annotate level2/modules/kernel/krn.asm @ 1624:bb75784a1ec5

Minor source change by Rodney H.
author boisy
date Wed, 30 Jun 2004 01:07:36 +0000
parents 5f18094d961d
children 5ecf6e023a64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1 ********************************************************************
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
2 * krn - NitrOS-9 Level 2 Kernel
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
3 *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
4 * $Id$
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
5 *
1378
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
7 * Comment
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
1378
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
9 * 19r6 2002/08/21 Boisy G. Pitre
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
10 * Assembles to the os9p1 module that works on my NitrOS-9 system.
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
11 *
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
12 * 19r7 2002/09/26 Boisy G. Pitre
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
13 * Added check for CRC feature bit in init module
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
14 *
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
15 * 19r8 2003/09/22 Boisy G. Pitre
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
16 * Back-ported to OS-9 Level Two.
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
17 *
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
18 * 19r8 2004/05/22 Boisy G. Pitre
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
19 * Renamed to 'krn'
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
20
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
21 nam krn
1378
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
22 ttl NitrOS-9 Level 2 Kernel
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
23
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
24 IFP1
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
25 use defsfile
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
26 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
27
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
28 * defines for customizations
1251
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
29 Revision set 8 module revision
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
30 Edition set 19 module Edition
1378
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
31 Where equ $F000 absolute address of where Kernel starts in memory
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
32
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1378
diff changeset
33 mod eom,MName,Systm,ReEnt+Revision,entry,0
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
34
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
35 MName fcs /krn/
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
36 fcb Edition
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
37
1378
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
38 * FILL - all unused bytes are now here
1399
40ccec5c5717 Updated
boisy
parents: 1387
diff changeset
39 fcc /www.katvixen.com/
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
40 IFNE H6309
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
41 fcc /0123456789ABCDEF/
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
42 fcc /0123456789ABCDEF/
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
43 fcc /0123456/
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
44 ELSE
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
45 fcc /012345678/
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
46 ENDC
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
47
1378
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
48 * Might as well have this here as just past the end of Kernel...
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
49 DisTable fdb L0CD2+Where D.Clock absolute address at the start
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
50 fdb XSWI3+Where D.XSWI3
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
51 fdb XSWI2+Where D.XSWI2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
52 fdb D.Crash D.XFIRQ crash on an FIRQ
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
53 fdb XIRQ+Where D.XIRQ
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
54 fdb XSWI+Where D.XSWI
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
55 fdb D.Crash D.XNMI crash on an NMI
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
56 fdb $0055 D.ErrRst ??? Not used as far as I can tell
1378
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
57 fdb Sys.Vec+Where Initial Kernel system call vector
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
58 DisSize equ *-DisTable
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
59 * DO NOT ADD ANYTHING BETWEEN THESE 2 TABLES: see code using 'SubSiz', below
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
60 LowSub equ $0160 start of low memory subroutines
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
61 SubStrt equ *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
62 * D.Flip0 - switch to system task 0
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
63 R.Flip0 equ *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
64 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
65 aim #$FE,<D.TINIT map type 0
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
66 lde <D.TINIT 'nother 2 bytes saved if GRFDRV does a 'tfr cc,e'
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
67 ste >DAT.Task and we can use A here, instead of E
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
68 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
69 pshs a
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
70 lda <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
71 anda #$FE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
72 sta <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
73 sta >DAT.Task
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
74 puls a
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
75 ENDC
1258
1aae5bde55a0 Fixed bugs as per Rodney's suggestion
boisy
parents: 1251
diff changeset
76 clr <D.SSTskN
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
77 tfr x,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
78 tfr a,cc
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
79 rts
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
80 SubSiz equ *-SubStrt
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
81 * Don't add any code here: See L0065, below.
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
82 * Interrupt service routine
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
83 Vectors jmp [<-(D.SWI3-D.XSWI3),x] (-$10) (Jmp to 2ndary vector)
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
84
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
85 * Let's start by initializing system page
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1378
diff changeset
86 entry equ *
1445
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
87 IFEQ Level-1
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
88 IFNE H6309
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
89 ldq #(D.FMBM*256)+($400-D.FMBM)
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
90 leay <entry+2,pc
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
91 tfm y,d+
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
92 tfr d,x
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
93 ELSE
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
94 ldx #D.FMBM
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
95 ldy #$400-D.FMBM
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
96 clra
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
97 clrb
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
98 loop1 std ,x++
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
99 leay -2,y
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
100 bne loop1
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
101 ENDC
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
102 ELSE
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
103 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
104 ldq #$01001f00 Start address to clear & # bytes to clear
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1378
diff changeset
105 leay <entry+2,pc Point to a 0
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
106 tfm y,d+
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
107 std <D.CCStk Set pointer to top of global memory to $2000
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
108 lda #$01 set task user table to $0100
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
109 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
110 ldx #$100
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
111 ldy #$2000-$100
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
112 clra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
113 clrb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
114 L001C std ,x++
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
115 leay -2,y
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
116 bne L001C
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
117 stx <D.CCStk Set pointer to top of global memory to $2000
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
118 inca D = $0100
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
119 ENDC
1445
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
120 ENDC
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
121
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
122 * Setup system direct page variables
1445
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
123 IFEQ Level-1
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
124 * For Level 1 this is how the memory map looks after
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
125 * the kernel has initialized:
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
126 *
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
127 * $0000----> ==================================
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
128 * | |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
129 * | |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
130 * $0020-$0111 | System Globals (D.FMBM-D.XNMI) |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
131 * | |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
132 * | |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
133 * $0200---->|==================================|
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
134 * | Free Memory Bitmap |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
135 * $0200-$021F | (1 bit = 256 byte page) |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
136 * |----------------------------------|
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
137 * | System Dispatch Table |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
138 * $0222-$0291 | (Room for 56 addresses) |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
139 * |----------------------------------|
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
140 * $0292-$02FF | User Dispatch Table |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
141 * | (Room for 56 addresses) |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
142 * $0300---->|==================================|
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
143 * | |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
144 * | |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
145 * $0300-$03FF | Module Directory Entries |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
146 * | (Room for 64 entries) |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
147 * | |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
148 * $0400---->|==================================|
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
149 * | |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
150 * $0400-$04FF | System Stack |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
151 * | |
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
152 * $0500---->|==================================|
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
153
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
154 ldd #$200
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
155 std <D.FMBM $200 = start of free memory bitmap
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
156 addb #$20
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
157 std D.FMBM+2 $220 = end of free memory bitmap
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
158 addb #$02
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
159 std <D.SysDis $222 = addr of sys dispatch table
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
160 addb #$70
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
161 std <D.UsrDis $292 = addr of sys dispatch table
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
162 clrb
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
163 inca D = $300
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
164 std <D.ModDir $300 = module dir start
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
165 stx <D.ModDir+2 $400 = module dir start
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
166 leas >$0100,x S = $500 (system stack)
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
167 ELSE
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
168 std <D.Tasks
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
169 addb #$20 set Task image table to $0120
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
170 std <D.TskIPt
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
171 clrb set memory block map to $0200
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
172 inca
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
173 std <D.BlkMap
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
174 addb #$40 set second block map to $0240
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
175 std <D.BlkMap+2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
176 clrb set system service dispatch table to $0300
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
177 inca
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
178 std <D.SysDis
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
179 inca set user dispatch table to $0400
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
180 std <D.UsrDis
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
181 inca set process descriptor block to $0500
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
182 std <D.PrcDBT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
183 inca set system process descriptor to $0600
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
184 std <D.SysPrc
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
185 std <D.Proc set user process descriptor to $0600
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
186 adda #$02 set stack pointer to $0800
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
187 tfr d,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
188 inca set system stack to $0900
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
189 std <D.SysStk
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
190 std <D.SysMem set system memory map ptr $0900
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
191 inca set module directory start to $0a00
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
192 std <D.ModDir
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
193 std <D.ModEnd set module directory end to $0a00
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
194 adda #$06 set secondary module directory start to $1000
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
195 std <D.ModDir+2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
196 std <D.ModDAT set module directory DAT pointer to $1000
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
197 std <D.CCMem set pointer to beginning of global memory to $1000
1445
229396b827b0 OS makefiles now make 720K disk image
boisy
parents: 1399
diff changeset
198 ENDC
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
199 * In following line, CRC=ON if it is STA <D.CRC, CRC=OFF if it is a STB <D.CRC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
200 stb <D.CRC set CRC checking flag to off
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
201
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
202 * Initialize interrupt vector tables
1203
70df6eac0ae3 Fixed spelling error
boisy
parents: 1146
diff changeset
203 leay <DisTable,pcr point to table of absolute vector addresses
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
204 ldx #D.Clock where to put it in memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
205 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
206 ldf #DisSize size of the table - E=0 from TFM, above
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
207 tfm y+,x+ move it over
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
208 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
209 ldb #DisSize
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
210 LoopCopy lda ,y+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
211 sta ,x+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
212 decb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
213 bne LoopCopy
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
214 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
215
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
216 * initialize D.Flip0 routine in low memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
217 * Y=ptr to R.Flip0 already
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
218 * leay >R.Flip0,pc
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
219 ldu #LowSub somewhere in block 0 that's never modified
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
220 stu <D.Flip0 switch to system task 0
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
221 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
222 ldf #SubSiz size of it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
223 tfm y+,u+ copy it over
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
224 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
225 ldb #SubSiz
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
226 Loop2 lda ,y+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
227 sta ,u+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
228 decb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
229 bne Loop2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
230 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
231
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
232 * leau <Vectors,pc point to vector
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
233 tfr y,u move the pointer to a faster register
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
234 L0065 stu ,x++ Set all IRQ vectors to go to Vectors for now
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
235 cmpx #D.NMI
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
236 bls L0065
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
237
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
238 * Initialize user interupt vectors
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
239 ldx <D.XSWI2 Get SWI2 (os9 command) service routine pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
240 stx <D.UsrSvc Save it as user service routine pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
241 ldx <D.XIRQ Get IRQ service routine pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
242 stx <D.UsrIRQ Save it as user IRQ routine pointer
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
243
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
244 leax >SysCall,pc Setup System service routine entry vector
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
245 stx <D.SysSvc
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
246 stx <D.XSWI2
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
247
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
248 leax >S.SysIRQ,pc Setup system IRQ service vector
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
249 stx <D.SysIRQ
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
250 stx <D.XIRQ
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
251
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
252 leax >S.SvcIRQ,pc Setup in system IRQ service vector
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
253 stx <D.SvcIRQ
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
254 leax >S.Poll,pc Setup interrupt polling vector
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
255 stx <D.Poll ORCC #$01;RTS
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
256 leax >S.AltIRQ,pc Setup alternate IRQ vector: pts to an RTS
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
257 stx <D.AltIRQ
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
258
1378
5955268ca3e5 Changes
boisy
parents: 1258
diff changeset
259 lda #'K --- in Kernel
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
260 jsr <D.BtBug ---
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
261
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
262 leax >S.Flip1,pc Setup change to task 1 vector
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
263 stx <D.Flip1
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
264
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
265 * Setup System calls
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
266 leay >SysCalls,pc
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
267 lbsr SysSvc
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
268
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
269 * Initialize system process descriptor
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
270 ldu <D.PrcDBT get process table pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
271 ldx <D.SysPrc get system process pointer
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
272
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
273 * These overlap because it is quicker than trying to strip hi byte from X
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
274 stx ,u save it as first process in table
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
275 stx 1,u save it as the second as well
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
276 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
277 oim #$01,P$ID,x Set process ID to 1 (inited to 0)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
278 oim #SysState,P$State,x Set to system state (inited to 0)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
279 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
280 ldd #$01*256+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
281 sta P$ID,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
282 stb P$State,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
283 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
284 clra System task is task #0
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
285 sta <D.SysTsk
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
286 sta P$Task,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
287 coma Setup its priority & age ($FF)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
288 sta P$Prior,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
289 sta P$Age,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
290 leax <P$DATImg,x point to DAT image
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
291 stx <D.SysDAT save it as a pointer in DP
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
292 * actually, since block 0 is tfm'd to be zero, we can skip the next 2 lines
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
293 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
294 clrd
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
295 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
296 clra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
297 clrb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
298 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
299 std ,x++ initialize 1st block to 0 (for this DP)
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
300
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
301 * Dat.BlCt-ROMCount-RAMCount
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
302 lda #$06 initialize the rest of the blocks to be free
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
303 ldu #DAT.Free
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
304 L00EF stu ,x++
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
305 deca
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
306 bne L00EF
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
307
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
308 ldu #$003F Block $3F is in use, at the top of system DAT image
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
309 stu ,x
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
310
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
311 ldx <D.Tasks Point to task user table
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
312 inc ,x mark first 2 in use (system & GrfDrv)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
313 inc 1,x
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
314
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
315 * Setup system memory map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
316 ldx <D.SysMem Get system memory map pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
317 ldb <D.CCStk Get MSB of top of CC memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
318 L0104 inc ,x+ Mark it as used
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
319 decb Done?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
320 bne L0104 No, go back till done
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
321
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
322 * Calculate memory size
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
323 ldx <D.BlkMap get ptr to 8k block map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
324 inc <$3F,x mark block $3F as used (kernel)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
325 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
326 ldq #$00080100 e=Marker, D=Block # to check
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
327 L0111 asld get next block #
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
328 stb >$FFA5 Map block into block 6 of my task
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
329 ste >-$6000,x save marker to that block
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
330 cmpe ,x did it ghost to block 0?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
331 bne L0111 No, keep going till ghost is found
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
332 stb <D.MemSz Save # 8k mem blocks that exist
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
333 addr x,d add number of blocks to block map start
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
334 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
335 ldd #$0008
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
336 L0111 aslb
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
337 rola
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
338 stb >$FFA5
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
339 pshs a
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
340 lda #$01
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
341 sta >-$6000,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
342 cmpa ,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
343 puls a
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
344 bne L0111
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
345 stb <D.MemSz
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
346 pshs x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
347 addd ,s++
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
348 ENDC
1240
cd2122359eb9 Removed extraneous jmp D.Crash from os9p2.asm
boisy
parents: 1239
diff changeset
349 std <D.BlkMap+2 save block map end pointer
cd2122359eb9 Removed extraneous jmp D.Crash from os9p2.asm
boisy
parents: 1239
diff changeset
350
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
351 * [D] at this point will contain 1 of the following:
1251
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
352 * $0210 - 128k
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
353 * $0220 - 256k
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
354 * $0240 - 512k
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
355 * $0280 - 1024k
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
356 * $0300 - 2048k
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
357 bitb #%00110000 block above 128K-256K?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
358 beq L0170 yes, no need to mark block map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
359 tstb 2 meg?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
360 beq L0170 yes, skip this
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
361 * Mark blocks from 128k-256K to block $3F as NOT RAM
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
362 abx add maximum block number to block map start
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
363 leax -1,x Skip good blocks that are RAM
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
364 lda #NotRAM Not RAM flag
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
365 subb #$3F Calculate # blocks to mark as not RAM
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
366 L0127 sta ,x+ Mark them all
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
367 decb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
368 bne L0127
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
369
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
370 L0170 ldx #Bt.Start start address of the boot track in memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
371 lda #$12 size of the boot track: B=$00 from L0127 loop, above
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
372 lbsr I.VBlock go verify it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
373
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
374 bsr L01D2 go mark system map
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
375
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
376 * See if init module is in memory already
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
377 L01B0 leax <init,pc point to 'Init' module name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
378 bsr link try & link it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
379 bcc L01BF no error, go on
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
380 L01B8 os9 F$Boot error linking init, try & load boot file
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
381 bcc L01B0 got it, try init again
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
382 bra L01CE error, re-booting do D.Crash
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
383 * Save pointer to init module and execute krnp2
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
384 L01BF stu <D.Init Save init module pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
385 lda Feature1,u Get feature byte #1 from init module
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
386 bita #CRCOn CRC feature on?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
387 beq ShowI if not, continue
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
388 inc <D.CRC else inc. CRC flag
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
389 ShowI lda #'i found init module
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
390 jsr <D.BtBug
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
391
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
392 L01C1 leax <krnp2,pc Point to it's name
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
393 bsr link Try to link it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
394 bcc L01D0 It worked, execute it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
395 os9 F$Boot It doesn't exist try re-booting
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
396 bcc L01C1 No error's, let's try to link it again
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
397 L01CE jmp <D.Crash obviously can't do it, crash machine
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
398 L01D0 jmp ,y execute krnp2
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
399
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
400 * Mark kernel in system memory map as used memory (256 byte blocks)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
401 L01D2 ldx <D.SysMem Get system mem ptr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
402 ldd #NotRAM*256+$ED $ED00 is the start of the boot
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
403 abx point to Bt.Start - start of boot track
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
404 comb we have $FF-$ED pages to mark as used
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
405 sta b,x Mark I/O as not RAM
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
406 L01DF lda #RAMinUse get in use flag
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
407 L01E1 sta ,x+ save it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
408 decb done?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
409 bne L01E1 no, keep going
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
410 ldx <D.BlkMap get pointer to start of block map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
411 sta <$3f,x mark kernel block as RAMinUse, instead of ModInBlk
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
412 S.AltIRQ rts return
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
413
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
414 * Link module pointed to by X
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
415 link lda #Systm Attempt to link system module
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
416 os9 F$Link
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
417 rts
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
418
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
419 init fcs 'Init'
1587
5f18094d961d kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
boisy
parents: 1445
diff changeset
420 krnp2 fcs 'krnp2'
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
421
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
422 * Service vector call pointers
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
423 SysCalls fcb F$Link
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
424 fdb FLink-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
425 fcb F$PrsNam
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
426 fdb FPrsNam-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
427 fcb F$CmpNam
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
428 fdb FCmpNam-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
429 fcb F$CmpNam+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
430 fdb FSCmpNam-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
431 fcb F$CRC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
432 fdb FCRC-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
433 fcb F$SRqMem+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
434 fdb FSRqMem-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
435 fcb F$SRtMem+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
436 fdb FSRtMem-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
437 fcb F$AProc+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
438 fdb FAProc-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
439 fcb F$NProc+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
440 fdb FNProc-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
441 fcb F$VModul+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
442 fdb FVModul-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
443 fcb F$SSvc+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
444 fdb FSSvc-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
445 fcb F$SLink+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
446 fdb FSLink-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
447 fcb F$Boot+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
448 fdb FBoot-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
449 fcb F$BtMem+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
450 fdb FSRqMem-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
451 IFNE H6309
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
452 fcb F$CpyMem
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
453 fdb FCpyMem-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
454 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
455 fcb F$Move+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
456 fdb FMove-*-2
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1378
diff changeset
457 fcb F$AllRAM
1451bc7ef0b9 Updates source comments
boisy
parents: 1378
diff changeset
458 fdb FAllRAM-*-2
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
459 fcb F$AllImg+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
460 fdb FAllImg-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
461 fcb F$SetImg+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
462 fdb FFreeLB-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
463 fcb F$FreeLB+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
464 fdb FSFreeLB-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
465 fcb F$FreeHB+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
466 fdb FFreeHB-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
467 fcb F$AllTsk+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
468 fdb FAllTsk-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
469 fcb F$DelTsk+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
470 fdb FDelTsk-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
471 fcb F$SetTsk+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
472 fdb FSetTsk-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
473 fcb F$ResTsk+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
474 fdb FResTsk-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
475 fcb F$RelTsk+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
476 fdb FRelTsk-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
477 fcb F$DATLog+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
478 fdb FDATLog-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
479 fcb F$LDAXY+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
480 fdb FLDAXY-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
481 fcb F$LDDDXY+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
482 fdb FLDDDXY-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
483 fcb F$LDABX+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
484 fdb FLDABX-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
485 fcb F$STABX+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
486 fdb FSTABX-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
487 fcb F$ELink+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
488 fdb FELink-*-2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
489 fcb F$FModul+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
490 fdb FFModul-*-2
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1378
diff changeset
491 fcb F$AlHRAM+SysState
1451bc7ef0b9 Updates source comments
boisy
parents: 1378
diff changeset
492 fdb FAlHRAM-*-2
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
493 fcb F$VBlock+SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
494 fdb FVBlock-*-2
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
495 IFNE H6309
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
496 fcb F$DelRAM
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
497 fdb FDelRAM-*-2
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
498 ENDC
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
499 fcb $80
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
500
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
501 * SWI3 vector entry
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
502 XSWI3 lda #P$SWI3 point to SWI3 vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
503 fcb $8C skip 2 bytes
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
504
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
505 * SWI vector entry
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
506 XSWI lda #P$SWI point to SWI vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
507 ldx <D.Proc get process pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
508 ldu a,x user defined SWI[x]?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
509 beq L028E no, go get option byte
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
510 GoUser lbra L0E5E Yes, go call users's routine
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
511
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
512 * SWI2 vector entry
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
513 XSWI2 ldx <D.Proc get current process descriptor
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
514 ldu P$SWI2,x any SWI vector?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
515 bne GoUser yes, go execute it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
516
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
517 * Process software interupts from a user state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
518 * Entry: X=Process descriptor pointer of process that made system call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
519 * U=Register stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
520 L028E ldu <D.SysSvc set system call processor to system side
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
521 stu <D.XSWI2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
522 ldu <D.SysIRQ do the same thing for IRQ's
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
523 stu <D.XIRQ
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
524 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
525 oim #SysState,P$State,x mark process as in system state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
526 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
527 lda P$State,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
528 ora #SysState
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
529 sta P$State,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
530 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
531 * copy register stack to process descriptor
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
532 sts P$SP,x save stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
533 leas (P$Stack-R$Size),x point S to register stack destination
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
534
1243
0819245a7e87 Fixed terrible bug in user state system call dispatch routine thanks to
boisy
parents: 1241
diff changeset
535 IFNE H6309
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
536 leau R$Size-1,s point to last byte of destination register stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
537 leay -1,y point to caller's register stack in $FEE1
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
538 ldw #R$Size size of the register stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
539 tfm y-,u-
1243
0819245a7e87 Fixed terrible bug in user state system call dispatch routine thanks to
boisy
parents: 1241
diff changeset
540 leau ,s needed because the TFM is u-, not -u (post, not pre)
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
541 ELSE
1251
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
542 * Note! R$Size MUST BE an EVEN number of bytes for this to work!
1243
0819245a7e87 Fixed terrible bug in user state system call dispatch routine thanks to
boisy
parents: 1241
diff changeset
543 leau R$Size,s point to last byte of destination register stack
1251
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
544 lda #R$Size/2
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
545 Loop3 ldx ,--y
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
546 stx ,--u
411c88ed62f6 Fixed bug in os9p1, now boots in Level Two! Also inc'ed rev (and in os9p2)
boisy
parents: 1250
diff changeset
547 deca
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
548 bne Loop3
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
549 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
550 andcc #^IntMasks
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
551 * B=function code already from calling process: DON'T USE IT!
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
552 ldx R$PC,u get where PC was from process
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
553 leax 1,x move PC past option
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
554 stx R$PC,u save updated PC to process
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
555 * execute function call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
556 ldy <D.UsrDis get user dispatch table pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
557 lbsr L033B go execute option
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
558 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
559 aim #^IntMasks,R$CC,u Clear interrupt flags in caller's CC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
560 ELSE
1243
0819245a7e87 Fixed terrible bug in user state system call dispatch routine thanks to
boisy
parents: 1241
diff changeset
561 lda R$CC,u
0819245a7e87 Fixed terrible bug in user state system call dispatch routine thanks to
boisy
parents: 1241
diff changeset
562 anda #^IntMasks
0819245a7e87 Fixed terrible bug in user state system call dispatch routine thanks to
boisy
parents: 1241
diff changeset
563 sta R$CC,u
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
564 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
565 ldx <D.Proc get current process ptr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
566 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
567 aim #^(SysState+TimOut),P$State,x Clear system & timeout flags
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
568 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
569 lda P$State,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
570 anda #^(SysState+TimOut)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
571 sta P$State,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
572 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
573
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
574 * Check for image change now, which lets stuff like F$MapBlk and F$ClrBlk
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
575 * do the short-circuit thing, too. Adds about 20 cycles to each system call.
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
576 lbsr TstImg it doesn't hurt to call this twice
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
577 lda P$State,x get current state of the process
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
578 ora <P$Signal,x is there a pending signal?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
579 sta <D.Quick save quick return flag
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
580 beq AllClr if nothing's have changed, do full checks
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
581
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
582 DoFull bsr L02DA move the stack frame back to user state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
583 lbra L0D80 go back to the process
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
584
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
585 * add ldu P$SP,x, etc...
1240
cd2122359eb9 Removed extraneous jmp D.Crash from os9p2.asm
boisy
parents: 1239
diff changeset
586 AllClr equ *
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
587 IFNE H6309
1240
cd2122359eb9 Removed extraneous jmp D.Crash from os9p2.asm
boisy
parents: 1239
diff changeset
588 inc <D.QCnt
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
589 aim #$1F,<D.QCnt
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
590 beq DoFull every 32 system calls, do the full check
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
591 ldw #R$Size --- size of the register stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
592 ldy #Where+SWIStack --- to stack at top of memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
593 orcc #IntMasks
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
594 tfm u+,y+ --- move the stack to the top of memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
595 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
596 lda <D.QCnt
1240
cd2122359eb9 Removed extraneous jmp D.Crash from os9p2.asm
boisy
parents: 1239
diff changeset
597 inca
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
598 anda #$1F
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
599 sta <D.QCnt
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
600 beq DoFull
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
601 ldb #R$Size
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
602 ldy #Where+SWIStack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
603 orcc #IntMasks
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
604 Loop4 lda ,u+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
605 sta ,y+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
606 decb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
607 bne Loop4
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
608 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
609 lbra BackTo1 otherwise simply return to the user
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
610
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
611 * Copy register stack from user to system
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
612 * Entry: U=Ptr to Register stack in process dsc
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
613 L02CB pshs cc,x,y,u preserve registers
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
614 ldb P$Task,x get task #
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
615 ldx P$SP,x get stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
616 lbsr L0BF3 calculate block offset (only affects A&X)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
617 leax -$6000,x adjust pointer to where memory map will be
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
618 bra L02E9 go copy it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
619
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
620 * Copy register stack from system to user
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
621 * Entry: U=Ptr to Register stack in process dsc
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
622 L02DA pshs cc,x,y,u preserve registers
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
623 ldb P$Task,x get task # of destination
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
624 ldx P$SP,x get stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
625 lbsr L0BF3 calculate block offset (only affects A&X)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
626 leax -$6000,x adjust pointer to where memory map will be
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
627 exg x,y swap pointers & copy
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
628 * Copy a register stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
629 * Entry: X=Source
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
630 * Y=Destination
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
631 * A=Offset into DAT image of stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
632 * B=Task #
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
633 L02E9 leau a,u point to block # of where stack is
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
634 lda 1,u get first block
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
635 ldb 3,u get a second just in case of overlap
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
636 orcc #IntMasks shutdown interupts while we do this
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
637 std >$FFA5 map blocks in
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
638 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
639 ldw #R$Size get size of register stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
640 tfm x+,y+ copy it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
641 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
642 ldb #R$Size
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
643 Loop5 lda ,x+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
644 sta ,y+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
645 decb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
646 bne Loop5
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
647 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
648 ldx <D.SysDAT remap the blocks we took out
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
649 lda $0B,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
650 ldb $0D,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
651 std >$FFA5
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
652 puls cc,x,y,u,pc restore & return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
653
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
654 * Process software interupts from system state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
655 * Entry: U=Register stack pointer
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
656 SysCall leau ,s get pointer to register stack
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
657 lda <D.SSTskN Get system task # (0=SYSTEM, 1=GRFDRV)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
658 clr <D.SSTskN Force to System Process
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
659 pshs a Save the system task number
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
660 lda ,u Restore callers CC register (R$CC=$00)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
661 tfr a,cc make it current
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
662 ldx R$PC,u Get my caller's PC register
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
663 leax 1,x move PC to next position
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
664 stx R$PC,u Save my caller's updated PC register
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
665 ldy <D.SysDis get system dispatch table pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
666 bsr L033B execute system call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
667 puls a restore system state task number
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
668 lbra L0E2B return to process
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
669
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
670 * Entry: X = system call vector to jump to
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
671 Sys.Vec jmp ,x execute service call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
672
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
673 * Execute system call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
674 * Entry: B=Function call #
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
675 * Y=Function dispatch table pointer (D.SysDis or D.UsrDis)
1247
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1243
diff changeset
676 L033B
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1243
diff changeset
677 lslb is it a I/O call? (Also multiplys by 2 for offset)
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
678 bcc L0345 no, go get normal vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
679 * Execute I/O system calls
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
680 ldx IOEntry,y get IOMan vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
681 * Execute the system call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
682 L034F pshs u preserve register stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
683 jsr [D.SysVec] perform a vectored system call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
684 puls u restore pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
685 L0355 tfr cc,a move CC to A for stack update
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
686 bcc L035B go update it if no error from call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
687 stb R$B,u save error code to caller's B
1247
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1243
diff changeset
688 L035B ldb R$CC,u get callers CC, R$CC=$00
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
689 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
690 andd #$2FD0 [A]=H,N,Z,V,C [B]=E,F,I
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
691 orr b,a merge them together
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
692 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
693 anda #$2F [A]=H,N,Z,V,C
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
694 andb #$D0 [B]=E,F,I
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
695 pshs b
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
696 ora ,s+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
697 ENDC
1247
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1243
diff changeset
698 sta R$CC,u return it to caller, R$CC=$00
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
699 rts
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
700
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
701 * Execute regular system calls
1247
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1243
diff changeset
702 L0345
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1243
diff changeset
703 clra clear MSB of offset
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
704 ldx d,y get vector to call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
705 bne L034F it's initialized, go execute it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
706 comb set carry for error
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
707 ldb #E$UnkSvc get error code
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
708 bra L0355 return with it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
709
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
710 use freboot.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
711
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
712 use fssvc.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
713
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
714 use flink.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
715
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
716 use fvmodul.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
717
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
718 use ffmodul.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
719
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
720 use fprsnam.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
721
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
722 use fcmpnam.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
723
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
724 use fsrqmem.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
725
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
726 use fallram.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
727
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
728
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
729 IFNE H6309
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
730 use fdelram.asm
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
731 ENDC
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
732
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
733 use fallimg.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
734
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
735 use ffreehb.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
736
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
737 use fdatlog.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
738
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
739 use fld.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
740
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
741 IFNE H6309
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
742 use fcpymem.asm
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
743 ENDC
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
744
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
745 use fmove.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
746
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
747 use fldabx.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
748
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
749 use falltsk.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
750
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
751 use faproc.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
752
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
753 * System IRQ service routine
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
754 XIRQ ldx <D.Proc get current process pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
755 sts P$SP,x save the stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
756 lds <D.SysStk get system stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
757 ldd <D.SysSvc set system service routine to current
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
758 std <D.XSWI2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
759 ldd <D.SysIRQ set system IRQ routine to current
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
760 std <D.XIRQ
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
761 jsr [>D.SvcIRQ] execute irq service
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
762 bcc L0D5B
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
763
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
764 ldx <D.Proc get current process pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
765 ldb P$Task,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
766 ldx P$SP,x get it's stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
767
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
768 pshs u,d,cc save some registers
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
769 leau ,s point to a 'caller register stack'
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
770 lbsr L0C40 do a LDB 0,X in task B
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
771 puls u,d,cc and now A ( R$A,U ) = the CC we want
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
772
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
773 ora #IntMasks disable it's IRQ's
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
774 lbsr L0C28 save it back
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
775 L0D5B orcc #IntMasks shut down IRQ's
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
776 ldx <D.Proc get current process pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
777 tst <D.QIRQ was it a clock IRQ?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
778 lbne L0DF7 if not, do a quick return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
779
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
780 lda P$State,x Get it's state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
781 bita #TimOut Is it timed out?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
782 bne L0D7C yes, wake it up
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
783 * Update active process queue
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
784 ldu #(D.AProcQ-P$Queue) point to active process queue
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
785 ldb #Suspend get suspend flag
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
786 L0D6A ldu P$Queue,u get a active process pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
787 beq L0D78
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
788 bitb P$State,u is it suspended?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
789 bne L0D6A yes, go to next one in chain
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
790 ldb P$Prior,x get current process priority
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
791 cmpb P$Prior,u do we bump this one?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
792 blo L0D7C
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
793
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
794 L0D78 ldu P$SP,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
795 bra L0DB9
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
796
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
797 L0D7C anda #^TimOut
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
798 sta P$State,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
799
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
800 L0D80 equ *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
801 L0D83 bsr L0D11 activate next process
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
802
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
803 use fnproc.asm
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
804
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
805 * The following routines must appear no earlier than $E00 when assembled, as
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
806 * they have to always be in the vector RAM page ($FE00-$FEFF)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
807
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
808 * Default routine for D.SysIRQ
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
809 S.SysIRQ lda <D.SSTskN Get current task's GIME task # (0 or 1)
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
810 beq FastIRQ Use super-fast version for system state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
811 clr <D.SSTskN Clear out memory copy (task 0)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
812 jsr [>D.SvcIRQ] (Normally routine in Clock calling D.Poll)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
813 inc <D.SSTskN Save task # for system state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
814 lda #1 Task 1
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
815 ora <D.TINIT Merge task bit's into Shadow version
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
816 sta <D.TINIT Update shadow
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
817 sta >DAT.Task Save to GIME as well & return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
818 bra DoneIRQ Check for error and exit
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
819
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
820 FastIRQ jsr [>D.SvcIRQ] (Normally routine in Clock calling D.Poll)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
821 DoneIRQ bcc L0E28 No error on IRQ, exit
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
822 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
823 oim #IntMasks,0,s Setup RTI to shut interrupts off again
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
824 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
825 lda ,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
826 ora #IntMasks
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
827 sta ,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
828 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
829 L0E28 rti
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
830
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
831 * return from a system call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
832 L0E29 clra Force System task # to 0 (non-GRDRV)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
833 L0E2B ldx <D.SysPrc Get system process dsc. ptr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
834 lbsr TstImg check image, and F$SetTsk (PRESERVES A)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
835 orcc #IntMasks Shut interrupts off
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
836 sta <D.SSTskN Save task # for system state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
837 beq Fst2 If task 0, skip subroutine
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
838 ora <D.TINIT Merge task bit's into Shadow version
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
839 sta <D.TINIT Update shadow
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
840 sta >DAT.Task Save to GIME as well & return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
841 Fst2 leas ,u Stack ptr=U & return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
842 rti
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
843
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
844 * Switch to new process, X=Process descriptor pointer, U=Stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
845 L0E4C equ *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
846 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
847 oim #$01,<D.TINIT switch GIME shadow to user state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
848 lda <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
849 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
850 lda <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
851 ora #$01
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
852 sta <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
853 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
854 sta >DAT.Task save it to GIME
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
855 leas ,y point to new stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
856 tstb is the stack at SWISTACK?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
857 bne MyRTI no, we're doing a system-state rti
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
858
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
859 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
860 ldf #R$Size E=0 from call to L0E8D before
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
861 ldu #Where+SWIStack point to the stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
862 tfm u+,y+ move the stack from top of memory to user memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
863 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
864 ldb #R$Size
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
865 ldu #Where+SWIStack point to the stack
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
866 RtiLoop lda ,u+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
867 sta ,y+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
868 decb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
869 bne RtiLoop
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
870 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
871 MyRTI rti return from IRQ
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
872
1249
6f0cffb3ab74 Added sbca #0
boisy
parents: 1247
diff changeset
873
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
874 * Execute routine in task 1 pointed to by U
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
875 * comes from user requested SWI vectors
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
876 L0E5E equ *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
877 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
878 oim #$01,<D.TINIT switch GIME shadow to user state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
879 ldb <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
880 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
881 ldb <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
882 orb #$01
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
883 stb <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
884 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
885 stb >DAT.Task
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
886 jmp ,u
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
887
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
888 * Flip to task 1 (used by GRF/WINDInt to switch to GRFDRV) (pointed to
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
889 * by <D.Flip1). All regs are already preserved on stack for the RTI
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
890 S.Flip1 ldb #2 get Task image entry numberx2 for Grfdrv (task 1)
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
891 bsr L0E8D copy over the DAT image
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
892 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
893 oim #$01,<D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
894 lda <D.TINIT get copy of GIME Task side
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
895 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
896 lda <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
897 ora #$01
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
898 sta <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
899 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
900 sta >DAT.Task save it to GIME register
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
901 inc <D.SSTskN increment system state task number
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
902 rti return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
903
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
904 * Setup MMU in task 1, B=Task # to swap to, shifted left 1 bit
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
905 L0E8D cmpb <D.Task1N are we going back to the same task
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
906 beq L0EA3 without the DAT image changing?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
907 stb <D.Task1N nope, save current task in map type 1
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
908 ldx #$FFA8 get MMU start register for process's
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
909 ldu <D.TskIPt get task image pointer table
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
910 ldu b,u get address of DAT image
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
911 L0E93 leau 1,u point to actual MMU block
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
912 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
913 lde #4 get # banks/2 for task
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
914 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
915 lda #4
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
916 pshs a
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
917 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
918 L0E9B lda ,u++ get a bank
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
919 ldb ,u++ and next one
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
920 std ,x++ Save it to MMU
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
921 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
922 dece done?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
923 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
924 dec ,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
925 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
926 bne L0E9B no, keep going
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
927 IFEQ H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
928 leas 1,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
929 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
930 L0EA3 rts return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
931
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
932 * Execute SWI3 vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
933 * Execute FIRQ vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
934 FIRQVCT ldx #D.FIRQ get DP offset of vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
935 bra L0EB8 go execute it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
936
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
937 * Execute IRQ vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
938 IRQVCT orcc #IntMasks disasble IRQ's
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
939 ldx #D.IRQ get DP offset of vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
940 * Execute interrupt vector, B=DP Vector offset
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
941 L0EB8 clra (faster than CLR >$xxxx)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
942 sta >DAT.Task Force to Task 0 (system state)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
943 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
944 tfr 0,dp setup DP
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
945 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
946 tfr a,dp
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
947 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
948 MapGrf equ *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
949 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
950 aim #$fe,<D.TINIT switch GIME shadow to system state
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
951 lda <D.TINIT set GIME again just in case timer is used
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
952 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
953 lda <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
954 anda #$FE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
955 sta <D.TINIT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
956 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
957 MapT0 sta >DAT.Task
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
958 jmp [,x] execute it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
959
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
960 SWI3VCT orcc #IntMasks disable IRQ's
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
961 ldx #D.SWI3 get DP offset of vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
962 bra SWICall go execute it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
963
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
964 * Execute SWI2 vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
965 SWI2VCT orcc #IntMasks disasble IRQ's
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
966 ldx #D.SWI2 get DP offset of vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
967
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
968 * saves 1 cycle on system-system calls
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
969 * saves about 200 cycles (calls to I.LDABX and L029E) on grfdrv-system,
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
970 * or user-system calls.
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
971 SWICall ldb [R$PC,s] --- get callcode of the system call
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
972 clr >DAT.Task go to map type 1
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
973 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
974 tfr 0,dp set DP to zero
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
975 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
976 clra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
977 tfr a,dp
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
978 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
979
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
980 * These lines add a total of 81 addition cycles to each SWI(2,3) call,
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
981 * and 36 bytes+12 for R$Size in the constant page at $FExx
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
982 * It takes no more time for a SWI(2,3) from system state than previously,
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
983 * ... and adds 14 cycles to each SWI(2,3) call from grfdrv... not a problem.
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
984 * For processes that re-vector SWI, SWI3, it adds 81 cycles. BUT SWI(3)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
985 * CANNOT be vectored to L0EBF cause the user SWI service routine has been
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
986 * changed
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
987 lda <D.TINIT get map type flag
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
988 bita #$01 check it without changing it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
989
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
990 * Change to LBEQ R.SysSvc to avoid JMP [,X]
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
991 * and add R.SysSvc STA >DAT.Task ???
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
992 beq MapT0 in map 0: restore hardware and do system service
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
993 tst <D.SSTskN get system state 0,1
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
994 bne MapGrf if in grfdrv, go to map 0 and do system service
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
995
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
996 * the preceding few lines are necessary, as all SWI's still pass thru
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
997 * here before being vectored to the system service routine... which
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
998 * doesn't copy the stack from user state.
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
999 sta >DAT.Task go to map type X again to get user's stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1000 * a byte less, a cycle more than ldy #$FEED-R$Size, or ldy #$F000+SWIStack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1001 leay <SWIStack,pc where to put the register stack: to $FEDF
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1002 tfr s,u get a copy of where the stack is
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1003 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1004 ldw #R$Size get the size of the stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1005 tfm u+,y+ move the stack to the top of memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1006 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1007 pshs b
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1008 ldb #R$Size
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1009 Looper lda ,u+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1010 sta ,y+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1011 decb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1012 bne Looper
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1013 puls b
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1014 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1015 bra L0EB8 and go from map type 1 to map type 0
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1016
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1017 * Execute SWI vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1018 SWIVCT ldx #D.SWI get DP offset of vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1019 bra SWICall go execute it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1020
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1021 * Execute NMI vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1022 NMIVCT ldx #D.NMI get DP offset of vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1023 bra L0EB8 go execute it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1024
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1025 emod
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1026 eom equ *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1027
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1028 *SWIStack fcc /REGISTER STACK/ R$Size data bytes
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
1029 SWIStack fcb $88,$03,$00
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
1030 IFNE H6309
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
1031 fcb $45,$72
1146
1b6a7fd01282 More Changes
boisy
parents: 1145
diff changeset
1032 ENDC
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
1033 fcb $00,$cd,$00,$12,$00,$00,$00,$e5,$7f
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1034
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1035 fcb $55 D.ErrRst
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1036
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1037 * Now bra instead of lbra since 2 cycles/interrupt faster
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1038 bra SWI3VCT SWI3 vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1039 nop
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1040 bra SWI2VCT SWI2 vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1041 nop
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1042 bra FIRQVCT FIRQ vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1043 nop
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1044 bra IRQVCT IRQ vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1045 nop
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1046 bra SWIVCT SWI vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1047 nop
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1048 bra NMIVCT NMI vector
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1049 nop
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1050
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1051 end
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
1052