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