Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an LC-3 assembly language program that counts the number of 1s in the value stored in RO and stores the result in R1. For

image text in transcribed
Write an LC-3 assembly language program that counts the number of 1s in the value stored in RO and stores the result in R1. For example, if RO contains 0001001101110000 (x1370), then after the program executes, the value stored in R1 would be 110 (decimal 6) Here are some hints from my solution ORIG x3000 AND R5, R5?#0 ADD R5, R5, #1.R5 will act as a mask to mask out the unneeded bit AND R 1, R 1, #0 zero out the result register AND R2, R2, #0 ,R2 will act as a counter LD R3, NegSixt MskLoop AND R4, RO, RS mask off the bit Add code here.. . if you want more than a 0-) HALT NegSat FILL , 16 END Mask logic 100 CREDIT Solicit the number to be inspected via the keyboard 10 points for a single digit (e g 5) decimal number, which must be converted to binary 20 points for a two digit (e g 55) decimal number, which must be converted to binary

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

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions

Question

1. Where will you recommend that she hold the focus group?

Answered: 1 week ago

Question

3. What might you have done differently

Answered: 1 week ago