* PutPixelX converted to a pure assembler routine

git-svn-id: trunk@41042 -
This commit is contained in:
nickysn 2019-01-24 15:37:37 +00:00
parent a190d65f92
commit a22ac81677

View File

@ -2606,71 +2606,69 @@ const CrtAddress: word = 0;
Mem[SegA000:offset] := color; Mem[SegA000:offset] := color;
end; end;
{$else asmgraph} {$else asmgraph}
Procedure PutPixelX(X,Y: smallint; color:ColorType); Procedure PutPixelX(X,Y: smallint; color:ColorType); assembler;
begin asm
asm push ax
push ax push bx
push bx push cx
push cx push dx
push dx push es
push es push di
push di mov ax, [X]
mov ax, [X] mov di, [Y] ; (* DI = Y coordinate *)
mov di, [Y] ; (* DI = Y coordinate *)
cmp byte ptr [ClipPixels], 0 cmp byte ptr [ClipPixels], 0
je @@ClipDone je @@ClipDone
test ax, ax test ax, ax
js @@Done js @@Done
test di, di test di, di
js @@Done js @@Done
cmp ax, [ViewWidth] cmp ax, [ViewWidth]
jg @@Done jg @@Done
cmp di, [ViewHeight] cmp di, [ViewHeight]
jg @@Done jg @@Done
@@ClipDone: @@ClipDone:
{$ifdef FPC_MM_HUGE} {$ifdef FPC_MM_HUGE}
mov bx, SEG SegA000 mov bx, SEG SegA000
mov es, bx mov es, bx
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}
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 *)
add ax, [StartXViewPort] add ax, [StartXViewPort]
mov cx, ax mov cx, ax
{DI = Y * LINESIZE, BX = X, coordinates admissible} {DI = Y * LINESIZE, BX = X, coordinates admissible}
shr ax, 1 shr ax, 1
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 ax,[Color] ; { only lower byte is used. } mov ax,[Color] ; { only lower byte is used. }
mov es:[di], al mov es:[di], al
@@Done: @@Done:
pop di pop di
pop es pop es
pop dx pop dx
pop cx pop cx
pop bx pop bx
pop ax pop ax
end;
end; end;
{$endif asmgraph} {$endif asmgraph}