Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/dwio.asm @ 2958:77500452de1c
bootman: Rename assembler files to .as
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sun, 09 Feb 2014 22:53:29 +0100 |
parents | 28ed72477814 |
children | e68c1db27cbe |
rev | line source |
---|---|
2180 | 1 ******************************************************************** |
2724
05b648103e78
Renamed dw3.sb to dwio.sb and rbdw3 to rbdw
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2723
diff
changeset
|
2 * dwio - DriveWire Low Level Subroutine Module |
2180 | 3 * |
4 * $Id$ | |
5 * | |
6 * Edt/Rev YYYY/MM/DD Modified by | |
7 * Comment | |
8 * ------------------------------------------------------------------ | |
9 * 1 2008/01/26 Boisy G. Pitre | |
10 * Started as a segregated subroutine module. | |
2374 | 11 * |
12 * 2 2010/01/20 Boisy G. Pitre | |
13 * Added support for DWNet | |
2387 | 14 * |
15 * 3 2010/01/23 Aaron A. Wolfe | |
16 * Added dynamic polling frequency | |
17 * | |
2724
05b648103e78
Renamed dw3.sb to dwio.sb and rbdw3 to rbdw
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2723
diff
changeset
|
18 nam dwio |
2374 | 19 ttl DriveWire 3 Low Level Subroutine Module |
2180 | 20 |
2374 | 21 ifp1 |
22 use defsfile | |
2624 | 23 use drivewire.d |
2374 | 24 endc |
2180 | 25 |
2374 | 26 tylg set Sbrtn+Objct |
27 atrv set ReEnt+rev | |
28 rev set $01 | |
2308 | 29 |
2374 | 30 mod eom,name,tylg,atrv,start,0 |
2180 | 31 |
2308 | 32 * irq |
2374 | 33 IRQPckt fcb $00,$01,$0A ;IRQ packet Flip(1),Mask(1),Priority(1) bytes |
2308 | 34 * Default time packet |
2374 | 35 DefTime fcb 109,12,31,23,59,59 |
2180 | 36 |
2435 | 37 * for dynamic poll frequency, number of ticks between firing poller - should we move to dwdefs? |
2387 | 38 * speed 1 = interactive (typing) |
39 PollSpd1 fcb 3 | |
2435 | 40 * speed 2 = bulk transfer (depending on how much processing needs to be done to incoming stream, 5-8 seems good) |
2387 | 41 PollSpd2 fcb 6 |
2435 | 42 * speed 3 = idle |
2387 | 43 PollSpd3 fcb 40 |
44 * X pollidle -> drop to next slower rate | |
45 PollIdle fcb 60 | |
46 | |
47 | |
2724
05b648103e78
Renamed dw3.sb to dwio.sb and rbdw3 to rbdw
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2723
diff
changeset
|
48 name fcs /dwio/ |
2180 | 49 |
50 * DriveWire subroutine entry table | |
2374 | 51 start lbra Init |
52 bra Read | |
53 nop | |
54 lbra Write | |
2180 | 55 |
56 * Term | |
57 * | |
58 * Entry: | |
59 * U = address of device memory area | |
60 * | |
61 * Exit: | |
62 * CC = carry set on error | |
63 * B = error code | |
64 * | |
2374 | 65 Term |
66 clrb clear Carry | |
67 rts | |
2180 | 68 |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
69 Read |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
70 IFNE atari |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
71 jmp [$FFE0] |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
72 ELSE |
2374 | 73 use dwread.asm |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
74 ENDC |
2374 | 75 |
76 Write | |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
77 IFNE atari |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
78 jmp [$FFE2] |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
79 ELSE |
2374 | 80 use dwwrite.asm |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
81 ENDC |
2308 | 82 |
2638
4655eabf00c0
dw3.asm is now common... dwinit.asm now added to for port specific initialization
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
83 |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
84 IFNE atari |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
85 DWInit rts |
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
86 ELSE |
2638
4655eabf00c0
dw3.asm is now common... dwinit.asm now added to for port specific initialization
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
87 use dwinit.asm |
2725
c2112f93923a
o dwio for Atari now uses routines in ROM, so dwread/dwrite stripped of Atari
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
88 ENDC |
2638
4655eabf00c0
dw3.asm is now common... dwinit.asm now added to for port specific initialization
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
89 |
2308 | 90 * Init |
91 * | |
92 * Entry: | |
93 * Y = address of device descriptor | |
94 * U = address of device memory area | |
95 * | |
96 * Exit: | |
97 * CC = carry set on error | |
98 * B = error code | |
99 * | |
100 * Initialize the serial device | |
2374 | 101 Init |
102 clrb clear Carry | |
103 pshs y,x,cc then push CC on stack | |
2638
4655eabf00c0
dw3.asm is now common... dwinit.asm now added to for port specific initialization
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
104 bsr DWInit |
2308 | 105 |
106 ; allocate DW statics page | |
2374 | 107 pshs u |
108 ldd #$0100 | |
109 os9 F$SRqMem | |
110 tfr u,x | |
111 puls u | |
112 lbcs InitEx | |
113 ifgt Level-1 | |
114 stx <D.DWStat | |
115 else | |
116 stx >D.DWStat | |
117 endc | |
2308 | 118 ; clear out 256 byte page at X |
2374 | 119 clrb |
120 loop@ clr ,x+ | |
121 decb | |
122 bne loop@ | |
2308 | 123 |
2321
6a5ada3e2666
added DWINIT op code, dw3 now sends on init just before installing VIRQ
aaronwolfe
parents:
2316
diff
changeset
|
124 * send OP_DWINIT |
6a5ada3e2666
added DWINIT op code, dw3 now sends on init just before installing VIRQ
aaronwolfe
parents:
2316
diff
changeset
|
125 ; setup DWsub command |
2374 | 126 pshs u |
2429
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
127 ldb #1 ; DRIVER VERSION |
2374 | 128 lda #OP_DWINIT ; load command |
2429
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
129 pshs d ; command store on stack |
2374 | 130 leax ,s ; point X to stack |
2429
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
131 ldy #2 ; 1 byte to send |
2374 | 132 ifgt Level-1 |
133 ldu <D.DWSubAddr | |
134 else | |
135 ldu >D.DWSubAddr | |
136 endc | |
2640
8d24c482646e
o increased timeout in atari dwread.asm module
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2638
diff
changeset
|
137 jsr DW$Write,u ; call DWrite |
2429
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
138 leas 1,s ; leave one byte on stack for response |
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
139 |
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
140 ; read protocol version response, 1 byte |
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
141 leax ,s ; point X to stack head |
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
142 ldy #1 ; 1 byte to retrieve |
2640
8d24c482646e
o increased timeout in atari dwread.asm module
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2638
diff
changeset
|
143 jsr DW$Read,u ; call DWRead |
2429
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
144 beq InstIRQ ; branch if no error |
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
145 leas 3,s ; error, cleanup stack (u and 1 byte from read) |
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
146 lbra InitEx ; don't install IRQ handler |
2374 | 147 |
2308 | 148 * install ISR |
2374 | 149 InstIRQ |
2429
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
150 puls a,u ; a has proto version from server.. not used yet |
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
151 |
65541e2444dc
use dwinit to become compatible with dw3 server
aaronwolfe
parents:
2422
diff
changeset
|
152 ifgt Level-1 |
2374 | 153 ldx <D.DWStat |
154 else | |
155 ldx >D.DWStat | |
156 endc | |
157 leax DW.VIRQPkt,x | |
158 pshs u | |
159 tfr x,u | |
160 leax Vi.Stat,x ;fake VIRQ status register | |
161 lda #$80 ;VIRQ flag clear, repeated VIRQs | |
162 sta ,x ;set it while we're here... | |
163 tfr x,d ;copy fake VIRQ status register address | |
164 leax IRQPckt,pcr ;IRQ polling packet | |
165 leay IRQSvc,pcr ;IRQ service entry | |
166 os9 F$IRQ ;install | |
167 puls u | |
168 bcs InitEx ;exit with error | |
2387 | 169 clra |
170 ldb PollSpd3,pcr ; start at idle | |
2374 | 171 ifgt Level-1 |
172 ldx <D.DWStat | |
173 else | |
174 ldx >D.DWStat | |
175 endc | |
176 leax DW.VIRQPkt,x | |
177 std Vi.Rst,x ; reset count | |
178 tfr x,y ; move VIRQ software packet to Y | |
179 tryagain | |
180 ldx #$0001 ; code to install new VIRQ | |
181 os9 F$VIRQ ; install | |
182 bcc IRQok ; no error, continue | |
183 cmpb #E$UnkSvc | |
184 bne InitEx | |
2308 | 185 ; if we get an E$UnkSvc error, then clock has not been initialized, so do it here |
2374 | 186 leax DefTime,pcr |
187 os9 F$STime | |
188 bra tryagain ; note: this has the slim potential of looping forever | |
189 IRQok | |
190 ifgt Level-1 | |
191 ldx <D.DWStat | |
192 else | |
193 ldx >D.DWStat | |
194 endc | |
2308 | 195 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax |
2374 | 196 leax DW.StatTbl,x |
197 tfr u,d | |
198 ldb <V.PORT+1,u ; get our port # | |
199 sta b,x ; store in table | |
2308 | 200 |
2374 | 201 InitEx |
202 puls cc,x,y,pc | |
2308 | 203 |
204 | |
205 ; *********************************************************************** | |
206 ; Interrupt handler - Much help from Darren Atkinson | |
2374 | 207 |
208 IRQMulti3 anda #$0F ; mask first 4 bits, a is now port #+1 | |
209 deca ; we pass +1 to use 0 for no data | |
210 pshs a ; save port # | |
211 cmpb RxGrab,u ; compare room in buffer to server's byte | |
212 bhs IRQM06 ; room left >= server's bytes, no problem | |
213 | |
214 stb RxGrab,u ; else replace with room left in our buffer | |
2308 | 215 |
216 ; also limit to end of buffer | |
2374 | 217 IRQM06 ldd RxBufEnd,u ; end addr of buffer |
218 subd RxBufPut,u ; subtract current write pointer, result is # bytes left going forward in buff. | |
219 | |
220 IRQM05 cmpb RxGrab,u ; compare b (room left) to grab bytes | |
221 bhs IRQM03 ; branch if we have room for grab bytes | |
2308 | 222 |
2374 | 223 stb RxGrab,u ; else set grab to room left |
224 | |
2308 | 225 ; send multiread req |
2374 | 226 IRQM03 puls a ; port # is on stack |
227 ldb RxGrab,u | |
2308 | 228 |
2374 | 229 pshs u |
230 | |
2308 | 231 ; setup DWsub command |
2374 | 232 pshs d ; (a port, b bytes) |
233 lda #OP_SERREADM ; load command | |
234 pshs a ; command store on stack | |
235 leax ,s ; point X to stack | |
236 ldy #3 ; 3 bytes to send | |
2308 | 237 |
2374 | 238 ifgt Level-1 |
239 ldu <D.DWSubAddr | |
240 else | |
241 ldu >D.DWSubAddr | |
242 endc | |
2640
8d24c482646e
o increased timeout in atari dwread.asm module
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2638
diff
changeset
|
243 jsr DW$Write,u ; call DWrite |
2308 | 244 |
2374 | 245 leas 3,s ; clean 3 DWsub args from stack |
2308 | 246 |
2374 | 247 ldx ,s ; pointer to this port's area (from U prior), leave it on stack |
248 ldb RxGrab,x ; set B to grab bytes | |
249 clra ; 0 in high byte | |
250 tfr d,y ; set # bytes for DW | |
2308 | 251 |
2374 | 252 ldx RxBufPut,x ; point X to insert position in this port's buffer |
2308 | 253 ; receive response |
2640
8d24c482646e
o increased timeout in atari dwread.asm module
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2638
diff
changeset
|
254 jsr DW$Read,u ; call DWRead |
2308 | 255 ; handle errors? |
256 | |
257 | |
2374 | 258 puls u |
259 ldb RxGrab,u ; our grab bytes | |
2308 | 260 |
261 ; set new RxBufPut | |
2374 | 262 ldx RxBufPut,u ; current write pointer |
263 abx ; add b (# bytes) to RxBufPut | |
264 cmpx RxBufEnd,u ; end of Rx buffer? | |
265 blo IRQM04 ; no, go keep laydown pointer | |
266 ldx RxBufPtr,u ; get Rx buffer start address | |
267 IRQM04 stx RxBufPut,u ; set new Rx data laydown pointer | |
2308 | 268 |
269 ; set new RxDatLen | |
2374 | 270 ldb RxDatLen,u |
271 addb RxGrab,u | |
272 stb RxDatLen,u ; store new value | |
273 | |
274 lbra CkSSig ; had to lbra | |
275 | |
276 IRQMulti | |
2387 | 277 ; set IRQ freq for bulk |
278 pshs a | |
279 lda PollSpd2,pcr | |
280 lbsr IRQsetFRQ | |
281 puls a | |
282 | |
2308 | 283 ; initial grab bytes |
2374 | 284 stb RxGrab,u |
285 | |
2308 | 286 ; limit server bytes to bufsize - datlen |
2374 | 287 ldb RxBufSiz,u ; size of buffer |
288 subb RxDatLen,u ; current bytes in buffer | |
289 bne IRQMulti3 ; continue, we have some space in buffer | |
2308 | 290 ; no room in buffer |
2374 | 291 tstb |
292 lbne CkSSig ;had to lbra | |
293 lbra IRQExit ;had to lbra | |
294 | |
2723
22bdfbe8bc68
Optimized dw3.asm routines for Atari and fixed crash in OP_SERPOLL mode. dwread routine now properly returns Carry or Negative set.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2720
diff
changeset
|
295 bad |
22bdfbe8bc68
Optimized dw3.asm routines for Atari and fixed crash in OP_SERPOLL mode. dwread routine now properly returns Carry or Negative set.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2720
diff
changeset
|
296 leas 2,s ; error, cleanup stack 2 |
22bdfbe8bc68
Optimized dw3.asm routines for Atari and fixed crash in OP_SERPOLL mode. dwread routine now properly returns Carry or Negative set.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2720
diff
changeset
|
297 lbra IRQExit2 ; don't reset error count on the way out |
2308 | 298 |
299 ; **** IRQ ENTRY POINT | |
2374 | 300 IRQSvc equ * |
301 pshs cc,dp ; save system cc,DP | |
302 orcc #IntMasks ; mask interrupts | |
2308 | 303 |
304 ; mark VIRQ handled (note U is pointer to our VIRQ packet in DP) | |
2374 | 305 lda Vi.Stat,u ; VIRQ status register |
306 anda #^Vi.IFlag ; clear flag in VIRQ status register | |
307 sta Vi.Stat,u ; save it... | |
2308 | 308 |
309 ; poll server for incoming serial data | |
310 | |
311 ; send request | |
2374 | 312 lda #OP_SERREAD ; load command |
313 pshs a ; command store on stack | |
314 leax ,s ; point X to stack | |
315 ldy #1 ; 1 byte to send | |
2308 | 316 |
2374 | 317 ifgt Level-1 |
318 ldu <D.DWSubAddr | |
319 else | |
320 ldu >D.DWSubAddr | |
321 endc | |
2640
8d24c482646e
o increased timeout in atari dwread.asm module
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2638
diff
changeset
|
322 jsr DW$Write,u ; call DWrite |
2308 | 323 |
324 ; receive response | |
2374 | 325 leas -1,s ; one more byte to fit response |
326 leax ,s ; point X to stack head | |
327 ldy #2 ; 2 bytes to retrieve | |
2640
8d24c482646e
o increased timeout in atari dwread.asm module
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2638
diff
changeset
|
328 jsr DW$Read,u ; call DWRead |
2723
22bdfbe8bc68
Optimized dw3.asm routines for Atari and fixed crash in OP_SERPOLL mode. dwread routine now properly returns Carry or Negative set.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2720
diff
changeset
|
329 bcs bad |
22bdfbe8bc68
Optimized dw3.asm routines for Atari and fixed crash in OP_SERPOLL mode. dwread routine now properly returns Carry or Negative set.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2720
diff
changeset
|
330 bne bad |
2308 | 331 |
332 ; process response | |
2374 | 333 IRQSvc2 |
334 ldd ,s++ ; pull returned status byte into A,data into B (set Z if zero, N if multiread) | |
2387 | 335 bne IRQGotOp ; branch if D != 0 (something to do) |
336 * this is a NOP response.. do we need to reschedule | |
337 ifgt Level-1 | |
338 ldx <D.DWStat | |
339 else | |
340 ldx >D.DWStat | |
341 endc | |
2422 | 342 lda DW.VIRQPkt+Vi.Rst+1,x |
2387 | 343 cmpa PollSpd3,pcr |
344 lbeq IRQExit ;we are already at idle speed | |
2308 | 345 |
2387 | 346 lda DW.VIRQNOP,x |
347 inca | |
348 cmpa PollIdle,pcr | |
349 beq FRQdown | |
350 | |
351 sta DW.VIRQNOP,x ;inc NOP count, exit | |
352 lbra IRQExit | |
353 | |
2422 | 354 FRQdown lda DW.VIRQPkt+Vi.Rst+1,x |
2387 | 355 cmpa PollSpd1,pcr |
356 beq FRQd1 | |
357 lda PollSpd3,pcr | |
358 FRQd2 | |
2422 | 359 sta DW.VIRQPkt+Vi.Rst+1,x |
2387 | 360 clr DW.VIRQNOP,x |
361 lbra IRQExit | |
362 FRQd1 lda PollSpd2,pcr | |
363 bra FRQd2 | |
2374 | 364 |
2308 | 365 ; save back D on stack and build our U |
2829 | 366 IRQGotOp |
367 cmpd #16*256+255 | |
368 beq do_reboot | |
369 | |
370 pshs d | |
371 * mode switch on bits 7+6 of A: 00 = vserial, 01 = vwindow, 10 = wirebug?, 11 = ? | |
372 | |
2374 | 373 anda #$C0 ; mask last 6 bits |
374 beq mode00 ; virtual serial mode | |
2311 | 375 ; future - handle other modes |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
376 cmpa #%01000000 ; vwindow? |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
377 beq mode01 |
2374 | 378 lbra IRQExit ; for now, bail |
379 | |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
380 * Virtual Window Handler |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
381 mode01 |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
382 lda ,s |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
383 anda #%00110000 |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
384 beq key |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
385 lbra IRQExit |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
386 |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
387 key |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
388 lda ,s |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
389 anda #$0F |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
390 ora #$10 |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
391 ifgt Level-1 |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
392 ldx <D.DWStat |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
393 else |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
394 ldx >D.DWStat |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
395 endc |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
396 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
397 ; leax DW.StatTbl,x |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
398 lda a,x |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
399 clrb |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
400 tfr d,u |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
401 puls d |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
402 lbra IRQPutch |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
403 |
2829 | 404 do_reboot |
405 lda #255 | |
406 os9 F$Debug | |
407 | |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2640
diff
changeset
|
408 * Virtual Serial Handler |
2829 | 409 mode00 |
410 lda ,s ; restore A | |
2374 | 411 anda #$0F ; mask first 4 bits, a is now port #+1 |
412 beq IRQCont ; if we're here with 0 in the port, its not really a port # (can we jump straight to status?) | |
413 deca ; we pass +1 to use 0 for no data | |
2308 | 414 ; here we set U to the static storage area of the device we are working with |
2374 | 415 ifgt Level-1 |
416 ldx <D.DWStat | |
417 else | |
418 ldx >D.DWStat | |
419 endc | |
2308 | 420 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax |
421 ; leax DW.StatTbl,x | |
2374 | 422 lda a,x |
423 bne IRQCont ; if A is 0, then this device is not active, so exit | |
424 puls d | |
425 lbra IRQExit | |
426 IRQCont | |
427 clrb | |
428 tfr d,u | |
429 | |
430 puls d | |
2308 | 431 |
2311 | 432 * multiread/status flag is in bit 4 of A |
2374 | 433 bita #$10 |
2702
2bd966ffd6d5
Fixed longstanding issue with processes not going away when a network path closed. Also inetd now turns of pause
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2700
diff
changeset
|
434 lbeq IRQPutch ; branch for read1 if multiread not set |
2374 | 435 |
2311 | 436 * all 0s in port means status, anything else is multiread |
2374 | 437 |
438 bita #$0F ;mask bit 7-4 | |
439 beq dostat ;port # all 0, this is a status response | |
2387 | 440 lbra IRQMulti ;its not all 0, this is a multiread |
2308 | 441 |
2314
5f76d1a611f6
term signal sending for serread port status responses
aaronwolfe
parents:
2313
diff
changeset
|
442 |
5f76d1a611f6
term signal sending for serread port status responses
aaronwolfe
parents:
2313
diff
changeset
|
443 * in status events, databyte is split, 4bits status, 4bits port # |
2374 | 444 dostat bitb #$F0 ;mask low bits |
445 lbne IRQExit ;we only implement code 0000, term | |
2314
5f76d1a611f6
term signal sending for serread port status responses
aaronwolfe
parents:
2313
diff
changeset
|
446 * set u to port # |
2374 | 447 ifgt Level-1 |
448 ldx <D.DWStat | |
449 else | |
450 ldx >D.DWStat | |
451 endc | |
452 lda b,x | |
453 bne statcont ; if A is 0, then this device is not active, so exit | |
454 lbra IRQExit | |
2372 | 455 |
2387 | 456 * IRQ set freq routine |
457 * sets freq and clears NOP counter | |
458 * a = desired IRQ freq | |
459 IRQsetFRQ pshs x ; preserve | |
460 ifgt Level-1 | |
461 ldx <D.DWStat | |
462 else | |
463 ldx >D.DWStat | |
464 endc | |
2422 | 465 sta DW.VIRQPkt+Vi.Rst+1,x |
466 * +++ BGP +++ added following line so that the counter (which was copied by | |
467 * clock before calling us) gets reset to the same value the reset value. Without | |
468 * this line, we get called again with the PRIOR Vi.Rst value. | |
469 sta DW.VIRQPkt+Vi.Cnt+1,x | |
2387 | 470 clr DW.VIRQNOP,x |
471 puls x | |
472 rts | |
473 | |
474 | |
2372 | 475 * This routine roots through process descriptors in a queue and |
476 * checks to see if the process has a path that is open to the device | |
2702
2bd966ffd6d5
Fixed longstanding issue with processes not going away when a network path closed. Also inetd now turns of pause
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2700
diff
changeset
|
477 * represented by the static storage pointer in U. If so, set the Condem |
2bd966ffd6d5
Fixed longstanding issue with processes not going away when a network path closed. Also inetd now turns of pause
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2700
diff
changeset
|
478 * bit of the P$State of that process. |
2372 | 479 * |
2699
1c88a9bc6c8c
Reworked to make the searching of the paths in a process more efficient
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2698
diff
changeset
|
480 * Note: we start with path 0 and continue until we get to either (a) the |
1c88a9bc6c8c
Reworked to make the searching of the paths in a process more efficient
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2698
diff
changeset
|
481 * last path for that process or (b) a hit on the static storage that we |
1c88a9bc6c8c
Reworked to make the searching of the paths in a process more efficient
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2698
diff
changeset
|
482 * are seeking. |
2372 | 483 * |
484 * Entry: X = process descriptor to evaluate | |
485 * U = static storage of device we want to check against | |
2374 | 486 RootThrough |
2699
1c88a9bc6c8c
Reworked to make the searching of the paths in a process more efficient
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2698
diff
changeset
|
487 clrb |
2374 | 488 leay P$Path,x |
489 pshs x | |
2699
1c88a9bc6c8c
Reworked to make the searching of the paths in a process more efficient
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2698
diff
changeset
|
490 loop cmpb #NumPaths |
1c88a9bc6c8c
Reworked to make the searching of the paths in a process more efficient
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2698
diff
changeset
|
491 beq out |
1c88a9bc6c8c
Reworked to make the searching of the paths in a process more efficient
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2698
diff
changeset
|
492 incb |
2374 | 493 lda ,y+ |
494 beq loop | |
495 pshs y | |
496 ifgt Level-1 | |
497 ldx <D.PthDBT | |
498 else | |
499 ldx >D.PthDBT | |
500 endc | |
501 os9 F$Find64 | |
502 ldx PD.DEV,y | |
503 leax V$STAT,x | |
504 puls y | |
2700 | 505 bcs loop +BGP+ Jul 20, 2012: continue even if error in F$Find64 |
2372 | 506 |
2374 | 507 cmpu ,x |
508 bne loop | |
509 | |
510 ldx ,s | |
2801
9ffe2daeb011
Reworked libraries to adhere to lwlink's naming specifications
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2725
diff
changeset
|
511 |
2374 | 512 ldb #S$HUP |
2801
9ffe2daeb011
Reworked libraries to adhere to lwlink's naming specifications
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2725
diff
changeset
|
513 stb P$Signal,x |
9ffe2daeb011
Reworked libraries to adhere to lwlink's naming specifications
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2725
diff
changeset
|
514 os9 F$AProc |
9ffe2daeb011
Reworked libraries to adhere to lwlink's naming specifications
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2725
diff
changeset
|
515 |
9ffe2daeb011
Reworked libraries to adhere to lwlink's naming specifications
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2725
diff
changeset
|
516 * lda P$State,x get state of recipient |
9ffe2daeb011
Reworked libraries to adhere to lwlink's naming specifications
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2725
diff
changeset
|
517 * ora #Condem set condemn bit |
9ffe2daeb011
Reworked libraries to adhere to lwlink's naming specifications
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2725
diff
changeset
|
518 * sta P$State,x and set it back |
2372 | 519 |
2374 | 520 out puls x |
521 ldx P$Queue,x | |
522 bne RootThrough | |
523 rts | |
524 | |
525 statcont clrb | |
526 tfr d,u | |
2372 | 527 * NEW: root through all process descriptors. if any has a path open to this |
2703
aa91dd03121d
Fixed bug where ordering of pull was affecting routine
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2702
diff
changeset
|
528 * device, condem it |
2374 | 529 ldx <D.AProcQ |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2375
diff
changeset
|
530 beq dowaitq |
2374 | 531 bsr RootThrough |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2375
diff
changeset
|
532 dowaitq ldx <D.WProcQ |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2375
diff
changeset
|
533 beq dosleepq |
2374 | 534 bsr RootThrough |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2375
diff
changeset
|
535 dosleepq ldx <D.SProcQ |
2375 | 536 beq CkLPRC |
2374 | 537 bsr RootThrough |
2372 | 538 |
2387 | 539 CkLPRC |
2374 | 540 lda <V.LPRC,u |
541 beq IRQExit ; no last process, bail | |
542 ldb #S$HUP | |
543 os9 F$Send ; send signal, don't think we can do anything about an error result anyway.. so | |
544 bra CkSuspnd ; do we need to go check suspend? | |
2314
5f76d1a611f6
term signal sending for serread port status responses
aaronwolfe
parents:
2313
diff
changeset
|
545 |
2308 | 546 ; put byte B in port As buffer - optimization help from Darren Atkinson |
2387 | 547 IRQPutCh |
548 ; set IRQ freq for bulk | |
2422 | 549 lda PollSpd1,pcr |
2387 | 550 lbsr IRQsetFRQ |
551 ldx RxBufPut,u ; point X to the data buffer | |
2374 | 552 |
2308 | 553 ; process interrupt/quit characters here |
554 ; note we will have to do this in the multiread (ugh) | |
2374 | 555 tfr b,a ; put byte in A |
556 ldb #S$Intrpt | |
557 cmpa V.INTR,u | |
558 beq send@ | |
559 ldb #S$Abort | |
560 cmpa V.QUIT,u | |
561 bne store | |
562 send@ lda V.LPRC,u | |
563 beq IRQExit | |
564 os9 F$Send | |
565 bra IRQExit | |
2308 | 566 |
2374 | 567 store |
2308 | 568 ; store our data byte |
2374 | 569 sta ,x+ ; store and increment buffer pointer |
570 | |
2308 | 571 ; adjust RxBufPut |
2374 | 572 cmpx RxBufEnd,u ; end of Rx buffer? |
573 blo IRQSkip1 ; no, go keep laydown pointer | |
574 ldx RxBufPtr,u ; get Rx buffer start address | |
575 IRQSkip1 stx RxBufPut,u ; set new Rx data laydown pointer | |
2308 | 576 |
577 ; increment RxDatLen | |
2374 | 578 inc RxDatLen,u |
2308 | 579 |
2374 | 580 CkSSig |
581 lda <SSigID,u ; send signal on data ready? | |
582 beq CkSuspnd | |
583 ldb <SSigSg,u ; else get signal code | |
584 os9 F$Send | |
585 clr <SSigID,u | |
586 bra IRQExit | |
2308 | 587 |
588 ; check if we have a process waiting for data | |
2374 | 589 CkSuspnd |
590 lda <V.WAKE,u ; V.WAKE? | |
591 beq IRQExit ; no | |
592 clr <V.WAKE,u ; clear V.WAKE | |
593 | |
2308 | 594 ; wake up waiter for read |
2374 | 595 ifeq Level-1 |
596 ldb #S$Wake | |
597 os9 F$Send | |
598 else | |
599 clrb | |
600 tfr d,x ; copy process descriptor pointer | |
601 lda P$State,x ; get state flags | |
602 anda #^Suspend ; clear suspend state | |
603 sta P$State,x ; save state flags | |
604 endc | |
2308 | 605 |
2374 | 606 IRQExit |
607 IRQExit2 puls cc,dp,pc ; restore interrupts cc,dp, return | |
2180 | 608 |
2374 | 609 emod |
610 eom equ * | |
611 end |