Post Reply 
Help - Assembly programming on Debug4x (HP50G)
06-12-2019, 09:02 AM
Post: #4
RE: Help - Assembly programming on Debug4x (HP50G)
(06-11-2019 07:47 PM)JeffB Wrote:  C=DAT1 A
?C=0 A

In addition to what Werner said (which should resolve your freezing issues) and what DavidM suggested (which merely improves readability), your code won't do exactly what you think it will do. The issue is in the lines I quoted: you're reading an object from the stack, then comparing it to 0 and jumping if that's true. However, you're not comparing the number stored in the BINT object, but instead you're comparing its address with 0. If you ever get such an address from the stack, then you've done something wrong (e.g. it can happen when the stack is empty, but dropping a level in that case will mess things up).
What you want is something like this:
?C=0 A
That brings the address of the object into A, moves it into D0 while backing up the former D0 (which is the top of the return stack) into A, advances D0 to point just past the 5-nibble prolog of the object (i.e. to the 5-nibble number in a BINT), pulls the number into C, and then it restores D0. Finally, your comparison and conditional jump.
Hope this helps.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Help - Assembly programming on Debug4x (HP50G) - 3298 - 06-12-2019 09:02 AM

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