Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

1. What are the pros and cons of diversity for an organisation?

Answered: 1 week ago