annotate level1/modules/vrn.asm @ 1071:853a796a1bcd

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