1 ;======================================================================
2 ; SERIAL PORT - TRANSMISSION TO HOST
7 ;======================================================================
8 ; QUEUEING MESSAGES FOR TRANSMISSION
11 addbyte_toomany panic morse_HB
13 ;----------------------------------------
15 ; W byte to xmit to host trashed
16 ; FSR0 any set for serial_addbyte_another
17 ; outbuf, outmsg_* buffer not full adjusted appropriately
19 ; all others any not interfered with
22 mov_ff outmsg_end, FSR0L
24 ;----------------------------------------
25 serial_addbyte_another @
26 ; W byte to xmit to host trashed
27 ; FSR0 from _addbyte[_another] updated for ..._another again
28 ; outbuf, outmsg_* buffer not full adjusted appropriately
30 ; all others any not interfered with
41 return ; don't bother messing about if tx is already enabled
43 ; we fall through to portb_read to reenable TXIE if appropriate
45 ;======================================================================
46 ; FLOW CONTROL BY HOST OF OUR TRANSMISSIONS
49 ;----------------------------------------
52 ; W undefined value from PORTB
53 ; TXIE any enabled iff host allows us to xmit
55 ; Note that this will reenable TXIE even if the serial buffer is empty,
56 ; every time portb_read is called. This doesn't matter very much
57 ; because the serialtx_intrl routine will disable it again straight
63 bt_w_if1 p0_rs232_fcin >> 4
67 call led_green ; we're transmitting
74 goto led_red ; flow control forces us not to transmit
76 ;----------------------------------------------------------------------
82 rcall portb_read ; check flow control
85 ;----------------------------------------------------------------------
90 pin_l p0_rs232_fcout ; set outgoing RTS/CTS active
93 ;======================================================================
96 ;----------------------------------------------------------------------
98 ; are we ready to transmit ?
113 bra_n tx_justsent_noacknmra
114 ; we've just sent the last byte of some message:
115 ; maybe we push an NMRADONE message on the front
117 bra_nz tx_acknmra_insert
118 tx_justsent_noacknmra
120 bc_f outmsg_begin, outbuf_szln2
121 call i2c_consider_restartread
123 intrl_handled_nostack
127 sub_wff acknmra ; we're acking these now
128 mov_wf INDF0 ; write it over the message we just sent
133 sub_wff acknmra ; we're acking these now
139 ; maybe we send an NMRADONE
141 bra_nz tx_acknmra_send
142 ; nothing at all to do:
144 call led_black ; we're not transmitting
145 intrl_handled_nostack
147 ;----------------------------------------------------------------------
153 ;======================================================================