Math routines
------------------------------------------------------------------
1-001
Function Name: DNegate
Purpose: Negates a 16 bit value.
Call address: $C172
Input requirements:
X The address of the 16 bit integer
Output:
X The address of the 16 bit result.
Description: This routine is one of the GEOS math routines. X
points to a 16 bit value which is negated. The value of X is not
affected.
1-002
Function Name: Ddiv
Purpose: Unsigned 16 bit by 16 bit division.
Call address: $C169
Input requirements:
Y The address of the 16 bit divisor.
X The address of the 16 bit dividend.
Output:
X The address of the 16 bit quotient.
$12-$13 R8 The 16 bit remainder.
Description: This routine is one of the GEOS math routines. X and
Y each have the address of a term in the division. The quotient
is stored in place of the original dividend that X pointed to.
The dividend is left untouched.
1-003
Function Name: DMult
Purpose: Unsigned 16 bit by 16 bit multiply.
Call address: $C166
Input requirements:
Y The address of the 16 bit multiplier.
X The address of the 16 bit multiplicand.
Output:
X The address of the 16 bit result.
Description: This routine is one of the GEOS math routines. X and
Y each have the address of a term in the multiplication. The
result is stored in place of the original multiplicand that X
pointed to. The multiplier pointed to by Y is untouched.
1-004
Function Name: BMult
Purpose: Unsigned 8 bit by 16 bit multiply.
Call address: $C163
Input requirements:
Y The address of the 8 bit multiplier.
X The address of the 16 bit multiplicand.
Output:
X The address of the 16 bit product.
Description: This routine is one of the GEOS math routines. X and
Y each have the address of a term in the multiplication. The
result is stored in place of the original multiplicand that X
pointed to. The byte following the multiplier is set to zero,
then control passes to DMult.
1-005
Function Name: BBMult
Purpose: Unsigned 8 bit by 8 bit multiply.
Call address: $C160
Input requirements:
Y The address of the multiplier.
X The address of the multiplicand.
Output:
X The address of the 16 bit product.
Description: This routine is one of the GEOS math routines. X and
Y each have the address of a term in the multiplication. The
result is stored in place of the original multiplicand that X
pointed to. The value that Y points to is left untouched.
1-006
Function Name: DSdiv
Purpose: Signed 16 bit by 16 bit division.
Call address: $C16C
Input requirements:
Y The address of the 16 bit divisor.
X The address of the 16 bit dividend.
Output:
X The address of the 16 bit quotient.
$12-$13 R8 The 16 bit remainder.
Description: This routine is one of the GEOS math routines. X and
Y each have the address of a term in the division. Both terms are
made positive with Dabs. Ddiv is then called; if the result of
the division should be negative, DNegate is called. The quotient is
stored in place of the original dividend that X pointed to. The
dividend is left untouched. The remainder is always a positive
integer.
1-007
Function Name: Dabs
Purpose: 16 bit absolute value.
Call address: $C16F
Input requirements:
X The address of the 16 bit integer.
Output:
X The address a positive 16 bit integer.
Description: This routine is one of the GEOS math routines. X
points to a 16 bit value which if found to be negative, DNegate is
called to make it positive.
1-008
Function Name: Ddec
Purpose: Decrements a 16 bit value.
Call address: $C175
Input requirements:
X The address of the 16 bit integer.
Output:
X The address of the 16 bit result.
Description: This routine is one of the GEOS math routines. X
points to a 16 bit value which is decremented by 1.
1-009
Function Name: DShiftLeft
Purpose: 16 bit multiple arithmetic shift lefts.
Call address: $C15D
Input requirements:
Y The shift count.
X The address of the 16 bit value to be shifted.
Output:
X Result of shifts.
Description: This routine is one of the GEOS math routines. X has
the address of a 16 bit integer in zero page, which is to be
shifted left by the count in Y.
1-010
Function Name: DShiftRight
Purpose: 16 bit multiple logical shift rights.
Call address: $C262
Input requirements:
Y The shift count.
X The address of the 16 bit value to be shifted.
Output:
X Result of shifts.
Description: This routine is one of the GEOS math routines. X has
the address of a 16 bit integer in zero page, which is to be
shifted right by the count in Y.
1-011
Function Name: CRC
Purpose: Compute a checksum for a data region.
Call address: $C20E
Input requirements:
$02-$03 R0 Pointer to data region.
$04-$05 R1 Length of region.
Output:
$06-$07 R2 Checksum of region.
Description: This routine is called by the bootup routines to
compute the checksum of GEOS BOOT. This checksum is used to
create the interrupt vector address. The reason for this was to
prevent piracy. This can be used to check the integrity of a
memory region. This is actually more of a CRC computation then a
checksum and the formula is a little too complex to explain here.