summaryrefslogtreecommitdiff
path: root/engine/math/math.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-08-25 22:58:26 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2018-08-25 22:58:26 -0400
commit296402bd31946455c500fd524b141c18cf73cf8c (patch)
tree76de873943a8982f8ee6488449ea43f2e3a72326 /engine/math/math.asm
parent4c8c5c10a8c7619cfadf68072f2c52ae0e724386 (diff)
_Divide results go in hQuotient and hRemainder, not in hDividend and hDivisor
Note that the result quotient is four bytes, but hQuotient is a three-byte buffer. This is because no Divide caller ever needed a four-byte quotient, so the buffer didn't include the high byte.
Diffstat (limited to 'engine/math/math.asm')
-rw-r--r--engine/math/math.asm10
1 files changed, 5 insertions, 5 deletions
diff --git a/engine/math/math.asm b/engine/math/math.asm
index 18aa042ed..f06b5488a 100644
--- a/engine/math/math.asm
+++ b/engine/math/math.asm
@@ -172,18 +172,18 @@ _Divide::
.done
ldh a, [hDividend + 1]
- ldh [hDivisor], a
+ ldh [hRemainder], a
ldh a, [hMathBuffer + 4]
- ldh [hDividend + 3], a
+ ldh [hQuotient + 2], a
ldh a, [hMathBuffer + 3]
- ldh [hDividend + 2], a
+ ldh [hQuotient + 1], a
ldh a, [hMathBuffer + 2]
- ldh [hDividend + 1], a
+ ldh [hQuotient + 0], a
ldh a, [hMathBuffer + 1]
- ldh [hDividend + 0], a
+ ldh [hQuotient - 1], a
ret