Whadaya think? Is it going to work?
I based this off of Mr_E's simple print-string routine originally written for an LCD, adapted for my GLCD, now adapted to copy a string within the source over to a string array...basically so I can send it out with a serout or lcdout command.
Code:
string var byte[255] : stringpos var byte
ASM
copystr macro str
local thestring , overstr
goto overstr
thestring
data str , 0
overstr
MOVE?CW thestring , _addr
L?CALL _copystring
endm
ENDASM
copystring: stringpos = 0
copystringloop:
READCODE addr , char
if char = 0 then copystringdone
string[ stringpos ] = char
stringpos = stringpos + 1
if stringpos < 255 then copystring1
copystringdone:
stringpos = stringpos + 1
string [ stringpos ] = 0
if stringpos < 255 then copystringdone
return
Now the statement:
@ copystr "TEST STRING"
should end up with the variable string with "TEST STRING" with the remainder of the array zero'd.
(and look...only one colon
)
Bookmarks