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

Question 3,4 Lab Questions - 1. Write inst type your answers here rite instructi

ID: 3756916 • Letter: Q

Question

Question 3,4

Lab Questions - 1. Write inst type your answers here rite instructions to store the digits 0-9 in locations starting at $12 the ORG and DC.B directives. 00 using only 2. Start with a new programsie table. In the "Assembly" window, right click and choose Format->hex, right- elick again and choose Display->Code. new program shell. Run the following code in Code Warrior and fill out the table. In LOOP CLRA LDX #$1500 STAA 0,X STAA PORTB STAA $1500 BRA LOOP Addressing Mode Instruction IP Address Opcode Operand CLRA LDX #$1500 STAA 0, X STAA PORTB STAA $1500 BRA LOOP 3. Does the STAA instruction always have the same opcode? If not, why do you think it differs? 4. Is the operand for the BRA instruction above a positive or negative number? What does this number mean in terms of branching?

Explanation / Answer

3. The opcode for the STAA instruction will always be A (Accumulator)
as the instruction itself states that STAA means store the content of Accumulator to the memory location specified in the operand.
Operands may differ for the different instructions, I.e., the operand may be direct memory location or indirect memory location etc.,
Examples:
a. LDAA #$80 loads the A register with the hex number $80
b. STAA #$1000 stores the contents of the A register at memory location $1000. etc.,

4. BRA Loop instruction:
The operand of this instruction will be negative,
Explanation: here the operand will the displacement between the program counters of address of "loop" to the program counter address of current instruction. On this case the loop address will be smaller and he program counter of the BRA instruction is higher. The difference will always be negative. So the operand will the negative
Let us assume the IP address for CLR A is 100 and thd IP address for the BRA will be around 116(approx) when the BRA going to be execute, the difference 100- 116 will be the operand i.e operand will be -16. While branching the operand value will be added to the current IP address value and branched to the resultant IP address. In this case -16 will add to 116 and the result is 100 and it will branch to the 100 address location.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote