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