Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Recall that the op-code and operand are represented in memory by HEX numbers (e.

ID: 3789829 • Letter: R

Question

Recall that the op-code and operand are represented in memory by HEX numbers (e.g., LDAA $3000 will show in memory as $B6, $30, and $00). Write a short program to use the commands LDAA and STAA to load and store a value of your choice. Then show in your screenshots the machine language op-code and operand of these instructions and where in memory this is stored. Finally, execute and show the relevant registers and memory locations in your screenshots. Take note of how many cycles where needed to fetch, decode, and execute each instruction (i.e., LDAA will take an "x" amount of cycles and STAA will take an "x" amount of cycles). Hint: See the register window in the CW simulator and the "HCS12 instruction set reference" on the course website.

Can someone explain how to do this please?

Explanation / Answer

LDA Load the accumulator with a data from the the memory in a particular address. It's is a three byte instruction.First byte is the opcode, second & third byte together will give the address from where data is to be moved into accumulator. STA , Store the current contents of the Accumulator in to the memory, whose address will be given as part of instruction. Here also first byte is opcode and the second & third byte together give the address. Both are examples of Direct Addressing method.

This can be more clearly understood and remembered by considering the accumulator as a carrying truck. Now when we talk about LDA i.e Load Accumulator Direct then that will signify loading the accumulator with something. For instance, if i have taken LDA 3000H then accumulator will be loaded with the contents of the memory location 3000H, as if a truck is being loaded with some material.

On the other hand, STA i.e Store Accumulator Direct will store the contents of the accumulator to the specified memory location for instance, STA 4000H will store the contents of the accumulator to the memory location 4000H. As if we have taken the stuff out from the truck and put it safely in our homes. (If you have just been shifted to a new home or have seen someone loading and unloading the truck then this visualization can be more clear!)

Data is always loaded from the memory and is always stored into the memory! This line can help a great deal to understand the difference between LDA and STA instruction in 8085 microprocessor. This is the way which i learnt it! Hope it will help you too! :)