to a memory location use). For a list S12 assembly instructions, see the \"HCS12
ID: 2085737 • Letter: T
Question
to a memory location use). For a list S12 assembly instructions, see the "HCS12 Instruction Set Reference" on the course website or in Appendix A in the book. Understanding the CCR Write code that will: 1) load registers A and B with $FF and $01 respectively e., the LDAA and LDAB instructions) and, 2) add the contents of registers A and B and store the result back into A. Remember, that registers A and B can only hold a byte (8-bits). However, $FF + $01 = $100 which is larger than a byte. In your report, indicate what is in register A and what relevant flags are set in the CCR after execution. Instruction Execution Cycle During the lecture, we stepped through the execution cycle of instructions LDAA and STAA (see pp. 22-25 in your book). 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). Please use the commands LDAA and STAA to load and store a value of your choice. Then show in your screenshots the machine language instructions and where in memory this is store execute and show the relevant registers and locations in your screenshots. In your report, indicate how many cycles were 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). What to Turn In (Please read this carefully) You are to put your code as text and screenshots into the "Lab_1_Template.docx" in the designated areas. This will be the file that file that you upload to TITANium as your submission. Provide your code as text, not an image. Points will be deducted if it is an image. You are then to takeExplanation / Answer
Answer:-2) The code in assembly is written below-
LDAA #$FF ; load register A with value $FF
LDAB #$01 ; load register B with value $01
ABA ; add accumulators A and B and store result in A
So A contains $00 and carry flag in Condition Code Register(CCR bit-0) is set. Note # is used for data and not for address.
Answer:-3) Insruction LDAA takes one machine cycle if immediate addressing is used, i.e LDAA #$FF. Here $FF is moved to register A. The machine code for this will be $86 $FF, where $86 is opcode and $FF is operand.
But LDAA $3600, is a direct addressing type and takes two machine cycles. This instruction will copy the content of memory location $3600 to register A in two machine cycle and the mahine code will be $96 $36 $00, note opcode is now $96 and not $86(for immediate case).
For instruction STAA, it takes two machine cycle for direct addressing mode, i.e STAA $3600 means cpoy content of A into memory location $3600 and the machine code will be $5A $36 $00. Immediate is not done with STAA.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.