Skip to main content
added 143 characters in body
Source Link

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

I'm trying to use FRMNUM ($DD67) and PRNTFAC ($ED2E) to carry out the math and print the result, but I can't findit's not working.

Below is a sample program designed just to add 1 and 1 and print 2, but the program winds up in a loop.

It puts the data 31 c8 31 00 (= 1 + 1) at memory address $7000, points TXTPTR (which is the pointer used by the FRMNUM subroutine) at that Applesoft uses to take a decimal numberaddress, runs FRMNUM and convert it tothen runs PRNTFAC which should print the six-bit exponent-mantissa formatresult on the screen.

It doesn't. It winds up in a loop somewhere in the $DD's, ie in FRMNUM.

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.

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.

I'm trying to use FRMNUM ($DD67) and PRNTFAC ($ED2E) to carry out the math and print the result, but it's not working.

Below is a sample program designed just to add 1 and 1 and print 2, but the program winds up in a loop.

It puts the data 31 c8 31 00 (= 1 + 1) at memory address $7000, points TXTPTR (which is the pointer used by the FRMNUM subroutine) at that address, runs FRMNUM and then runs PRNTFAC which should print the result on the screen.

It doesn't. It winds up in a loop somewhere in the $DD's, ie in FRMNUM.

edited body
Source Link

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 1: Here is a link to the calculator program I'm working on. I can't copy and paste it into here because it's too long.

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$7000 LDA #$00 STA PTR STA TXTPTR LDA #$70 STA PTR+1 STA TXTPTR+1 * LOAD CONTENT OF DATA * TO $0700$7000 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 

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 1: Here is a link to the calculator program I'm working on. I can't copy and paste it into here because it's too long.

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 

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 1: Here is a link to the calculator program I'm working on. I can't copy and paste it into here because it's too long.

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 $7000 LDA #$00 STA PTR STA TXTPTR LDA #$70 STA PTR+1 STA TXTPTR+1 * LOAD CONTENT OF DATA * TO $7000 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 
added 960 characters in body
Source Link

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 1: Here is a link to the calculator program I'm working on. I can't copy and paste it into here because it's too long.

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 

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 

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 1: Here is a link to the calculator program I'm working on. I can't copy and paste it into here because it's too long.

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 
added 960 characters in body
Source Link
Loading
added 109 characters in body
Source Link
Loading
Rollback to Revision 1
Source Link
Loading
added 177 characters in body
Source Link
Loading
Source Link
Loading