Sunday, September 23, 2007

Addition to the HP-35s stack save/restore program - I

The following extension to the U001 subroutine allow for simulating unary operation (one that only operates on value in X stack register and saves old value in LASTX register): Get what was in the X register to LASTX, leave what is in X register in X (this is your new operation's result) and restore Y, Z and T registers.

Program:
U050 0
U051 STO I
U052 RDN
U053 RCL(I)
U054 ABS
U055 RDN
U056 3
UO57 STO I
U058 RDN
U059 RCL(I)
U060 2
U061 STO I
UO62 RDN
U063 RCL(I)
U064 1
U065 STO I
U066 RDN
U067 RCL(I)
U068 R^
U069 RTN
Comments:

Terms of use.

So now we have the subroutines:
  1. XEQ U001 to save the stack and LASTX.
  2. XEQ U029 to restore the stack and LASTX given U001 has been used to save.
  3. XEQ U050 to implement operation native unary operation stack and LASTX behaviour given U001 has been used to save.
Change history:

20070929:2035UTC : Change because of fix in U program.

No comments: