A82: Help
[Prev][Next][Index][Thread]
A82: Help
I am having a most terrible time working the kinks out of this file detection routine. There's something wrong with this
and I just can't figure out what it is. Somebody, anybody, please take a look at this and see if you can figure out what
is wrong. Thanks.
ld hl,VAT_START ; $FE6E
ld ix,files ; ix -> area to store addresses
SearchLoop:
ld a,(hl) ; Save type
dec hl ; Get past type byte
ld c,6
sub c \ jr z,FoundProgram ; Type 6 == edit-locked program
inc a \ jr z,FoundProgram ; Type 5 == regular program
SkipName:
sbc hl,bc ; Skip c bytes
ld de,(VAT_END_ADDR) ; End of program table - 1
inc de
call CP_HL_DE \ jr c,SearchDone
jr SearchLoop
FoundProgram:
ld e,(hl)
dec hl
ld d,(hl) ; de -> program data
ex de,hl ; Save hl in de, hl -> program data
inc hl \ inc hl ; Skip program length
ld a,(hl)
inc a \ jr nz,KeepSearching ; Is first byte $FF?
inc hl
ld a,(hl)
or a \ jr nz,KeepSearching ; Is second byte $00?
inc hl ; This one's a keeper!
ld (ix),l ; Store address of program data to
inc ix ; memory in LSB order
ld (ix),h
inc ix ; Point to address for next entry
ld hl,num_files
inc (hl) ; Increase number of files found
KeepSearching:
ex de,hl ; Restore pointer
dec hl ; Point to namelength byte
ld c,(hl) ; Save namelength
inc c ; Inc so we skip that byte too
jr SkipName
SearchDone:
-Kouri
http://pages.hotbot.com/edu/kouri
Follow-Ups: