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

Page 6 (8 points) The following is an assembly language program written for the

ID: 2266389 • Letter: P

Question

Page 6 (8 points) The following is an assembly language program written for the 68HC11. Determine the values stored in accumulators A and B at the end of the program. (Clearly show the values of A and B after each instruction for partial credit.) STAA $2B STAB $19 ABA ADDA $19 SUBB #$19 COMA NEGB END Final Results: A = B= (8 points) The following is an assembly language program written for the 68HC11. Determine stored in acumulators A and B at the end of the program. (Clearly show the values of A and B instruction for partial credit.) 10. LDAA #$00 STAA $40 LDAB #$30 LI LDAA $40 ADDA #$02 STAA $40 DECB SUBA #SOA BNE LI L2 BRAL2 END B= Final Results: A

Explanation / Answer

LDAA #$19

Load Accumulator A with hexadecimal 19

A = (19)16

STAA $2B

Store Accumulator A at memory 2B Location

A = (19)16 , [2B] <- A

LDAB #$2B

Load Accumulator B with 2B

B = (2B)16 , A = (19)16

STAB $19

Store Accumulator B at memory (19)16 Location

[19] <- 2B

ABA

Add A with B and store result in A

A = (44)16 , B = (2B)16

ADDA $19

Add location (19)16 content to A

A = (6F)16 , B = (2B)16

SUBB #$19

Subtract (19)16 from B

A = (6F)16 , B = (12)16

COMA

Complement Accumulator A

A = (90)16 , B = (12)16

NEGB

Change sign of B content. B= 00 with overflow

A = (90)16 , B = (EE)16

END

END of program directive

Final Result A = (90)16 = 144, B=EE=238

LDAA #$00

Load Accumulator A with hexadecimal 00

A = (00)16

STAA $40

Store Accumulator A at memory 40 Location

A = (00)16 , [40] <- A

LDAB #$30

Load Accumulator B with hexadecimal (30)16

B = (30)16 , A = (00)16

L1 LDAA $40

Load Accumulator A from memory 40

B = (30)16 , A = (00)16

ADDA #$02

Add A with immediate hex 02

B = (30)16 , A = (02)16

STAA $40

Store A at location 40

B = (30)16 , A = (02)16, [40] <- 02

DECB

Decrement B by 1

B = (2F)16 , A = (02)16

SUBA #$0A

Subtract 0A from A and store result in A

B = (2F)16 , A = (F8)16 , Carry = 1

BNE L1

Branch if not Zero, Z=0

B = (2F)16 , A = (F8)16

L2 BRA L2

Infinite loop

END

END of program directive

Final Results B = (2F)16 = 47 , A = (F8)16 = -8

LDAA #$19

Load Accumulator A with hexadecimal 19

A = (19)16

STAA $2B

Store Accumulator A at memory 2B Location

A = (19)16 , [2B] <- A

LDAB #$2B

Load Accumulator B with 2B

B = (2B)16 , A = (19)16

STAB $19

Store Accumulator B at memory (19)16 Location

[19] <- 2B

ABA

Add A with B and store result in A

A = (44)16 , B = (2B)16

ADDA $19

Add location (19)16 content to A

A = (6F)16 , B = (2B)16

SUBB #$19

Subtract (19)16 from B

A = (6F)16 , B = (12)16

COMA

Complement Accumulator A

A = (90)16 , B = (12)16

NEGB

Change sign of B content. B= 00 with overflow

A = (90)16 , B = (EE)16

END

END of program directive