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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started