* asm version of GetPixelX converted to pure asm

git-svn-id: trunk@41019 -
This commit is contained in:
nickysn 2019-01-23 15:23:48 +00:00
parent 46f3c742f3
commit c86da93af8

View File

@ -2487,45 +2487,42 @@ const CrtAddress: word = 0;
GetPixelX := Mem[SegA000:offset]; GetPixelX := Mem[SegA000:offset];
end; end;
{$else asmgraph} {$else asmgraph}
function GetPixelX(X,Y: smallint): ColorType; function GetPixelX(X,Y: smallint): ColorType; assembler;
begin asm
asm
{$ifdef FPC_MM_HUGE} {$ifdef FPC_MM_HUGE}
mov ax, SEG SegA000 mov ax, SEG SegA000
mov es, ax mov es, ax
mov es, es:[SegA000] mov es, es:[SegA000]
{$else FPC_MM_HUGE} {$else FPC_MM_HUGE}
mov es, [SegA000] mov es, [SegA000]
{$endif FPC_MM_HUGE} {$endif FPC_MM_HUGE}
mov di,[Y] ; (* DI = Y coordinate *) mov di,[Y] ; (* DI = Y coordinate *)
add di,[StartYViewPort] add di,[StartYViewPort]
(* Multiply by 80 start *) (* Multiply by 80 start *)
mov cl, 4 mov cl, 4
shl di, cl shl di, cl
mov bx, di mov bx, di
shl di, 1 shl di, 1
shl di, 1 shl di, 1
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 cx, [X]
add cx, [StartXViewPort] add cx, [StartXViewPort]
mov ax, cx mov ax, cx
{DI = Y * LINESIZE, BX = X, coordinates admissible} {DI = Y * LINESIZE, BX = X, coordinates admissible}
shr ax, 1 ; (* Faster on 286/86 machines *) shr ax, 1 ; (* Faster on 286/86 machines *)
shr ax, 1 shr ax, 1
add di, ax ; {DI = Y * LINESIZE + (X SHR 2) } add di, ax ; {DI = Y * LINESIZE + (X SHR 2) }
add di, [VideoOfs] ; (* Pointing at start of Active page *) add di, [VideoOfs] ; (* Pointing at start of Active page *)
(* Select plane to use *) (* Select plane to use *)
mov dx, 03c4h mov dx, 03c4h
mov ax, FirstPlane ; (* Map Mask & Plane Select Register *) mov ax, FirstPlane ; (* Map Mask & Plane Select Register *)
and cl, 03h ; (* Get Plane Bits *) and cl, 03h ; (* Get Plane Bits *)
shl ah, cl ; (* Get Plane Select Value *) shl ah, cl ; (* Get Plane Select Value *)
out dx, ax out dx, ax
(* End selection of plane *) (* End selection of plane *)
mov al, ES:[DI] mov al, ES:[DI]
xor ah, ah xor ah, ah
mov @Result, ax
end;
end; end;
{$endif asmgraph} {$endif asmgraph}