[fpc-pascal] FPC in DOS environment

2007-01-11 Thread 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.

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


$6E8F


$6ED0


$22E3


$279E

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?

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?

3.) in other machine i tried and compiled the code but got some strange
results (i can post as soon as a i get home and reach that machine). here is
the code:
---code
start---
program DiskExplorer;

uses crt, dos;

const
   BUFLEN = 4608;
   BUFSECT = 9;
   COMMANDX = 1;
   COMMANDY = 20;
   COMMAND_RT = 79;
   COMMAND_BOT = 24;
   STATUSX = 1;
   STATUSY = 18;
   STATUS_RT = 79;
   STATUS_BOT = 19;
   LEFTSCREEN = 1;
   RIGHTSCREEN = 80;
   TOPSCREEN = 1;
   BOTTOMSCREEN = 17;
   ERROR = -1;

type
   buf = array[0..BUFLEN] of byte;

var
   finished: boolean;
   drive: byte;
   sector: integer;
   buffer: buf;
   regs: Registers;

function DiskRead(drive: byte; sector, n_sectors: integer; var buffer: buf):
integer;
begin
   inline($55/
{this assembly code does nothing more than saving correct stuff, executes
DOS}
  $8B/$EC/
{interrupts for read/write the disk, restores stuff, flushes DOS buffer and
exits }
  $83/$C5/$08/
  $1E/
  $8B/$5E/$00/
  $8B/$46/$02/
  $8E/$D8/
  $8B/$4E/$04/
  $8B/$56/$06/
  $8A/$46/$08/
  $55/
  $CD/$25/
  $73/$08/
  $9D/
  $5D/
  $89/$46/$0A/
  $EB/$08/$90/
  $9D/
  $5D/
  $33/$C0/
  $89/$46/$0A/
  $1F/
  $5D);
end;


function DiskWrite(drive: byte; sector, n_sectors: integer; var buffer:
buf): integer;
begin
   inline($55/
  $8B/$EC/
  $83/$C5/$08/
  $1E/
  $8B/$5E/$00/
  $8B/$46/$02/
  $8E/$D8/
  $8B/$4E/$04/
  $8B/$56/$06/
  $8A/$46/$08/
  $55/
  $CD/$26/
  $73/$08/
  $9D/
  $5D/
  $89/$46/$0A/
  $EB/$08/$90/
  $9D/
  $5D/
  $33/$C0/
  $89/$46/$0A/
  $1F/
  $5D);
   regs.ax := $D00;
   intr($21, regs);
end;


procedure Beep;
begin
   sound(400);
   delay(500);
   sound(300);
   delay(500);
   nosound;
end;

procedure DisplayStartScreen;
begin
   clrscr;
   window(1,1,80,25);
   writeln('=Disk Examiner=');
   writeln;
   writeln;
   writeln;
   writeln;
   writeln('---MAIN MENU---');
   writeln('F1: Dump and modify sectors');
   writeln;
   writeln('F10: Exit');
end;


{ main routine }
begin
   drive := 0;
   sector := 0;
   finished := false;
   while not finished do
   begin
   DisplayStartScreen;
   regs.ax := 0;
   intr($16, regs);
   if regs.ax and $ff = 0 then
   begin
   clrscr;
   case (regs.ax) of
   $4400: finished := true;
   end;
   end;
   end;
end.
---code
end---

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?!

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



--
Daniel

"Let us change our traditional attitude to the construction of programs.
Instead of imagining that our main task is to instruct a computer what to
do, let us concentrate rather on explaining to human beings what we want a
computer to do." (Donald Knuth)

"Ye

Re: [fpc-pascal] FPC in DOS environment

2007-01-11 Thread Daniël Mantione


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
> $6E8F
> $6ED0
> $22E3
> $279E
> 
> 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___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC in DOS environment

2007-01-11 Thread Jonas Maebe


On 11 jan 2007, at 10:14, Daniël Mantione 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.


That's not true anymore since Pierre is back.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC in DOS environment

2007-01-11 Thread Tomas Hajny
Daniel Franzini wrote:


Hi Daniel,

> i'm trying to use fpc in a old DOS environment by using FreeDOS inside
> Virtual PC (guess i should be using vmware)

I've had difficulties running FPC apps (probably including the compiler
itself) under FreeDOS in the past (whereas it works properly with other
DOS implementations like MS-DOS, IBM PC DOS and DR-DOS/Novell DOS). Things
might have improved since then, though.


> 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.
 .
 .
> 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?

GO32v2 is a protected mode application, indeed - specifically, it's using
DPMI (DOS Protected Mode Interface). No special extender is needed if you
already have DPMI host available (up and running). Some DOS
implementations already include this such DPMI host, similarly DPMI host
is provided for DOS applications running under Win 3.x, Win32 platforms,
OS/2, etc. If you run GO32v2 applications and no DPMI host is running, the
loader/stub (linked into the compiled executable) tries to locate (using
standard search rules - current directory and then using %PATH%) and
launch CWSDPMI.EXE first (thus starting a DPMI host itself).


> 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?

I guess the description above should be sufficient. Alternatively, you can
bind the DPMI host directly into the executable (using tools provided
within the standard CWSDPMI package), but this is of limited use in
general (only reasonable if having single GO32v2 executable on a DOS
machine with no DPMI host).


> 3.) in other machine i tried and compiled the code but got some strange
> results (i can post as soon as a i get home and reach that machine). here
> is
> the code:
 .
 .
> function DiskRead(drive: byte; sector, n_sectors: integer; var buffer:
> buf):
> integer;
> begin
> inline($55/
 .
 .
> {this assembly code does nothing more than saving correct stuff, executes
> DOS}
 .
 .

Surely, this inline stuff needs to be disassembled and ported to a 32-bit
protected mode environment in order to make it to work properly with FPC.


> 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?!

Rewrite it in proper 32-bit assembler targetted for a protected mode
environment. I guess you should be able to find some information available
on Internet regarding what needs to be changed and how, but it isn't that
simple to be described here (especially with functions requiring a memory
buffer shared between real mode and protected mode code like with your
disk read/write functions).


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

I guess that it's easier to discuss the particular example you tried
directly if you post it here.

Tomas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] low level disk access under Windows

2007-01-11 Thread Daniel Franzini

well

i did not wrote any code like this yet...but i do know that the so-called
rawwrite tool used for writing images of boot floppies in windowz env is
written in delphi (7 at the moment)...

since the sources are open you can browse around and see how things get done

http://www.chrysocome.net/rawwrite

On 10/6/06, Pianoman <[EMAIL PROTECTED]> wrote:


Hello, I'd like to ask if someone has experiences with low level
disk operations in windows with FPC.
The program should be able to copy entire diskete to one single image file
and for example extract a single file from that image or view its
contents.

For example how can I read one sector from disk in to buffer?
Thanx for help
Pianoman





--
Daniel

"Let us change our traditional attitude to the construction of programs.
Instead of imagining that our main task is to instruct a computer what to
do, let us concentrate rather on explaining to human beings what we want a
computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (
http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while
I'm not good at painting, drawing, or music, I can write software."
(Yukihiro Matsumoto, a.k.a. ``Matz'')
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC in DOS environment

2007-01-11 Thread Daniel Franzini

On 1/11/07, Daniël Mantione <[EMAIL PROTECTED]> 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...

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 PCsince i don't have a pentium 100 or a 486 i cannot test this
on a real machine...



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???

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 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)???

here is the small assembly source that generates the code i posted:

--code start-

   {diskwrite}
   asm
   pushbp
   mov bp, sp
   add bp, 8
   pushds
   mov bx, [bp]
   mov ax, [bp+2]
   mov ds, ax
   mov cx, [bp+4]
   mov dx, [bp+6]
   mov al, [bp+8]
   pushbp
   int 26h
   jnc ok
   popf
   pop bp
   mov [bp+10], ax
   jmp cont
   ok: popf
   pop bp
   xor ax, ax
   mov [bp+10], ax
   cont:   pop ds
   pop bp
   mov ax, 13h
   int 21h
   ret
--code end-



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

documented.



sorry...my bad about this...reading the manuals right now, while writing
this


Daniël


Daniel
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC in DOS environment

2007-01-11 Thread Daniel Franzini

welllike i said before, i'm a volunteer to mantain the port...if Pierre
does need some sort of help he can call me

On 1/11/07, Jonas Maebe <[EMAIL PROTECTED]> wrote:



On 11 jan 2007, at 10:14, Daniël Mantione 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.

That's not true anymore since Pierre is back.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal





--
Daniel

"Let us change our traditional attitude to the construction of programs.
Instead of imagining that our main task is to instruct a computer what to
do, let us concentrate rather on explaining to human beings what we want a
computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (
http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while
I'm not good at painting, drawing, or music, I can write software."
(Yukihiro Matsumoto, a.k.a. ``Matz'')
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC in DOS environment

2007-01-11 Thread Daniel Franzini

On 1/11/07, Tomas Hajny <[EMAIL PROTECTED]> wrote:


Daniel Franzini wrote:


Hi Daniel,



Hi



I've had difficulties running FPC apps (probably including the compiler
itself) under FreeDOS in the past (whereas it works properly with other
DOS implementations like MS-DOS, IBM PC DOS and DR-DOS/Novell DOS). Things
might have improved since then, though.



the compiler does run fine here...i think things got better now, since fpc
is now part of the oficial freedos 1.0 packages...things that annoy me in
freedos are a bug in setedit which makes the mouse gets crazy and the fact
that i could not yet set up my keyboard correctly...the rest does run fine
here...




GO32v2 is a protected mode application, indeed - specifically, it's using
DPMI (DOS Protected Mode Interface). No special extender is needed if you
already have DPMI host available (up and running). Some DOS
implementations already include this such DPMI host, similarly DPMI host
is provided for DOS applications running under Win 3.x, Win32 platforms,
OS/2, etc. If you run GO32v2 applications and no DPMI host is running, the
loader/stub (linked into the compiled executable) tries to locate (using
standard search rules - current directory and then using %PATH%) and
launch CWSDPMI.EXE first (thus starting a DPMI host itself).



this is something still obscure to mewhen i target the compiler to
go32v2, the compiler generates my code and links it with some magic code in
order to work correctly with the funtions provided by the host (which in the
general case is a standalone exe)???



I guess the description above should be sufficient. Alternatively, you can
bind the DPMI host directly into the executable (using tools provided
within the standard CWSDPMI package), but this is of limited use in
general (only reasonable if having single GO32v2 executable on a DOS
machine with no DPMI host).



i guess i should look for the DPMI host documentation on freedos in order to
find out what host it is, if its enabled by default and how to
enable/disable it...but thanks anyway



Surely, this inline stuff needs to be disassembled and ported to a 32-bit
protected mode environment in order to make it to work properly with FPC.



the code that generates is here:
--code start-

   {diskwrite}
   asm
   pushbp
   mov bp, sp
   add bp, 8
   pushds
   mov bx, [bp]
   mov ax, [bp+2]
   mov ds, ax
   mov cx, [bp+4]
   mov dx, [bp+6]
   mov al, [bp+8]
   pushbp
   int 26h
   jnc ok
   popf
   pop bp
   mov [bp+10], ax
   jmp cont
   ok: popf
   pop bp
   xor ax, ax
   mov [bp+10], ax
   cont:   pop ds
   pop bp
   mov ax, 13h
   int 21h
   ret
--code end-



Rewrite it in proper 32-bit assembler targetted for a protected mode
environment. I guess you should be able to find some information available
on Internet regarding what needs to be changed and how, but it isn't that
simple to be described here (especially with functions requiring a memory
buffer shared between real mode and protected mode code like with your
disk read/write functions).



like i said to Daniel Mantionne, the plans are to rewrite it in pure
pascal...but it should work first in 32bit assembly...what would be the main
differences between the two asm sources??



I guess that it's easier to discuss the particular example you tried
directly if you post it here.

Tomas



thanks

--
Daniel

"Let us change our traditional attitude to the construction of programs.
Instead of imagining that our main task is to instruct a computer what to
do, let us concentrate rather on explaining to human beings what we want a
computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (
http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while
I'm not good at painting, drawing, or music, I can write software."
(Yukihiro Matsumoto, a.k.a. ``Matz'')
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] FP IDE in DOS env

2007-01-11 Thread Daniel Franzini

I'm trying to write some pascal code on a DOS env (FreeDOS 1.0). Is the IDE
for this plataform mantained?! The command line compiler does run fine, but
the IDE shows up and quickly disapears.

Has anyone suffered this before?!!??

--
Daniel

"Let us change our traditional attitude to the construction of programs.
Instead of imagining that our main task is to instruct a computer what to
do, let us concentrate rather on explaining to human beings what we want a
computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (
http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while
I'm not good at painting, drawing, or music, I can write software."
(Yukihiro Matsumoto, a.k.a. ``Matz'')
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How can i detect what cause the problem

2007-01-11 Thread Daniel Franzini

this happens because windows API code usually have two versions: an Ascii
version where chars are 8-bit ASCII (with the suffix A, and used mainly in
9x code) and other where the chars are 2-byte unicode chars with the W
suffix, used mainly in 2000/XP stuff (guess W means wide in the sense of
widestring)

On 11/14/06, Gabor Boros <[EMAIL PROTECTED]> wrote:


Many thanks Felipe, the problem is the exported name(s).
The exported names is SCAN_AllocateBuffer_A and SCAN_AllocateBuffer_W.

Thanks again!

Gabor

Felipe Monteiro de Carvalho írta:
> Can you show us the c declaration of the function you are calling? It
> should be on a .h file.
>
> Also, you should put an way to verify if the calls are working, like:
>
>DLL_Handle:=LoadLibrary('SCNAPI32.DLL');
>
>if DLL_Handle = nil then raise EException.Create('Could not load
> library');
>
>Pointer(SCAN_AllocateBuffer):=GetProcedureAddress(DLL_Handle,
> 'SCAN_AllocateBuffer');
>
>if Pointer(SCAN_AllocateBuffer) = nil then raise
> EException.Create('Could not load procedure');
>
> One possibility is that this C library uses name mangling, and the
> function has a different name from the canonical one. You can check
> all function names exported by the function using this software:
>
> http://wiki.lazarus.freepascal.org/Libview
>

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal





--
Daniel

"Let us change our traditional attitude to the construction of programs.
Instead of imagining that our main task is to instruct a computer what to
do, let us concentrate rather on explaining to human beings what we want a
computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (
http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while
I'm not good at painting, drawing, or music, I can write software."
(Yukihiro Matsumoto, a.k.a. ``Matz'')
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FP IDE in DOS env

2007-01-11 Thread Daniël Mantione


Op Thu, 11 Jan 2007, schreef Daniel Franzini:

> I'm trying to write some pascal code on a DOS env (FreeDOS 1.0). Is the IDE
> for this plataform mantained?! The command line compiler does run fine, but
> the IDE shows up and quickly disapears.
> 
> Has anyone suffered this before?!!??

I don't know about this particular issue, but the general story applies 
here: The 2.0.2 IDE is very crash prone. 2.0.4 is better, but far from 
bug free. No 2.0 compiler has a working debugger.

However, as Jonas said, Pierre has done some work on the Dos compiler, 
and he got the debugger working. You might want to download a snapshot and 
check if that works better. If you want a better Dos release, I'd say 
now is the time to act: if you can help Pierre identify bugs and 
possible solutions we can perhaps do Dos update for the currect 
compiler soon.

Daniël___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC in DOS environment

2007-01-11 Thread Daniël Mantione


Op Thu, 11 Jan 2007, schreef Daniel Franzini:

> On 1/11/07, Daniël Mantione <[EMAIL PROTECTED]> 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 PCsince 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___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal