* PutPixel16 converted to pure asm routine

git-svn-id: trunk@41004 -
This commit is contained in:
nickysn 2019-01-22 16:40:51 +00:00
parent 1533f1e218
commit 7c4466025a

View File

@ -1587,75 +1587,73 @@ end;
PortW[$3ce] := $0001; { Index 01 : Disable ops on all four planes. } PortW[$3ce] := $0001; { Index 01 : Disable ops on all four planes. }
end; end;
{$else asmgraph} {$else asmgraph}
Procedure PutPixel16(X,Y : smallint; Pixel: ColorType); Procedure PutPixel16(X,Y : smallint; Pixel: ColorType); assembler;
Begin asm
asm mov si, [X]
mov si, [X] mov bx, [Y]
mov bx, [Y] cmp byte ptr [ClipPixels], 0
cmp byte ptr [ClipPixels], 0 je @@ClipDone
je @@ClipDone
test si, si test si, si
js @@Done js @@Done
test bx, bx test bx, bx
js @@Done js @@Done
cmp si, [ViewWidth] cmp si, [ViewWidth]
jg @@Done jg @@Done
cmp bx, [ViewHeight] cmp bx, [ViewHeight]
jg @@Done jg @@Done
@@ClipDone: @@ClipDone:
add si, [StartXViewPort] add si, [StartXViewPort]
add bx, [StartYViewPort] add bx, [StartYViewPort]
{$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}
{ 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
out dx, ax out dx, ax
{ setup set/reset register } { setup set/reset register }
mov ah, byte ptr [Pixel] mov ah, byte ptr [Pixel]
xor al, al xor al, al
out dx, ax out dx, ax
{ setup the bit mask register } { setup the bit mask register }
mov al, 8 mov al, 8
{ load the bitmask register } { load the bitmask register }
mov cx, si mov cx, si
and cl, 07h and cl, 07h
mov ah, 80h mov ah, 80h
shr ah, cl shr ah, cl
out dx, ax out dx, ax
{ get the x index and divide by 8 for 16-color } { get the x index and divide by 8 for 16-color }
mov cl, 3 mov cl, 3
shr si, cl shr si, cl
{ determine the address } { determine the address }
inc cx { CL=4 } inc cx { CL=4 }
shl bx, cl shl bx, cl
mov di, bx mov di, bx
shl di, 1 shl di, 1
shl di, 1 shl di, 1
add di, bx add di, bx
add di, si add di, si
add di, [VideoOfs] add di, [VideoOfs]
{ send the data through the display memory through set/reset } { send the data through the display memory through set/reset }
mov bl,es:[di] mov bl,es:[di]
stosb stosb
{ reset for formal vga operation } { reset for formal vga operation }
mov ax,0ff08h mov ax,0ff08h
out dx,ax out dx,ax
{ restore enable set/reset register } { restore enable set/reset register }
mov ax,0001h mov ax,0001h
out dx,ax out dx,ax
@@Done: @@Done:
end ['AX','BX','CX','DX','SI','DI']; end;
end;
{$endif asmgraph} {$endif asmgraph}