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, 23.06.2019 04:00
Laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. she adds pictures of that place in her letter. which feature of a word processing program will claire to remove unwanted parts of the pictures?
Answers: 3
question
Computers and Technology, 23.06.2019 09:00
The first screen you see when you open word2016 what is called?
Answers: 1
question
Computers and Technology, 24.06.2019 08:20
Which type of entity describes a fundamental business aspect of a database? a. linking b. lookup c. domain d. weak
Answers: 3
question
Computers and Technology, 24.06.2019 08:30
Formatting rows and columns is similar to cell formatting. in an openoffice calc spreadsheet, you can format data entered into rows and columns with the of the rows and columns options. you can insert rows and columns into, or delete rows and columns from, a spreadsheet. use the insert or delete rows and columns option on the insert tab. alternatively, select the row or column where you want new rows or columns to appear, right-click, and select insert only row or only column options. you can hide or show rows and columns in a spreadsheet. use the hide or show option on the format tab. for example, to hide a row, first select the row, then choose the insert tab, then select the row option, and then select hide. alternatively, you can select the row or columns, right-click, and select the hide or show option. you can adjust the height of rows and width of columns. select row and then select the height option on the format tab. similarly, select column, then select the width option on the format tab. alternatively, you can hold the mouse on the row and column divider, and drag the double arrow to the position. you can also use the autofit option on the table tab to resize rows and columns.
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, 14.03.2022 14:00
question
Mathematics, 14.03.2022 14:00
question
Mathematics, 14.03.2022 14:00
question
Mathematics, 14.03.2022 14:00
question
Mathematics, 14.03.2022 14:00
question
Computers and Technology, 14.03.2022 14:00
Questions on the website: 13722362