Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;**All outputs are exactly the same as rFindSym**
- ;FindVar:
- ;Inputs:
- ; OP1+1 contains the name of a symbol var. No type byte.
- ;
- ;FindVarSym(DE)
- ;Inputs:
- ; DE points to the name of a symbol var
- ;
- ;FindVarSym(HL)
- ;Inputs:
- ; HL points to the name of a symbol var
- ;
- ;SearchVarBC
- ;Inputs:
- ; BC contains the name of the var to search. For example, if BC was 00AAh, it would search for Str1. In hex it makes more sense to do it this way (in hex ld bc,00AAh is 01AA00), but you can modify the code a little to make it so that you can do ld bc,$AA00 instead
- FindSym:
- ld de,OP1+1
- FindVarSym(DE):
- ex de,hl
- FindVarSym(HL):
- ld c,(hl)
- inc hl
- ld b,(hl)
- SearchVarBC:
- ld hl,symtable-6
- SearchLoop:
- ld a,c
- cp (hl)
- dec hl
- jr nz,$+6 ;2004 is the hex code. I believe this is correct... It skips the next 4 bytes
- ld a,b
- cp (hl)
- jr z,$+16 ;280E This skips the next 14 bytes if z is set.
- ld de,-8
- add hl,de
- ex de,hl
- ld hl,(progPtr)
- sbc hl,de
- ex de,hl
- ld a,d
- or a
- ccf
- jr nz,SearchLoop ;20E7
- inc hl
- inc hl
- ld b,(hl)
- inc hl
- ld d,(hl)
- inc hl
- ld e,(hl)
- inc hl
- inc hl
- inc hl
- ld a,(hl)
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement