Display contents of Xwire network Rx data block
One of the functions performed in a couple of places in the sandbox program is to display the contents of the network Rx data block on the LCD, taking into account the number of bytes of available data, as indicated by bRxLength. This is done by the following subroutine:
(Click here for some tips for working around problems with copy and paste out of Internet Explorer and HTML-help (.chm) files)
;----- Display contents (up to 30 bytes) of Xwire network Rx data block
RxDCount: defBYTE ;local loop counter
RxDisplay:
OBLCD_Cls
Recall bRxLength ;Get the byte count
Push ;Duplicate
GoIfNZ RxD1 ;Test there's something there
OBLCD_Text "Nothing frm srvr" ;Oops!
Return
RxD1:
Store RxDCount ;Save the loop counter
LoadI 0 ;Index into the Rx data block
RxDispLoop:
iRecall abRxData ;Get the next byte
OBLCD_CharX ;Display
IncI ;Increment the read index to the next character
DMGNZ RxDCount,RxDispLoop ;Decrement and test the loop counter
Return ;All done
The main trick here is using the index register I to access a range of data bytes, while using a memory location (RxDCount) to count down the bytes being moved.