Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/scdwn.asm @ 2402:04755ee002ba
Updated
author | boisy |
---|---|
date | Sun, 24 Jan 2010 17:32:49 +0000 |
parents | 8339cef818b2 |
children | 28bfbf753ea9 |
rev | line source |
---|---|
2324 | 1 ******************************************************************** |
2 * scdwn - CoCo DriveWire Network Driver | |
3 * | |
4 * $Id$ | |
5 * | |
2384 | 6 * How this wildcard /N stuff works: |
7 * A process interested in obtaining a path to a network device | |
8 * can open any /Nx descriptor but it may be in use by another process. | |
9 * The safest way to obtain a new network device is to open the wildcard | |
10 * descriptor /N. This works similarly to the way /W works in the CoCo 3 | |
11 * VTIO driver. | |
12 * | |
13 * When /N is open, the INIT routine is called but most of it is bypassed | |
14 * because it detects the wildcard device (which has an address of $FFFF). | |
15 * | |
16 * The SS.Open I$SetStat entry point is called. That routine also detects | |
17 * the wildcard is used, so the hunt is on for the next available /Nx | |
18 * descriptor (it does this by checking the DW static storage for each /Nx | |
19 * in the DW static storage page). If it finds a free page, it notes the | |
20 * offset as a number, then builds a descriptor name (ex: /N4) and then | |
21 * F$Links to it. It then takes the descriptor module address and sticks it | |
22 * in the device table entry for /N. It also takes the V.PORT address and sticks | |
23 * it in the static storage memory allocated for /N. | |
24 * Afer that, SS.Open does something really sneaky: it branches into the | |
25 * Init routine which detects via the static storage that this is not a /N | |
26 * descriptor but a /N4 descriptor. Init then sends the SERINIT and initializes | |
27 * the DW static storage for /N4. Control is returned to the SS.Open code which | |
28 * then advertises the SS.Open to the server. | |
29 * | |
2324 | 30 * Edt/Rev YYYY/MM/DD Modified by |
31 * Comment | |
32 * ------------------------------------------------------------------ | |
33 * 1 2009/11/30 Aaron Wolfe | |
34 * Started | |
35 * | |
36 * 2009/12/28 Boisy G. Pitre | |
37 * Modified so that F$STime is called if we get an error on calling | |
38 * F$VIRQ (which means the clock module has not be initialized) | |
39 * | |
40 * 2009/12/31 Boisy G. Pitre | |
41 * Fixed crash in Init where F$Link failure would not clean up stack | |
42 * | |
43 * 2010/01/03 Boisy G. Pitre | |
44 * Moved IRQ stuff into DW3 subroutine module | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
45 * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
46 * 2 2010/01/23 Boisy G. Pitre |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
47 * Added code in SS.Open to use /N wildcard device (tricky stuff!) |
2324 | 48 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
49 nam scdwn |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
50 ttl CoCo DriveWire Network Driver |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
51 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
52 ifp1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
53 use defsfile |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
54 use dwdefs.d |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
55 endc |
2324 | 56 |
57 | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
58 tylg set Drivr+Objct |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
59 atrv set ReEnt+Rev |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
60 rev set $00 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
61 edition set 2 |
2324 | 62 |
63 * Note: driver memory defined in dwdefs.d | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
64 mod eom,name,tylg,atrv,start,SCFDrvMemSz |
2324 | 65 |
66 * module info | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
67 fcb UPDAT.+SHARE. ;driver access modes |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
68 name fcs /scdwn/ ;driver name |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
69 fcb edition ;driver edition |
2324 | 70 |
71 * dispatch calls | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
72 start equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
73 lbra Init |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
74 lbra Read |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
75 lbra Write |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
76 lbra GetStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
77 lbra SetStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
78 |
2324 | 79 *********************************************************************** |
80 * Term | |
81 * | |
82 * shut down the driver. | |
83 * should close only the correct port, tell server to close the port, | |
84 * and remove irq handler when no ports are left | |
85 * | |
86 * Entry: | |
87 * U = address of device memory area | |
88 * | |
89 * Exit: | |
90 * CC = carry set on error | |
91 * B = error code | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
92 Term equ * |
2394 | 93 lda <V.PORT+1,u get our port # |
94 bmi termbye if this is wildcard, skip TERM | |
95 pshs a port # on stack | |
96 * clear statics table entry | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
97 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
98 ldx <D.DWStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
99 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
100 ldx >D.DWStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
101 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
102 beq tell |
2394 | 103 * cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax |
104 * leax DW.StatTbl,x | |
105 clr a,x clear out | |
2324 | 106 |
2394 | 107 * tell server |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
108 tell |
2394 | 109 lda #OP_SERTERM load command |
110 pshs a command store on stack | |
111 leax ,s point X to stack | |
112 ldy #2 2 bytes to send | |
2324 | 113 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
114 pshs u |
2324 | 115 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
116 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
117 ldu <D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
118 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
119 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
120 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
121 beq nosub |
2394 | 122 jsr 6,u call DWrite |
2324 | 123 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
124 nosub |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
125 puls u |
2394 | 126 leas 2,s clean 3 DWsub args from stack |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
127 termbye clrb |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
128 rts |
2324 | 129 |
130 *********************************************************************** | |
131 * Init | |
132 * | |
133 * Entry: | |
134 * Y = address of device descriptor | |
135 * U = address of device memory area | |
136 * | |
137 * Exit: | |
138 * CC = carry set on error | |
139 * B = error code | |
140 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
141 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
142 Init equ * |
2324 | 143 |
144 ; link to subroutine module | |
145 ; has the link already been done? | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
146 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
147 ldx <D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
148 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
149 ldx >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
150 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
151 bne already ; if so, do not bother |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
152 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
153 pshs u ; preserve u since os9 link is coming up |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
154 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
155 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
156 ldx <D.Proc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
157 pshs x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
158 ldx <D.SysPrc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
159 stx <D.Proc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
160 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
161 clra |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
162 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
163 leax dw3name,pcr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
164 os9 F$Link |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
165 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
166 puls x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
167 stx <D.Proc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
168 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
169 bcs InitEx2 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
170 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
171 sty <D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
172 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
173 sty >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
174 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
175 jsr ,y ; call DW init routine |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
176 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
177 puls u ; restore u |
2324 | 178 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
179 already |
2324 | 180 ; tell DW we have a new port opening (port mode already on stack) |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
181 ldb <V.PORT+1,u ; get our port # |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
182 * if /N wildcard, skip advertising via SERINIT |
2394 | 183 bmi initEx |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
184 lda #OP_SERINIT ; command |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
185 pshs d ; command + port # on stack |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
186 leax ,s ; point X to stack |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
187 ldy #2 ; # of bytes to send |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
188 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
189 pshs u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
190 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
191 ldu <D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
192 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
193 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
194 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
195 jsr 6,u ; call DWrite |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
196 puls u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
197 |
2324 | 198 ; set up local buffer |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
199 ldb #RxBufDSz ; default Rx buffer size |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
200 leax RxBuff,u ; default Rx buffer address |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
201 stb RxBufSiz,u ; save Rx buffer size |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
202 stx RxBufPtr,u ; save Rx buffer address |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
203 stx RxBufGet,u ; set initial Rx buffer input address |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
204 stx RxBufPut,u ; set initial Rx buffer output address |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
205 abx ; add buffer size to buffer start.. |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
206 stx RxBufEnd,u ; save Rx buffer end address |
2324 | 207 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
208 tfr u,d ; (A = high page of statics) |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
209 puls b |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
210 puls b ; (B = port number) |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
211 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
212 ldx <D.DWStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
213 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
214 ldx >D.DWStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
215 endc |
2324 | 216 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax |
217 ; leax DW.StatTbl,x | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
218 sta b,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
219 InitEx equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
220 rts |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
221 InitEx2 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
222 puls u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
223 rts |
2324 | 224 |
225 ; drivewire info | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
226 dw3name fcs /dw3/ |
2324 | 227 |
228 | |
229 ***************************************************************************** | |
230 * Write | |
231 * | |
232 * Entry: | |
233 * A = character to write | |
234 * Y = address of path descriptor | |
235 * U = address of device memory area | |
236 * | |
237 * Exit: | |
238 * CC = carry set on error | |
239 * B = error code | |
240 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
241 Write equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
242 pshs a ; character to send on stack |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
243 ldb <V.PORT+1,u ; port number into B |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
244 lda #OP_SERWRITE ; put command into A |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
245 pshs d |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
246 leax ,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
247 ldy #$0003 ; 3 bytes to send.. ugh. need WRITEM (data mode) |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
248 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
249 ldu <D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
250 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
251 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
252 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
253 jsr 6,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
254 WriteOK clrb |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
255 WriteExit puls a,x,pc ; clean stack, return |
2324 | 256 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
257 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
258 NotReady comb |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
259 ldb #E$NotRdy |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
260 rts |
2333 | 261 |
2324 | 262 ************************************************************************************* |
263 * Read | |
264 * | |
265 * Entry: | |
266 * Y = address of path descriptor | |
267 * U = address of device memory area | |
268 * | |
269 * Exit: | |
270 * A = character read | |
271 * CC = carry set on error | |
272 * B = error code | |
273 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
274 Read equ * |
2333 | 275 * Check to see if there is a signal-on-data-ready set for this path. |
276 * If so, we return a Not Ready error. | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
277 lda <SSigID,u data ready signal trap set up? |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
278 bne NotReady yes, exit with not ready error |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
279 pshs cc,dp ; save IRQ/Carry status, system DP |
2324 | 280 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
281 ReadChr orcc #IntMasks ; mask interrupts |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
282 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
283 lda RxDatLen,u ; get our Rx buffer count |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
284 beq ReadSlp ; no data, go sleep while waiting for new Rx data... |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
285 |
2324 | 286 ; we have data waiting |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
287 deca ; one less byte in buffer |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
288 sta RxDatLen,u ; save new Rx data count |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
289 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
290 ldx RxBufGet,u ; current Rx buffer pickup position |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
291 lda ,x+ ; get Rx character, set up next pickup position |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
292 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
293 cmpx RxBufEnd,u ; end of Rx buffer? |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
294 blo ReadChr1 ; no, keep pickup pointer |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
295 ldx RxBufPtr,u ; get Rx buffer start address |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
296 ReadChr1 stx RxBufGet,u ; set new Rx data pickup pointer |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
297 |
2324 | 298 ; return to caller |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
299 puls cc,dp,pc ; recover IRQ/Carry status, system DP, return with character in A |
2324 | 300 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
301 ReadSlp equ * |
2324 | 302 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
303 ifeq Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
304 ReadSlp2 lda <V.BUSY,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
305 sta <V.WAKE,u ; store process id in this port's entry in the waiter table |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
306 lbsr Sleep0 ; sleep level 1 style |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
307 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
308 ReadSlp2 lda >D.Proc ; process descriptor address MSB |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
309 sta <V.WAKE,u ; save MSB in V.WAKE |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
310 clrb |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
311 tfr d,x ; process descriptor address |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
312 ifne H6309 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
313 oim #Suspend,P$State,x ; suspend |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
314 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
315 ldb P$State,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
316 orb #Suspend |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
317 stb P$State,x ; suspend |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
318 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
319 bsr Sleep1 ; sleep level 2 style |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
320 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
321 |
2324 | 322 ; we have been awakened.. |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
323 |
2324 | 324 ; check for signals |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
325 ldx >D.Proc ; process descriptor address |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
326 ldb P$Signal,x ; pending signal for this process? |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
327 beq ChkState ; no, go check process state... |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
328 cmpb #S$HUP ; (S$HUP or lower) |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
329 bls ErrExit ; yes, go do it... |
2324 | 330 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
331 ChkState equ * |
2324 | 332 ; have we been condemned to die? |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
333 ifne H6309 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
334 tim #Condem,P$State,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
335 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
336 ldb P$State,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
337 bitb #Condem |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
338 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
339 bne PrAbtErr ; yes, go do it... |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
340 |
2324 | 341 ; check that our waiter byte was cleared by ISR instance |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
342 tst <V.WAKE,u ; our waiter byte |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
343 beq ReadChr ; 0 = its our turn, go get a character |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
344 bra ReadSlp ; false alarm, go back to sleep |
2324 | 345 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
346 PrAbtErr ldb #E$PrcAbt ; set error code |
2324 | 347 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
348 ErrExit equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
349 ifne H6309 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
350 oim #Carry,,s ; set carry |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
351 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
352 lda ,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
353 ora #Carry |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
354 sta ,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
355 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
356 puls cc,dp,pc ; restore CC, system DP, return |
2324 | 357 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
358 ifeq Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
359 Sleep0 ldx #$0 ; sleep till ISR wakes us |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
360 bra TimedSlp |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
361 endc |
2324 | 362 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
363 Sleep1 ldx #$1 ; just sleep till end of slice, we are suspended (level 2) |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
364 TimedSlp andcc #^Intmasks ; enable IRQs |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
365 os9 F$Sleep |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
366 clr <V.WAKE,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
367 rts ; return |
2324 | 368 |
369 | |
370 ********************************************************************** | |
371 * GetStat - heavily borrowed from sc6551 | |
372 * | |
373 * Entry: | |
374 * A = function code | |
375 * Y = address of path descriptor | |
376 * U = address of device memory area | |
377 * | |
378 * Exit: | |
379 * CC = carry set on error | |
380 * B = error code | |
381 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
382 GetStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
383 clrb ; default to no error... |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
384 pshs cc,dp ; save IRQ/Carry status,system DP |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
385 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
386 ldx PD.RGS,y ; caller's register stack pointer |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
387 cmpa #SS.EOF |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
388 beq GSExitOK ; SCF devices never return EOF |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
389 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
390 cmpa #SS.Ready |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
391 bne Advertise ; next check |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
392 |
2324 | 393 ; SS.Ready |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
394 lda RxDatLen,u ; get Rx data length |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
395 beq NRdyErr ; none, go report error |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
396 sta R$B,x ; set Rx data available in caller's [B] |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
397 GSExitOK puls cc,dp,pc ; restore Carry status, system DP, return |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
398 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
399 NRdyErr ldb #E$NotRdy |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
400 bra ErrExit ; return error code |
2324 | 401 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
402 UnSvcErr ldb #E$UnkSvc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
403 bra ErrExit ; return error code |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
404 |
2324 | 405 ; We advertise all of our SERGETSTAT calls (except SS.Ready) to the server |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
406 Advertise |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
407 ldb #OP_SERGETSTAT |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
408 bsr SendStat |
2324 | 409 |
410 ; Note: Here we could somehow obtain the size of the terminal window from the server | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
411 GetScSiz cmpa #SS.ScSiz |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
412 bne GetComSt ; next check |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
413 ldu PD.DEV,y |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
414 ldu V$DESC,u ; device descriptor |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
415 clra |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
416 ldb IT.COL,u ; return screen size |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
417 std R$X,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
418 ldb IT.ROW,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
419 std R$Y,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
420 puls cc,dp,pc ; restore Carry status, system DP, return |
2324 | 421 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
422 GetComSt cmpa #SS.ComSt |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
423 bne UnSvcErr ; no, we have no more answers, report error |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
424 ldd #$0000 ; not used, return $0000 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
425 std R$Y,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
426 sta R$B,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
427 puls cc,dp,pc ; restore Carry status, system DP, return |
2324 | 428 |
429 * Advertise Stat Code to server | |
430 * A = Function Code | |
431 * B = OP_SERGETSTAT or OP_SERSETSTAT | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
432 SendStat |
2324 | 433 ; advertise our GetStt code to the server |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
434 pshs a,y,x,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
435 leas -3,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
436 leax ,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
437 stb ,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
438 sta 2,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
439 ldb V.PORT+1,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
440 stb 1,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
441 ldy #$0003 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
442 ifgt LEVEL-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
443 ldu <D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
444 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
445 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
446 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
447 jsr 6,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
448 leas 3,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
449 puls a,y,x,u,pc |
2324 | 450 |
451 ************************************************************************* | |
452 * SetStat | |
453 * | |
454 * Entry: | |
455 * A = function code | |
456 * Y = address of path descriptor | |
457 * U = address of device memory area | |
458 * | |
459 * Exit: | |
460 * CC = carry set on error | |
461 * B = error code | |
462 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
463 SetStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
464 cmpa #SS.Open |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
465 bne isitcomst |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
466 bsr open |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
467 bcs ssbye |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
468 ldd #SS.Open*256+OP_SERSETSTAT |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
469 bra SendStat |
2394 | 470 isitcomst |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
471 ldb #OP_SERSETSTAT |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
472 bsr SendStat |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
473 cmpa #SS.ComSt |
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
474 beq comst |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
475 cmpa #SS.Close |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
476 beq ex |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
477 cmpa #SS.SSig |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
478 beq ssig |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
479 cmpa #SS.Relea |
2394 | 480 bne donebad |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
481 relea lda PD.CPR,y get curr proc # |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
482 cmpa <SSigID,u same? |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
483 bne ex |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
484 clr <SSigID,u clear process id |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
485 ex rts |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
486 ssig pshs cc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
487 orcc #IntMasks |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
488 lda PD.CPR,y ; get curr proc # |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
489 ldx PD.RGS,y |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
490 ldb R$X+1,x ; get user signal code |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
491 tst RxDatLen,u ; get Rx data length |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
492 beq ssigsetup ; branch if no data in buffer |
2333 | 493 * if here, we have data so send signal immediately |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
494 os9 F$Send |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
495 puls cc,pc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
496 ssigsetup std <SSigID,u ; save process ID & signal |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
497 puls cc,pc |
2333 | 498 |
2394 | 499 donebad comb |
500 ldb #E$UnkSvc | |
501 rts | |
502 | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
503 comst leax PD.OPT,y |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
504 ldy #OPTCNT |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
505 ifgt LEVEL-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
506 ldu <D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
507 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
508 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
509 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
510 jsr 6,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
511 clrb |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
512 ssbye rts |
2324 | 513 |
2339
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
514 * SS.Open processor |
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
515 * Entry: X=Register stack pointer |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
516 * U=Static memory pointer |
2339
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
517 * Y=Path descriptor pointer |
2394 | 518 open tst <V.PORT+1,u check if this is $FFFF (wildcard) |
519 bpl ssbye if not, we have nothing to do | |
520 pshs u,y preserve registers | |
521 ldx PD.DEV,y get pointer to device table entry | |
522 ldx V$DESC,x get pointer to /N descriptor | |
523 pshs x save device descriptor pointer | |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
524 * start at /N1 |
2394 | 525 ldb #1 |
526 L0B58 equ * | |
527 ifgt Level-1 | |
528 ldx <D.DWStat | |
529 else | |
530 ldx >D.DWStat | |
531 endc | |
2339
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
532 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax |
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
533 ; leax DW.StatTbl,x |
2394 | 534 next cmpb #DW.StatCnt |
535 bge opexer | |
536 tst b,x | |
537 beq found | |
538 incb | |
539 bra next | |
540 opexer comb set carry | |
541 ldb #E$MNF get module not found error | |
542 puls x,y,u,pc purge stack and return | |
543 | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
544 * Found a free spot |
2394 | 545 found pshs b save # of free entry |
546 leas -5,s | |
547 leay ,s | |
548 ldb #'N get netdev name prefix | |
549 stb ,y+ put it in buffer | |
550 ldb 5,s get netdev # that was free | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
551 * Convert netdev # in B to ASCII eqivalent with high bit set |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
552 |
2394 | 553 ifne H6309 |
2395 | 554 clra |
2394 | 555 divd #10 divide it by 10 |
556 else | |
557 lda #-1 | |
558 L0B87b inca | |
559 subb #10 | |
560 bcc L0B87b | |
561 addb #10 | |
562 exg a,b | |
563 cmpb #0 | |
564 endc | |
565 beq L0B87 if answer is 0 there is only 1 digit, skip ahead | |
566 orb #$30 make first digit ASCII | |
567 stb ,y+ put it in buffer | |
568 L0B87 ora #$B0 make remainder ASCII with high bit set | |
569 sta ,y+ put it in buffer | |
570 L0B92 leas -2,s make a buffer for process decriptor pointer | |
571 ifgt Level-1 | |
572 lbsr L0238 switch to system process descriptor | |
573 endc | |
574 leax 2,s Point to calculated dsc. name | |
575 lda #Devic+Objct get module type | |
576 os9 F$Link try & link it | |
577 ifgt Level-1 | |
578 lbsr L0244 switch back to current process | |
579 endc | |
580 leas 7,s purge stack | |
581 bcc L0BAB it's linked, skip ahead | |
582 L0BA7 puls b get original number | |
583 incb | |
584 bra L0B58 go find another free space | |
2338 | 585 |
2394 | 586 ifgt Level-1 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
587 * Switch to system process descriptor |
2394 | 588 L0238 pshs d Preserve D |
589 ldd <D.Proc Get current process dsc. ptr | |
590 std 4,s Preserve on stack | |
591 ldd <D.SysPrc Get system process dsc. ptr | |
592 std <D.Proc Make it the current process | |
593 puls d,pc Restore D & return | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
594 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
595 * Switch back to current process |
2394 | 596 L0244 pshs d Preserve D |
597 ldd 4,s Get current process ptr | |
598 std <D.Proc Make it the current process | |
599 puls d,pc Restore D & return | |
600 endc | |
2324 | 601 |
2394 | 602 * Got a device descriptor, put into device table & save netdev # into static |
603 L0BAB | |
604 lda M$PORT+2,u get MSB of port byte of newly linked /N? descriptor | |
605 ldy 3,s get path descriptor pointer | |
606 ldx PD.DEV,y get pointer to device table | |
607 stu V$DESC,x save pointer to descriptor into it | |
608 ldu 1,s get pointer to /N descriptor | |
609 os9 F$UnLink unlink it from system map | |
610 ldu 5,s get static mem pointer | |
611 sta V.PORT+1,u | |
612 leas 7,s purge stack | |
613 * Load Y with address of descriptor and U with address of memory area | |
614 ldy V$DESC,x | |
615 pshs x,y,u | |
616 lbsr Init call Init to setup dw statics | |
617 puls x,y,u,pc | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
618 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
619 emod |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
620 eom equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
621 end |