Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/rel.asm @ 2438:a0d17254fbb3
rfm continues
author | aaronwolfe |
---|---|
date | Thu, 25 Feb 2010 00:09:32 +0000 |
parents | 8cbd8013fe24 |
children | 6e40b043d3e0 |
rev | line source |
---|---|
1299 | 1 ******************************************************************** |
2 * REL - Relocation routine | |
3 * | |
4 * $Id$ | |
5 * | |
6 * Edt/Rev YYYY/MM/DD Modified by | |
7 * Comment | |
8 * ------------------------------------------------------------------ | |
9 * 5r5 2003/07/31 Boisy G. Pitre | |
10 * Back ported NitrOS-9 REL to OS-9 Level Two. | |
1798 | 11 * |
12 * 2004/11/09 P.Harvey-Smith | |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
13 * Added code to flip Dragon Alpha into text mode on boot. |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
14 * |
1299 | 15 |
16 nam REL | |
17 ttl Relocation routine | |
18 | |
19 IFP1 | |
20 use defsfile | |
21 ENDC | |
22 | |
23 XX.Size equ 6 number of bytes before REL actually starts | |
1309
0a04945a7c60
Fixed bug in rel.asm, changed OS-9 Level One Bt.Start to $EE00 and Bt.Size to $1080 due to increased size of boot track using DriveWire booter.
boisy
parents:
1301
diff
changeset
|
24 Offset equ Bt.Start+XX.Size |
1854 | 25 IFEQ Level-1 |
1299 | 26 ScStart equ $8000 screen start in memory |
1854 | 27 ELSE |
28 ScStart equ $8008 screen start in memory | |
29 ENDC | |
1299 | 30 |
31 tylg set Systm+Objct | |
32 atrv set ReEnt+rev | |
33 rev set $05 | |
34 edition set 5 | |
35 | |
36 ******************************************************************** | |
37 * Any changes to the next 3 lines requires changes in XX.Size, above | |
1301 | 38 fcc /OS/ sync bytes |
1299 | 39 bra Start+XX.Size execution start |
40 fdb $1205 filler bytes | |
41 | |
1301 | 42 Begin mod eom,name,tylg,atrv,start,size |
1299 | 43 |
44 org 0 | |
45 size equ . REL doesn't require any memory | |
46 | |
47 name fcs /REL/ | |
48 fcb edition | |
49 | |
1854 | 50 IFGT Level-1 |
51 | |
52 L001F fcb $6C MMU, IRQ, Vector page, SCS | |
53 fcb $00 map type 0 | |
54 fcb $00 no FIRQ | |
55 fcb $00 no IRQ | |
56 fdb $0900 timer | |
57 fcb $00 unused | |
58 fcb $00 unused | |
59 IFEQ TkPerSec-50 | |
60 fcb $0B 50Hz refresh, alphanumeric display, 8 lines/char row | |
61 ELSE | |
62 fcb $03 60Hz refresh, alphanumeric display, 8 lines/char row | |
63 ENDC | |
64 | |
65 IFEQ Width-80 | |
66 fcb $34 200 lines, 80 column mode, no attribute byte (monochrome) | |
67 fcb $3F white border | |
68 BOOTLINE set 11 80-col start line for BOOT/FAIL messages | |
69 ENDC | |
70 | |
71 IFEQ Width-40 | |
72 fcb $24 200 lines, 40-col, no attribute byte | |
73 fcb $3F white border | |
74 BOOTLINE set 13 40-col start line for BOOT/FAIL messages | |
75 ENDC | |
76 | |
77 IFEQ Width-32 | |
78 fcb $20 200 lines, 32-col, no attribute byte | |
79 fcb $00 black border | |
80 BOOTLINE set 13 32-col start line for BOOT/FAIL messages | |
81 ENDC | |
82 | |
83 fcb $00 display in lower 512k bank | |
84 fcb $00 vertical fine scroll set to 0 | |
85 fcb Bt.Block*4 display block where-ever | |
86 fcb $01 offset 8 bytes | |
87 fcb $00 no horizontal scroll | |
88 | |
89 crash lda #'* signal a crash error | |
90 jsr <D.BtBug | |
91 tfr b,a save error code | |
92 jsr <D.BtBug and dump this out, too | |
93 clrb | |
94 fcb $8C skip 2 bytes | |
95 | |
96 reset equ * later on, have reset different from start? | |
97 start ldb #$FF negative - do complete boot | |
98 clr >$FFDF added for OS-9 ROM Kit boots +BGP+ | |
99 | |
100 start1 orcc #IntMasks turn off IRQ's | |
101 clr >PIA0Base+3 turn off SAM IRQ's | |
102 clra make A=0 for later | |
103 IFNE H6309 | |
104 tfr 0,dp set direct page to $0000 | |
105 ELSE | |
106 tfr a,dp | |
107 ENDC | |
108 clr <D.CBStrt cold boot start: don't re-boot on reset | |
109 clr >$FFA0 map in block 0 | |
110 lds #$1FFF set stack to the end of the block | |
111 stb ,-s save status of start, $00=cold, $01=warm | |
112 * This is done so I can tell what went on in the direct page if there's | |
113 * a crash. 0(crash) 1(reset) -1(startup) | |
114 beq Cont --don't clear out direct page if it's a crash | |
2249 | 115 * BGP 12/24/2009: clear out ALL of direct page (even $00-$1F) |
116 * ldb #$20 start out at $20 | |
117 clrb | |
1854 | 118 tfr d,x here, too |
119 L0072 sta ,x+ clear out the direct page | |
120 incb Boot won't be using any of it! | |
121 bne L0072 BUT RAMMER/MD DOES!!! | |
122 inc <D.Speed 0+1=1; high speed | |
123 Cont clrb --make sure B=0 | |
124 stb >$FFD9 set to high speed | |
125 leay <L001F,pcr point to the video setup data | |
126 ldx #$0090 set video mapping | |
127 deca now D=$FF00, versus STU >-$0100,x (saves 1 byte) | |
128 L0084 ldu ,y++ get the bytes | |
129 stu d,x save in the hardware | |
130 stu ,x++ and in the direct page | |
131 cmpx #$00A0 end of video hardware yet? | |
132 bcs L0084 | |
133 | |
134 IFEQ Width-32 | |
135 ldd #$1200 color 0=$12, 1=$00 i.e. black on green | |
136 ELSE | |
137 ldd #$3F00 color 0=$3F, 1=$00, i.e. black on white | |
138 ENDC | |
139 std >$FFB0 set only the first two palettes, B=$00 already | |
140 lda #Bt.Block | |
141 sta >$FFA4 map in the block | |
142 | |
143 ldx #$8000 start of the block | |
144 IFNE H6309 | |
145 ldq #Bt.Flag*65536+8 | |
146 ELSE | |
147 ldd #Bt.Flag | |
148 ENDC | |
149 tst ,s check status : 0(crash) 1(reset) -1(startup) | |
150 bmi StoreQ if NOT a crash or reset, start at the start... | |
151 cmpd ,x are they the same? | |
152 beq MoveTxt don't bother clearing the screen if it's there | |
153 StoreQ | |
154 IFNE H6309 | |
155 stq ,x otherwise save the bytes on-screen | |
156 ELSE | |
157 std ,x | |
158 ldd #8 | |
159 std 2,x | |
160 ENDC | |
161 | |
162 leax 8,x point to the start of the screen in memory | |
163 IFNE H6309 | |
164 ldw #$2000-8 clear out the entire block of memory | |
165 leau <L00E0,pcr point to $20, a space | |
166 tfm u,x+ clear out the screen | |
167 ELSE | |
168 ldy #$2000-8 | |
169 ldb #$20 | |
170 ClrLoop stb ,x+ | |
171 leay -1,y | |
172 bne ClrLoop | |
173 * ldd #$2000-8 | |
174 * ldu #$2020 | |
175 *ClrLoop stu ,x++ | |
176 * subd #$0002 | |
177 * bne ClrLoop | |
178 ENDC | |
179 | |
180 MoveTxt leau <L0011,pcr point to OS-9 Welcome Message | |
181 bsr Move1 E=$00 already from TFM above... | |
182 * 0 = crash | |
183 * 1 = reset | |
184 * -1 = startup | |
185 ldb ,s+ check state of boot | |
186 bne L00E2 if OK, continue | |
187 * U=<L0019 already from TFM above (call to L00FD) | |
188 bsr Move1 move it on-screen, E=$00 already | |
189 clr >$FF40 turn off disk drives | |
190 L00E0 bra L00E0 loop forever | |
191 | |
192 Move1 ldy ,u++ get where to put the text | |
193 IFNE H6309 | |
194 Move ldf ,u+ get the size of the block to move | |
195 L00FD tfm u+,y+ | |
196 ELSE | |
197 Move clra | |
198 ldb ,u+ | |
199 tfr d,x | |
200 L00FD lda ,u+ | |
201 sta ,y+ | |
202 leax -1,x | |
203 bne L00FD | |
204 ENDC | |
205 rts | |
206 | |
207 L0011 fdb ScStart+(BOOTLINE*Width)+((Width-L1)/2) | |
208 fcb L1 length of the text below | |
209 T1 equ * | |
210 fcc /NITROS9 BOOT/ | |
211 L1 equ *-T1 | |
212 | |
213 fdb ScStart+((BOOTLINE+2)*Width)+((Width-LFail)/2) | |
214 fcb LFail length of the 'FAILED' string | |
215 TFail fcc /FAILED/ | |
216 LFail equ *-TFail | |
217 | |
218 * saves 2 bytes over leax <L00E2,pc, cmpx #Bt.Start | |
219 L00E2 tfr pc,d get the address at which we're executing | |
220 cmpa #$26 the bootfile starts out at $2600 | |
221 bne L0101 if not at $26xx, continue with booting | |
222 ldu #$2600 else move rel, Boot, OS9p1 over | |
223 IFNE H6309 | |
224 ldw #$1200 size of track 34 boot file | |
225 ELSE | |
226 ldx #$1200 | |
227 ENDC | |
228 ldy #Bt.Start where to put it | |
229 bsr L00FD 1 byte smaller than tfm in place | |
230 jmp >Offset+L0101 | |
231 | |
232 BtDebug pshs cc,d,x save the register | |
233 orcc #IntMasks turn IRQ's off | |
234 ldb #Bt.Block block to map in | |
235 stb >$FFA0 map the boot screen into block 0 | |
236 ldx >$0002 where to put the bytes | |
237 sta ,x+ put the character on-screen | |
238 stx >$0002 save updated address | |
239 clr >$FFA0 map block 0 in again | |
240 puls cc,d,x,pc restore X and exit | |
241 | |
242 L0101 | |
243 lda #$7E RTS | |
244 sta <D.BtBug | |
245 leax <BtDebug,pc point to debug routine | |
246 stx <D.BtBug+1 | |
247 | |
248 leau <R.Crash,pcr point to D.Crash, D.CBStart | |
249 ldy #D.Crash move it over | |
250 bsr Move E=$00 from call to L00FD above. | |
251 IFNE H6309 | |
252 ldmd #$03 go to native mode, FIRQ saves all registers | |
253 inc <D.MDREG 0+1=1; set MD shadow register (clr'd from above) | |
254 ENDC | |
255 | |
256 * leax <eom,pcr point to the end of REL | |
257 * ldd M$Size,x get size of the next module | |
258 * leax d,x skip Boot, point to OS9p1 | |
259 ldx #$F000 we KNOW where OS9p1 starts in memory | |
260 ldd M$Exec,x get execution start address | |
261 jmp d,x jump to it | |
262 | |
263 * D.Crash | |
264 R.Crash fcb $10 size of the data to move over | |
265 L003F clr >$FF91 go to map type 0 - called by CC3Go from map 1 | |
266 jmp >Offset+crash | |
267 | |
268 fcb $00 warm start flag | |
269 fdb $0074 go to $0074, next routine | |
270 | |
271 * reset vector: map ROMs out and go to REL in the default DECB block map, | |
272 * which is still block $3F at the top fo memory | |
273 nop required for the ROMs to believe it's a reset vector | |
274 clr >$FFDF go to all RAM mode | |
275 jmp >Offset+reset and re-start the boot | |
276 | |
277 Pad fill $39,$127-* | |
278 | |
279 ELSE | |
280 | |
1299 | 281 start clr PIA0Base+3 |
282 | |
2040 | 283 IFNE (tano+d64+dalpha) |
1299 | 284 clr PIA0Base+1 added for Dragon, works on CoCo |
285 ENDC | |
286 | |
287 sta $FFDF turn off ROM | |
288 * locate Boot Text Screen at $8000 | |
289 ldb #$06 | |
290 ldx #$FFC6 | |
291 L262B sta ,x++ | |
292 decb | |
293 bne L262B | |
294 sta 1,x | |
295 | |
2040 | 296 IFNE dalpha |
1727
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
297 clr $ffc0 * Reset to text mode if Dragon Alpha |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
298 clr $ffc2 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
299 clr $ffc4 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
300 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
301 lda $ff22 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
302 anda #$07 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
303 sta $ff22 |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
304 ENDC |
78ce0a5ffc8e
Incorporated changes and additions made by Phill Harvey-Smith for the
boisy
parents:
1709
diff
changeset
|
305 |
1299 | 306 * Clear VDG screen |
307 ldx #ScStart | |
308 ldy #512 | |
309 lda #$60 | |
310 L263B sta ,x+ | |
311 leay -1,y | |
312 bne L263B | |
313 | |
314 * Copy "OS9 BOOT" to screen area | |
1375 | 315 ldx #ScStart+$10A |
1299 | 316 leay <BootMsg,pcr |
317 ldb #BootMLen | |
318 L2649 lda ,y+ | |
319 sta ,x+ | |
320 decb | |
321 bne L2649 | |
322 | |
2040 | 323 IFNE (tano+d64+dalpha) |
1299 | 324 tst <$72 |
325 ELSE | |
326 ldd #$1212 | |
327 cmpd <$0078 | |
328 ENDC | |
329 | |
330 beq L266E | |
1301 | 331 leau >Begin-XX.Size,pcr |
332 ldx #Bt.Size | |
1299 | 333 ldy #Bt.Start |
334 L2663 lda ,u+ | |
335 sta ,y+ | |
336 leax -1,x | |
337 bne L2663 | |
1309
0a04945a7c60
Fixed bug in rel.asm, changed OS-9 Level One Bt.Start to $EE00 and Bt.Size to $1080 due to increased size of boot track using DriveWire booter.
boisy
parents:
1301
diff
changeset
|
338 jmp >Offset+L266E |
1299 | 339 L266E leax <eom,pcr |
1301 | 340 ldd M$Exec,x |
1299 | 341 jmp d,x |
342 | |
1374 | 343 BootMsg fcc /NITROSy/ |
1299 | 344 fcb $60 |
345 fcc /BOOT/ | |
346 BootMLen equ *-BootMsg | |
347 | |
1854 | 348 ENDC |
349 | |
1299 | 350 emod |
351 eom equ * | |
352 end |