diff options
-rw-r--r-- | home.asm | 30 | ||||
-rwxr-xr-x | home/compare.asm | 35 |
2 files changed, 36 insertions, 29 deletions
@@ -212,35 +212,7 @@ CallPointerAt:: ret INCLUDE "home/queue_script.asm" - -Function3431:: -.asm_3431 - ld a, [de] - cp [hl] - ret nz - inc de - inc hl - dec c - jr nz, .asm_3431 - ret - -Function343a:: -.asm_343a - ld a, [de] - cp [hl] - jr nz, .asm_3447 - inc de - inc hl - dec bc - ld a, b - or c - jr nz, .asm_343a - scf - ret - -.asm_3447 - and a - ret +INCLUDE "home/compare.asm" ClearBGPalettes:: call ClearPalettes diff --git a/home/compare.asm b/home/compare.asm new file mode 100755 index 00000000..bd665ef4 --- /dev/null +++ b/home/compare.asm @@ -0,0 +1,35 @@ +CompareBytes:: +; Compare c bytes at de and hl. +; Return z if they all match. +.loop + ld a, [de] + cp [hl] + ret nz + inc de + inc hl + dec c + jr nz, .loop + ret + +CompareBytesLong:: +; Compare bc bytes at de and hl. +; Return carry if they all match. +.loop + ld a, [de] + cp [hl] + jr nz, .diff + + inc de + inc hl + dec bc + + ld a, b + or c + jr nz, .loop + + scf + ret + +.diff: + and a + ret
\ No newline at end of file |