News:

  • December 05, 2024, 04:24:35 AM

Login with username, password and session length

Author Topic: Accumulator stack question  (Read 3261 times)

Mickster

  • Newbie
  • *
  • Posts: 1
Accumulator stack question
« on: April 29, 2008, 06:22:20 PM »
Is the data in an accumulator stack retained from scan to scan?

MikeS

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 254
    • Host Engineering, Inc.
Re: Accumulator stack question
« Reply #1 on: April 30, 2008, 10:06:09 AM »
i believe that it is, the accumulator value would only change if an instruction is executed that uses the accumulator, and i don't know of anything that happens at the end or beginning of the scan that would manipulate the accumulator.
Good design costs a lot. Bad design costs even more.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3703
    • Host Engineering
Re: Accumulator stack question
« Reply #2 on: April 30, 2008, 04:46:08 PM »
I know that if an interrupt occurs, the accumulator stack is saved off, then from within the interrupt you can do all the LD/LDA/LD??? instructions you want, then when the IRT (return from interrupt) occurs, it restores the state of the accumulator stack.

I would not utilize this "feature" in your program, because the accumulator stack is meant to be "temporary" and not maintain a "pristine" state.

For example, the OUT box does NOT do a POP, so if you have ANY conditional load instructions from one scan to the next, you have no idea what the state of the accumulator stack is.

STR X0
LD V1400

STR X1
LD V1401

What is the state of the accumulator stack on scan #27?  Who knows! :D