summaryrefslogtreecommitdiff
path: root/home/math.asm
blob: 2f3b408defd1f96c155f8c06e39ca7f3ab8c700f (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 "Home Math", ROM0[$341F]
else
SECTION "Home Math", 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

AddAMulBC:: ; 3429
; Returns hl + a * bc
    and a
    ret z
.loop:
    add hl, bc
    dec a
    jr nz, .loop
    ret

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