summaryrefslogtreecommitdiff
path: root/home/util.asm
blob: 6591da211139a913d8b9b06d1d3ac7a185a6a2e4 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
INCLUDE "constants.asm"

if DEBUG
SECTION "Misc Utility Functions", ROM0[$341F]
else
SECTION "Misc Utility Functions", ROM0[$33E3]
endc

_341F:: ; 341f
; Returns hl + a * 6
    and a
    ret z
    ld bc, 6
.loop:
    add hl, bc
    dec a
    jr nz, .loop
    ret

AddNTimes:: ; 3429 (0:3429)
	and a
	ret z
.asm_342b
	add hl, bc
	dec a
	jr nz, .asm_342b
	ret
; 0x3430

memcmp:: ; 3430
; Compare c bytes at hl and de
; Returns z if all equal, nz otherwise.
.loop:
    ld a, [de]
    cp [hl]
    ret nz
    inc de
    inc hl
    dec c
    jr nz, .loop
    ret