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 14:30
The “rule of 72” is used to approximate the time required for prices to double due to inflation. if the inflation rate is r%, then the rule of 72 estimates that prices will double in 72/r years. for instance, at an inflation rate of 6%, prices double in about 72/6 or 12 years. write a program to test the accuracy of this rule. for each interest rate from 1% to 20%, the program should display the rounded value of 72/r and the actual number of years required for prices to double at an r% inflation rate. (assume prices increase at the end of each year.)
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. what critical detail must she have before she starts designing the brochure?
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
What season was better from fortnite?
Answers: 2
question
Computers and Technology, 23.06.2019 00:10
Write a function so that the main0 code below can be replaced by the simpler code that calls function mphandminutes tomiles0. original main0 int main) l double milesperhour-70.0; double minutestraveled = 100.0; double hourstraveled; double milestraveled; hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; cout < "miles" 2 using namespace std; 4 /* your solution goes here/ 6 int maino 1 test passed 7 double milesperhour 70.0 all tests passed 8 double minutestraveled 100.0; 10 cout < < "miles: " < < mphandminutestomiles(milesper-hour, minutestraveled) < < endl; 12 return 0; 13
Answers: 1
You know the right answer?
Objective The purpose of this assignment is to give students practice with I/O, left-shifting, mult...
Questions
question
Mathematics, 26.03.2020 22:35
question
Mathematics, 26.03.2020 22:35
question
Mathematics, 26.03.2020 22:35
question
Mathematics, 26.03.2020 22:35
question
Mathematics, 26.03.2020 22:35
question
Mathematics, 26.03.2020 22:35
Questions on the website: 13722359