summaryrefslogtreecommitdiff
path: root/home/tables.asm
blob: dc0a7a2c253b477cfb1763cb535ff368ffb3f743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
INCLUDE "constants.asm"
	
SECTION "FindItemInTable", ROM0[$35F8]

; find value a from table hl with row length de
; returns carry and row index b if successful

FindItemInTable: ; 00:35F8
	ld b, 0
	ld c, a
	
.nextItem
	ld a, [hl]
	cp $FF
	jr z, .fail
	cp c
	jr z, .success
	inc b
	add hl, de
	jr .nextItem
	
.fail
	and a
	ret
	
.success
	scf
	ret