Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;===============================================================
- ChkFindVar:
- ;===============================================================
- ;Inputs:
- ; OP1 contains the var name to search for
- ;Outputs:
- ; A is the type
- ; B is the flashpage
- ; C is the name length
- ; DE points to the size bytes
- ; HL points to the symentry
- ;===============================================================
- ld de,8478h
- ChkFindVarAtDE:
- ld bc,9
- ld a,(de)
- and 1Fh
- ld (de),a
- ld hl,OP2-1
- cp 5
- jr nz,$+4
- ld (hl),6
- cp 6
- jr nz,$+4
- ld (hl),5
- ex de,hl
- ld a,b
- push hl
- cpir
- jr z,$+3
- dec c
- ld a,7
- sub c
- ld (OP2-2),a
- pop hl
- rst 10h
- ld hl,(9830h)
- CompareOverLoop:
- ld de,8478h
- CompareLoop:
- ld bc,(982Eh)
- or a
- sbc hl,bc
- add hl,bc
- ccf
- ret z
- ld a,(de)
- ld bc,-6
- cp (hl)
- jr z,TypeMatch
- ld a,(OP2-1)
- cp (hl)
- jr z,TypeMatch
- add hl,bc
- ld c,(hl)
- inc c
- inc b
- or a
- sbc hl,bc
- jr CompareLoop
- NotMatch:
- pop af
- or a
- sbc hl,bc
- jr CompareOverLoop
- TypeMatch:
- add hl,bc
- push hl
- ld a,(OP2-2)
- ld c,(hl)
- dec hl
- inc b
- cp c
- jr nz,NotMatch
- inc de
- CompareName:
- ld a,(de)
- inc de
- cpd
- jr nz,NotMatch
- jp pe,CompareName
- FoundVar:
- pop hl
- ld c,(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