Code: Select all
.define BasicPC $965D
.define BasicStart $965B
.define BasicEnd $965F
Main
bcall(_AnsName)
bcall(_CkOP1Real)
cp StrngObj
jr nz,Search
bcall(_RclVarSym)
ex de,hl
ld e,(hl) ;ans is a string so try to jump
inc hl
ld d,0
inc hl
ex de,hl
ld a,e
ld hl,savesscreen
jumploop:
cp (hl)
jr z,foundmsb
inc hl
inc hl
inc hl
inc hl
jr jumploop
foundmsb:
ld a,d
inc hl
cp (hl)
jr z,foundlbl
inc hl
inc hl
inc hl
ld a,e
jr jumploop
foundlbl:
inc hl
ld d,(hl)
inc hl
ld e,(hl)
ld (BasicPC),de
ret
Search:
ld ix,BasicEnd ;BASIC end
ld l,(ix)
inc ix ;}load hl with basic-end
ld h,(ix)
ld ix,BasicStart ;BASIC start
ld c,(ix)
inc ix ;}load bc with basic-start
ld b,(ix)
push bc
SCF
CCF
sbc hl,bc ;hl is now the length (end - start)
push hl
pop bc ;length of basic prog in bc
pop hl ;begin of basic prog in hl
ld a,tLbl ;compare with tLbl
ld de,savesscreen ;destination
searchloop:
cpir ;search untill end-of-prog or Lbl encountered
ret nz ;end reached
ldi
ldi ;save 2 tokens: label name1+name2
push de
pop ix
ld (ix),h
inc ix ;token 1, token 2, h, l, next label
ld (ix),l
inc de
inc de
jr searchloop
i dont see what's wrong with it (well, i do, but those arent things that would stop it from working..)
could someone check it please?