Applesoft: Internals--Floating Point Math Package (3 of 3) LOWER LEVEL INTERFACE ROUTINES FOUT ED34 FOUT creates an ASCII string in FBUFFR equivalent to the value of FAC. On exit Y,A points to the string, which ends with an ASCII null. FAC is scrambled. Use STROUT to print the number. SNGFLT E301 SNGFLT converts the unsigned number in Y to a floating point number in FAC. GIVAYF E2F2 GIVAYF converts the unsigned number in Y,A to a floating point number in FAC. FLOAT EB93 FLOAT converts the signed number in A to a floating point number in FAC. CONINT E6FB CONINT converts FAC into a single byte integer in X and FACLO. CONINT normally exits through CHRGET unless FAC is greater than 255 or less than 0, when it exits via ILLEGAL QUANTITY ERROR. AYINT E10C If FAC is less than +32767 and greater than -32767, then execute QINT. Otherwise AYINT exits via ILLEGAL QUANTITY ERROR. QINT EBF2 Quick greatest integer function. Leaves INT(FAC) in FACHO,MO,LO signed. QINT assumes that the absolute value of the FAC is less than 8388608 (2^23rd power). GETADR E752 GETADR converts the number in FAC to a 2 byte, unsigned integer in LINNUM. When FAC is greater than 65535 or less than -65535, GETADR exits via ILLEGAL QUANTITY ERROR. GETNUM E746 GETNUM fetches a 2 byte number, a comma and an unsigned, single byte number from TXTPTR. The first number is stored in LINNUM, while the second is returned to the X register. On entry TXTPTR points to the first character of the formula for the first number. GETNUM uses FRNUM, GETADR, CHKCOM and GETBYT. COMBYTE E74C COMBYTE checks for a comma, then fetches an unsigned, single byte number returned in X. On entry TXTPTR points to the comma. COMBYTE uses CHKCOM and GETBYT. FRMEVL DD7B FRMEVL evaluates the formula at TXTPTR using CHRGET, then leaves the result in FAC. On entry, TXTPTR points to the first character of the formula, while on exit points to the terminator. "A" does not contain the terminator. The format of the temporary result on the stack is: The address of the operator routine. The floating point temporary result. The precedence of the operator. FRMEVL, the main subroutine for the commands that use formulas, works for both strings and numbers. If the formula is a string literal, FRMEVL gobbles the opening quote, then executes STRLIT and ST2TXT. FRMNUM DD67 FRMNUM evaluates the formula at TXTPTR, puts it in FAC, then makes sure the result is numeric. On entry TXTPTR points to the first character of the formula. FRMNUM exits through TYPE MISMATCH ERROR if the result is a string. FIN EC4A FIN inputs a floating point number into FAC from CHRGET. FIN assumes the 6502 registers and A were set up by the CHRGET that fetched the first digit. FIN only operates on numeric constants, not formulas. Apple Tech Notes Keywords: ================================================================== This information is from the Apple Technical Information Library. ArticleID: TECHINFO-0000076 19960724 15:55:27.00 .