annotate level1/modules/scdwt.asm @ 2313:9e3038c39b01

clock2_dw3 now gets seconds (6 byte time packet) dw3.asm uses hard coded date instead of dtb so CRC won't go wild scdwt.asm no longer has date in since it's not needed
author boisy
date Sun, 03 Jan 2010 20:29:41 +0000
parents 7820a7317242
children bf6708acbda6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
1 ********************************************************************
2275
8452d3ceb811 Moved F$STime call into area where F$VIRQ fails
boisy
parents: 2274
diff changeset
2 * scdwt - CoCo DriveWire Virtual Serial Driver
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
3 *
2275
8452d3ceb811 Moved F$STime call into area where F$VIRQ fails
boisy
parents: 2274
diff changeset
4 * $Id$
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
5 *
2275
8452d3ceb811 Moved F$STime call into area where F$VIRQ fails
boisy
parents: 2274
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
8452d3ceb811 Moved F$STime call into area where F$VIRQ fails
boisy
parents: 2274
diff changeset
7 * Comment
8452d3ceb811 Moved F$STime call into area where F$VIRQ fails
boisy
parents: 2274
diff changeset
8 * ------------------------------------------------------------------
8452d3ceb811 Moved F$STime call into area where F$VIRQ fails
boisy
parents: 2274
diff changeset
9 * 1 2009/11/30 Aaron Wolfe
8452d3ceb811 Moved F$STime call into area where F$VIRQ fails
boisy
parents: 2274
diff changeset
10 * Started
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
11 *
2275
8452d3ceb811 Moved F$STime call into area where F$VIRQ fails
boisy
parents: 2274
diff changeset
12 * 2009/12/28 Boisy G. Pitre
8452d3ceb811 Moved F$STime call into area where F$VIRQ fails
boisy
parents: 2274
diff changeset
13 * Modified so that F$STime is called if we get an error on calling
8452d3ceb811 Moved F$STime call into area where F$VIRQ fails
boisy
parents: 2274
diff changeset
14 * F$VIRQ (which means the clock module has not be initialized)
2299
8bad20f41100 Fixed crash in Init in F$Link failure
boisy
parents: 2291
diff changeset
15 *
8bad20f41100 Fixed crash in Init in F$Link failure
boisy
parents: 2291
diff changeset
16 * 2009/12/31 Boisy G. Pitre
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
17 * Fixed crash in Init where F$Link failure would not clean up stack
2313
9e3038c39b01 clock2_dw3 now gets seconds (6 byte time packet)
boisy
parents: 2310
diff changeset
18 *
9e3038c39b01 clock2_dw3 now gets seconds (6 byte time packet)
boisy
parents: 2310
diff changeset
19 * 2010/01/03 Boisy G. Pitre
9e3038c39b01 clock2_dw3 now gets seconds (6 byte time packet)
boisy
parents: 2310
diff changeset
20 * Moved IRQ stuff into DW3 subroutine module
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
21
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
22 nam scdwt
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
23 ttl CoCo DriveWire Virtual Serial Driver
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
24
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
25 ifp1
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
26 use defsfile
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
27 use dwdefs.d
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
28 endc
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
29
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
30
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
31 tylg set Drivr+Objct
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
32 atrv set ReEnt+Rev
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
33 rev set $00
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
34 edition set 1
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
35
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
36 * Note: driver memory defined in dwdefs.d
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
37 mod eom,name,tylg,atrv,start,SCFDrvMemSz
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
38
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
39 * module info
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
40 fcb READ.+WRITE. ;driver access modes
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
41 name fcs /scdwt/ ;driver name
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
42 fcb edition ;driver edition
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
43
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
44 * dispatch calls
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
45 start equ *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
46 lbra Init
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
47 lbra Read
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
48 lbra Write
2291
c4aa9c53261a DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents: 2290
diff changeset
49 lbra GetStat
2290
c0961e667550 Driver now sends OP_SERGETSTAT and OP_SERSETSTAT to server, along with
boisy
parents: 2288
diff changeset
50 lbra SetStat
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
51
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
52 ***********************************************************************
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
53 * Term
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
54 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
55 * shut down the driver.
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
56 * should close only the correct port, tell server to close the port,
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
57 * and remove irq handler when no ports are left
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
58 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
59 * Entry:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
60 * U = address of device memory area
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
61 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
62 * Exit:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
63 * CC = carry set on error
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
64 * B = error code
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
65 Term equ *
2249
8cbd8013fe24 rel: now we clear $00-$1F (direct page) in Level 2
boisy
parents: 2242
diff changeset
66
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
67 lda <V.PORT+1,u ;get our port #
2249
8cbd8013fe24 rel: now we clear $00-$1F (direct page) in Level 2
boisy
parents: 2242
diff changeset
68
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
69 pshs a ;port # on stack
2249
8cbd8013fe24 rel: now we clear $00-$1F (direct page) in Level 2
boisy
parents: 2242
diff changeset
70 * clear statics table entry
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
71 IFGT Level-1
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
72 ldx <D.DWStat
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
73 ELSE
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
74 ldx >D.DWStat
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
75 ENDC
2299
8bad20f41100 Fixed crash in Init in F$Link failure
boisy
parents: 2291
diff changeset
76 beq tell
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
77 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
78 ; leax DW.StatTbl,x
2249
8cbd8013fe24 rel: now we clear $00-$1F (direct page) in Level 2
boisy
parents: 2242
diff changeset
79 clr a,x ;clear out
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
80
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
81 * tell server
2299
8bad20f41100 Fixed crash in Init in F$Link failure
boisy
parents: 2291
diff changeset
82 tell
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
83 lda #OP_SERTERM ; load command
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
84 pshs a ; command store on stack
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
85 leax ,s ; point X to stack
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
86 ldy #2 ; 2 bytes to send
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
87
2249
8cbd8013fe24 rel: now we clear $00-$1F (direct page) in Level 2
boisy
parents: 2242
diff changeset
88 pshs u
8cbd8013fe24 rel: now we clear $00-$1F (direct page) in Level 2
boisy
parents: 2242
diff changeset
89
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
90 IFGT Level-1
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
91 ldu <D.DWSubAddr
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
92 ELSE
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
93 ldu >D.DWSubAddr
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
94 ENDC
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
95 beq nosub
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
96 jsr 6,u ; call DWrite
2249
8cbd8013fe24 rel: now we clear $00-$1F (direct page) in Level 2
boisy
parents: 2242
diff changeset
97
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
98 nosub
2249
8cbd8013fe24 rel: now we clear $00-$1F (direct page) in Level 2
boisy
parents: 2242
diff changeset
99 puls u
8cbd8013fe24 rel: now we clear $00-$1F (direct page) in Level 2
boisy
parents: 2242
diff changeset
100
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
101 leas 2,s ; clean 3 DWsub args from stack
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
102
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
103 clrb
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
104 rts
2299
8bad20f41100 Fixed crash in Init in F$Link failure
boisy
parents: 2291
diff changeset
105
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
106 puls u
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
107 leas 2,s
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
108 rts
2299
8bad20f41100 Fixed crash in Init in F$Link failure
boisy
parents: 2291
diff changeset
109
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
110 ***********************************************************************
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
111 * Init
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
112 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
113 * Entry:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
114 * Y = address of device descriptor
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
115 * U = address of device memory area
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
116 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
117 * Exit:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
118 * CC = carry set on error
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
119 * B = error code
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
120 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
121
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
122 Init equ *
2273
db65aeb5c335 Driver now calls F$STime to insure F$VIRQ call is installed by Clock
boisy
parents: 2271
diff changeset
123
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
124 lda IT.PAR,y
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
125 pshs a ; save parity byte for later
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
126
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
127 ; link to subroutine module
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
128 ; has the link already been done?
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
129 IFGT Level-1
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
130 ldx <D.DWSubAddr
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
131 ELSE
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
132 ldx >D.DWSubAddr
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
133 ENDC
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
134 bne already ; if so, do not bother
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
135
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
136 pshs u ; preserve u since os9 link is coming up
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
137
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
138 IFGT Level-1
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
139 ldx <D.Proc
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
140 pshs x
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
141 ldx <D.SysPrc
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
142 stx <D.Proc
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
143 ENDC
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
144 clra
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
145
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
146 leax dw3name,pcr
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
147 os9 F$Link
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
148 IFGT Level-1
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
149 puls x
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
150 stx <D.Proc
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
151 ENDC
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
152 bcs InitEx2
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
153 IFGT Level-1
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
154 sty <D.DWSubAddr
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
155 ELSE
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
156 sty >D.DWSubAddr
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
157 ENDC
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
158 jsr ,y ; call DW init routine
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
159
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
160 puls u ; restore u
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
161
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
162 already
2309
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
163 ; tell DW we have a new port opening (port mode already on stack)
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
164 ldb <V.PORT+1,u ; get our port #
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
165 lda #OP_SERINIT ; command
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
166 pshs d ; command + port # on stack
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
167 leax ,s ; point X to stack
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
168 ldy #3 ; # of bytes to send
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
169
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
170 pshs u
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
171 IFGT Level-1
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
172 ldu <D.DWSubAddr
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
173 ELSE
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
174 ldu >D.DWSubAddr
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
175 ENDC
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
176 jsr 6,u ; call DWrite
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
177 puls u
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
178
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
179 ; set up local buffer
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
180 ldb #RxBufDSz ; default Rx buffer size
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
181 leax RxBuff,u ; default Rx buffer address
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
182 stb RxBufSiz,u ; save Rx buffer size
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
183 stx RxBufPtr,u ; save Rx buffer address
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
184 stx RxBufGet,u ; set initial Rx buffer input address
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
185 stx RxBufPut,u ; set initial Rx buffer output address
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
186 abx ; add buffer size to buffer start..
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
187 stx RxBufEnd,u ; save Rx buffer end address
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
188
2309
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
189 tfr u,d (A = high page of statics)
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
190 puls b
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
191 puls b (B = port number)
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
192 IFGT Level-1
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
193 ldx <D.DWStat
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
194 ELSE
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
195 ldx >D.DWStat
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
196 ENDC
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
197 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
198 ; leax DW.StatTbl,x
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
199 sta b,x
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
200 InitEx equ *
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
201 puls a,pc
2299
8bad20f41100 Fixed crash in Init in F$Link failure
boisy
parents: 2291
diff changeset
202 InitEx2
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
203 puls u
2299
8bad20f41100 Fixed crash in Init in F$Link failure
boisy
parents: 2291
diff changeset
204 puls a,pc
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
205
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
206 ; drivewire info
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
207 dw3name fcs /dw3/
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
208
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
209
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
210 *****************************************************************************
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
211 * Write
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
212 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
213 * Entry:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
214 * A = character to write
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
215 * Y = address of path descriptor
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
216 * U = address of device memory area
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
217 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
218 * Exit:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
219 * CC = carry set on error
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
220 * B = error code
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
221 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
222 Write equ *
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
223 pshs a ; character to send on stack
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
224 ldb V.PORT+1,u ; port number into B
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
225 lda #OP_SERWRITE ; put command into A
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
226 pshs d
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
227 leax ,s
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
228 ldy #$0003 ; 3 bytes to send.. ugh. need WRITEM (data mode)
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
229 IFGT Level-1
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
230 ldu <D.DWSubAddr
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
231 ELSE
2270
07b2433f0c65 moved dwdefs.d to defs/, major changes to drivers due to new globals arrangement.
boisy
parents: 2261
diff changeset
232 ldu >D.DWSubAddr
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
233 ENDC
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
234 jsr 6,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
235 WriteOK clrb
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
236 WriteExit puls a,x,pc ; clean stack, return
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
237
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
238
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
239 *************************************************************************************
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
240 * Read
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
241 *
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
242 * Entry:
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
243 * Y = address of path descriptor
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
244 * U = address of device memory area
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
245 *
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
246 * Exit:
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
247 * A = character read
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
248 * CC = carry set on error
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
249 * B = error code
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
250 *
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
251 Read equ *
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
252 pshs cc,dp ; save IRQ/Carry status, system DP
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
253
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
254 ReadChr orcc #IntMasks ; mask interrupts
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
255
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
256 lda RxDatLen,u ; get our Rx buffer count
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
257 beq ReadSlp ; no data, go sleep while waiting for new Rx data...
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
258
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
259 ; we have data waiting
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
260 deca ; one less byte in buffer
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
261 sta RxDatLen,u ; save new Rx data count
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
262
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
263 ldx RxBufGet,u ; current Rx buffer pickup position
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
264 lda ,x+ ; get Rx character, set up next pickup position
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
265
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
266 cmpx RxBufEnd,u ; end of Rx buffer?
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
267 blo ReadChr1 ; no, keep pickup pointer
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
268 ldx RxBufPtr,u ; get Rx buffer start address
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
269 ReadChr1 stx RxBufGet,u ; set new Rx data pickup pointer
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
270
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
271 ; return to caller
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
272 puls cc,dp,pc ; recover IRQ/Carry status, system DP, return with character in A
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
273
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
274 ReadSlp equ *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
275
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
276 IFEQ Level-1
2249
8cbd8013fe24 rel: now we clear $00-$1F (direct page) in Level 2
boisy
parents: 2242
diff changeset
277 ReadSlp2 lda <V.BUSY,u
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
278 sta <V.WAKE,u ; store process id in this port's entry in the waiter table
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
279 lbsr Sleep0 ; sleep level 1 style
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
280 ELSE
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
281 ReadSlp2 lda >D.Proc ; process descriptor address MSB
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
282 sta <V.WAKE,u ; save MSB in V.WAKE
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
283 clrb
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
284 tfr d,x ; process descriptor address
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
285 IFNE H6309
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
286 oim #Suspend,P$State,x ; suspend
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
287 ELSE
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
288 ldb P$State,x
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
289 orb #Suspend
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
290 stb P$State,x ; suspend
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
291 ENDC
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
292 bsr Sleep1 ; sleep level 2 style
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
293 ENDC
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
294
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
295 ; we have been awakened..
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
296
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
297 ; check for signals
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
298 ldx >D.Proc ; process descriptor address
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
299 ldb P$Signal,x ; pending signal for this process?
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
300 beq ChkState ; no, go check process state...
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
301 cmpb #S$Intrpt ; (interrupt only)
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
302 bls ErrExit ; yes, go do it...
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
303
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
304 ChkState equ *
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
305 ; have we been condemned to die?
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
306 IFNE H6309
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
307 tim #Condem,P$State,x
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
308 ELSE
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
309 ldb P$State,x
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
310 bitb #Condem
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
311 ENDC
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
312 bne PrAbtErr ; yes, go do it...
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
313
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
314 ; check that our waiter byte was cleared by ISR instance
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
315 tst <V.WAKE,u ; our waiter byte
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
316 beq ReadChr ; 0 = its our turn, go get a character
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
317 bra ReadSlp ; false alarm, go back to sleep
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
318
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
319 PrAbtErr ldb #E$PrcAbt ; set error code
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
320
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
321 ErrExit equ *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
322 IFNE H6309
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
323 oim #Carry,,s ; set carry
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
324 ELSE
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
325 lda ,s
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
326 ora #Carry
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
327 sta ,s
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
328 ENDC
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
329 puls cc,dp,pc ; restore CC, system DP, return
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
330
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
331 IFEQ Level-1
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
332 Sleep0 ldx #$0 ; sleep till ISR wakes us
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
333 bra TimedSlp
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
334 ENDC
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
335
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
336 Sleep1 ldx #$1 ; just sleep till end of slice, we are suspended (level 2)
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
337 TimedSlp andcc #^Intmasks ; enable IRQs
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
338 os9 F$Sleep
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
339 rts ; return
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
340
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
341
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
342 **********************************************************************
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
343 * GetStat - heavily borrowed from sc6551
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
344 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
345 * Entry:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
346 * A = function code
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
347 * Y = address of path descriptor
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
348 * U = address of device memory area
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
349 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
350 * Exit:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
351 * CC = carry set on error
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
352 * B = error code
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
353 *
2291
c4aa9c53261a DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents: 2290
diff changeset
354 GetStat
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
355 clrb ; default to no error...
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
356 pshs cc,dp ; save IRQ/Carry status,system DP
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
357
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
358 ldx PD.RGS,y ; caller's register stack pointer
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
359 cmpa #SS.EOF
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
360 beq GSExitOK ; SCF devices never return EOF
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
361
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
362 cmpa #SS.Ready
2304
02a0a5544e93 We no longer advertise SS.Ready GetStat to the server
boisy
parents: 2299
diff changeset
363 bne Advertise ; next check
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
364
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
365 ; SS.Ready
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
366 lda RxDatLen,u ; get Rx data length
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
367 beq NRdyErr ; none, go report error
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
368 sta R$B,x ; set Rx data available in caller's [B]
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
369 GSExitOK puls cc,dp,pc ; restore Carry status, system DP, return
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
370
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
371 NRdyErr ldb #E$NotRdy
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
372 bra ErrExit ; return error code
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
373
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
374 UnSvcErr ldb #E$UnkSvc
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
375 bra ErrExit ; return error code
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
376
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
377 ; We advertise all of our SERGETSTAT calls (except SS.Ready) to the server
2304
02a0a5544e93 We no longer advertise SS.Ready GetStat to the server
boisy
parents: 2299
diff changeset
378 Advertise
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
379 ldb #OP_SERGETSTAT
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
380 bsr SendStat
2304
02a0a5544e93 We no longer advertise SS.Ready GetStat to the server
boisy
parents: 2299
diff changeset
381
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
382 ; Note: Here we could somehow obtain the size of the terminal window from the server
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
383 GetScSiz cmpa #SS.ScSiz
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
384 bne GetComSt ; next check
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
385 ldu PD.DEV,y
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
386 ldu V$DESC,u ; device descriptor
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
387 clra
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
388 ldb IT.COL,u ; return screen size
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
389 std R$X,x
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
390 ldb IT.ROW,u
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
391 std R$Y,x
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
392 puls cc,dp,pc ; restore Carry status, system DP, return
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
393
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
394 GetComSt cmpa #SS.ComSt
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
395 bne UnSvcErr ; no, we have no more answers, report error
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
396 ldd #$0000 ; not used, return $0000
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
397 std R$Y,x
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
398 sta R$B,x
2287
e49532f2c754 Added CTRL-C CTRL-E for single read only (not multiread)
boisy
parents: 2282
diff changeset
399 puls cc,dp,pc ; restore Carry status, system DP, return
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
400
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
401 * Advertise Stat Code to server
2291
c4aa9c53261a DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents: 2290
diff changeset
402 * A = Function Code
c4aa9c53261a DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents: 2290
diff changeset
403 * B = OP_SERGETSTAT or OP_SERSETSTAT
c4aa9c53261a DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents: 2290
diff changeset
404 SendStat
c4aa9c53261a DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents: 2290
diff changeset
405 * advertise our GetStt code to the server
2310
7820a7317242 Fixed crash in advertisting getstat
boisy
parents: 2309
diff changeset
406 pshs a,y,x,u
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
407 leas -3,s
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
408 leax ,s
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
409 stb ,x
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
410 sta 2,x
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
411 ldb V.PORT+1,u
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
412 stb 1,x
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
413 ldy #$0003
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
414 IFGT LEVEL-1
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
415 ldu <D.DWSubAddr
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
416 ELSE
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
417 ldu >D.DWSubAddr
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
418 ENDC
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
419 jsr 6,u
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
420 leas 3,s
2310
7820a7317242 Fixed crash in advertisting getstat
boisy
parents: 2309
diff changeset
421 puls a,y,x,u,pc
2291
c4aa9c53261a DriveWire Internet server now made in 3rdparty/packages/drivewire
boisy
parents: 2290
diff changeset
422
2242
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
423 *************************************************************************
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
424 * SetStat
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
425 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
426 * Entry:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
427 * A = function code
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
428 * Y = address of path descriptor
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
429 * U = address of device memory area
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
430 *
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
431 * Exit:
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
432 * CC = carry set on error
2a889a511f0a Adding Aaron Wolfe's DriveWire work
boisy
parents:
diff changeset
433 * B = error code
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
434 *
2290
c0961e667550 Driver now sends OP_SERGETSTAT and OP_SERSETSTAT to server, along with
boisy
parents: 2288
diff changeset
435 SetStat
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
436 ldb #OP_SERSETSTAT
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
437 bsr SendStat
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
438 cmpa #SS.ComSt
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
439 bne donebad
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
440 leax PD.OPT,y
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
441 ldy #OPTCNT
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
442 IFGT LEVEL-1
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
443 ldu <D.DWSubAddr
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
444 ELSE
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
445 ldu >D.DWSubAddr
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
446 ENDC
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
447 jsr 6,u
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
448 clrb
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
449 rts
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
450
2309
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
451 IFEQ 1
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
452 SetPortSig cmpa #SS.PortSig
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
453 bne SetPortRel
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
454 lda PD.CPR,y current process ID
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
455 ldb R$X+1,x LSB of [X] is signal code
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
456 std <PortSigPID
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
457 clrb
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
458 rts
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
459 SetPortRel cmpa #SS.PortRel
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
460 bne donebad
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
461 leax PortSigPID,u
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
462 bsr ReleaSig
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
463 clrb
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
464 rts
2309
f3e79ee2ffef Driver now moved ISR to dw3, all works
boisy
parents: 2308
diff changeset
465 ENDC
2305
daf732c77c52 Dressed up source more
boisy
parents: 2304
diff changeset
466 donebad comb
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
467 ldb #E$UnkSVc
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
468 rts
2290
c0961e667550 Driver now sends OP_SERGETSTAT and OP_SERSETSTAT to server, along with
boisy
parents: 2288
diff changeset
469
2308
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
470 ReleaSig pshs cc save IRQ enable status
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
471 orcc #IntMasks disable IRQs while releasing signal
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
472 lda PD.CPR,y get current process ID
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
473 suba ,x same as signal process ID?
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
474 bne NoReleas no, go return...
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
475 sta ,x clear this signal's process ID
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
476 NoReleas puls cc,pc restore IRQ enable status, return
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
477
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
478 emod
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
479 eom equ *
b5f0c5326e7e Changes made to move ISR to dw3
boisy
parents: 2305
diff changeset
480 end