The current URL is datacrystal.tcrf.net.
EarthBound/ASM/Math Routines
This is a sub-page of EarthBound/ASM.
$C08FE8-$C08FF6: Unsigned 8-bit multiplication
accumulator[0] = accumulator[0] * accumulator[1]
Multiplies two 8-bit multiplicands and truncates the product into an 8-bit result. Implemented using a simple application of the SNES's hardware support for unsigned multiplication.
Note: This routine does not appear to be used anywhere in an unmodified EarthBound ROM.
Inputs
- accumulator[0]: 8-bit multiplicand1
- accumulator[1]: 8-bit multiplicand2
Outputs
- accumulator: 8-bit product
Note: The accumulator is set to 8-bit mode before returning because somebody was trying way too hard to stick to the principle that an 8-bit math operation should always return an 8-bit result. But if you clear flag #$20 after the routine returns, the upper byte of the accumulator should contain the upper byte of the product for a full 16-bit result.
$C08FF7-$C09031: Unsigned 16-bit * 8-bit multiplication
accumulator = accumulator * y[0]
Multiplies a 16-bit multiplicand by an 8-bit multiplicand and truncates the product into a 16-bit result. Implemented by combining together the results of up to two applications of the SNES hardware multiplier.
Inputs
- accumulator: 16-bit multiplicand1
- y[0]: 8-bit multiplicand2
Outputs
- accumulator: 16-bit product
Note: Due to how the result is processed, if the input accumulator[1] is not zero, on output, y[1] will contain the upper third byte of the product, making it possible to use this routine to calculate a 24-bit product. But if the input accumulator[1] is zero, y[1] will not be modified, and will contain whatever it contained before calling the routine.
$C09032-$C09085: Unsigned 16-bit multiplication
$C09086-$C090CD: Unsigned 32-bit multiplication
$C090CE-$C090E5: Signed 8-bit division
$C090E6-$C090FE: Signed 16-bit division
$C090FF-$C0911D: Signed 32-bit division
$C0911E-$C0912B: 8-bit division of absolute values of inputs
$C0912C-$C0914A: Unsigned 8-bit division
$C0914B-$C0915A: 16-bit division of absolute values of inputs
$C0915B-$C0917B: Unsigned 16-bit division
$C0917C-$C091A5: 32-bit division of absolute values of inputs
$C091A6-$C091E2: Unsigned 32-bit division
This page is rather stubbly and could use some expansion. Are you a bad enough dude to rescue this article? |