Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/kernel/krn.asm @ 3277:33d539c123cf
d64: Add mb.ddisk script for making Dragon boot floppy
At least it works in XRoar when running off a 80d floppy
and preparing a new 40d boot floppy in the second drive.
The "format" must be run manually for now since there is
not enough memory to run it from inside the script...
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sat, 07 Mar 2020 23:15:05 +0100 |
parents | 185c31229f22 |
children |
rev | line source |
---|---|
1453 | 1 ******************************************************************** |
1587
5f18094d961d
kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents:
1460
diff
changeset
|
2 * Krn - NitrOS-9 Level 1 Kernel |
1453 | 3 * |
4 * $Id$ | |
5 * | |
6 * This is how the memory map looks after the kernel has initialized: | |
7 * | |
8 * $0000----> ================================== | |
9 * | | | |
10 * | | | |
11 * $0020-$0111 | System Globals (D.FMBM-D.XNMI) | | |
12 * | | | |
13 * | | | |
14 * $0200---->|==================================| | |
15 * | Free Memory Bitmap | | |
16 * $0200-$021F | (1 bit = 256 byte page) | | |
17 * |----------------------------------| | |
2012 | 18 * $0220-$0221 | IOMan I/O Call Pointer | |
19 * |----------------------------------| | |
1453 | 20 * | System Dispatch Table | |
21 * $0222-$0291 | (Room for 56 addresses) | | |
22 * |----------------------------------| | |
23 * $0292-$02FF | User Dispatch Table | | |
24 * | (Room for 56 addresses) | | |
25 * $0300---->|==================================| | |
26 * | | | |
27 * | | | |
28 * $0300-$03FF | Module Directory Entries | | |
29 * | (Room for 64 entries) | | |
30 * | | | |
31 * $0400---->|==================================| | |
32 * | | | |
33 * $0400-$04FF | System Stack | | |
34 * | | | |
35 * $0500---->|==================================| | |
2618 | 36 * | | |
37 * | | | |
38 * | | | |
39 * $0500-$08FF | Screen Memory (Atari Only) | | |
40 * | | | |
41 * | | | |
42 * | | | |
43 * $0900---->|==================================| | |
1453 | 44 * |
45 * Edt/Rev YYYY/MM/DD Modified by | |
46 * Comment | |
47 * ------------------------------------------------------------------ | |
48 * 14 1985/??/?? | |
49 * From Tandy OS-9 Level One VR 02.00.00 | |
50 * | |
51 * 15 2002/07/21 Boisy G. Pitre | |
52 * Module validation consists only of module header parity check. | |
53 * CRC check is not done unless D.CRC is set to 1, which is NOT the | |
54 * default case. By default, D.CRC is set to 0, thus there is no | |
55 * CRC checking. Speeds up module loads quite a bit. The Init module | |
56 * has a bit in a compatibility byte that can turn on/off CRC checking | |
57 * | |
58 * 15r1 2003/12/09 Boisy G. Pitre | |
1460 | 59 * Kernel no longer scans for modules in I/O space. Also, F$PrsNam now |
60 * allows _ and 0-9 as first chars of a filename. | |
1587
5f18094d961d
kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents:
1460
diff
changeset
|
61 * |
5f18094d961d
kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents:
1460
diff
changeset
|
62 * 15r1 2004/05/23 Boisy G. Pitre |
5f18094d961d
kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents:
1460
diff
changeset
|
63 * Renamed to 'krn' |
2617
b1145d2cb659
Adding atari port folder and modifications to init and krn to accommodate
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2252
diff
changeset
|
64 * |
b1145d2cb659
Adding atari port folder and modifications to init and krn to accommodate
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2252
diff
changeset
|
65 * 16 2004/05/23 Boisy G. Pitre |
b1145d2cb659
Adding atari port folder and modifications to init and krn to accommodate
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2252
diff
changeset
|
66 * Added changes for Atari port |
1453 | 67 |
1587
5f18094d961d
kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents:
1460
diff
changeset
|
68 nam krn |
1453 | 69 ttl NitrOS-9 Level 1 Kernel |
70 | |
71 ifp1 | |
72 use defsfile | |
73 endc | |
74 | |
75 tylg set Systm+Objct | |
76 atrv set ReEnt+rev | |
2617
b1145d2cb659
Adding atari port folder and modifications to init and krn to accommodate
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2252
diff
changeset
|
77 rev set $00 |
b1145d2cb659
Adding atari port folder and modifications to init and krn to accommodate
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2252
diff
changeset
|
78 edition set 16 |
1453 | 79 |
2012 | 80 ModTop mod eom,name,tylg,atrv,OS9Cold,size |
1453 | 81 |
82 size equ . | |
83 | |
1663 | 84 name fcs /Krn/ |
1453 | 85 fcb edition |
86 | |
87 * | |
88 * OS-9 Genesis! | |
1460 | 89 |
1453 | 90 OS9Cold equ * |
2252 | 91 * clear out system globals from $0000-$0400 |
92 * ldx #D.FMBM | |
93 ldx #$0000 | |
1460 | 94 IFNE H6309 |
2252 | 95 * ldw #$400-D.FMBM |
96 ldw #$400 | |
1460 | 97 leay Zoro,pc |
98 tfm y,x+ | |
99 ELSE | |
2252 | 100 * ldy #$400-D.FMBM |
101 ldy #$400 | |
1453 | 102 clra |
103 clrb | |
104 L007F std ,x++ | |
105 leay -2,y | |
106 bne L007F | |
1460 | 107 ENDC |
108 | |
1453 | 109 * set up system globals |
1460 | 110 IFNE H6309 |
111 ldd #$200 | |
112 ELSE | |
1453 | 113 inca |
114 inca D = $200 | |
1460 | 115 ENDC |
1453 | 116 std <D.FMBM $200 = start of free memory bitmap |
117 addb #$20 | |
118 std <D.FMBM+2 $220 = end of free memory bitmap | |
119 addb #$02 | |
120 std <D.SysDis $222 = addr of sys dispatch tbl | |
121 addb #$70 | |
122 std <D.UsrDis $292 = addr of usr dispatch tbl | |
123 clrb | |
124 inca D = $300 | |
125 std <D.ModDir $300 = mod dir start | |
126 stx <D.ModDir+2 X = $400 = mod dir end | |
127 leas >$0100,x S = $500 (system stack?) | |
128 | |
2653
40d55004f686
o krn.asm: Conditionalized out code in kernel to check for top of RAM
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2649
diff
changeset
|
129 * NOTE: This routine checks for RAM by writing a pattern at an address |
40d55004f686
o krn.asm: Conditionalized out code in kernel to check for top of RAM
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2649
diff
changeset
|
130 * then reading it back for validation. On the CoCo, we pretty much know |
40d55004f686
o krn.asm: Conditionalized out code in kernel to check for top of RAM
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2649
diff
changeset
|
131 * that we are in all-RAM mode at this point, and the same goes for the |
40d55004f686
o krn.asm: Conditionalized out code in kernel to check for top of RAM
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2649
diff
changeset
|
132 * other supported platforms. So I am taking this code out for the time being. |
40d55004f686
o krn.asm: Conditionalized out code in kernel to check for top of RAM
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2649
diff
changeset
|
133 |
40d55004f686
o krn.asm: Conditionalized out code in kernel to check for top of RAM
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2649
diff
changeset
|
134 IFNE CHECK_FOR_VALID_RAM |
1453 | 135 * Check for valid RAM starting at $400 |
136 ChkRAM leay ,x | |
137 ldd ,y store org contents in D | |
138 ldx #$00FF | |
139 stx ,y write pattern to ,Y | |
140 cmpx ,y same as what we wrote? | |
141 bne L00C2 nope, not RAM here! | |
142 ldx #$FF00 try different pattern | |
143 stx ,y write it to ,Y | |
144 cmpx ,y same as what we wrote? | |
145 bne L00C2 nope, not RAM here! | |
146 std ,y else restore org contents | |
147 leax >$0100,y check top of next 256 block | |
148 cmpx #Bt.Start stop short of boot track mem | |
149 bcs ChkRAM | |
150 leay ,x | |
151 * Here, Y = end of RAM | |
152 L00C2 leax ,y X = end of RAM | |
2653
40d55004f686
o krn.asm: Conditionalized out code in kernel to check for top of RAM
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2649
diff
changeset
|
153 ELSE |
3180
1c75a05d3304
defs: Move boot track parameters into each port def file
Boisy Pitre <coco@toughmac.com>
parents:
3088
diff
changeset
|
154 ldx #Bt.Start |
2653
40d55004f686
o krn.asm: Conditionalized out code in kernel to check for top of RAM
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2649
diff
changeset
|
155 ENDC |
1453 | 156 stx <D.MLIM save off memory limit |
157 | |
158 * Copy vector code over to address $100 | |
2653
40d55004f686
o krn.asm: Conditionalized out code in kernel to check for top of RAM
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2649
diff
changeset
|
159 pshs x |
1460 | 160 IFNE H6309 |
161 leax >VectCode,pcr | |
162 ldy #D.XSWI3 | |
163 ldw #VectCSz | |
164 tfm x+,y+ | |
165 ELSE | |
1453 | 166 leax >VectCode,pcr |
167 ldy #D.XSWI3 | |
168 ldb #VectCSz | |
169 L00D2 lda ,x+ | |
170 sta ,y+ | |
171 decb | |
172 bne L00D2 | |
1460 | 173 ENDC |
2653
40d55004f686
o krn.asm: Conditionalized out code in kernel to check for top of RAM
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2649
diff
changeset
|
174 puls x |
1460 | 175 |
3181
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
176 * Atari has bootfile already in memory |
2617
b1145d2cb659
Adding atari port folder and modifications to init and krn to accommodate
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2252
diff
changeset
|
177 IFNE atari |
3181
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
178 * flag that we've booted and that Boot Low starts appropriately |
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
179 ldy #$D000 Atari: I/O is at $D000-$D7FF |
2649
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
180 inc <D.Boot |
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
181 stx <D.BTLO |
3181
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
182 ldx #$FFFF |
2649
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
183 stx <D.BTHI |
2625
d1ea3dc90082
More progress... now booting with DriveWire
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2624
diff
changeset
|
184 ELSE |
3182
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
185 IFNE corsham |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
186 ldx #Bt.Start |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
187 ldy #Bt.Start+Bt.Size-1 |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
188 ELSE |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
189 * CoCo |
2620 | 190 ldy #Bt.Start+Bt.Size |
2617
b1145d2cb659
Adding atari port folder and modifications to init and krn to accommodate
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2252
diff
changeset
|
191 ENDC |
3182
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
192 ENDC |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
193 |
2620 | 194 lbsr ValMods |
3181
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
195 |
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
196 * Atari: look for more modules at $D800-$F3FF |
2617
b1145d2cb659
Adding atari port folder and modifications to init and krn to accommodate
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2252
diff
changeset
|
197 IFNE atari |
2620 | 198 ldx #$D800 |
2649
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
199 ldy #$F400 |
3181
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
200 lbsr ValMods |
2617
b1145d2cb659
Adding atari port folder and modifications to init and krn to accommodate
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2252
diff
changeset
|
201 ENDC |
2620 | 202 |
1460 | 203 * Copy vectors to system globals |
1453 | 204 L00EE leay >Vectors,pcr |
2012 | 205 leax >ModTop,pcr |
1453 | 206 pshs x |
207 ldx #D.SWI3 | |
208 L00FB ldd ,y++ | |
209 addd ,s | |
210 std ,x++ | |
2012 | 211 cmpx #D.NMI |
1453 | 212 bls L00FB |
213 leas 2,s restore stack | |
214 | |
215 * fill in more system globals | |
216 leax >URtoSs,pcr | |
217 stx <D.URtoSs | |
218 leax >UsrIRQ,pcr | |
219 stx <D.UsrIRQ | |
220 leax >UsrSvc,pcr | |
221 stx <D.UsrSvc | |
222 leax >SysIRQ,pcr | |
223 stx <D.SysIRQ | |
224 stx <D.SvcIRQ | |
225 leax >SysSvc,pcr | |
226 stx <D.SysSvc | |
227 stx <D.SWI2 | |
2023 | 228 leax >Poll,pcr point to default poll routine |
229 stx <D.Poll and save it | |
230 leax >Clock,pcr get default clock routine | |
231 stx <D.Clock and save it to the vector | |
232 stx <D.AltIRQ and in the alternate IRQ vector | |
1453 | 233 |
234 * install system calls | |
235 leay >SysTbl,pcr | |
236 lbsr InstSSvc | |
237 | |
238 * link to init module | |
239 lda #Systm+0 | |
240 leax >InitNam,pcr | |
241 os9 F$Link | |
242 lbcs OS9Cold | |
243 stu <D.Init | |
244 lda Feature1,u get feature byte 1 | |
245 bita #CRCOn CRC on? | |
246 beq GetMem branch if not (already cleared earlier) | |
247 inc <D.CRC else turn on CRC checking | |
2770
bfe3de781ddf
Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2710
diff
changeset
|
248 *GetMem ldd MaxMem+1,u I don't think this exists for Level1 RG |
2732
43300b4f840a
Robert Gault submitted changes to the level1/modules/kernel/krn.asm file related to free pages being less than what they should be.
drencor-xeen
parents:
2731
diff
changeset
|
249 * clrb |
2770
bfe3de781ddf
Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2710
diff
changeset
|
250 * cmpd <D.MLIM starts as $EE00 |
2732
43300b4f840a
Robert Gault submitted changes to the level1/modules/kernel/krn.asm file related to free pages being less than what they should be.
drencor-xeen
parents:
2731
diff
changeset
|
251 * bcc L0158 |
43300b4f840a
Robert Gault submitted changes to the level1/modules/kernel/krn.asm file related to free pages being less than what they should be.
drencor-xeen
parents:
2731
diff
changeset
|
252 * std <D.MLIM |
2770
bfe3de781ddf
Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2710
diff
changeset
|
253 GetMem equ * Initially I tried GetMem clra |
bfe3de781ddf
Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2710
diff
changeset
|
254 * that is redundant. See last line. RG |
1453 | 255 L0158 ldx <D.FMBM |
3088
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
256 * Free-memory bitmap. Bit7 of 0,x corresponds to page 0, bit6 to page 1 etc. |
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
257 * Bit7 of 1,x corresponds to page 8, bit6 to page 9 etc, etc. |
3181
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
258 |
3088
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
259 IFNE atari |
3181
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
260 * Atari needs $0000-$08FF and $D000-$D7FF reserved |
2618 | 261 ldb #%11111111 |
3088
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
262 stb ,x mark $0000-$07FF as allocated |
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
263 stb $1A,x mark $D000-$D7FF I/O area as allocated |
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
264 ldb #%10000000 |
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
265 stb 1,x mark $0800-$08FF as allocated |
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
266 ELSE |
3182
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
267 IFNE corsham |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
268 * Corsham needs $0000-$04FF and $E000-$EFFF reserved |
2618 | 269 ldb #%11111000 |
3182
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
270 stb ,x mark $0000-$04FF as allocated |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
271 ldb #%11111111 |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
272 stb $1C,x mark $E000-$E7FF I/O area as allocated |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
273 stb $1D,x mark $E800-$EFFF I/O area as allocated |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
274 ELSE |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
275 * CoCo needs $0000-$04FF reserved |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
276 ldb #%11111000 |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
277 stb ,x mark $0000-$04FF as allocated |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
278 ENDC |
3088
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
279 ENDC |
3181
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
280 |
3088
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
281 * For all platforms exclude high memory as defined (earlier) by D.MLIM |
1453 | 282 clra |
283 ldb <D.MLIM | |
284 negb | |
285 tfr d,y | |
286 negb | |
3088
fa4b4ae537c1
Add comments based on my learnings while debugging boot on multicomp09
Neal Crook <foofoobedoo@gmail.com>
parents:
3057
diff
changeset
|
287 lbsr L065A in included fallbit.asm |
1453 | 288 |
2012 | 289 * jump into krnp2 here |
1453 | 290 leax >P2Nam,pcr |
291 lda #Systm+Objct | |
292 os9 F$Link | |
293 lbcs OS9Cold | |
294 jmp ,y | |
2012 | 295 |
1453 | 296 SWI3 pshs pc,x,b |
297 ldb #P$SWI3 | |
298 bra L018C | |
299 SWI2 pshs pc,x,b | |
300 ldb #P$SWI2 | |
301 bra L018C | |
2622
1df7d248bb24
Made progress... clock is running, fixed some stuff, things are working
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2620
diff
changeset
|
302 SVCNMI jmp [>D.NMI] |
3181
d9760f344c96
Whitespace/comments in Atari sections of krn, clock, sysgo
Boisy Pitre <coco@toughmac.com>
parents:
3180
diff
changeset
|
303 DUMMY rti |
1453 | 304 SVCIRQ jmp [>D.SvcIRQ] |
305 SWI pshs pc,x,b | |
306 ldb #P$SWI | |
307 L018C ldx >D.Proc | |
308 ldx b,x get SWI entry | |
309 stx 3,s put in PC on stack | |
310 puls pc,x,b | |
311 | |
2023 | 312 UsrIRQ leay <DoIRQPoll,pcr |
1453 | 313 * transition from user to system state |
314 URtoSs clra | |
315 tfr a,dp clear direct page | |
2012 | 316 ldx <D.Proc get current process desc |
2023 | 317 * Note that we are putting the system state service routine address into |
318 * the D.SWI2 vector. If a system call is made while we are in system state, | |
319 * D.SWI2 will be vectored to the system state service routine vector. | |
2012 | 320 ldd <D.SysSvc get system state system call vector |
321 std <D.SWI2 store in D.SWI2 | |
2023 | 322 * The same comment above applies to the IRQ service vector. |
2012 | 323 ldd <D.SysIRQ get system IRQ vector |
324 std <D.SvcIRQ store in D.SvcIRQ | |
325 leau ,s point U to S | |
326 stu P$SP,x and save in process P$SP | |
327 lda P$State,x get state field in proc desc | |
328 ora #SysState mark process to be in system state | |
329 sta P$State,x store it | |
330 jmp ,y jump to ,y | |
1453 | 331 |
2023 | 332 DoIRQPoll |
333 jsr [>D.Poll] call vectored polling routine | |
334 bcc L01BD branch if carry clear | |
335 ldb ,s get the CC on the stack | |
336 orb #IRQMask mask IRQs | |
337 stb ,s and save it back | |
338 L01BD lbra ActivateProc | |
339 | |
340 | |
1453 | 341 |
342 SysIRQ clra | |
2023 | 343 tfr a,dp make DP be 0 |
344 jsr [>D.Poll] call the vectored IRQ polling routine | |
345 bcc L01CF branch if carry is clear | |
346 ldb ,s get the CC on the stack | |
347 orb #IRQMask mask IRQs | |
348 stb ,s and save it back | |
1453 | 349 L01CF rti |
2023 | 350 |
1453 | 351 Poll comb |
352 rts | |
353 | |
2017
f273e28ea8d0
Breaking kernel down into individual files... added comments
boisy
parents:
2012
diff
changeset
|
354 * Default clock routine - executed 60 times/sec |
2023 | 355 Clock ldx <D.SProcQ get pointer to sleeping proc queue |
356 beq L01FD branch if no process sleeping | |
357 lda P$State,x get state of that process | |
358 bita #TimSleep timed sleep? | |
359 beq L01FD branch if clear | |
360 ldu P$SP,x else get process stack pointer | |
361 ldd R$X,u get the value of the process X reg | |
362 subd #$0001 subtract one from it | |
3054
22ddd48b4ec2
level1 krn: Fix scheduler bug that only affected 6309
Tormod Volden <debian.tormod@gmail.com>
parents:
2898
diff
changeset
|
363 std R$X,u and store it back |
2023 | 364 bne L01FD branch if not zero (still will sleep) |
365 L01E7 ldu P$Queue,x get process current queue pointer | |
366 bsr L021A | |
1453 | 367 leax ,u |
368 beq L01FB | |
2023 | 369 lda P$State,x get process state byte |
370 bita #TimSleep bit set? | |
371 beq L01FB branch if not | |
372 ldu P$SP,x get process stack pointer | |
373 ldd R$X,u then get process X register | |
374 beq L01E7 branch if zero | |
1453 | 375 L01FB stx <D.SProcQ |
2017
f273e28ea8d0
Breaking kernel down into individual files... added comments
boisy
parents:
2012
diff
changeset
|
376 L01FD dec <D.Slice decrement slice |
f273e28ea8d0
Breaking kernel down into individual files... added comments
boisy
parents:
2012
diff
changeset
|
377 bne ClockRTI if not 0, exit ISR |
f273e28ea8d0
Breaking kernel down into individual files... added comments
boisy
parents:
2012
diff
changeset
|
378 lda <D.TSlice else get default time slice |
f273e28ea8d0
Breaking kernel down into individual files... added comments
boisy
parents:
2012
diff
changeset
|
379 sta <D.Slice and save it as slice |
f273e28ea8d0
Breaking kernel down into individual files... added comments
boisy
parents:
2012
diff
changeset
|
380 ldx <D.Proc get proc desc of current proc |
f273e28ea8d0
Breaking kernel down into individual files... added comments
boisy
parents:
2012
diff
changeset
|
381 beq ClockRTI if none, exit ISR |
f273e28ea8d0
Breaking kernel down into individual files... added comments
boisy
parents:
2012
diff
changeset
|
382 lda P$State,x get process state |
f273e28ea8d0
Breaking kernel down into individual files... added comments
boisy
parents:
2012
diff
changeset
|
383 ora #TimOut set timeout bit |
f273e28ea8d0
Breaking kernel down into individual files... added comments
boisy
parents:
2012
diff
changeset
|
384 sta P$State,x and store back |
1453 | 385 bpl L0212 branch if not system state |
386 ClockRTI rti | |
387 | |
2023 | 388 L0212 leay >ActivateProc,pcr |
1453 | 389 bra URtoSs |
390 | |
2006 | 391 |
392 *FAProc ldx R$X,u Get ptr to process to activate | |
393 *L0D11 clrb | |
394 * pshs cc,b,x,y,u | |
395 * lda P$Prior,x Get process priority | |
396 * sta P$Age,x Save it as age (How long it's been around) | |
397 * orcc #IntMasks Shut down IRQ's | |
398 * ldu #(D.AProcQ-P$Queue) Get ptr to active process queue | |
399 * bra L0D29 Go through the chain | |
400 ** Update active process queue | |
401 ** X=Process to activate | |
402 ** U=Current process in queue links | |
403 *L0D1F inc P$Age,u update current process age | |
404 * bne L0D25 wrap? | |
405 * dec P$Age,u yes, reset it to max. | |
406 *L0D25 cmpa P$Age,u match process ages?? | |
407 * bhi L0D2B no, skip update | |
408 *L0D29 leay ,u point Y to current process | |
409 *L0D2B ldu P$Queue,u get pointer to next process in chain | |
410 * bne L0D1F Still more in chain, keep going | |
411 * ldd P$Queue,y | |
412 * stx P$Queue,y save new process to chain | |
413 * std P$Queue,x | |
414 * puls cc,b,x,y,u,pc | |
415 | |
416 | |
2049 | 417 use faproc.asm |
2018 | 418 |
2012 | 419 * User-State system call entry point |
2023 | 420 * |
421 * All system calls made from user-state will go through this code. | |
422 UsrSvc leay <MakeSysCall,pcr | |
1453 | 423 orcc #IntMasks |
424 lbra URtoSs | |
425 | |
2023 | 426 MakeSysCall |
427 andcc #^IntMasks unmask IRQ/FIRQ | |
428 ldy <D.UsrDis get pointer to user syscall dispatch table | |
429 bsr DoSysCall go do the system call | |
430 ActivateProc | |
431 ldx <D.Proc get current proc desc | |
1453 | 432 beq FNProc branch to FNProc if none |
2012 | 433 orcc #IntMasks mask interrupts |
434 ldb P$State,x get state value in proc desc | |
435 andb #^SysState turn off system state flag | |
436 stb P$State,x save state value | |
437 bitb #TimOut timeout bit set? | |
438 beq L02D1 branch if not | |
439 andb #^TimOut else turn off bit | |
440 stb P$State,x in state value | |
1453 | 441 bsr L021A |
442 bra FNProc | |
443 | |
2012 | 444 * System-State system call entry point |
1453 | 445 SysSvc clra |
446 tfr a,dp set direct page to 0 | |
2012 | 447 leau ,s point U to SP |
448 ldy <D.SysDis get system state dispatch table ptr | |
449 bsr DoSysCall | |
1453 | 450 rti |
451 | |
2012 | 452 * Entry: Y = Dispatch table (user or system) |
453 DoSysCall | |
454 pshs u | |
1453 | 455 ldx R$PC,u point X to PC |
456 ldb ,x+ get func code at X | |
457 stx R$PC,u restore updated PC | |
2012 | 458 lslb high bit set? |
459 bcc L0288 branch if not (non I/O call) | |
460 rorb else restore B (its an I/O call) | |
461 ldx -2,y grab IOMan vector | |
462 * Note: should check if X is zero in case IOMan was not installed. | |
1453 | 463 bra L0290 |
2012 | 464 L0288 cmpb #$37*2 |
1453 | 465 bcc L02A7 |
466 ldx b,y X = addr of system call | |
467 beq L02A7 | |
468 L0290 jsr ,x jsr into system call | |
469 L0292 puls u | |
470 tfr cc,a | |
471 bcc FixCC branch if no error | |
472 stb R$B,u store error code | |
473 FixCC ldb R$CC,u get caller's CC | |
474 andb #^(Negative+Zero+TwosOvfl+Carry) | |
475 stb R$CC,u | |
476 anda #Negative+Zero+TwosOvfl+Carry | |
477 ora R$CC,u | |
478 sta R$CC,u | |
479 rts | |
480 L02A7 comb | |
481 ldb #E$UnkSvc | |
482 bra L0292 | |
483 | |
484 * no signal handler, exit with signal value as exit code | |
485 L02AC ldb P$State,x | |
486 orb #SysState | |
487 stb P$State,x | |
488 ldb <P$Signal,x | |
489 andcc #^(IntMasks) | |
490 os9 F$Exit | |
491 | |
492 FNProc clra | |
493 clrb | |
494 std <D.Proc | |
495 bra L02C2 | |
496 * execution goes here when there are no active processes | |
497 L02C0 cwai #^(IntMasks) | |
498 L02C2 orcc #IntMasks | |
499 ldx <D.AProcQ get next active process | |
500 beq L02C0 CWAI if none | |
501 ldd P$Queue,x get queue ptr | |
502 std <D.AProcQ store in Active Q | |
503 stx <D.Proc store in current process | |
504 lds P$SP,x get process' stack ptr | |
505 L02D1 ldb P$State,x get state | |
506 bmi L0308 branch if system state | |
507 bitb #Condem process condemned? | |
508 bne L02AC branch if so... | |
509 ldb <P$Signal,x get signal no | |
510 beq L02FF branch if none | |
511 decb decrement | |
512 beq L02FC branch if wake up | |
513 ldu <P$SigVec,x get signal handler addr | |
514 beq L02AC branch if none | |
515 ldy <P$SigDat,x get data addr | |
3055
35db67ca1302
level1 krn: Fix signal dispatch code to use R$ macros
Tormod Volden <debian.tormod@gmail.com>
parents:
3054
diff
changeset
|
516 ldd R$Y,s |
35db67ca1302
level1 krn: Fix signal dispatch code to use R$ macros
Tormod Volden <debian.tormod@gmail.com>
parents:
3054
diff
changeset
|
517 * set up new return stack for RTI |
35db67ca1302
level1 krn: Fix signal dispatch code to use R$ macros
Tormod Volden <debian.tormod@gmail.com>
parents:
3054
diff
changeset
|
518 pshs u,y,d new PC (sigvec), new U (sigdat), same Y |
35db67ca1302
level1 krn: Fix signal dispatch code to use R$ macros
Tormod Volden <debian.tormod@gmail.com>
parents:
3054
diff
changeset
|
519 ldu 6+R$X,s old X via U |
35db67ca1302
level1 krn: Fix signal dispatch code to use R$ macros
Tormod Volden <debian.tormod@gmail.com>
parents:
3054
diff
changeset
|
520 lda <P$Signal,x signal ... |
35db67ca1302
level1 krn: Fix signal dispatch code to use R$ macros
Tormod Volden <debian.tormod@gmail.com>
parents:
3054
diff
changeset
|
521 ldb 6+R$DP,s and old DP ... |
3056
dde1b2fc79fc
level1 krn: Fix signal dispatch for 6309
Tormod Volden <debian.tormod@gmail.com>
parents:
3055
diff
changeset
|
522 IFEQ H6309 |
3055
35db67ca1302
level1 krn: Fix signal dispatch code to use R$ macros
Tormod Volden <debian.tormod@gmail.com>
parents:
3054
diff
changeset
|
523 tfr d,y via Y |
35db67ca1302
level1 krn: Fix signal dispatch code to use R$ macros
Tormod Volden <debian.tormod@gmail.com>
parents:
3054
diff
changeset
|
524 ldd 6+R$CC,s old CC and A via D |
35db67ca1302
level1 krn: Fix signal dispatch code to use R$ macros
Tormod Volden <debian.tormod@gmail.com>
parents:
3054
diff
changeset
|
525 pshs u,y,d same X, same DP / new B (signal), same A / CC |
3056
dde1b2fc79fc
level1 krn: Fix signal dispatch for 6309
Tormod Volden <debian.tormod@gmail.com>
parents:
3055
diff
changeset
|
526 ELSE |
dde1b2fc79fc
level1 krn: Fix signal dispatch for 6309
Tormod Volden <debian.tormod@gmail.com>
parents:
3055
diff
changeset
|
527 pshs u,b same X, same DP |
dde1b2fc79fc
level1 krn: Fix signal dispatch for 6309
Tormod Volden <debian.tormod@gmail.com>
parents:
3055
diff
changeset
|
528 pshsw same W |
dde1b2fc79fc
level1 krn: Fix signal dispatch for 6309
Tormod Volden <debian.tormod@gmail.com>
parents:
3055
diff
changeset
|
529 pshs a new B (signal) |
dde1b2fc79fc
level1 krn: Fix signal dispatch for 6309
Tormod Volden <debian.tormod@gmail.com>
parents:
3055
diff
changeset
|
530 ldd 6+6+R$CC,s |
dde1b2fc79fc
level1 krn: Fix signal dispatch for 6309
Tormod Volden <debian.tormod@gmail.com>
parents:
3055
diff
changeset
|
531 pshs d same A / CC |
dde1b2fc79fc
level1 krn: Fix signal dispatch for 6309
Tormod Volden <debian.tormod@gmail.com>
parents:
3055
diff
changeset
|
532 ENDC |
1453 | 533 clrb |
534 L02FC stb <P$Signal,x | |
535 L02FF ldd <P$SWI2,x | |
536 std <D.SWI2 | |
537 ldd <D.UsrIRQ | |
538 std <D.SvcIRQ | |
539 L0308 rti | |
540 | |
541 FLink pshs u save caller regs | |
542 ldd R$A,u | |
543 ldx R$X,u | |
544 lbsr L0443 | |
545 bcc FLinkOK | |
546 ldb #E$MNF | |
547 bra L033D | |
548 * U = module dir entry | |
549 FLinkOK ldy ,u get module ptr | |
550 ldb M$Revs,y | |
551 bitb #ReEnt reentrant? | |
552 bne L032A branch if so | |
553 tst $02,u link count zero? | |
554 beq L032A yep, ok to link to nonreent | |
555 comb else module is busy | |
556 ldb #E$ModBsy | |
557 bra L033D | |
558 L032A inc $02,u increment link count | |
559 ldu ,s get caller regs from stack | |
560 stx R$X,u | |
561 sty R$U,u | |
562 ldd M$Type,y | |
563 std R$D,u | |
564 ldd M$IDSize,y | |
565 leax d,y | |
566 stx R$Y,u | |
567 L033D puls pc,u | |
568 | |
569 FVModul pshs u | |
570 ldx R$X,u | |
571 bsr ValMod | |
572 puls y | |
573 stu R$U,y | |
574 rts | |
2620 | 575 |
1453 | 576 * X = address of module to validate |
577 ValMod bsr ChkMHCRC | |
2620 | 578 bcs ValModEx |
1453 | 579 lda M$Type,x |
580 pshs x,a | |
581 ldd M$Name,x | |
582 leax d,x X = addr of name in mod | |
2710
ab3a2531c000
Fixed makefiles and assembly for ATARI port
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2653
diff
changeset
|
583 IFNE atari |
2649
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
584 * jsr [>$FFE8] |
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
585 * lda #$20 |
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
586 * jsr [>$FFE4] |
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
587 ENDC |
1453 | 588 puls a |
589 lbsr L0443 | |
590 puls x | |
2620 | 591 bcs ValLea |
1453 | 592 ldb #E$KwnMod |
593 cmpx ,u | |
2620 | 594 beq errex@ |
1453 | 595 lda M$Revs,x |
596 anda #RevsMask | |
597 pshs a | |
598 ldy ,u | |
599 lda M$Revs,y | |
600 anda #RevsMask | |
601 cmpa ,s+ same revision as other mod? | |
2620 | 602 bcc errex@ |
1453 | 603 pshs y,x |
604 ldb M$Size,u | |
2620 | 605 bne ValPul |
1453 | 606 ldx ,u |
607 cmpx <D.BTLO | |
2620 | 608 bcc ValPul |
1453 | 609 ldd $02,x |
610 addd #$00FF | |
611 tfr a,b | |
612 clra | |
613 tfr d,y | |
614 ldb ,u | |
615 ldx <D.FMBM | |
616 os9 F$DelBit | |
617 clr $02,u | |
2620 | 618 ValPul puls y,x |
619 ValSto stx ,u | |
1453 | 620 clrb |
2620 | 621 ValModEx rts |
622 ValLea leay ,u | |
623 bne ValSto | |
1453 | 624 ldb #E$DirFul |
2620 | 625 errex@ coma |
1453 | 626 rts |
627 | |
628 * check module header and CRC | |
629 * X = address of potential module | |
630 ChkMHCRC ldd ,x | |
631 cmpd #M$ID12 sync bytes? | |
2620 | 632 bne ChkMHEx nope, not a module here |
1453 | 633 leay M$Parity,x |
634 bsr ChkMHPar check header parity | |
2620 | 635 bcc Chk4CRC branch if ok |
636 ChkMHEx comb | |
1453 | 637 ldb #E$BMID |
638 rts | |
639 | |
2620 | 640 Chk4CRC |
1453 | 641 * Following 4 lines added to support no CRC checks - 2002/07/21 |
642 lda <D.CRC is CRC checking on? | |
643 bne DoCRCCk branch if so | |
644 clrb | |
645 rts | |
646 | |
647 DoCRCCk pshs x | |
648 ldy M$Size,x | |
649 bsr ChkMCRC checkm module CRC | |
650 puls pc,x | |
2620 | 651 |
1453 | 652 * check module header parity |
653 * Y = pointer to parity byte | |
654 ChkMHPar pshs y,x | |
655 clra | |
656 ChkM010 eora ,x+ | |
657 cmpx 2,s compare to addr of M$Parity | |
658 bls ChkM010 | |
659 cmpa #$FF | |
660 puls pc,y,x | |
661 * X = address of potential module | |
662 * Y = size of module | |
663 ChkMCRC ldd #$FFFF | |
664 pshs b,a | |
665 pshs b,a | |
666 leau 1,s | |
667 L03D4 lda ,x+ | |
668 bsr CRCAlgo | |
669 leay -1,y dec Y (size of module) | |
670 bne L03D4 continue | |
671 clr -1,u | |
672 lda ,u | |
673 cmpa #CRCCon1 | |
674 bne L03EC | |
675 ldd 1,u | |
676 cmpd #CRCCon23 | |
677 beq L03EF | |
678 L03EC comb | |
679 ldb #E$BMCRC | |
680 L03EF puls pc,y,x | |
681 | |
2049 | 682 use fcrc.asm |
1453 | 683 |
2649
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
684 L0443 |
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
685 ldu #$0000 |
1453 | 686 tfr a,b |
687 anda #TypeMask | |
688 andb #LangMask | |
689 pshs u,y,x,b,a | |
690 bsr EatSpace | |
691 cmpa #PDELIM pathlist char? | |
692 beq L049C branch if so | |
693 lbsr ParseNam parse name | |
694 bcs L049D return if error | |
695 ldu <D.ModDir | |
696 L045B pshs u,y,b | |
697 ldu ,u | |
698 beq L048B | |
699 ldd $04,u | |
700 leay d,u | |
701 ldb ,s | |
702 lbsr L07AB | |
703 bcs L0493 | |
704 lda $05,s | |
705 beq L0476 | |
706 eora $06,u | |
707 anda #$F0 | |
708 bne L0493 | |
709 L0476 lda $06,s | |
710 beq L0480 | |
711 eora $06,u | |
712 anda #$0F | |
713 bne L0493 | |
714 L0480 puls u,x,b | |
715 stu $06,s | |
716 bsr EatSpace | |
717 stx $02,s | |
718 clra | |
719 bra L049D | |
720 L048B ldd $0B,s | |
721 bne L0493 | |
722 ldd $03,s | |
723 std $0B,s | |
724 L0493 puls u,y,b | |
725 leau $04,u | |
726 cmpu <D.ModDir+2 | |
727 bcs L045B | |
728 L049C comb | |
729 L049D puls pc,u,y,x,b,a | |
730 | |
731 EatSpace lda #C$SPAC | |
732 EatSpc10 cmpa ,x+ | |
733 beq EatSpc10 | |
734 lda ,-x | |
735 rts | |
736 | |
737 FFork ldx <D.PrcDBT | |
738 os9 F$All64 | |
739 bcs L0517 | |
740 ldx <D.Proc | |
741 pshs x save calling proc desc on stack | |
742 ldd P$User,x | |
743 std P$User,y | |
744 lda P$Prior,x | |
745 clrb | |
746 std P$Prior,y | |
747 ldb #SysState | |
748 stb P$State,y | |
749 sty <D.Proc | |
750 ldd <P$NIO,x | |
751 std <P$NIO,y | |
752 ldd <P$NIO+2,x | |
753 std <P$NIO+2,y | |
754 leax <P$DIO,x | |
755 leay <P$DIO,y | |
756 ldb #DefIOSiz | |
757 * copy I/O stuff from parent to child | |
758 L04D7 lda ,x+ | |
759 sta ,y+ | |
760 decb | |
761 bne L04D7 | |
762 * X/Y = address of path table in respective proc desc | |
763 * Dup stdin/stdout/stderr | |
764 ldb #$03 | |
765 L04E0 lda ,x+ | |
766 os9 I$Dup | |
767 bcc L04E8 | |
768 clra | |
769 L04E8 sta ,y+ | |
770 decb | |
771 bne L04E0 | |
772 bsr L0553 | |
773 bcs L050C | |
774 puls y get parent proc desc | |
775 sty <D.Proc | |
776 lda P$ID,x get ID of new process | |
777 sta R$A,u store in caller's A | |
778 ldb P$CID,y get child id of parent | |
779 sta P$CID,y store new proc in parent's CID | |
780 lda P$ID,y get ID of parent | |
781 std P$PID,x store in child proc desc | |
782 ldb P$State,x update state of child | |
783 andb #^SysState | |
784 stb P$State,x | |
785 os9 F$AProc insert child in active Q | |
786 rts | |
787 L050C pshs b | |
788 os9 F$Exit | |
789 comb | |
790 puls x,b | |
791 stx <D.Proc | |
792 rts | |
793 L0517 comb | |
794 ldb #E$PrcFul | |
795 rts | |
796 | |
797 FChain bsr L0543 | |
798 bcs L0531 | |
799 orcc #IntMasks | |
800 ldb $0D,x | |
801 andb #$7F | |
802 stb $0D,x | |
803 L0527 os9 F$AProc | |
804 os9 F$NProc | |
805 | |
806 SFChain bsr L0543 | |
807 bcc L0527 | |
808 L0531 pshs b | |
809 stb <P$Signal,x | |
810 ldb P$State,x | |
811 orb #Condem | |
812 stb P$State,x | |
813 ldb #$FF | |
814 stb P$Prior,x | |
815 comb | |
816 puls pc,b | |
817 L0543 pshs u | |
818 ldx <D.Proc | |
819 ldu <P$PModul,x | |
820 os9 F$UnLink | |
821 ldu ,s | |
822 bsr L0553 | |
823 puls pc,u | |
824 L0553 ldx <D.Proc | |
825 pshs u,x | |
826 ldd <D.UsrSvc | |
827 std <P$SWI,x | |
828 std <P$SWI2,x | |
829 std <P$SWI3,x | |
830 clra | |
831 clrb | |
832 sta <P$Signal,x | |
833 std <P$SigVec,x | |
834 lda R$A,u | |
835 ldx R$X,u | |
836 os9 F$Link | |
837 bcc L0578 | |
838 os9 F$Load | |
839 bcs L05E7 | |
840 L0578 ldy <D.Proc | |
841 stu <P$PModul,y | |
842 cmpa #Prgrm+Objct | |
843 beq L058B | |
844 cmpa #Systm+Objct | |
845 beq L058B | |
846 comb | |
847 ldb #E$NEMod | |
848 bra L05E7 | |
849 L058B leay ,u Y = addr of module | |
850 ldu 2,s get U off stack (caller regs) | |
851 stx R$X,u | |
852 lda R$B,u | |
853 clrb | |
854 cmpd M$Mem,y compare passed mem to module's | |
855 bcc L059B branch if less than | |
856 ldd M$Mem,y | |
857 L059B addd #$0000 | |
858 bne L05A0 | |
859 L05A0 os9 F$Mem | |
860 bcs L05E7 | |
861 subd #R$Size subtract registers | |
862 subd R$Y,u subtract parameter area | |
863 bcs L05E5 | |
864 ldx R$U,u get parameter area | |
865 ldd R$Y,u get parameter size | |
866 pshs b,a | |
867 beq L05BE | |
868 leax d,x point to end of param area | |
869 L05B6 lda ,-x get byte, dec X | |
870 sta ,-y save byte in data area, dec X | |
871 cmpx R$U,u at top of param area? | |
872 bhi L05B6 | |
873 * set up registers for return of F$Fork/F$Chain | |
874 L05BE ldx <D.Proc | |
3057
1a76d7b57aa6
level 1 krn: Fix stack injection on 6309
Tormod Volden <debian.tormod@gmail.com>
parents:
3056
diff
changeset
|
875 sty -R$Size+R$X,y put in X on caller stack |
1453 | 876 leay -R$Size,y back up register size |
877 sty P$SP,x | |
878 lda P$ADDR,x | |
879 clrb | |
880 std R$U,y lowest address | |
881 sta R$DP,y set direct page | |
882 adda P$PagCnt,x | |
883 std R$Y,y | |
884 puls b,a | |
885 std R$D,y size of param area | |
886 ldb #Entire | |
887 stb R$CC,y | |
888 ldu <P$PModul,x get addr of prim. mod | |
889 ldd M$Exec,u | |
890 leau d,u | |
891 stu R$PC,y put in PC on caller reg | |
892 clrb | |
893 L05E5 ldb #E$IForkP | |
894 L05E7 puls pc,u,x | |
895 | |
2619
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
896 use fsrqmem.asm |
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
897 |
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
898 use fallbit.asm |
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
899 |
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
900 use fprsnam.asm |
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
901 |
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
902 use fcmpnam.asm |
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
903 |
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
904 use fssvc.asm |
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
905 |
2620 | 906 * Validate modules subroutine |
907 * Entry: X = address to start searching | |
908 * Y = address to stop (actually stops at Y-1) | |
909 ValMods pshs y | |
910 valloop@ lbsr ValMod | |
911 bcs valerr | |
912 ldd M$Size,x | |
913 leax d,x go past module | |
914 bra valcheck | |
915 valerr cmpb #E$KwnMod | |
916 beq valret | |
917 leax 1,x | |
918 valcheck cmpx ,s | |
919 bcs valloop@ | |
920 valret puls y,pc | |
921 | |
2619
d888412d8118
o Fixed assembler issue in init.asm
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2618
diff
changeset
|
922 |
2620 | 923 VectCode bra SWI3Jmp $0100 |
924 nop | |
925 bra SWI2Jmp $0103 | |
926 nop | |
2630
e310e8613606
Fixed earlier change from yesterday due to misunderstanding of ordering of 6809 vectors on CoCo 1/2...
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2625
diff
changeset
|
927 bra SWIJmp $0106 |
2620 | 928 nop |
2630
e310e8613606
Fixed earlier change from yesterday due to misunderstanding of ordering of 6809 vectors on CoCo 1/2...
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2625
diff
changeset
|
929 bra NMIJmp $0109 |
2620 | 930 nop |
2630
e310e8613606
Fixed earlier change from yesterday due to misunderstanding of ordering of 6809 vectors on CoCo 1/2...
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2625
diff
changeset
|
931 bra IRQJmp $010C |
2620 | 932 nop |
2630
e310e8613606
Fixed earlier change from yesterday due to misunderstanding of ordering of 6809 vectors on CoCo 1/2...
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2625
diff
changeset
|
933 bra FIRQJmp $010F |
2620 | 934 |
935 SWI3Jmp jmp [>D.SWI3] | |
936 SWI2Jmp jmp [>D.SWI2] | |
937 SWIJmp jmp [>D.SWI] | |
938 NMIJmp jmp [>D.NMI] | |
2630
e310e8613606
Fixed earlier change from yesterday due to misunderstanding of ordering of 6809 vectors on CoCo 1/2...
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2625
diff
changeset
|
939 IRQJmp jmp [>D.IRQ] |
e310e8613606
Fixed earlier change from yesterday due to misunderstanding of ordering of 6809 vectors on CoCo 1/2...
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2625
diff
changeset
|
940 FIRQJmp jmp [>D.FIRQ] |
2620 | 941 VectCSz equ *-VectCode |
942 | |
943 | |
944 SysTbl fcb F$Link | |
945 fdb FLink-*-2 | |
946 fcb F$Fork | |
947 fdb FFork-*-2 | |
948 fcb F$Chain | |
949 fdb FChain-*-2 | |
950 fcb F$Chain+SysState | |
951 fdb SFChain-*-2 | |
952 fcb F$PrsNam | |
953 fdb FPrsNam-*-2 | |
954 fcb F$CmpNam | |
955 fdb FCmpNam-*-2 | |
956 fcb F$SchBit | |
957 fdb FSchBit-*-2 | |
958 fcb F$AllBit | |
959 fdb FAllBit-*-2 | |
960 fcb F$DelBit | |
961 fdb FDelBit-*-2 | |
962 fcb F$CRC | |
963 fdb FCRC-*-2 | |
964 fcb F$SRqMem+SysState | |
965 fdb FSRqMem-*-2 | |
966 fcb F$SRtMem+SysState | |
967 fdb FSRtMem-*-2 | |
968 fcb F$AProc+SysState | |
969 fdb FAProc-*-2 | |
970 fcb F$NProc+SysState | |
971 fdb FNProc-*-2 | |
972 fcb F$VModul+SysState | |
973 fdb FVModul-*-2 | |
974 fcb F$SSvc | |
975 fdb FSSvc-*-2 | |
976 fcb $80 | |
977 | |
978 IFNE H6309 | |
979 Zoro fcb $00 | |
980 ENDC | |
981 | |
982 InitNam fcs /Init/ | |
983 | |
984 P2Nam fcs /krnp2/ | |
985 | |
2649
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
986 |
928b4a062979
Atari: Made mods to the kernel to boot with new Liber809 firmware
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2630
diff
changeset
|
987 |
3182
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
988 EOMTop EQU * |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
989 |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
990 IFEQ corsham |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
991 emod |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
992 eom equ * |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
993 ENDC |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
994 |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
995 IFNE atari |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
996 fdb $F3FE-(*-OS9Cold) |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
997 ENDC |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
998 |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
999 Vectors fdb SWI3 SWI3 |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1000 fdb SWI2 SWI2 |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1001 fdb DUMMY FIRQ |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1002 fdb SVCIRQ IRQ |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1003 fdb SWI SWI |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1004 fdb SVCNMI NMI |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1005 |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1006 IFNE corsham |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1007 emod |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1008 eom equ * |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1009 ENDC |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1010 EOMSize equ *-EOMTop |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1011 |
185c31229f22
Add level1 corsham port for the Corsham 6809 System
Boisy Pitre <coco@toughmac.com>
parents:
3181
diff
changeset
|
1012 end |