subject

Objective The purpose of this assignment is to give students practice with I/O, left-shifting, multiplying by 2, and useful 2's complement logic.
High Level Description
Load any valid number into a register from the memory address specified in your assn 3 template and output it to the console as 16-bit two's complement binary (i. e. the native format of the LC-3) Note: Valid numbers are [ 32768, #32767] (decimal) or [x0000, x] (hex).
Your Tasks You do not yet know how to take a multi-digit decimal number from user input and convert it to binary, so for this assignment you are going to get the assembler to do that part for you: you will use the .FILL pseudo-op to take a literal (decimal or hex, as you wish) and translate it into 16-bit two's comp. binary, and store that value in the indicated memory location; and then you will Load that value from memory into R1.
You MUST use the provided assn3.asm template to set this up: it ensures that the number to be converted is always stored in the same location (the memory address specified in your template) so we can test your work; make sure you fully understand the code we provide.
At this point, your value will be stored in R1: it is now your job to extract the 1'sand O's from the number and print them out to the console one by one, from left to right.
Important things to consider
Recall the difference between a positive number and a negative number in 2's complement binary: if the most significant bit (MSB) is 0, the number is positive; if it is 1, the number is negative.
The BRanch instruction has parameters (n, z, p) which tell it to check whether a value is negative, zero, or positive (or any combination thereof).
Once you are done inspecting the MSB, how would you shift the next bit into its place so you could perform the next iteration?
Pseudocode
for(i = 15 downto 0):
if (bit[i] is a 0)
print a
eise
print a 1
shift left
CODE TEMPLATE:
.ORIG x3000 ; Program begins here
;
;Instructions
;
LD R6, Convert_addr ; R6 <-- Address pointer for Convert
LDR R1, R6, #0 ; R1 <-- VARIABLE Convert
;
;ENTER CODE HERE
;
HALT
;
;Data
;
Convert_addr .FILL xD000 ; The address of where to find the data
.ORIG xD000 ; Remote data
Convert .FILL xABCD ; <

;
;END of PROGRAM
;
.END

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
Jaina and tomas are being considered as new tenants in an apartment. the landlord looks at their creditworthiness because he wants to be sure his new tenant pays the rent on time and in full. the table below summarizes the information that was on their applications. application information questions jaina tomas how many years have you had your job? 5 2 what is your monthly salary? $1,850 $2,500 how many credit cards do you have? 4 1 how much debt do you have? $13,000 $7,000 how many times were you late with payments on credit cards in the past year? 5 1 who will the landlord decide to be more creditworthy and why? tomas because the ratio of his debt to income is less. jaina because she has had her job longer, which makes her look more stable. jaina because she has more credit cards available to her. tomas because he makes more money per month.
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
Of the following pieces of information in a document, for which would you most likely insert a mail merge field?
Answers: 3
question
Computers and Technology, 24.06.2019 07:30
Aproject involves many computing systems working together on disjointed task towards a single goal what form of computing would the project be using
Answers: 3
You know the right answer?
Objective The purpose of this assignment is to give students practice with I/O, left-shifting, mult...
Questions
question
Spanish, 13.11.2020 22:30
question
Mathematics, 13.11.2020 22:30
question
Chemistry, 13.11.2020 22:30
question
Mathematics, 13.11.2020 22:30
question
English, 13.11.2020 22:30
Questions on the website: 13722361