mirror of
https://github.com/mgcaret/rom4x.git
synced 2024-09-27 02:55:09 +00:00
add block counter safety check to config finder
This commit is contained in:
parent
fdbb458ec6
commit
ea801bed1f
@ -92,30 +92,33 @@ msg1 = *
|
||||
.byte $04,$2e,"6 Boot Int. 5.25"
|
||||
.byte $04,$ae,"7 Boot Ext. 5.25"
|
||||
.byte $07,$5f,"By M.G."
|
||||
msg2: .byte $07,$db,"ROM 4X 04/08/17"
|
||||
msg2: .byte $07,$db,"ROM 4X 05/27/17"
|
||||
.byte $05,$ae,$00 ; cursor pos in menu
|
||||
msg3: .byte $05,$b0,"SURE? ",$00
|
||||
|
||||
; Boot4X - the boot portion of the program
|
||||
.assert * < boot4x, warning, .sprintf("Boot4X overrun! * = %x, > %x", *, boot4x)
|
||||
.res boot4x - *, 0
|
||||
.org boot4x
|
||||
jsr gobanner ; "Apple //c"
|
||||
jsr rdrecov ; try to recover ramdisk
|
||||
lda power2 + rx_mslot ; get action saved by reset4x
|
||||
beq :+
|
||||
beq :+ ; unset, go look for config on ram card
|
||||
pha ; save it
|
||||
bra selboot ; set, go do it
|
||||
: lda numbanks,y ; (y should be OK here) ram card present?
|
||||
bra selboot ; now go do it
|
||||
: lda numbanks,y ; (y should be set in rdrecov) ram card present?
|
||||
beq boot6 ; nope, boot slot 6
|
||||
jsr getcfg ; try to get config
|
||||
bcs boot4 ; no config, normal boot
|
||||
;stx $7d2
|
||||
;sty $7d3
|
||||
phx ; config present, move on
|
||||
phx ; config present, save it and move on
|
||||
lda #'C' ; tell user
|
||||
sta $7d1 ; on screen
|
||||
selboot: ldx #(msg2-msg1) ; short banner offset
|
||||
jsr disp ; display it
|
||||
pla ; boot selection
|
||||
sta $7d2
|
||||
pla ; get boot selection from stack
|
||||
;sta $7d2
|
||||
btc2: cmp #$02 ; clear ramcard
|
||||
bne btc3
|
||||
jsr rdclear ; do clear
|
||||
@ -231,10 +234,11 @@ bt4xend = *
|
||||
chktype = $06 ; 'BIN' - easy to set auxtype with bsave
|
||||
entbuf = $0280
|
||||
; zp locs, safe to use under our circumstances
|
||||
blkptrl = $06
|
||||
blkptrl = $06 ; block we are going to read
|
||||
blkptrh = blkptrl + 1
|
||||
entryl = $08
|
||||
nentries = $09
|
||||
entryl = $08 ; length of an entry
|
||||
nentries = $09 ; number of entries per block
|
||||
blkcnt = $0a ; block counter for safety
|
||||
.proc getcfg
|
||||
jsr rdinit
|
||||
lda #$02 ; first block of volume directory
|
||||
@ -255,7 +259,8 @@ bt4xend = *
|
||||
cmp #$f0 ; storage type is $f?
|
||||
bne nocfg ; nope, eom
|
||||
lda #$23 ; offset of directory entry length in block
|
||||
sta addrl,x
|
||||
sta blkcnt ; may as well use this for the safety check
|
||||
sta addrl,x ; set data pointer
|
||||
lda data,x ; grab entry length
|
||||
sta entryl ; save it
|
||||
ldy data,x ; entries per block
|
||||
@ -263,6 +268,8 @@ bt4xend = *
|
||||
bra nxtbl1 ; skip setting slinky block and nentries, already there
|
||||
nxtblk: jsr setblk
|
||||
beq nocfg ; just set block 0, eom
|
||||
dec blkcnt ; decrease safety counter
|
||||
beq nocfg ; and if we hit zero, bail out
|
||||
ldy nentries ; restore # entries per block+1 into y
|
||||
nxtbl1: jsr gnxtblk ; set next block pointer, leave data ptr at offset $04
|
||||
nxtent: dey ; next entry, assumes y has # of entries remaining to check
|
||||
|
Loading…
Reference in New Issue
Block a user