 sttl Time of Day Clock Handler
 pag
*
* Time of Day Clock Device table
*
DEV_TOD
 fdb bad_cmd  0 -
 fdb open_tod  1 -
 fdb close_tod  2 -
 fdb bad_cmd  3 -
 fdb bad_cmd  4 -
 fdb treq_write  5 -
 fdb twrite_data  6 -
 fdb bad_cmd  7 -
 fdb treq_read  8 -
 fdb tread_data  9 -
 fdb bad_cmd 10 -
 fdb bad_cmd 11 -
 fdb bad_cmd 12 -
 fdb bad_cmd 13 -
 fdb bad_cmd 14 -
 fdb clock_on 15 -
 pag

*
* treq_read - CPU has informed us he wants to read
* Tell him when some data is available.
*
treq_read
 lda #TOD_SIZE -- Size of TOD information
 ldb #R_RDOK data available
 rts

*
* tread_data - CPU wants IOP to send data
*  Max # chars to move in transaction speicific value
*
tread_data
 clra
10 sta TOD_ADDR
 ldb TOD_DATA move TOD data to FIFO
 jsr FIFO_put
 inca
 cmpa #TOD_SIZE
 bne 10b
 ldb #R_SNDNC data now available in FIFO
 rts

*
* open_tod - Perform device open
*
open_tod
 ldb #R_OPEN
 rts

*
* close_tod - Perform device close
*
close_tod
 ldb #R_CLOSE
 rts

*
* treq_write - Request permission to write data
*
treq_write
 ldb #R_REQOK request granted code
 puls pc return

*
* twrite_data - Write data to TOD
*
twrite_data
 clra
10 jsr FIFO_get
 sta TOD_ADDR
 stb TOD_DATA
 inca
 cmpa #TOD_SIZE
 bne 10b
 ldb #R_WRITE
 puls pc return
