annotate level1/modules/dw3.asm @ 2383:b399116a3b5f

Now we have a /N descriptor... and the code in scdwn.asm to handle it.
author boisy
date Sat, 23 Jan 2010 22:37:16 +0000
parents 707480b7f0b0
children 8476556e5f0c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
1 ********************************************************************
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
2 * DW3 - DriveWire 3 Low Level Subroutine Module
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
3 *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
4 * $Id$
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
5 *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
7 * Comment
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
9 * 1 2008/01/26 Boisy G. Pitre
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
10 * Started as a segregated subroutine module.
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
11 *
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
12 * 2 2010/01/20 Boisy G. Pitre
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
13 * Added support for DWNet
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
14
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
15 nam DW3
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
16 ttl DriveWire 3 Low Level Subroutine Module
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
17
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
18 ifp1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
19 use defsfile
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
20 use dwdefs.d
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
21 endc
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
22
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
23 tylg set Sbrtn+Objct
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
24 atrv set ReEnt+rev
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
25 rev set $01
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
26
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
27 mod eom,name,tylg,atrv,start,0
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
28
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
29 * irq
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
30 IRQPckt fcb $00,$01,$0A ;IRQ packet Flip(1),Mask(1),Priority(1) bytes
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
31 * Default time packet
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
32 DefTime fcb 109,12,31,23,59,59
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
33
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
34 name fcs /dw3/
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
35
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
36 * DriveWire subroutine entry table
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
37 start lbra Init
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
38 bra Read
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
39 nop
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
40 lbra Write
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
41
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
42 * Term
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
43 *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
44 * Entry:
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
45 * U = address of device memory area
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
46 *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
47 * Exit:
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
48 * CC = carry set on error
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
49 * B = error code
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
50 *
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
51 Term
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
52 clrb clear Carry
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
53 rts
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
54
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
55 * Read
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
56 *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
57 * ON ENTRY:
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
58 * X = ADDRESS OF THE RECEIVE BUFFER
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
59 * A = TIMEOUT VALUE (182 = APPROX ONE SECOND @ 0.89 MHz)
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
60 *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
61 * ON EXIT:
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
62 * Y = DATA CHECKSUM
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
63 * D = ACTUAL NUMBER OF BYTES RECEIVED
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
64 * X AND U ARE PRESERVED
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
65 * CC.CARRY IS SET IF A FRAMING ERROR WAS DETECTED
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
66 *
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
67 Read
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
68 use dwread.asm
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
69
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
70 * Write
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
71 *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
72 * Entry:
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
73 Write
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
74 use dwwrite.asm
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
75
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
76 * Init
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
77 *
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
78 * Entry:
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
79 * Y = address of device descriptor
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
80 * U = address of device memory area
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
81 *
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
82 * Exit:
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
83 * CC = carry set on error
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
84 * B = error code
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
85 *
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
86 * Initialize the serial device
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
87 Init
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
88 clrb clear Carry
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
89 pshs y,x,cc then push CC on stack
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
90 orcc #IntMasks
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
91 ldx #PIA1Base $FF20
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
92 clr 1,x clear CD
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
93 lda #%11111110
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
94 sta ,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
95 lda #%00110100
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
96 sta 1,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
97 lda ,x
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
98
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
99 ; allocate DW statics page
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
100 pshs u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
101 ldd #$0100
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
102 os9 F$SRqMem
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
103 tfr u,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
104 puls u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
105 lbcs InitEx
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
106 ifgt Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
107 stx <D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
108 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
109 stx >D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
110 endc
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
111 ; clear out 256 byte page at X
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
112 clrb
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
113 loop@ clr ,x+
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
114 decb
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
115 bne loop@
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
116
2321
6a5ada3e2666 added DWINIT op code, dw3 now sends on init just before installing VIRQ
aaronwolfe
parents: 2316
diff changeset
117 * send OP_DWINIT
6a5ada3e2666 added DWINIT op code, dw3 now sends on init just before installing VIRQ
aaronwolfe
parents: 2316
diff changeset
118 ; setup DWsub command
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
119 pshs u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
120 lda #OP_DWINIT ; load command
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
121 pshs a ; command store on stack
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
122 leax ,s ; point X to stack
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
123 ldy #1 ; 1 byte to send
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
124 ifgt Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
125 ldu <D.DWSubAddr
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
126 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
127 ldu >D.DWSubAddr
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
128 endc
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
129 jsr 6,u ; call DWrite
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
130 leas 1,s ; clean 1 DWsub arg from stack
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
131 puls u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
132
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
133 * install ISR
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
134 InstIRQ
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
135 ifgt Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
136 ldx <D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
137 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
138 ldx >D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
139 endc
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
140 leax DW.VIRQPkt,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
141 pshs u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
142 tfr x,u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
143 leax Vi.Stat,x ;fake VIRQ status register
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
144 lda #$80 ;VIRQ flag clear, repeated VIRQs
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
145 sta ,x ;set it while we're here...
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
146 tfr x,d ;copy fake VIRQ status register address
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
147 leax IRQPckt,pcr ;IRQ polling packet
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
148 leay IRQSvc,pcr ;IRQ service entry
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
149 os9 F$IRQ ;install
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
150 puls u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
151 bcs InitEx ;exit with error
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
152 ldd #$0003 ;lets try every 6 ticks (0.1 seconds) -- testing 3, gives better response in interactive things
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
153 ifgt Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
154 ldx <D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
155 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
156 ldx >D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
157 endc
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
158 leax DW.VIRQPkt,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
159 std Vi.Rst,x ; reset count
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
160 tfr x,y ; move VIRQ software packet to Y
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
161 tryagain
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
162 ldx #$0001 ; code to install new VIRQ
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
163 os9 F$VIRQ ; install
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
164 bcc IRQok ; no error, continue
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
165 cmpb #E$UnkSvc
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
166 bne InitEx
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
167 ; if we get an E$UnkSvc error, then clock has not been initialized, so do it here
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
168 leax DefTime,pcr
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
169 os9 F$STime
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
170 bra tryagain ; note: this has the slim potential of looping forever
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
171 IRQok
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
172 ifgt Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
173 ldx <D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
174 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
175 ldx >D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
176 endc
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
177 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
178 leax DW.StatTbl,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
179 tfr u,d
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
180 ldb <V.PORT+1,u ; get our port #
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
181 sta b,x ; store in table
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
182
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
183 InitEx
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
184 puls cc,x,y,pc
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
185
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
186
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
187 ; ***********************************************************************
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
188 ; Interrupt handler - Much help from Darren Atkinson
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
189
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
190 IRQMulti3 anda #$0F ; mask first 4 bits, a is now port #+1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
191 deca ; we pass +1 to use 0 for no data
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
192 pshs a ; save port #
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
193 cmpb RxGrab,u ; compare room in buffer to server's byte
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
194 bhs IRQM06 ; room left >= server's bytes, no problem
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
195
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
196 stb RxGrab,u ; else replace with room left in our buffer
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
197
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
198 ; also limit to end of buffer
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
199 IRQM06 ldd RxBufEnd,u ; end addr of buffer
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
200 subd RxBufPut,u ; subtract current write pointer, result is # bytes left going forward in buff.
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
201
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
202 IRQM05 cmpb RxGrab,u ; compare b (room left) to grab bytes
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
203 bhs IRQM03 ; branch if we have room for grab bytes
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
204
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
205 stb RxGrab,u ; else set grab to room left
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
206
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
207 ; send multiread req
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
208 IRQM03 puls a ; port # is on stack
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
209 ldb RxGrab,u
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
210
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
211 pshs u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
212
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
213 ; setup DWsub command
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
214 pshs d ; (a port, b bytes)
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
215 lda #OP_SERREADM ; load command
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
216 pshs a ; command store on stack
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
217 leax ,s ; point X to stack
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
218 ldy #3 ; 3 bytes to send
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
219
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
220 ifgt Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
221 ldu <D.DWSubAddr
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
222 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
223 ldu >D.DWSubAddr
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
224 endc
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
225 jsr 6,u ; call DWrite
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
226
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
227 leas 3,s ; clean 3 DWsub args from stack
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
228
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
229 ldx ,s ; pointer to this port's area (from U prior), leave it on stack
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
230 ldb RxGrab,x ; set B to grab bytes
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
231 clra ; 0 in high byte
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
232 tfr d,y ; set # bytes for DW
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
233
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
234 ldx RxBufPut,x ; point X to insert position in this port's buffer
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
235 ; receive response
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
236 jsr 3,u ; call DWRead
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
237 ; handle errors?
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
238
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
239
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
240 puls u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
241 ldb RxGrab,u ; our grab bytes
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
242
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
243 ; set new RxBufPut
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
244 ldx RxBufPut,u ; current write pointer
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
245 abx ; add b (# bytes) to RxBufPut
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
246 cmpx RxBufEnd,u ; end of Rx buffer?
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
247 blo IRQM04 ; no, go keep laydown pointer
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
248 ldx RxBufPtr,u ; get Rx buffer start address
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
249 IRQM04 stx RxBufPut,u ; set new Rx data laydown pointer
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
250
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
251 ; set new RxDatLen
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
252 ldb RxDatLen,u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
253 addb RxGrab,u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
254 stb RxDatLen,u ; store new value
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
255
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
256 lbra CkSSig ; had to lbra
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
257
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
258 IRQMulti
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
259 ; initial grab bytes
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
260 stb RxGrab,u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
261
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
262 ; limit server bytes to bufsize - datlen
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
263 ldb RxBufSiz,u ; size of buffer
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
264 subb RxDatLen,u ; current bytes in buffer
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
265 bne IRQMulti3 ; continue, we have some space in buffer
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
266 ; no room in buffer
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
267 tstb
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
268 lbne CkSSig ;had to lbra
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
269 lbra IRQExit ;had to lbra
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
270
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
271
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
272 ; **** IRQ ENTRY POINT
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
273 IRQSvc equ *
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
274 pshs cc,dp ; save system cc,DP
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
275 orcc #IntMasks ; mask interrupts
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
276
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
277 ; mark VIRQ handled (note U is pointer to our VIRQ packet in DP)
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
278 lda Vi.Stat,u ; VIRQ status register
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
279 anda #^Vi.IFlag ; clear flag in VIRQ status register
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
280 sta Vi.Stat,u ; save it...
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
281
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
282 ; poll server for incoming serial data
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
283
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
284 ; send request
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
285 lda #OP_SERREAD ; load command
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
286 pshs a ; command store on stack
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
287 leax ,s ; point X to stack
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
288 ldy #1 ; 1 byte to send
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
289
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
290 ifgt Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
291 ldu <D.DWSubAddr
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
292 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
293 ldu >D.DWSubAddr
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
294 endc
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
295 jsr 6,u ; call DWrite
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
296
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
297 ; receive response
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
298 leas -1,s ; one more byte to fit response
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
299 leax ,s ; point X to stack head
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
300 ldy #2 ; 2 bytes to retrieve
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
301 jsr 3,u ; call DWRead
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
302 beq IRQSvc2 ; branch if no error
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
303 leas 2,s ; error, cleanup stack 2
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
304 lbra IRQExit2 ; don't reset error count on the way out
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
305
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
306 ; process response
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
307 IRQSvc2
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
308 ldd ,s++ ; pull returned status byte into A,data into B (set Z if zero, N if multiread)
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
309 lbeq IRQExit ; branch if D = 0 (nothing to do)
2311
b2bc1ad04163 Made changes
aaronwolfe
parents: 2308
diff changeset
310 ; future - handle backing off on polling interval
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
311
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
312
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
313 ; save back D on stack and build our U
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
314 pshs d
2311
b2bc1ad04163 Made changes
aaronwolfe
parents: 2308
diff changeset
315 * mode switch on bits 7+6 of A: 00 = vserial, 01 = system, 10 = wirebug?, 11 = ?
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
316 anda #$C0 ; mask last 6 bits
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
317 beq mode00 ; virtual serial mode
2311
b2bc1ad04163 Made changes
aaronwolfe
parents: 2308
diff changeset
318 ; future - handle other modes
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
319 lbra IRQExit ; for now, bail
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
320
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
321 mode00 lda ,s ; restore A
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
322 anda #$0F ; mask first 4 bits, a is now port #+1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
323 beq IRQCont ; if we're here with 0 in the port, its not really a port # (can we jump straight to status?)
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
324 deca ; we pass +1 to use 0 for no data
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
325 ; here we set U to the static storage area of the device we are working with
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
326 ifgt Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
327 ldx <D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
328 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
329 ldx >D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
330 endc
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
331 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
332 ; leax DW.StatTbl,x
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
333 lda a,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
334 bne IRQCont ; if A is 0, then this device is not active, so exit
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
335 puls d
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
336 lbra IRQExit
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
337 IRQCont
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
338 clrb
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
339 tfr d,u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
340
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
341 puls d
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
342
2311
b2bc1ad04163 Made changes
aaronwolfe
parents: 2308
diff changeset
343 * multiread/status flag is in bit 4 of A
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
344 bita #$10
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
345 beq IRQPutch ; branch if multiread not set
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
346
2311
b2bc1ad04163 Made changes
aaronwolfe
parents: 2308
diff changeset
347 * all 0s in port means status, anything else is multiread
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
348
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
349 bita #$0F ;mask bit 7-4
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
350 beq dostat ;port # all 0, this is a status response
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
351 bra IRQMulti ;its not all 0, this is a multiread
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
352
2314
5f76d1a611f6 term signal sending for serread port status responses
aaronwolfe
parents: 2313
diff changeset
353
5f76d1a611f6 term signal sending for serread port status responses
aaronwolfe
parents: 2313
diff changeset
354 * in status events, databyte is split, 4bits status, 4bits port #
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
355 dostat bitb #$F0 ;mask low bits
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
356 lbne IRQExit ;we only implement code 0000, term
2314
5f76d1a611f6 term signal sending for serread port status responses
aaronwolfe
parents: 2313
diff changeset
357 * set u to port #
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
358 ifgt Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
359 ldx <D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
360 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
361 ldx >D.DWStat
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
362 endc
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
363 lda b,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
364 bne statcont ; if A is 0, then this device is not active, so exit
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
365 lbra IRQExit
2372
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
366
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
367 * This routine roots through process descriptors in a queue and
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
368 * checks to see if the process has a path that is open to the device
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
369 * represented by the static storage pointer in U. if so, the S$HUP
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
370 * signal is sent to that process
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
371 *
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
372 * Entry: X = process descriptor to evaluate
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
373 * U = static storage of device we want to check against
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
374 RootThrough
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
375 ldb #NumPaths
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
376 leay P$Path,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
377 pshs x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
378 loop decb
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
379 bmi out
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
380 lda ,y+
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
381 beq loop
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
382 pshs y
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
383 ifgt Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
384 ldx <D.PthDBT
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
385 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
386 ldx >D.PthDBT
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
387 endc
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
388 os9 F$Find64
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
389 ldx PD.DEV,y
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
390 leax V$STAT,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
391 puls y
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
392 bcs out
2372
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
393
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
394 cmpu ,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
395 bne loop
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
396
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
397 ldx ,s
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
398 lda P$ID,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
399 ldb #S$HUP
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
400 os9 F$Send
2372
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
401
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
402 out puls x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
403 ldx P$Queue,x
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
404 bne RootThrough
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
405 rts
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
406
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
407 statcont clrb
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
408 tfr d,u
2372
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
409 * NEW: root through all process descriptors. if any has a path open to this
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
410 * device, send then S$HUP
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
411 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
412 beq dowaitq
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
413 bsr RootThrough
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2375
diff changeset
414 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
415 beq dosleepq
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
416 bsr RootThrough
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2375
diff changeset
417 dosleepq ldx <D.SProcQ
2375
707480b7f0b0 Updated
boisy
parents: 2374
diff changeset
418 beq CkLPRC
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
419 bsr RootThrough
2372
bfb8eefc19e1 Renamed S$Peer to S$HUP
boisy
parents: 2359
diff changeset
420
2375
707480b7f0b0 Updated
boisy
parents: 2374
diff changeset
421 CkLPRC
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
422 lda <V.LPRC,u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
423 beq IRQExit ; no last process, bail
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
424 ldb #S$HUP
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
425 os9 F$Send ; send signal, don't think we can do anything about an error result anyway.. so
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
426 bra CkSuspnd ; do we need to go check suspend?
2314
5f76d1a611f6 term signal sending for serread port status responses
aaronwolfe
parents: 2313
diff changeset
427
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
428 ; put byte B in port As buffer - optimization help from Darren Atkinson
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
429 IRQPutCh ldx RxBufPut,u ; point X to the data buffer
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
430
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
431 ; process interrupt/quit characters here
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
432 ; note we will have to do this in the multiread (ugh)
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
433 tfr b,a ; put byte in A
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
434 ldb #S$Intrpt
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
435 cmpa V.INTR,u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
436 beq send@
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
437 ldb #S$Abort
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
438 cmpa V.QUIT,u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
439 bne store
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
440 send@ lda V.LPRC,u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
441 beq IRQExit
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
442 os9 F$Send
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
443 bra IRQExit
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
444
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
445 store
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
446 ; store our data byte
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
447 sta ,x+ ; store and increment buffer pointer
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
448
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
449 ; adjust RxBufPut
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
450 cmpx RxBufEnd,u ; end of Rx buffer?
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
451 blo IRQSkip1 ; no, go keep laydown pointer
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
452 ldx RxBufPtr,u ; get Rx buffer start address
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
453 IRQSkip1 stx RxBufPut,u ; set new Rx data laydown pointer
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
454
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
455 ; increment RxDatLen
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
456 inc RxDatLen,u
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
457
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
458 CkSSig
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
459 lda <SSigID,u ; send signal on data ready?
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
460 beq CkSuspnd
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
461 ldb <SSigSg,u ; else get signal code
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
462 os9 F$Send
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
463 clr <SSigID,u
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
464 bra IRQExit
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
465
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
466 ; check if we have a process waiting for data
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
467 CkSuspnd
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
468 lda <V.WAKE,u ; V.WAKE?
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
469 beq IRQExit ; no
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
470 clr <V.WAKE,u ; clear V.WAKE
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
471
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
472 ; wake up waiter for read
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
473 ifeq Level-1
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
474 ldb #S$Wake
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
475 os9 F$Send
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
476 else
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
477 clrb
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
478 tfr d,x ; copy process descriptor pointer
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
479 lda P$State,x ; get state flags
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
480 anda #^Suspend ; clear suspend state
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
481 sta P$State,x ; save state flags
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
482 endc
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2180
diff changeset
483
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
484 IRQExit
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
485 IRQExit2 puls cc,dp,pc ; restore interrupts cc,dp, return
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
486
2374
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
487 emod
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
488 eom equ *
895dec31461a Added back code to send S$HUP to V.LPRC
boisy
parents: 2372
diff changeset
489 end