[fpc-pascal] FPC in DOS environment
Daniel Franzini
daniel.franzini at gmail.com
Thu Jan 11 17:37:27 CET 2007
On 1/11/07, Tomas Hajny <XHajT03 at mbox.vol.cz> 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 me....when 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
push bp
mov bp, sp
add bp, 8
push ds
mov bx, [bp]
mov ax, [bp+2]
mov ds, ax
mov cx, [bp+4]
mov dx, [bp+6]
mov al, [bp+8]
push bp
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'')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20070111/d23a1224/attachment.html>
More information about the fpc-pascal
mailing list