> ; > ; Write the message to the display. > ; > clrf fsr ;init message index > outloop unbank ;back here each new message character > movf fsr, w ;get the index for this character > incf fsr ;increment the index for next time > mcallr message, reg0 ;get the indexed message char in REG0 > movf reg0 ;set Z if this char is null terminator > skip_nz ;got valid message char, not terminator ? > goto loop ;done writing the message > gcall sendchar ;send char in REG0 to the display > goto outloop ;back to do next message character > ; > ;******************** > ; > ; Local subroutine MESSAGE > ; > ; Return the indexed message character in W. The 0-N character > ; index is in FSR, which is preserved. > ; > message locsub, noregs > movlw low msg ;get low byte of table start address > addwf fsr, w ;make table entry address low byte > skip_ncarr ;propagate carry to high address byte > incf pclath > movwf pcl ;jump the the selected table entry > > msg dt "Hello" ;the message string to send > dt 0 ;string terminator I just realized that I changed the subroutine to take FSR as the index (as documented), but forgot to go back and update the calling code. Oh well, that's what I get for letting people see my untested code. However, the point of this code was the documentation style, which is still valid. ***************************************************************** Olin Lathrop, embedded systems consultant in Devens Massachusetts (978) 772-3129, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads