* Patch from mantis 11724 that translates some asm and voodoo code to cleaner pascal

at the expense of some extra vars. (probably solves problems caused
    by oldfpcpascal change)

git-svn-id: trunk@15019 -
This commit is contained in:
marco 2010-03-14 22:28:07 +00:00
parent 06a5f63582
commit bfbe9df673

View File

@ -337,34 +337,17 @@ end;
SearchVESAModes := ModeSupported; SearchVESAModes := ModeSupported;
end; end;
procedure SetBankIndex(win: byte; BankNr: smallint);
{I don't know why but the previous assembler version changed by some mechanism
procedure SetBankIndex(win: byte; BankNr: smallint); assembler; unknown to me some places in memory what lead to changing some variables not
asm belonging to this procedure (Laaca)}
{$IFDEF REGCALL} var r:TDPMIregisters;
mov bl, al begin
{$ELSE REGCALL} r.ax:=$4f05;
mov bl,[Win] r.bx:=win;
{$ENDIF REGCALL} r.dx:=BankNr;
mov ax,4f05h RealIntr($10,r);
mov bh,00h end;
{$IFNDEF REGCALL}
mov dx,[BankNr]
{$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 ['EDX','EBX','EAX'];
{********************************************************} {********************************************************}
{ There are two routines for setting banks. This may in } { There are two routines for setting banks. This may in }
@ -1318,6 +1301,9 @@ end;
procedure PutPixVESA32kOr64k(x, y : smallint; color : word); {$ifndef fpc}far;{$endif fpc} procedure PutPixVESA32kOr64k(x, y : smallint; color : word); {$ifndef fpc}far;{$endif fpc}
var var
offs : longint; offs : longint;
place: word;
bank : shortint;
begin begin
{$ifdef logging} {$ifdef logging}
logln('putpixvesa32kor64k('+strf(x)+','+strf(y)+')'); logln('putpixvesa32kor64k('+strf(x)+','+strf(y)+')');
@ -1334,11 +1320,14 @@ end;
end; end;
Y := Y + YOffset; { adjust pixel for correct virtual page } Y := Y + YOffset; { adjust pixel for correct virtual page }
offs := longint(y) * BytesPerLine + 2*x; offs := longint(y) * BytesPerLine + 2*x;
SetWriteBank(smallint(offs shr 16)); bank := offs div 65536;
place:= offs mod 65536;
SetWriteBank(bank);
{$ifdef logging} {$ifdef logging}
logln('putpixvesa32kor64k offset: '+strf(word(offs))); logln('putpixvesa32kor64k offset: '+strf(word(offs)));
{$endif logging} {$endif logging}
memW[WinWriteSeg : word(offs)] := color; memW[WinWriteSeg : place] := color;
end; end;
function GetPixVESA32kOr64k(x, y : smallint): word; {$ifndef fpc}far;{$endif fpc} function GetPixVESA32kOr64k(x, y : smallint): word; {$ifndef fpc}far;{$endif fpc}
@ -1355,29 +1344,34 @@ end;
procedure DirectPutPixVESA32kOr64k(x, y : smallint); {$ifndef fpc}far;{$endif fpc} procedure DirectPutPixVESA32kOr64k(x, y : smallint); {$ifndef fpc}far;{$endif fpc}
var var
offs : longint; offs : longint;
col : word; bank : smallint;
place,col : word;
begin begin
{$ifdef logging} {$ifdef logging}
logln('directputpixvesa32kor64k('+strf(x)+','+strf(y)+')'); logln('directputpixvesa32kor64k('+strf(x)+','+strf(y)+')');
{$endif logging} {$endif logging}
y:= Y + YOffset; y:= Y + YOffset;
offs := longint(y) * BytesPerLine + 2*x; offs := longint(y) * BytesPerLine + 2*x;
SetWriteBank(smallint((offs shr 16) and $ff)); bank:=offs div 65536;
place:=offs mod 65536;
SetWriteBank(bank and $FF); // unknown why this and $FF is here.
Case CurrentWriteMode of Case CurrentWriteMode of
XorPut: XorPut:
Begin Begin
SetReadBank(smallint(offs shr 16)); SetReadBank(bank);
memW[WinWriteSeg : word(offs)] := memW[WinReadSeg : word(offs)] xor currentcolor; memW[WinWriteSeg : place] := memW[WinReadSeg : place] xor currentcolor;
End; End;
AndPut: AndPut:
Begin Begin
SetReadBank(smallint(offs shr 16)); SetReadBank(bank);
memW[WinWriteSeg : word(offs)] := memW[WinReadSeg : word(offs)] And currentcolor; memW[WinWriteSeg : place] := memW[WinReadSeg : place] And currentcolor;
End; End;
OrPut: OrPut:
Begin Begin
SetReadBank(smallint(offs shr 16)); SetReadBank(bank);
memW[WinWriteSeg : word(offs)] := memW[WinReadSeg : word(offs)] or currentcolor; memW[WinWriteSeg : place] := memW[WinReadSeg : place] or currentcolor;
End End
else else
Begin Begin
@ -1387,7 +1381,7 @@ end;
{$ifdef logging} {$ifdef logging}
logln('directputpixvesa32kor64k offset: '+strf(word(offs))); logln('directputpixvesa32kor64k offset: '+strf(word(offs)));
{$endif logging} {$endif logging}
memW[WinWriteSeg : word(offs)] := Col; memW[WinWriteSeg : place] := Col;
End End
End; End;
end; end;