From 2db54ecb9b2ec41dd40318395f69814af64f6f7b Mon Sep 17 00:00:00 2001 From: Rangi Date: Thu, 5 Nov 2020 13:23:57 -0500 Subject: Sync more with pokeyellow --- engine/math/bcd.asm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'engine/math/bcd.asm') diff --git a/engine/math/bcd.asm b/engine/math/bcd.asm index 1e5aedc9..92bf6f17 100644 --- a/engine/math/bcd.asm +++ b/engine/math/bcd.asm @@ -1,6 +1,9 @@ +; divide hMoney by hDivideBCDDivisor +; return output in hDivideBCDQuotient (same as hDivideBCDDivisor) +; used only to halve player money upon losing a fight DivideBCDPredef:: DivideBCDPredef2:: -DivideBCDPredef3:: +DivideBCDPredef3:: ; only used function DivideBCDPredef4:: call GetPredefRegisters @@ -40,6 +43,7 @@ DivideBCD:: and $f0 ldh [hDivideBCDDivisor+2], a jr .mulBy10Loop + .next push de push de @@ -151,8 +155,8 @@ DivideBCD_getNextDigit: pop bc ret c inc b - ld de, hMoney+2 ; since SubBCD works starting from the least significant digit - ld hl, hDivideBCDDivisor+2 + ld de, hMoney + 2 ; since SubBCD works starting from the least significant digit + ld hl, hDivideBCDDivisor + 2 push bc call SubBCD pop bc -- cgit v1.2.3 From 2a4b8b5a248065d2ef80b9960228750112f30da5 Mon Sep 17 00:00:00 2001 From: Rangi Date: Thu, 5 Nov 2020 15:17:39 -0500 Subject: Remove trailing whitespace --- engine/math/bcd.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/math/bcd.asm') diff --git a/engine/math/bcd.asm b/engine/math/bcd.asm index 92bf6f17..5747a684 100644 --- a/engine/math/bcd.asm +++ b/engine/math/bcd.asm @@ -13,7 +13,7 @@ DivideBCD:: ldh [hDivideBCDBuffer+1], a ldh [hDivideBCDBuffer+2], a ld d, $1 -.mulBy10Loop +.mulBy10Loop ; multiply the divisor by 10 until the leading digit is nonzero ; to set up the standard long division algorithm ldh a, [hDivideBCDDivisor] @@ -108,7 +108,7 @@ DivideBCD:: ldh a, [hDivideBCDBuffer+2] ldh [hDivideBCDQuotient+2], a pop de - ld a, $6 + ld a, $6 sub d and a ret z -- cgit v1.2.3