annotate level2/modules/kernel/ccbkrn.asm @ 3195:6eb2edad80d8

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