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
73 goto led_red ; flow control forces us not to transmit
75 ;----------------------------------------------------------------------
81 rcall portb_read ; check flow control
84 ;----------------------------------------------------------------------
89 pin_l p0_rs232_fcout ; set outgoing RTS/CTS active
92 ;======================================================================
95 ;----------------------------------------------------------------------
97 ; are we ready to transmit ?
112 bra_n tx_justsent_noacknmra
113 ; we've just sent the last byte of some message:
114 ; maybe we push an NMRADONE message on the front
116 bra_nz tx_acknmra_insert
117 tx_justsent_noacknmra
119 bc_f outmsg_begin, outbuf_szln2
120 call i2c_consider_restartread
122 call led_green ; we're transmitting
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 ;----------------------------------------------------------------------
154 ;======================================================================