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;








0















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.










share|improve this question

















  • 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

















0















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.










share|improve this question

















  • 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













0












0








0








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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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












  • 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












1 Answer
1






active

oldest

votes


















0














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





share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    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





    share|improve this answer



























      0














      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





      share|improve this answer

























        0












        0








        0







        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





        share|improve this answer













        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






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 26 at 22:16









        RyanRyan

        62




        62





























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현