gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/libc/asm/z80/memcmp.s
1 .module strcmp
2
3 .area _HOME
4
5 ; int memcmp(const void *buf1, const void *buf2, size_t count)
6 _memcmp::
7 pop hl
8 pop de
9 pop bc
10 ex (sp), hl
11 ex de, hl
12
13 inc d
14 inc e
15 jr 3$
16
17 1$:
18 ld a,(bc)
19 sub (hl) ; s1[i]==s2[i]?
20 jr nz, 2$ ; -> Different
21
22 inc bc
23 inc hl
24 3$:
25 dec e
26 jr nz, 1$
27 dec d
28 jr nz, 1$
29
30 ld hl, #0
31 ret
32
33 2$:
34 ld hl,#1
35 ret c
36
37 ld hl,#-1
38 ret
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.