How do I print in decimal in LC3?How to get the ASCII value of a character?LC-3 .BLKW How it worksHow to BR with nzp=000 in LC3LC3 Programming - Printing a histogramhow to overwrite in the memory of lc3LC3 Starting Address of the FileLC3 MultiplicationHow to print multiple text lines in LC3LC3 how do I print user input to screen?Displaying 3 digits numbers to the console LC3
Arcane Tradition and Cost Efficiency: Learn spells on level-up, or learn them from scrolls/spellbooks?
Dedicated bike GPS computer over smartphone
How can Caller ID be faked?
How can I detect if I'm in a subshell?
Digital signature that is only verifiable by one specific person
Reflecting Telescope Blind Spot?
Do items with curse of vanishing disappear from shulker boxes?
Are athletes' college degrees discounted by employers and graduate school admissions?
Must a CPU have a GPU if the motherboard provides a display port (when there isn't any separate video card)?
Can an escape pod land on Earth from orbit and not be immediately detected?
Fastest path on a snakes and ladders board
Boss making me feel guilty for leaving the company at the end of my internship
Does anyone recognize these rockets, and their location?
How can this shape perfectly cover a cube?
Does WiFi affect the quality of images downloaded from the internet?
How do I say what something is made out of?
New Site Design!
Print the phrase "And she said, 'But that's his.'" using only the alphabet
My parents claim they cannot pay for my college education; what are my options?
Bullying by school - Submitted PhD thesis but not allowed to proceed to viva until change to new supervisor
Using roof rails to set up hammock
Why not make one big CPU core?
How could I create a situation in which a PC has to make a saving throw or be forced to pet a dog?
Is there a term for someone whose preferred policies are a mix of Left and Right?
How do I print in decimal in LC3?
How to get the ASCII value of a character?LC-3 .BLKW How it worksHow to BR with nzp=000 in LC3LC3 Programming - Printing a histogramhow to overwrite in the memory of lc3LC3 Starting Address of the FileLC3 MultiplicationHow to print multiple text lines in LC3LC3 how do I print user input to screen?Displaying 3 digits numbers to the console LC3
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a code that lets user input 5 numbers and they will be added up and the sum will be displayed. If the user hits ENTER the sum will be displayed and if they press q the program will halt. I am new to LC3 and I never understood how to change a value from ASCII to decimal. I don't know if the value is not being stored or if the sum operation is not right. Anyone know how to do this?
I already tried to use x0030 (48) and subtract it from the sum but it does not work.
.ORIG x3000
RESTART
AND R0, R0, #0
AND R1, R1, #0
AND R2, R2, #0
AND R3, R3, #0 ;Clear all registers
AND R4, R4, #0
AND R5, R5, #0
AND R6, R6, #0
LEA R0, MESSAGE ;Load and print first prompt message
PUTS
ADD R4, R4, #4 ;Set counter
SUM
GETC ;Get input and echo it
OUT
ADD R1, R0, #0
LD R6, QKEY
NOT R6, R6
ADD R1, R6, R0 ;Check if user pressed the letter q
BRz DONE
LD R2, ENTER
NOT R2, R2 ;Check if user pressed ENTER key
ADD R1, R2, R0
BRz FINISH
ADD R1, R0, R1 ;Store sum value in R1
LEA R0, NEXT
PUTS ;Load and print next prompt
ADD R4, R4, #-1 ;Decrement counter
BRp SUM ;Loop
GETC ;Get final input and echo it
OUT
ADD R1, R0, #0
LD R6, QKEY
NOT R6, R6
ADD R1, R6, R0 ;Check if user pressed the letter q
BRz DONE
LD R2, ENTER
NOT R2, R2 ;Check if user pressed ENTER key
ADD R1, R2, R0
BRz FINISH
FINISH
LEA R0, OUTPUT ;Load and print prompt of sum
PUTS
LD R3, NEG30
NOT R3, R3
ADD R3, R3, #1
ADD R1, R1, R0
OUT
BR RESTART ;Restart program
DONE
LEA R0, QUIT
PUTS ;Load and print quit prompt
HALT
MESSAGE .STRINGZ "n Enter Start Number (0 - 9): "
NEXT .STRINGZ "n Enter Next Number (0 - 9): "
OUTPUT .STRINGZ "n The sum of the numbers is: "
NEG30 .FILL x30
QUIT .STRINGZ "n Thank you for playing!"
QKEY .FILL x70
ENTER .FILL x09
.END
ascii lc3
add a comment |
I have a code that lets user input 5 numbers and they will be added up and the sum will be displayed. If the user hits ENTER the sum will be displayed and if they press q the program will halt. I am new to LC3 and I never understood how to change a value from ASCII to decimal. I don't know if the value is not being stored or if the sum operation is not right. Anyone know how to do this?
I already tried to use x0030 (48) and subtract it from the sum but it does not work.
.ORIG x3000
RESTART
AND R0, R0, #0
AND R1, R1, #0
AND R2, R2, #0
AND R3, R3, #0 ;Clear all registers
AND R4, R4, #0
AND R5, R5, #0
AND R6, R6, #0
LEA R0, MESSAGE ;Load and print first prompt message
PUTS
ADD R4, R4, #4 ;Set counter
SUM
GETC ;Get input and echo it
OUT
ADD R1, R0, #0
LD R6, QKEY
NOT R6, R6
ADD R1, R6, R0 ;Check if user pressed the letter q
BRz DONE
LD R2, ENTER
NOT R2, R2 ;Check if user pressed ENTER key
ADD R1, R2, R0
BRz FINISH
ADD R1, R0, R1 ;Store sum value in R1
LEA R0, NEXT
PUTS ;Load and print next prompt
ADD R4, R4, #-1 ;Decrement counter
BRp SUM ;Loop
GETC ;Get final input and echo it
OUT
ADD R1, R0, #0
LD R6, QKEY
NOT R6, R6
ADD R1, R6, R0 ;Check if user pressed the letter q
BRz DONE
LD R2, ENTER
NOT R2, R2 ;Check if user pressed ENTER key
ADD R1, R2, R0
BRz FINISH
FINISH
LEA R0, OUTPUT ;Load and print prompt of sum
PUTS
LD R3, NEG30
NOT R3, R3
ADD R3, R3, #1
ADD R1, R1, R0
OUT
BR RESTART ;Restart program
DONE
LEA R0, QUIT
PUTS ;Load and print quit prompt
HALT
MESSAGE .STRINGZ "n Enter Start Number (0 - 9): "
NEXT .STRINGZ "n Enter Next Number (0 - 9): "
OUTPUT .STRINGZ "n The sum of the numbers is: "
NEG30 .FILL x30
QUIT .STRINGZ "n Thank you for playing!"
QKEY .FILL x70
ENTER .FILL x09
.END
ascii lc3
add a comment |
I have a code that lets user input 5 numbers and they will be added up and the sum will be displayed. If the user hits ENTER the sum will be displayed and if they press q the program will halt. I am new to LC3 and I never understood how to change a value from ASCII to decimal. I don't know if the value is not being stored or if the sum operation is not right. Anyone know how to do this?
I already tried to use x0030 (48) and subtract it from the sum but it does not work.
.ORIG x3000
RESTART
AND R0, R0, #0
AND R1, R1, #0
AND R2, R2, #0
AND R3, R3, #0 ;Clear all registers
AND R4, R4, #0
AND R5, R5, #0
AND R6, R6, #0
LEA R0, MESSAGE ;Load and print first prompt message
PUTS
ADD R4, R4, #4 ;Set counter
SUM
GETC ;Get input and echo it
OUT
ADD R1, R0, #0
LD R6, QKEY
NOT R6, R6
ADD R1, R6, R0 ;Check if user pressed the letter q
BRz DONE
LD R2, ENTER
NOT R2, R2 ;Check if user pressed ENTER key
ADD R1, R2, R0
BRz FINISH
ADD R1, R0, R1 ;Store sum value in R1
LEA R0, NEXT
PUTS ;Load and print next prompt
ADD R4, R4, #-1 ;Decrement counter
BRp SUM ;Loop
GETC ;Get final input and echo it
OUT
ADD R1, R0, #0
LD R6, QKEY
NOT R6, R6
ADD R1, R6, R0 ;Check if user pressed the letter q
BRz DONE
LD R2, ENTER
NOT R2, R2 ;Check if user pressed ENTER key
ADD R1, R2, R0
BRz FINISH
FINISH
LEA R0, OUTPUT ;Load and print prompt of sum
PUTS
LD R3, NEG30
NOT R3, R3
ADD R3, R3, #1
ADD R1, R1, R0
OUT
BR RESTART ;Restart program
DONE
LEA R0, QUIT
PUTS ;Load and print quit prompt
HALT
MESSAGE .STRINGZ "n Enter Start Number (0 - 9): "
NEXT .STRINGZ "n Enter Next Number (0 - 9): "
OUTPUT .STRINGZ "n The sum of the numbers is: "
NEG30 .FILL x30
QUIT .STRINGZ "n Thank you for playing!"
QKEY .FILL x70
ENTER .FILL x09
.END
ascii lc3
I have a code that lets user input 5 numbers and they will be added up and the sum will be displayed. If the user hits ENTER the sum will be displayed and if they press q the program will halt. I am new to LC3 and I never understood how to change a value from ASCII to decimal. I don't know if the value is not being stored or if the sum operation is not right. Anyone know how to do this?
I already tried to use x0030 (48) and subtract it from the sum but it does not work.
.ORIG x3000
RESTART
AND R0, R0, #0
AND R1, R1, #0
AND R2, R2, #0
AND R3, R3, #0 ;Clear all registers
AND R4, R4, #0
AND R5, R5, #0
AND R6, R6, #0
LEA R0, MESSAGE ;Load and print first prompt message
PUTS
ADD R4, R4, #4 ;Set counter
SUM
GETC ;Get input and echo it
OUT
ADD R1, R0, #0
LD R6, QKEY
NOT R6, R6
ADD R1, R6, R0 ;Check if user pressed the letter q
BRz DONE
LD R2, ENTER
NOT R2, R2 ;Check if user pressed ENTER key
ADD R1, R2, R0
BRz FINISH
ADD R1, R0, R1 ;Store sum value in R1
LEA R0, NEXT
PUTS ;Load and print next prompt
ADD R4, R4, #-1 ;Decrement counter
BRp SUM ;Loop
GETC ;Get final input and echo it
OUT
ADD R1, R0, #0
LD R6, QKEY
NOT R6, R6
ADD R1, R6, R0 ;Check if user pressed the letter q
BRz DONE
LD R2, ENTER
NOT R2, R2 ;Check if user pressed ENTER key
ADD R1, R2, R0
BRz FINISH
FINISH
LEA R0, OUTPUT ;Load and print prompt of sum
PUTS
LD R3, NEG30
NOT R3, R3
ADD R3, R3, #1
ADD R1, R1, R0
OUT
BR RESTART ;Restart program
DONE
LEA R0, QUIT
PUTS ;Load and print quit prompt
HALT
MESSAGE .STRINGZ "n Enter Start Number (0 - 9): "
NEXT .STRINGZ "n Enter Next Number (0 - 9): "
OUTPUT .STRINGZ "n The sum of the numbers is: "
NEG30 .FILL x30
QUIT .STRINGZ "n Thank you for playing!"
QKEY .FILL x70
ENTER .FILL x09
.END
ascii lc3
ascii lc3
asked Mar 25 at 2:48
Luis MLuis M
11
11
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330661%2fhow-do-i-print-in-decimal-in-lc3%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330661%2fhow-do-i-print-in-decimal-in-lc3%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown