Post Reply 
EXC/ x<>Rn for stack efficiency
06-11-2017, 10:07 PM
Post: #2
RE: EXC/ x<>Rn for stack efficiency
(06-11-2017 08:58 PM)Matt Agajanian Wrote:  I'm trying to find the most effective way to perform a register exchange function that minimizes stack disruption. Although on the 34C and 67, and later models the I register and x<>(i) functions are available, how can x<>Rn be accomplished with the 25 or 33 without disrupting the stack drastically?

The obvious solution (assuming X is exchanged with register 1) would be:


Since the current X-value and the content of R1 require two stack registers, this solution loses the T-register:

before   after

  T       X
  Z       Z
  Y       Y
  X       R1

LastX    LastX

Replacing the final R↓ with CLX + duplicates the previous Z to T while it clears LastX.
As far as I can see you always have to sacrifice one register.

Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-11-2017 10:07 PM

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