Recent

Author Topic: 32-Bit MS-DOS Application(s)  (Read 1200 times)

paule32

  • Hero Member
  • *****
  • Posts: 563
  • One in all. But, not all in one.
32-Bit MS-DOS Application(s)
« on: June 13, 2025, 01:12:09 pm »
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 ?
MS-IIS - Internet Information Server, Apache, PHP/HTML/CSS, MinGW-32/64 MSys2 GNU C/C++ 13 (-stdc++20), FPC 3.2.2
A Friend in need, is a Friend indeed.

Thaddy

  • Hero Member
  • *****
  • Posts: 17396
  • Ceterum censeo Trump esse delendam
Re: 32-Bit MS-DOS Application(s)
« Reply #1 on: June 13, 2025, 01:23:26 pm »
Yes, FPC supports dos extenders such as GO32V2
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12311
  • FPC developer.
Re: 32-Bit MS-DOS Application(s)
« Reply #2 on: June 13, 2025, 01:23:34 pm »
target "msdos" generates 16-bit binaries, and target "go32v2" generates 32-bit dpmi binaries for djgpp's go32 V2 extender.

paule32

  • Hero Member
  • *****
  • Posts: 563
  • One in all. But, not all in one.
Re: 32-Bit MS-DOS Application(s)
« Reply #3 on: June 13, 2025, 06:51:38 pm »
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
MS-IIS - Internet Information Server, Apache, PHP/HTML/CSS, MinGW-32/64 MSys2 GNU C/C++ 13 (-stdc++20), FPC 3.2.2
A Friend in need, is a Friend indeed.

Thaddy

  • Hero Member
  • *****
  • Posts: 17396
  • Ceterum censeo Trump esse delendam
Re: 32-Bit MS-DOS Application(s)
« Reply #4 on: June 13, 2025, 09:17:53 pm »
That is because you need to build the msdos cross-compiler and/or the Go32v2 cross-compiler first.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

PascalDragon

  • Hero Member
  • *****
  • Posts: 6035
  • Compiler Developer
Re: 32-Bit MS-DOS Application(s)
« Reply #5 on: June 13, 2025, 10:03:30 pm »
T:\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.

T:\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

  • Hero Member
  • *****
  • Posts: 563
  • One in all. But, not all in one.
Re: 32-Bit MS-DOS Application(s)
« Reply #6 on: June 14, 2025, 08:48:19 am »
where can I download the package\win16 sources ?
MS-IIS - Internet Information Server, Apache, PHP/HTML/CSS, MinGW-32/64 MSys2 GNU C/C++ 13 (-stdc++20), FPC 3.2.2
A Friend in need, is a Friend indeed.

Thaddy

  • Hero Member
  • *****
  • Posts: 17396
  • Ceterum censeo Trump esse delendam
Re: 32-Bit MS-DOS Application(s)
« Reply #7 on: June 14, 2025, 02:08:02 pm »
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.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

paule32

  • Hero Member
  • *****
  • Posts: 563
  • One in all. But, not all in one.
Re: 32-Bit MS-DOS Application(s)
« Reply #8 on: June 15, 2025, 10:05:46 am »
thanks for your notes.
when I compile a msdos application for win 3.11
how can I create a win16 application ?
MS-IIS - Internet Information Server, Apache, PHP/HTML/CSS, MinGW-32/64 MSys2 GNU C/C++ 13 (-stdc++20), FPC 3.2.2
A Friend in need, is a Friend indeed.

Thaddy

  • Hero Member
  • *****
  • Posts: 17396
  • Ceterum censeo Trump esse delendam
Re: 32-Bit MS-DOS Application(s)
« Reply #9 on: June 15, 2025, 03:48:11 pm »
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.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12311
  • FPC developer.
Re: 32-Bit MS-DOS Application(s)
« Reply #10 on: June 15, 2025, 03:54:49 pm »
thanks 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

  • Hero Member
  • *****
  • Posts: 17396
  • Ceterum censeo Trump esse delendam
Re: 32-Bit MS-DOS Application(s)
« Reply #11 on: June 15, 2025, 04:26:42 pm »
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.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 873
Re: 32-Bit MS-DOS Application(s)
« Reply #12 on: June 15, 2025, 04:31:48 pm »
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.
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12311
  • FPC developer.
Re: 32-Bit MS-DOS Application(s)
« Reply #13 on: June 15, 2025, 04:32:36 pm »
They 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

  • Hero Member
  • *****
  • Posts: 873
Re: 32-Bit MS-DOS Application(s)
« Reply #14 on: June 15, 2025, 04:52:51 pm »
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
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

 

TinyPortal © 2005-2018