mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
hMultiplicand is four bytes internally, but the high byte is always 0 since allowing four-byte multiplicands could overflow hProduct.
This commit is contained in:
parent
ae022e1420
commit
9ee2b59208
@ -4,7 +4,7 @@ _Multiply::
|
|||||||
ld b, a
|
ld b, a
|
||||||
|
|
||||||
xor a
|
xor a
|
||||||
ldh [hProduct], a
|
ldh [hMultiplicand - 1], a
|
||||||
ldh [hMathBuffer + 1], a
|
ldh [hMathBuffer + 1], a
|
||||||
ldh [hMathBuffer + 2], a
|
ldh [hMathBuffer + 2], a
|
||||||
ldh [hMathBuffer + 3], a
|
ldh [hMathBuffer + 3], a
|
||||||
@ -36,7 +36,7 @@ _Multiply::
|
|||||||
|
|
||||||
ldh a, [hMathBuffer + 1]
|
ldh a, [hMathBuffer + 1]
|
||||||
ld c, a
|
ld c, a
|
||||||
ldh a, [hProduct]
|
ldh a, [hMultiplicand - 1]
|
||||||
adc c
|
adc c
|
||||||
ldh [hMathBuffer + 1], a
|
ldh [hMathBuffer + 1], a
|
||||||
|
|
||||||
@ -58,9 +58,9 @@ _Multiply::
|
|||||||
rla
|
rla
|
||||||
ldh [hMultiplicand + 0], a
|
ldh [hMultiplicand + 0], a
|
||||||
|
|
||||||
ldh a, [hProduct]
|
ldh a, [hMultiplicand - 1]
|
||||||
rla
|
rla
|
||||||
ldh [hProduct], a
|
ldh [hMultiplicand - 1], a
|
||||||
|
|
||||||
jr .loop
|
jr .loop
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user