I am thinking about using FreePascal to write programs for DOS. Writing an "hello world" program in FreePascal for 32 bit DOS (Go32) is easy, because the fpc package can be installed with fdimples from the Live installer.
But there is no 16 bit FreePascal directly for DOS. So one have to used some other OS like Windows or Linux, and use a FreePascal cross-compiler to 80186 16 bit DOS. I say 80186, because this is the precompiled version, you would have to compile your own cross-compiler for like 386 16 bit DOS. And now I am realizing that 80186 is kind of too advanced for FreeDos that prefer 8086... but I think the older FreePascal can do is 80186. It has been a little bit hard to obtain my first hello.exe file from hello.pas file... so I am writing this to share, and as a memory helper for a later day. I am using Fedora 38 (beta) and will follow a path that match that... sorry for other distros users. Fedora have fpc as a package, but not the cross-compiler to FreeDOS. So I had to download it from: https://sourceforge.net/projects/freepascal/files/Linux/3.2.2/ More precisely for me: https://master.dl.sourceforge.net/project/freepascal/msdos/3.2.2/fpc-i8086-msdos-3.2.2-1.x86_64.rpm?viasf=1 I did intall it with: sudo dnf fpc-i8086-msdos-3.2.2-1.x86_64.rpm which installed it with the fpc from Fedora as a dependency. It is not possible to list the files in that cross compiler with: dnf repoquery -l fpc-i8086-msdos-3.2.2-1 because it is not in Fedora repositories, so I had to use: repoquery -l fpc-i8086-msdos-3.2.2-1 Rather than using fpc to compile a .pas file, you use: ppcross8086 as describe in: https://wiki.freepascal.org/DOS which is not too clear, that's why I am writing this. Using -vt to show the files that the cross-compiler try to open, I had figure out that it search in different place the config file for fpc, called fpc.cfg: in /lib64/fpc/etc/fpc.cfg (was at my first try /lib/fpc/etc/fpc.cfg), then in ~/.fpc.cfg then in /etc/fpc.cfg So basically, I "cp /etc/fpc.cfg ~/.fpc.cfg" then "nano ~/.fpc.cfg" edit it. I'll show you the full file... even if I think I might have damage it a bit in the long day: [paul@fedora mypas]$ cat ~/.fpc.cfg ================ BEGIN ========================== # Automatically created file, don't edit. #ifdef cpui8086 -CX -XX -XP #endif # -Fu/usr/lib/fpc/$fpcversion\units\msdos/$fpctarget # -Fu/usr/lib/fpc/$fpcversion\units\msdos/$fpctarget\* #-Fu/usr/lib64/fpc/3.2.2/units/msdos/80186-medium/rtl/ #-Fu/chien/salivant #IFDEF CPUI8086 -Fu/usr/lib64/fpc/$fpcversion/units/msdos/80186-$fpcmemorymodel -Fu/usr/lib64/fpc/$fpcversion/units/msdos/80186-$fpcmemorymodel/* -Fu/usr/lib64/fpc/$fpcversion/units/msdos/80186-$fpcmemorymodel/rtl #ELSE -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/* -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl #ENDIF #IFDEF NORMAL -TLinux -Mfpc -Sg -Ci -CX -CpATHLON64 -OpATHLON64 -XS -g- -p- -b- -XP -O1 #ENDIF #IFDEF DEBUG -TLinux -Mfpc -Sg -Cr -Ci -Co -CpATHLON64 -OpATHLON64 # -Fu/usr/lib/fpc/$fpcversion\units\msdos/$fpctarget # -Fu/usr/lib/fpc/$fpcversion\units\msdos/$fpctarget\* # -Fu/usr/lib/fpc/$fpcversion\units\msdos/$fpctarget\rtl -XS -g -p- -b- #ENDIF #IFDEF RELEASE -TLinux -Mfpc -Sg -CpATHLON64 -OpATHLON64 # -Fu/usr/lib64/fpc/$fpcversion\units\$fpctarget # -Fu/usr/lib64/fpc/$fpcversion\units\$fpctarget\* # -Fu/usr/lib64/fpc/$fpcversion\units\$fpctarget\rtl -XS -g- -p- -b- -O2 #ENDIF ========================= END ================================ With that I was able to compile hello.pas file: [paul@fedora mypas]$ cat hello.pas program hello; begin writeln('Hello!'); end. [paul@fedora mypas]$ with: [paul@fedora mypas]$ ppcross8086 -WmTiny -Wtcom hello.pas [paul@fedora mypas]$ ls -lh total 240K -rw-r--r--. 1 paul paul 1,6K 19 mar 23:54 crosscompile.txt -rw-r--r--. 1 paul paul 841 19 mar 20:25 fp.cfg.old -rwxr-xr-x. 1 paul paul 187K 19 mar 20:33 hello -rw-r--r--. 1 paul paul 4,0K 20 mar 00:06 hello.a -rwxr-xr-x. 1 paul paul 13K 20 mar 00:06 hello.com -rwxr-xr-x. 1 paul paul 15K 19 mar 23:23 hello.exe -rw-r--r--. 1 paul paul 1,2K 19 mar 23:14 hello.o -rw-r--r--. 1 paul paul 48 19 mar 17:01 hello.pas [paul@fedora mypas]$ or other commands: ppcross8086 -WmTiny -Wtcom hello.pas ppcross8086 -WmTiny -Wtexe hello.pas ppcross8086 -WmSmall hello.pas ppcross8086 -WmMedium hello.pas ppcross8086 -WmCompact hello.pas ppcross8086 -WmLarge hello.pas ppcross8086 -WmHuge hello.pas Hope it might help someone some day! _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel