annotate level1/modules/vrn.asm @ 177:90b0403b7e82

Added help files
author boisy
date Fri, 12 Jul 2002 03:14:07 +0000
parents 6641a883d6b0
children b3bfa479f8d0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
2 * VRN - VIRQ/RAM/Nil device driver
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 * $Id$
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
6 * Copyright (C) 1989, 1990 Bruce Isted
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
7 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 * This program may be freely distributed as long as the copyright notice
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
9 * remains intact and the source, binary, and documentation files are
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
10 * distributed together.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
11 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12 * This program may not be sold for profit, individually or as part of a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
13 * package without the prior written permission of the copyright holder.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 * Ed. Comments Who YY/MM/DD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16 * ------------------------------------------------------------------
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17 * 1 Created BRI ??/??/??
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19 nam VRN
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 ttl VIRQ/RAM/Nil device driver
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 ifp1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23 use defsfile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24 use scfdefs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
26
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
27 VTCount equ 4 number of VIRQ tables
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28 * VIRQ Table Data Layout
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 org 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30 FS2.ID rmb 1 Flight Simulator 2 (and FS2+) VIRQ process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
31 FS2.Pth rmb 1 path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 FS2.Sgl rmb 1 signal code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
33 FS2.Tmr rmb 2 countdown timer (send signal on zero)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34 FS2.Rst rmb 2 reset count (no reset if zero)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35 FS2.STot rmb 1 signal counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 FS2.VTot rmb 4 total VIRQ counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 KQ3.ID rmb 1 King's Quest III VIRQ process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 KQ3.Pth rmb 1 path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
39 VTSize equ . VIRQ table size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
40 * RAM Table Data Layout
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41 org 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 RAM.ID rmb 1 RAM process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43 RAM.Pth rmb 1 path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44 RAM.Bks rmb 1 number of RAM blocks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
45 RAM.StB rmb 2 starting RAM block number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
46 RTSize equ . RAM table size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47 * Shared VIRQ/RAM Table Data Layout
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48 org 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 All.ID rmb 1 all tables' process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50 All.Pth rmb 1 all tables' path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
51 org V.SCF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52 VIRQPckt rmb 5 VIRQ packet Counter(2),Reset(2),Status(1) bytes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 PathNmbr rmb 1 current path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54 ProcNmbr rmb 1 current process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55 VIRQTbls rmb VTCount*VTSize space for VIRQ tables
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 RTCount equ ($0100-.)/RTSize number of tables that fit in balance of page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 RAMTbls rmb RTCount*RTSize space for RAM tables
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58 VMem equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
59
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 rev set $01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 edition set 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
63 mod VEnd,VName,Drivr+Objct,ReEnt+rev,VEntry,VMem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65 fcb UPDAT. driver access mode(s)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67 VName fcs "VRN"
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 fcb edition edition byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70 VEntry lbra VInit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 lbra VRead
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 lbra VWrit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73 lbra VGStt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 lbra VSStt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 lbra VTerm
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 IRQPckt fcb $00,$01,$0A IRQ packet Flip(1),Mask(1),Priority(1) bytes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 VInit equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78 * Note that all device memory except V.PAGE and
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 * V.PORT has already been cleared (zeroed).
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 leax VIRQPckt+Vi.Stat,u fake VIRQ status register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 lda #$80 VIRQ flag clear, repeated VIRQs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 sta ,x set it while we're here...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 tfr x,d copy fake VIRQ status register address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 leax IRQPckt,pc IRQ polling packet
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 leay IRQSvc,pc IRQ service entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 os9 F$IRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 bcs InitExit go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 ldd #$0001 initial count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 std VIRQPckt+Vi.Rst,u reset count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 ldx #$0001 code to install new VIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91 leay VIRQPckt,u VIRQ software registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 os9 F$VIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93 bcc InitExit no error, go exit...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94 pshs cc,b save error info
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 bsr DumpIRQ go remove from IRQ polling
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 puls cc,b,pc recover error info & exit...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 VRead equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 ldb #E$EOF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
100 InitExit rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101 VTerm equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
102 ldx #$0000 code to delete VIRQ entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
103 leay VIRQPckt,u VIRQ software registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
104 os9 F$VIRQ remove from VIRQ polling
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105 bcs Term.Err go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
106 DumpIRQ leax VIRQPckt+Vi.Stat,u fake VIRQ status register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
107 tfr x,d copy address...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
108 ldx #$0000 code to remove IRQ entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109 leay IRQSvc,pc IRQ service routine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
110 os9 F$IRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111 Term.Err rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
112 VGStt equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 * [A] = call code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 * call $01: SS.Ready (device never has data ready)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115 * call $80: return FS2/FS2+ total VIRQ counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
116 * call $81: return FS2/FS2+ number of signals sent
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117 * all others return E$UnkSvc error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118 bsr GetInfo process+path and caller's stack info
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
119 cmpa #$01 SS.Ready?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
120 bne Chk.GS80 no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
121 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
122 ldb #E$NotRdy
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
123 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
124 UnitErr ldb #E$Unit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
125 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126 * get process+path info, [Y] --> caller's register stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
127 * do not alter [A] or [U]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
128 GetInfo ldb PD.PD,y path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
129 stb PathNmbr,u save it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130 ldb PD.CPR,y current process ID (can't depend on V.BUSY)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
131 stb ProcNmbr,u save it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
132 ldy PD.RGS,y caller's register stack address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
133 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
134 Chk.GS80 cmpa #$80 return & clear total VIRQs?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
135 bne Chk.GS81 no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
136 bsr FPTFS2 find process+path entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 bcs UnitErr not in tables, go return error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 ldd FS2.VTot,x total VIRQ counter MSBs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 std R$X,y return them to caller
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 ldd FS2.VTot+2,x total VIRQ counter LSBs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141 std R$Y,y return them to caller
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
142 ClrVTot clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143 clrb no error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144 std FS2.VTot,x *clear total
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145 std FS2.VTot+2,x *VIRQ counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 Chk.GS81 cmpa #$81 return & clear signals sent?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 lbne USvcErr not supported, go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 bsr FPTFS2 find process+path entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150 bcs UnitErr not in tables, go return error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151 lda FS2.STot,x number of signals sent
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 sta R$A,y return it to caller
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
153 clr FS2.STot,x clear signal counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
154 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 VSStt equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156 * [A] = call code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 * call $2A: SS.Close (clear all process+path entries)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158 * call $81: set process+path FS2 VIRQ, clear process+path FS2/FS2+ VIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
159 * call $C7: set process+path FS2+ VIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
160 * call $C8: set process+path KQ3 VIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 * call $C9: clear process+path KQ3 VIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162 * call $CA: allocate process+path RAM blocks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 * call $CB: de-allocate process+path RAM blocks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 * all others return E$UnkSvc error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 bsr GetInfo process+path and caller's stack info
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
166 cmpa #$2A SS.Close?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167 bne Chk.SSC9 no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
168 bsr FPTFS2 check for existing FS2/FS2+ VIRQ entry...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
169 bcs Chk.KV2A none, go check for KQ3 VIRQ...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
170 clr All.ID,x de-allocate FS2/FS2+ entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171 Chk.KV2A bsr SS2A.KQ3 check/de-allocate KQ3 VIRQ...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 bra SS2A.RAM go return RAM blocks, return from there...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 Chk.SSC9 cmpa #$C9 clear KQ3 VIRQ?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
174 bne Chk.SSCB no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
175 SS2A.KQ3 bsr FPTKQ3 existing KQ3 VIRQ is ours?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
176 bcs SS.OK no, go exit clean...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
177 clr All.ID,x de-allocate KQ3 VIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179 Chk.SSCB cmpa #$CB return process+path RAM blocks?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180 bne Chk.SSC8 no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
181 SS2A.RAM bsr FPTRAM go find RAM table entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
182 bcs SS.OK no entry, go exit clean...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
183 clr All.ID,x de-allocate table entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
184 ldb RAM.Bks,x number of RAM blocks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
185 beq SS.OK no RAM to return, go exit clean...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186 ldx RAM.StB,x first block number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187 os9 F$DelRAM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
188 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
189 * Find Current Process+Path Table Entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
190 FPTRAM leax RAMTbls,u first RAM table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
191 ldd #RTCount*256+RTSize [A]=loop count, [B]=table size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192 bra FPT01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
193 FPTKQ3 leax VIRQTbls+KQ3.ID,u first KQ3 VIRQ entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
194 bra FPT00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 FPTFS2 leax VIRQTbls+FS2.ID,u first FS2/FS2+ VIRQ entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
196 FPT00 ldd #VTCount*256+VTSize [A]=loop count, [B]=table size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
197 FPT01 pshs a save loop count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 FPTLoop lda ProcNmbr,u current process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 cmpa All.ID,x same?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200 bne FPTNext no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
201 lda PathNmbr,u current path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
202 cmpa All.Pth,x same?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
203 bne FPTNext no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
204 clrb table found, clear Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
205 puls a,pc clean up stack, return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
206 FPTNext abx next table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
207 dec ,s done yet?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
208 bne FPTLoop no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
209 comb table not found, set Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
210 puls a,pc clean up stack, return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
211 Chk.SSC8 cmpa #$C8 set KQ3 VIRQ?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
212 bne Chk.SSCA no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
213 bsr FPTKQ3 existing KQ3 VIRQ?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
214 bcc SS.OK yes, go exit clean...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 bsr FETKQ3 KQ3 VIRQ available?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
216 bcs BusyErr no, go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
217 SS.OK clrb no error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
218 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
219 Chk.SSCA cmpa #$CA allocate process+path RAM blocks?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
220 bne Chk.SS81 no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
221 bsr FPTRAM go check for existing process+path RAM table entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
222 bcc BusyErr found it, go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
223 bsr FETRAM go find empty RAM table entry...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
224 bcs BusyErr tables full, go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225 ldb R$X+1,y RAM blocks to allocate
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 stb RAM.Bks,x save it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227 os9 F$AllRAM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 bcs SSCA.Err go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
229 std RAM.StB,x save first block number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
230 std R$X,y return it to caller, too
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 SS.Err rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
232 SSCA.Err pshs cc,b save error info
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
233 clr All.ID,x de-allocate table entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
234 puls cc,b,pc recover error info, return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
235 GetFS2 bsr FPTFS2 check for existing FS2/FS2+ entry...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
236 bcc GotFS2 found it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
237 bsr FETFS2 check for empty FS2/FS2+ table...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
238 bcs BusyErr none left, go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239 lbsr ClrVTot go clear VIRQ total counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
240 GotFS2 ldd R$X,y FS2/FS2+ timer count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
241 std FS2.Tmr,x save it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
242 std FS2.Rst,x FS2 reset count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
243 clr FS2.STot,x no signals sent yet...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
244 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
245 * Find Empty Table Entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
246 FETRAM leax RAMTbls,u first RAM table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
247 ldd #RTCount*256+RTSize [A]=loop count, [B]=table size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
248 bra FET01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
249 FETKQ3 leax VIRQTbls+KQ3.ID,u first KQ3 VIRQ entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
250 bra FET00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
251 FETFS2 leax VIRQTbls+FS2.ID,u first FS2/FS2+ VIRQ entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
252 FET00 ldd #VTCount*256+VTSize [A]=loop count, [B]=table size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
253 FET01 pshs a save loop count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
254 FETLoop lda All.ID,x table allocated?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
255 bne FETNext yes, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
256 lda ProcNmbr,u current process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
257 sta All.ID,x allocate table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
258 lda PathNmbr,u current path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
259 sta All.Pth,x set path number
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
260 clrb table found, clear Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
261 puls a,pc clean up stack, return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
262 FETNext abx next table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
263 dec ,s done yet?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
264 bne FETLoop no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
265 comb table not found, set Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266 puls a,pc clean up stack, return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
267 BusyErr comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
268 ldb #E$DevBsy
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
269 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270 Chk.SS81 cmpa #$81 set FS2 VIRQ or clear FS2/FS2+ VIRQ?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
271 bne Chk.SSC7 no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
272 bsr GetFS2 go get FS2/FS2+ VIRQ entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
273 bcs SS.Err go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
274 ldb #$80 standard FS2 signal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
275 stb FS2.Sgl,x save it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
276 ldb R$Y+1,y FS2 VIRQ enable/disable flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
277 bne SS.OK set VIRQ flag, go exit clean...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
278 ClrID clr All.ID,x de-allocate entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
279 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
280 Chk.SSC7 cmpa #$C7 set FS2+ VIRQ?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
281 bne USvcErr not supported, go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
282 bsr GetFS2 go get FS2/FS2+ VIRQ entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
283 bcs SS.Err go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
284 ldd R$Y,y FS2+ reset count (one shot VIRQ if zero)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
285 std FS2.Rst,x save it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
286 ldb R$U+1,y LSB = caller's signal code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
287 stb FS2.Sgl,x save it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
288 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
289 USvcErr comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
290 ldb #E$UnkSvc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
291 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
292 IRQSvc equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
293 lda VIRQPckt+Vi.Stat,u VIRQ status register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
294 anda #^Vi.IFlag clear flag in VIRQ status register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
295 sta VIRQPckt+Vi.Stat,u save it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
296 leau VIRQTbls,u VIRQ tables
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
297 ldy #VTCount loop count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
298 IRQLoop lda KQ3.ID,u KQ3 VIRQ process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
299 beq NoKQ3Sgl none, skip signal...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
300 ldb #$80 signal code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
301 os9 F$Send send signal, ignore error (if any)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
302 NoKQ3Sgl lda FS2.ID,u process ID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
303 beq NoFS2Sgl unallocated entry, skip everything...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
304 inc FS2.VTot+3,u *increment
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
305 bne DoneVTot *total
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
306 inc FS2.VTot+2,u *VIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
307 bne DoneVTot *counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
308 inc FS2.VTot+1,u *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
309 bne DoneVTot *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
310 inc FS2.VTot,u *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
311 DoneVTot ldx FS2.Tmr,u timer count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
312 leax -1,x less one...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
313 stx FS2.Tmr,u done yet?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
314 bne NoFS2Sgl no, skip signal...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
315 inc FS2.STot,u one more signal...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
316 ldx FS2.Rst,u reset timer count (one shot VIRQ?)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
317 stx FS2.Tmr,u set counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
318 bne KeepID not zero, go on...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
319 clr FS2.ID,u de-allocate entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
320 KeepID ldb FS2.Sgl,u signal code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
321 os9 F$Send send signal, ignore error (if any)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
322 NoFS2Sgl leau VTSize,u next table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
323 leay -1,y done all tables?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
324 bne IRQLoop no, go check next...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
325 VWrit equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
326 clrb no error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
327 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
328 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
329 VEnd equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
330 end