Take 2......................
Code:
string var byte[255] : stringpos var byte
ASM
copystr macro stringcopy
local thestringcopy , overthestring
goto overthestring
thestringcopy
data stringcopy , 0
overthestring
MOVE?CW thestringcopy , _addr
;It is necessary to use CN in place of CW to cover the case when the
;copystring statement is located above 64K (i.e. PIC18F4685, '8722, etc.etc.)
L?CALL _copystring
endm
ENDASM
copystring: stringpos = 0
copystringloop: READCODE addr , char : if char = 0 then copystringdone
string[ stringpos ] = char : addr = addr + 1
stringpos = stringpos + 1
if stringpos < 255 then copystringloop
copystringdone: string[ stringpos ] = 0 : stringpos = stringpos + 1
if stringpos < 254 then copystringdone
return
Bookmarks