Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please note that this is all in assembley language, please answer all parts of the question with detailed answers so I can understand. 5. [8

Please note that this is all in assembley language, please answer all parts of the question with detailed answers so I can understand.

image text in transcribed

5. [8 points] Fill in the following assembly language program to find how many "1" in four 16- bit number which is located starting at the memory address 0x1234. The program should start at 0x10000 and the result (the number of"") should store in data register D3 ORG 0x10000 //Initialized 0 into D3 (the result) //set up the counter to count the 16-bit number //Pointing A0 to the initial data location //Initialized 0 into DO //Load the 16-bit number into DO and increment //A0 points to the next data location //shift 1 bit Right in DO //If the carry bit=0, branch to COUNT //otherwise, add 1 into the result //Decrement the Counter NEXT CLR . L %D0 LOOP ASR.L COUNT #1,8D3 ADD 1, L COUNT SUBI #1,8D5 BNE LOOP //compare memory location to check if all //data have been read already //YES, done //set up the counter again //NO, next data //END the program BEQ EXIT MOVE , L #16,%D 5 BRA NEXT EXIT TRAP #15 5. [8 points] Fill in the following assembly language program to find how many "1" in four 16- bit number which is located starting at the memory address 0x1234. The program should start at 0x10000 and the result (the number of"") should store in data register D3 ORG 0x10000 //Initialized 0 into D3 (the result) //set up the counter to count the 16-bit number //Pointing A0 to the initial data location //Initialized 0 into DO //Load the 16-bit number into DO and increment //A0 points to the next data location //shift 1 bit Right in DO //If the carry bit=0, branch to COUNT //otherwise, add 1 into the result //Decrement the Counter NEXT CLR . L %D0 LOOP ASR.L COUNT #1,8D3 ADD 1, L COUNT SUBI #1,8D5 BNE LOOP //compare memory location to check if all //data have been read already //YES, done //set up the counter again //NO, next data //END the program BEQ EXIT MOVE , L #16,%D 5 BRA NEXT EXIT TRAP #15

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

Step: 3

blur-text-image

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

Students also viewed these Databases questions