Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/scdwn.asm @ 2393:08b60a5995d0
More optimizations for Level 1
author | boisy |
---|---|
date | Sun, 24 Jan 2010 04:19:46 +0000 |
parents | e454c42a134b |
children | 2244c43efe0e |
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 * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
93 lda <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
|
94 bmi termbye |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
95 pshs a ;port # on stack |
2324 | 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 |
2324 | 103 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax |
104 ; 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
|
105 clr a,x ;clear out |
2324 | 106 |
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 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
109 lda #OP_SERTERM ; load command |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
110 pshs a ; command store on stack |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
111 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
|
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 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
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 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
126 leas 2,s ; clean 3 DWsub args from stack |
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 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
183 bmi initEx |
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 |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
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 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
480 lbne donebad |
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 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
499 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
|
500 ldy #OPTCNT |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
501 ifgt LEVEL-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
502 ldu <D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
503 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
504 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
505 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
506 jsr 6,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
507 clrb |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
508 ssbye rts |
2324 | 509 |
2339
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
510 * SS.Open processor |
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
511 * 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
|
512 * 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
|
513 * Y=Path descriptor pointer |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
514 open pshs u,y preserve registers |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
515 tst <V.PORT+1,u check if this is $FFFF (wildcard) |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
516 lbpl L0BCD |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
517 ldx PD.DEV,y get pointer to device table entry |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
518 ldx V$DESC,x get pointer to /N descriptor |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
519 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
|
520 * start at /N1 |
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
521 ldb #1 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
522 L0B58 equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
523 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
524 ldx <D.DWStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
525 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
526 ldx >D.DWStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
527 endc |
2339
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
528 ; 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
|
529 ; leax DW.StatTbl,x |
2386 | 530 next cmpb #DW.StatCnt |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
531 bge opexer |
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
532 tst b,x |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
533 beq found |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
534 incb |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
535 bra next |
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
536 opexer comb set carry |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
537 ldb #E$MNF get module not found error |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
538 puls x,y,u,pc purge stack and return |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
539 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
540 * Found a free spot |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
541 found pshs b save # of free entry |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
542 leas -5,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
543 leay ,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
544 ldb #'N get netdev name prefix |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
545 stb ,y+ put it in buffer |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
546 ldb 5,s get netdev # that was free |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
547 * 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
|
548 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
549 IFNE H6309 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
550 divd #10 divide it by 10 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
551 ELSE |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
552 lda #-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
553 L0B87b inca |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
554 subb #10 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
555 bcc L0B87b |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
556 addb #10 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
557 exg a,b |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
558 cmpb #0 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
559 ENDC |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
560 beq L0B87 if answer is 0 there is only 1 digit, skip ahead |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
561 orb #$30 make first digit ASCII |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
562 stb ,y+ put it in buffer |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
563 L0B87 ora #$B0 make remainder ASCII 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
|
564 sta ,y+ put it in buffer |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
565 L0B92 leas -2,s make a buffer for process decriptor pointer |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
566 IFGT Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
567 lbsr L0238 switch to system process descriptor |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
568 ENDC |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
569 leax 2,s Point to calculated dsc. name |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
570 lda #Devic+Objct get module type |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
571 os9 F$Link try & link it |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
572 IFGT Level-1 |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
573 pshs cc |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
574 lbsr L0244 switch back to current process |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
575 puls cc |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
576 ENDC |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
577 leas 7,s purge stack |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
578 bcc L0BAB it's linked, skip ahead |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
579 L0BA7 puls b get original number |
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
580 incb |
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
581 bra L0B58 go find another free space |
2338 | 582 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
583 IFGT Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
584 * Switch to system process descriptor |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
585 L0238 pshs d Preserve D |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
586 ldd <D.Proc Get current process dsc. ptr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
587 std 4,s Preserve on stack |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
588 ldd <D.SysPrc Get system process dsc. ptr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
589 std <D.Proc Make it the current process |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
590 puls d,pc Restore D & return |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
591 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
592 * Switch back to current process |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
593 L0244 pshs d Preserve D |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
594 ldd 4,s Get current process ptr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
595 std <D.Proc Make it the current process |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
596 puls d,pc Restore D & return |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
597 ENDC |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
598 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
599 * Got a device descriptor, put into device table & save netdev # into static |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
600 L0BAB |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
601 lda M$PORT+2,u get MSB of port byte of newly linked /N? descriptor |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
602 ldy 3,s get path descriptor pointer |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
603 ldx PD.DEV,y get pointer to device table |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
604 stu V$DESC,x save pointer to descriptor into it |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
605 ldu 1,s get pointer to descriptor |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
606 os9 F$UnLink unlink it from system map |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
607 ldu 5,s get static mem pointer |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
608 sta 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
|
609 leas 7,s purge stack |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
610 * Load Y with address of descriptor and U with address of memory area |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
611 ldy V$DESC,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
612 pshs x,y,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
613 lbsr Init |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
614 puls x,y,u,pc |
2338 | 615 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
616 L0BCD clrb No error |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
617 puls y,u,pc |
2324 | 618 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
619 ifeq 1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
620 SetPortSig |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
621 cmpa #SS.PortSig |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
622 bne SetPortRel |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
623 lda PD.CPR,y current process ID |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
624 ldb R$X+1,x LSB of [X] is signal code |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
625 std <PortSigPID |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
626 clrb |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
627 rts |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
628 SetPortRel |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
629 cmpa #SS.PortRel |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
630 bne donebad |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
631 leax PortSigPID,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
632 bsr ReleaSig |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
633 clrb |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
634 rts |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
635 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
636 donebad comb |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
637 ldb #E$UnkSvc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
638 rts |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
639 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
640 ReleaSig pshs cc save IRQ enable status |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
641 orcc #IntMasks disable IRQs while releasing signal |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
642 lda PD.CPR,y get current process ID |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
643 suba ,x same as signal process ID? |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
644 bne NoReleas no, go return... |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
645 sta ,x clear this signal's process ID |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
646 NoReleas puls cc,pc restore IRQ enable status, return |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
647 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
648 emod |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
649 eom equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
650 end |