[fpc-pascal]DOS memory access via "absolute"

Florian Klaempfl Florian.Klaempfl at gmx.de
Sun Oct 1 22:26:09 CEST 2000


Sebastian Schuberth wrote:
> 
> Hi there!
> 
> Is anyone able to tell me why the following code plots the red pixel but
> not the blue one, 

absolute uses always addressing via FS, see below.

> and why the locking function does not work?

You don't have to lock memory, if you don't use interrupt handlers.

> 
> ----8<----
> Program Test;
> 
> Uses
>   CRT,GO32;
> 
> Var
>   Screen:Array[0..199,0..319] Of Byte Absolute $A0000;
> 
> Begin
>   WriteLn(lock_linear_region($A0000,320*200));
> 
>   ReadKey;
>   Asm
>     mov eax,13h
>     int 10h
>   End;
> 
>   Screen[0,0]:=1; { blue pixel }
>   Mem[$A0001]:=12; { red pixel }

Use Mem[$a000:0001] instead.
FPC uses some tricks to access dos memory (it is done via the fs selector).




More information about the fpc-pascal mailing list