📄 pmgraph.asm
字号:
ret
_PutPixel endp
;void HLine(long Left, long Top, long Width, long Color)
public _HLine
_HLine proc
push bp
mov bp,sp
push edi
mov edi,[bp + 8]
imul edi,_GRWidth
add edi,[bp + 4]
mov al,[bp + 16]
mov ah,al
push ax
shl eax,16
pop ax
mov ecx,[bp + 12]
shr ecx,2
cld
rep stos es:dword ptr [edi]
;jnc HLAllDone
mov ecx,[bp + 12]
and ecx,3
rep stos es:byte ptr [edi]
HLAllDone: pop edi
pop bp
ret
_HLine endp
;void VLine(long Left, long Top, long Height, long Color)
public _VLine
_VLine proc
push bp
mov bp,sp
mov ebx,[bp + 8]
imul ebx,_GRWidth
add ebx,[bp + 4]
mov cx,[bp + 12]
mov al,[bp + 16]
VLDrawLine: mov es:[ebx],al
add ebx,_GRWidth
loopnz VLDrawLine
pop bp
ret
_VLine endp
;void Bar(long Left, long Top, long Width, long Height, long Color)
public _Bar
_Bar proc
push bp
mov bp,sp
push edi
cld
mov edi,[bp + 8]
imul edi,_GRWidth
add edi,[bp + 4]
mov al,[bp + 20]
mov ah,al
push ax
shl eax,16
pop ax
jmp BarTestEnd
BarDraw: mov ecx,[bp + 12]
shr ecx,2
push edi
rep stos es:dword ptr [edi]
mov ecx,[bp + 12]
and ecx,3
jz BarLineDrawn
rep stos es:byte ptr [edi]
BarLineDrawn: pop edi
add edi,_GRWidth
BarTestEnd: dec word ptr [bp + 16]
jns BarDraw
pop edi
pop bp
ret
_Bar endp
;void PutImage(long Left,long Top,long Width,long Height,
; 4 8 12 16
; long IAdd,long PhysImage);
; 20 24
public _PutImage
_PutImage proc
push bp
mov bp,sp
push esi
push edi
cld
mov edi,[bp + 8]
imul edi,_GRWidth
add edi,[bp + 4]
mov esi,[bp + 24]
jmp PITestEnd
PIDraw: mov ecx,[bp + 12]
shr ecx,2
push edi
rep movs es:dword ptr [edi],gs:[esi]
;jnc PILineDrawn
mov ecx,[bp + 12]
and ecx,3
rep movs es:byte ptr [edi],gs:[esi]
PILineDrawn: pop edi
add edi,_GRWidth
add esi,[bp + 20]
PITestEnd: dec word ptr [bp + 16]
jns PIDraw
pop edi
pop esi
pop bp
ret
_PutImage endp
;void GetImage(long Left,long Top,long Width,long Height,
; 4 8 12 16
; long IAdd,long PhysImage);
; 20 24
public _GetImage
_GetImage proc
push bp
mov bp,sp
push esi
push edi
cld
push es
push gs
pop es
pop gs
mov esi,[bp + 8]
imul esi,_GRWidth
add esi,[bp + 4]
mov edi,[bp + 24]
jmp GITestEnd
GIDraw: mov ecx,[bp + 12]
shr ecx,2
push esi
rep movs es:dword ptr [edi],gs:[esi]
;jnc GILineDrawn
mov ecx,[bp + 12]
and ecx,3
rep movs es:byte ptr [edi],gs:[esi]
GILineDrawn: pop esi
add esi,_GRWidth
add edi,[bp + 20]
GITestEnd: dec word ptr [bp + 16]
jns GIDraw
push es
push gs
pop es
pop gs
pop edi
pop esi
pop bp
ret
_GetImage endp
;void SetClippingRegion(long Left, long Top, long Width, long Height);
public _SetClippingRegion
_SetClippingRegion proc
push bp
mov bp,sp
mov eax,[bp + 4]
mov ecx,[bp + 12]
mov edx,[bp + 16]
mov ebx,[bp + 8]
or eax,eax
jnl SCRLeftOK
add ecx,eax
xor eax,eax
SCRLeftOK: or ebx,ebx
jnl SCRTopOK
add edx,ebx
xor ebx,ebx
SCRTopOK:
mov _ClipLeft,eax
mov _ClipTop,ebx
add eax,ecx
dec eax
add ebx,edx
dec ebx
cmp eax,_GRWidth
jl SCRRightOK
sub ecx,eax
mov eax,_GRWidth
dec eax
add ecx,eax
SCRRightOK: cmp ebx,_GRHeight
jl SCRBottomOK
sub edx,ebx
mov ebx,_GRHeight
dec ebx
add edx,ebx
SCRBottomOK:
mov _ClipRight,eax
mov _ClipBottom,ebx
mov _ClipWidth,ecx
mov _ClipHeight,edx
pop bp
ret
_SetClippingRegion endp
;void GetClippingRegion(long PhysLeft, long PhysTop, long PhysWidth, long PhysHeight);
public _GetClippingRegion
_GetClippingRegion proc
push bp
mov bp,sp
mov ebx,[bp + 4]
mov eax,_ClipLeft
mov gs:[ebx],eax
mov ebx,[bp + 8]
mov eax,_ClipTop
mov gs:[ebx],eax
mov ebx,[bp + 12]
mov eax,_ClipWidth
mov gs:[ebx],eax
mov ebx,[bp + 16]
mov eax,_ClipHeight
mov gs:[ebx],eax
pop bp
ret
_GetClippingRegion endp
;void SetViewportOrigin(long Left, long Top);
public _SetViewportOrigin
_SetViewportOrigin proc
push bp
mov bp,sp
mov eax,[bp + 4]
mov ebx,[bp + 8]
mov ecx,_VPLeft
sub ecx,eax
mov edx,_VPTop
sub edx,ebx
; add _ClipLeft,ecx
; add _ClipRight,ecx
; add _ClipTop,edx
; add _ClipBottom,edx
mov _VPLeft,eax
mov _VPTop,ebx
pop bp
ret
_SetViewportOrigin endp
;void GetViewportOrigin(long PhysLeft, long PhysTop)
public _GetViewportOrigin
_GetViewportOrigin proc
push bp
mov bp,sp
mov ebx,[bp + 4]
mov eax,_VPLeft
mov gs:[ebx],eax
mov ebx,[bp + 8]
mov eax,_VPTop
mov gs:[ebx],eax
pop bp
ret
_GetViewportOrigin endp
;void MapFontData()
public _MapFontData
_MapFontData proc
ret
_MapFontData endp
;long PMTextWidth(long PhysStr)
public _PMTextWidth
_PMTextWidth proc
push bp
mov bp,sp
push esi
mov esi,[bp + 4]
cld
jmp PMTWGetChar
PMTWIncLen: movzx eax,al
shl ax,2
add eax,_PhysFontHeader
movzx ax,gs:byte ptr [eax + 3]
add cx,ax
PMTWGetChar: lods gs:byte ptr [esi]
or al,al
jnz PMTWIncLen
mov ax,cx
xor dx,dx
pop esi
pop bp
ret
_PMTextWidth endp
;void CreateText(long Width, long PhysStr, long Color);
public _CreateText
_CreateText proc
push bp
mov bp,sp
push esi
push edi
push es
cld
mov ax,gs
mov es,ax
mov edi,GrTextBuffer
mov esi,[bp + 8]
jmp CTGetChar
CTDrawChar: shl ax,2
add eax,_PhysFontHeader
push eax
movzx ebx,gs:word ptr [eax]
movzx edx,gs:byte ptr [eax + 2]
shl bx,1
shl dx,1
add edx,ebx
jmp CTTestCharEnd
CTDrawLine: push edi
mov eax,_PhysFontData
movzx ecx,gs:word ptr [ebx + eax]
mov eax,ecx
shr ax,10
add edi,eax
mov ax,cx
shr ax,5
and ax,001fh
imul eax,[bp + 4]
add edi,eax
and cx,001fh
mov ax,[bp + 12]
rep stos es:byte ptr [edi]
pop edi
add ebx,2
CTTestCharEnd: cmp ebx,edx
jl CTDrawLine
pop eax
movzx eax,gs:byte ptr [eax + 3]
add edi,eax
CTGetChar: xor eax,eax
lods gs:byte ptr [esi]
or al,al
jnz CTDrawChar
pop es
pop edi
pop esi
pop bp
ret
_CreateText endp
FARCODE ends
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -