
 sttl Main Command Processing
 pag

*
* Process - Get a command from the system CPU via
*   the FIO mailbox.  Then process the command as
*   necessary.
*
process bsr fio_rcv wait for a command
 tfr b,a save command byte
 lsra isolate opcode
 lsra
 lsra
 lsra
 cmpa #MAX_cmd legal command?
 bls go_cmd yes - go try to process it
 ldb #REJECT+BAD_CMD no - return bad command
reply bsr fio_send send response code to host
 bra process
go_cmd ldx #CMD_tab set up to process
 lsla
 jsr [d,x] perform function
 bra reply send result code

*
* Command Processing Table
*
CMD_tab equ *
 fdb null_cmd 0 - Null command
 fdb rs_ports 1 - Reset ports
 fdb putchar  2 - Write Single Character
 fdb getchar  3 - Read Character
 fdb scan_kb  4 - Check for presence of character
*
MAX_cmd equ ((*-CMD_tab)/2)-1 Largest legal command

 sttl Command Processing
 pag

 spc 4,10
*
* Null command - just here for a clean interface
*
null_cmd ldb #0 return no error
 rts

 spc 4,10
*
* putchar - Write one character to the selected port
*   -- Character comes from FIFO
*
putchar bsr select select terminal port
 bsr fifo_get get data byte from FIFO
 bsr out_char output character
 ldb #0 return - no error
 rts

