IN LC-3. Modify the code to satisfy the Description of Code Description of Code: ; Reads two (2) values from Memory, displays message about status of first (startVal) ; Add both values, display message about status of added values, ; and stores added value to Memory. Requirements: Reads two (2) values from Memory Displays message about status of first (startVal) Add both values Display message about status of added values Stores added value to Memory Do not modify outside of the ";;;;;Your Code Here" block Suggested Test Data: startVal : 5, addThis: -6, Was output: "Value was Positive", Is output: "Value is Negative". Result contains -1 startVal : -5, addThis: -6, Was output: "Value was Negative", Is output: "Value is Negative". Result contains -11 startVal : -5, addThis: 5, Was output: "Value was Negative", Is output: "Value is Zero". Result contains 0 startVal : 0, addThis: 0, Was output: "Value was Zero", Is output: "Value is Zero". Result contains 0 Hints: R0 is a 'reserved' register when printing strings to the console. Don't overwrite your data when trying to print to the console The 'was' and 'is' parts of this assignment are very similar. Spend most of your time creating the 'was' section. Then copy, paste, and modify the 'is' section After making sure the 'was' section works, use the Set Breakpoint feature of the debugging tools to jump past all that when working in the 'is' section. Code: .ORIG x3000 ;;;;; Your code here ;;;;; End of your code Done HALT ;End of Program ;Data Declarations------------- startVal .FILL #5 ;*** Starting value addThis .FILL #-6 ;*** Value to add Result .BLKW 1 ;*** Memory location to store new value ;*** Output Message options for startVal's inital status WasPos .STRINGZ "Value was Positive, " WasNeg .STRINGZ "Value was Negative, " WasZero .STRINGZ "Value was Zero, " ;*** Output Message options for added value's status IsPos .STRINGZ "Value is now Positive" IsNeg .STRINGZ "Value is now Negative" IsZero .STRINGZ "Value is now Zero" .END
IN LC-3. Modify the code to satisfy the Description of Code
Description of Code:
; Reads two (2) values from Memory, displays message about status of first (startVal)
; Add both values, display message about status of added values,
; and stores added value to Memory.
Requirements:
- Reads two (2) values from Memory
- Displays message about status of first (startVal)
- Add both values
- Display message about status of added values
- Stores added value to Memory
- Do not modify outside of the ";;;;;Your Code Here" block
Suggested Test Data:
- startVal : 5, addThis: -6, Was output: "Value was Positive", Is output: "Value is Negative". Result contains -1
- startVal : -5, addThis: -6, Was output: "Value was Negative", Is output: "Value is Negative". Result contains -11
- startVal : -5, addThis: 5, Was output: "Value was Negative", Is output: "Value is Zero". Result contains 0
- startVal : 0, addThis: 0, Was output: "Value was Zero", Is output: "Value is Zero". Result contains 0
Hints:
R0 is a 'reserved' register when printing strings to the console. Don't overwrite your data when trying to print to the console
The 'was' and 'is' parts of this assignment are very similar. Spend most of your time creating the 'was' section. Then copy, paste, and modify the 'is' section
After making sure the 'was' section works, use the Set Breakpoint feature of the debugging tools to jump past all that when working in the 'is' section.
Code:
.ORIG x3000
;;;;; Your code here
;;;;; End of your code
Done HALT
;End of Program
;Data Declarations-------------
startVal .FILL #5 ;*** Starting value
addThis .FILL #-6 ;*** Value to add
Result .BLKW 1 ;*** Memory location to store new value
;*** Output Message options for startVal's inital status
WasPos .STRINGZ "Value was Positive, "
WasNeg .STRINGZ "Value was Negative, "
WasZero .STRINGZ "Value was Zero, "
;*** Output Message options for added value's status
IsPos .STRINGZ "Value is now Positive"
IsNeg .STRINGZ "Value is now Negative"
IsZero .STRINGZ "Value is now Zero"
.END
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images