Maths Subroutines for the 464 only


&BD5BREAL SUBTRACTION
ActionSubtracts the second real value from the first real value, and leaves the result in lieu of the first number
EntryHL points to the first real value, and DE points to the second real value
ExitHL points to the result in place of the first real value, AF, BC, DE, IX and IY are corrupt
&BD67REAL EXPONENT ADDITION
ActionAdds the value of the A register to the exponent byte of a real number
EntryHL points to the real value, and A holds the value to he added
ExitHL points to the result in place of the first real value, AF and IX are corrupt, and all others are preserved
&BD9DINTERNAL SUBROUTINE - not useful
&BDA0INTERNAL SUBROUTINE - not useful
&BDA3INTERNAL SUBROUTINE - not useful
&BDA6INTERNAL SUBROUTINE - not useful
&BDA9INTERNAL SUBROUTINE - not useful
&BDACINTEGER ADDITION
ActionAdds two signed integer values
EntryHL holds the first integer value, and DE holds the second integer value
ExitHL holds the result of the addition, A holds &FF if there is an overflow but is preserved otherwise, the flags Z are corrupt, and all other registers are preserved
&BDAFINTEGER SUBTRACTION
ActionSubtracts the second signed integer value from the first signed integer value
EntryHL holds the first integer value, and DE holds the second integer value
ExitHL holds the result of the subtraction, A holds &FF if there is an overflow but is preserved othenvise, the flags are corrupt, and all the other registers are preserved
&BDB2INTEGER REVERSE SUBTRACTION
ActionSubtracts the first signed integer value from the second signed integer value
EntryHL holds the first integer value, and DE holds the second integer value
ExitHL holds the result of the subtraction, AF and DE are corrupt, and all others are preserved
&BDB5INTEGER MULTIPLICATION
ActionMultiplies two signed integer values together, and leaves the result in lieu of the first number
EntryHL holds the first integer value, and DE holds the second integer value
ExitHL holds the result of the multiplication, A holds &FF if there is an overflow but is corrupted otherwise, the flags, BC and DE are corrupt, and the other registers are preserved
NotesMultiplication of signed integers does not produce the sarne result as with unsigned integers
&BDB8INTEGER DIVISION
ActionDivides the first signed integer value by the second signed integer value
EntryHL holds the first integer value, and DE holds the second integer value
ExitHL holds the result of the division, DE holds the remainder, AF and BC are corrupt, and all others are preserved
NotesDivision of signed integers does not produce the same result as with unsigned integers
&BDBBINTEGER DIVISION 2
ActionDivides the first signed integer value by the second signed integer value
EntryHL holds the first integer value, and DE holds the second integer value
ExitDE holds the result of the division, HL holds the remainder, AF and BC are corrupt, and all others are preserved
NotesDivision of signed integers does not produce the same result as with unsigned integers
&BDBEINTERNAL SUBROUTINE - not useful
&BDC1INTERNAL SUBROUTINE - not useful
&BDC4INTEGER COMPARISON
ActionCompares two signed integer values
EntryHL holds the first integer value, and DE holds the second integer value
ExitA holds the result of the comparison process, the flags are corrupt, and all others are preserved
NotesAfter this routine has been called, the value in A depends on the result of the comparison as follows
if the first real number is greater than the second real number, then A holds &01
if the first real number is the same as the second real number, then A holds &00
if the second real number is greater than the first real number, then A holds &FF
With signed integers, the range of values runs from &8000 (-32768) via zero to &7FFF (+32767) and so any value which is greater than &8000 is considered as being less than a value of &7FFF or less
&BDC7INTEGER UNARY MINUS
ActionReverses the sign of an integer value (by subtracting it from &10000)
EntryHL holds the integer value
ExitHL holds the new value of the integer number, AF is corrupt, cmd all other registers are preserved
&BDCAINTEGER SIGNUM/SGN
ActionTests a signed integer value
EntryHL holds the integer value
ExitA holds the result of this comparison process, the flags are corrupt, and all others are preserved
NotesAfter this routine has been called, the value in A depends on the result of the comparison as follows
if the integer number is greater than 0 and is less than &8000, then A holds &01
if the integer number is the same as 0, then A holds &00
if the integer number is greater than &7FFF and less than or equal to &FFFF, then A holds &FF
See INTEGER COMPARISON for more details on the way that signed integers are laid out


David Cantrell, March 1996