Hi Guys,
Hope you don't mind me butting in...
I've been using a similar method for 18F' devices in assembler for awhile now and I wonder if you might need to account for the occasional odd length character string to make sure the address is word aligned before placing it back into TOS?
Regards, Mike
Code:
;
; Example macro usage
;
_Title "K8LH Az/El Controller\r\n\n"
_Print "Satellite AOS:\r\n"
_Print "Satellite LOS:\r\n"
;******************************************************************
;
; print the in-line string using Stack Pointer & TBLPTR
;
PutString
movff TOSH,TBLPTRH ; copy SP address to TBLPTR
movff TOSL,TBLPTRL ;
clrf TBLPTRU ;
PutNxt tblrd *+ ; get character
movf TABLAT,W ; last character (00)?
bz PutXit ; yes, exit
rcall Put232 ; else, print character
bra PutNxt ; do another
PutXit btfsc TBLPTRL,0 ; odd address?
tblrd *+ ; yes, make it even (fix PC)
movf TBLPTRH,W ;
movwf TOSH ; update the return stack
movf TBLPTRL,W ;
movwf TOSL ;
return ;
;
;******************************************************************
Bookmarks