Question: Complete the program below so that it does the following: Adds two signed 16-bit numbers: A = A + B Divides the resulting sum by

Complete the program below so that it does the following: Adds two signed 16-bit numbers: A = A + B Divides the resulting sum by 4: A = A/4

.INCLUDE "m328pdef.inc"

.DEF AL = R18 ; low byte of A

.DEF AH = R19 ; high byte of A

.DEF BL = R20 ; low byte of B

.DEF BH = R21 ; high byte of B

.EQU ValueA = 0xF283 ;

.EQU ValueB = 0xC52 ;

.ORG 0

RJMP MAIN

.ORG 180

MAIN: LDI AL, LOW(ValueA)

LDI AH, HIGH(ValueA)

LDI BL, LOW(ValueB)

LDI BH, HIGH(ValueB)

______ ______, ______ (first blank: ANDI,ADD, ADC, AND) (second blank: AL, AH, BL, BH) adds the higher order bytes

______ ______, ______ (first blank: ANDI,ADD, ADC, AND) (second blank: AL, AH, BL, BH) adds the lower order bytes

_____ AH( LSL,LSR,ROR,ROL,ASR,SWAP)

_____ AL( LSL,LSR,ROR,ROL,ASR,SWAP)

_____ AH( LSL,LSR,ROR,ROL,ASR,SWAP)

_____ AL( LSL,LSR,ROR,ROL,ASR,SWAP)

WAIT: RJMP WAIT ; loop forever

; the final result in R18 is 0,1,2,3,4,5,6,7,8,9, A,B,C,D,E,,F

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!