Post Reply 
Help - Assembly programming on Debug4x (HP50G)
06-12-2019, 03:30 PM
Post: #5
RE: Help - Assembly programming on Debug4x (HP50G)
(06-12-2019 09:02 AM)3298 Wrote:  ...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).

I believe Jeff was merely copying the sample code for the "Drop" program from "Introduction to Saturn Assembly Language" by Gilbert Fernandes at the bottom of page 141 in that book. In this case, he probably used BINT1 just to place something on the stack which could subsequently be dropped by the code object. The code sample checks to see if the current SL1 pointer is aimed at #00000 in an effort to skip the traditional drop sequence if the stack is empty. While that should usually work OK, the "stack depth" discussion that immediately precedes that example in the book also shows why that method is not 100% foolproof.

Dropping a level when the stack is empty is one of my favorite examples of how easy it is to truly mess up your RPL calculator with SysRPL or Saturn code in just a few easy steps. Smile
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) - DavidM - 06-12-2019 03:30 PM



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