annotate level1/modules/scdwn.asm @ 2402:04755ee002ba

Updated
author boisy
date Sun, 24 Jan 2010 17:32:49 +0000
parents 8339cef818b2
children 28bfbf753ea9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
1 ********************************************************************
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
2 * scdwn - CoCo DriveWire Network Driver
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
3 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
4 * $Id$
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
5 *
2384
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
6 * How this wildcard /N stuff works:
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
7 * A process interested in obtaining a path to a network device
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
8 * can open any /Nx descriptor but it may be in use by another process.
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
9 * The safest way to obtain a new network device is to open the wildcard
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
10 * descriptor /N. This works similarly to the way /W works in the CoCo 3
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
11 * VTIO driver.
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
12 *
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
13 * When /N is open, the INIT routine is called but most of it is bypassed
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
14 * because it detects the wildcard device (which has an address of $FFFF).
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
15 *
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
16 * The SS.Open I$SetStat entry point is called. That routine also detects
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
17 * the wildcard is used, so the hunt is on for the next available /Nx
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
18 * descriptor (it does this by checking the DW static storage for each /Nx
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
19 * in the DW static storage page). If it finds a free page, it notes the
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
20 * offset as a number, then builds a descriptor name (ex: /N4) and then
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
21 * F$Links to it. It then takes the descriptor module address and sticks it
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
22 * in the device table entry for /N. It also takes the V.PORT address and sticks
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
23 * it in the static storage memory allocated for /N.
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
24 * Afer that, SS.Open does something really sneaky: it branches into the
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
25 * Init routine which detects via the static storage that this is not a /N
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
26 * descriptor but a /N4 descriptor. Init then sends the SERINIT and initializes
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
27 * the DW static storage for /N4. Control is returned to the SS.Open code which
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
28 * then advertises the SS.Open to the server.
67b11fbf5253 Updated comments
boisy
parents: 2383
diff changeset
29 *
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
30 * Edt/Rev YYYY/MM/DD Modified by
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
31 * Comment
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
32 * ------------------------------------------------------------------
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
33 * 1 2009/11/30 Aaron Wolfe
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
34 * Started
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
35 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
36 * 2009/12/28 Boisy G. Pitre
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
37 * Modified so that F$STime is called if we get an error on calling
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
38 * F$VIRQ (which means the clock module has not be initialized)
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
39 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
40 * 2009/12/31 Boisy G. Pitre
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
41 * Fixed crash in Init where F$Link failure would not clean up stack
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
42 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
43 * 2010/01/03 Boisy G. Pitre
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
56
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
62
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
65
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
70
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
79 ***********************************************************************
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
80 * Term
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
81 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
82 * shut down the driver.
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
83 * should close only the correct port, tell server to close the port,
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
84 * and remove irq handler when no ports are left
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
85 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
86 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
87 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
88 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
89 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
90 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
91 * B = error code
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
92 Term equ *
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
93 lda <V.PORT+1,u get our port #
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
94 bmi termbye if this is wildcard, skip TERM
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
95 pshs a port # on stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
96 * clear statics table entry
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
97 ifgt Level-1
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
98 ldx <D.DWStat
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
99 else
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
100 ldx >D.DWStat
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
101 endc
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
102 beq tell
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
103 * cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
104 * leax DW.StatTbl,x
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
105 clr a,x clear out
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
106
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
107 * tell server
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
108 tell
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
109 lda #OP_SERTERM load command
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
110 pshs a command store on stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
111 leax ,s point X to stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
112 ldy #2 2 bytes to send
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
115
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
116 ifgt Level-1
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
117 ldu <D.DWSubAddr
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
118 else
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
119 ldu >D.DWSubAddr
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
120 endc
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
121 beq nosub
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
122 jsr 6,u call DWrite
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
123
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
124 nosub
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
125 puls u
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
126 leas 2,s clean 3 DWsub args from stack
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
127 termbye clrb
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
128 rts
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
129
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
130 ***********************************************************************
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
131 * Init
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
132 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
133 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
134 * Y = address of device descriptor
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
135 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
136 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
137 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
138 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
139 * B = error code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
143
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
144 ; link to subroutine module
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
180 ; tell DW we have a new port opening (port mode already on stack)
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
181 ldb <V.PORT+1,u ; get our port #
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
182 * if /N wildcard, skip advertising via SERINIT
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
183 bmi initEx
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
184 lda #OP_SERINIT ; command
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
185 pshs d ; command + port # on stack
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
186 leax ,s ; point X to stack
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
187 ldy #2 ; # of bytes to send
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
188
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
189 pshs u
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
190 ifgt Level-1
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
191 ldu <D.DWSubAddr
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
192 else
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
193 ldu >D.DWSubAddr
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
194 endc
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
195 jsr 6,u ; call DWrite
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
196 puls u
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
197
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
216 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
224
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
227
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
228
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
229 *****************************************************************************
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
230 * Write
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
231 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
232 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
233 * A = character to write
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
234 * Y = address of path descriptor
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
235 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
236 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
237 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
238 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
239 * B = error code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
080b3670b08f Updated to handle SSig on data ready
boisy
parents: 2324
diff changeset
261
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
262 *************************************************************************************
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
263 * Read
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
264 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
265 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
266 * Y = address of path descriptor
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
267 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
268 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
269 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
270 * A = character read
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
271 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
272 * B = error code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
080b3670b08f Updated to handle SSig on data ready
boisy
parents: 2324
diff changeset
275 * Check to see if there is a signal-on-data-ready set for this path.
080b3670b08f Updated to handle SSig on data ready
boisy
parents: 2324
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
368
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
369
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
370 **********************************************************************
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
371 * GetStat - heavily borrowed from sc6551
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
372 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
373 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
374 * A = function code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
375 * Y = address of path descriptor
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
376 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
377 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
378 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
379 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
380 * B = error code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
409
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
428
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
429 * Advertise Stat Code to server
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
430 * A = Function Code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
450
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
451 *************************************************************************
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
452 * SetStat
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
453 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
454 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
455 * A = function code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
456 * Y = address of path descriptor
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
457 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
458 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
459 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
460 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
461 * B = error code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
462 *
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
463 SetStat
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
464 cmpa #SS.Open
2385
cd29118ee172 Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents: 2384
diff changeset
465 bne isitcomst
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
466 bsr open
2385
cd29118ee172 Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents: 2384
diff changeset
467 bcs ssbye
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
468 ldd #SS.Open*256+OP_SERSETSTAT
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
469 bra SendStat
2394
2244c43efe0e Updated
boisy
parents: 2386
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
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
480 bne donebad
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
481 relea lda PD.CPR,y get curr proc #
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
482 cmpa <SSigID,u same?
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
483 bne ex
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
484 clr <SSigID,u clear process id
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
485 ex rts
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
486 ssig pshs cc
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
487 orcc #IntMasks
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
488 lda PD.CPR,y ; get curr proc #
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
489 ldx PD.RGS,y
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
490 ldb R$X+1,x ; get user signal code
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
491 tst RxDatLen,u ; get Rx data length
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
492 beq ssigsetup ; branch if no data in buffer
2333
080b3670b08f Updated to handle SSig on data ready
boisy
parents: 2324
diff changeset
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
080b3670b08f Updated to handle SSig on data ready
boisy
parents: 2324
diff changeset
498
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
499 donebad comb
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
500 ldb #E$UnkSvc
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
501 rts
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
502
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
503 comst leax PD.OPT,y
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
504 ldy #OPTCNT
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
505 ifgt LEVEL-1
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
506 ldu <D.DWSubAddr
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
507 else
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
508 ldu >D.DWSubAddr
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
509 endc
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
510 jsr 6,u
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
511 clrb
2385
cd29118ee172 Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents: 2384
diff changeset
512 ssbye rts
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
513
2339
f9ff11331a2f Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents: 2338
diff changeset
514 * SS.Open processor
f9ff11331a2f Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents: 2338
diff changeset
515 * Entry: X=Register stack pointer
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
516 * U=Static memory pointer
2339
f9ff11331a2f Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents: 2338
diff changeset
517 * Y=Path descriptor pointer
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
518 open tst <V.PORT+1,u check if this is $FFFF (wildcard)
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
519 bpl ssbye if not, we have nothing to do
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
520 pshs u,y preserve registers
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
521 ldx PD.DEV,y get pointer to device table entry
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
522 ldx V$DESC,x get pointer to /N descriptor
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
523 pshs x save device descriptor pointer
2385
cd29118ee172 Fixed SCF to allow it to return if SS.Open errored out.
boisy
parents: 2384
diff changeset
524 * start at /N1
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
525 ldb #1
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
526 L0B58 equ *
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
527 ifgt Level-1
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
528 ldx <D.DWStat
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
529 else
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
530 ldx >D.DWStat
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
531 endc
2339
f9ff11331a2f Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents: 2338
diff changeset
532 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
f9ff11331a2f Changes made to scdwn now send 2 bytes at INIT... server should get mode
boisy
parents: 2338
diff changeset
533 ; leax DW.StatTbl,x
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
534 next cmpb #DW.StatCnt
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
535 bge opexer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
536 tst b,x
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
537 beq found
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
538 incb
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
539 bra next
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
540 opexer comb set carry
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
541 ldb #E$MNF get module not found error
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
542 puls x,y,u,pc purge stack and return
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
543
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
544 * Found a free spot
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
545 found pshs b save # of free entry
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
546 leas -5,s
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
547 leay ,s
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
548 ldb #'N get netdev name prefix
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
549 stb ,y+ put it in buffer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
550 ldb 5,s get netdev # that was free
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
551 * Convert netdev # in B to ASCII eqivalent with high bit set
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
552
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
553 ifne H6309
2395
59f1d5ca0d0a Fixed error on Level 2 opening /N-1
boisy
parents: 2394
diff changeset
554 clra
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
555 divd #10 divide it by 10
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
556 else
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
557 lda #-1
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
558 L0B87b inca
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
559 subb #10
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
560 bcc L0B87b
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
561 addb #10
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
562 exg a,b
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
563 cmpb #0
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
564 endc
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
565 beq L0B87 if answer is 0 there is only 1 digit, skip ahead
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
566 orb #$30 make first digit ASCII
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
567 stb ,y+ put it in buffer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
568 L0B87 ora #$B0 make remainder ASCII with high bit set
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
569 sta ,y+ put it in buffer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
570 L0B92 leas -2,s make a buffer for process decriptor pointer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
571 ifgt Level-1
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
572 lbsr L0238 switch to system process descriptor
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
573 endc
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
574 leax 2,s Point to calculated dsc. name
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
575 lda #Devic+Objct get module type
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
576 os9 F$Link try & link it
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
577 ifgt Level-1
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
578 lbsr L0244 switch back to current process
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
579 endc
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
580 leas 7,s purge stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
581 bcc L0BAB it's linked, skip ahead
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
582 L0BA7 puls b get original number
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
583 incb
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
584 bra L0B58 go find another free space
2338
a640af6b4582 More updates
boisy
parents: 2337
diff changeset
585
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
586 ifgt Level-1
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
587 * Switch to system process descriptor
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
588 L0238 pshs d Preserve D
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
589 ldd <D.Proc Get current process dsc. ptr
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
590 std 4,s Preserve on stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
591 ldd <D.SysPrc Get system process dsc. ptr
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
592 std <D.Proc Make it the current process
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
593 puls d,pc Restore D & return
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
594
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
595 * Switch back to current process
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
596 L0244 pshs d Preserve D
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
597 ldd 4,s Get current process ptr
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
598 std <D.Proc Make it the current process
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
599 puls d,pc Restore D & return
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
600 endc
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
601
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
602 * Got a device descriptor, put into device table & save netdev # into static
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
603 L0BAB
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
604 lda M$PORT+2,u get MSB of port byte of newly linked /N? descriptor
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
605 ldy 3,s get path descriptor pointer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
606 ldx PD.DEV,y get pointer to device table
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
607 stu V$DESC,x save pointer to descriptor into it
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
608 ldu 1,s get pointer to /N descriptor
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
609 os9 F$UnLink unlink it from system map
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
610 ldu 5,s get static mem pointer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
611 sta V.PORT+1,u
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
612 leas 7,s purge stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
613 * Load Y with address of descriptor and U with address of memory area
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
614 ldy V$DESC,x
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
615 pshs x,y,u
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
616 lbsr Init call Init to setup dw statics
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
617 puls x,y,u,pc
2383
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
618
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
619 emod
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
620 eom equ *
b399116a3b5f Now we have a /N descriptor... and the code in scdwn.asm to handle it.
boisy
parents: 2372
diff changeset
621 end