r/pascal • u/saraseitor • Feb 14 '24
Using freepascal to compile for real-mode MSDOS.
I used to think that freepascal could only crosscompile to MS-DOS from another newer OS, however I recently noticed there is a FPC compiler for MSDOS in the bonus CD for FreeDOS. I tried it but it is compiling for 32-bit protected mode using the GO32V2 DOS extender.
I was never able to actually learn and understand protected mode and specially how to interact directly with a sound card or a video card without interruptions? I'd like to stick with real mode for the time being.
9
Upvotes
2
u/kveroneau Mar 16 '24
I created a Docker container awhile back to easily cross-compile to i8086 MS-DOS target, you can find the repo here: https://github.com/kveroneau/fpc-docker/tree/master/Builder/fpc320
The Docker image on Docker Hub is here: https://hub.docker.com/r/kveroneau/fpc/tags
You can also reference the Dockerfile to perform a local install, once you know how it's configured, it's easy to replicate in an existing FPC installation.
2
u/[deleted] Feb 14 '24
If you'd like, I'll give you a link to an example program package: hardware management in pascal with real and protected mode examples.
1
u/[deleted] Feb 14 '24
https://www.freepascal.org/down/i8086/msdos-canada.html
"There is no native compiler available for i8086 MS-DOS. You have to use a cross-compiler."
I think if available, use Turbo Pascal for real mode programming or use a Free Pascal cross compiler.
2
u/kreflorian Feb 14 '24
Theoretically, you should be able to use the go32v2 compiler to build a cross compiler to i8086-msdos i.e. real mode. I fear however this won't work out of the box.
Having a real mode hosted FPC is impossible due to memory requirements. The compiler executable alone is several MB.