annotate level1/modules/vrn.asm @ 1724:f389c6bca482

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