According to Orlando Llanes:
I know this has been asked over and over again, but I promise I've tried what I've been told and have even read FAQs.
Did you also look at the GPC assembler documentation?
ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/contrib/gpcasm.zip
Does anyone have any working code to access the VGA segment using only a base address? I'm looking to see if it's possible to access the VGA segment without having to load a segment register under GPC's asm().
There is no chance to access the VGA memory without - explicitly or implicitly - loading a segment (selector) register.
The best thing you can do - if possible; I didn't check - is to let GPC move the value $A000 to the segment register rather than doing that yourself with an explicit `movw %ax, %gs' (or whatever) asm statement. Consult the "gpcasm" manual (URL above) for how to do such things.
(* Please note that that segment register will *not* get "clobbered" by the asm statement. If you use several `asm's in sequence that all want to have $A000 in `%gs', an optimizing GPC will move it only once. *)
I tried the following code
... asm( 'movl $0xA0000, %edi' ); asm( 'addl $1000, %edi' ); asm( 'movb $15, (%edi)' ); ...
No chance without a selector prefix.
asm ( 'moveb %0, gs:(%1)' : (* no output *) : 'r' ( <source byte> ), 'r' ( <destination offset> ) );
and even the following code:
VGASel := SegToSelector( $A000 ); GetSegmentBase( VGASel, VGABase ); ... asm( 'movl %0, %%edi' : '=m' (VGABase) ); asm( 'addl $1000, %edi' ); asm( 'movb $15, (%edi)' ); ...
This cannot work unless you have a selector for memory address 0 somewhere - which I don't see.
Good luck,
Peter -- Peter Gerwinski, Essen, Germany, free physicist and programmer Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - 1 Oct 1997 PGP key fingerprint: AC 6C 94 45 BE 28 A4 96 0E CC E9 12 47 25 82 75 Fight the SPAM! - http://maps.vix.com/