0
|
1 ********************************************************************
|
|
2 * Rel - OS-9 Level Two relocation module
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Ed. Comments Who YY/MM/DD
|
|
7 * ------------------------------------------------------------------
|
|
8 * 5 Original version by Tandy/Microware
|
|
9 * 6 Added instruction to put into ALL-RAM mode BGP 98/10/10
|
|
10 * for ROM based kernels.
|
|
11 * Added more comments from version provided by BGP 98/10/21
|
|
12 * Curtis Boyle
|
|
13
|
|
14 nam REL
|
|
15 ttl OS-9 Level Two relocation module
|
|
16
|
|
17 ifp1
|
|
18 use defsfile
|
|
19 endc
|
|
20
|
|
21 Bt.Start equ $ED00
|
|
22 ScStart equ $8000 screen start in memory
|
|
23 XX.Size equ 6 number of bytes before REL actually starts
|
|
24 Offset equ Bt.Start+XX.Size
|
|
25
|
|
26 tylg set Systm+Objct
|
|
27 atrv set ReEnt+rev
|
|
28 rev set $01
|
|
29 edition set 6
|
|
30
|
|
31 ********************************************************************
|
|
32 * Any changes to the next 3 lines requires changes in XX.Size, above
|
|
33 fcc /OS/ sync bytes
|
|
34 bra Start+XX.Size execution start
|
|
35 fdb $1205 filler bytes
|
|
36
|
|
37 mod eom,name,tylg,atrv,start,size
|
|
38
|
|
39 org 0
|
|
40 size equ . REL doesn't require any memory
|
|
41
|
|
42 name fcs /REL/
|
|
43 fcb edition
|
|
44
|
|
45 * OS-9 boot message (Setup for a 32 column screen)
|
|
46
|
|
47 BootMsg fcc /OS/
|
|
48 fcb $79
|
|
49 fcb $60
|
|
50 fcc /BOOT/
|
|
51
|
|
52 * Fail message
|
|
53
|
|
54 FailMsg fcc /FAILED/
|
|
55
|
|
56 * GIME register default values
|
|
57
|
|
58 CC3Regs fcb $EC CC2, MMU, IRQ, Vector page, SCS
|
|
59 fcb $00 map type 0
|
|
60 fcb $00 no FIRQ
|
|
61 fcb $00 no IRQ
|
|
62 fdb $0900 timer
|
|
63 fcb $00 unused
|
|
64 fcb $00 unused
|
|
65 fcb $00
|
|
66 fcb $00
|
|
67 fcb $00
|
|
68 fcb $00
|
|
69 fdb $0FE0
|
|
70 fcb $00
|
|
71 fcb $00
|
|
72
|
|
73 * Palette register default colors
|
|
74
|
|
75 DefPals fcb $12 green
|
|
76 fcb $36
|
|
77 fcb $09 blue
|
|
78 fcb $24 red
|
|
79 fcb $3F white
|
|
80 fcb $1B cyan
|
|
81 fcb $2D magenta
|
|
82 fcb $26
|
|
83 fcb $00 black
|
|
84 fcb $12 green
|
|
85 fcb $00 black
|
|
86 fcb $3F white
|
|
87 fcb $00 black
|
|
88 fcb $12 green
|
|
89 fcb $00 black
|
|
90 fcb $26
|
|
91
|
|
92 * CC crash routine (This gets moved to direct page)
|
|
93
|
|
94 CrashRtn clr >Dat.Task go to map type 0 - called by CC3Go from map 1
|
|
95 jmp >Offset+crash
|
|
96
|
|
97 * CC3 warmstart
|
|
98
|
|
99 fcb $00 warm start flag
|
|
100 fdb $0074 go to $0074, next routine
|
|
101 * reset vector: map ROMs out and go to REL in the default DECB block map,
|
|
102 * which is still block $3F at the top of memory
|
|
103 nop required for the ROMs to believe it's a reset vector
|
|
104 clr >$FFDF go to all RAM mode
|
|
105 jmp >Offset+reset and re-start the boot
|
|
106
|
|
107 crash
|
|
108 fcb $C6,$01,$20,$07,$4F
|
|
109 fcb $53,$20,$5B,$12,$05
|
|
110
|
|
111 ******************************
|
|
112 *
|
|
113 * Main entry point
|
|
114 *
|
|
115
|
|
116 reset
|
|
117 start clr $FFDF ALL RAM MODE (for ROM-based kernels) ++BGP
|
|
118 clrb
|
|
119 orcc #IntMasks turn off IRQ's
|
|
120 clr >PIA0Base+3 turn off SAM IRQ's
|
|
121 clra
|
|
122 tfr a,dp set direct page to $0000
|
|
123 sta <D.CbStrt
|
|
124 sta DAT.Regs map in block 0
|
|
125 lds #$1FFF set stack to the end of the block
|
|
126 pshs b set first byte of stack to 0
|
|
127 ldb #D.Clock get length of system direct page to initialize
|
|
128 ldx #D.Tasks get start of system direct page
|
|
129 L0072 sta ,x+ clear out the direct page
|
|
130 decb done?
|
|
131 bne L0072 no, keep going till done
|
|
132 inca
|
|
133 sta <D.Speed hi speed
|
|
134 sta >$FFD9 set to high speed
|
|
135 leau CC3Regs,pcr point to the video setup data
|
|
136 ldx #D.HINIT set video mapping
|
|
137 L0084 ldd ,u++ get the bytes
|
|
138 std -256,x save in the hardware
|
|
139 std ,x++ and in the direct page
|
|
140 cmpx #D.Speed end of video hardware yet?
|
|
141 bcs L0084
|
|
142
|
|
143 * set up palettes
|
|
144
|
|
145 leau >DefPals,pcr point to palette data
|
|
146 ldy #PalAdr point to GIME palette start
|
|
147 ldb #16 get length of data
|
|
148 bsr CopyRtn move table
|
|
149
|
|
150 lda #$3E
|
|
151 sta >$FFA4 map in the block
|
|
152 ldx #ScStart start of the block
|
|
153 clrb get length of screen
|
|
154 ldu #$6060 clear out screen mem
|
|
155 L00A9 stu ,x++ save data
|
|
156 decb done?
|
|
157 bne L00A9 no, keep going
|
|
158
|
|
159 * print 'OS9 BOOT'
|
|
160
|
|
161 ldy #ScStart+$010C get screen address for print
|
|
162 leau BootMsg,pcr point to boot message
|
|
163 ldb #8 get length of data
|
|
164 bsr CopyRtn print it
|
|
165
|
|
166 * setup VDG hardware to point at $4000
|
|
167
|
|
168 ldb #5 get length of screen init
|
|
169 ldx #$FFC6 get start register to set up screen
|
|
170 L00BF sta ,x++ set SAM bits
|
|
171 decb done?
|
|
172 bne L00BF no, keep going
|
|
173 sta 1,x set last couple of bits
|
|
174 sta 3,x
|
|
175 ldb ,s can we continue? (first byte should be 0)
|
|
176 beq L00DD yes, continue boot
|
|
177
|
|
178 * boot failed
|
|
179
|
|
180 ldy #ScStart+$014D get screen address
|
|
181 leau >FailMsg,pcr point to 'Failed' message
|
|
182 ldb #$06 get length of data
|
|
183 bsr CopyRtn show failed message
|
|
184 clr >$FF40 shut off disk motor
|
|
185 Hang bra Hang dead loop forever
|
|
186
|
|
187 L00DD leax >L00DD,pcr get pointer to where we are in memory
|
|
188 cmpx #$ED00 warm start?
|
|
189 bcc JmpOS9P1 yep...
|
|
190 ldu #$2600 else copy at $2600...
|
|
191 ldx #$1200 $1200 bytes...
|
|
192 ldy #$ED00 ...to $ED00
|
|
193 bsr L00F8
|
|
194 jmp >Offset+JmpOS9P1 jump to OS9p1!
|
|
195
|
|
196 * Copies B bytes from ,U to ,Y
|
|
197
|
|
198 CopyRtn clra
|
|
199 tfr d,x
|
|
200 L00F8 ldb ,u+
|
|
201 stb ,y+
|
|
202 leax -1,x
|
|
203 bne L00F8
|
|
204 rts
|
|
205
|
|
206 * Setup Crash routine
|
|
207
|
|
208 JmpOS9P1 leau >CrashRtn,pcr get pointer to crash routine
|
|
209 ldb #16 get length of crash routine
|
|
210 ldy #D.Crash point to crash routine area
|
|
211 bsr CopyRtn move it
|
|
212
|
|
213 * Execute Boot module
|
|
214
|
|
215 leax <eom,pcr point to start of boot
|
|
216 ldd M$Size,x get size of Boot
|
|
217 leax d,x move past it
|
|
218 ldd M$Exec,x get execution offset to OS9p1
|
|
219 jmp d,x execute it
|
|
220
|
|
221 * Fill the rest to put Boot at proper address
|
|
222
|
518
|
223 Filler fill $39,$12A-3-*
|
0
|
224
|
|
225 emod
|
|
226 eom equ *
|
|
227 end
|