Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/scdwn.asm @ 2730:6bd6e348665d
Working on cloned default branch, pulled 2012/11/03
user: gheskett@wdtv.com
branch 'default'
changed ChangeLog
changed ReadMe
changed defs/rbf.d
changed defs/rbsuper.d
changed defs/scsi.d
changed level1/atari/cmds/fuji.asm
changed level1/coco/modules/makefile
changed level1/modules/boot_scsi.asm
changed level1/modules/superdesc.asm
changed level2/coco3/bootfiles/makefile
changed level2/coco3/modules/makefile
changed level2/coco3_6309/bootfiles/makefile
changed level2/modules/joydrv_6551L.asm
changed rules.mak
author | gheskett@wdtv.com |
---|---|
date | Sat, 10 Nov 2012 11:55:48 -0500 |
parents | 07cc32e3d96f |
children |
rev | line source |
---|---|
2324 | 1 ******************************************************************** |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
2 * scdwn - DriveWire Network Driver |
2324 | 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!) |
2542 | 48 * |
49 * 2010/05/28 Aaron Wolfe | |
50 * Added FASTSERWRITE support | |
51 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
52 nam scdwn |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
53 ttl DriveWire Network Driver |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
54 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
55 ifp1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
56 use defsfile |
2624 | 57 use drivewire.d |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
58 endc |
2324 | 59 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
60 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
|
61 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
|
62 rev set $00 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
63 edition set 2 |
2324 | 64 |
65 * 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
|
66 mod eom,name,tylg,atrv,start,SCFDrvMemSz |
2324 | 67 |
68 * module info | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
69 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
|
70 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
|
71 fcb edition ;driver edition |
2324 | 72 |
73 * dispatch calls | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
74 start equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
75 lbra Init |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
76 lbra Read |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
77 lbra Write |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
78 lbra GetStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
79 lbra SetStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
80 |
2324 | 81 *********************************************************************** |
82 * Term | |
83 * | |
84 * shut down the driver. | |
85 * should close only the correct port, tell server to close the port, | |
86 * and remove irq handler when no ports are left | |
87 * | |
88 * Entry: | |
89 * U = address of device memory area | |
90 * | |
91 * Exit: | |
92 * CC = carry set on error | |
93 * 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
|
94 Term equ * |
2394 | 95 lda <V.PORT+1,u get our port # |
96 bmi termbye if this is wildcard, skip TERM | |
97 pshs a port # on stack | |
98 * 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
|
99 ifgt Level-1 |
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 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
102 ldx >D.DWStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
103 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
104 beq tell |
2394 | 105 * cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax |
106 * leax DW.StatTbl,x | |
107 clr a,x clear out | |
2324 | 108 |
2394 | 109 * tell server |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
110 tell |
2394 | 111 lda #OP_SERTERM load command |
112 pshs a command store on stack | |
113 leax ,s point X to stack | |
114 ldy #2 2 bytes to send | |
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 pshs u |
2324 | 117 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
118 ifgt Level-1 |
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 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
121 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
122 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
123 beq nosub |
2394 | 124 jsr 6,u call DWrite |
2324 | 125 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
126 nosub |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
127 puls u |
2394 | 128 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
|
129 termbye clrb |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
130 rts |
2324 | 131 |
132 *********************************************************************** | |
133 * Init | |
134 * | |
135 * Entry: | |
136 * Y = address of device descriptor | |
137 * U = address of device memory area | |
138 * | |
139 * Exit: | |
140 * CC = carry set on error | |
141 * B = error code | |
142 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
143 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
144 Init equ * |
2324 | 145 |
146 ; link to subroutine module | |
147 ; 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
|
148 ifgt Level-1 |
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 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
151 ldx >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
152 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
153 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
|
154 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
155 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
|
156 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
157 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
158 ldx <D.Proc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
159 pshs x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
160 ldx <D.SysPrc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
161 stx <D.Proc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
162 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
163 clra |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
164 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
165 leax dw3name,pcr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
166 os9 F$Link |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
167 ifgt Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
168 puls x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
169 stx <D.Proc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
170 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
171 bcs InitEx2 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
172 ifgt Level-1 |
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 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
175 sty >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
176 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
177 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
|
178 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
179 puls u ; restore u |
2324 | 180 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
181 already |
2324 | 182 ; 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
|
183 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
|
184 * if /N wildcard, skip advertising via SERINIT |
2394 | 185 bmi initEx |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
186 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
|
187 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
|
188 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
|
189 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
|
190 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
191 pshs u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
192 ifgt Level-1 |
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 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
195 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
196 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
197 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
|
198 puls u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
199 |
2324 | 200 ; 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
|
201 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
|
202 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
|
203 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
|
204 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
|
205 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
|
206 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
|
207 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
|
208 stx RxBufEnd,u ; save Rx buffer end address |
2324 | 209 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
210 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
|
211 puls b |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
212 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
|
213 ifgt Level-1 |
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 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
216 ldx >D.DWStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
217 endc |
2324 | 218 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax |
219 ; 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
|
220 sta b,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
221 InitEx equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
222 rts |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
223 InitEx2 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
224 puls u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
225 rts |
2324 | 226 |
227 ; drivewire info | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
228 dw3name fcs /dw3/ |
2324 | 229 |
230 | |
231 ***************************************************************************** | |
232 * Write | |
233 * | |
234 * Entry: | |
235 * A = character to write | |
236 * Y = address of path descriptor | |
237 * U = address of device memory area | |
238 * | |
239 * Exit: | |
240 * CC = carry set on error | |
241 * B = error code | |
242 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
243 Write equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
244 pshs a ; character to send on stack |
2542 | 245 lda <V.PORT+1,u ; port number into a |
246 adda #128 ; add base of command into A | |
247 pshs a | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
248 leax ,s |
2542 | 249 ldy #$0002 ; 3 bytes to send.. ugh. need WRITEM (data mode) |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
250 ifgt Level-1 |
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 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
253 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
254 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
255 jsr 6,u |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
256 WriteOK clrb |
2542 | 257 WriteExit puls x,pc ; clean stack, return |
2324 | 258 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
259 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
260 NotReady comb |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
261 ldb #E$NotRdy |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
262 rts |
2333 | 263 |
2324 | 264 ************************************************************************************* |
265 * Read | |
266 * | |
267 * Entry: | |
268 * Y = address of path descriptor | |
269 * U = address of device memory area | |
270 * | |
271 * Exit: | |
272 * A = character read | |
273 * CC = carry set on error | |
274 * B = error code | |
275 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
276 Read equ * |
2333 | 277 * Check to see if there is a signal-on-data-ready set for this path. |
278 * 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
|
279 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
|
280 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
|
281 pshs cc,dp ; save IRQ/Carry status, system DP |
2324 | 282 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
283 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
|
284 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
285 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
|
286 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
|
287 |
2324 | 288 ; 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
|
289 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
|
290 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
|
291 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
292 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
|
293 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
|
294 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
295 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
|
296 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
|
297 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
|
298 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
|
299 |
2324 | 300 ; 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
|
301 puls cc,dp,pc ; recover IRQ/Carry status, system DP, return with character in A |
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 ReadSlp equ * |
2324 | 304 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
305 ifeq Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
306 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
|
307 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
|
308 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
|
309 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
310 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
|
311 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
|
312 clrb |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
313 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
|
314 ifne H6309 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
315 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
|
316 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
317 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
|
318 orb #Suspend |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
319 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
|
320 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
321 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
|
322 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
323 |
2324 | 324 ; 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
|
325 |
2324 | 326 ; 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
|
327 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
|
328 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
|
329 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
|
330 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
|
331 bls ErrExit ; yes, go do it... |
2324 | 332 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
333 ChkState equ * |
2324 | 334 ; 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
|
335 ifne H6309 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
336 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
|
337 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
338 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
|
339 bitb #Condem |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
340 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
341 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
|
342 |
2324 | 343 ; 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
|
344 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
|
345 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
|
346 bra ReadSlp ; false alarm, go back to sleep |
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 PrAbtErr ldb #E$PrcAbt ; set error code |
2324 | 349 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
350 ErrExit equ * |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
351 ifne H6309 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
352 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
|
353 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
354 lda ,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
355 ora #Carry |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
356 sta ,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
357 endc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
358 puls cc,dp,pc ; restore CC, system DP, return |
2324 | 359 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
360 ifeq Level-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
361 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
|
362 bra TimedSlp |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
363 endc |
2324 | 364 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
365 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
|
366 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
|
367 os9 F$Sleep |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
368 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
|
369 rts ; return |
2324 | 370 |
371 | |
372 ********************************************************************** | |
373 * GetStat - heavily borrowed from sc6551 | |
374 * | |
375 * Entry: | |
376 * A = function code | |
377 * Y = address of path descriptor | |
378 * U = address of device memory area | |
379 * | |
380 * Exit: | |
381 * CC = carry set on error | |
382 * B = error code | |
383 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
384 GetStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
385 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
|
386 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
|
387 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
388 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
|
389 cmpa #SS.EOF |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
390 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
|
391 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
392 cmpa #SS.Ready |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
393 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
|
394 |
2324 | 395 ; SS.Ready |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
396 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
|
397 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
|
398 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
|
399 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
|
400 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
401 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
|
402 bra ErrExit ; return error code |
2324 | 403 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
404 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
|
405 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
|
406 |
2324 | 407 ; 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
|
408 Advertise |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
409 ldb #OP_SERGETSTAT |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
410 bsr SendStat |
2324 | 411 |
412 ; 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
|
413 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
|
414 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
|
415 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
|
416 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
|
417 clra |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
418 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
|
419 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
|
420 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
|
421 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
|
422 puls cc,dp,pc ; restore Carry status, system DP, return |
2324 | 423 |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
424 GetComSt cmpa #SS.ComSt |
2588 | 425 bne GetKySns ; no, we have no more answers, report error |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
426 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
|
427 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
|
428 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
|
429 puls cc,dp,pc ; restore Carry status, system DP, return |
2324 | 430 |
2588 | 431 GetKySns |
432 cmpa #SS.KySns | |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
433 bne GetSSMntr ; no, we have no more answers, report error |
2588 | 434 * Get key sense byte from server and return to caller |
2662 | 435 pshs a,x,u |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
436 leax ,s |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
437 ldy #$001 |
2589 | 438 ifgt Level-1 |
439 ldu <D.DWSubAddr | |
440 else | |
441 ldu >D.DWSubAddr | |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
442 jsr DW$Read,u |
2589 | 443 endc |
2662 | 444 puls a,x,u |
2589 | 445 sta R$A,x |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
446 puls cc,dp,pc ; restore Carry status, system DP, return |
2588 | 447 |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
448 GetSSMntr cmpa #SS.Montr |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
449 bne UnSvcErr ; no, we have no more answers, report error |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
450 lda #$01 |
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
451 sta R$A,x |
2588 | 452 puls cc,dp,pc ; restore Carry status, system DP, return |
453 | |
2324 | 454 * Advertise Stat Code to server |
455 * A = Function Code | |
456 * 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
|
457 SendStat |
2324 | 458 ; 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
|
459 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
|
460 leas -3,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
461 leax ,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
462 stb ,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
463 sta 2,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
464 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
|
465 stb 1,x |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
466 ldy #$0003 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
467 ifgt LEVEL-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
468 ldu <D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
469 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
470 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
471 endc |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
472 jsr DW$Write,u |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
473 leas 3,s |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
474 puls a,y,x,u,pc |
2324 | 475 |
476 ************************************************************************* | |
477 * SetStat | |
478 * | |
479 * Entry: | |
480 * A = function code | |
481 * Y = address of path descriptor | |
482 * U = address of device memory area | |
483 * | |
484 * Exit: | |
485 * CC = carry set on error | |
486 * B = error code | |
487 * | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
488 SetStat |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
489 cmpa #SS.Open |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
490 bne isitcomst |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
491 bsr open |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
492 bcs ssbye |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
493 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
|
494 bra SendStat |
2394 | 495 isitcomst |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
496 ldb #OP_SERSETSTAT |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
497 bsr SendStat |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
498 cmpa #SS.ComSt |
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
499 beq comst |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
500 cmpa #SS.Close |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
501 beq ex |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
502 cmpa #SS.SSig |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
503 beq ssig |
2662 | 504 cmpa #SS.Montr |
505 beq ex | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
506 cmpa #SS.Relea |
2394 | 507 bne donebad |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
508 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
|
509 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
|
510 bne ex |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
511 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
|
512 ex rts |
2588 | 513 sskysns |
514 rts | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
515 ssig pshs cc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
516 orcc #IntMasks |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
517 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
|
518 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
|
519 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
|
520 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
|
521 beq ssigsetup ; branch if no data in buffer |
2333 | 522 * 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
|
523 os9 F$Send |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
524 puls cc,pc |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
525 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
|
526 puls cc,pc |
2333 | 527 |
2394 | 528 donebad comb |
529 ldb #E$UnkSvc | |
530 rts | |
531 | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
532 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
|
533 ldy #OPTCNT |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
534 ifgt LEVEL-1 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
535 ldu <D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
536 else |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
537 ldu >D.DWSubAddr |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
538 endc |
2661
9e9ed6d6b4c2
Updated so that scdwn handles SS.Montr
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
539 jsr DW$Write,u |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
540 clrb |
2385
cd29118ee172
Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents:
2384
diff
changeset
|
541 ssbye rts |
2324 | 542 |
2339
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
543 * SS.Open processor |
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
544 * 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
|
545 * 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
|
546 * Y=Path descriptor pointer |
2394 | 547 open tst <V.PORT+1,u check if this is $FFFF (wildcard) |
548 bpl ssbye if not, we have nothing to do | |
549 pshs u,y preserve registers | |
550 ldx PD.DEV,y get pointer to device table entry | |
551 ldx V$DESC,x get pointer to /N descriptor | |
552 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
|
553 * start at /N1 |
2394 | 554 ldb #1 |
555 L0B58 equ * | |
556 ifgt Level-1 | |
557 ldx <D.DWStat | |
558 else | |
559 ldx >D.DWStat | |
560 endc | |
2339
f9ff11331a2f
Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents:
2338
diff
changeset
|
561 ; 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
|
562 ; leax DW.StatTbl,x |
2394 | 563 next cmpb #DW.StatCnt |
564 bge opexer | |
565 tst b,x | |
566 beq found | |
567 incb | |
568 bra next | |
569 opexer comb set carry | |
570 ldb #E$MNF get module not found error | |
571 puls x,y,u,pc purge stack and return | |
572 | |
2383
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
573 * Found a free spot |
2394 | 574 found pshs b save # of free entry |
575 leas -5,s | |
576 leay ,s | |
577 ldb #'N get netdev name prefix | |
578 stb ,y+ put it in buffer | |
579 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
|
580 * 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
|
581 |
2394 | 582 ifne H6309 |
2395 | 583 clra |
2394 | 584 divd #10 divide it by 10 |
585 else | |
586 lda #-1 | |
587 L0B87b inca | |
588 subb #10 | |
589 bcc L0B87b | |
590 addb #10 | |
591 exg a,b | |
592 cmpb #0 | |
593 endc | |
594 beq L0B87 if answer is 0 there is only 1 digit, skip ahead | |
595 orb #$30 make first digit ASCII | |
596 stb ,y+ put it in buffer | |
597 L0B87 ora #$B0 make remainder ASCII with high bit set | |
598 sta ,y+ put it in buffer | |
599 L0B92 leas -2,s make a buffer for process decriptor pointer | |
600 ifgt Level-1 | |
601 lbsr L0238 switch to system process descriptor | |
602 endc | |
603 leax 2,s Point to calculated dsc. name | |
604 lda #Devic+Objct get module type | |
605 os9 F$Link try & link it | |
606 ifgt Level-1 | |
607 lbsr L0244 switch back to current process | |
608 endc | |
609 leas 7,s purge stack | |
610 bcc L0BAB it's linked, skip ahead | |
611 L0BA7 puls b get original number | |
612 incb | |
613 bra L0B58 go find another free space | |
2338 | 614 |
2394 | 615 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
|
616 * Switch to system process descriptor |
2394 | 617 L0238 pshs d Preserve D |
618 ldd <D.Proc Get current process dsc. ptr | |
619 std 4,s Preserve on stack | |
620 ldd <D.SysPrc Get system process dsc. ptr | |
621 std <D.Proc Make it the current process | |
622 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
|
623 |
b399116a3b5f
Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents:
2372
diff
changeset
|
624 * Switch back to current process |
2394 | 625 L0244 pshs d Preserve D |
626 ldd 4,s Get current process ptr | |
627 std <D.Proc Make it the current process | |
628 puls d,pc Restore D & return | |
629 endc | |
2324 | 630 |
2394 | 631 * Got a device descriptor, put into device table & save netdev # into static |
632 L0BAB | |
633 lda M$PORT+2,u get MSB of port byte of newly linked /N? descriptor | |
634 ldy 3,s get path descriptor pointer | |
635 ldx PD.DEV,y get pointer to device table | |
636 stu V$DESC,x save pointer to descriptor into it | |
637 ldu 1,s get pointer to /N descriptor | |
638 os9 F$UnLink unlink it from system map | |
639 ldu 5,s get static mem pointer | |
640 sta V.PORT+1,u | |
641 leas 7,s purge stack | |
642 * Load Y with address of descriptor and U with address of memory area | |
643 ldy V$DESC,x | |
644 pshs x,y,u | |
645 lbsr Init call Init to setup dw statics | |
646 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
|
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 |