0x03 // Bootstrapping a Free Pascal Environment for BBS Development

Now we can finally start coding! Sort of... Since the goal is to be able to compile on, or for, many generations and flavors of operating systems we're going to need a lot of tools for a lot of systems. While I've dabbled in "Edit" on MS-DOS (Microsoft Disk Operating System) already to prove to myself I have a chance at this (and successfully controlled a modem), we're switching gears this week and setting up a development environment on a modern Windows 10/11 system.
Why? Well that's what we've been configuring the last few weeks, and if you want to continue to follow along (source code soon!) you'll be able to without buying a bunch of vintage computing hardware.
Ok let's roll.
You'll need to install Free Pascal from the official Downloads section. There are quite a few options as you will see. Follow the path for AMD64/Intel 64/x86_64 > Windows 64-bit and ultimately download fpc-3.2.2.win32.and.win64.exe. Go ahead and install that.
During installation you will find that it also installs it's own text mode IDE (Integrated Development Environment). Let's explore! Find the Free Pascal IDE icon on your desktop and open it. Very retro and appropriate. We'll start with this IDE as it's already ready to compile code.

Despite it's appearance, it does in fact support the mouse. Go ahead and create a new file via File > New.
Type or copy the following code into the editor:
program Hello;
begin
writeln ('Hello, world.');
readln;
end.
Save it as hello.pas and then select Compile > Compile.
If you typed in the code correctly, your screen should look like mine below.

You can see the program compiled successfully and targeted Win32 for i386. That will get us a long way.
Try running it, either by selecting Run > Run or double clicking on hello.exe which was generated in the same directory as the file you saved earlier. You should see the output below.

Congratulations! If you've never coded before, you've successfully written you first, and most classic "Hello world" program. Nice work.
Oh and, "readln" is waiting for you to press enter to exit.
Back in the editor select Compile > Target. Check out all those beautiful options. We aren't going there yet, but GO32 V2 DOS Extender is the magic that will allow us to compile for MS-DOS. You can also see OS/2 is listed. There's quite a few targets to explore in future issues. You know you're an uber nerd if you are excited as I am about such a cryptic list.

While this IDE will get us started it will quickly grow cumbersome. I'd recommend you explore a couple of additional software options and find what fits your style best.
One IDE worthy of exploring, is Lazarus. What's Lazarus you ask? Well, Lazarus is a modern cross-platform IDE for Free Pascal! Lazarus and Free Pascal strive for write once compile anywhere. Since the exact same compiler is available on Linux, Windows, macOS, FreeBSD (and more!) platforms it means you don't need to do any recoding to produce identical products for different platforms.
Also, check out Visual Studio Code. It's an open source editor created by Microsoft. Somewhat, but not exactly a spiritual successor to Visual Studio. It's capable of supporting any language you'd want to code now or in the future and is very extendable through plugins (they call them extensions). That's great for us as while Free Pascal is the focus today it may become necessary that we dabble in other languages as we explore and support different aspects of the scene.
Those are both worth your time, but my fight 'til the death editor of choice is and will continue to be Neovim. It, or its cousins, have plugins and support across pretty much every platform I'll be targeting. It's something you can most definitely explore on your own, and I may write about in a future issue. But I don't dare challenging you with setting up (and exiting) such a puzzle today. Proceed at your own risk!
Any Pascal developers following along? What are your recommendations for IDEs and plugins? Drop a comment below!
[Esc] → :wq
That's it for this week. If you don't hear from me, I probably have headphones on coding like a madman, fiddling with modem connections strings... or I might just be stuck in Vim. Who knows.
Want to "read ahead"? Start peaking at serial communications in Free Pascal. Code is going to be different for every generation of operating system so there's a lot of research to be done.
And if you are enjoying these articles, don't forget about the entry level paid tier, Call Me Maybe. You've got a phone, I've got an answering machine. Want to call it? Bump up that membership and I'll email you the number for the comment line.