Post Reply 
(35S) Non volatile write stack to memory
01-22-2015, 10:54 AM (This post was last modified: 06-15-2017 01:31 PM by Gene.)
Post: #1
(35S) Non volatile write stack to memory
Non Volatile Write Stack to Memory for the HP35s

Greetings,
The following codes will read|write|exchange the current classic four level stack x,y,z,t with indirect memory 99, 98, 97, 96 (changeable) on the HP35s using available indirect memory addresses (built in) and the indirection registers (i) and (j).
This program utility may be used interactively to save|recall|exchange the stack in a non volatile way during normal calculations using parameters which may be easily changed, or the routines of the interactive program may also be called from other programs under automated control to save and restore the stack environment also in a non volatile way.

Have you ever wanted to save the stack environment momentarily (without a lot of manual exchanges or having to write down intermediate steps, or have you ever wished the four level stack could be expanded a bit without losing stuff out the TOP>?
Read on.

These codes assume some setup, and an understanding of indirect memory registers and indirect memory addressing on the HP35s. The user's guide which comes with the unit on CD covers this topic well.
I reserve 100 (0-99) indirect memory addresses which I may access with the (i) and (j) registers by placing a non zero value at indirect memory location 100. This takes up 37x101 bytes from the available 30192 bytes of on-board program storage, so that when placing -1 in memory location 100 the program storage byte counter (assuming no programs) will read 30192-(37x101). By default these codes read|write|exchange the stack x,y,z,t to memory locations 99,98,97,96 with the operator option at run time to not only select read|write|exchange but also to set the memory location. The assumption for this example code is a reserve of 101 memory locations.
On to the codes:
Code:


     T001  LBL  T
     T002  x<>  F
     T003  CLx
     T004  -1                  (mode:  -1 exchange default, 0 read, 1 write  
     T005  STOP              (give the operator a chance to select the mode
     T006  x<>  F            (save mode  F=mode flag
     T007  x<>  J
     T008  CLx
     T009  99.095            (default counts 4 down from 99 to 95
     T010  STOP               (allow operator to change it  ie.  89.085
     T011  x<>  J             (save memory location (J) indirection counter
     T012  x<>  F             (get mode flag   -1 exchange,  0 read,  1 write
     T013  x!=0?               (DO on x not equal to zero
     T014  GTO  T022        (T022:  branch around READ routine
     T015  x<>  F
     T016  CLx                   (ENTRY POINT for READ routine
     T017  RCL  (J)             (   start reading values from memory into the stack
     T018  R|                     (   roll stack down arrow
     T019  DSE  J               (    decrement counter | move to next memory
     T020  GTO  T016         (    loop back until all four values are read into stack
     T021  RTN                   (    end of READ routine
     T022  x>0?                  (continue branch from T014
     T023  GTO  T030          (T030:  branch around EXCHANGE routine
     T024  x<>  F    
     T025  x<>  (J)             (ENTRY POINT for EXCHANGE routine
     T026  R|                      (   roll stack down arrow
     T027  DSE  J                (    decrement counter | move to next memory
     T028  GTO  T025          (    loop back until all four values are exchanged
     T029  RTN                    (   end of EXCHANGE routine
     T030  x<>  F
     T031  STO  (J)              (ENTRY POINT for WRITE routine
     T032  R|                       (   roll stack down arrow
     T033  DSE  J                 (   decrement counter | move to next memory
     T034  GTO T031            (   loop back until all four values are written
     T035  RTN                     (   end of WRITE routine

-
Usage:

Make sure that you have memories reserved for indirect addressing. This case assumes 101 reserved (but you can alter that) by placing a non zero value in indirect memory 100 like this:
100
STO J
-1
STO (J)

It is best to do this before you store any programs, but not essential.

To run the routines interactively use [XEQ] [T] [ENTER]

The default parameter -1 will be swapped from F into x stack position.

Select -1 leave default to EXCHANGE the stack with memory
Select 1 [+/-] to WRITE stack non volatile out to memory
Select 0 [CLx] to READ memory into stack

BE CAREFUL to not do anything that will cause STACK LIFT... to change to one use [+/-]
to change to 0 use the back arrow clear! If you activate stack lift you will lose the t TOP !

Press [R/S]

The default memory address counter will be 99.095 , which may be changed :
Make sure the counter represents a count down of 4. ie. 89.085 again, change it only
using back arrow clear so as to NOT activate stack lift !

Press [R/S]

That's all there is to it. If you want to use these same routines from within other programs to save or restore the environment in a nonvolatile way have your program call the appropriate ENTRY POINT for the routine you need. Again, make sure you have reserved the appropriate indirect memory addresses FIRST.


Cheers
Smile

Kind regards,
marcus
Find all posts by this user
Quote this message in a reply
Post Reply 




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