diff options
author | libjet <libj3t@gmail.com> | 2020-02-19 17:49:15 +0000 |
---|---|---|
committer | libjet <libj3t@gmail.com> | 2020-02-19 17:49:15 +0000 |
commit | 3f9061ccea0b86c07408f9f5a33a83b3dae72d22 (patch) | |
tree | 7c74ad1d658cc30e609802b83d1e175e3f77423b /home.asm | |
parent | 336fe6b368c74bb95ff0d165c1b04cda18ac1fc2 (diff) |
Add home/hp_pals.asm
Diffstat (limited to 'home.asm')
-rw-r--r-- | home.asm | 38 |
1 files changed, 14 insertions, 24 deletions
@@ -217,40 +217,30 @@ CallPointerAt:: INCLUDE "home/queue_script.asm" INCLUDE "home/compare.asm" INCLUDE "home/tilemap.asm" - -SetHPPal:: - call GetHPPal - ld [hl], d - ret - -GetHPPal:: ; 3596 (0:3596) - ld d, $0 - ld a, e - cp $18 - ret nc - inc d - cp $a - ret nc - inc d - ret +INCLUDE "home/hp_pals.asm" CountSetBits:: - ld c, $0 -.asm_35a4 +; Count the number of set bits in b bytes starting from hl. +; Return in a, c and [wNumSetBits]. + ld c, 0 +.next ld a, [hli] ld e, a - ld d, $8 -.asm_35a8 + ld d, 8 + +.count srl e - ld a, $0 + ld a, 0 adc c ld c, a dec d - jr nz, .asm_35a8 + jr nz, .count + dec b - jr nz, .asm_35a4 + jr nz, .next + ld a, c - ld [wd151], a + ld [wNumSetBits], a ret GetWeekday:: |