Mercurial > hg > Members > kono > nitros9-code
comparison level1/cmds/cobbler.asm @ 924:c155aac72190
Made cosmetic changes
author | boisy |
---|---|
date | Sun, 19 Jan 2003 14:54:09 +0000 |
parents | 617c1b90e623 |
children | 636cabe76c6e |
comparison
equal
deleted
inserted
replaced
923:840aa54d6f45 | 924:c155aac72190 |
---|---|
12 nam Cobbler | 12 nam Cobbler |
13 ttl Write OS9Boot to a disk | 13 ttl Write OS9Boot to a disk |
14 | 14 |
15 * Disassembled 02/07/06 13:08:41 by Disasm v1.6 (C) 1988 by RML | 15 * Disassembled 02/07/06 13:08:41 by Disasm v1.6 (C) 1988 by RML |
16 | 16 |
17 ifp1 | 17 IFP1 |
18 use defsfile | 18 use defsfile |
19 use rbfdefs | 19 use rbfdefs |
20 endc | 20 ENDC |
21 | 21 |
22 DOHELP set 0 | 22 DOHELP set 0 |
23 | 23 |
24 tylg set Prgrm+Objct | 24 tylg set Prgrm+Objct |
25 atrv set ReEnt+rev | 25 atrv set ReEnt+rev |
29 os9l1start equ $EF00 | 29 os9l1start equ $EF00 |
30 os9l1size equ $0F80 | 30 os9l1size equ $0F80 |
31 | 31 |
32 mod eom,name,tylg,atrv,start,size | 32 mod eom,name,tylg,atrv,start,size |
33 | 33 |
34 LSN0Buff rmb 26 | 34 org 0 |
35 NewBPath rmb 1 | 35 lsn0buff rmb 26 |
36 DevPath rmb 3 | 36 newbpath rmb 1 |
37 devpath rmb 3 | |
37 u001E rmb 2 | 38 u001E rmb 2 |
38 FullBName rmb 20 this buffer hodls the entire name (i.e. /D0/OS9Boot) | 39 fullbnam rmb 20 this buffer hodls the entire name (i.e. /D0/OS9Boot) |
39 u0034 rmb 16 | 40 u0034 rmb 16 |
40 u0044 rmb 7 | 41 u0044 rmb 7 |
41 u004B rmb 2 | 42 u004B rmb 2 |
42 u004D rmb 1 | 43 u004D rmb 1 |
43 u004E rmb 16 | 44 u004E rmb 16 |
44 PathOpts rmb 20 | 45 pathopts rmb 20 |
45 u0072 rmb 2 | 46 u0072 rmb 2 |
46 u0074 rmb 10 | 47 u0074 rmb 10 |
47 BFFDBuf rmb 16 | 48 bffdbuf rmb 16 |
48 u008E rmb 1 | 49 u008E rmb 1 |
49 u008F rmb 7 | 50 u008F rmb 7 |
50 u0096 rmb 232 | 51 u0096 rmb 232 |
51 BitMBuf rmb 1024 | 52 bitmbuf rmb 1024 |
52 ifgt Level-1 | 53 IFGT Level-1 |
53 u057E rmb 76 | 54 u057E rmb 76 |
54 u05CA rmb 8316 | 55 u05CA rmb 8316 |
55 endc | 56 ENDC |
56 size equ . | 57 size equ . |
57 | 58 |
58 name fcs /Cobbler/ | 59 name fcs /Cobbler/ |
59 fcb edition | 60 fcb edition |
60 | 61 |
82 fcc "not rewritten." | 83 fcc "not rewritten." |
83 fcb C$CR | 84 fcb C$CR |
84 BootFrag fcb C$LF | 85 BootFrag fcb C$LF |
85 fcc "Error - OS9boot file fragmented" | 86 fcc "Error - OS9boot file fragmented" |
86 fcb C$CR | 87 fcb C$CR |
87 ifgt Level-1 | 88 IFGT Level-1 |
88 RelMsg fcb C$LF | 89 RelMsg fcb C$LF |
89 fcc "Error - can't link to Rel module" | 90 fcc "Error - can't link to Rel module" |
90 fcb C$CR | 91 fcb C$CR |
91 endc | 92 ENDC |
92 BootName fcc "OS9Boot " | 93 BootName fcc "OS9Boot " |
93 fcb $FF | 94 fcb $FF |
94 RelNam fcc "Rel" | 95 RelNam fcc "Rel" |
95 fcb $FF | 96 fcb $FF |
96 | 97 |
101 os9 F$PrsNam | 102 os9 F$PrsNam |
102 lbcs ShowHelp | 103 lbcs ShowHelp |
103 lda #PDELIM | 104 lda #PDELIM |
104 cmpa ,y | 105 cmpa ,y |
105 lbeq ShowHelp | 106 lbeq ShowHelp |
106 leay <FullBName,u | 107 leay <fullbnam,u |
107 L013C sta ,y+ | 108 L013C sta ,y+ |
108 lda ,x+ | 109 lda ,x+ |
109 decb | 110 decb |
110 bpl L013C | 111 bpl L013C |
111 sty <u001E | 112 sty <u001E |
112 lda #PENTIR | 113 lda #PENTIR |
113 ldb #C$SPAC | 114 ldb #C$SPAC |
114 std ,y++ | 115 std ,y++ |
115 leax <FullBName,u | 116 leax <fullbnam,u |
116 lda #UPDAT. | 117 lda #UPDAT. |
117 os9 I$Open | 118 os9 I$Open |
118 sta <DevPath | 119 sta <devpath |
119 lbcs ShowHelp | 120 lbcs ShowHelp |
120 ldx <u001E | 121 ldx <u001E |
121 leay >BootName,pcr | 122 leay >BootName,pcr |
122 lda #PDELIM | 123 lda #PDELIM |
123 L0162 sta ,x+ | 124 L0162 sta ,x+ |
126 pshs u | 127 pshs u |
127 clra | 128 clra |
128 clrb | 129 clrb |
129 tfr d,x | 130 tfr d,x |
130 tfr d,u | 131 tfr d,u |
131 lda <DevPath | 132 lda <devpath |
132 os9 I$Seek seek to 0 | 133 os9 I$Seek seek to 0 |
133 lbcs Bye | 134 lbcs Bye |
134 puls u | 135 puls u |
135 leax LSN0Buff,u | 136 leax lsn0buff,u |
136 ldy #DD.DAT $1A | 137 ldy #DD.DAT $1A |
137 lda <DevPath | 138 lda <devpath |
138 os9 I$Read read LSN0 | 139 os9 I$Read read LSN0 |
139 lbcs Bye | 140 lbcs Bye |
140 ldd <DD.BSZ get size of bootfile currently | 141 ldd <DD.BSZ get size of bootfile currently |
141 beq L019F branch if none | 142 beq L019F branch if none |
142 leax <FullBName,u | 143 leax <fullbnam,u |
143 os9 I$Delete delete existing bootfile | 144 os9 I$Delete delete existing bootfile |
144 clra | 145 clra |
145 clrb | 146 clrb |
146 sta <DD.BT | 147 sta <DD.BT |
147 std <DD.BT+1 | 148 std <DD.BT+1 |
148 std <DD.BSZ | 149 std <DD.BSZ |
149 lbsr WriteLSN0 | 150 lbsr WriteLSN0 |
150 L019F lda #WRITE. | 151 L019F lda #WRITE. |
151 ldb #READ.+WRITE. | 152 ldb #READ.+WRITE. |
152 leax <FullBName,u | 153 leax <fullbnam,u |
153 os9 I$Create create new bootfile | 154 os9 I$Create create new bootfile |
154 sta <NewBPath | 155 sta <newbpath |
155 lbcs Bye branch if error | 156 lbcs Bye branch if error |
156 | 157 |
157 ifgt Level-1 | 158 IFGT Level-1 |
158 * OS-9 Level Two: Copy first 90 bytes of system direct page into our space | 159 * OS-9 Level Two: Copy first 90 bytes of system direct page into our space |
159 * so we can figure out boot location and size, then copy to our space | 160 * so we can figure out boot location and size, then copy to our space |
160 leax >L0015,pcr | 161 leax >L0015,pcr |
161 tfr x,d | 162 tfr x,d |
162 ldx #$0000 | 163 ldx #$0000 |
194 os9 F$CpyMem | 195 os9 F$CpyMem |
195 lbcs Bye | 196 lbcs Bye |
196 puls u | 197 puls u |
197 ldy ,s | 198 ldy ,s |
198 leax >u057E,u | 199 leax >u057E,u |
199 lda <NewBPath | 200 lda <newbpath |
200 os9 I$Write | 201 os9 I$Write |
201 lbcs Bye | 202 lbcs Bye |
202 puls b,a | 203 puls b,a |
203 ldy $02,s | 204 ldy $02,s |
204 leay d,y | 205 leay d,y |
210 leay d,y | 211 leay d,y |
211 sty ,s | 212 sty ,s |
212 bne L01F7 | 213 bne L01F7 |
213 leas $04,s | 214 leas $04,s |
214 | 215 |
215 else | 216 ELSE |
216 | 217 |
217 * OS-9 Level One: Write out bootfile | 218 * OS-9 Level One: Write out bootfile |
218 ldd >D.BTHI get bootfile size | 219 ldd >D.BTHI get bootfile size |
219 subd >D.BTLO | 220 subd >D.BTLO |
220 tfr d,y in D, tfr to Y | 221 tfr d,y in D, tfr to Y |
221 std <DD.BSZ save it | 222 std <DD.BSZ save it |
222 ldx >D.BTLO get pointer to boot in mem | 223 ldx >D.BTLO get pointer to boot in mem |
223 lda <NewBPath | 224 lda <newbpath |
224 os9 I$Write write out boot to file | 225 os9 I$Write write out boot to file |
225 lbcs Bye | 226 lbcs Bye |
226 | 227 |
227 endc | 228 ENDC |
228 | 229 |
229 leax <PathOpts,u | 230 leax <pathopts,u |
230 ldb #SS.Opt | 231 ldb #SS.Opt |
231 lda <NewBPath | 232 lda <newbpath |
232 os9 I$GetStt | 233 os9 I$GetStt |
233 lbcs Bye | 234 lbcs Bye |
234 lda <NewBPath | 235 lda <newbpath |
235 os9 I$Close | 236 os9 I$Close |
236 lbcs ShowHelp | 237 lbcs ShowHelp |
237 pshs u | 238 pshs u |
238 ldx <PathOpts+(PD.FD-PD.OPT),u | 239 ldx <pathopts+(PD.FD-PD.OPT),u |
239 lda <PathOpts+(PD.FD+2-PD.OPT),u | 240 lda <pathopts+(PD.FD+2-PD.OPT),u |
240 * Now X and A hold file descriptor sector LSN of newly created OS9Boot | 241 * Now X and A hold file descriptor sector LSN of newly created OS9Boot |
241 clrb | 242 clrb |
242 tfr d,u | 243 tfr d,u |
243 lda <DevPath | 244 lda <devpath |
244 os9 I$Seek seek to os9boot file descriptor | 245 os9 I$Seek seek to os9boot file descriptor |
245 puls u | 246 puls u |
246 lbcs Bye | 247 lbcs Bye |
247 leax <BFFDBuf,u | 248 leax <bffdbuf,u |
248 ldy #256 | 249 ldy #256 |
249 os9 I$Read read in filedes sector | 250 os9 I$Read read in filedes sector |
250 lbcs Bye | 251 lbcs Bye |
251 ldd >BFFDBuf+(FD.SEG+FDSL.S+FDSL.B),u | 252 ldd >bffdbuf+(FD.SEG+FDSL.S+FDSL.B),u |
252 lbne IsFragd branch if fragmented | 253 lbne IsFragd branch if fragmented |
253 * Get and save bootfile's LSN | 254 * Get and save bootfile's LSN |
254 ldb >BFFDBuf+(FD.SEG),u | 255 ldb >bffdbuf+(FD.SEG),u |
255 stb <DD.BT | 256 stb <DD.BT |
256 ldd >BFFDBuf+(FD.SEG+1),u | 257 ldd >bffdbuf+(FD.SEG+1),u |
257 std <DD.BT+1 | 258 std <DD.BT+1 |
258 lbsr WriteLSN0 | 259 lbsr WriteLSN0 |
259 lda #$00 | 260 lda #$00 |
260 ldb #$01 | 261 ldb #$01 |
261 lbsr Seek2LSN | 262 lbsr Seek2LSN |
262 leax >BitMBuf,u | 263 leax >bitmbuf,u |
263 ldy <DD.MAP | 264 ldy <DD.MAP |
264 lda <DevPath | 265 lda <devpath |
265 os9 I$Read read bitmap sector(s) | 266 os9 I$Read read bitmap sector(s) |
266 lbcs Bye | 267 lbcs Bye |
267 lda #$22 | 268 lda #$22 |
268 clrb | 269 clrb |
269 ldy #$0004 | 270 ldy #$0004 |
272 lda #$22 | 273 lda #$22 |
273 ldb #$00 | 274 ldb #$00 |
274 lbsr Seek2LSN | 275 lbsr Seek2LSN |
275 leax <u0044,u | 276 leax <u0044,u |
276 ldy #$0007 | 277 ldy #$0007 |
277 lda <DevPath | 278 lda <devpath |
278 os9 I$Read | 279 os9 I$Read |
279 lbcs Bye | 280 lbcs Bye |
280 leax <u0044,u | 281 leax <u0044,u |
281 ldd ,x | 282 ldd ,x |
282 cmpa #'O | 283 cmpa #'O |
306 bra L02F7 | 307 bra L02F7 |
307 | 308 |
308 L0315 clra | 309 L0315 clra |
309 ldb #$01 | 310 ldb #$01 |
310 lbsr Seek2LSN Seek to bitmap sector on disk | 311 lbsr Seek2LSN Seek to bitmap sector on disk |
311 leax >BitMBuf,u | 312 leax >bitmbuf,u |
312 ldy <DD.MAP | 313 ldy <DD.MAP |
313 lda <DevPath | 314 lda <devpath |
314 os9 I$Write write updated bitmap | 315 os9 I$Write write updated bitmap |
315 lbcs Bye | 316 lbcs Bye |
316 | 317 |
317 ifgt Level-1 | 318 IFGT Level-1 |
318 * OS-9 Level Two: Link to Rel, which brings in boot code | 319 * OS-9 Level Two: Link to Rel, which brings in boot code |
319 pshs u | 320 pshs u |
320 lda #Systm+Objct | 321 lda #Systm+Objct |
321 leax >RelNam,pcr | 322 leax >RelNam,pcr |
322 os9 F$Link | 323 os9 F$Link |
333 addd #$0001 | 334 addd #$0001 |
334 tfr d,y | 335 tfr d,y |
335 lda #$22 | 336 lda #$22 |
336 ldb #$00 | 337 ldb #$00 |
337 lbsr Seek2LSN | 338 lbsr Seek2LSN |
338 lda <DevPath | 339 lda <devpath |
339 ldx <u004B,u | 340 ldx <u004B,u |
340 | 341 |
341 else | 342 ELSE |
342 | 343 |
343 * OS-9 Level One: Write out data at $EF00 | 344 * OS-9 Level One: Write out data at $EF00 |
344 lda #$22 | 345 lda #$22 |
345 ldb #$00 | 346 ldb #$00 |
346 lbsr Seek2LSN | 347 lbsr Seek2LSN |
347 lda <DevPath | 348 lda <devpath |
348 ldx #os9l1start | 349 ldx #os9l1start |
349 ldy #os9l1size | 350 ldy #os9l1size |
350 | 351 |
351 endc | 352 ENDC |
352 | 353 |
353 os9 I$Write | 354 os9 I$Write |
354 lbcs WriteBad | 355 lbcs WriteBad |
355 os9 I$Close | 356 os9 I$Close |
356 lbcs Bye | 357 lbcs Bye |
392 | 393 |
393 L03A1 fcb $80,$40,$20,$10,$08,$04,$02,$01 | 394 L03A1 fcb $80,$40,$20,$10,$08,$04,$02,$01 |
394 | 395 |
395 L03A7 pshs y,x,b,a | 396 L03A7 pshs y,x,b,a |
396 bsr AbsLSN go get absolute LSN | 397 bsr AbsLSN go get absolute LSN |
397 leax >BitMBuf,u point X to our bitmap buffer | 398 leax >bitmbuf,u point X to our bitmap buffer |
398 bsr L038C | 399 bsr L038C |
399 sta ,-s save off | 400 sta ,-s save off |
400 bmi L03CB | 401 bmi L03CB |
401 lda ,x | 402 lda ,x |
402 sta <u004D | 403 sta <u004D |
433 L03F7 orcc #Carry | 434 L03F7 orcc #Carry |
434 L03F9 leas $01,s | 435 L03F9 leas $01,s |
435 puls pc,y,x,b,a | 436 puls pc,y,x,b,a |
436 L03FD pshs y,x,b,a | 437 L03FD pshs y,x,b,a |
437 lbsr AbsLSN get absolute LSN | 438 lbsr AbsLSN get absolute LSN |
438 leax >BitMBuf,u | 439 leax >bitmbuf,u |
439 bsr L038C | 440 bsr L038C |
440 sta ,-s | 441 sta ,-s |
441 bmi L041C | 442 bmi L041C |
442 lda ,x | 443 lda ,x |
443 L040E ora ,s | 444 L040E ora ,s |
473 clrb | 474 clrb |
474 tfr d,u | 475 tfr d,u |
475 puls b | 476 puls b |
476 clra | 477 clra |
477 tfr d,x | 478 tfr d,x |
478 lda <DevPath | 479 lda <devpath |
479 os9 I$Seek | 480 os9 I$Seek |
480 bcs WriteBad | 481 bcs WriteBad |
481 puls pc,u,y,x,b,a | 482 puls pc,u,y,x,b,a |
482 | 483 |
483 WriteLSN0 | 484 WriteLSN0 |
484 pshs u added for OS-9 Level One +BGP+ | 485 pshs u added for OS-9 Level One +BGP+ |
485 clra | 486 clra |
486 clrb | 487 clrb |
487 tfr d,x | 488 tfr d,x |
488 tfr d,u | 489 tfr d,u |
489 lda <DevPath | 490 lda <devpath |
490 os9 I$Seek Seek to LSN0 | 491 os9 I$Seek Seek to LSN0 |
491 puls u added for OS-9 Level One +BGP+ | 492 puls u added for OS-9 Level One +BGP+ |
492 leax LSN0Buff,u Point to our LSN buffer | 493 leax lsn0buff,u Point to our LSN buffer |
493 ldy #DD.DAT | 494 ldy #DD.DAT |
494 lda <DevPath | 495 lda <devpath |
495 os9 I$Write Write to disk | 496 os9 I$Write Write to disk |
496 bcs Bye branch if error | 497 bcs Bye branch if error |
497 rts | 498 rts |
498 | 499 |
499 ShowHelp equ * | 500 ShowHelp equ * |
521 | 522 |
522 TrkAlloc leax >FileWarn,pcr | 523 TrkAlloc leax >FileWarn,pcr |
523 clrb | 524 clrb |
524 bra L0477 | 525 bra L0477 |
525 | 526 |
526 ifgt Level-1 | 527 IFGT Level-1 |
527 NoRel leax >RelMsg,pcr | 528 NoRel leax >RelMsg,pcr |
528 bra L0477 | 529 bra L0477 |
529 endc | 530 ENDC |
530 | 531 |
531 emod | 532 emod |
532 eom equ * | 533 eom equ * |
533 end | 534 end |