You can try the code below. The assembly should all be the same, not sure about the memory addressing in Linux though? It may crash sommething, but if not I can give you a whole graphics unit.
USES Crt, Dos;
{ Draws a rectangle with Top-Left corner at X,Y and a size of Width*Height in COLOR on WHERE screen }
PROCEDURE Rectangle(X, Y, Width, Height : Word; Color : Byte; Where : Word);
Begin
For Y := Y to (Y + Height) Do
For X := X to (X + Width) Do
Mem[Where: X + Y*320] := Color;
End;
CONST
Text = $B800;
VGA = $A000; { Memory location of the VGA screen (...at least in dos) }
Begin
ASM
Mov Ax, $0013 { 00h = Set Graphics Mode, 13h = 320x200 256 Colors }
Int $10 { Int 10h = Call Graphics Interrupt }
END;
{ Draw a 30x30 rectangle, top-left location @ 10,10 in White (15) on the VGA screen }
Rectangle(10, 10, 30, 30, 15, VGA);
Readkey; { Wait for a key press }
ASM
Mov Ax, $0003 { 00h = Set Graphics Mode, 03h = 80x25 Text Mode }
Int $10 { Int 10h = Call Graphics Interrupt }
END;
End;
WHERE will always be VGA until you start working with Virtual Screens.
As you will notice, once you start drawing alot of stuff repeatedly the screen will flicker. This is handled by VIRTUAL SCREENS. Basically a chunk of memory the same size as your screen (320x200 = 64000 bytes) where you draw everything to, then you just 'flip' the whole virtual screen onto the real screen and voila! no flicker.
Notice that the VGA resolution allows a virtual screen to fit in the 64k memory limitation ;)
If this works, search this board for GRAPHICS.PAS and you should find my old unit.
I know Turbo Pascal also had BGI graphics, but not sure what FPC has.
Phat Nat