annotate level1/modules/kernel.asm @ 1287:10957d54bf16

Made all modules rev 0
author boisy
date Sat, 30 Aug 2003 20:16:51 +0000
parents 607fcc81c5ae
children bfb91dc51fb6
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 * OS9p1 - OS-9 Level One V2 P1 module
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 *
1197
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
6 * This is how the memory map looks after the kernel has initialized:
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
7 *
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
8 * $0000----> ==================================
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
9 * | |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
10 * | |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
11 * $0020-$0111 | System Globals (D.FMBM-D.XNMI) |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
12 * | |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
13 * | |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
14 * $0200---->|==================================|
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
15 * | Free Memory Bitmap |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
16 * $0200-$0221 | (1 bit = 256 byte page) |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
17 * |----------------------------------|
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
18 * | System Dispatch Table |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
19 * $0222-$0291 | (Room for 56 addresses) |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
20 * |----------------------------------|
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
21 * $0292-$02FF | User Dispatch Table |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
22 * | (Room for 56 addresses) |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
23 * $0300---->|==================================|
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
24 * | |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
25 * | |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
26 * $0300-$03FF | Module Directory Entries |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
27 * | (Room for 64 entries) |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
28 * | |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
29 * $0400---->|==================================|
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
30 * | |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
31 * $0400-$04FF | System Stack |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
32 * | |
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
33 * $0500---->|==================================|
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
34 *
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
35 * Edt/Rev YYYY/MM/DD Modified by
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
36 * Comment
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 * ------------------------------------------------------------------
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
38 * 14 1985/??/??
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
39 * From Tandy OS-9 Level One VR 02.00.00
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
40 *
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
41 * 15 2002/07/21 Boisy G. Pitre
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
42 * Module validation consists only of module header parity check.
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
43 * CRC check is not done unless D.CRC is set to 1, which is NOT the
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
44 * default case. By default, D.CRC is set to 0, thus there is no
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
45 * CRC checking. Speeds up module loads quite a bit. The Init module
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
46 * has a bit in a compatibility byte that can turn on/off CRC checking
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48 nam OS9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 ttl OS-9 Level One V2 P1 module
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
51 ifp1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52 use defsfile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 use scfdefs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 tylg set Systm+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 atrv set ReEnt+rev
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1197
diff changeset
58 rev set $00
300
e2ac8a38f22c Changed module edition
boisy
parents: 297
diff changeset
59 edition set 15
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 L0000 mod eom,name,tylg,atrv,OS9Cold,size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
63 size equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65 name fcs /OS9/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66 fcb edition
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 fcc /CC/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70 InitNam fcs /INIT/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 P2Nam fcs /OS9P2/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73
1197
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
74 VectCode bra SWI3Jmp $0100
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 nop
1197
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
76 bra SWI2Jmp $0103
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 nop
1197
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
78 bra SWIJmp $0106
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 nop
1197
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
80 bra NMIJmp $0109
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 nop
1197
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
82 bra IRQJmp $010C
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 nop
1197
607fcc81c5ae Fixed incorrect RMB sizes of Level One D.X*** system globals
boisy
parents: 977
diff changeset
84 bra FIRQJmp $010F
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 SWI3Jmp jmp [>D.SWI3]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 SWI2Jmp jmp [>D.SWI2]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 SWIJmp jmp [>D.SWI]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 NMIJmp jmp [>D.NMI]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 IRQJmp jmp [>D.IRQ]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91 FIRQJmp jmp [>D.FIRQ]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 VectCSz equ *-VectCode
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 SysTbl fcb F$Link
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 fdb FLink-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 fcb F$Fork
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 fdb FFork-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101 fcb F$Chain
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
102 fdb FChain-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
103
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
104 fcb F$Chain+$80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105 fdb SFChain-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
106
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
107 fcb F$PrsNam
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
108 fdb FPrsNam-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
110 fcb F$CmpNam
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111 fdb FCmpNam-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
112
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 fcb F$SchBit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 fdb FSchBit-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
116 fcb F$AllBit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117 fdb FAllBit-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
119 fcb F$DelBit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
120 fdb FDelBit-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
121
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
122 fcb F$CRC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
123 fdb FCRC-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
124
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
125 fcb F$SRqMem+$80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126 fdb FSRqMem-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
127
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
128 fcb F$SRtMem+$80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
129 fdb FSRtMem-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
131 fcb F$AProc+$80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
132 fdb FAProc-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
133
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
134 fcb F$NProc+$80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
135 fdb FNProc-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
136
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 fcb F$VModul+$80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 fdb FVModul-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 fcb F$SSvc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141 fdb FSSvc-*-2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
142
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143 fcb $80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 * OS-9 Genesis!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 OS9Cold equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 * clear out system globals from $0020-$0400
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 ldx #D.FMBM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150 ldy #$400-D.FMBM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
153 L007F std ,x++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
154 leay -2,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 bne L007F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156 * set up system globals
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 inca
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158 inca D = $200
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
159 std <D.FMBM $200 = start of free memory bitmap
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
160 addb #$20
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 std <D.FMBM+2 $220 = end of free memory bitmap
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162 addb #$02
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 std <D.SysDis $222 = addr of sys dispatch tbl
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 addb #$70
296
398a1bbd04bd Had wrong math in a comment -- fixed
boisy
parents: 247
diff changeset
165 std <D.UsrDis $292 = addr of usr dispatch tbl
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
166 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167 inca D = $300
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
168 std <D.ModDir $300 = mod dir start
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
169 stx <D.ModDir+2 X = $400 = mod dir end
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
170 leas >$0100,x S = $500 (system stack?)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 * Check for valid RAM starting at $400
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 ChkRAM leay ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
174 ldd ,y store org contents in D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
175 ldx #$00FF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
176 stx ,y write pattern to ,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
177 cmpx ,y same as what we wrote?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178 bne L00C2 nope, not RAM here!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179 ldx #$FF00 try different pattern
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180 stx ,y write it to ,Y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
181 cmpx ,y same as what we wrote?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
182 bne L00C2 nope, not RAM here!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
183 std ,y else restore org contents
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
184 leax >$0100,y check top of next 256 block
977
dd89c62ea2ca os9.asm and oscode.asm now use BTStart symbolic from systype
boisy
parents: 308
diff changeset
185 cmpx #BTStart stop short of boot track mem
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186 bcs ChkRAM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187 leay ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
188 * Here, Y = end of RAM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
189 L00C2 leax ,y X = end of RAM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
190 stx <D.MLIM save off memory limit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
191
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192 * Copy vector code over to address $100
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
193 pshs y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
194 leax >VectCode,pcr
247
7b282be4703e More slight source changes
boisy
parents: 201
diff changeset
195 ldy #D.XSWI3
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
196 ldb #VectCSz
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
197 L00D2 lda ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 sta ,y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200 bne L00D2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
201 puls y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
202 * validate modules at top of RAM (kernel, etc.)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
203 L00DB lbsr ValMod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
204 bcs L00E6
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
205 ldd M$Size,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
206 leax d,x go past module
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
207 bra L00EC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
208 L00E6 cmpb #E$KwnMod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
209 beq L00EE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
210 leax 1,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
211 L00EC bne L00DB
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
212
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
213 * copy vectors to system globals
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
214 L00EE leay >Vectors,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 leax >L0000,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
216 pshs x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
217 ldx #D.SWI3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
218 L00FB ldd ,y++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
219 addd ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
220 std ,x++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
221 cmpx #$0036
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
222 bls L00FB
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
223 leas 2,s restore stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
224
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225 * fill in more system globals
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 leax >URtoSs,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227 stx <D.URtoSs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 leax >UsrIRQ,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
229 stx <D.UsrIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
230 leax >UsrSvc,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 stx <D.UsrSvc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
232 leax >SysIRQ,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
233 stx <D.SysIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
234 stx <D.SvcIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
235 leax >SysSvc,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
236 stx <D.SysSvc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
237 stx <D.SWI2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
238 leax >Poll,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239 stx <D.Poll
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
240 leax >Clock,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
241 stx <D.Clock
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
242 stx <D.AltIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
243
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
244 * install system calls
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
245 leay >SysTbl,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
246 lbsr InstSSvc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
247
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
248 * link to init module
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
249 lda #Systm+0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
250 leax >InitNam,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
251 os9 F$Link
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
252 lbcs OS9Cold
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
253 stu <D.Init
308
1d99e2771841 Renamed compatibility byte to feature byte in init
boisy
parents: 306
diff changeset
254 lda Feature1,u get feature byte 1
306
c863af5b4ea1 init.asm: extended (see os9defs(
boisy
parents: 300
diff changeset
255 bita #CRCOn CRC on?
c863af5b4ea1 init.asm: extended (see os9defs(
boisy
parents: 300
diff changeset
256 beq GetMem branch if not (already cleared earlier)
c863af5b4ea1 init.asm: extended (see os9defs(
boisy
parents: 300
diff changeset
257 inc <D.CRC else turn on CRC checking
c863af5b4ea1 init.asm: extended (see os9defs(
boisy
parents: 300
diff changeset
258 GetMem ldd MaxMem+1,u
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
259 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
260 cmpd <D.MLIM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
261 bcc L0158
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
262 std <D.MLIM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
263 L0158 ldx <D.FMBM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
264 ldb #$F8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
265 stb ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
267 ldb <D.MLIM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
268 negb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
269 tfr d,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270 negb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
271 lbsr L065A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
272
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
273 * jump into OS9p2 here
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
274 leax >P2Nam,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
275 lda #Systm+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
276 os9 F$Link
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
277 lbcs OS9Cold
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
278 jmp ,y
165
473b9aec5828 Set labels on vectors
boisy
parents: 0
diff changeset
279 SWI3 pshs pc,x,b
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
280 ldb #P$SWI3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
281 bra L018C
165
473b9aec5828 Set labels on vectors
boisy
parents: 0
diff changeset
282 SWI2 pshs pc,x,b
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
283 ldb #P$SWI2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
284 bra L018C
247
7b282be4703e More slight source changes
boisy
parents: 201
diff changeset
285 DUMMY rti
165
473b9aec5828 Set labels on vectors
boisy
parents: 0
diff changeset
286 SVCIRQ jmp [>D.SvcIRQ]
473b9aec5828 Set labels on vectors
boisy
parents: 0
diff changeset
287 SWI pshs pc,x,b
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
288 ldb #P$SWI
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
289 L018C ldx >D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
290 ldx b,x get SWI entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
291 stx 3,s put in PC on stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
292 puls pc,x,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
293
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
294 UsrIRQ leay <L01B1,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
295 * transition from user to system state
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
296 URtoSs clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
297 tfr a,dp clear direct page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
298 ldx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
299 ldd <D.SysSvc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
300 std <D.SWI2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
301 ldd <D.SysIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
302 std <D.SvcIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
303 leau ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
304 stu P$SP,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
305 lda P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
306 ora #SysState
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
307 sta P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
308 jmp ,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
309
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
310 L01B1 jsr [>D.Poll]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
311 bcc L01BD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
312 ldb ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
313 orb #$10
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
314 stb ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
315 L01BD lbra L0255
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
316
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
317 SysIRQ clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
318 tfr a,dp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
319 jsr [>D.Poll]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
320 bcc L01CF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
321 ldb ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
322 orb #$10
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
323 stb ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
324 L01CF rti
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
325 Poll comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
326 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
327
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
328 Clock ldx <D.SProcQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
329 beq L01FD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
330 lda P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
331 bita #TimSleep
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
332 beq L01FD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
333 ldu P$SP,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
334 ldd P$SP,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
335 subd #$0001
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
336 std P$SP,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
337 bne L01FD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
338 L01E7 ldu P$Queue,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
339 bsr L021A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
340 leax ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
341 beq L01FB
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
342 lda P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
343 bita #TimSleep
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
344 beq L01FB
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
345 ldu P$SP,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
346 ldd P$SP,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
347 beq L01E7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
348 L01FB stx <D.SProcQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
349 L01FD dec <D.Slice
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
350 bne ClockRTI
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
351 lda <D.TSlice
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
352 sta <D.Slice
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
353 ldx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
354 beq ClockRTI
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
355 lda P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
356 ora #TimOut
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
357 sta P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
358 bpl L0212 branch if not system state
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
359 ClockRTI rti
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
360
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
361 L0212 leay >L0255,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
362 bra URtoSs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
363
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
364 * X = proc desc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
365 FAProc ldx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
366 L021A pshs u,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
367 ldu #$003F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
368 bra L0228
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
369 L0221 ldb P$Age,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
370 incb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
371 beq L0228
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
372 stb P$Age,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
373 L0228 ldu P$Queue,u U = proc desc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
374 bne L0221
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
375 ldu #$003F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
376 lda P$Prior,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
377 sta P$Age,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
378 orcc #IntMasks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
379 L0235 leay ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
380 ldu P$Queue,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
381 beq L023F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
382 cmpa P$Age,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
383 bls L0235
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
384 L023F stu P$Queue,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
385 stx P$Queue,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
386 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
387 puls pc,u,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
388
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
389 UsrSvc leay <L024E,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
390 orcc #IntMasks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
391 lbra URtoSs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
392
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
393 L024E andcc #^IntMasks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
394 ldy <D.UsrDis
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
395 bsr L0278
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
396 L0255 ldx <D.Proc get current proc desc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
397 beq FNProc branch to FNProc if none
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
398 orcc #IntMasks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
399 ldb P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
400 andb #^SysState
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
401 stb P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
402 bitb #TimOut
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
403 beq L02D1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
404 andb #^TimOut
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
405 stb P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
406 bsr L021A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
407 bra FNProc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
408
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
409 * system call entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
410 SysSvc clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
411 tfr a,dp set direct page to 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
412 leau ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
413 ldy <D.SysDis
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
414 bsr L0278
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
415 rti
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
416
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
417 L0278 pshs u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
418 ldx R$PC,u point X to PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
419 ldb ,x+ get func code at X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
420 stx R$PC,u restore updated PC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
421 lslb multiply by 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
422 bcc L0288 branch if user call
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
423 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
424 ldx -2,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
425 bra L0290
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
426 L0288 cmpb #$6E
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
427 bcc L02A7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
428 ldx b,y X = addr of system call
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
429 beq L02A7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
430 L0290 jsr ,x jsr into system call
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
431 L0292 puls u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
432 tfr cc,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
433 bcc FixCC branch if no error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
434 stb R$B,u store error code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
435 FixCC ldb R$CC,u get caller's CC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
436 andb #^(Negative+Zero+TwosOvfl+Carry)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
437 stb R$CC,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
438 anda #Negative+Zero+TwosOvfl+Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
439 ora R$CC,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
440 sta R$CC,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
441 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
442 L02A7 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
443 ldb #E$UnkSvc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
444 bra L0292
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
445
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
446 * no signal handler, exit with signal value as exit code
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
447 L02AC ldb P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
448 orb #SysState
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
449 stb P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
450 ldb <P$Signal,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
451 andcc #^(IntMasks)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
452 os9 F$Exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
453
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
454 FNProc clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
455 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
456 std <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
457 bra L02C2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
458 * execution goes here when there are no active processes
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
459 L02C0 cwai #^(IntMasks)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
460 L02C2 orcc #IntMasks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
461 ldx <D.AProcQ get next active process
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
462 beq L02C0 CWAI if none
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
463 ldd P$Queue,x get queue ptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
464 std <D.AProcQ store in Active Q
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
465 stx <D.Proc store in current process
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
466 lds P$SP,x get process' stack ptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
467 L02D1 ldb P$State,x get state
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
468 bmi L0308 branch if system state
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
469 bitb #Condem process condemned?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
470 bne L02AC branch if so...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
471 ldb <P$Signal,x get signal no
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
472 beq L02FF branch if none
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
473 decb decrement
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
474 beq L02FC branch if wake up
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
475 ldu <P$SigVec,x get signal handler addr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
476 beq L02AC branch if none
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
477 ldy <P$SigDat,x get data addr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
478 ldd $06,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
479 pshs u,y,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
480 ldu $0A,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
481 lda <P$Signal,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
482 ldb $09,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
483 tfr d,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
484 ldd $06,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
485 pshs u,y,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
486 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
487 L02FC stb <P$Signal,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
488 L02FF ldd <P$SWI2,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
489 std <D.SWI2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
490 ldd <D.UsrIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
491 std <D.SvcIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
492 L0308 rti
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
493
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
494 FLink pshs u save caller regs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
495 ldd R$A,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
496 ldx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
497 lbsr L0443
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
498 bcc FLinkOK
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
499 ldb #E$MNF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
500 bra L033D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
501 * U = module dir entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
502 FLinkOK ldy ,u get module ptr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
503 ldb M$Revs,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
504 bitb #ReEnt reentrant?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
505 bne L032A branch if so
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
506 tst $02,u link count zero?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
507 beq L032A yep, ok to link to nonreent
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
508 comb else module is busy
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
509 ldb #E$ModBsy
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
510 bra L033D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
511 L032A inc $02,u increment link count
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
512 ldu ,s get caller regs from stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
513 stx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
514 sty R$U,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
515 ldd M$Type,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
516 std R$D,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
517 ldd M$IDSize,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
518 leax d,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
519 stx R$Y,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
520 L033D puls pc,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
521
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
522 FVModul pshs u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
523 ldx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
524 bsr ValMod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
525 puls y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
526 stu R$U,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
527 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
528 * X = address of module to validate
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
529 ValMod bsr ChkMHCRC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
530 bcs L039A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
531 lda M$Type,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
532 pshs x,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
533 ldd M$Name,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
534 leax d,x X = addr of name in mod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
535 puls a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
536 lbsr L0443
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
537 puls x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
538 bcs L039B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
539 ldb #E$KwnMod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
540 cmpx ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
541 beq L03A1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
542 lda M$Revs,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
543 anda #RevsMask
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
544 pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
545 ldy ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
546 lda M$Revs,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
547 anda #RevsMask
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
548 cmpa ,s+ same revision as other mod?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
549 bcc L03A1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
550 pshs y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
551 ldb M$Size,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
552 bne L0395
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
553 ldx ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
554 cmpx <D.BTLO
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
555 bcc L0395
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
556 ldd $02,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
557 addd #$00FF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
558 tfr a,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
559 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
560 tfr d,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
561 ldb ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
562 ldx <D.FMBM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
563 os9 F$DelBit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
564 clr $02,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
565 L0395 puls y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
566 L0397 stx ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
567 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
568 L039A rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
569 L039B leay ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
570 bne L0397
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
571 ldb #E$DirFul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
572 L03A1 coma
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
573 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
574
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
575 * check module header and CRC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
576 * X = address of potential module
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
577 ChkMHCRC ldd ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
578 cmpd #M$ID12 sync bytes?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
579 bne L03B1 nope, not a module here
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
580 leay M$Parity,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
581 bsr ChkMHPar check header parity
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
582 bcc L03B5 branch if ok
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
583 L03B1 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
584 ldb #E$BMID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
585 rts
297
eda95fad0c31 Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents: 296
diff changeset
586
eda95fad0c31 Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents: 296
diff changeset
587 L03B5
eda95fad0c31 Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents: 296
diff changeset
588 * Following 4 lines added to support no CRC checks - 2002/07/21
eda95fad0c31 Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents: 296
diff changeset
589 lda <D.CRC is CRC checking on?
eda95fad0c31 Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents: 296
diff changeset
590 bne DoCRCCk branch if so
eda95fad0c31 Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents: 296
diff changeset
591 clrb
eda95fad0c31 Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents: 296
diff changeset
592 rts
eda95fad0c31 Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents: 296
diff changeset
593
eda95fad0c31 Added check for D.CRC switch to prevent CRC checking (off by default)
boisy
parents: 296
diff changeset
594 DoCRCCk pshs x
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
595 ldy M$Size,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
596 bsr ChkMCRC checkm module CRC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
597 puls pc,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
598 * check module header parity
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
599 * Y = pointer to parity byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
600 ChkMHPar pshs y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
601 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
602 ChkM010 eora ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
603 cmpx 2,s compare to addr of M$Parity
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
604 bls ChkM010
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
605 cmpa #$FF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
606 puls pc,y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
607 * X = address of potential module
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
608 * Y = size of module
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
609 ChkMCRC ldd #$FFFF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
610 pshs b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
611 pshs b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
612 leau 1,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
613 L03D4 lda ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
614 bsr CRCAlgo
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
615 leay -1,y dec Y (size of module)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
616 bne L03D4 continue
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
617 clr -1,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
618 lda ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
619 cmpa #CRCCon1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
620 bne L03EC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
621 ldd 1,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
622 cmpd #CRCCon23
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
623 beq L03EF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
624 L03EC comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
625 ldb #E$BMCRC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
626 L03EF puls pc,y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
627
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
628 * F$CRC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
629 FCRC ldx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
630 ldy R$Y,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
631 beq L0402
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
632 ldu R$U,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
633 L03FA lda ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
634 bsr CRCAlgo
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
635 leay -1,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
636 bne L03FA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
637 L0402 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
638 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
639
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
640 CRCAlgo eora ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
641 pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
642 ldd $01,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
643 std ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
644 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
645 ldb ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
646 lslb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
647 rola
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
648 eora 1,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
649 std 1,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
650 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
651 lda ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
652 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
653 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
654 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
655 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
656 eora 1,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
657 eorb 2,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
658 std 1,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
659 lda ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
660 lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
661 eora ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
662 sta ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
663 lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
664 lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
665 eora ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
666 sta ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
667 lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
668 lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
669 lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
670 lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
671 eora ,s+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
672 bpl L0442
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
673 ldd #$8021
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
674 eora ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
675 sta ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
676 eorb 2,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
677 stb 2,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
678 L0442 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
679
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
680 L0443 ldu #$0000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
681 tfr a,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
682 anda #TypeMask
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
683 andb #LangMask
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
684 pshs u,y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
685 bsr EatSpace
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
686 cmpa #PDELIM pathlist char?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
687 beq L049C branch if so
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
688 lbsr L074D parse name
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
689 bcs L049D return if error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
690 ldu <D.ModDir
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
691 L045B pshs u,y,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
692 ldu ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
693 beq L048B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
694 ldd $04,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
695 leay d,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
696 ldb ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
697 lbsr L07AB
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
698 bcs L0493
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
699 lda $05,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
700 beq L0476
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
701 eora $06,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
702 anda #$F0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
703 bne L0493
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
704 L0476 lda $06,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
705 beq L0480
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
706 eora $06,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
707 anda #$0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
708 bne L0493
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
709 L0480 puls u,x,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
710 stu $06,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
711 bsr EatSpace
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
712 stx $02,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
713 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
714 bra L049D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
715 L048B ldd $0B,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
716 bne L0493
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
717 ldd $03,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
718 std $0B,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
719 L0493 puls u,y,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
720 leau $04,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
721 cmpu <D.ModDir+2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
722 bcs L045B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
723 L049C comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
724 L049D puls pc,u,y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
725
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
726 EatSpace lda #C$SPAC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
727 EatSpc10 cmpa ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
728 beq EatSpc10
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
729 lda ,-x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
730 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
731
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
732 FFork ldx <D.PrcDBT
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
733 os9 F$All64
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
734 bcs L0517
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
735 ldx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
736 pshs x save calling proc desc on stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
737 ldd P$User,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
738 std P$User,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
739 lda P$Prior,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
740 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
741 std P$Prior,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
742 ldb #SysState
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
743 stb P$State,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
744 sty <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
745 ldd <P$NIO,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
746 std <P$NIO,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
747 ldd <P$NIO+2,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
748 std <P$NIO+2,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
749 leax <P$DIO,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
750 leay <P$DIO,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
751 ldb #DefIOSiz
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
752 * copy I/O stuff from parent to child
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
753 L04D7 lda ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
754 sta ,y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
755 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
756 bne L04D7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
757 * X/Y = address of path table in respective proc desc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
758 * Dup stdin/stdout/stderr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
759 ldb #$03
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
760 L04E0 lda ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
761 os9 I$Dup
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
762 bcc L04E8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
763 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
764 L04E8 sta ,y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
765 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
766 bne L04E0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
767 bsr L0553
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
768 bcs L050C
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
769 puls y get parent proc desc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
770 sty <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
771 lda P$ID,x get ID of new process
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
772 sta R$A,u store in caller's A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
773 ldb P$CID,y get child id of parent
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
774 sta P$CID,y store new proc in parent's CID
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
775 lda P$ID,y get ID of parent
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
776 std P$PID,x store in child proc desc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
777 ldb P$State,x update state of child
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
778 andb #^SysState
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
779 stb P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
780 os9 F$AProc insert child in active Q
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
781 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
782 L050C pshs b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
783 os9 F$Exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
784 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
785 puls x,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
786 stx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
787 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
788 L0517 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
789 ldb #E$PrcFul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
790 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
791
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
792 FChain bsr L0543
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
793 bcs L0531
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
794 orcc #IntMasks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
795 ldb $0D,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
796 andb #$7F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
797 stb $0D,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
798 L0527 os9 F$AProc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
799 os9 F$NProc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
800
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
801 SFChain bsr L0543
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
802 bcc L0527
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
803 L0531 pshs b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
804 stb <P$Signal,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
805 ldb P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
806 orb #Condem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
807 stb P$State,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
808 ldb #$FF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
809 stb P$Prior,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
810 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
811 puls pc,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
812 L0543 pshs u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
813 ldx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
814 ldu <P$PModul,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
815 os9 F$UnLink
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
816 ldu ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
817 bsr L0553
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
818 puls pc,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
819 L0553 ldx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
820 pshs u,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
821 ldd <D.UsrSvc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
822 std <P$SWI,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
823 std <P$SWI2,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
824 std <P$SWI3,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
825 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
826 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
827 sta <P$Signal,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
828 std <P$SigVec,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
829 lda R$A,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
830 ldx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
831 os9 F$Link
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
832 bcc L0578
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
833 os9 F$Load
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
834 bcs L05E7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
835 L0578 ldy <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
836 stu <P$PModul,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
837 cmpa #Prgrm+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
838 beq L058B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
839 cmpa #Systm+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
840 beq L058B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
841 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
842 ldb #E$NEMod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
843 bra L05E7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
844 L058B leay ,u Y = addr of module
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
845 ldu 2,s get U off stack (caller regs)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
846 stx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
847 lda R$B,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
848 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
849 cmpd M$Mem,y compare passed mem to module's
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
850 bcc L059B branch if less than
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
851 ldd M$Mem,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
852 L059B addd #$0000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
853 bne L05A0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
854 L05A0 os9 F$Mem
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
855 bcs L05E7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
856 subd #R$Size subtract registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
857 subd R$Y,u subtract parameter area
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
858 bcs L05E5
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
859 ldx R$U,u get parameter area
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
860 ldd R$Y,u get parameter size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
861 pshs b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
862 beq L05BE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
863 leax d,x point to end of param area
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
864 L05B6 lda ,-x get byte, dec X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
865 sta ,-y save byte in data area, dec X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
866 cmpx R$U,u at top of param area?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
867 bhi L05B6
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
868 * set up registers for return of F$Fork/F$Chain
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
869 L05BE ldx <D.Proc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
870 sty -$08,y put in X on caller stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
871 leay -R$Size,y back up register size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
872 sty P$SP,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
873 lda P$ADDR,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
874 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
875 std R$U,y lowest address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
876 sta R$DP,y set direct page
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
877 adda P$PagCnt,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
878 std R$Y,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
879 puls b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
880 std R$D,y size of param area
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
881 ldb #Entire
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
882 stb R$CC,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
883 ldu <P$PModul,x get addr of prim. mod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
884 ldd M$Exec,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
885 leau d,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
886 stu R$PC,y put in PC on caller reg
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
887 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
888 L05E5 ldb #E$IForkP
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
889 L05E7 puls pc,u,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
890
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
891 FSRqMem ldd R$D,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
892 addd #$00FF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
893 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
894 std R$D,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
895 ldx <D.FMBM+2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
896 ldd #$01FF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
897 pshs b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
898 bra L0604
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
899 L05FA dec $01,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
900 ldb $01,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
901 L05FE lsl ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
902 bcc L060A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
903 rol ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
904 L0604 leax -1,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
905 cmpx <D.FMBM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
906 bcs L0620
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
907 L060A lda ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
908 anda ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
909 bne L05FA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
910 dec 1,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
911 subb 1,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
912 cmpb 1,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
913 rora
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
914 addb 1,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
915 rola
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
916 bcs L05FE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
917 ldb 1,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
918 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
919 incb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
920 L0620 leas 2,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
921 bcs L0635
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
922 ldx <D.FMBM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
923 tfr d,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
924 ldb 1,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
925 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
926 exg d,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
927 bsr L065A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
928 exg a,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
929 std 8,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
930 L0633 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
931 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
932 L0635 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
933 ldb #E$MemFul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
934 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
935
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
936 FSRtMem ldd R$D,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
937 addd #$00FF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
938 tfr a,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
939 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
940 tfr d,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
941 ldd R$U,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
942 beq L0633
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
943 tstb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
944 beq L064E
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
945 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
946 ldb #E$BPAddr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
947 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
948 L064E exg a,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
949 ldx <D.FMBM
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
950 bra L06AD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
951
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
952 FAllBit ldd R$D,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
953 leau R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
954 pulu y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
955 L065A pshs y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
956 bsr L0690
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
957 tsta
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
958 pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
959 bmi L0671
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
960 lda ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
961 L0665 ora ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
962 leay -1,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
963 beq L0689
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
964 lsr ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
965 bcc L0665
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
966 sta ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
967 L0671 tfr y,d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
968 sta ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
969 lda #$FF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
970 bra L067B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
971 L0679 sta ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
972 L067B subb #$08
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
973 bcc L0679
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
974 dec ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
975 bpl L0679
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
976 L0683 lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
977 incb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
978 bne L0683
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
979 ora ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
980 L0689 sta ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
981 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
982 leas 1,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
983 puls pc,y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
984 L0690 pshs b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
985 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
986 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
987 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
988 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
989 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
990 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
991 leax d,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
992 puls b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
993 lda #$80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
994 andb #$07
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
995 beq L06A6
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
996 L06A2 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
997 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
998 bne L06A2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
999 L06A6 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1000
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1001 FDelBit ldd R$D,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1002 leau R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1003 pulu y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1004 L06AD pshs y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1005 bsr L0690
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1006 coma
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1007 pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1008 bpl L06C4
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1009 lda ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1010 L06B8 anda ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1011 leay -1,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1012 beq L06D8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1013 asr ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1014 bcs L06B8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1015 sta ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1016 L06C4 tfr y,d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1017 bra L06CA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1018 L06C8 clr ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1019 L06CA subd #$0008
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1020 bhi L06C8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1021 beq L06D8
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1022 L06D1 lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1023 incb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1024 bne L06D1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1025 coma
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1026 anda ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1027 L06D8 sta ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1028 clr ,s+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1029 puls pc,y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1030
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1031 FSchBit pshs u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1032 ldd R$D,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1033 ldx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1034 ldy R$Y,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1035 ldu R$U,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1036 bsr L06F3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1037 puls u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1038 std R$D,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1039 sty R$Y,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1040 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1041 L06F3 pshs u,y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1042 pshs y,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1043 clr 8,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1044 clr 9,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1045 tfr d,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1046 bsr L0690
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1047 pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1048 bra L0710
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1049 L0703 leay $01,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1050 sty $05,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1051 L0708 lsr ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1052 bcc L0714
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1053 ror ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1054 leax $01,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1055 L0710 cmpx $0B,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1056 bcc L0732
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1057 L0714 lda ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1058 anda ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1059 bne L0703
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1060 leay $01,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1061 tfr y,d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1062 subd $05,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1063 cmpd $03,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1064 bcc L0739
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1065 cmpd $09,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1066 bls L0708
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1067 std $09,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1068 ldd $05,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1069 std $01,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1070 bra L0708
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1071 L0732 ldd $01,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1072 std $05,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1073 coma
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1074 bra L073B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1075 L0739 std $09,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1076 L073B leas $05,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1077 puls pc,u,y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1078
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1079 FPrsNam ldx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1080 bsr L074D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1081 std R$D,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1082 bcs L0749
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1083 stx R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1084 L0749 sty R$Y,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1085 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1086 L074D lda ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1087 cmpa #PDELIM pathlist char?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1088 bne L0755 branch if not
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1089 leax 1,x go past pathlist char
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1090 L0755 leay ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1091 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1092 lda ,y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1093 anda #$7F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1094 bsr L0792
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1095 bcs L0772
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1096 L0760 incb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1097 lda -1,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1098 bmi L076F hi bit set on this char, done
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1099 lda ,y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1100 anda #$7F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1101 bsr IllChar
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1102 bcc L0760
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1103 lda ,-y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1104 L076F andcc #^Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1105 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1106 L0772 cmpa #C$COMA comma?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1107 bne L0778
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1108 L0776 lda ,y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1109 L0778 cmpa #C$SPAC space?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1110 beq L0776
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1111 lda ,-y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1112 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1113 ldb #E$BNam
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1114 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1115
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1116 * check for illegal characters in a pathlist
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1117 IllChar cmpa #C$PERD period?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1118 beq L07C9 branch if so
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1119 cmpa #'0 zero?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1120 bcs L07A2 branch if less than
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1121 cmpa #'9 number?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1122 bls L07C9 branch if lower/same
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1123 cmpa #'_ underscore?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1124 beq L07C9 branch if so
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1125 L0792 cmpa #'A A?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1126 bcs L07A2 branch if less than
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1127 cmpa #'Z Z?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1128 bls L07C9 branch if less or equal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1129 cmpa #'a a?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1130 bcs L07A2 branch if lower
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1131 cmpa #'z z?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1132 bls L07C9 branch if less or equal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1133 L07A2 orcc #Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1134 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1135
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1136 FCmpNam ldb R$B,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1137 leau R$X,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1138 pulu y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1139 L07AB pshs y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1140 L07AD lda ,y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1141 bmi L07BE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1142 decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1143 beq L07BA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1144 eora ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1145 anda #$DF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1146 beq L07AD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1147 L07BA orcc #Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1148 puls pc,y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1149 L07BE decb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1150 bne L07BA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1151 eora ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1152 anda #$5F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1153 bne L07BA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1154 puls y,x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1155 L07C9 andcc #^Carry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1156 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1157
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1158 FSSvc ldy R$Y,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1159 bra InstSSvc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1160 SSvcLoop tfr b,a put syscall code in A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1161 anda #$7F kill hi bit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1162 cmpa #$7F is code $7F?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1163 beq SSvcOK
977
dd89c62ea2ca os9.asm and oscode.asm now use BTStart symbolic from systype
boisy
parents: 308
diff changeset
1164 cmpa #$37 compare against highest call allowed
dd89c62ea2ca os9.asm and oscode.asm now use BTStart symbolic from systype
boisy
parents: 308
diff changeset
1165 bcs SSvcOK branch if A less than highest call
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1166 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1167 ldb #E$ISWI
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1168 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1169 SSvcOK lslb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1170 ldu <D.SysDis
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1171 leau b,u U points to entry in table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1172 ldd ,y++ get addr of func
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1173 leax d,y get absolute addr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1174 stx ,u store in system table
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1175 bcs InstSSvc branch if system only
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1176 stx <$70,u else store in user table too
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1177 InstSSvc ldb ,y+ get system call code in B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1178 cmpb #$80 end of table?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1179 bne SSvcLoop branch if not
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1180 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1181
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1182 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1183 eom equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1184
165
473b9aec5828 Set labels on vectors
boisy
parents: 0
diff changeset
1185 fdb Clock
247
7b282be4703e More slight source changes
boisy
parents: 201
diff changeset
1186 Vectors fdb SWI3 SWI3
7b282be4703e More slight source changes
boisy
parents: 201
diff changeset
1187 fdb SWI2 SWI2
7b282be4703e More slight source changes
boisy
parents: 201
diff changeset
1188 fdb DUMMY FIRQ
7b282be4703e More slight source changes
boisy
parents: 201
diff changeset
1189 fdb SVCIRQ IRQ
7b282be4703e More slight source changes
boisy
parents: 201
diff changeset
1190 fdb SWI SWI
7b282be4703e More slight source changes
boisy
parents: 201
diff changeset
1191 fdb DUMMY NMI
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1192
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1193 end
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1194