This is how I do it
Code:
prn_SetDate: PokeCode "Date changed",0
prn_SetTime: PokeCode "Time changed",0
prn_LogPrinted: PokeCode "Log printed",0
prn_SafeClosedByMaster: PokeCode "Key interlock cleared by master",0
ASM
GetAddress macro Label, Wout ; Returns the Address of a Label as a Word
CHK?RP Wout
movlw low Label
movwf Wout
movlw High Label
movwf Wout + 1
endm
ENDASM
Address var word
'----snip------
' This is how to use it
' Prt_puts uses the Variable Address to print the contents pointed at by it
@ GetAddress _prn_SetDate, _Address ;macro from this site
gosub Prt_puts ; put the string to printer
'----snip------
' Print an ASCIIZ string
' Input - Address points to the string
Prt_puts:
repeat
peekcode Address, gr[0] ' gr[0] is a byte sized user register
if gr[0] then
gosub Prt_putc ' print 1 character
Address = Address+1
endif
until gr[0]=0 ' print till end of string '0'
return
Hope this helps
Bookmarks