144 lines
4.7 KiB
NASM
144 lines
4.7 KiB
NASM
macro defLabel name, color, [text]
|
||
{
|
||
common
|
||
local ..str
|
||
..str db text, 0
|
||
name#.len = $ - ..str - 1
|
||
name LABEL color, name#.len, ..str
|
||
}
|
||
macro defNumber name, color, size
|
||
{
|
||
common
|
||
name#.len = size
|
||
name LABEL color, name#.len, 0
|
||
}
|
||
; -----------------------------
|
||
; <20>¨áã¥â ⥪áâ ¯® yPosition ¨ æ¥âà¨àãï ⥪áâ ¯® è¨à¨¥ íªà
|
||
; á ãç¥â®¬ ¤«¨ë ⥪áâ ¨ 㪠§ ®£® á¬¥é¥¨ï ¢ ᨬ¢®« å
|
||
; input: pText - 㪠§ ⥫ì áâàãªâãàã
|
||
; yPosition - ¯®§¨æ¨ï Y
|
||
; countOffset - ª®«-¢® ᨬ¢®«®¢ ¤«ï ᬥ饨ï
|
||
; -----------------------------
|
||
proc draw.Navigation pText, yPosition, countOffset
|
||
mov eax, [pText]
|
||
mov eax, [eax + LABEL.size]
|
||
sub eax, [countOffset]
|
||
stdcall draw.GetNavigationX, eax
|
||
stdcall draw.Label, [pText], eax, [yPosition], 0
|
||
ret
|
||
endp
|
||
; -----------------------------
|
||
; <20>¨áã¥â ç¨á«® ¯® yPosition ¨ æ¥âà¨àãï ç¨á«® ¯® è¨à¨¥ íªà
|
||
; á ãç¥â®¬ ¤«¨ë ç¨á« ¨ 㪠§ ®£® á¬¥é¥¨ï ¢ ᨬ¢®« å
|
||
; input: pNumber - 㪠§ ⥫ì áâàãªâãàã
|
||
; yPosition - ¯®§¨æ¨ï Y
|
||
; countOffset - ª®«-¢® ᨬ¢®«®¢ ¤«ï ᬥ饨ï
|
||
; -----------------------------
|
||
proc draw.NavigationNumber pNumber, yPosition, countOffset
|
||
mov eax, [pNumber]
|
||
mov eax, [eax + LABEL.size]
|
||
sub eax, [countOffset]
|
||
stdcall draw.GetNavigationX, eax
|
||
stdcall draw.Number, [pNumber], eax, [yPosition], 0
|
||
ret
|
||
endp
|
||
; -----------------------------
|
||
; ‚®§¢à é ¥â ª®®à¤¨ âã X ¤«ï à §¬¥é¥¨ï ⥪áâ ¯® æ¥âàã íªà
|
||
; á ãç¥â®¬ 㪠§ ®£® á¬¥é¥¨ï ¢ ᨬ¢®« å
|
||
; input: countOffset - ª®«-¢® ᨬ¢®«®¢ ¤«ï ᬥ饨ï
|
||
; output: eax - ª®®à¤¨ â X
|
||
; -----------------------------
|
||
proc draw.GetNavigationX countOffset
|
||
mov eax, [countOffset]
|
||
neg eax
|
||
mul [configFont.width]
|
||
add eax, [window_width]
|
||
sub eax, 10
|
||
shr eax, 1
|
||
ret
|
||
endp
|
||
; -----------------------------
|
||
; ”®à¬¨àã¥â ¢ ®¤®¬ ॣ¨áâॠª®®à¤¨ âë ¢ 㦮¬ ä®à¬ ⥠¤®¡ ¢«ïï
|
||
; è¨à¨ã ᬥ饨ï ᨬ¢®«®¢ ¯® X ¥á«¨ 㪠§ ® ª®«-¢®
|
||
; input: xPosition - ¯®§¨æ¨ï ¯® X
|
||
; yPosition - ¯®§¨æ¨ï ¯® Y
|
||
; countOffset - ª®«-¢® ᨬ¢®«®¢ ¤«ï ᬥ饨ï
|
||
; output: eax - ª®®à¤¨ â ¢ ä®à¬ ⥠X*65536+Y
|
||
; -----------------------------
|
||
proc draw._prepareCoord xPosition, yPosition, countOffset
|
||
mov eax, [countOffset]
|
||
mul [configFont.width]
|
||
add eax, [xPosition]
|
||
shl eax, 16
|
||
add eax, [yPosition]
|
||
ret
|
||
endp
|
||
; -----------------------------
|
||
; <20>¨áã¥â ⥪áâ ¯® 㪠§ ®© ¯®§¨æ¨¨ X ¨ Y
|
||
; ¨ á¬¥é ¥â è¨à¨ã ᨬ¢®«®¢ ¯® X ¥á«¨ 㪠§ ®
|
||
; input: pText - 㪠§ ⥫ì áâàãªâãàã
|
||
; xPosition - ¯®§¨æ¨ï X
|
||
; yPosition - ¯®§¨æ¨ï Y
|
||
; countOffset - ª®«-¢® ᨬ¢®«®¢ ¤«ï ᬥ饨ï
|
||
; -----------------------------
|
||
proc draw.Label pText, xPosition, yPosition, countOffset
|
||
stdcall draw._prepareCoord, [xPosition], [yPosition], [countOffset]
|
||
mov ebx, eax
|
||
mov eax, [pText]
|
||
mov ecx, [configFont.mask]
|
||
or ecx, [eax + LABEL.color]
|
||
mov edx, [eax + LABEL.value]
|
||
mcall 4
|
||
ret
|
||
endp
|
||
; -----------------------------
|
||
; <20>¨áã¥â ç¨á«® ¯® 㪠§ ®© ¯®§¨æ¨¨ X ¨ Y
|
||
; ¨ á¬¥é ¥â è¨à¨ã ᨬ¢®«®¢ ¯® X ¥á«¨ 㪠§ ®
|
||
; input: pNumber - 㪠§ ⥫ì áâàãªâãàã
|
||
; xPosition - ¯®§¨æ¨ï X
|
||
; yPosition - ¯®§¨æ¨ï Y
|
||
; countOffset - ª®«-¢® ᨬ¢®«®¢ ¤«ï ᬥ饨ï
|
||
; -----------------------------
|
||
proc draw.Number pNumber, xPosition, yPosition, countOffset
|
||
stdcall draw._prepareCoord, [xPosition], [yPosition], [countOffset]
|
||
mov edx, eax
|
||
mov eax, [pNumber]
|
||
mov ebx, [eax + LABEL.size]
|
||
shl ebx, 16
|
||
mov ecx, [eax + LABEL.value]
|
||
mov esi, [configFont.maskNumber]
|
||
or esi, [eax + LABEL.color]
|
||
mcall 47, , , , ,[background_color]
|
||
ret
|
||
endp
|
||
; -----------------------------
|
||
; “áâ ®¢¨âì áâனª¨ èà¨äâ ¢ § ¢¨á¨¬®á⨠®â à §¬¥à ï祩ª¨
|
||
; ãáâ ¢«¨¢ ¥â ¢ëá®âã, è¨à¨ã ᨬ¢®« ¨ ¬ áªã ¤«ï à¨á®¢ ¨ï ⥪áâ ¨ ç¨á«
|
||
; input: squareSideLength - à §¬¥à ï祩ª¨
|
||
; -----------------------------
|
||
proc draw.setConfigFont squareSideLength
|
||
cmp [squareSideLength], MIN_SQUARE_SIDE_LENGTH_FONT
|
||
jg @f
|
||
cmp [configFont.flag], FONT_SMALL
|
||
je .return
|
||
mov [configFont.flag], FONT_SMALL
|
||
jmp .set
|
||
@@:
|
||
cmp [configFont.flag], FONT_LARGE
|
||
je .return
|
||
mov [configFont.flag], FONT_LARGE
|
||
.set:
|
||
mov eax, [configFont.flag]
|
||
lea ebx, [eax + 8]
|
||
shl ebx, 28
|
||
mov [configFont.mask], ebx
|
||
lea ebx, [eax*2 + 6]
|
||
mov [configFont.width], ebx
|
||
lea ebx, [8 + eax*4]
|
||
mov [configFont.height], ebx
|
||
lea ebx, [eax + 4]
|
||
shl ebx, 28
|
||
mov [configFont.maskNumber], ebx
|
||
.return:
|
||
ret
|
||
endp |