Subroutines for individual Network commands
There are a number of subroutines that use SCH_SetCommand to send specific commands to the SX10509. Most are quite trivial. Here’s one of them:
;----- Send GET command to SCH
; sSCH_GotEchois set once the command is echoed by SCH
SCH_Get:
LoadX kCMD_DoGet
GoSub SCH_SetCommand
Return
There are several that follow the same pattern. They make it easier to code the higher level stuff, and make the program a lot more readable.
The subroutine for commanding a read from the SX10509 network Rx buffer is a bit more interesting. It is designed to use an offset, passed to it in the I (index) register, as a parameter in the command being sent to the SX10509. The Read command is documented here.
;----- Read from n/w Rx buffer in SCH to Xwire Rx data block
; Starting offset in I
; sSCH_GotEchois set once the command is echoed by SCH
SCH_Read:
ItoX
Store bTxLength ;Incremental offset
LoadX kCMD_Read
GoSub SCH_SetCommand
Return