Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assembly Language Lab (LC-3) Hi all , im in a computer organization class , and we are experimenting with assembly code.. My homework is to

Assembly Language Lab (LC-3)

Hi all , im in a computer organization class , and we are experimenting with assembly code.. My homework is to use a LC-3 Simulator and write out a program that does the follwing two things ....

(OddsEven reference are after the pictures)

LC-3 Web simulator : https://wchargin.github.io/lc3web/

image text in transcribed

image text in transcribed

OddsEven

/******************************************************************************************

0011 0000 0000 0000 ; Start the program at location 0x3000.
0101 001 001 1 00000 ; Clear R1, the result.
0101 100 100 1 00000 ; Clear R4, the mask.
0010 011 000101101 ; Load the data at location 0x3030 into R3.
0001 100 100 1 00001 ; Set the mask in R4.
0101 001 011 000 100 ; AND R4 with R3; put the result in R1.
0011 001 000101011 ; Store the result at location 0x3031
1111 0000 00100101 ; Halt.

*************************************************************************************/

Part 3a: Counting '1's An important characteristic of a binary value is the number of '1's within it. Develop an LC-3 program that counts the number of bits set to 1' in the value at memory location 0x3100. Store this number in memory at location 0x3101 For example, if memory contains Address Data 0x30FF 0x3100 0110 1000 1111 0110 0x3101 0x3102 Then, after running your program, it should contain Address Data 0x30FF 0x3100 0110 1000 1111 0110 0x3101 0000 0000 0000 1001 0x3102 Strive to make your program as short as possible. A clear, concise program should accomplish this task in about 11 instructions. A slightly less readable program can do it in 8 (including the final HALT) While working on this program, you may find it useful to read through evenOdd.bin. This program deter mines the parity of the value at memory location 0x3030, storing 'l' at memory location 0x3031 if it is odd and 0' if it is even. Requirements: Write your program in a file named "part3a.bin" . Your program must start at memory location 0x3000 . After running your program, memory location 0x3101 must contain the number of '1's in the value at memory location 0x3100 . You must not mutate the value stored at memory location 0x3100 Aside from loading the value at location 0x3100 and storing the count at location 0x3101, you may not use memory for data Your program must use a loop to iterate through the bits in the value at location 0x3100 (the value whose '1's are being counted) . Your program must be able to be run multiple times by resetting the PC to 0x3000. It should not require that the LC-3 be reinitialized, that any files be reloaded, or that any registers be reset Each instruction in your program n must be commented. . Your source code must include comments describing the purpose of each register you use. Additionally include a comment with your name (and your partner's name, if applicable) Part 3a: Counting '1's An important characteristic of a binary value is the number of '1's within it. Develop an LC-3 program that counts the number of bits set to 1' in the value at memory location 0x3100. Store this number in memory at location 0x3101 For example, if memory contains Address Data 0x30FF 0x3100 0110 1000 1111 0110 0x3101 0x3102 Then, after running your program, it should contain Address Data 0x30FF 0x3100 0110 1000 1111 0110 0x3101 0000 0000 0000 1001 0x3102 Strive to make your program as short as possible. A clear, concise program should accomplish this task in about 11 instructions. A slightly less readable program can do it in 8 (including the final HALT) While working on this program, you may find it useful to read through evenOdd.bin. This program deter mines the parity of the value at memory location 0x3030, storing 'l' at memory location 0x3031 if it is odd and 0' if it is even. Requirements: Write your program in a file named "part3a.bin" . Your program must start at memory location 0x3000 . After running your program, memory location 0x3101 must contain the number of '1's in the value at memory location 0x3100 . You must not mutate the value stored at memory location 0x3100 Aside from loading the value at location 0x3100 and storing the count at location 0x3101, you may not use memory for data Your program must use a loop to iterate through the bits in the value at location 0x3100 (the value whose '1's are being counted) . Your program must be able to be run multiple times by resetting the PC to 0x3000. It should not require that the LC-3 be reinitialized, that any files be reloaded, or that any registers be reset Each instruction in your program n must be commented. . Your source code must include comments describing the purpose of each register you use. Additionally include a comment with your name (and your partner's name, if applicable)

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

More Books

Students also viewed these Databases questions

Question

c. What groups were least represented? Why do you think this is so?

Answered: 1 week ago