mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:14:25 +02:00
+ DontClearGraphMemory added to be able to start a mode
without clearing everything (needed for IDE) * tried to clean assembler problems due to regcall conventions git-svn-id: trunk@5696 -
This commit is contained in:
parent
e0d9b9e307
commit
c9c37f573b
@ -52,6 +52,10 @@ const
|
|||||||
UseLFB : boolean = false;
|
UseLFB : boolean = false;
|
||||||
UseNoSelector : boolean = false;
|
UseNoSelector : boolean = false;
|
||||||
LFBPointer : pointer = nil;
|
LFBPointer : pointer = nil;
|
||||||
|
{ Helpful variable to get save/restore support in IDE PM }
|
||||||
|
const
|
||||||
|
DontClearGraphMemory : boolean = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -162,55 +166,65 @@ const
|
|||||||
pop es
|
pop es
|
||||||
pop esi
|
pop esi
|
||||||
pop edi
|
pop edi
|
||||||
end ['ESI','EDI','ECX','EAX']
|
end ['ECX','EAX']
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$endif tp}
|
{$endif tp}
|
||||||
|
|
||||||
|
Procedure CallInt10(val_ax : word); assembler;
|
||||||
|
asm
|
||||||
|
{$IFNDEF REGCALL}
|
||||||
|
mov ax,val_ax
|
||||||
|
{$ENDIF REGCALL}
|
||||||
|
{$ifdef fpc}
|
||||||
|
push ebp
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ebx
|
||||||
|
{$endif fpc}
|
||||||
|
int 10h
|
||||||
|
{$ifdef fpc}
|
||||||
|
pop ebx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
pop ebp
|
||||||
|
{$endif fpc}
|
||||||
|
end;
|
||||||
|
|
||||||
{************************************************************************}
|
{************************************************************************}
|
||||||
{* 4-bit planar VGA mode routines *}
|
{* 4-bit planar VGA mode routines *}
|
||||||
{************************************************************************}
|
{************************************************************************}
|
||||||
|
|
||||||
Procedure Init640x200x16; {$ifndef fpc}far;{$endif fpc} assembler;
|
Procedure Init640x200x16; {$ifndef fpc}far;{$endif fpc}
|
||||||
{ must also clear the screen...}
|
begin
|
||||||
asm
|
if DontClearGraphMemory then
|
||||||
mov ax,000Eh
|
CallInt10($8e)
|
||||||
{$ifdef fpc}
|
else
|
||||||
push ebp
|
CallInt10($e);
|
||||||
{$endif fpc}
|
|
||||||
int 10h
|
|
||||||
{$ifdef fpc}
|
|
||||||
pop ebp
|
|
||||||
{$endif fpc}
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
Procedure Init640x350x16; {$ifndef fpc}far;{$endif fpc} assembler;
|
|
||||||
{ must also clear the screen...}
|
|
||||||
asm
|
|
||||||
mov ax,0010h
|
|
||||||
{$ifdef fpc}
|
|
||||||
push ebp
|
|
||||||
{$endif fpc}
|
|
||||||
int 10h
|
|
||||||
{$ifdef fpc}
|
|
||||||
pop ebp
|
|
||||||
{$endif fpc}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Init640x480x16; {$ifndef fpc}far;{$endif fpc} assembler;
|
|
||||||
{ must also clear the screen...}
|
Procedure Init640x350x16; {$ifndef fpc}far;{$endif fpc}
|
||||||
asm
|
begin
|
||||||
mov ax,0012h
|
if DontClearGraphMemory then
|
||||||
{$ifdef fpc}
|
CallInt10($90)
|
||||||
push ebp
|
else
|
||||||
{$endif fpc}
|
CallInt10($10);
|
||||||
int 10h
|
|
||||||
{$ifdef fpc}
|
|
||||||
pop ebp
|
|
||||||
{$endif fpc}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Procedure Init640x480x16; {$ifndef fpc}far;{$endif fpc}
|
||||||
|
begin
|
||||||
|
if DontClearGraphMemory then
|
||||||
|
CallInt10($92)
|
||||||
|
else
|
||||||
|
CallInt10($12);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Procedure PutPixel16(X,Y : smallint; Pixel: Word); {$ifndef fpc}far;{$endif fpc}
|
Procedure PutPixel16(X,Y : smallint; Pixel: Word); {$ifndef fpc}far;{$endif fpc}
|
||||||
{$ifndef asmgraph}
|
{$ifndef asmgraph}
|
||||||
var offset: word;
|
var offset: word;
|
||||||
@ -313,9 +327,9 @@ const
|
|||||||
{ restore enable set/reset register }
|
{ restore enable set/reset register }
|
||||||
mov ax,0001h
|
mov ax,0001h
|
||||||
out dx,ax
|
out dx,ax
|
||||||
|
{$endif fpc}
|
||||||
pop edi
|
pop edi
|
||||||
pop ebx
|
pop ebx
|
||||||
{$endif fpc}
|
|
||||||
end;
|
end;
|
||||||
{$endif asmgraph}
|
{$endif asmgraph}
|
||||||
end;
|
end;
|
||||||
@ -345,9 +359,6 @@ const
|
|||||||
{$else asmgraph}
|
{$else asmgraph}
|
||||||
asm
|
asm
|
||||||
{$ifndef fpc}
|
{$ifndef fpc}
|
||||||
push esi
|
|
||||||
push edi
|
|
||||||
push ebx
|
|
||||||
mov ax, [X] { Get X address }
|
mov ax, [X] { Get X address }
|
||||||
push ax
|
push ax
|
||||||
shr ax, 3
|
shr ax, 3
|
||||||
@ -413,6 +424,9 @@ const
|
|||||||
xor ah,ah
|
xor ah,ah
|
||||||
mov @Result, ax
|
mov @Result, ax
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ebx
|
||||||
movzx eax, [X] { Get X address }
|
movzx eax, [X] { Get X address }
|
||||||
push eax
|
push eax
|
||||||
shr eax, 3
|
shr eax, 3
|
||||||
@ -660,9 +674,6 @@ End;
|
|||||||
{$else asmgraph}
|
{$else asmgraph}
|
||||||
{ note: still needs xor/or/and/notput support !!!!! (JM) }
|
{ note: still needs xor/or/and/notput support !!!!! (JM) }
|
||||||
asm
|
asm
|
||||||
push esi
|
|
||||||
push edi
|
|
||||||
push ebx
|
|
||||||
{$ifndef fpc}
|
{$ifndef fpc}
|
||||||
mov es, [SegA000]
|
mov es, [SegA000]
|
||||||
{ enable the set / reset function and load the color }
|
{ enable the set / reset function and load the color }
|
||||||
@ -708,6 +719,9 @@ End;
|
|||||||
mov ax,0001h
|
mov ax,0001h
|
||||||
out dx,ax
|
out dx,ax
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ebx
|
||||||
{ enable the set / reset function and load the color }
|
{ enable the set / reset function and load the color }
|
||||||
mov dx, 3ceh
|
mov dx, 3ceh
|
||||||
mov ax, 0f01h
|
mov ax, 0f01h
|
||||||
@ -992,9 +1006,15 @@ End;
|
|||||||
mov ah,05h
|
mov ah,05h
|
||||||
{$ifdef fpc}
|
{$ifdef fpc}
|
||||||
push ebp
|
push ebp
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ebx
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
int 10h
|
int 10h
|
||||||
{$ifdef fpc}
|
{$ifdef fpc}
|
||||||
|
pop ebx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
pop ebp
|
pop ebp
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
|
|
||||||
@ -1033,9 +1053,15 @@ End;
|
|||||||
mov ah,05h
|
mov ah,05h
|
||||||
{$ifdef fpc}
|
{$ifdef fpc}
|
||||||
push ebp
|
push ebp
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ebx
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
int 10h
|
int 10h
|
||||||
{$ifdef fpc}
|
{$ifdef fpc}
|
||||||
|
pop ebx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
pop ebp
|
pop ebp
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
end;
|
end;
|
||||||
@ -1060,17 +1086,15 @@ End;
|
|||||||
{* 320x200x256c Routines *}
|
{* 320x200x256c Routines *}
|
||||||
{************************************************************************}
|
{************************************************************************}
|
||||||
|
|
||||||
Procedure Init320; {$ifndef fpc}far;{$endif fpc} assembler;
|
Procedure Init320; {$ifndef fpc}far;{$endif fpc}
|
||||||
asm
|
begin
|
||||||
mov ax,0013h
|
if DontClearGraphMemory then
|
||||||
{$ifdef fpc}
|
CallInt10($93)
|
||||||
push ebp
|
else
|
||||||
{$endif fpc}
|
CallInt10($13);
|
||||||
int 10h
|
end;
|
||||||
{$ifdef fpc}
|
|
||||||
pop ebp
|
|
||||||
{$endif fpc}
|
|
||||||
end;
|
|
||||||
|
|
||||||
Procedure PutPixel320(X,Y : smallint; Pixel: Word); {$ifndef fpc}far;{$endif fpc}
|
Procedure PutPixel320(X,Y : smallint; Pixel: Word); {$ifndef fpc}far;{$endif fpc}
|
||||||
{ x,y -> must be in local coordinates. Clipping if required. }
|
{ x,y -> must be in local coordinates. Clipping if required. }
|
||||||
@ -1277,6 +1301,11 @@ const CrtAddress: word = 0;
|
|||||||
MOV CRTAddress,DX
|
MOV CRTAddress,DX
|
||||||
|
|
||||||
MOV AX, 0013h
|
MOV AX, 0013h
|
||||||
|
MOV BL, DontClearGraphMemory
|
||||||
|
OR BL,BL
|
||||||
|
JZ @L2
|
||||||
|
OR AX, 080h
|
||||||
|
@L2:
|
||||||
{$ifdef fpc}
|
{$ifdef fpc}
|
||||||
push ebp
|
push ebp
|
||||||
{$EndIf fpc}
|
{$EndIf fpc}
|
||||||
@ -1333,7 +1362,7 @@ const CrtAddress: word = 0;
|
|||||||
IN AL,DX
|
IN AL,DX
|
||||||
OR AL,40h {bit 6 := 1: memory access scheme=linear bit array }
|
OR AL,40h {bit 6 := 1: memory access scheme=linear bit array }
|
||||||
OUT DX,AL
|
OUT DX,AL
|
||||||
end;
|
end ['ESI','EDI','EBX','EAX'];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1376,6 +1405,7 @@ const CrtAddress: word = 0;
|
|||||||
mov al, ES:[DI]
|
mov al, ES:[DI]
|
||||||
xor ah, ah
|
xor ah, ah
|
||||||
mov @Result, ax
|
mov @Result, ax
|
||||||
|
end;
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
push edi
|
push edi
|
||||||
push ebx
|
push ebx
|
||||||
@ -1403,8 +1433,8 @@ const CrtAddress: word = 0;
|
|||||||
mov @Result, ax
|
mov @Result, ax
|
||||||
pop ebx
|
pop ebx
|
||||||
pop edi
|
pop edi
|
||||||
|
end ['ESI','EDI','EBX','EAX'];
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
end;
|
|
||||||
{$endif asmgraph}
|
{$endif asmgraph}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2003,6 +2033,11 @@ const CrtAddress: word = 0;
|
|||||||
{ check if Hercules adapter supPorted ... }
|
{ check if Hercules adapter supPorted ... }
|
||||||
{ check if EGA adapter supPorted... }
|
{ check if EGA adapter supPorted... }
|
||||||
asm
|
asm
|
||||||
|
{$ifdef fpc}
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ebx
|
||||||
|
{$endif fpc}
|
||||||
mov ah,12h
|
mov ah,12h
|
||||||
mov bx,0FF10h
|
mov bx,0FF10h
|
||||||
{$ifdef fpc}
|
{$ifdef fpc}
|
||||||
@ -2016,6 +2051,11 @@ const CrtAddress: word = 0;
|
|||||||
jz @noega
|
jz @noega
|
||||||
mov [EGADetected],TRUE
|
mov [EGADetected],TRUE
|
||||||
@noega:
|
@noega:
|
||||||
|
{$ifdef fpc}
|
||||||
|
pop ebx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
{$endif fpc}
|
||||||
end;
|
end;
|
||||||
{$ifdef logging}
|
{$ifdef logging}
|
||||||
LogLn('EGA detected: '+strf(Longint(EGADetected)));
|
LogLn('EGA detected: '+strf(Longint(EGADetected)));
|
||||||
@ -2024,6 +2064,11 @@ const CrtAddress: word = 0;
|
|||||||
if EGADetected then
|
if EGADetected then
|
||||||
begin
|
begin
|
||||||
asm
|
asm
|
||||||
|
{$ifdef fpc}
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
push ebx
|
||||||
|
{$endif fpc}
|
||||||
mov ax,1a00h
|
mov ax,1a00h
|
||||||
{$ifdef fpc}
|
{$ifdef fpc}
|
||||||
push ebp
|
push ebp
|
||||||
@ -2038,17 +2083,16 @@ const CrtAddress: word = 0;
|
|||||||
mov ax,1c00h { get state size for save... }
|
mov ax,1c00h { get state size for save... }
|
||||||
{ ... all imPortant data }
|
{ ... all imPortant data }
|
||||||
mov cx,07h
|
mov cx,07h
|
||||||
{$ifdef fpc}
|
|
||||||
push ebp
|
|
||||||
{$endif fpc}
|
|
||||||
int 10h
|
int 10h
|
||||||
{$ifdef fpc}
|
|
||||||
pop ebp
|
|
||||||
{$endif fpc}
|
|
||||||
cmp al,1ch { success? }
|
cmp al,1ch { success? }
|
||||||
jne @novga
|
jne @novga
|
||||||
mov [VGADetected],TRUE
|
mov [VGADetected],TRUE
|
||||||
@novga:
|
@novga:
|
||||||
|
{$ifdef fpc}
|
||||||
|
pop ebx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
{$endif fpc}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ifdef logging}
|
{$ifdef logging}
|
||||||
@ -2774,6 +2818,6 @@ begin
|
|||||||
test ax,ax
|
test ax,ax
|
||||||
sete al
|
sete al
|
||||||
mov inWindows,al
|
mov inWindows,al
|
||||||
end;
|
end ['ESI','EDI','EBX','EAX'];
|
||||||
InitializeGraph;
|
InitializeGraph;
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user