Got a modification of the PRINTSTR macro for my nokia lcd...
Code:
ASM
PrintStr macro x, y, Str
local TheString, OverStr
goto OverStr
TheString
data Str, 0
OverStr
MOVE?CB x, _lcdpx
MOVE?CB y, _lcdpy
MOVE?CW TheString, _Addr
L?CALL _StringOut
endm
ENDASM
StringOut:
Readcode Addr, Char : if Char = 0 then StringDone ' Look for Null char, Stop if found
gosub puttext : Addr = Addr + 1 : lcdpx = lcdpx + 1 : goto StringOut
StringDone: return
Is there a conditional directive that'll "overload" (I suppose like C++) the PRINTSTR macro to either accept or ignore 2 extra parameters?
In my case, I want to add foreground color and background color, but not neccessarily one or both at the same time...like this
Code:
PrintStr macro x, y, Str , forecolor , backcolor
If both are there, great, process them as normal.
If the background color value isn't there, ignore it and don't change it.
If the foreground color value isn't there, ignore both of them and don't change either.
Sure, it's easy enough to make 3 different versions of the same thing, and use 3 different names, i.e. printstr, printstrf (set foreground only ), printstrfb (set both foreground/background), printstrb (set background only).
If I assumed null-zero's would work, that would be fine except that I'm dealing with 8 bits of color (soon to be 16) and a zero-null is a valid color.
Bookmarks