mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-01-23 09:16:20 -08:00
_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.
This commit is contained in:
parent
4c8c5c10a8
commit
296402bd31
@ -172,18 +172,18 @@ _Divide::
|
|||||||
|
|
||||||
.done
|
.done
|
||||||
ldh a, [hDividend + 1]
|
ldh a, [hDividend + 1]
|
||||||
ldh [hDivisor], a
|
ldh [hRemainder], a
|
||||||
|
|
||||||
ldh a, [hMathBuffer + 4]
|
ldh a, [hMathBuffer + 4]
|
||||||
ldh [hDividend + 3], a
|
ldh [hQuotient + 2], a
|
||||||
|
|
||||||
ldh a, [hMathBuffer + 3]
|
ldh a, [hMathBuffer + 3]
|
||||||
ldh [hDividend + 2], a
|
ldh [hQuotient + 1], a
|
||||||
|
|
||||||
ldh a, [hMathBuffer + 2]
|
ldh a, [hMathBuffer + 2]
|
||||||
ldh [hDividend + 1], a
|
ldh [hQuotient + 0], a
|
||||||
|
|
||||||
ldh a, [hMathBuffer + 1]
|
ldh a, [hMathBuffer + 1]
|
||||||
ldh [hDividend + 0], a
|
ldh [hQuotient - 1], a
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user