Saturday, September 22, 2007

Modified HP-35s stack save/restore program

Decided wanted the U program to also save/restore the LASTX register.

Modified program:
U001 LBL U
U002 X<> I
U003 RDN
U004 0
U005 X<> I
U006 STO(I)
U007 RDN
U008 1
U009 STO I
U010 RDN
U011 STO(I)
U012 RDN
U013 2
U014 STO I
U015 RDN
U016 STO(I)
U017 RDN
U018 3
U019 STO I
U020 RDN
U021 STO(I)
U022 4
U023 STO I
U025 STO(I)
U026 5
U027 STO I
U028 STO(I)
U029 4
U030 STO I
U031 RCL(I)
U032 ABS
U033 3
U034 STO I
U035 RDN
U036 RCL(I)
U037 2
U038 STO I
U039 RDN
U040 RCL(I)
U041 1
U042 STO I
U043 RDN
U044 RCL(I)
U045 0
U046 STO I
U047 RDN
U048 RCL(I)
U049 RTN

Terms of use.

LASTX is saved to register 4 and register 5 gets a non zero to allocate registers for sure.

Recall soubroutine is now U029.

Change history:

20070929:2035UTC : An error has been corrected: The error had to do with not properly allocating indirect registers if happen to store zeros in reg. 4 and downwards in sequence... See here for more on this topic.

No comments: