The Maths Firmware


&BDC1MOVE REAL (&BD3D for the 464)
ActionCopies the five bytes that are pointed to by DE to the location held in HL
EntryDE points to the source real value, and HL points to the destination
ExitHL points to the real value in the destination, Carry is true if the move went properly, F is corrupt, and all other registers are preserved
NotesFor the 464 only, A holds the exponent byte of the real value when the routine is exited
&BD64INTEGER TO REAL (&BD40 for the 464)
ActionConverts an integer value into a real value
EntryHL holds the integer value, DE points to the desti- nation for the real value, bit 7 of A holds the sign of the integer value - it is taken to be negative if bit 7 is set
ExitHL points to the real value in the destination, AF and DE are corrupt, and all others are preserved
&BD67BINARY TO REAL (&BD43 for the 464)
ActionConverts a four byte binary value into a real value at the same location
EntryHL points to the binary value, bit 7 of A holds the sign of the binary value - negative if it is set
ExitHL points to the real value in lieu of the four byte binary value, AF is corrupt, and all others are preserved
NotesA four byte binary value is an unsigned integer up to &FFFFFFFF and is stored with the least significant byte first, and with the most significant byte last
&BD6AREAL TO INTEGER (&BD46 for the 464)
ActionConverts a real value, rounding it into an unsigned integer value held in HL
EntryHL points to the real value
ExitHL holds the integer value, Carry is true if the conversion worked successfully, the Sign flag holds the sign of the integer (negative if it is set). A, IX and the other flags are corrupt, and all other registers are preserved
NotesThis rounds the decimal part down if it is less than 0.5, but rounds up if it is greater than, or equal to 0.5
&BD6DREAL TO BINARY (&BD49 for the 464)
ActionConverts a real value, rounding it into a four byte binary value at the same location
EntryHL points to the real value
ExitHL points to the binary value in lieu of the real value, bit 7 of B holds the sign for the binary value (it is negative if bit 7 is set), AF, B and IX are corrupt, and all other registers are preserved
NotesSee REAL TO INTEGER for details of how the values are rounded up or down
&BD70REAL FIX (&BD4C for the 464)
ActionPerforms an equivalent of BASIC's FIX function on a real value, leaving the result as a four byte binary value at the same location
EntryHL points to the real value
ExitHL points to the binary value in lieu of the real value, bit 7 of B has the sign of the binary value (it is negative if bit 7 is set), AF, B and IX are corrupt, and all others are preserved
NotesFIX removes any decimal part of the value, rounding down whether positive or negative - see the BASIC handbook for more details on the FIX command
&BD73REAL INT (&BD4F for the 464)
ActionPerforms an equivalent of BASIC's INT function on a real value, leaving the result as a four byte binary value at the same location
EntryHL points to the real value
ExitHL points to the binary value in lieu of the real value, bit 7 of B has the sign of the binary value (it is negative if bit 7 is set), AF, B and IX are corrupt, and all others are preserved
NotesINT removes any decimal part of the value, rounding down if the nurnber is positive, but rounding up if it is negative
&BD76INTERNAL SUBROUTINE - not useful (&BD52 for the 464)
&BD79REAL *10^A (&BD55 for the 464)
ActionMultiplies a real value by 10 to the power of the value in the A register, leaving the result at the same location
EntryHL points to the real value, and A holds the power of 10
ExitHL points to the result, AF, BC, DE, IX and IY are corrupt
&BD7CREAL ADDITION (&BD58 for the 464)
ActionAdds two real values, and leaves the result in lieu of the first real number
EntryHL points to the first real value, and DE points to the second real value
ExitHL points to the result, AF, BC, DE, IX and IY are corrupt
&BD82REAL REVERSE SUBTRACTION (&BD5E for the 464)
ActionSubtracts the first real value from the second 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
&BD85REAL MULTIPLICATION (&BD61 for the 464)
ActionMultiplies two real values together, 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
&BD88REAL DIVISION (&BD64 for the 464)
ActionDivides the first real value by the second 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
&BD8EREAL COMPARISON (&BD6A for the 464)
ActionCompares two real values
EntryHL points to the first real value, and DE points to the second real value
ExitA holds the result of the comparison process, IX, IY, and the other 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
&BD91REAL UNARY MINUS (&BD6D for the 464)
ActionReverses the sign of a real value
EntryHL points to the real value
ExitHL points to the new value of the real number (which is stored in place of the original number), bit 7 of A holds the sign of the result (it is negative if bit 7 is set), AF and IX are corrupt, and all other registers are preserved
&BD94REAL SIGNUM/SGN (&BD70 for the 464)
ActionTests a real value, and compares it with zero
EntryHL points to the real value
ExitA holds the result of this comparison process, IX and the other ˇlags 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 real number is greater than 0, then A holds &01, Carry is false, and Zero is false
if the real number is the same as 0, then A holds &00, Carry is false, and Zero is true
if the real number is smaller than 0, then A holds &FF, Carry is true, and Zero is false
&BD97SET ANGLE MODE (&BD73 for the 464)
ActionSets the angular calculation mode to either degrees (DEG) or radians (RAD)
EntryA holds the mode setting - 0 for RAD, and any other value for DEG
ExitAll registers are preserved
&BD9AREAL PI (&BD76 for the 464)
ActionPlaces the real value of pi at a given memory location
EntryHL holds the address at which the value of pi is to be placed
ExitAF and DE are corrupt, and all other registers are preserved
&BD9DREAL SQR (&BD79 for the 464)
ActionCalculates the square root of a real value, leaving the result in lieu of the real value
EntryHL points to the real value
ExitHL points to the result of the calculation, AF, BC, DE, IX and IY are corrupt
&BDA0REAL POWER (&BD7C for the 464)
ActionRaises the first real value to the power of the second real value, leaving the result in lieu of the ˇirst real value
EntryHL points to the first real value, and DE points to the second real value
ExitHL points to the result of the calculation, AF, BC, DE, IX and IY are corrupt
&BDA3REAL LOG (&BD7F for the 464)
ActionReturns the naperian logarithm (to base e) of a real value, leaving the result in lieu of the real value
EntryHL points to the real value
ExitHL points to the logarithrn that has been calculated, AF, BC, DE, LY and IY are corrupt
&BDA6REAL LOG 10 (&BD82 for the 464)
ActionReturns the logarithm (to base 10) of a real value, leaving the result in lieu of the real value
EntryHL points to the real value
ExitHL points to the logarithrn that has been calculated, AF, BC, DE, IX and IY are corrupt
&BDA9REAL EXP (&BD85 for the 464)
ActionReturns the antilogarithm (base e) of a real value, leaving the result in lieu of the real value
EntryHL points to the real value
ExitHL points to the antilogarithm that has been cal- culated, AF, BC, DE, IX and IY are corrupt
NotesSee the BASIC handbook for details of EXP
&BDACREAL SINE (&BD88 for the 464)
ActionReturns the sine of a real value, leaving the result in lieu of the real value
EntryHL points to the real value (ie all angle)
ExitHL points to the sine value that has been calculated, AF, BC, DE, IX and IY are corrupt
&BDAFREAL COSINE (&BD8B for the 464)
ActionReturns the cosine of a real value, leaving a the result in lieu of the real value
EntryHL points to the real value (ie an angle)
ExitHL points to the cosine value that has been calculated, AF, BC, DE, IX and IY are corrupt
&BDB2REAL TANGENT (&BD8E for the 464)
ActionReturns the tangent of a real value, leaving the result in lieu of the real value
EntryHL points to the real value (ie an angle)
ExitHL points to the tangent value that has been cal- culated, AF, BC, DE, IX and IY are corrupt
&BDB5REAL ARCTANGENT (&BD91 for the 464)
ActionReturns the arctangent of a real value, leaving the result in lieu of the real value
EntryHL points to the real value (ie an angle)
ExitHL points to the arctangent value that has been calculated, AF, BC, DE, IX and IY are corrupt All of the above routines to calculate sine, cosine, tangent and arctangent are slightly inaccuarate
&BDB8INTERNAL SUBROUTINE - not useful (&BD94 for the 464)
&BDBBINTERNAL SUBROUTINE - not useful (&BD97 for the 464)
&BDBEINTERNAL SUBROUTINE - not useful (&BD9A for the 464)


David Cantrell, March 1996