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
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 ********************************************************************
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
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!)
2542
28bfbf753ea9 serfastwrite support
aaronwolfe
parents: 2396
diff changeset
48 *
28bfbf753ea9 serfastwrite support
aaronwolfe
parents: 2396
diff changeset
49 * 2010/05/28 Aaron Wolfe
28bfbf753ea9 serfastwrite support
aaronwolfe
parents: 2396
diff changeset
50 * Added FASTSERWRITE support
28bfbf753ea9 serfastwrite support
aaronwolfe
parents: 2396
diff changeset
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
b8c7b7fbf3c9 Major changes:
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2589
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
64
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
67
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
72
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
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 * Term
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
83 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
84 * shut down the driver.
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
85 * 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
86 * and remove irq handler when no ports are left
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
87 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
88 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
89 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
90 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
91 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
92 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
95 lda <V.PORT+1,u get our port #
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
96 bmi termbye if this is wildcard, skip TERM
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
97 pshs a port # on stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
105 * cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
106 * leax DW.StatTbl,x
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
107 clr a,x clear out
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
108
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
111 lda #OP_SERTERM load command
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
112 pshs a command store on stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
113 leax ,s point X to stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
114 ldy #2 2 bytes to send
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 pshs u
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
124 jsr 6,u call DWrite
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
131
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 * Init
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
134 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
135 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
136 * Y = address of device descriptor
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
137 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
138 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
139 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
140 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
141 * B = error code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
145
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
146 ; link to subroutine module
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
218 ; 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
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
226
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
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
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 * Write
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
233 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
234 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
235 * A = character to write
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
236 * Y = address of path descriptor
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
237 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
238 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
239 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
240 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
241 * B = error code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
28bfbf753ea9 serfastwrite support
aaronwolfe
parents: 2396
diff changeset
245 lda <V.PORT+1,u ; port number into a
28bfbf753ea9 serfastwrite support
aaronwolfe
parents: 2396
diff changeset
246 adda #128 ; add base of command into A
28bfbf753ea9 serfastwrite support
aaronwolfe
parents: 2396
diff changeset
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
28bfbf753ea9 serfastwrite support
aaronwolfe
parents: 2396
diff changeset
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
28bfbf753ea9 serfastwrite support
aaronwolfe
parents: 2396
diff changeset
257 WriteExit puls x,pc ; clean stack, return
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
080b3670b08f Updated to handle SSig on data ready
boisy
parents: 2324
diff changeset
263
2324
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 * Read
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
266 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
267 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
268 * Y = address of path descriptor
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
269 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
270 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
271 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
272 * A = character read
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
273 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
274 * B = error code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
080b3670b08f Updated to handle SSig on data ready
boisy
parents: 2324
diff changeset
277 * 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
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
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 ReadSlp equ *
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
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 PrAbtErr ldb #E$PrcAbt ; set error code
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
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
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 * GetStat - heavily borrowed from sc6551
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
374 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
375 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
376 * A = function code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
377 * Y = address of path descriptor
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
378 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
379 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
380 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
381 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
382 * B = error code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
411
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
d5a5b6b89fb1 Added placeholder for SS.KySns GetStat.
boisy
parents: 2542
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
430
2588
d5a5b6b89fb1 Added placeholder for SS.KySns GetStat.
boisy
parents: 2542
diff changeset
431 GetKySns
d5a5b6b89fb1 Added placeholder for SS.KySns GetStat.
boisy
parents: 2542
diff changeset
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
d5a5b6b89fb1 Added placeholder for SS.KySns GetStat.
boisy
parents: 2542
diff changeset
434 * Get key sense byte from server and return to caller
2662
07cc32e3d96f More fixes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2661
diff changeset
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
e134044fd755 Added code to handle SS.KySns (untested!)
boisy
parents: 2588
diff changeset
438 ifgt Level-1
e134044fd755 Added code to handle SS.KySns (untested!)
boisy
parents: 2588
diff changeset
439 ldu <D.DWSubAddr
e134044fd755 Added code to handle SS.KySns (untested!)
boisy
parents: 2588
diff changeset
440 else
e134044fd755 Added code to handle SS.KySns (untested!)
boisy
parents: 2588
diff changeset
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
e134044fd755 Added code to handle SS.KySns (untested!)
boisy
parents: 2588
diff changeset
443 endc
2662
07cc32e3d96f More fixes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2661
diff changeset
444 puls a,x,u
2589
e134044fd755 Added code to handle SS.KySns (untested!)
boisy
parents: 2588
diff changeset
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
d5a5b6b89fb1 Added placeholder for SS.KySns GetStat.
boisy
parents: 2542
diff changeset
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
d5a5b6b89fb1 Added placeholder for SS.KySns GetStat.
boisy
parents: 2542
diff changeset
452 puls cc,dp,pc ; restore Carry status, system DP, return
d5a5b6b89fb1 Added placeholder for SS.KySns GetStat.
boisy
parents: 2542
diff changeset
453
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
454 * Advertise Stat Code to server
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 * 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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
475
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
476 *************************************************************************
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
477 * SetStat
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
478 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
479 * Entry:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
480 * A = function code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
481 * Y = address of path descriptor
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
482 * U = address of device memory area
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
483 *
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
484 * Exit:
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
485 * CC = carry set on error
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
486 * B = error code
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
07cc32e3d96f More fixes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2661
diff changeset
504 cmpa #SS.Montr
07cc32e3d96f More fixes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2661
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
d5a5b6b89fb1 Added placeholder for SS.KySns GetStat.
boisy
parents: 2542
diff changeset
513 sskysns
d5a5b6b89fb1 Added placeholder for SS.KySns GetStat.
boisy
parents: 2542
diff changeset
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
080b3670b08f Updated to handle SSig on data ready
boisy
parents: 2324
diff changeset
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
080b3670b08f Updated to handle SSig on data ready
boisy
parents: 2324
diff changeset
527
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
528 donebad comb
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
529 ldb #E$UnkSvc
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
530 rts
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
547 open tst <V.PORT+1,u check if this is $FFFF (wildcard)
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
548 bpl ssbye if not, we have nothing to do
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
549 pshs u,y preserve registers
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
550 ldx PD.DEV,y get pointer to device table entry
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
551 ldx V$DESC,x get pointer to /N descriptor
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
554 ldb #1
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
555 L0B58 equ *
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
556 ifgt Level-1
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
557 ldx <D.DWStat
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
558 else
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
559 ldx >D.DWStat
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
563 next cmpb #DW.StatCnt
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
564 bge opexer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
565 tst b,x
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
566 beq found
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
567 incb
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
568 bra next
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
569 opexer comb set carry
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
570 ldb #E$MNF get module not found error
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
571 puls x,y,u,pc purge stack and return
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
574 found pshs b save # of free entry
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
575 leas -5,s
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
576 leay ,s
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
577 ldb #'N get netdev name prefix
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
578 stb ,y+ put it in buffer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
582 ifne H6309
2395
59f1d5ca0d0a Fixed error on Level 2 opening /N-1
boisy
parents: 2394
diff changeset
583 clra
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
584 divd #10 divide it by 10
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
585 else
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
586 lda #-1
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
587 L0B87b inca
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
588 subb #10
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
589 bcc L0B87b
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
590 addb #10
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
591 exg a,b
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
592 cmpb #0
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
593 endc
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
594 beq L0B87 if answer is 0 there is only 1 digit, skip ahead
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
595 orb #$30 make first digit ASCII
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
596 stb ,y+ put it in buffer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
597 L0B87 ora #$B0 make remainder ASCII with high bit set
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
598 sta ,y+ put it in buffer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
599 L0B92 leas -2,s make a buffer for process decriptor pointer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
600 ifgt Level-1
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
601 lbsr L0238 switch to system process descriptor
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
602 endc
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
603 leax 2,s Point to calculated dsc. name
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
604 lda #Devic+Objct get module type
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
605 os9 F$Link try & link it
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
606 ifgt Level-1
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
607 lbsr L0244 switch back to current process
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
608 endc
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
609 leas 7,s purge stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
610 bcc L0BAB it's linked, skip ahead
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
611 L0BA7 puls b get original number
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
612 incb
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
613 bra L0B58 go find another free space
2338
a640af6b4582 More updates
boisy
parents: 2337
diff changeset
614
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
617 L0238 pshs d Preserve D
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
618 ldd <D.Proc Get current process dsc. ptr
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
619 std 4,s Preserve on stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
620 ldd <D.SysPrc Get system process dsc. ptr
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
621 std <D.Proc Make it the current process
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
625 L0244 pshs d Preserve D
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
626 ldd 4,s Get current process ptr
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
627 std <D.Proc Make it the current process
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
628 puls d,pc Restore D & return
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
629 endc
2324
ccd33b48321a Renamed scdwt to scdwn, t/u to n descriptors
boisy
parents:
diff changeset
630
2394
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
631 * Got a device descriptor, put into device table & save netdev # into static
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
632 L0BAB
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
633 lda M$PORT+2,u get MSB of port byte of newly linked /N? descriptor
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
634 ldy 3,s get path descriptor pointer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
635 ldx PD.DEV,y get pointer to device table
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
636 stu V$DESC,x save pointer to descriptor into it
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
637 ldu 1,s get pointer to /N descriptor
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
638 os9 F$UnLink unlink it from system map
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
639 ldu 5,s get static mem pointer
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
640 sta V.PORT+1,u
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
641 leas 7,s purge stack
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
642 * Load Y with address of descriptor and U with address of memory area
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
643 ldy V$DESC,x
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
644 pshs x,y,u
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
645 lbsr Init call Init to setup dw statics
2244c43efe0e Updated
boisy
parents: 2386
diff changeset
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