Finding largest integer of four inputs using MIPS assemblyMIPS Assembly - how to only accept integers between 1 and 15?How to read input from STDIN in x86_64 assembly?MIPS Assembly homework. Can't seem to find the bugMIPS, using a while loop to calculatethe sum of odd integers 1-9Printing out to five decimal places using MIPS integer commandsReplacing a 32-bit loop counter with 64-bit introduces crazy performance deviationsMIPS Assembly program not outputting the correct integersTrying to convert an asciiz 'integer' into an actual integer in MIPSMIPS- How to add one string to anotherMIPS questions about writing assembly to call functions on an array
How can I make 12 tone and atonal melodies sound interesting?
"due" instead of "to"?
Does putting salt first make it easier for attacker to bruteforce the hash?
How do free-speech protections in the United States apply in public to corporate misrepresentations?
Solving this logarithmic problem
Do people with slow metabolism tend to gain weight (fat) if they stop exercising?
bash vs. zsh: What are the practical differences?
C++ logging library
How to avoid typing 'git' at the begining of every Git command
How do we say "within a kilometer radius spherically"?
Difference between prepositions in "...killed during/in the war"
Why is Na5 not played in this line of the French Defense, Advance Variation?
How can I use the SpendProofV1 to prove I sent Monero to an exchange?
Amplitude of a crest and trough in a sound wave?
Who voices the small round football sized demon in Good Omens?
What is the color of artificial intelligence?
Why does smartdiagram replace the Greek letter xi by a number?
Rail-to-rail op-amp only reaches 90% of VCC, works sometimes, not everytime
Should I put programming books I wrote a few years ago on my resume?
If there's something that implicates the president why is there then a national security issue? (John Dowd)
Why was this person allowed to become Grand Maester?
Ability To Change Root User Password (Vulnerability?)
Is there a DSLR/mirorless camera with minimal options like a classic, simple SLR?
Derivative of a double integral over a circular region
Finding largest integer of four inputs using MIPS assembly
MIPS Assembly - how to only accept integers between 1 and 15?How to read input from STDIN in x86_64 assembly?MIPS Assembly homework. Can't seem to find the bugMIPS, using a while loop to calculatethe sum of odd integers 1-9Printing out to five decimal places using MIPS integer commandsReplacing a 32-bit loop counter with 64-bit introduces crazy performance deviationsMIPS Assembly program not outputting the correct integersTrying to convert an asciiz 'integer' into an actual integer in MIPSMIPS- How to add one string to anotherMIPS questions about writing assembly to call functions on an array
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I need to print the largest integer of four inputs from the user. I figured out how to do it up to three integers, but the last CMP I am having difficulties with. I need assistance with the last CMP.
I am assuming I need one more CMP to solve this issue, but everything I try always just prints out the largest of the first three numbers.
# this program prints out the four of two numbers
# The four numbers are read through the keyboard
.text
.globl main
main:
# Display prompt1
li $v0, 4
la $a0, prompt1
syscall
# read keyboard into $v0 (number x is number to test)
li $v0, 5
syscall
# move the first number from $v0 in $t0
move $t0,$v0
# Display the prmopt2 (string)
li $v0, 4
la $a0, prompt2
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the second number from $v0 in $t1
move $t1,$v0
# Display the prmopt3 (string)
li $v0, 4
la $a0, prompt3
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the third number from $v0 in $t2
move $t2,$v0
# Display the prmopt4 (string)
li $v0, 4
la $a0, prompt4
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the fourth number from $v0 in $t3
move $t3,$v0
# effectively these two lines do: $t1 = max($t0, $t1)
bge $t1, $t0, CMP2
move $t1, $t0
CMP2:
# effectively these two lines do: $t1 = max($t2, $t1)
bge $t1, $t2, L1
move $t1, $t2
# largest number in $t1
move $t2, $t0
# print answer
L1:
li $v0, 4
la $a0, answer
syscall
# print integer function call 1
# put the answer into $a0
li $v0, 1
move $a0, $t1
syscall
#exit
end: li $v0, 10
syscall
.data
prompt1:
.asciiz "Enter the first number "
prompt2:
.asciiz "Enter the second number "
prompt3:
.asciiz "Enter the third number "
prompt4:
.asciiz "Enter the fourth number "
answer:
.asciiz "The largest number is "
The actual results spit out the largest of the three numbers. I need the actual results of the largest of four integers.
assembly mips
add a comment |
I need to print the largest integer of four inputs from the user. I figured out how to do it up to three integers, but the last CMP I am having difficulties with. I need assistance with the last CMP.
I am assuming I need one more CMP to solve this issue, but everything I try always just prints out the largest of the first three numbers.
# this program prints out the four of two numbers
# The four numbers are read through the keyboard
.text
.globl main
main:
# Display prompt1
li $v0, 4
la $a0, prompt1
syscall
# read keyboard into $v0 (number x is number to test)
li $v0, 5
syscall
# move the first number from $v0 in $t0
move $t0,$v0
# Display the prmopt2 (string)
li $v0, 4
la $a0, prompt2
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the second number from $v0 in $t1
move $t1,$v0
# Display the prmopt3 (string)
li $v0, 4
la $a0, prompt3
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the third number from $v0 in $t2
move $t2,$v0
# Display the prmopt4 (string)
li $v0, 4
la $a0, prompt4
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the fourth number from $v0 in $t3
move $t3,$v0
# effectively these two lines do: $t1 = max($t0, $t1)
bge $t1, $t0, CMP2
move $t1, $t0
CMP2:
# effectively these two lines do: $t1 = max($t2, $t1)
bge $t1, $t2, L1
move $t1, $t2
# largest number in $t1
move $t2, $t0
# print answer
L1:
li $v0, 4
la $a0, answer
syscall
# print integer function call 1
# put the answer into $a0
li $v0, 1
move $a0, $t1
syscall
#exit
end: li $v0, 10
syscall
.data
prompt1:
.asciiz "Enter the first number "
prompt2:
.asciiz "Enter the second number "
prompt3:
.asciiz "Enter the third number "
prompt4:
.asciiz "Enter the fourth number "
answer:
.asciiz "The largest number is "
The actual results spit out the largest of the three numbers. I need the actual results of the largest of four integers.
assembly mips
1
Can you elaborate on what you tried? It's not making sense "tried everything"... implies there is no solution.... that's why you posted the question, right?! Just update the question. NO need for people to down-vote.
– ZF007
Mar 24 at 23:46
I figured it out, but I appreciate the feedback on how to properly ask the question. Thanks.
– Ryan
Mar 26 at 0:20
... I hate the suspense tension of having to wait to see your answer... "post your self-gained insight on solving your own communicated mystery a.s.a.p...." ;p
– ZF007
Mar 26 at 6:30
add a comment |
I need to print the largest integer of four inputs from the user. I figured out how to do it up to three integers, but the last CMP I am having difficulties with. I need assistance with the last CMP.
I am assuming I need one more CMP to solve this issue, but everything I try always just prints out the largest of the first three numbers.
# this program prints out the four of two numbers
# The four numbers are read through the keyboard
.text
.globl main
main:
# Display prompt1
li $v0, 4
la $a0, prompt1
syscall
# read keyboard into $v0 (number x is number to test)
li $v0, 5
syscall
# move the first number from $v0 in $t0
move $t0,$v0
# Display the prmopt2 (string)
li $v0, 4
la $a0, prompt2
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the second number from $v0 in $t1
move $t1,$v0
# Display the prmopt3 (string)
li $v0, 4
la $a0, prompt3
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the third number from $v0 in $t2
move $t2,$v0
# Display the prmopt4 (string)
li $v0, 4
la $a0, prompt4
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the fourth number from $v0 in $t3
move $t3,$v0
# effectively these two lines do: $t1 = max($t0, $t1)
bge $t1, $t0, CMP2
move $t1, $t0
CMP2:
# effectively these two lines do: $t1 = max($t2, $t1)
bge $t1, $t2, L1
move $t1, $t2
# largest number in $t1
move $t2, $t0
# print answer
L1:
li $v0, 4
la $a0, answer
syscall
# print integer function call 1
# put the answer into $a0
li $v0, 1
move $a0, $t1
syscall
#exit
end: li $v0, 10
syscall
.data
prompt1:
.asciiz "Enter the first number "
prompt2:
.asciiz "Enter the second number "
prompt3:
.asciiz "Enter the third number "
prompt4:
.asciiz "Enter the fourth number "
answer:
.asciiz "The largest number is "
The actual results spit out the largest of the three numbers. I need the actual results of the largest of four integers.
assembly mips
I need to print the largest integer of four inputs from the user. I figured out how to do it up to three integers, but the last CMP I am having difficulties with. I need assistance with the last CMP.
I am assuming I need one more CMP to solve this issue, but everything I try always just prints out the largest of the first three numbers.
# this program prints out the four of two numbers
# The four numbers are read through the keyboard
.text
.globl main
main:
# Display prompt1
li $v0, 4
la $a0, prompt1
syscall
# read keyboard into $v0 (number x is number to test)
li $v0, 5
syscall
# move the first number from $v0 in $t0
move $t0,$v0
# Display the prmopt2 (string)
li $v0, 4
la $a0, prompt2
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the second number from $v0 in $t1
move $t1,$v0
# Display the prmopt3 (string)
li $v0, 4
la $a0, prompt3
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the third number from $v0 in $t2
move $t2,$v0
# Display the prmopt4 (string)
li $v0, 4
la $a0, prompt4
syscall
# read keyboard into $v0
li $v0, 5
syscall
# move the fourth number from $v0 in $t3
move $t3,$v0
# effectively these two lines do: $t1 = max($t0, $t1)
bge $t1, $t0, CMP2
move $t1, $t0
CMP2:
# effectively these two lines do: $t1 = max($t2, $t1)
bge $t1, $t2, L1
move $t1, $t2
# largest number in $t1
move $t2, $t0
# print answer
L1:
li $v0, 4
la $a0, answer
syscall
# print integer function call 1
# put the answer into $a0
li $v0, 1
move $a0, $t1
syscall
#exit
end: li $v0, 10
syscall
.data
prompt1:
.asciiz "Enter the first number "
prompt2:
.asciiz "Enter the second number "
prompt3:
.asciiz "Enter the third number "
prompt4:
.asciiz "Enter the fourth number "
answer:
.asciiz "The largest number is "
The actual results spit out the largest of the three numbers. I need the actual results of the largest of four integers.
assembly mips
assembly mips
asked Mar 24 at 20:56
RyanRyan
62
62
1
Can you elaborate on what you tried? It's not making sense "tried everything"... implies there is no solution.... that's why you posted the question, right?! Just update the question. NO need for people to down-vote.
– ZF007
Mar 24 at 23:46
I figured it out, but I appreciate the feedback on how to properly ask the question. Thanks.
– Ryan
Mar 26 at 0:20
... I hate the suspense tension of having to wait to see your answer... "post your self-gained insight on solving your own communicated mystery a.s.a.p...." ;p
– ZF007
Mar 26 at 6:30
add a comment |
1
Can you elaborate on what you tried? It's not making sense "tried everything"... implies there is no solution.... that's why you posted the question, right?! Just update the question. NO need for people to down-vote.
– ZF007
Mar 24 at 23:46
I figured it out, but I appreciate the feedback on how to properly ask the question. Thanks.
– Ryan
Mar 26 at 0:20
... I hate the suspense tension of having to wait to see your answer... "post your self-gained insight on solving your own communicated mystery a.s.a.p...." ;p
– ZF007
Mar 26 at 6:30
1
1
Can you elaborate on what you tried? It's not making sense "tried everything"... implies there is no solution.... that's why you posted the question, right?! Just update the question. NO need for people to down-vote.
– ZF007
Mar 24 at 23:46
Can you elaborate on what you tried? It's not making sense "tried everything"... implies there is no solution.... that's why you posted the question, right?! Just update the question. NO need for people to down-vote.
– ZF007
Mar 24 at 23:46
I figured it out, but I appreciate the feedback on how to properly ask the question. Thanks.
– Ryan
Mar 26 at 0:20
I figured it out, but I appreciate the feedback on how to properly ask the question. Thanks.
– Ryan
Mar 26 at 0:20
... I hate the suspense tension of having to wait to see your answer... "post your self-gained insight on solving your own communicated mystery a.s.a.p...." ;p
– ZF007
Mar 26 at 6:30
... I hate the suspense tension of having to wait to see your answer... "post your self-gained insight on solving your own communicated mystery a.s.a.p...." ;p
– ZF007
Mar 26 at 6:30
add a comment |
1 Answer
1
active
oldest
votes
I ended up finding the solution on mine own. This was the snippet of code that I was in need of...
CMP1:
# the following lines perform this: $t1 = max($t0, $t1)
bge $t1, $t0, CMP2
move $t1, $t0
CMP2:
# the following lines perform this: $t1 = max($t2, $t1)
bge $t1, $t2, L1
move $t1, $t2
# the following lines perform this: $t1 = max($t3, $t2)
CMP3:
bge $t1, $t3, CMP2
move $t1, $t3
add a comment |
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%2f55328486%2ffinding-largest-integer-of-four-inputs-using-mips-assembly%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I ended up finding the solution on mine own. This was the snippet of code that I was in need of...
CMP1:
# the following lines perform this: $t1 = max($t0, $t1)
bge $t1, $t0, CMP2
move $t1, $t0
CMP2:
# the following lines perform this: $t1 = max($t2, $t1)
bge $t1, $t2, L1
move $t1, $t2
# the following lines perform this: $t1 = max($t3, $t2)
CMP3:
bge $t1, $t3, CMP2
move $t1, $t3
add a comment |
I ended up finding the solution on mine own. This was the snippet of code that I was in need of...
CMP1:
# the following lines perform this: $t1 = max($t0, $t1)
bge $t1, $t0, CMP2
move $t1, $t0
CMP2:
# the following lines perform this: $t1 = max($t2, $t1)
bge $t1, $t2, L1
move $t1, $t2
# the following lines perform this: $t1 = max($t3, $t2)
CMP3:
bge $t1, $t3, CMP2
move $t1, $t3
add a comment |
I ended up finding the solution on mine own. This was the snippet of code that I was in need of...
CMP1:
# the following lines perform this: $t1 = max($t0, $t1)
bge $t1, $t0, CMP2
move $t1, $t0
CMP2:
# the following lines perform this: $t1 = max($t2, $t1)
bge $t1, $t2, L1
move $t1, $t2
# the following lines perform this: $t1 = max($t3, $t2)
CMP3:
bge $t1, $t3, CMP2
move $t1, $t3
I ended up finding the solution on mine own. This was the snippet of code that I was in need of...
CMP1:
# the following lines perform this: $t1 = max($t0, $t1)
bge $t1, $t0, CMP2
move $t1, $t0
CMP2:
# the following lines perform this: $t1 = max($t2, $t1)
bge $t1, $t2, L1
move $t1, $t2
# the following lines perform this: $t1 = max($t3, $t2)
CMP3:
bge $t1, $t3, CMP2
move $t1, $t3
answered Mar 26 at 22:16
RyanRyan
62
62
add a comment |
add a comment |
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%2f55328486%2ffinding-largest-integer-of-four-inputs-using-mips-assembly%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
1
Can you elaborate on what you tried? It's not making sense "tried everything"... implies there is no solution.... that's why you posted the question, right?! Just update the question. NO need for people to down-vote.
– ZF007
Mar 24 at 23:46
I figured it out, but I appreciate the feedback on how to properly ask the question. Thanks.
– Ryan
Mar 26 at 0:20
... I hate the suspense tension of having to wait to see your answer... "post your self-gained insight on solving your own communicated mystery a.s.a.p...." ;p
– ZF007
Mar 26 at 6:30