32-Bit MS-DOS Application(s) lazarus / 21-General ---------------------------------------------------------------------- paule32 · 2025-06-13 11:12 Hello, does FPC for MS-DOS create executables in 16-Bit Mode or 32-Bit Mode ? under MS-DOS and working with the GNU C/C++ Compiler there was a DPMI Package that could be used to work with High Memory Parts by adding a Stub-File in Front of an a.out File. This a.out File was than a 32-Bit compiled binary Format. Is there a DPMI for FPC ? ---------------------------------------------------------------------- Thaddy · 2025-06-13 11:23 Yes, FPC supports dos extenders such as GO32V2 ---------------------------------------------------------------------- marcov · 2025-06-13 11:23 target "msdos" generates 16-bit binaries, and target "go32v2" generates 32-bit dpmi binaries for djgpp's go32 V2 extender. ---------------------------------------------------------------------- paule32 · 2025-06-13 16:51 I get Errors: T:\ap>fpc -Tmsdos test.pas Error: Illegal parameter: -Tmsdos T:\ap>fpc -Tgo32v2 test.pas Error: Illegal parameter: -Tmsdos This works: T:\ap>fpc -Tlinux test.pas T:\ap>fpc -Twin64 test.pas ---------------------------------------------------------------------- Thaddy · 2025-06-13 19:17 That is because you need to build the msdos cross-compiler and/or the Go32v2 cross-compiler first. ---------------------------------------------------------------------- PascalDragon · 2025-06-13 20:03 Quote from: paule32 on June 13, 2025, 06:51:38 pmT:\ap>fpc -Tmsdos test.pas Error: Illegal parameter: -Tmsdos For the msdos target you need the i8086 cross compiler (and then select it using -Pi8086) plus the units compiled for at least one of the memory models for i8086-msdos. Quote from: paule32 on June 13, 2025, 06:51:38 pmT:\ap>fpc -Tgo32v2 test.pas Error: Illegal parameter: -Tmsdos For the go32v2 target you need a i386 cross compiler (and then select it using -Pi386) plus the units compiled for i386-go32v2. ---------------------------------------------------------------------- paule32 · 2025-06-14 06:48 where can I download the package\win16 sources ? ---------------------------------------------------------------------- Thaddy · 2025-06-14 12:08 It is not a package it is the compiler sources. If you checkout main, you will have the sources already and building the cross compiler is simply as usual. While building the cross- compiler the packages that are registered for use with msdos will also be build. ---------------------------------------------------------------------- paule32 · 2025-06-15 08:05 thanks for your notes. when I compile a msdos application for win 3.11 how can I create a win16 application ? ---------------------------------------------------------------------- Thaddy · 2025-06-15 13:48 I do not see your point? If you have a VM with win 3.1 installed the software runs and you can even use the low-level API's from win 3.1. Don't expect Lazarus to work, though. Win 3.1 is still on top of msdos, unlike XP which is on top of NT4. ---------------------------------------------------------------------- marcov · 2025-06-15 13:54 Quote from: paule32 on June 15, 2025, 10:05:46 amthanks for your notes. when I compile a msdos application for win 3.11 how can I create a win16 application ? Msdos and win16 are separate targets. win16 is still in development in "main".  Maybe the wiki has more info about it. ---------------------------------------------------------------------- Thaddy · 2025-06-15 14:26 They are separate targets, Marco, but when 3.1.X is installed you can already write old school: using the API. It is not something to recommend to do unless you are really proficient in old school WinAPI. ---------------------------------------------------------------------- Mr.Madguy · 2025-06-15 14:31 There are other options: 1) Using HX DOS Extender, that is similar to Borland Power Pack, i.e. provides partial Win32 API emulation 2) Programming for Win32s, that provides partial 9x support on Win 3.1. ---------------------------------------------------------------------- marcov · 2025-06-15 14:32 Quote from: Thaddy on June 15, 2025, 04:26:42 pmThey are separate targets, Marco, but when 3.1.X is installed you can already write old school: using the API. Afaik you can acccess the API from dos via INT $2F, but for real winapi acces you need the win16 target. ---------------------------------------------------------------------- Mr.Madguy · 2025-06-15 14:52 See attachment for example of HX project. Things to notice: 1) Set CPU to i386 2) Create relocatable executable (-WR) 3) Don't use default heap/stack size (-Ch/-Cs) 4) Not 100% sure, but "Ignore unresolved imports" (DPMILDR=128) option can be required 5) Use PATCHPE.EXE, if you don't want to use HXLDR32.EXE ---------------------------------------------------------------------- Thaddy · 2025-06-15 14:57 Quote from: marcov on June 15, 2025, 04:32:36 pmQuote from: Thaddy on June 15, 2025, 04:26:42 pmThey are separate targets, Marco, but when 3.1.X is installed you can already write old school: using the API. Afaik you can acccess the API from dos via INT $2F, but for real winapi acces you need the win16 target. win 3.1 is not a kernel, nor an OS. you just need the dll's. ---------------------------------------------------------------------- PascalDragon · 2025-06-16 20:05 Quote from: paule32 on June 15, 2025, 10:05:46 amhow can I create a win16 application ? Look at the Wiki.