Hello everyone! I have been having some trouble with the old iondetect routine, and attempting to have it detect AppVars. It seems that the structure of the two are the same, so I am at a loss as to way iondetect is unable to find AppVars. I imagine that it has something to do with the header of the AppVar, but I am a little unsure as to what it could actually be.
Code:
External Appvar data:
Code:
Does anyone have any ideas on why this is occurring? Anything would help!
Code:
; Setup Stuff
; More code
ld ix,Detection_String
ld hl,(progptr)
call detect
ret
detect:
ld de,(ptemp)
bcall(_cphlde)
ld a,(hl)
jr nz,detectContinue
inc a
ret
detectContinue:
push hl
and $01
jr nz,detectSkip
dec hl
dec hl
dec hl ; hl->lsb ptr
ld e,(hl)
dec hl
ld d,(hl)
dec hl ; hl->page
ld a,(hl)
or a
push af
ld h,d
ld l,e ; hl & de->program
jr z,detectNoMove
push hl
bcall(_memfree)
ld bc,64
sbc hl,bc
pop hl
jr c,detectNotEnough
ld de,($9820)
push ix
push hl
push de
bcall(_flashToRam)
pop hl
push hl
pop ix
ld a,10
add a,(ix+9)
ld e,a
ld d,0 ; de=flash offset
add hl,de
ex (sp),hl
add hl,de
pop de
ex de,hl ; hl-temp, de-perm
pop ix
detectNoMove:
inc de
inc de
ld c,(hl)
inc hl
ld b,(hl)
inc hl ; hl->data in ram
push bc
push ix
pop bc
detectCheck:
ld a,(bc)
or a
jr z,detectFound
cp (hl)
inc bc
inc de
inc hl
jr z,detectCheck
detectBad:
pop bc
detectNotEnough:
pop af
detectSkip:
pop hl
ld bc,-6
add hl,bc
ld b,(hl)
dec hl
detectNameLoop2:
dec hl
djnz detectNameLoop2
jr detect
detectFound:
pop hl
; hl=size, de->data
pop af ; a=page, f=(or a)
jr z,detectInRam
push de ; data
push af
push hl
bcall(_enoughRam)
pop bc
jr c,detectBad
pop af
pop hl
ld de,($9820) ; tempMem
push de
bcall(_flashToRam)
pop de
detectInRam: ; de->data in RAM
pop hl ; hl->vat location
ld bc,-6
add hl,bc
ld b,(hl)
inc b
detectNameLoop1:
dec hl
djnz detectNameLoop1
ex de,hl
xor a
ret
Detection_String:
.db "Test",0
External Appvar data:
Code:
.db "Test"
;Data
Does anyone have any ideas on why this is occurring? Anything would help!