Post Reply 
HP 48GX Indefinite Loops
04-03-2022, 11:39 AM
Post: #13
RE: HP 48GX Indefinite Loops
(04-03-2022 01:59 AM)MNH Wrote:  \<< 1 CF CSV DUP SIZE
10 CHR { } 1 \→ csv
...
\>>

Although the desired output has been attained, the DO...UNTIL...END
structure still repeats one more time after the test condition returns a
true (nonzero) result. I have to clean up the stack, which I shouldn't have
to do if the program worked as expected. Any thoughts?

Hmmm.... several thoughts.

See the above post about INOUT, which would make it easier for others to be able to test the code. Also, placing the code into a code block (see the "#" button above the text when typing a post/response) would at least preserve the original ascii text along with the intended indentation. It also makes it a little easier to copy and paste (IMHO).

I loaded your program into an emulated 48GX for testing and stepped through the flow with SST. If I'm understanding things correctly, you're wanting the 'points' local to have a list with each line in it. That local is only a list for a very short time, however, namely when it is first created as an empty list with the local assignment operator (→). Your code replaces that list with a string assignment in the THEN clause by using STO instead of STO+. Also, if you want the strings to be in the same order they are encountered in CSV, then you'll want to swap the new string and 'points' prior to STO+ being executed.

In its current form, your program simply concatenates the previous string with the final string and leaves it on the stack. I don't believe that's what you intended, but I could be confused about exactly what your code is trying to achieve.

Stepping through the code, the main loop is terminated correctly if flag 1 is set. Have you tried single-stepping through the code to see what it is doing?

In summary:

If I change this
Code:
'points' STO
into
Code:
'points' SWAP STO+
...then it appears to leave the list of strings on the stack that you wanted. If that's not what you intended, please provide further clarification.

Hope this helps!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP 48GX Indefinite Loops - MNH - 03-28-2022, 01:11 AM
RE: HP 48GX Indefinite Loops - MNH - 04-02-2022, 02:15 PM
RE: HP 48GX Indefinite Loops - DavidM - 03-28-2022, 04:11 AM
RE: HP 48GX Indefinite Loops - DavidM - 03-29-2022, 12:30 PM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 01:59 AM
RE: HP 48GX Indefinite Loops - DavidM - 04-03-2022, 10:58 AM
RE: HP 48GX Indefinite Loops - DavidM - 04-03-2022 11:39 AM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 05:39 PM
RE: HP 48GX Indefinite Loops - ttw - 03-30-2022, 01:02 AM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 12:57 PM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 04:25 PM



User(s) browsing this thread: 1 Guest(s)