I'm trying to write a calculator program in assembly for the Apple //e. I know that there are built-in subroutines for performing all kinds of math operations involving the floating-point accumulator (FAC), and I'd like to use those, but I don't know how to convert the set of hex digits the user inputs into memory into the format required for the FAC (exponent + mantissa, explained in great detail on p.100 of "Inside the Apple IIe" by Gary B. Little). I know about FRMNUM ($DD67) and PRNTFAC ($ED2E), but I can't find the subroutine that Applesoft uses to take a decimal number and convert it to the six-bit exponent-mantissa format.
EDIT: Here's the commented data in text format.
*============= * PRNTFAC TEST ORG $6000 HOME EQU $FC58 FRMNUM EQU $DD67 PRNTFAC EQU $ED2E TXTPTR EQU $B8 PTR EQU $06 * CLEAR SCREEN START JSR HOME * MAKE BOTH POINTER AND TXTPTR * POINT TO $0700 LDA #$00 STA PTR STA TXTPTR LDA #$70 STA PTR+1 STA TXTPTR+1 * LOAD CONTENT OF DATA * TO $0700 LDX #$00 LDY #$00 ]LOOP LDA DATA,X STA (PTR),Y BEQ NEXT INX INY JMP ]LOOP * $0700 NOW CONTAINS * 31 C8 31 00 (I HAVE CHECKED * THIS USING THE DEBUGGER) * RUN FRMNUM NEXT JSR FRMNUM * RUN PRNTFAC * IF PRNTFAC OPERATES LIKE * COUT, A "2" SHOULD BE PRINTED * AT THE TOP LEFT CORNER OF THE * SCREEN JSR PRNTFAC END RTS DATA HEX 31C83100