[fpc-pascal] FPC in DOS environment

Daniël Mantione daniel.mantione at freepascal.org
Thu Jan 11 21:42:40 CET 2007



Op Thu, 11 Jan 2007, schreef Daniel Franzini:

> On 1/11/07, Daniël Mantione <daniel.mantione at freepascal.org> wrote:
> > This the situation:
> > * The Dos port is without a maintainer.
> > * We are still providing it because many people have need for a Dos
> > version
> > * Bugs in the Dos port are not being fixed so it is of poor quality.
> 
> well, if so i'm a volunteer to mantain the DOS port...

Well, help is certainly very welcome, but note that more is needed than 
one or two bug fixes. To make it a first platform again someone is needed 
who really uses Dos, so he quickly notes when something is wrong and can 
make some new developments available on the Dos platform.

> Yes, it is a protected mode app, using the go32v2 extender. You need a
> > dpmi service on your system. Normally on real Dos you use cwsdpmi, but
> > any
> > DPMI will do. However, WinNT/2000/XP is troublesome because their DPMI
> > support
> > is buggy.

> i was not trying to use it in win nt/xp/2000...its freedos inside a MS
> Virtual PC....since i don't have a pentium 100 or a 486 i cannot test this
> on a real machine...

Ok, so it is real DPMI. Since it can run OS/2 I think VPC should be of 
sufficient quality to run a Dos extender but note that many virtual 
machines don't a PC emulate good enough and can be expected to cause some 
trouble here. I'm not saying this is the case here, but you shouldn't 
put limitless trust in your VM either.

> > go32v2 is the extender, cwsdpmi the dpmi host that comes with it. So you
> > have used go32v2 before, and the procedure is the same with FPC programs.

> ok...when exactly the go32v2 gets linked with my code? is this done
> automatically by the compiler???

Yes.

> 
> The code you should contains 16 bit assembler. FPC is a 32 bit
> > application. So the assembler needs to be rewritten in 32-bit assembler.
> > Other than that, FPC is compatible with TP. So, just put the compiler in
> > TP mode an compile.

> thanks
> 
> can this be compiled directly in a 32bit assembler like nasm (or directly
> assembled by the fpc internal assembler using directives to use asm inside
> pascal source)????

I suggest to use the internal assembler.

> i was also looking for a way to rewrite this in clean Pascal language...is
> this possible in pmode using fpc (note the code contains an interrupt call
> for a low level operation)???

You should check the go32 extender documentation wether it supports 
interrupt 26. If yes, the port will be easy, you can just update the code 
using 32 bit registers (i.e. ebp instead of bp).

If not, it is harder: you should allocate real mode memory, copy data to 
real mode and do a real mode interrupt. The go32 contains the procedures 
to do this.

Daniël


More information about the fpc-pascal mailing list