annotate level1/modules/sc6551.asm @ 3295:6b7a7b233925 default tip

makefile: Allow PORTS with level1/2 mix https://sourceforge.net/p/nitros9/feature-requests/10/
author Tormod Volden <debian.tormod@gmail.com>
date Tue, 19 Apr 2022 18:12:17 +0200
parents f91dc5c378f6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
1 ********************************************************************
1488
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
2 * sc6551 - 6551 Driver
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
3 *
ddf87e72951c sacia added
boisy
parents:
diff changeset
4 * $Id$
ddf87e72951c sacia added
boisy
parents:
diff changeset
5 *
1488
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
7 * Comment
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
1488
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
9 * ????/??/??
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
10 * NitrOS-9 2.00 distribution.
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
11 *
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
12 * 9r4 2003/01/01 Boisy G. Pitre
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
13 * Back-ported to OS-9 Level Two.
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
14 *
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
15 * 10r1 2003/??/?? Robert Gault
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
16 * Added 6809 code where it was lacking.
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
17 *
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
18 * 10r2 2004/05/03 Boisy G. Pitre
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
19 * Fixed numerous issues with 6809 and Level 1 versions.
1550
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
20 * Tested 6809 Level 1 and Level 2.
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
21
1488
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
22 nam sc6551
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
23 ttl 6551 Driver
ddf87e72951c sacia added
boisy
parents:
diff changeset
24
ddf87e72951c sacia added
boisy
parents:
diff changeset
25 ifp1
ddf87e72951c sacia added
boisy
parents:
diff changeset
26 use defsfile
2682
f91dc5c378f6 Remove references to include scfdefs
William Astle <lost@l-w.ca>
parents: 1587
diff changeset
27 ; use scfdefs
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
28 endc
ddf87e72951c sacia added
boisy
parents:
diff changeset
29
ddf87e72951c sacia added
boisy
parents:
diff changeset
30 * conditional assembly switches
ddf87e72951c sacia added
boisy
parents:
diff changeset
31 TC9 set false "true" for TC-9 version, "false" for Coco 3
ddf87e72951c sacia added
boisy
parents:
diff changeset
32 MPIFlag set true "true" MPI slot selection, "false" no slot
ddf87e72951c sacia added
boisy
parents:
diff changeset
33
ddf87e72951c sacia added
boisy
parents:
diff changeset
34 * miscellaneous definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
35 DCDStBit equ %00100000 DCD status bit for SS.CDSta call
ddf87e72951c sacia added
boisy
parents:
diff changeset
36 DSRStBit equ %01000000 DSR status bit for SS.CDSta call
ddf87e72951c sacia added
boisy
parents:
diff changeset
37 SlpBreak set TkPerSec/2+1 line Break duration
ddf87e72951c sacia added
boisy
parents:
diff changeset
38 SlpHngUp set TkPerSec/2+1 hang up (drop DTR) duration
ddf87e72951c sacia added
boisy
parents:
diff changeset
39
ddf87e72951c sacia added
boisy
parents:
diff changeset
40 ifeq TC9-true
ddf87e72951c sacia added
boisy
parents:
diff changeset
41 IRQBit equ %00000100 GIME IRQ bit to use for IRQ ($FF92)
ddf87e72951c sacia added
boisy
parents:
diff changeset
42 else
ddf87e72951c sacia added
boisy
parents:
diff changeset
43 IRQBit equ %00000001 GIME IRQ bit to use for IRQ ($FF92)
ddf87e72951c sacia added
boisy
parents:
diff changeset
44 endc
ddf87e72951c sacia added
boisy
parents:
diff changeset
45
ddf87e72951c sacia added
boisy
parents:
diff changeset
46 * 6551 register definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
47 org 0
ddf87e72951c sacia added
boisy
parents:
diff changeset
48 DataReg rmb 1 receive/transmit Data (read Rx / write Tx)
ddf87e72951c sacia added
boisy
parents:
diff changeset
49 StatReg rmb 1 status (read only)
ddf87e72951c sacia added
boisy
parents:
diff changeset
50 PRstReg equ StatReg programmed reset (write only)
ddf87e72951c sacia added
boisy
parents:
diff changeset
51 CmdReg rmb 1 command (read/write)
ddf87e72951c sacia added
boisy
parents:
diff changeset
52 CtlReg rmb 1 control (read/write)
ddf87e72951c sacia added
boisy
parents:
diff changeset
53
ddf87e72951c sacia added
boisy
parents:
diff changeset
54 * Status bit definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
55 Stat.IRQ equ %10000000 IRQ occurred
ddf87e72951c sacia added
boisy
parents:
diff changeset
56 Stat.DSR equ %01000000 DSR level (clear = active)
ddf87e72951c sacia added
boisy
parents:
diff changeset
57 Stat.DCD equ %00100000 DCD level (clear = active)
ddf87e72951c sacia added
boisy
parents:
diff changeset
58 Stat.TxE equ %00010000 Tx data register Empty
ddf87e72951c sacia added
boisy
parents:
diff changeset
59 Stat.RxF equ %00001000 Rx data register Full
ddf87e72951c sacia added
boisy
parents:
diff changeset
60 Stat.Ovr equ %00000100 Rx data Overrun error
ddf87e72951c sacia added
boisy
parents:
diff changeset
61 Stat.Frm equ %00000010 Rx data Framing error
ddf87e72951c sacia added
boisy
parents:
diff changeset
62 Stat.Par equ %00000001 Rx data Parity error
ddf87e72951c sacia added
boisy
parents:
diff changeset
63
ddf87e72951c sacia added
boisy
parents:
diff changeset
64 Stat.Err equ Stat.Ovr!Stat.Frm!Stat.Par Status error bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
65 Stat.Flp equ $00 all Status bits active when set
ddf87e72951c sacia added
boisy
parents:
diff changeset
66 Stat.Msk equ Stat.IRQ!Stat.RxF active IRQs
ddf87e72951c sacia added
boisy
parents:
diff changeset
67
ddf87e72951c sacia added
boisy
parents:
diff changeset
68 * Control bit definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
69 Ctl.Stop equ %10000000 stop bits (set=two, clear=one)
ddf87e72951c sacia added
boisy
parents:
diff changeset
70 Ctl.DBit equ %01100000 see data bit table below
ddf87e72951c sacia added
boisy
parents:
diff changeset
71 Ctl.RxCS equ %00010000 Rx clock source (set=baud rate, clear=external)
ddf87e72951c sacia added
boisy
parents:
diff changeset
72 Ctl.Baud equ %00001111 see baud rate table below
ddf87e72951c sacia added
boisy
parents:
diff changeset
73
ddf87e72951c sacia added
boisy
parents:
diff changeset
74 * data bit table
ddf87e72951c sacia added
boisy
parents:
diff changeset
75 DB.8 equ %00000000 eight data bits per character
ddf87e72951c sacia added
boisy
parents:
diff changeset
76 DB.7 equ %00100000 seven data bits per character
ddf87e72951c sacia added
boisy
parents:
diff changeset
77 DB.6 equ %01000000 six data bits per character
ddf87e72951c sacia added
boisy
parents:
diff changeset
78 DB.5 equ %01100000 five data bits per character
ddf87e72951c sacia added
boisy
parents:
diff changeset
79
ddf87e72951c sacia added
boisy
parents:
diff changeset
80 * baud rate table
ddf87e72951c sacia added
boisy
parents:
diff changeset
81 org $00
ddf87e72951c sacia added
boisy
parents:
diff changeset
82 BR.ExClk rmb 1 16x external clock (not supported)
ddf87e72951c sacia added
boisy
parents:
diff changeset
83 org $11
ddf87e72951c sacia added
boisy
parents:
diff changeset
84 BR.00050 rmb 1 50 baud (not supported)
ddf87e72951c sacia added
boisy
parents:
diff changeset
85 BR.00075 rmb 1 75 baud (not supported)
ddf87e72951c sacia added
boisy
parents:
diff changeset
86 BR.00110 rmb 1 109.92 baud
ddf87e72951c sacia added
boisy
parents:
diff changeset
87 BR.00135 rmb 1 134.58 baud (not supported)
ddf87e72951c sacia added
boisy
parents:
diff changeset
88 BR.00150 rmb 1 150 baud (not supported)
ddf87e72951c sacia added
boisy
parents:
diff changeset
89 BR.00300 rmb 1 300 baud
ddf87e72951c sacia added
boisy
parents:
diff changeset
90 BR.00600 rmb 1 600 baud
ddf87e72951c sacia added
boisy
parents:
diff changeset
91 BR.01200 rmb 1 1200 baud
ddf87e72951c sacia added
boisy
parents:
diff changeset
92 BR.01800 rmb 1 1800 baud (not supported)
ddf87e72951c sacia added
boisy
parents:
diff changeset
93 BR.02400 rmb 1 2400 baud
ddf87e72951c sacia added
boisy
parents:
diff changeset
94 BR.03600 rmb 1 3600 baud (not supported)
ddf87e72951c sacia added
boisy
parents:
diff changeset
95 BR.04800 rmb 1 4800 baud
ddf87e72951c sacia added
boisy
parents:
diff changeset
96 BR.07200 rmb 1 7200 baud (not supported)
ddf87e72951c sacia added
boisy
parents:
diff changeset
97 BR.09600 rmb 1 9600 baud
ddf87e72951c sacia added
boisy
parents:
diff changeset
98 BR.19200 rmb 1 19200 baud
ddf87e72951c sacia added
boisy
parents:
diff changeset
99
ddf87e72951c sacia added
boisy
parents:
diff changeset
100 * Command bit definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
101 Cmd.Par equ %11100000 see parity table below
ddf87e72951c sacia added
boisy
parents:
diff changeset
102 Cmd.Echo equ %00010000 local echo (set=activated)
ddf87e72951c sacia added
boisy
parents:
diff changeset
103 Cmd.TIRB equ %00001100 see Tx IRQ/RTS/Break table below
ddf87e72951c sacia added
boisy
parents:
diff changeset
104 Cmd.RxI equ %00000010 Rx IRQ (set=disabled)
ddf87e72951c sacia added
boisy
parents:
diff changeset
105 Cmd.DTR equ %00000001 DTR output (set=enabled)
ddf87e72951c sacia added
boisy
parents:
diff changeset
106
ddf87e72951c sacia added
boisy
parents:
diff changeset
107 * parity table
ddf87e72951c sacia added
boisy
parents:
diff changeset
108 Par.None equ %00000000
ddf87e72951c sacia added
boisy
parents:
diff changeset
109 Par.Odd equ %00100000
ddf87e72951c sacia added
boisy
parents:
diff changeset
110 Par.Even equ %01100000
ddf87e72951c sacia added
boisy
parents:
diff changeset
111 Par.Mark equ %10100000
ddf87e72951c sacia added
boisy
parents:
diff changeset
112 Par.Spac equ %11100000
ddf87e72951c sacia added
boisy
parents:
diff changeset
113
ddf87e72951c sacia added
boisy
parents:
diff changeset
114 * Tx IRQ/RTS/Break table
ddf87e72951c sacia added
boisy
parents:
diff changeset
115 TIRB.Off equ %00000000 RTS & Tx IRQs disabled
ddf87e72951c sacia added
boisy
parents:
diff changeset
116 TIRB.On equ %00000100 RTS & Tx IRQs enabled
ddf87e72951c sacia added
boisy
parents:
diff changeset
117 TIRB.RTS equ %00001000 RTS enabled, Tx IRQs disabled
ddf87e72951c sacia added
boisy
parents:
diff changeset
118 TIRB.Brk equ %00001100 RTS enabled, Tx IRQs disabled, Tx line Break
ddf87e72951c sacia added
boisy
parents:
diff changeset
119
ddf87e72951c sacia added
boisy
parents:
diff changeset
120 * V.ERR bit definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
121 DCDLstEr equ %00100000 DCD lost error
ddf87e72951c sacia added
boisy
parents:
diff changeset
122 OvrFloEr equ %00000100 Rx data overrun or Rx buffer overflow error
ddf87e72951c sacia added
boisy
parents:
diff changeset
123 FrmingEr equ %00000010 Rx data framing error
ddf87e72951c sacia added
boisy
parents:
diff changeset
124 ParityEr equ %00000001 Rx data parity error
ddf87e72951c sacia added
boisy
parents:
diff changeset
125
ddf87e72951c sacia added
boisy
parents:
diff changeset
126 * FloCtlRx bit definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
127 FCRxSend equ %10000000 send flow control character
ddf87e72951c sacia added
boisy
parents:
diff changeset
128 FCRxSent equ %00010000 Rx disabled due to XOFF sent
ddf87e72951c sacia added
boisy
parents:
diff changeset
129 FCRxDTR equ %00000010 Rx disabled due to DTR
ddf87e72951c sacia added
boisy
parents:
diff changeset
130 FCRxRTS equ %00000001 Rx disabled due to RTS
ddf87e72951c sacia added
boisy
parents:
diff changeset
131
ddf87e72951c sacia added
boisy
parents:
diff changeset
132 * FloCtlTx bit definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
133 FCTxXOff equ %10000000 due to XOFF received
ddf87e72951c sacia added
boisy
parents:
diff changeset
134 FCTxBrk equ %00000010 due to currently transmitting Break
ddf87e72951c sacia added
boisy
parents:
diff changeset
135
ddf87e72951c sacia added
boisy
parents:
diff changeset
136 * Wrk.Type bit definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
137 Parity equ %11100000 parity bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
138 MdmKill equ %00010000 modem kill option
ddf87e72951c sacia added
boisy
parents:
diff changeset
139 RxSwFlow equ %00001000 Rx data software (XON/XOFF) flow control
ddf87e72951c sacia added
boisy
parents:
diff changeset
140 TxSwFlow equ %00000100 Tx data software (XON/XOFF) flow control
ddf87e72951c sacia added
boisy
parents:
diff changeset
141 RTSFlow equ %00000010 CTS/RTS hardware flow control
ddf87e72951c sacia added
boisy
parents:
diff changeset
142 DSRFlow equ %00000001 DSR/DTR hardware flow control
ddf87e72951c sacia added
boisy
parents:
diff changeset
143
ddf87e72951c sacia added
boisy
parents:
diff changeset
144 * Wrk.Baud bit definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
145 StopBits equ %10000000 number of stop bits code
ddf87e72951c sacia added
boisy
parents:
diff changeset
146 WordLen equ %01100000 word length code
ddf87e72951c sacia added
boisy
parents:
diff changeset
147 BaudRate equ %00001111 baud rate code
ddf87e72951c sacia added
boisy
parents:
diff changeset
148
ddf87e72951c sacia added
boisy
parents:
diff changeset
149 * Wrk.XTyp bit definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
150 SwpDCDSR equ %10000000 swap DCD+DSR bits (valid for 6551 only)
ddf87e72951c sacia added
boisy
parents:
diff changeset
151 ForceDTR equ %01000000 don't drop DTR in term routine
ddf87e72951c sacia added
boisy
parents:
diff changeset
152 RxBufPag equ %00001111 input buffer page count
ddf87e72951c sacia added
boisy
parents:
diff changeset
153
ddf87e72951c sacia added
boisy
parents:
diff changeset
154 * static data area definitions
ddf87e72951c sacia added
boisy
parents:
diff changeset
155 org V.SCF allow for SCF manager data area
ddf87e72951c sacia added
boisy
parents:
diff changeset
156 Cpy.Stat rmb 1 Status register copy
ddf87e72951c sacia added
boisy
parents:
diff changeset
157 CpyDCDSR rmb 1 DSR+DCD status copy
ddf87e72951c sacia added
boisy
parents:
diff changeset
158 Mask.DCD rmb 1 DCD status bit mask (MUST immediately precede Mask.DSR)
ddf87e72951c sacia added
boisy
parents:
diff changeset
159 Mask.DSR rmb 1 DSR status bit mask (MUST immediately follow Mask.DCD)
ddf87e72951c sacia added
boisy
parents:
diff changeset
160 CDSigPID rmb 1 process ID for CD signal
ddf87e72951c sacia added
boisy
parents:
diff changeset
161 CDSigSig rmb 1 CD signal code
ddf87e72951c sacia added
boisy
parents:
diff changeset
162 FloCtlRx rmb 1 Rx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
163 FloCtlTx rmb 1 Tx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
164 RxBufEnd rmb 2 end of Rx buffer
ddf87e72951c sacia added
boisy
parents:
diff changeset
165 RxBufGet rmb 2 Rx buffer output pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
166 RxBufMax rmb 2 Send XOFF (if enabled) at this point
ddf87e72951c sacia added
boisy
parents:
diff changeset
167 RxBufMin rmb 2 Send XON (if XOFF sent) at this point
ddf87e72951c sacia added
boisy
parents:
diff changeset
168 RxBufPtr rmb 2 pointer to Rx buffer
ddf87e72951c sacia added
boisy
parents:
diff changeset
169 RxBufPut rmb 2 Rx buffer input pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
170 RxBufSiz rmb 2 Rx buffer size
ddf87e72951c sacia added
boisy
parents:
diff changeset
171 RxDatLen rmb 2 current length of data in Rx buffer
ddf87e72951c sacia added
boisy
parents:
diff changeset
172 SigSent rmb 1 keyboard abort/interrupt signal already sent
ddf87e72951c sacia added
boisy
parents:
diff changeset
173 SSigPID rmb 1 SS.SSig process ID
ddf87e72951c sacia added
boisy
parents:
diff changeset
174 SSigSig rmb 1 SS.SSig signal code
ddf87e72951c sacia added
boisy
parents:
diff changeset
175 WritFlag rmb 1 initial write attempt flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
176 Wrk.Type rmb 1 type work byte (MUST immediately precede Wrk.Baud)
ddf87e72951c sacia added
boisy
parents:
diff changeset
177 Wrk.Baud rmb 1 baud work byte (MUST immediately follow Wrk.Type)
ddf87e72951c sacia added
boisy
parents:
diff changeset
178 Wrk.XTyp rmb 1 extended type work byte
1550
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
179 IFEQ Level-1
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
180 orgDFIRQ rmb 2
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
181 ENDC
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
182 regWbuf rmb 2 substitute for regW
ddf87e72951c sacia added
boisy
parents:
diff changeset
183 RxBufDSz equ 256-. default Rx buffer gets remainder of page...
ddf87e72951c sacia added
boisy
parents:
diff changeset
184 RxBuff rmb RxBufDSz default Rx buffer
ddf87e72951c sacia added
boisy
parents:
diff changeset
185 MemSize equ .
ddf87e72951c sacia added
boisy
parents:
diff changeset
186
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
187 rev set 2
1488
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
188 edition set 10
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
189
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
190 mod ModSize,ModName,Drivr+Objct,ReEnt+rev,ModEntry,MemSize
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
191
ddf87e72951c sacia added
boisy
parents:
diff changeset
192 fcb UPDAT. access mode(s)
ddf87e72951c sacia added
boisy
parents:
diff changeset
193
1488
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
194 ModName fcs "sc6551"
1a875569e4d7 sacia has been renamed to sc6551 and descriptors are modified accordingly
boisy
parents: 1469
diff changeset
195 fcb edition
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
196
ddf87e72951c sacia added
boisy
parents:
diff changeset
197 ifeq MPIFlag-true
ddf87e72951c sacia added
boisy
parents:
diff changeset
198 SlotSlct fcb MPI.Slot selected MPI slot
ddf87e72951c sacia added
boisy
parents:
diff changeset
199 else
ddf87e72951c sacia added
boisy
parents:
diff changeset
200 SlotSlct fcb $FF disable MPI slot selection
ddf87e72951c sacia added
boisy
parents:
diff changeset
201 endc
ddf87e72951c sacia added
boisy
parents:
diff changeset
202
ddf87e72951c sacia added
boisy
parents:
diff changeset
203 IRQPckt equ *
ddf87e72951c sacia added
boisy
parents:
diff changeset
204 Pkt.Flip fcb Stat.Flp flip byte
ddf87e72951c sacia added
boisy
parents:
diff changeset
205 Pkt.Mask fcb Stat.Msk mask byte
ddf87e72951c sacia added
boisy
parents:
diff changeset
206 fcb $0A priority
ddf87e72951c sacia added
boisy
parents:
diff changeset
207
ddf87e72951c sacia added
boisy
parents:
diff changeset
208 BaudTabl equ *
ddf87e72951c sacia added
boisy
parents:
diff changeset
209 fcb BR.00110,BR.00300,BR.00600
ddf87e72951c sacia added
boisy
parents:
diff changeset
210 fcb BR.01200,BR.02400,BR.04800
ddf87e72951c sacia added
boisy
parents:
diff changeset
211 fcb BR.09600,BR.19200
ddf87e72951c sacia added
boisy
parents:
diff changeset
212
1550
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
213 IFEQ Level-1
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
214 FIRQRtn tst ,s 'Entire' bit of carry set?
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
215 bmi L003B branch if so
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
216 leas -$01,s make room on stack
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
217 pshs y,x,dp,b,a save regs
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
218 lda $08,s get original CC on stack
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
219 stu $07,s save U
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
220 ora #$80 set 'Entire' bit
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
221 pshs a save CC
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
222 L003B jmp [>D.SvcIRQ] jump to IRQ service routine
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
223 ENDC
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
224
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
225 * NOTE: SCFMan has already cleared all device memory except for V.PAGE and
ddf87e72951c sacia added
boisy
parents:
diff changeset
226 * V.PORT. Zero-default variables are: CDSigPID, CDSigSig, Wrk.XTyp.
ddf87e72951c sacia added
boisy
parents:
diff changeset
227 Init clrb default to no error...
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
228 pshs cc,dp save IRQ/Carry status, system DP
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
229 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
230 tfr u,w
ddf87e72951c sacia added
boisy
parents:
diff changeset
231 tfr e,dp
ddf87e72951c sacia added
boisy
parents:
diff changeset
232 tfr y,w save descriptor pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
233 ELSE
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
234 tfr u,d
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
235 tfr a,dp
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
236 pshs y
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
237 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
238 ldd <V.PORT base hardware address
ddf87e72951c sacia added
boisy
parents:
diff changeset
239 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
240 incd point to 6551 status address
ddf87e72951c sacia added
boisy
parents:
diff changeset
241 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
242 addd #$0001
ddf87e72951c sacia added
boisy
parents:
diff changeset
243 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
244 leax IRQPckt,pc
ddf87e72951c sacia added
boisy
parents:
diff changeset
245 leay IRQSvc,pc
ddf87e72951c sacia added
boisy
parents:
diff changeset
246 os9 F$IRQ
ddf87e72951c sacia added
boisy
parents:
diff changeset
247 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
248 tfr w,y recover descriptor pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
249 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
250 puls y
ddf87e72951c sacia added
boisy
parents:
diff changeset
251 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
252 lbcs ErrExit go report error...
1550
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
253 IFEQ Level-1
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
254 ldd >D.FIRQ
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
255 std <orgDFIRQ
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
256 leax >FIRQRtn,pcr
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
257 stx >D.FIRQ
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
258 ENDC
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
259 ldb M$Opt,y get option size
ddf87e72951c sacia added
boisy
parents:
diff changeset
260 cmpb #IT.XTYP-IT.DTP room for extended type byte?
ddf87e72951c sacia added
boisy
parents:
diff changeset
261 bls DfltInfo no, go use defaults...
ddf87e72951c sacia added
boisy
parents:
diff changeset
262 ldd #Stat.DCD*256+Stat.DSR default (unswapped) DCD+DSR masks
ddf87e72951c sacia added
boisy
parents:
diff changeset
263 tst IT.XTYP,y check extended type byte for swapped DCD & DSR bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
264 bpl NoSwap no, go skip swapping them...
ddf87e72951c sacia added
boisy
parents:
diff changeset
265 exg a,b swap to DSR+DCD masks
ddf87e72951c sacia added
boisy
parents:
diff changeset
266 NoSwap std <Mask.DCD save DCD+DSR (or DSR+DCD) masks
ddf87e72951c sacia added
boisy
parents:
diff changeset
267 lda IT.XTYP,y get extended type byte
ddf87e72951c sacia added
boisy
parents:
diff changeset
268 sta <Wrk.XTyp save it
ddf87e72951c sacia added
boisy
parents:
diff changeset
269 anda #RxBufPag clear all but Rx buffer page count bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
270 beq DfltInfo none, go use defaults...
ddf87e72951c sacia added
boisy
parents:
diff changeset
271 clrb make data size an even number of pages
ddf87e72951c sacia added
boisy
parents:
diff changeset
272 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
273 tfr u,w save data pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
274 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
275 pshs u
ddf87e72951c sacia added
boisy
parents:
diff changeset
276 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
277 os9 F$SRqMem get extended buffer
ddf87e72951c sacia added
boisy
parents:
diff changeset
278 tfr u,x copy address
ddf87e72951c sacia added
boisy
parents:
diff changeset
279 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
280 tfr w,u recover data pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
281 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
282 puls u
ddf87e72951c sacia added
boisy
parents:
diff changeset
283 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
284 lbcs TermExit error, go remove IRQ entry and exit...
ddf87e72951c sacia added
boisy
parents:
diff changeset
285 bra SetRxBuf
ddf87e72951c sacia added
boisy
parents:
diff changeset
286 DfltInfo ldd #RxBufDSz default Rx buffer size
ddf87e72951c sacia added
boisy
parents:
diff changeset
287 leax RxBuff,u default Rx buffer address
ddf87e72951c sacia added
boisy
parents:
diff changeset
288 SetRxBuf std <RxBufSiz save Rx buffer size
ddf87e72951c sacia added
boisy
parents:
diff changeset
289 stx <RxBufPtr save Rx buffer address
ddf87e72951c sacia added
boisy
parents:
diff changeset
290 stx <RxBufGet set initial Rx buffer input address
ddf87e72951c sacia added
boisy
parents:
diff changeset
291 stx <RxBufPut set initial Rx buffer output address
ddf87e72951c sacia added
boisy
parents:
diff changeset
292 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
293 addr d,x point to end of Rx buffer
ddf87e72951c sacia added
boisy
parents:
diff changeset
294 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
295 leax d,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
296 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
297 stx <RxBufEnd save Rx buffer end address
ddf87e72951c sacia added
boisy
parents:
diff changeset
298 subd #80 characters available in Rx buffer
ddf87e72951c sacia added
boisy
parents:
diff changeset
299 std <RxBufMax set auto-XOFF threshold
ddf87e72951c sacia added
boisy
parents:
diff changeset
300 ldd #10 characters remaining in Rx buffer
ddf87e72951c sacia added
boisy
parents:
diff changeset
301 std <RxBufMin set auto-XON threshold after auto-XOFF
ddf87e72951c sacia added
boisy
parents:
diff changeset
302 ldb #TIRB.RTS default command register
ddf87e72951c sacia added
boisy
parents:
diff changeset
303 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
304 tim #ForceDTR,<Wrk.XTyp
ddf87e72951c sacia added
boisy
parents:
diff changeset
305 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
306 lda #ForceDTR
ddf87e72951c sacia added
boisy
parents:
diff changeset
307 bita <Wrk.XTyp
ddf87e72951c sacia added
boisy
parents:
diff changeset
308 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
309 beq NoDTR no, don't enable DTR yet
ddf87e72951c sacia added
boisy
parents:
diff changeset
310 orb #Cmd.DTR set (enable) DTR bit
ddf87e72951c sacia added
boisy
parents:
diff changeset
311 NoDTR ldx <V.PORT get port address
ddf87e72951c sacia added
boisy
parents:
diff changeset
312 stb CmdReg,x set new command register
ddf87e72951c sacia added
boisy
parents:
diff changeset
313 ldd IT.PAR,y [A] = IT.PAR, [B] = IT.BAU from descriptor
ddf87e72951c sacia added
boisy
parents:
diff changeset
314 lbsr SetPort go save it and set up control/format registers
ddf87e72951c sacia added
boisy
parents:
diff changeset
315 orcc #IntMasks disable IRQs while setting up hardware
ddf87e72951c sacia added
boisy
parents:
diff changeset
316 IFEQ TC9-true
ddf87e72951c sacia added
boisy
parents:
diff changeset
317 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
318 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
319 aim #$FC,>PIA1Base+3
ddf87e72951c sacia added
boisy
parents:
diff changeset
320 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
321 lda >PIA1Base+3
ddf87e72951c sacia added
boisy
parents:
diff changeset
322 anda #$FC
1550
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
323 IFEQ Level-1
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
324 ora #$01
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
325 ENDC
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
326 sta >PIA1Base+3
ddf87e72951c sacia added
boisy
parents:
diff changeset
327 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
328 lda >PIA1Base+2 clear possible pending PIA CART* FIRQ
ddf87e72951c sacia added
boisy
parents:
diff changeset
329 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
330 IFGT Level-1
ddf87e72951c sacia added
boisy
parents:
diff changeset
331 lda #IRQBit get GIME IRQ bit to use
ddf87e72951c sacia added
boisy
parents:
diff changeset
332 ora >D.IRQER mask in current GIME IRQ enables
ddf87e72951c sacia added
boisy
parents:
diff changeset
333 sta >D.IRQER save GIME CART* IRQ enable shadow register
ddf87e72951c sacia added
boisy
parents:
diff changeset
334 sta >IrqEnR enable GIME CART* IRQs
ddf87e72951c sacia added
boisy
parents:
diff changeset
335 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
336 lda StatReg,x ensure old IRQ flags are clear
ddf87e72951c sacia added
boisy
parents:
diff changeset
337 lda DataReg,x ensure old error and Rx data IRQ flags are clear
ddf87e72951c sacia added
boisy
parents:
diff changeset
338 lda StatReg,x ... again
ddf87e72951c sacia added
boisy
parents:
diff changeset
339 lda DataReg,x ... and again
ddf87e72951c sacia added
boisy
parents:
diff changeset
340 lda StatReg,x get new Status register contents
ddf87e72951c sacia added
boisy
parents:
diff changeset
341 sta <Cpy.Stat save Status copy
ddf87e72951c sacia added
boisy
parents:
diff changeset
342 tfr a,b copy it...
ddf87e72951c sacia added
boisy
parents:
diff changeset
343 eora Pkt.Flip,pc flip bits per D.Poll
ddf87e72951c sacia added
boisy
parents:
diff changeset
344 anda Pkt.Mask,pc any IRQ(s) still pending?
ddf87e72951c sacia added
boisy
parents:
diff changeset
345 lbne NRdyErr yes, go report error... (device not plugged in?)
ddf87e72951c sacia added
boisy
parents:
diff changeset
346 andb #Stat.DSR!Stat.DCD clear all but DSR+DCD status
ddf87e72951c sacia added
boisy
parents:
diff changeset
347 stb <CpyDCDSR save new DCD+DSR status copy
ddf87e72951c sacia added
boisy
parents:
diff changeset
348 IFEQ MPIFlag-true
ddf87e72951c sacia added
boisy
parents:
diff changeset
349 lda SlotSlct,pc get MPI slot select value
ddf87e72951c sacia added
boisy
parents:
diff changeset
350 bmi NoSelect no MPI slot select, go on...
ddf87e72951c sacia added
boisy
parents:
diff changeset
351 sta >MPI.Slct set MPI slot select register
ddf87e72951c sacia added
boisy
parents:
diff changeset
352 ENDC
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
353 NoSelect puls cc,dp,pc recover IRQ/Carry status, system DP, return
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
354
ddf87e72951c sacia added
boisy
parents:
diff changeset
355 Term clrb default to no error...
ddf87e72951c sacia added
boisy
parents:
diff changeset
356 pshs cc,dp save IRQ/Carry status, dummy B, system DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
357 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
358 tfr u,w setup our DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
359 tfr e,dp
ddf87e72951c sacia added
boisy
parents:
diff changeset
360 ELSE
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
361 tfr u,d
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
362 tfr a,dp
ddf87e72951c sacia added
boisy
parents:
diff changeset
363 ENDC
1550
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
364 IFEQ Level-1
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
365 ldx >D.Proc
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
366 lda P$ID,x
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
367 sta <V.BUSY
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
368 sta <V.LPRC
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
369 ENDC
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
370 ldx <V.PORT
ddf87e72951c sacia added
boisy
parents:
diff changeset
371 lda CmdReg,x get current Command register contents
ddf87e72951c sacia added
boisy
parents:
diff changeset
372 anda #^(Cmd.TIRB!Cmd.DTR) disable Tx IRQs, RTS, and DTR
ddf87e72951c sacia added
boisy
parents:
diff changeset
373 ora #Cmd.RxI disable Rx IRQs
ddf87e72951c sacia added
boisy
parents:
diff changeset
374 ldb <Wrk.XTyp get extended type byte
ddf87e72951c sacia added
boisy
parents:
diff changeset
375 andb #ForceDTR forced DTR?
ddf87e72951c sacia added
boisy
parents:
diff changeset
376 beq KeepDTR no, go leave DTR disabled...
ddf87e72951c sacia added
boisy
parents:
diff changeset
377 ora #Cmd.DTR set (enable) DTR bit
ddf87e72951c sacia added
boisy
parents:
diff changeset
378 KeepDTR sta CmdReg,x set DTR and RTS enable/disable
ddf87e72951c sacia added
boisy
parents:
diff changeset
379 ldd <RxBufSiz get Rx buffer size
ddf87e72951c sacia added
boisy
parents:
diff changeset
380 tsta less than 256 bytes?
ddf87e72951c sacia added
boisy
parents:
diff changeset
381 beq TermExit yes, no system memory to return...
ddf87e72951c sacia added
boisy
parents:
diff changeset
382 pshs u save data pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
383 ldu <RxBufPtr get address of system memory
ddf87e72951c sacia added
boisy
parents:
diff changeset
384 os9 F$SRtMem
ddf87e72951c sacia added
boisy
parents:
diff changeset
385 puls u recover data pointer
1550
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
386 TermExit
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
387 IFEQ Level-1
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
388 ldd <orgDFIRQ
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
389 std >D.FIRQ
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
390 ENDC
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
391 ldd <V.PORT base hardware address is status register
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
392 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
393 incd point to 6551 status register
ddf87e72951c sacia added
boisy
parents:
diff changeset
394 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
395 addd #$0001
ddf87e72951c sacia added
boisy
parents:
diff changeset
396 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
397 ldx #$0000 remove IRQ table entry
ddf87e72951c sacia added
boisy
parents:
diff changeset
398 leay IRQSvc,pc
ddf87e72951c sacia added
boisy
parents:
diff changeset
399 puls cc recover IRQ/Carry status
ddf87e72951c sacia added
boisy
parents:
diff changeset
400 os9 F$IRQ
ddf87e72951c sacia added
boisy
parents:
diff changeset
401 puls dp,pc restore dummy A, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
402
1548
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
403 ReadSlp
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
404 IFEQ Level-1
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
405 lda <V.BUSY
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
406 sta <V.WAKE
1549
5f2f9583d13b preparation for 3.2.1 release
boisy
parents: 1548
diff changeset
407 lbsr Sleep0 go suspend process...
1548
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
408 ELSE
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
409 ldd >D.Proc process descriptor address
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
410 sta <V.WAKE save MSB for IRQ service routine
ddf87e72951c sacia added
boisy
parents:
diff changeset
411 tfr d,x copy process descriptor address
ddf87e72951c sacia added
boisy
parents:
diff changeset
412 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
413 oim #Suspend,P$State,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
414 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
415 ldb P$State,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
416 orb #Suspend
ddf87e72951c sacia added
boisy
parents:
diff changeset
417 stb P$State,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
418 ENDC
1549
5f2f9583d13b preparation for 3.2.1 release
boisy
parents: 1548
diff changeset
419 lbsr Sleep1 go suspend process...
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
420 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
421 ldx >D.Proc process descriptor address
ddf87e72951c sacia added
boisy
parents:
diff changeset
422 ldb P$Signal,x pending signal for this process?
ddf87e72951c sacia added
boisy
parents:
diff changeset
423 beq ChkState no, go check process state...
ddf87e72951c sacia added
boisy
parents:
diff changeset
424 cmpb #S$Intrpt do we honor signal?
ddf87e72951c sacia added
boisy
parents:
diff changeset
425 lbls ErrExit yes, go do it...
ddf87e72951c sacia added
boisy
parents:
diff changeset
426 ChkState equ *
ddf87e72951c sacia added
boisy
parents:
diff changeset
427 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
428 tim #Condem,P$State,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
429 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
430 ldb P$State,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
431 bitb #Condem
ddf87e72951c sacia added
boisy
parents:
diff changeset
432 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
433 bne PrAbtErr yes, go do it...
ddf87e72951c sacia added
boisy
parents:
diff changeset
434 ldb <V.WAKE true interrupt?
ddf87e72951c sacia added
boisy
parents:
diff changeset
435 beq ReadChk yes, go read the char.
ddf87e72951c sacia added
boisy
parents:
diff changeset
436 bra ReadSlp no, go suspend the process
ddf87e72951c sacia added
boisy
parents:
diff changeset
437
ddf87e72951c sacia added
boisy
parents:
diff changeset
438 Read clrb default to no errors...
ddf87e72951c sacia added
boisy
parents:
diff changeset
439 pshs cc,dp save IRQ/Carry status, system DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
440 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
441 tfr u,w setup our DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
442 tfr e,dp
ddf87e72951c sacia added
boisy
parents:
diff changeset
443 ELSE
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
444 tfr u,d
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
445 tfr a,dp
ddf87e72951c sacia added
boisy
parents:
diff changeset
446 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
447 ReadLoop orcc #IntMasks disable IRQs while checking Rx flow control
ddf87e72951c sacia added
boisy
parents:
diff changeset
448 ReadChk lda <FloCtlRx get Rx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
449 beq ReadChar none, go get Rx character...
ddf87e72951c sacia added
boisy
parents:
diff changeset
450 ldx <RxDatLen get Rx data count again
ddf87e72951c sacia added
boisy
parents:
diff changeset
451 cmpx <RxBufMin at or below XON level?
ddf87e72951c sacia added
boisy
parents:
diff changeset
452 bhi ReadChar no, go get Rx character...
ddf87e72951c sacia added
boisy
parents:
diff changeset
453 ldx <V.PORT
ddf87e72951c sacia added
boisy
parents:
diff changeset
454 bita #FCRxSent Rx disabled due to XOFF sent?
ddf87e72951c sacia added
boisy
parents:
diff changeset
455 beq ChkHWHS no, go check hardware handshake(s)...
ddf87e72951c sacia added
boisy
parents:
diff changeset
456 ldb <FloCtlTx get Tx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
457 bitb #FCTxBrk currently transmitting line Break?
ddf87e72951c sacia added
boisy
parents:
diff changeset
458 beq NotTxBrk yes, go skip XON this time...
ddf87e72951c sacia added
boisy
parents:
diff changeset
459 ReadLp2 andcc #^IntMasks turn interupts back on
ddf87e72951c sacia added
boisy
parents:
diff changeset
460 bra ReadLoop
ddf87e72951c sacia added
boisy
parents:
diff changeset
461 NotTxBrk equ *
ddf87e72951c sacia added
boisy
parents:
diff changeset
462 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
463 tim #Stat.TxE,StatReg,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
464 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
465 pshs a
ddf87e72951c sacia added
boisy
parents:
diff changeset
466 lda StatReg,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
467 bita #Stat.TxE
ddf87e72951c sacia added
boisy
parents:
diff changeset
468 puls a
ddf87e72951c sacia added
boisy
parents:
diff changeset
469 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
470 beq ReadLp2 no, go skip XON this time...
ddf87e72951c sacia added
boisy
parents:
diff changeset
471 ldb <V.XON
ddf87e72951c sacia added
boisy
parents:
diff changeset
472 stb DataReg,x write XON character
ddf87e72951c sacia added
boisy
parents:
diff changeset
473 ChkHWHS bita #FCRxDTR!FCRxRTS Rx disabled due to DTR or RTS?
ddf87e72951c sacia added
boisy
parents:
diff changeset
474 beq RxFloClr no, go clear Rx flow control flag(s)...
ddf87e72951c sacia added
boisy
parents:
diff changeset
475 ldb CmdReg,x get current Command register contents
ddf87e72951c sacia added
boisy
parents:
diff changeset
476 andb #^Cmd.TIRB clear Tx IRQ/RTS/Break control bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
477 orb #TIRB.RTS!Cmd.DTR enable RTS and DTR, disable Tx IRQs
ddf87e72951c sacia added
boisy
parents:
diff changeset
478 stb CmdReg,x set Command register
ddf87e72951c sacia added
boisy
parents:
diff changeset
479 RxFloClr clr <FloCtlRx clear Rx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
480 ReadChar ldb <V.ERR get accumulated errors, if any
ddf87e72951c sacia added
boisy
parents:
diff changeset
481 stb PD.ERR,y set/clear error(s) in path descriptor
ddf87e72951c sacia added
boisy
parents:
diff changeset
482 bne ReprtErr error(s), go report it/them...
ddf87e72951c sacia added
boisy
parents:
diff changeset
483 ldd <RxDatLen get Rx buffer count
ddf87e72951c sacia added
boisy
parents:
diff changeset
484 beq ReadSlp none, go sleep while waiting for new Rx data...
ddf87e72951c sacia added
boisy
parents:
diff changeset
485 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
486 decd less character we're about to grab
ddf87e72951c sacia added
boisy
parents:
diff changeset
487 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
488 subd #$0001
ddf87e72951c sacia added
boisy
parents:
diff changeset
489 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
490 std <RxDatLen save new Rx data count
ddf87e72951c sacia added
boisy
parents:
diff changeset
491 orcc #IntMasks see if this fixes the problem
ddf87e72951c sacia added
boisy
parents:
diff changeset
492 ldx <RxBufGet current Rx buffer pickup position
ddf87e72951c sacia added
boisy
parents:
diff changeset
493 lda ,x+ get Rx character, set up next pickup position
ddf87e72951c sacia added
boisy
parents:
diff changeset
494 cmpx <RxBufEnd end of Rx buffer?
ddf87e72951c sacia added
boisy
parents:
diff changeset
495 blo SetPckUp no, go keep pickup pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
496 ldx <RxBufPtr get Rx buffer start address
ddf87e72951c sacia added
boisy
parents:
diff changeset
497 SetPckUp stx <RxBufGet set new Rx data pickup pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
498 puls cc,dp,pc recover IRQ/Carry status, dummy B, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
499
ddf87e72951c sacia added
boisy
parents:
diff changeset
500 ModEntry lbra Init
ddf87e72951c sacia added
boisy
parents:
diff changeset
501 bra Read
ddf87e72951c sacia added
boisy
parents:
diff changeset
502 nop
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1550
diff changeset
503 bra Write
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
504 nop
ddf87e72951c sacia added
boisy
parents:
diff changeset
505 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
506 bra GStt
ddf87e72951c sacia added
boisy
parents:
diff changeset
507 nop
ddf87e72951c sacia added
boisy
parents:
diff changeset
508 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
509 lbra GStt
ddf87e72951c sacia added
boisy
parents:
diff changeset
510 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
511 lbra SStt
ddf87e72951c sacia added
boisy
parents:
diff changeset
512 lbra Term
ddf87e72951c sacia added
boisy
parents:
diff changeset
513
ddf87e72951c sacia added
boisy
parents:
diff changeset
514 PrAbtErr ldb #E$PrcAbt
ddf87e72951c sacia added
boisy
parents:
diff changeset
515 bra ErrExit
ddf87e72951c sacia added
boisy
parents:
diff changeset
516
ddf87e72951c sacia added
boisy
parents:
diff changeset
517 ReprtErr clr <V.ERR clear error status
ddf87e72951c sacia added
boisy
parents:
diff changeset
518 bitb #DCDLstEr DCD lost error?
ddf87e72951c sacia added
boisy
parents:
diff changeset
519 bne HngUpErr yes, go report it...
ddf87e72951c sacia added
boisy
parents:
diff changeset
520 ldb #E$Read
ddf87e72951c sacia added
boisy
parents:
diff changeset
521 ErrExit equ *
ddf87e72951c sacia added
boisy
parents:
diff changeset
522 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
523 oim #Carry,,s set carry
ddf87e72951c sacia added
boisy
parents:
diff changeset
524 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
525 lda ,s
ddf87e72951c sacia added
boisy
parents:
diff changeset
526 ora #Carry
ddf87e72951c sacia added
boisy
parents:
diff changeset
527 sta ,s
ddf87e72951c sacia added
boisy
parents:
diff changeset
528 ENDC
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
529 puls cc,dp,pc restore CC, system DP, return
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
530
ddf87e72951c sacia added
boisy
parents:
diff changeset
531 HngUpErr ldb #E$HangUp
ddf87e72951c sacia added
boisy
parents:
diff changeset
532 lda #PST.DCD DCD lost flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
533 sta PD.PST,y set path status flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
534 bra ErrExit
ddf87e72951c sacia added
boisy
parents:
diff changeset
535
ddf87e72951c sacia added
boisy
parents:
diff changeset
536 NRdyErr ldb #E$NotRdy
ddf87e72951c sacia added
boisy
parents:
diff changeset
537 bra ErrExit
ddf87e72951c sacia added
boisy
parents:
diff changeset
538
ddf87e72951c sacia added
boisy
parents:
diff changeset
539 UnSvcErr ldb #E$UnkSvc
ddf87e72951c sacia added
boisy
parents:
diff changeset
540 bra ErrExit
ddf87e72951c sacia added
boisy
parents:
diff changeset
541
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1550
diff changeset
542 Write clrb default to no error...
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
543 pshs cc,dp save IRQ/Carry status, Tx character, system DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
544 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
545 tfr u,w setup our DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
546 tfr e,dp
ddf87e72951c sacia added
boisy
parents:
diff changeset
547 tfr a,e
ddf87e72951c sacia added
boisy
parents:
diff changeset
548 ELSE
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
549 pshs a
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
550 tfr u,d
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
551 tfr a,dp
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
552 puls a
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
553 sta <regWbuf
ddf87e72951c sacia added
boisy
parents:
diff changeset
554 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
555 orcc #IntMasks disable IRQs during error and Tx disable checks
ddf87e72951c sacia added
boisy
parents:
diff changeset
556 bra WritChr
ddf87e72951c sacia added
boisy
parents:
diff changeset
557 WritLoop lda <WritFlag
ddf87e72951c sacia added
boisy
parents:
diff changeset
558 beq WritFast
ddf87e72951c sacia added
boisy
parents:
diff changeset
559 lbsr Sleep1
ddf87e72951c sacia added
boisy
parents:
diff changeset
560 WritFast inc <WritFlag
ddf87e72951c sacia added
boisy
parents:
diff changeset
561 WritChr ldx <V.PORT
ddf87e72951c sacia added
boisy
parents:
diff changeset
562 ldb <V.ERR get accumulated errors, if any
ddf87e72951c sacia added
boisy
parents:
diff changeset
563 andb #DCDLstEr DCD lost error? (ignore other errors, if any)
ddf87e72951c sacia added
boisy
parents:
diff changeset
564 stb PD.ERR,y set/clear error(s) in path descriptor
ddf87e72951c sacia added
boisy
parents:
diff changeset
565 bne ReprtErr DCD lost error, go report it...
ddf87e72951c sacia added
boisy
parents:
diff changeset
566 ChkTxFlo ldb <FloCtlTx get Tx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
567 bitb #FCTxBrk currently transmitting line Break?
ddf87e72951c sacia added
boisy
parents:
diff changeset
568 bne WritLoop yes, go sleep a while...
ddf87e72951c sacia added
boisy
parents:
diff changeset
569 lda <Wrk.Type get software/hardware handshake enables
ddf87e72951c sacia added
boisy
parents:
diff changeset
570 bita #DSRFlow DSR/DTR handshake enabled?
ddf87e72951c sacia added
boisy
parents:
diff changeset
571 * Changed below - BGP
ddf87e72951c sacia added
boisy
parents:
diff changeset
572 * beq ChkTxFlo no, go check Tx flow control
ddf87e72951c sacia added
boisy
parents:
diff changeset
573 beq ChkRxFlo no, go check Rx flow control
ddf87e72951c sacia added
boisy
parents:
diff changeset
574 ldb <Cpy.Stat get copy of status register
ddf87e72951c sacia added
boisy
parents:
diff changeset
575 bitb <Mask.DSR Tx disabled due to DSR?
ddf87e72951c sacia added
boisy
parents:
diff changeset
576 bne WritLoop yes, go sleep a while...
ddf87e72951c sacia added
boisy
parents:
diff changeset
577 bita #TxSwFlow Tx software flow control enabled?
ddf87e72951c sacia added
boisy
parents:
diff changeset
578 beq ChkRxFlo no, go check pending Rx flow control
ddf87e72951c sacia added
boisy
parents:
diff changeset
579 bitb #FCTxXOff Tx disabled due to received XOFF?
ddf87e72951c sacia added
boisy
parents:
diff changeset
580 bne WritLoop yes, go sleep a while...
ddf87e72951c sacia added
boisy
parents:
diff changeset
581 ChkRxFlo bita #RxSwFlow Rx software flow control enabled?
ddf87e72951c sacia added
boisy
parents:
diff changeset
582 beq ChkTxE no, go check Tx register empty
ddf87e72951c sacia added
boisy
parents:
diff changeset
583 ldb <FloCtlRx get Rx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
584 bitb #FCRxSend XON/XOFF Rx flow control pending?
ddf87e72951c sacia added
boisy
parents:
diff changeset
585 bne WritLoop yes, go sleep a while...
ddf87e72951c sacia added
boisy
parents:
diff changeset
586 ChkTxE equ *
ddf87e72951c sacia added
boisy
parents:
diff changeset
587 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
588 tim #Stat.TxE,StatReg,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
589 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
590 pshs a
ddf87e72951c sacia added
boisy
parents:
diff changeset
591 lda StatReg,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
592 bita #Stat.TxE
ddf87e72951c sacia added
boisy
parents:
diff changeset
593 puls a
ddf87e72951c sacia added
boisy
parents:
diff changeset
594 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
595 beq WritLoop no, go sleep a while...
ddf87e72951c sacia added
boisy
parents:
diff changeset
596 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
597 ste DataReg,x write Tx character
ddf87e72951c sacia added
boisy
parents:
diff changeset
598 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
599 ldb <regWbuf
ddf87e72951c sacia added
boisy
parents:
diff changeset
600 stb DataReg,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
601 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
602 clr <WritFlag clear "initial write attempt" flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
603 puls cc,dp,pc recover IRQ/Carry status, Tx character, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
604
ddf87e72951c sacia added
boisy
parents:
diff changeset
605 GStt clrb default to no error...
ddf87e72951c sacia added
boisy
parents:
diff changeset
606 pshs cc,dp save IRQ/Carry status, dummy B, system DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
607 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
608 tfr u,w setup our DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
609 tfr e,dp
ddf87e72951c sacia added
boisy
parents:
diff changeset
610 ELSE
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
611 pshs a
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
612 tfr u,d
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
613 tfr a,dp
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
614 puls a
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
615 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
616 ldx PD.RGS,y caller's register stack pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
617 cmpa #SS.EOF
ddf87e72951c sacia added
boisy
parents:
diff changeset
618 beq GSExitOK yes, SCF devices never return EOF
ddf87e72951c sacia added
boisy
parents:
diff changeset
619 cmpa #SS.Ready
ddf87e72951c sacia added
boisy
parents:
diff changeset
620 bne GetScSiz
ddf87e72951c sacia added
boisy
parents:
diff changeset
621 ldd <RxDatLen get Rx data length
ddf87e72951c sacia added
boisy
parents:
diff changeset
622 beq NRdyErr none, go report error
ddf87e72951c sacia added
boisy
parents:
diff changeset
623 tsta more than 255 bytes?
ddf87e72951c sacia added
boisy
parents:
diff changeset
624 beq SaveLen no, keep Rx data available
ddf87e72951c sacia added
boisy
parents:
diff changeset
625 ldb #255 yes, just use 255
ddf87e72951c sacia added
boisy
parents:
diff changeset
626 SaveLen stb R$B,x set Rx data available in caller's [B]
ddf87e72951c sacia added
boisy
parents:
diff changeset
627 GSExitOK puls cc,dp,pc restore Carry status, dummy B, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
628
ddf87e72951c sacia added
boisy
parents:
diff changeset
629 GetScSiz cmpa #SS.ScSiz
ddf87e72951c sacia added
boisy
parents:
diff changeset
630 bne GetComSt
ddf87e72951c sacia added
boisy
parents:
diff changeset
631 ldu PD.DEV,y
ddf87e72951c sacia added
boisy
parents:
diff changeset
632 ldu V$DESC,u
ddf87e72951c sacia added
boisy
parents:
diff changeset
633 clra
ddf87e72951c sacia added
boisy
parents:
diff changeset
634 ldb IT.COL,u
ddf87e72951c sacia added
boisy
parents:
diff changeset
635 std R$X,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
636 ldb IT.ROW,u
ddf87e72951c sacia added
boisy
parents:
diff changeset
637 std R$Y,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
638 puls cc,dp,pc restore Carry status, dummy B, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
639
ddf87e72951c sacia added
boisy
parents:
diff changeset
640 GetComSt cmpa #SS.ComSt
ddf87e72951c sacia added
boisy
parents:
diff changeset
641 lbne UnSvcErr no, go report error
ddf87e72951c sacia added
boisy
parents:
diff changeset
642 ldd <Wrk.Type
ddf87e72951c sacia added
boisy
parents:
diff changeset
643 std R$Y,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
644 clra default to DCD and DSR enabled
ddf87e72951c sacia added
boisy
parents:
diff changeset
645 ldb <CpyDCDSR
ddf87e72951c sacia added
boisy
parents:
diff changeset
646 bitb #Mask.DCD
ddf87e72951c sacia added
boisy
parents:
diff changeset
647 beq CheckDSR no, go check DSR status
ddf87e72951c sacia added
boisy
parents:
diff changeset
648 ora #DCDStBit
ddf87e72951c sacia added
boisy
parents:
diff changeset
649 CheckDSR bitb <Mask.DSR DSR bit set (disabled)?
ddf87e72951c sacia added
boisy
parents:
diff changeset
650 beq SaveCDSt no, go set DCD/DSR status
ddf87e72951c sacia added
boisy
parents:
diff changeset
651 ora #DSRStBit
ddf87e72951c sacia added
boisy
parents:
diff changeset
652 SaveCDSt sta R$B,x set 6551 ACIA style DCD/DSR status in caller's [B]
ddf87e72951c sacia added
boisy
parents:
diff changeset
653 puls cc,dp,pc restore Carry status, dummy B, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
654
ddf87e72951c sacia added
boisy
parents:
diff changeset
655 BreakSlp ldx #SlpBreak SS.Break duration
ddf87e72951c sacia added
boisy
parents:
diff changeset
656 bra TimedSlp
ddf87e72951c sacia added
boisy
parents:
diff changeset
657
ddf87e72951c sacia added
boisy
parents:
diff changeset
658 HngUpSlp ldx #SlpHngUp SS.HngUp duration
ddf87e72951c sacia added
boisy
parents:
diff changeset
659 bra TimedSlp
ddf87e72951c sacia added
boisy
parents:
diff changeset
660
1548
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
661 IFEQ Level-1
1549
5f2f9583d13b preparation for 3.2.1 release
boisy
parents: 1548
diff changeset
662 Sleep0 ldx #$0000
5f2f9583d13b preparation for 3.2.1 release
boisy
parents: 1548
diff changeset
663 bra TimedSlp
1548
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
664 ENDC
1549
5f2f9583d13b preparation for 3.2.1 release
boisy
parents: 1548
diff changeset
665 Sleep1 ldx #1 give up balance of tick
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
666 TimedSlp pshs cc save IRQ enable status
ddf87e72951c sacia added
boisy
parents:
diff changeset
667 andcc #^Intmasks enable IRQs
ddf87e72951c sacia added
boisy
parents:
diff changeset
668 os9 F$Sleep
ddf87e72951c sacia added
boisy
parents:
diff changeset
669 puls cc,pc restore IRQ enable status, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
670
ddf87e72951c sacia added
boisy
parents:
diff changeset
671 SStt clrb default to no error...
ddf87e72951c sacia added
boisy
parents:
diff changeset
672 pshs cc,dp save IRQ/Carry status, dummy B, system DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
673 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
674 tfr u,w setup our DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
675 tfr e,dp
ddf87e72951c sacia added
boisy
parents:
diff changeset
676 ELSE
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
677 pshs a
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
678 tfr u,d
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
679 tfr a,dp
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
680 puls a
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
681 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
682 ldx PD.RGS,y
ddf87e72951c sacia added
boisy
parents:
diff changeset
683 cmpa #SS.HngUp
ddf87e72951c sacia added
boisy
parents:
diff changeset
684 bne SetBreak
ddf87e72951c sacia added
boisy
parents:
diff changeset
685 lda #^Cmd.DTR cleared (disabled) DTR bit
ddf87e72951c sacia added
boisy
parents:
diff changeset
686 ldx <V.PORT
ddf87e72951c sacia added
boisy
parents:
diff changeset
687 orcc #IntMasks disable IRQs while setting Command register
ddf87e72951c sacia added
boisy
parents:
diff changeset
688 anda CmdReg,x mask in current Command register contents
ddf87e72951c sacia added
boisy
parents:
diff changeset
689 sta CmdReg,x set new Command register
ddf87e72951c sacia added
boisy
parents:
diff changeset
690 bsr HngUpSlp go sleep for a while...
ddf87e72951c sacia added
boisy
parents:
diff changeset
691 BreakClr lda #^(Cmd.TIRB!Cmd.DTR) clear (disable) DTR and RTS control bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
692 FRegClr ldx <V.PORT
ddf87e72951c sacia added
boisy
parents:
diff changeset
693 anda CmdReg,x mask in current Command register
ddf87e72951c sacia added
boisy
parents:
diff changeset
694 ldb <FloCtlRx get Rx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
695 bitb #FCRxDTR Rx disabled due to DTR?
ddf87e72951c sacia added
boisy
parents:
diff changeset
696 bne LeaveDTR yes, go leave DTR disabled
ddf87e72951c sacia added
boisy
parents:
diff changeset
697 ora #Cmd.DTR set (enable) DTR bit
ddf87e72951c sacia added
boisy
parents:
diff changeset
698 LeaveDTR bitb #FCRxRTS Rx disabled due to RTS?
ddf87e72951c sacia added
boisy
parents:
diff changeset
699 bne LeaveRTS yes, go leave RTS disabled
ddf87e72951c sacia added
boisy
parents:
diff changeset
700 ora #TIRB.RTS enable RTS output
ddf87e72951c sacia added
boisy
parents:
diff changeset
701 LeaveRTS ldb <FloCtlTx get Tx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
702 bitb #FCTxBrk currently transmitting line Break?
ddf87e72951c sacia added
boisy
parents:
diff changeset
703 beq NoTxBrk no, go leave RTS alone...
ddf87e72951c sacia added
boisy
parents:
diff changeset
704 ora #TIRB.Brk set Tx Break bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
705 NoTxBrk sta CmdReg,x set new Command register
ddf87e72951c sacia added
boisy
parents:
diff changeset
706 puls cc,dp,pc restore IRQ/Carry status, dummy B, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
707
ddf87e72951c sacia added
boisy
parents:
diff changeset
708 SetBreak cmpa #SS.Break Tx line break?
ddf87e72951c sacia added
boisy
parents:
diff changeset
709 bne SetSSig
ddf87e72951c sacia added
boisy
parents:
diff changeset
710 ldy <V.PORT
ddf87e72951c sacia added
boisy
parents:
diff changeset
711 ldd #FCTxBrk*256+TIRB.Brk [A]=flow control flag, [B]=Tx break enable
ddf87e72951c sacia added
boisy
parents:
diff changeset
712 orcc #Intmasks disable IRQs while messing with flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
713 ora <FloCtlTx set Tx break flag bit
ddf87e72951c sacia added
boisy
parents:
diff changeset
714 sta <FloCtlTx save Tx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
715 orb CmdReg,y set Tx line break bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
716 stb CmdReg,y start Tx line break
ddf87e72951c sacia added
boisy
parents:
diff changeset
717 bsr BreakSlp go sleep for a while...
ddf87e72951c sacia added
boisy
parents:
diff changeset
718 anda #^FCTxBrk clear Tx break flag bit
ddf87e72951c sacia added
boisy
parents:
diff changeset
719 sta <FloCtlTx save Tx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
720 clr CmdReg,y clear Tx line break
ddf87e72951c sacia added
boisy
parents:
diff changeset
721 bra BreakClr go restore RTS output to previous...
ddf87e72951c sacia added
boisy
parents:
diff changeset
722
ddf87e72951c sacia added
boisy
parents:
diff changeset
723 SetSSig cmpa #SS.SSig
ddf87e72951c sacia added
boisy
parents:
diff changeset
724 bne SetRelea
ddf87e72951c sacia added
boisy
parents:
diff changeset
725 lda PD.CPR,y current process ID
ddf87e72951c sacia added
boisy
parents:
diff changeset
726 ldb R$X+1,x LSB of [X] is signal code
ddf87e72951c sacia added
boisy
parents:
diff changeset
727 orcc #IntMasks disable IRQs while checking Rx data length
ddf87e72951c sacia added
boisy
parents:
diff changeset
728 ldx <RxDatLen
ddf87e72951c sacia added
boisy
parents:
diff changeset
729 bne RSendSig
ddf87e72951c sacia added
boisy
parents:
diff changeset
730 std <SSigPID
ddf87e72951c sacia added
boisy
parents:
diff changeset
731 puls cc,dp,pc restore IRQ/Carry status, dummy B, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
732 RSendSig puls cc restore IRQ/Carry status
ddf87e72951c sacia added
boisy
parents:
diff changeset
733 os9 F$Send
ddf87e72951c sacia added
boisy
parents:
diff changeset
734 puls dp,pc restore system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
735
ddf87e72951c sacia added
boisy
parents:
diff changeset
736 SetRelea cmpa #SS.Relea
ddf87e72951c sacia added
boisy
parents:
diff changeset
737 bne SetCDSig
ddf87e72951c sacia added
boisy
parents:
diff changeset
738 leax SSigPID,u point to Rx data signal process ID
ddf87e72951c sacia added
boisy
parents:
diff changeset
739 bsr ReleaSig go release signal...
ddf87e72951c sacia added
boisy
parents:
diff changeset
740 puls cc,dp,pc restore Carry status, dummy B, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
741
ddf87e72951c sacia added
boisy
parents:
diff changeset
742 SetCDSig cmpa #SS.CDSig set DCD signal?
ddf87e72951c sacia added
boisy
parents:
diff changeset
743 bne SetCDRel
ddf87e72951c sacia added
boisy
parents:
diff changeset
744 lda PD.CPR,y current process ID
ddf87e72951c sacia added
boisy
parents:
diff changeset
745 ldb R$X+1,x LSB of [X] is signal code
ddf87e72951c sacia added
boisy
parents:
diff changeset
746 std <CDSigPID
ddf87e72951c sacia added
boisy
parents:
diff changeset
747 puls cc,dp,pc restore Carry status, dummy B, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
748
ddf87e72951c sacia added
boisy
parents:
diff changeset
749 SetCDRel cmpa #SS.CDRel release DCD signal?
ddf87e72951c sacia added
boisy
parents:
diff changeset
750 bne SetComSt
ddf87e72951c sacia added
boisy
parents:
diff changeset
751 CDRelSig leax CDSigPID,u point to DCD signal process ID
ddf87e72951c sacia added
boisy
parents:
diff changeset
752 bsr ReleaSig go release signal...
ddf87e72951c sacia added
boisy
parents:
diff changeset
753 puls cc,dp,pc restore Carry status, dummy B, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
754
ddf87e72951c sacia added
boisy
parents:
diff changeset
755 SetComSt cmpa #SS.ComSt
ddf87e72951c sacia added
boisy
parents:
diff changeset
756 bne SetOpen
ddf87e72951c sacia added
boisy
parents:
diff changeset
757 ldd R$Y,x caller's [Y] contains ACIAPAK format type/baud info
ddf87e72951c sacia added
boisy
parents:
diff changeset
758 bsr SetPort go save it and set up control/format registers
ddf87e72951c sacia added
boisy
parents:
diff changeset
759 ReturnOK puls cc,dp,pc restore Carry status, dummy B, system DP, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
760
ddf87e72951c sacia added
boisy
parents:
diff changeset
761 SetOpen cmpa #SS.Open
ddf87e72951c sacia added
boisy
parents:
diff changeset
762 bne SetClose
ddf87e72951c sacia added
boisy
parents:
diff changeset
763 lda R$Y+1,x get LSB of caller's [Y]
ddf87e72951c sacia added
boisy
parents:
diff changeset
764 deca real SS.Open from SCF? (SCF sets LSB of [Y] = 1)
ddf87e72951c sacia added
boisy
parents:
diff changeset
765 bne ReturnOK no, go do nothing but return OK...
ddf87e72951c sacia added
boisy
parents:
diff changeset
766 lda #TIRB.RTS enabled DTR and RTS outputs
ddf87e72951c sacia added
boisy
parents:
diff changeset
767 orcc #IntMasks disable IRQs while setting Format register
ddf87e72951c sacia added
boisy
parents:
diff changeset
768 lbra FRegClr go enable DTR and RTS (if not disabled due to Rx flow control)
ddf87e72951c sacia added
boisy
parents:
diff changeset
769
ddf87e72951c sacia added
boisy
parents:
diff changeset
770 SetClose cmpa #SS.Close
ddf87e72951c sacia added
boisy
parents:
diff changeset
771 lbne UnSvcErr no, go report error...
ddf87e72951c sacia added
boisy
parents:
diff changeset
772 lda R$Y+1,x real SS.Close from SCF? (SCF sets LSB of [Y] = 0)
ddf87e72951c sacia added
boisy
parents:
diff changeset
773 bne ReturnOK no, go do nothing but return OK...
ddf87e72951c sacia added
boisy
parents:
diff changeset
774 leax SSigPID,u point to Rx data signal process ID
ddf87e72951c sacia added
boisy
parents:
diff changeset
775 bsr ReleaSig go release signal...
ddf87e72951c sacia added
boisy
parents:
diff changeset
776 bra CDRelSig go release DCD signal, return from there...
ddf87e72951c sacia added
boisy
parents:
diff changeset
777
ddf87e72951c sacia added
boisy
parents:
diff changeset
778 ReleaSig pshs cc save IRQ enable status
ddf87e72951c sacia added
boisy
parents:
diff changeset
779 orcc #IntMasks disable IRQs while releasing signal
ddf87e72951c sacia added
boisy
parents:
diff changeset
780 lda PD.CPR,y get current process ID
ddf87e72951c sacia added
boisy
parents:
diff changeset
781 suba ,x same as signal process ID?
ddf87e72951c sacia added
boisy
parents:
diff changeset
782 bne NoReleas no, go return...
ddf87e72951c sacia added
boisy
parents:
diff changeset
783 sta ,x clear this signal's process ID
ddf87e72951c sacia added
boisy
parents:
diff changeset
784 NoReleas puls cc,pc restore IRQ enable status, return
ddf87e72951c sacia added
boisy
parents:
diff changeset
785
ddf87e72951c sacia added
boisy
parents:
diff changeset
786 SetPort pshs cc save IRQ enable and Carry status
ddf87e72951c sacia added
boisy
parents:
diff changeset
787 orcc #IntMasks disable IRQs while setting up ACIA registers
ddf87e72951c sacia added
boisy
parents:
diff changeset
788 std <Wrk.Type save type/baud in data area
ddf87e72951c sacia added
boisy
parents:
diff changeset
789 leax BaudTabl,pc
ddf87e72951c sacia added
boisy
parents:
diff changeset
790 andb #BaudRate clear all but baud rate bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
791 ldb b,x get baud rate setting
ddf87e72951c sacia added
boisy
parents:
diff changeset
792 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
793 tfr b,e save it temporarily
ddf87e72951c sacia added
boisy
parents:
diff changeset
794 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
795 stb <regWbuf
ddf87e72951c sacia added
boisy
parents:
diff changeset
796 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
797 ldb <Wrk.Baud get baud info again
ddf87e72951c sacia added
boisy
parents:
diff changeset
798 andb #^(Ctl.RxCS!Ctl.Baud) clear clock source + baud rate code bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
799 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
800 orr e,b mask in clock source + baud rate and clean up stack
ddf87e72951c sacia added
boisy
parents:
diff changeset
801 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
802 orb <regWbuf
ddf87e72951c sacia added
boisy
parents:
diff changeset
803 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
804 ldx <V.PORT get port address
ddf87e72951c sacia added
boisy
parents:
diff changeset
805 anda #Cmd.Par clear all except parity bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
806 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
807 tfr a,e save new command register contents temporarily
ddf87e72951c sacia added
boisy
parents:
diff changeset
808 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
809 sta <regWbuf
ddf87e72951c sacia added
boisy
parents:
diff changeset
810 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
811 lda CmdReg,x get current command register contents
ddf87e72951c sacia added
boisy
parents:
diff changeset
812 anda #^Cmd.Par clear parity control bits
ddf87e72951c sacia added
boisy
parents:
diff changeset
813 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
814 orr e,a mask in new parity
ddf87e72951c sacia added
boisy
parents:
diff changeset
815 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
816 ora <regWbuf
ddf87e72951c sacia added
boisy
parents:
diff changeset
817 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
818 std CmdReg,x set command+control registers
ddf87e72951c sacia added
boisy
parents:
diff changeset
819 puls cc,pc recover IRQ enable and Carry status, return...
ddf87e72951c sacia added
boisy
parents:
diff changeset
820
1550
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
821 IRQSvc
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
822 IFEQ Level-1
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
823 lda >PIA1Base+2 clear FIRQ
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
824 ENDC
6215c588d8ca Added FIRQ handling code for Level 1--now works under NitrOS-9 Level 1
boisy
parents: 1549
diff changeset
825 pshs dp save system DP
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
826 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
827 tfr u,w setup our DP
ddf87e72951c sacia added
boisy
parents:
diff changeset
828 tfr e,dp
ddf87e72951c sacia added
boisy
parents:
diff changeset
829 ELSE
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
830 tfr u,d setup our DP
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
831 tfr a,dp
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
832 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
833 ldx <V.PORT
ddf87e72951c sacia added
boisy
parents:
diff changeset
834 ldb StatReg,x get current Status register contents
ddf87e72951c sacia added
boisy
parents:
diff changeset
835 stb <Cpy.Stat save Status register copy
ddf87e72951c sacia added
boisy
parents:
diff changeset
836 bitb #Stat.Err error(s)?
ddf87e72951c sacia added
boisy
parents:
diff changeset
837 beq ChkRDRF no, go check Rx data
ddf87e72951c sacia added
boisy
parents:
diff changeset
838 tst DataReg,x read Rx data register to clear ACIA error flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
839 bitb #Stat.Frm framing error (assume Rx line Break)?
ddf87e72951c sacia added
boisy
parents:
diff changeset
840 beq ChkParty no, go check if parity error...
ddf87e72951c sacia added
boisy
parents:
diff changeset
841 lda <V.QUIT default to keyboard quit ("Break") code
ddf87e72951c sacia added
boisy
parents:
diff changeset
842 bra RxBreak go pretend we've received V.QUIT character...
ddf87e72951c sacia added
boisy
parents:
diff changeset
843
ddf87e72951c sacia added
boisy
parents:
diff changeset
844 ChkParty bitb #Stat.Par parity error?
ddf87e72951c sacia added
boisy
parents:
diff changeset
845 beq ChkOvRun no, go check overrun error...
ddf87e72951c sacia added
boisy
parents:
diff changeset
846 lda #ParityEr mark parity error
ddf87e72951c sacia added
boisy
parents:
diff changeset
847 ChkOvRun bita #Stat.Ovr overrun error?
ddf87e72951c sacia added
boisy
parents:
diff changeset
848 beq SaveErrs no, go save errors...
ddf87e72951c sacia added
boisy
parents:
diff changeset
849 ora #OvrFloEr mark overrun error
ddf87e72951c sacia added
boisy
parents:
diff changeset
850 SaveErrs ora <V.ERR
ddf87e72951c sacia added
boisy
parents:
diff changeset
851 sta <V.ERR
ddf87e72951c sacia added
boisy
parents:
diff changeset
852 lbra ChkTrDCD go check if DCD transition...
ddf87e72951c sacia added
boisy
parents:
diff changeset
853
ddf87e72951c sacia added
boisy
parents:
diff changeset
854 ChkRDRF bitb #Stat.RxF Rx data?
ddf87e72951c sacia added
boisy
parents:
diff changeset
855 lbeq ChkTrDCD no, go check DCD transition
ddf87e72951c sacia added
boisy
parents:
diff changeset
856 lda DataReg,x get Rx data
ddf87e72951c sacia added
boisy
parents:
diff changeset
857 RxBreak beq SavRxDat its a null, go save it...
1547
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
858 * IFNE H6309
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
859 * stf <SigSent clear signal sent flag
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
860 * ELSE
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
861 * pshs b
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
862 * ldb <regWbuf+1
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
863 * stb <SigSent
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
864 * puls b
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
865 * ENDC
e855164fa2be Still not fixed, but close.
boisy
parents: 1488
diff changeset
866 clr <SigSent
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
867 cmpa <V.INTR interrupt?
ddf87e72951c sacia added
boisy
parents:
diff changeset
868 bne Chk.Quit no, go on...
ddf87e72951c sacia added
boisy
parents:
diff changeset
869 ldb #S$Intrpt
ddf87e72951c sacia added
boisy
parents:
diff changeset
870 bra SendSig
ddf87e72951c sacia added
boisy
parents:
diff changeset
871
ddf87e72951c sacia added
boisy
parents:
diff changeset
872 Chk.Quit cmpa <V.QUIT abort?
ddf87e72951c sacia added
boisy
parents:
diff changeset
873 bne Chk.PChr no, go on...
ddf87e72951c sacia added
boisy
parents:
diff changeset
874 ldb #S$Abort
ddf87e72951c sacia added
boisy
parents:
diff changeset
875 SendSig pshs a save Rx data
ddf87e72951c sacia added
boisy
parents:
diff changeset
876 lda <V.LPRC get last process' ID
ddf87e72951c sacia added
boisy
parents:
diff changeset
877 os9 F$Send
ddf87e72951c sacia added
boisy
parents:
diff changeset
878 puls a recover Rx data
ddf87e72951c sacia added
boisy
parents:
diff changeset
879 stb <SigSent set signal sent flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
880 bra SavRxDat go save Rx data...
ddf87e72951c sacia added
boisy
parents:
diff changeset
881
ddf87e72951c sacia added
boisy
parents:
diff changeset
882 Chk.PChr cmpa <V.PCHR pause?
ddf87e72951c sacia added
boisy
parents:
diff changeset
883 bne Chk.Flow no, go on...
ddf87e72951c sacia added
boisy
parents:
diff changeset
884 ldx <V.DEV2 attached device defined?
ddf87e72951c sacia added
boisy
parents:
diff changeset
885 beq SavRxDat no, go save Rx data...
ddf87e72951c sacia added
boisy
parents:
diff changeset
886 sta V.PAUS,x yes, pause attached device
ddf87e72951c sacia added
boisy
parents:
diff changeset
887 bra SavRxDat go save Rx data...
ddf87e72951c sacia added
boisy
parents:
diff changeset
888
ddf87e72951c sacia added
boisy
parents:
diff changeset
889 Chk.Flow equ *
ddf87e72951c sacia added
boisy
parents:
diff changeset
890 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
891 tim #TxSwFlow,<Wrk.Type Tx data software flow control enabled?
ddf87e72951c sacia added
boisy
parents:
diff changeset
892 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
893 pshs a
ddf87e72951c sacia added
boisy
parents:
diff changeset
894 lda #TxSwFlow
ddf87e72951c sacia added
boisy
parents:
diff changeset
895 bita <Wrk.Type
ddf87e72951c sacia added
boisy
parents:
diff changeset
896 puls a
ddf87e72951c sacia added
boisy
parents:
diff changeset
897 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
898 beq SavRxDat no, go save Rx data...
ddf87e72951c sacia added
boisy
parents:
diff changeset
899 cmpa <V.XON XON?
ddf87e72951c sacia added
boisy
parents:
diff changeset
900 bne Chk.XOff no, go on...
ddf87e72951c sacia added
boisy
parents:
diff changeset
901 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
902 aim #^FCTxXOff,<FloCtlTx clear XOFF received bit
ddf87e72951c sacia added
boisy
parents:
diff changeset
903 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
904 pshs a
ddf87e72951c sacia added
boisy
parents:
diff changeset
905 lda #^FCTxXOff
ddf87e72951c sacia added
boisy
parents:
diff changeset
906 anda <FloCtlTx
ddf87e72951c sacia added
boisy
parents:
diff changeset
907 sta <FloCtlTx
ddf87e72951c sacia added
boisy
parents:
diff changeset
908 puls a
ddf87e72951c sacia added
boisy
parents:
diff changeset
909 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
910 bra SetTxFlo go save new Tx flow control flags...
ddf87e72951c sacia added
boisy
parents:
diff changeset
911
ddf87e72951c sacia added
boisy
parents:
diff changeset
912 Chk.XOff cmpa <V.XOFF XOFF?
ddf87e72951c sacia added
boisy
parents:
diff changeset
913 bne SavRxDat no, go save Rx data...
ddf87e72951c sacia added
boisy
parents:
diff changeset
914 ldb #FCTxXOff set XOFF received bit
ddf87e72951c sacia added
boisy
parents:
diff changeset
915 orb <FloCtlTx set software Tx flow control flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
916 SetTxFlo stb <FloCtlTx save new Tx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
917 lbra ChkTrDCD go check DCD transition...
ddf87e72951c sacia added
boisy
parents:
diff changeset
918 SavRxDat equ *
ddf87e72951c sacia added
boisy
parents:
diff changeset
919 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
920 aim #^FCRxSend,<FloCtlRx clear possible pending XOFF flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
921 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
922 pshs a
ddf87e72951c sacia added
boisy
parents:
diff changeset
923 lda #^FCRxSend
ddf87e72951c sacia added
boisy
parents:
diff changeset
924 anda <FloCtlRx
ddf87e72951c sacia added
boisy
parents:
diff changeset
925 sta <FloCtlRx
ddf87e72951c sacia added
boisy
parents:
diff changeset
926 puls a
ddf87e72951c sacia added
boisy
parents:
diff changeset
927 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
928 ldx <RxBufPut get Rx buffer input pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
929 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
930 ldw <RxDatLen Rx get Rx buffer data length
ddf87e72951c sacia added
boisy
parents:
diff changeset
931 cmpw <RxBufSiz Rx buffer already full?
ddf87e72951c sacia added
boisy
parents:
diff changeset
932 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
933 pshs d
ddf87e72951c sacia added
boisy
parents:
diff changeset
934 ldd <RxDatLen
ddf87e72951c sacia added
boisy
parents:
diff changeset
935 std <regWbuf
ddf87e72951c sacia added
boisy
parents:
diff changeset
936 cmpd <RxBufSiz
ddf87e72951c sacia added
boisy
parents:
diff changeset
937 puls d
ddf87e72951c sacia added
boisy
parents:
diff changeset
938 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
939 blo NotOvFlo no, go skip overflow error...
ddf87e72951c sacia added
boisy
parents:
diff changeset
940 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
941 oim #OvrFloEr,<V.ERR mark RX buffer overflow error
ddf87e72951c sacia added
boisy
parents:
diff changeset
942 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
943 ldb #OvrFloEr
ddf87e72951c sacia added
boisy
parents:
diff changeset
944 orb <V.ERR
ddf87e72951c sacia added
boisy
parents:
diff changeset
945 stb <V.ERR
ddf87e72951c sacia added
boisy
parents:
diff changeset
946 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
947 bra DisRxFlo go ensure Rx is disabled (if possible)
ddf87e72951c sacia added
boisy
parents:
diff changeset
948
ddf87e72951c sacia added
boisy
parents:
diff changeset
949 NotOvFlo sta ,x+ save Rx data
ddf87e72951c sacia added
boisy
parents:
diff changeset
950 cmpx <RxBufEnd end of Rx buffer?
ddf87e72951c sacia added
boisy
parents:
diff changeset
951 blo SetLayDn no, go keep laydown pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
952 ldx <RxBufPtr get Rx buffer start address
ddf87e72951c sacia added
boisy
parents:
diff changeset
953 SetLayDn stx <RxBufPut set new Rx data laydown pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
954 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
955 incw one more byte in Rx buffer
ddf87e72951c sacia added
boisy
parents:
diff changeset
956 stw <RxDatLen save new Rx data length
ddf87e72951c sacia added
boisy
parents:
diff changeset
957 cmpw <RxBufMax at or past maximum fill point?
ddf87e72951c sacia added
boisy
parents:
diff changeset
958 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
959 pshs d
ddf87e72951c sacia added
boisy
parents:
diff changeset
960 ldd <regWbuf
ddf87e72951c sacia added
boisy
parents:
diff changeset
961 addd #1
ddf87e72951c sacia added
boisy
parents:
diff changeset
962 std <regWbuf
ddf87e72951c sacia added
boisy
parents:
diff changeset
963 std <RxDatLen
ddf87e72951c sacia added
boisy
parents:
diff changeset
964 cmpd <RxBufMax
ddf87e72951c sacia added
boisy
parents:
diff changeset
965 puls d
ddf87e72951c sacia added
boisy
parents:
diff changeset
966 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
967 blo SgnlRxD no, go check Rx data signal...
ddf87e72951c sacia added
boisy
parents:
diff changeset
968 DisRxFlo ldx <V.PORT
ddf87e72951c sacia added
boisy
parents:
diff changeset
969 ldb CmdReg,x get current Command register contents
ddf87e72951c sacia added
boisy
parents:
diff changeset
970 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
971 tim #ForceDTR,<Wrk.XTyp forced DTR?
ddf87e72951c sacia added
boisy
parents:
diff changeset
972 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
973 lda #ForceDTR
ddf87e72951c sacia added
boisy
parents:
diff changeset
974 bita <Wrk.XTyp
ddf87e72951c sacia added
boisy
parents:
diff changeset
975 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
976 bne DisRxRTS yes, go check RTS disable...
ddf87e72951c sacia added
boisy
parents:
diff changeset
977 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
978 tim #DSRFlow,<Wrk.Type DSR/DTR Flow control?
ddf87e72951c sacia added
boisy
parents:
diff changeset
979 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
980 lda #DSRFlow
ddf87e72951c sacia added
boisy
parents:
diff changeset
981 bita <Wrk.Type
ddf87e72951c sacia added
boisy
parents:
diff changeset
982 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
983 beq DisRxRTS no, go check RTS disable
ddf87e72951c sacia added
boisy
parents:
diff changeset
984 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
985 oim #FCRxDTR,<Wrk.Type mark RX disabled due to DTR
ddf87e72951c sacia added
boisy
parents:
diff changeset
986 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
987 lda #FCRxDTR
ddf87e72951c sacia added
boisy
parents:
diff changeset
988 ora <Wrk.Type
ddf87e72951c sacia added
boisy
parents:
diff changeset
989 sta <Wrk.Type
ddf87e72951c sacia added
boisy
parents:
diff changeset
990 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
991 andb #^Cmd.DTR clear (disable) DTR bit
ddf87e72951c sacia added
boisy
parents:
diff changeset
992 DisRxRTS equ *
ddf87e72951c sacia added
boisy
parents:
diff changeset
993 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
994 tim #RTSFlow,<Wrk.Type
ddf87e72951c sacia added
boisy
parents:
diff changeset
995 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
996 lda #RTSFlow
ddf87e72951c sacia added
boisy
parents:
diff changeset
997 bita <Wrk.Type
ddf87e72951c sacia added
boisy
parents:
diff changeset
998 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
999 beq NewRxFlo no, go set new Rx flow control...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1000 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
1001 tim #DSRFlow,<Wrk.Type line break?
ddf87e72951c sacia added
boisy
parents:
diff changeset
1002 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
1003 lda #DSRFlow
ddf87e72951c sacia added
boisy
parents:
diff changeset
1004 bita <Wrk.Type
ddf87e72951c sacia added
boisy
parents:
diff changeset
1005 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
1006 bne NewRxFlo yes, go set new Rx flow control...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1007 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
1008 oim #FCRxRTS,<FloCtlRx
ddf87e72951c sacia added
boisy
parents:
diff changeset
1009 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
1010 lda #FCRxRTS
ddf87e72951c sacia added
boisy
parents:
diff changeset
1011 ora <FloCtlRx
ddf87e72951c sacia added
boisy
parents:
diff changeset
1012 sta <FloCtlRx
ddf87e72951c sacia added
boisy
parents:
diff changeset
1013 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
1014 andb #^Cmd.TIRB clear Tx IRQ/RTS/Break control bits (disable RTS)
ddf87e72951c sacia added
boisy
parents:
diff changeset
1015 NewRxFlo stb CmdReg,x set/clear DTR and RTS in Command register
ddf87e72951c sacia added
boisy
parents:
diff changeset
1016 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
1017 tim #RxSwFlow,<Wrk.Type Rx software flow control?
ddf87e72951c sacia added
boisy
parents:
diff changeset
1018 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
1019 ldb <Wrk.Type
ddf87e72951c sacia added
boisy
parents:
diff changeset
1020 bitb #RxSwFlow
ddf87e72951c sacia added
boisy
parents:
diff changeset
1021 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
1022 beq SgnlRxD no, go check Rx data signal...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1023 lda <V.XOFF XOFF character defined?
ddf87e72951c sacia added
boisy
parents:
diff changeset
1024 beq SgnlRxD no, go check Rx data signal...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1025 ldb <FloCtlRx get Rx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
1026 bitb #FCRxSent XOFF already sent?
ddf87e72951c sacia added
boisy
parents:
diff changeset
1027 bne SgnlRxD yes, go check Rx data signal...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1028 orb #FCRxSend set send XOFF flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
1029 stb <FloCtlRx set new Rx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
1030 IFNE H6309
ddf87e72951c sacia added
boisy
parents:
diff changeset
1031 tim #Stat.TxE,StatReg,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
1032 ELSE
ddf87e72951c sacia added
boisy
parents:
diff changeset
1033 ldb StatReg,x
ddf87e72951c sacia added
boisy
parents:
diff changeset
1034 bitb #Stat.TxE
ddf87e72951c sacia added
boisy
parents:
diff changeset
1035 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
1036 beq SgnlRxD no, go skip XOFF this time...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1037 sta DataReg,x write XOFF character
ddf87e72951c sacia added
boisy
parents:
diff changeset
1038 ldb #FCRxSent set XOFF sent flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
1039 orb <FloCtlRx mask in current Rx flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
1040 andb #^FCRxSend clear send XOFF flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
1041 stb <FloCtlRx save new flow control flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
1042 SgnlRxD ldb <SigSent already sent abort/interrupt signal?
ddf87e72951c sacia added
boisy
parents:
diff changeset
1043 bne ChkTrDCD yes, go check DCD transition...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1044 lda <SSigPID Rx data signal process ID?
ddf87e72951c sacia added
boisy
parents:
diff changeset
1045 beq ChkTrDCD none, go check DCD transition...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1046 stb <SSigPID clear Rx data signal
ddf87e72951c sacia added
boisy
parents:
diff changeset
1047 ldb <SSigSig Rx data signal code
ddf87e72951c sacia added
boisy
parents:
diff changeset
1048 os9 F$Send
ddf87e72951c sacia added
boisy
parents:
diff changeset
1049 ChkTrDCD ldx <V.PORT
ddf87e72951c sacia added
boisy
parents:
diff changeset
1050 lda <Cpy.Stat get Status register copy
ddf87e72951c sacia added
boisy
parents:
diff changeset
1051 tfr a,b copy it...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1052 eora <CpyDCDSR mark changes from old DSR+DCD status copy
ddf87e72951c sacia added
boisy
parents:
diff changeset
1053 andb #Stat.DSR!Stat.DCD clear all but DSR+DCD status
ddf87e72951c sacia added
boisy
parents:
diff changeset
1054 stb <CpyDCDSR save new DSR+DCD status copy
ddf87e72951c sacia added
boisy
parents:
diff changeset
1055 bita <Mask.DCD DCD transition?
ddf87e72951c sacia added
boisy
parents:
diff changeset
1056 beq CkSuspnd no, go check for suspended process...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1057 bitb <Mask.DCD DCD disabled now?
ddf87e72951c sacia added
boisy
parents:
diff changeset
1058 beq SgnlDCD no, go check DCD signal...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1059 lda <Wrk.Type
ddf87e72951c sacia added
boisy
parents:
diff changeset
1060 bita #MdmKill modem kill enabled?
ddf87e72951c sacia added
boisy
parents:
diff changeset
1061 beq SgnlDCD no, go on...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1062 ldx <V.PDLHd path descriptor list header
ddf87e72951c sacia added
boisy
parents:
diff changeset
1063 beq StCDLost no list, go set DCD lost error...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1064 lda #PST.DCD DCD lost flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
1065 PDListLp sta PD.PST,x set path status flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
1066 ldx PD.PLP,x get next path descriptor in list
ddf87e72951c sacia added
boisy
parents:
diff changeset
1067 bne PDListLp not end of list, go do another...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1068 StCDLost lda #DCDLstEr DCD lost error flag
ddf87e72951c sacia added
boisy
parents:
diff changeset
1069 ora <V.ERR
ddf87e72951c sacia added
boisy
parents:
diff changeset
1070 sta <V.ERR
ddf87e72951c sacia added
boisy
parents:
diff changeset
1071 SgnlDCD lda <CDSigPID get process ID, send a DCD signal?
ddf87e72951c sacia added
boisy
parents:
diff changeset
1072 beq CkSuspnd no, go check for suspended process...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1073 ldb <CDSigSig get DCD signal code
ddf87e72951c sacia added
boisy
parents:
diff changeset
1074 clr <CDSigPID clear DCD signal
ddf87e72951c sacia added
boisy
parents:
diff changeset
1075 os9 F$Send
ddf87e72951c sacia added
boisy
parents:
diff changeset
1076
ddf87e72951c sacia added
boisy
parents:
diff changeset
1077 CkSuspnd clrb clear Carry (for exit) and LSB of process descriptor address
ddf87e72951c sacia added
boisy
parents:
diff changeset
1078 lda <V.WAKE anybody waiting? ([D]=process descriptor address)
ddf87e72951c sacia added
boisy
parents:
diff changeset
1079 beq IRQExit no, go return...
1548
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
1080 IFEQ Level-1
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
1081 clr <V.WAKE
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
1082 ldb #S$Wake
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
1083 os9 F$Send
50ff40ac6472 Code in place for Level 1, but still not working under Level 1
boisy
parents: 1547
diff changeset
1084 ELSE
1469
ddf87e72951c sacia added
boisy
parents:
diff changeset
1085 stb <V.WAKE mark I/O done
ddf87e72951c sacia added
boisy
parents:
diff changeset
1086 tfr d,x copy process descriptor pointer
ddf87e72951c sacia added
boisy
parents:
diff changeset
1087 lda P$State,x get state flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
1088 anda #^Suspend clear suspend state
ddf87e72951c sacia added
boisy
parents:
diff changeset
1089 sta P$State,x save state flags
ddf87e72951c sacia added
boisy
parents:
diff changeset
1090 ENDC
ddf87e72951c sacia added
boisy
parents:
diff changeset
1091 IRQExit puls dp,pc recover system DP, return...
ddf87e72951c sacia added
boisy
parents:
diff changeset
1092
ddf87e72951c sacia added
boisy
parents:
diff changeset
1093 emod
ddf87e72951c sacia added
boisy
parents:
diff changeset
1094 ModSize equ *
ddf87e72951c sacia added
boisy
parents:
diff changeset
1095 end
ddf87e72951c sacia added
boisy
parents:
diff changeset
1096