[fpc-pascal] FPC in DOS environment

Daniël Mantione daniel.mantione at freepascal.org
Thu Jan 11 10:14:04 CET 2007



Op Wed, 10 Jan 2007, schreef Daniel Franzini:

> Hi all
> 
> i'm trying to use fpc in a old DOS environment by using FreeDOS inside
> Virtual PC (guess i should be using vmware)
> 
> the problem is that i have some low-level code which i would like to port to
> fpc. FreeDOS came with fpc 2.0.2 which i think is suitable for my needs.

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.
 
> 1.) i can't even compile the code
> ----------------------start-------------------------------
> C:\>cd
> code
> C:\code>fpc diskexp.pas
> 
> An unhandled exception occurred at $0001072C
> :
> EAccessViolation : Access
> violation
> $0001072C
> $00010752
> $00010CC0
> $00010D13
> $000100A8
> $00006E8F
> $00006ED0
> $000022E3
> $0000279E
> 
> ----------------------------end------------------------
> 
> the strange thing is that if i call fpc without parameters the (huge) usage
> shows up correctly...is fpc for go32v2 a pmode app? which extender do you
> recommend me to use?

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.
 
> 2.) i have some questions regarding pmode programming with fpc since i never
> used go32v2. with cwsdpmi, one compiles and links, getting an exe and this
> exe should be put in the same folder of cwsdpmi.exe. what's the general
> procedure for go32v2?

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.

> this code compiles fine with tp5.5 (altough the window function does not
> work)...what is the correct way to make such a thing in fpc?!

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.

> how to mix assembly with fpc in the same procedure/function? i tried but it
> complained about the labels

Local labels need to start with a @. Please read the manuals, this is well 
documented.

Daniël


More information about the fpc-pascal mailing list