awarded
comment
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
@fadden I can't know if this solves my problem or not if it doesn't work, so I haven't pivoted. I've just gotten an answer that doesn't solve the problem. I'll keep poking around, though, and thanks for the help!
revised
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
added 143 characters in body
Loading…
comment
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
I can convert the user input (eg "123" to 31 32 33) for use in with FRMNUM. That's not the issue.
revised
Loading…
comment
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
@fadden - yes, I understand that it should work, but why doesn't it work in the program above?
comment
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
Thank you for this. I've commented the code and also posted a link to the PDF of the big program I'm working on. The user input can be in any format. Right now, if you look at the code, it's in ASCII in the display area (eg 1 = B1) and converted to hex numbers in the memory area (e.g. 1 = 01) which I created for mathematical manipulation. It turns out I should use C1 for 1. Converting the input to the correct format isn't a problem. I just need to know how to get that data into the proper subroutines and then extract the result in a format I can print in the "calculator display."
revised
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
added 960 characters in body
Loading…
revised
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
added 960 characters in body
Loading…
awarded
awarded
revised
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
added 109 characters in body
Loading…
revised
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
rolled back to a previous revision
Loading…
awarded
comment
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
@fadden I've added an image (can't copy and paste from Merlin) of the code. Maybe you can see what I'm doing wrong.
revised
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
added 177 characters in body
Loading…
comment
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
It doesn't work. I loaded
31 C8 31 00 at location $7000, pointed TXTPTR ($B8 = #$00, $B9 = #$70) at it, did JSR FRMNUM then JSR PRNTFAC and it just winds up in a loop somewhere in the $DD's without printing anything. I've used the debugger to check all the relevant memory locations and everything's where it should be. Maybe PRNTFAC can't just be called like COUT? comment
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
So the string would have to be the ASCII values for the numbers (e.g., "1" = $B1 instead of $01) and I would use the tokens listed here (justsolve.archiveteam.org/wiki/Applesoft_BASIC_tokenized_file) for the operators, right? For example, if I put B1C8B100 (00 as a terminator) in memory and pointed
TXTPTR at that and did JSR FRMNUM, the result (numerical value 2) would be put in the FAC, which I could then read out using PRNTFAC -- is this correct? comment
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
Yes. The user inputs two numbers. The program blocks input of anything other than numbers (except for C for clear and the operators, etc.). The values are stored in memory in hex format (can't store them in any other format), but don't go above 9, so I guess that's equivalent to decimal? (I'm new to all this.)
comment
How to convert series of hex digits in memory into the format for use with Applesoft math subroutines
@fadden
FRMNUM involves using TXTPTR and other things in ways that complicate things. Looking at your link, FIN does, too. I guess that's the only way to do it. I just have to make TXTPTR point at the "formula" in memory, right? Currently I just have two series of hex numbers, but if I put them next to each other and an ASCII '+' etc between them, it'll evaluate the whole thing and put the result back in the FAC? 
