A82: Re: Help


[Prev][Next][Index][Thread]

A82: Re: Help




Well I seem to be having a much better time with this one, although it won't detect text files sent after you send a
bunch of other variables to the calc. The problem was I wasn't masking out the upper 3 bits of the type byte, and I
guess that causes TxtView to mis-identify certain variables. I'm surprised it still worked even a little bit. Anyway,
there's still the problem of not being able to detect progs sent after other vars, if anybody has a clue about this then
I'd be glad to hear it.


 ld hl,VAT_START  ; $FE6E
 ld ix,files   ; ix -> area to store addresses

SearchLoop:
 ld a,(hl)   ; Save type
 and 00011111b   ; Mask out upper bits
 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 ($8D12)
 inc de
 call CP_HL_DE \ jr c,SearchDone
 jr SearchLoop

FoundProgram:
 dec hl \ ld e,(hl)  ; Get past type byte
 dec hl \ ld d,(hl)  ; de -> program data
 dec hl \ ld c,(hl)  ; Save namelength
 inc c    ; Inc so we skip that byte too
 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 \ inc ix  ; Store address of program data
 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
 jr SkipName

SearchDone:



References: