<aside> <img src="/icons/map-pin_gray.svg" alt="/icons/map-pin_gray.svg" width="40px" /> Relevant Notes/Resources:

4 Advanced Assembly Programming

Instruction Set

</aside>


Enter the Value

The concept is pretty similar to what we did for the midterm. The entirety of the question usually revolves around the instruction swi, which performs the following operation:

Untitled

As noted in the operation, SP refers to the stack pointer. But, also as a reminder, a stack goes from a high address to low address. So when we subtract, we go “up” the table.

Untitled

In general, the stack after swi is executed should look something like this:

Untitled

I’ll provide a brief explanation on the first two operations, as the rest pretty much follow the same concept:

Then, this repeats for $Y_H:Y_L$ , $X_H:X_L$ , $B:A$ and $CCR$. At which, you should obtain the following stack frame:

Untitled

The solution for the other question is:

  1. ldd #$7843 load register D with $7843.
  2. aba adds accumulator A and B, and loads the results to accumulator A.