CO2:Interpret the M68HC11 instruction sets Mappiag CO,PO,Domain,Kl: CO1,PO1 C03:
ID: 1300282 • Letter: C
Question
CO2:Interpret the M68HC11 instruction sets Mappiag CO,PO,Domain,Kl: CO1,PO1 C03: Develop a firmware using 68HC11 assembly language Part A [15 marks] Q1. What are the contents of ACCA and ACCB if the following program is executed? ORG $700 LDAX #DATA LDAA 0,X ADDA 1,X BCS FKEE TAB BRA SKIP FKEE LDAB 3,X SKIP ORG $800 DATA FCC 11 22 33 44 55 66 (4 marks) 02. If the following program is executed, determine the number of BNE instruction to be executed? LDAB #10 AGAIN3 LDAA #5 AGAIN2 DECA BNE AGAIN2 DECB BNE AGAIN3 (2 marks) ASA FKEE UMPExplanation / Answer
Q 1
ORG $700 ; It’s an assembler directive to store program in given memory location
LDAX #DATA ; Load Index register X with the address of DATA
LDAA 0, X ; Read first element of DATA into A register (A = 11)
ADDA 1, X ; Add second number from DATA array to Accumulator A (A = 11 + 22 = 33 in hex)
BCS FKEE1 ; skip this as no carry generated from previous operation
TAB ; Transfer A to B (i.e. A = B = 33 in hex)
BRA SKIP ; Branch to SKIP (SKIP is a label that assembler convert to address)
Hence Accumulator A = B = 33 in hex / 51 in decimal
Q 2
It’s a nested loop condition.
Internal loop causes BNE to execute 5 times as A decrements by 1 every iteration. In fifth iteration comes out of internal loop
Again external loop gets decremented by 1 and branch back to AGAIN3 if reg B not zero.
Hence AGAIN2 BNE instruction executes 5 x 10 = 50 times (45 times true and 5 times false)
AGAIN3 BNE instruction executes 10 times (9 true and 1 false)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.