* proper regcall fixes

This commit is contained in:
Tomas Hajny 2004-03-06 23:18:02 +00:00
parent 8cdd1af070
commit a55555aecc

View File

@ -1100,35 +1100,43 @@ End;
mov es:[di], al mov es:[di], al
end; end;
{$else fpc} {$else fpc}
assembler;stdcall; assembler;
asm asm
push edi push edi
push ebx push ebx
movsx edi, x {$IFDEF REGCALL}
movsx ebx, y movsx edi, ax
cmp clippixels, 0 movsx ebx, dx
je @putpix320noclip mov al, cl
test edi, edi {$ELSE REGCALL}
jl @putpix320done movsx edi, x
test ebx, ebx movsx ebx, y
jl @putpix320done {$ENDIF REGCALL}
cmp di, ViewWidth cmp clippixels, 0
jg @putpix320done je @putpix320noclip
cmp bx, ViewHeight test edi, edi
jg @putpix320done jl @putpix320done
@putpix320noclip: test ebx, ebx
movsx ecx, StartYViewPort jl @putpix320done
movsx edx, StartXViewPort cmp di, ViewWidth
add ebx, ecx jg @putpix320done
add edi, edx cmp bx, ViewHeight
jg @putpix320done
@putpix320noclip:
movsx ecx, StartYViewPort
movsx edx, StartXViewPort
add ebx, ecx
add edi, edx
{ add edi, [VideoOfs] no multiple pages in 320*200*256 } { add edi, [VideoOfs] no multiple pages in 320*200*256 }
mov ax, [pixel] {$IFNDEF REGCALL}
shl ebx, 6 mov ax, [pixel]
add edi, ebx {$ENDIF REGCALL}
mov fs:[edi+ebx*4+$a0000], al shl ebx, 6
@putpix320done: add edi, ebx
pop ebx mov fs:[edi+ebx*4+$a0000], al
pop edi @putpix320done:
pop ebx
pop edi
{$endif fpc} {$endif fpc}
end; end;
@ -1152,12 +1160,17 @@ End;
mov @Result,ax mov @Result,ax
end; end;
{$else fpc} {$else fpc}
assembler;stdcall; assembler;
asm asm
push edi push edi
push ebx push ebx
{$IFDEF REGCALL}
movsx edi, ax
movsx ebx, dx
{$ELSE REGCALL}
movsx edi, x movsx edi, x
movsx ebx, y movsx ebx, y
{$ENDIF REGCALL}
movsx ecx, StartYViewPort movsx ecx, StartYViewPort
movsx edx, StartXViewPort movsx edx, StartXViewPort
add ebx, ecx add ebx, ecx
@ -1190,7 +1203,7 @@ End;
end; end;
{$else asmgraph} {$else asmgraph}
{ note: still needs or/and/notput support !!!!! (JM) } { note: still needs or/and/notput support !!!!! (JM) }
assembler;stdcall; assembler;
asm asm
{$ifndef fpc} {$ifndef fpc}
mov es, [SegA000] mov es, [SegA000]
@ -1211,8 +1224,13 @@ End;
{$else fpc} {$else fpc}
push edi push edi
push ebx push ebx
{$IFDEF REGCALL}
movzx edi, ax
movzx ebx, dx
{$ELSE REGCALL}
movzx edi, x movzx edi, x
movzx ebx, y movzx ebx, y
{$ENDIF REGCALL}
{ add edi, [VideoOfs] no multiple pages in 320*200*256 } { add edi, [VideoOfs] no multiple pages in 320*200*256 }
shl ebx, 6 shl ebx, 6
add edi, ebx add edi, ebx
@ -1394,10 +1412,13 @@ const CrtAddress: word = 0;
procedure SetVisualX(page: word); {$ifndef fpc}far;{$endif fpc} procedure SetVisualX(page: word); {$ifndef fpc}far;{$endif fpc}
{ 4 page supPort... } { 4 page supPort... }
Procedure SetVisibleStart(AOffset: word); Assembler;stdcall; Procedure SetVisibleStart(AOffset: word); Assembler;
(* Select where the left corner of the screen will be *) (* Select where the left corner of the screen will be *)
{ By Matt Pritchard } { By Matt Pritchard }
asm asm
{$IFDEF REGCALL}
mov cx, ax
{$ENDIF REGCALL}
{ Wait if we are currently in a Vertical Retrace } { Wait if we are currently in a Vertical Retrace }
MOV DX, INPUT_1 { Input Status #1 Register } MOV DX, INPUT_1 { Input Status #1 Register }
@DP_WAIT0: @DP_WAIT0:
@ -1415,10 +1436,18 @@ const CrtAddress: word = 0;
MOV AL, START_DISP_HI { Display Start High Register } MOV AL, START_DISP_HI { Display Start High Register }
MOV AH, BYTE PTR [AOffset+1] { High 8 Bits of Start Addr } MOV AH, BYTE PTR [AOffset+1] { High 8 Bits of Start Addr }
{$else fpc} {$else fpc}
{$IFDEF REGCALL}
mov ah, cl
{$ELSE REGCALL}
mov ah, byte [AOffset] mov ah, byte [AOffset]
{$ENDIF REGCALL}
out dx, ax out dx, ax
mov AL, START_DISP_HI mov AL, START_DISP_HI
{$IFDEF REGCALL}
mov ah, ch
{$ELSE REGCALL}
mov ah, byte [AOffset+1] mov ah, byte [AOffset+1]
{$ENDIF REGCALL}
{$endif fpc} {$endif fpc}
OUT DX, AX { Set Display Addr High } OUT DX, AX { Set Display Addr High }
{ Wait for a Vertical Retrace to smooth out things } { Wait for a Vertical Retrace to smooth out things }
@ -1545,17 +1574,22 @@ const CrtAddress: word = 0;
end; end;
{$else asmgraph} {$else asmgraph}
{ note: still needs or/and/notput support !!!!! (JM) } { note: still needs or/and/notput support !!!!! (JM) }
Assembler;stdcall; Assembler;
asm asm
mov di,[Y] ; (* DI = Y coordinate *) {$IFDEF REGCALL}
mov cl, al
mov di, dx
{$ELSE REGCALL}
mov cx, [X]
mov ax, cx
mov di, [Y] ; (* DI = Y coordinate *)
{$ENDIF REGCALL}
(* Multiply by 80 start *) (* Multiply by 80 start *)
mov bx, di mov bx, di
shl di, 6 ; (* Faster on 286/386/486 machines *) shl di, 6 ; (* Faster on 286/386/486 machines *)
shl bx, 4 shl bx, 4
add di, bx ; (* Multiply Value by 80 *) add di, bx ; (* Multiply Value by 80 *)
(* End multiply by 80 *) (* End multiply by 80 *)
mov cx, [X]
mov ax, cx
{DI = Y * LINESIZE, BX = X, coordinates admissible} {DI = Y * LINESIZE, BX = X, coordinates admissible}
shr ax, 2 shr ax, 2
add di, ax ; {DI = Y * LINESIZE + (X SHR 2) } add di, ax ; {DI = Y * LINESIZE + (X SHR 2) }
@ -2746,7 +2780,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.11 2003-12-04 21:42:07 peter Revision 1.12 2004-03-06 23:18:02 hajny
* proper regcall fixes
Revision 1.11 2003/12/04 21:42:07 peter
* register calling updates * register calling updates
Revision 1.10 2003/10/03 21:46:25 peter Revision 1.10 2003/10/03 21:46:25 peter