MIPS Tutorial 26 While Loop in MIPS

Поділитися
Вставка
  • Опубліковано 20 січ 2025

КОМЕНТАРІ • 102

  • @MegaHarsit
    @MegaHarsit 5 років тому +254

    In my 21 years of life, I've never seen anyone more excited about MIPS loops than this guy lmao

    • @stefanmilinkovic6433
      @stefanmilinkovic6433 2 роки тому +4

      You’ve only been alive for 21 years lol that’s why

    • @muhibali205
      @muhibali205 2 роки тому

      @@stefanmilinkovic6433 lol hahah

    • @nastenkaoo
      @nastenkaoo Рік тому +1

      @@stefanmilinkovic6433 derdim olsun, kadehler dolsun

    • @anmolpandey5692
      @anmolpandey5692 Рік тому

      @@stefanmilinkovic6433 Haha, and he was 23 when he uploaded the video...

  • @johnfredcornell5046
    @johnfredcornell5046 4 роки тому +20

    Just wanted to say I'm really appreciating this video series.
    Amell, thanks for making this. I have to work on a MIPS program for a school project and this is saving me a TON of time on ramping up to where I have enough of a base to get the project done.

    • @amellperalta
      @amellperalta  4 роки тому +7

      I'm glad to know that. Happy coding!

  • @mohamednaeem9111
    @mohamednaeem9111 2 роки тому +10

    Sir /Mate Amell , Thank you Indeed for saving my grades and time, You deserve more than a Thanks to be honest, I really can't express how did these tutorials help me understand this university course, You are WAYYY better than my instructor. Wishing you all the best in life. Thanks Again!

  • @utku_berki1767
    @utku_berki1767 9 місяців тому +2

    Thanks this is Utku from Turkey with your help I hope I will get good score in my midterm
    Good Video !✨

  • @Fruitpigfoot
    @Fruitpigfoot 3 роки тому +2

    the best mips explanation possible on UA-cam!

  • @koraiko
    @koraiko 6 років тому +2

    thanks for your videos - I had problems with it in my university because our prof just said look in the internet for it and I found your channel and you explain it good and in detail so that I understand it

    • @amellperalta
      @amellperalta  6 років тому

      You are welcome, Koraiko. Happy coding!

  • @lennyatomz8389
    @lennyatomz8389 6 років тому +4

    Thank you for this incredibly helpful video, Amell! Excellent delivery as always. :-D

  • @shabirahmadzai4878
    @shabirahmadzai4878 8 років тому +3

    Thank you for making these beneficial tutorials. It really helps.

    • @amellperalta
      @amellperalta  8 років тому

      +Mohammad Shabir You're welcome, Mohammad.

    • @shabirahmadzai4878
      @shabirahmadzai4878 8 років тому

      +Quasar Distant where are you from?

    • @amellperalta
      @amellperalta  8 років тому

      +Mohammad Shabir Originally from the Dominican Republic.

  • @santibravo3704
    @santibravo3704 9 місяців тому +1

    thanks a lot, im from Argentina and this saves my uni subjet haha

    • @amellperalta
      @amellperalta  9 місяців тому

      You're welcome. Happy coding!

  • @edge2sharp538
    @edge2sharp538 5 років тому +1

    Amell! You're saving my ass in my CE class!! Thanks!!

  • @Et3rnalxGamer
    @Et3rnalxGamer 5 років тому

    This man has single handedly saved me 1/4 of my degree

  • @user-rz3xq6pv5b
    @user-rz3xq6pv5b 8 років тому +2

    im a french student and i thank you for this video !

    • @amellperalta
      @amellperalta  8 років тому +2

      Je vous en pris. Happy coding!

  • @CasenriqueLacerda
    @CasenriqueLacerda 4 роки тому +1

    You are amazing dude, this tutorial is the best

  • @powerhitter033
    @powerhitter033 8 років тому +8

    Great video man. Super helpful.

  • @TomDabektv
    @TomDabektv 8 років тому +16

    man im so fucked for my exam.... thanks for the video none the less

  • @groverkennedy2049
    @groverkennedy2049 4 роки тому +1

    Amell you are awesome!

  • @NOLAMarathon2010
    @NOLAMarathon2010 3 роки тому +1

    If I'm not mistaken, the inverse of less than ( < ) is greater than or equal to, ( bge ).

  • @jcinaty89
    @jcinaty89 4 роки тому +1

    Excellent tutorial!

  • @Animelover-oo7cz
    @Animelover-oo7cz 2 роки тому

    What if there are 2 conditions in a while loop? Like (i7)
    How could i write this in MIPS?

  • @ThuyNguyen-bu9ge
    @ThuyNguyen-bu9ge 9 років тому +3

    Instead of j while, can you use b while? Or is that not conventional? Thanks!

    • @samiimran9538
      @samiimran9538 5 років тому

      j is a key word for jump, so you have to use just j

  • @sancho608
    @sancho608 2 роки тому

    Hey Amell. I have a question. Are while loops written inside the main label or outside the main label like other procedures?

  • @anelisiwenomabhunga2684
    @anelisiwenomabhunga2684 2 роки тому

    Hi Amell,
    I just watched the entire series of MIPS tutorial that you have uploaded on your YT channel. Thanks for that , it really helped me a lot .
    I'd appreciate if you'd help me with my project, I have been trying to do it by my own but I'm struggling.
    The question is
    Write a MIPS Assembler and Real-Time Simulator (MARS) code that accepts two integers from the
    console and uses one procedure to add the two numbers and a second procedure to subtract the
    second integer from the first.
    The two procedures should be invoked within a loop with options such as 0 to add, 1 to subtract and
    9 to exit. Ensure that both procedures are implemented. The code should display both the sum of
    the two integers and the difference between the first and the second integers on the console.
    a) Write two versions of the code, with the first using beq for loop implementation and the
    second adopting bne.
    b) Is there any difference in the execution times for the two versions of the code? If yes, why is
    this so? If no, suggest the reason why.
    I'd really appreciate your help.
    -Anelisiwe

  • @loya945
    @loya945 4 роки тому

    hye guys im new to mips, could someone explain to me after jr $ra it would go to the main function right. So how does it goes to addi $t0 +1 if it always goes to jal printNumber first? im sorry i just dont understand the flow

  • @roneetgautam2126
    @roneetgautam2126 6 років тому +1

    Excuse me amell can i get the link for the software you using for mips or if the software name is enough.... A response is highly appreciated..

    • @amellperalta
      @amellperalta  6 років тому

      Hi Roneet. The link is: courses.missouristate.edu/KenVollmar/mars/download.htm
      You need Java installed on your computer to run the simulator.

  • @viniciusneto6824
    @viniciusneto6824 9 років тому +2

    Hi Amell! I'd like to thank you for doing this MIPS tutorial series. It's helped me a lot. I haven't gotten the ideia very well in college. So, now a question! Do you consider the following a good practice? Moving the contents of $t0 to an argument register ($a1) before calling the "printNumber" procedure and then inside the procedure move the contents of $a1 to an expression evaluation register like $v1 and do operations on top of that? That's what I've done.
    IN MAIN:
    move $a1, $t0
    jal printNumber
    printNumber:
    move $v1, $a1
    li $v0, 1
    move $a0, $v1
    syscall
    jr $ra

    • @amellperalta
      @amellperalta  9 років тому +1

      Vinícius Neto You're welcome, Vinicius. It would be good practice to follow the convention of using the $a registers for procedure arguments, but the $v registers are used for return values. Therefore, it's not necessary to store the argument in a $v register in this case.

    • @viniciusneto6824
      @viniciusneto6824 9 років тому

      Oh! Ok. I see that now. So I should operate on top of the argument registers? In a addNumbers procedure for example. I would pass 2 numbers to the procedure using $a1 and $a2 and then inside de procedure I'd do something like add $v1, $a1, $a2. Did I get it right?

    • @amellperalta
      @amellperalta  9 років тому

      Yes, you are right. Good job.

    • @viniciusneto6824
      @viniciusneto6824 9 років тому

      Thanks!

    • @amellperalta
      @amellperalta  9 років тому

      You're welcome.

  • @beachfossils93
    @beachfossils93 8 років тому

    how would you implement an if conditional statement inside the while loop. I tried implementing an if conditional statement and then try to addi a value to a register and it won't allow me. stays in a infinite loop. help.

    • @amellperalta
      @amellperalta  8 років тому

      Hello Luis. You can implement if conditionals in assembly by using the branching instructions (i.e., beq, blt, etc) with labels. For example, you can create a while loop like the one I created in the video. Then, once you've tested that the while loop is working properly, you should use branching instructions that will jump to a specific label if a certain condition is true. If you need more assistance, please show me your code.

  • @Jonny-op3wr
    @Jonny-op3wr 4 роки тому

    For branches I thought we only use regs?

  • @mygardencat7755
    @mygardencat7755 7 років тому

    Firstly, thanks so much for the tuts! You are awesome man!
    I haven't watch the next videos, so i am wondering about how we can exit the while loop only not the program with the tag exit?

  • @vernsalgorithm4903
    @vernsalgorithm4903 9 років тому

    What if you wanted to have an array of 100 elements with each element having a unique value o.O? would be tedious to use sw 100 times and increment the index 100 times.

    • @amellperalta
      @amellperalta  9 років тому +1

      There are more ways to initialize an array. Another way is:
      myArray: .word 45, 34, 44, 34, 54, 43, 34, 78
      That declares an array of 8 integers with a unique value.

  • @alvdel2126
    @alvdel2126 8 років тому

    It took me a while to find a decent tutorial on MIPS thank you very much. By the way do you have any videos on the instruction sll?

    • @amellperalta
      @amellperalta  8 років тому

      Thank you.
      I have a tutorial on sll: ua-cam.com/video/KI2e6_IMt_U/v-deo.html

  • @kinanhawri6906
    @kinanhawri6906 2 роки тому +1

    really thank u bro

  • @vianeypadilla2499
    @vianeypadilla2499 6 років тому +1

    Very helpful!!! Thank you

    • @amellperalta
      @amellperalta  6 років тому

      You're welcome, Vianey. Happy coding!

  • @jayz8275
    @jayz8275 5 років тому

    would anyone tell me the difference between b and j ?it seems they do the same thing:go to a specific label

    • @ratdog356
      @ratdog356 5 років тому

      J jumps back into the loop until the condition is met and b just automatically jumps to a label with no regards for registers or conditions. B will go there every time

  • @wijdan7172
    @wijdan7172 6 років тому

    how can i add this numbers ???

  • @adriangutierrez7922
    @adriangutierrez7922 4 роки тому

    Do you have the code?

  • @TrungNguyen-yz6rc
    @TrungNguyen-yz6rc 9 років тому

    What editor/IDE are you using? I would like to use it as well. I'm new to MIPs.

    • @amellperalta
      @amellperalta  9 років тому

      +Trung Nguyen Hi, Trung. I'm using Mars simulator. You can get it here: courses.missouristate.edu/KenVollmar/MARS/

    • @dogusural5792
      @dogusural5792 8 років тому

      He is using mars mips simulator

  • @muccigane2351
    @muccigane2351 3 роки тому +1

    Good old ASSembly language making me learn outdated ass MIPS

  • @markdanielcamposano9815
    @markdanielcamposano9815 2 роки тому +1

    thank you

  • @parkle_
    @parkle_ 3 роки тому +1

    thank you so much

  • @albusv
    @albusv 9 років тому +5

    may be nitpicky, but our first while loop would be more like:
    i=0;
    while (1) {
    if (i > 10)
    break;
    i++;
    }

    • @amellperalta
      @amellperalta  9 років тому

      +Stefan Jevtic Yes, that would be a suitable first while loop. :)

  • @MakesLoudNoise
    @MakesLoudNoise 8 років тому +1

    My professor said not to use bgt, blt, and bge because hardware for

    • @figuraclass444
      @figuraclass444 7 років тому +1

      it is true. he could do this: beq $t0, $t1, exit, where t1 contains number 11

  • @dogusural5792
    @dogusural5792 8 років тому +1

    Thank you mate

  • @jr.shivendra4271
    @jr.shivendra4271 7 років тому

    Nice videos , Nice accent......

    • @amellperalta
      @amellperalta  7 років тому

      Thank you, Shivendra. Happy coding!

  • @olafpertile9910
    @olafpertile9910 5 років тому +9

    Do u want to be my father please?

  • @rosaballini9141
    @rosaballini9141 5 років тому

    te amo amell unas ganas de aprobar mañana

    • @amellperalta
      @amellperalta  5 років тому +1

      Te amo a ti tambien, Rosi. Deseo que apruebes manana.

    • @rosaballini9141
      @rosaballini9141 5 років тому

      Amell Peralta mañana te cuento como me fue! Sos el mejor 🥳

    • @amellperalta
      @amellperalta  5 років тому +1

      Que bien! Esperare tu mensaje. Si vienes a New York, me avisas y podemos ir a ver una pelicula.

    • @rosaballini9141
      @rosaballini9141 5 років тому +1

      Jajajaja tremendo amell encima de enseñarme una materia entera, me invita a ver una película en NY, sos lo más

  • @dotdashYTP
    @dotdashYTP 4 роки тому

    Data for all the data and text for the instructions

  • @debmeetbanerjee2411
    @debmeetbanerjee2411 4 роки тому

    voila!

  • @harrellt1405
    @harrellt1405 7 років тому

    Salamat po

  • @michellegodwin6567
    @michellegodwin6567 7 років тому +4

    Fourteen minutes? This tutorial sure does last for a long WHILE!
    ...I'll leave now

    • @amellperalta
      @amellperalta  7 років тому +2

      You should also check my assembly tutorials on recursion (Intro to Recursion and Recursive Factorial Program). :)

    • @djjambo2821
      @djjambo2821 6 років тому

      lmao plugging ur other videos

    • @muuubiee
      @muuubiee 3 роки тому

      Solution is after like 8 minutes...

  • @mpedzi031
    @mpedzi031 7 років тому

    AHMED. HELP ME, I HAVE POSTED A COMMENT REQUIRING YOUR HELP OF WRITING A MIPS PROGRAM THAT TAKES MY NAME (DANIEL) AND PRINTS IT OUT A CHARACTER AT AT TIME. PLEASE. MY LIFE DEPENDS ON IT.