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