this 8 minute video is actually better than watching 1 hour of stupid lectures from my university
@lee_dar_39lo
3 жыл бұрын
Your uni's teacher (who was discretly learning from this channel too) after seeing your comment : (*chuckles*) "I think I am in danger !"
@henri7999
8 жыл бұрын
I'm building an interactive game in MIPS, and I needed a queue to hold registered events, I completely forgot about a simple array; this helped greatly! Thanks!
@amellperalta
8 жыл бұрын
+San You're welcome, San.
@NataliePrahst
6 жыл бұрын
amell is my only hope for passing Programming at the Hardware/Software Interface
@amellperalta
6 жыл бұрын
I hope you do well in your class. :)
@einnorw
5 жыл бұрын
lol don't you go to UA
@orangetree2104
4 жыл бұрын
52 seconds was all it took, this guy knows his stuff this is a solid tutorial ! Subscribed
@amellperalta
4 жыл бұрын
Thank you. Happy coding!
@kishorsubedi4215
6 жыл бұрын
Thanks mate!!! I wouldnt just watch your awesome videos without throwing some nice words to you!! RESPECT
@amellperalta
6 жыл бұрын
You're welcome, mate! Happy coding!
@aninjamnky
6 жыл бұрын
My man, coming through with the best tutorials as always.
@amellperalta
6 жыл бұрын
Thank you. Happy coding!
@hedojunior2504
6 жыл бұрын
Thank you for the tutorials, Amell, they're very clear and succint, you're helping me a lot. Best regards from Brazil.
@amellperalta
6 жыл бұрын
You're welcome. Happy coding!
@PeachyAlgos
5 жыл бұрын
You are a life saver, thank you for making these videos
@amellperalta
5 жыл бұрын
You're always welcome, Sydney. Happy coding!
@qasimranjha1969
Ай бұрын
just finished the whole playlist of this amazing teacher , gonna ace the lab exam tomorrow Insha"Allah Many Many thanks to you, Respected Sir
@amellperalta
Ай бұрын
You are welcome. Happy coding!
@hatdogggg448
3 жыл бұрын
thank you amell! I didn't skip ads for you, you're a big help!
@amellperalta
3 жыл бұрын
Thank you for your support, Lily! Happy coding!
@lalanet1362
3 жыл бұрын
I have exam in 18 minutes, so I had to skip it :/
@Tivilivi
5 жыл бұрын
Thanks so much! this made me finally understand what I need to do
@amellperalta
5 жыл бұрын
You're welcome. Happy coding!
@caffeinerodent
6 жыл бұрын
Thank you so much! This really helped me with my programming project!
@amellperalta
6 жыл бұрын
You're welcome, Carol. I'm glad to know that.Happy coding!
@MathP3r
5 жыл бұрын
man I LOVE YOU AND YOUR VIDEOS SO F*** MUCH ahahah you save my life and the way you teach is so cool
@amellperalta
5 жыл бұрын
Thank you. Happy coding!
@zachkennow9638
7 жыл бұрын
Thank you! I had a question, though. In my assembly class, our instructor creates the array with *array: .word 0* and calls elements with *0($t1), for example. Why do you use .space, and how can you call the element using the name of the array?
@SitBritts
5 жыл бұрын
Hey, thanks for these videos! very helpful for me in computer architecture
@amellperalta
5 жыл бұрын
You're welcome, Bri. I'm glad to know that my videos are helpful. Happy coding!
@jccom24
6 жыл бұрын
youre so awesome Quasar, Thank you!
@amellperalta
6 жыл бұрын
Thank you, Jerry.
@HufffDaddy
8 жыл бұрын
Awesome videos! Very helpful and informative! U DA BOMB
@amellperalta
8 жыл бұрын
+HufffDaddy Thanks! Happy programming!
@rawanabuzaid535
7 жыл бұрын
how could i load second or third position in array ? what will be the statment of load ? how could i find tha max and min element in array ?
@hoangnguyenngoc5909
6 жыл бұрын
So clear, good work man :D thanks
@amellperalta
6 жыл бұрын
You're welcome.
@user-ys6yd2dn8j
2 жыл бұрын
Great job !
@brianawilliams4992
9 жыл бұрын
You rock Amell!!!
@amellperalta
9 жыл бұрын
Thank you, Briana! As soon as I get a chance, I will continue this tutorial series, and I will improve the quality of the information.
@oscarmenzer1036
8 жыл бұрын
Good tutorial! Do you know of any reason why this wouldn't work for larger arrays? I am working with one that is 70x70 but am running into problems when using this method
@mesofreak
8 жыл бұрын
Thank you so much for making these videos, they helped me immensely for my project
@amellperalta
8 жыл бұрын
+mesofreak I'm glad to know that. You're welcome!
@tessswan3597
7 жыл бұрын
Dear Amel! I love your videos! But i have a question, could you please tell me how to deallocate in mips, i use syscall 9 to allocate memory, i try negative increment but it just doesn't work! Thanks a lot!
@ThumpingThromnambular
8 жыл бұрын
Thanks Emile, very simple explanation. Going to get me through my homework today most probably.
hey man very nice videos, wondering how would you do the sum of 2 arrays, and store the sum in 3rd array for example, array1 has 1, 2, 3 array2 has 4, 5, 6 and array 3 should have 5, 7, 9
@bustacobbaproduction
5 жыл бұрын
Love the casual uTorrent running in the background ahaha
@user-lo4qj4st2g
3 жыл бұрын
Thanks a lot this video really saves my life!!!!!!
@amellperalta
3 жыл бұрын
You're welcome. Happy coding!
@MrJustdance13
7 жыл бұрын
How would you do an array that terminates the loop for user input when a negative number is entered ?
@nskitten05
5 жыл бұрын
You are the reason I passed Computer Architecture xD
@amellperalta
5 жыл бұрын
I'm glad to know that, Marcelo. Happy coding!
@321brianh
4 жыл бұрын
Do you have any videos on dynamic allocation in MIPS? I have to create a singly linked list in MIPS and I'm a little lost.
@우주어딘가
5 жыл бұрын
덕분에 이해할 수 있었어요 감사합니다
@amellperalta
5 жыл бұрын
천만에요.
@ioannismichalakis4376
6 жыл бұрын
i want to ask something at the point you store the registers in random access memory. If you write sw $s0 ,0(myArray) instead sw $s0, myArray($t0) is there any difference?
@zerodept
5 жыл бұрын
You're the best!!
@amellperalta
5 жыл бұрын
Thank you! Happy coding!
@vojazzy11
5 жыл бұрын
how would you store user input into a string array?
@jackwindensky5606
8 жыл бұрын
Thank you from UCI!
@amellperalta
8 жыл бұрын
+Jack Windensky You're quite welcome, Jack. Greetings from Fordham University.
@misaelaguirre2189
5 жыл бұрын
Zot zot zot
@96Muhsin96
7 жыл бұрын
What if I want to store more numbers than the amount of registers I have ? do I have to make a while instruction (branch) ? For I example I want to store 13 numbers. That means I store in the RAM about 52 bits. But I have no 13 $s and $t registers.
@sebascamargo7520
6 жыл бұрын
Amigo eres el mejor, gracias a ti he salvado el semestre mi universidad, porque no le entendía nada al profesor de mi clase :,v
@amellperalta
6 жыл бұрын
De nada, Sebas. Me alegra saberlo.
@ekhliousful
7 жыл бұрын
how to get the input from the user & store & printed out using a for loop
@spyrosnas
7 жыл бұрын
Just excellent!
@amellperalta
7 жыл бұрын
I'm glad to know that. Thank you!
@Thurmonaterrr41
7 жыл бұрын
When I write this code I seem to keep getting the error myArray: operand is of incorrect type
@OG_stevedidWHAT
6 жыл бұрын
Thurmonaterrr41 he is not using the correct syntax. In mips, it's offset (location) the offset should be a number. Not a register
@osamasafwat9345
3 жыл бұрын
Legend thank you 🙏❤️
@amellperalta
3 жыл бұрын
You're welcome!
@zuowang5481
6 жыл бұрын
Why does the program still work with smaller array size? For example, myArray: .space 4
@khanhcaoquoc4283
4 жыл бұрын
To retrieve the first element in the array you use lw $t6, myArray($zero), how about the second one? Is it lw $t7, myArray(4)
@alexchatzi9107
3 жыл бұрын
Nope, I think this argument/command can't function with an integer in the parenthesis, so instead you can save (for example) the number 4 to $t0 (addi $t0, $zero, 4, considering $t0 = 0 in this example) and then just use lw $t7, myArray($t0). Also, a suggestion, try to experiment with many different possibilities and situations. This way you'll get a better understanding of the language and the ways it works. I'm not an expert though, so take what I said with a grain of salt!
@chatchuonkongyotmoksri5300
Жыл бұрын
U BEST!!!
@jessicamacful
3 жыл бұрын
what do you do for index 1?
@RicardoSilva-lm4hb
5 жыл бұрын
What about if i want to store a boolean? 1 or 0? wich command do i use instead of "sw $t0 ..."?
@enisluis1234
4 жыл бұрын
Hello we have to input a string from user and then put that string into an array and find its length. Can u do this?
@groverkennedy2049
3 жыл бұрын
You're a better teacher than my professor
@amellperalta
3 жыл бұрын
Thank you. Happy coding!
@groverkennedy2049
3 жыл бұрын
@@amellperalta I'm sad coding right now ):
@kirkyoung6962
2 жыл бұрын
I’m building a transmission gear selector need help
@vatojavier
7 жыл бұрын
Que grande eres joder!!!!!!!!!!!!!!!!
@amellperalta
7 жыл бұрын
Gracias. De que pais eres?
@jr.shivendra4271
6 жыл бұрын
Sir can you upload videos on Structure through MIPS.
@stopplanet184
7 жыл бұрын
sir, how can i take user input in an array and display it?
@amellperalta
7 жыл бұрын
The first question to ask is what type of input are you taking. Let's suppose that you're taking integer values, more specifically 4 integer values. Then the first step is to create an array that can hold 4 integer values in the data section. Example: .data array: .space 16 The array has 16 bytes which is the amount necessary to hold 4 integer values (since each value takes 4 bytes). The next step is to use a register as an index in the array and loop 4 times asking the user to enter an integer value. Each time you need to save this value in the current position in the array (using sw instruction) and increment the index. Example: .data array: .space 16 .text # $t0 is the index. loop: # Ask user for value. # Read value from keyboard. li $v0, 5 syscall # Store the entered value in array. sw $v0, array($t0) # Increment index and loop again if necessary. addi $t0, $t0, 4 bne $t0, 16, loop # Display array values # You can do this by creating another loop and using the system call # to display integer value (i.e., syscall with code 1). Watch my video on # how to display integers.
@stopplanet184
7 жыл бұрын
got it and did it. Thank you sir. i am getting more from you than my instructor.
@dogukanyolcuoglu
4 жыл бұрын
Amell Peralta hi so as a float ? Store the entered value in array from keyboard
@justme8083
3 жыл бұрын
My input is a string How do I add its characters to an array? Please help
@ISLAMguidanceful
6 жыл бұрын
how can i clear an array?
@dayuu4
8 жыл бұрын
I am trying to have an array loaded onto a register. Is it OK if I have it as - All I am trying to do is have the array contents all saved in $t2 array: .word 1, 2, 3, 4, 5 la $t1, array lw $t2, ($t1) # t2 = array[i] or to say: lw $t2, array #t2 = array[i]
@joanacosta3331
5 жыл бұрын
Ganda Indiano cRLH!
@amellperalta
5 жыл бұрын
Obrigado Joana. Eu não sei Português, mas eu sei espanhol. A propósito, sou solteiro.
@xingxing6143
6 жыл бұрын
Thank you from UNSW
@amellperalta
6 жыл бұрын
You're welcome. Happy coding!
@ricardoalonzo7133
9 жыл бұрын
Amell, Its Ricardo again. I'm a bit unsure of how to load information from the second or third position in the array. I noticed when you load from position 1 you used ($zero). what does position 2 become? if I want to load 10 is this correct: lw $t7, 4($t0)
@amellperalta
9 жыл бұрын
If you want to load 10 in my example, then you need to specify the position in the array. The position is the second position, so if the first position was 0, then the second position is 4, and the reason is that memory is byte addressable and word aligned, and we are dealing with a 32-bit MIPS architecture. Example: addi $t0, $zero, 4 # Store 4 (second position) in $t0, beccause $t0 is the position or index lw $t6, myArray($t0) # Now get the second element from the array.
@ricardoalonzo7133
9 жыл бұрын
AH! thank you! THIS MAKES COMPLETE SENSE!!
@viniciusgoncalves5189
9 жыл бұрын
Quasar Distant this was my doubt too, thanks.
@amellperalta
9 жыл бұрын
You're welcome. Good luck.
@Arghandevol
7 жыл бұрын
I did exactly like you, and I cant load the second postion. (lw $t1, array($zero)) That is your code, and you said to load first position you need "tell to arrya 1 postion" and we know that the $zero is first position. But what I have to write istead $zero in "(lw $t1, array($zero))" to get second posotion? If I writing $t0, it will print out 3 position. :(
@corp4145
7 жыл бұрын
How would I find the maximum value of a number in an array by checking each stored number? Like say I had 3,10,5 in an array and wanted to know what the largest number was.
@amellperalta
7 жыл бұрын
lw $t0,0($s1) # initialize maximum to A[0] addi $t1,$zero,0 # initialize index i to 0 loop: add $t1,$t1,1 # increment index i by 1 beq $t1,$s2,done # if all elements examined, quit sll $t2,$t2,2 # compute 4i in $t2 add $t2,$t2,$s1 # form address of A[i] in $t2 lw $t3,0($t2) # load value of A[i] into $t3 slt $t4,$t0,$t3 # maximum < A[i]? beq $t4,$zero,loop # if not, repeat with no change addi $t0,$t3,0 # if so, A[i] is the new maximum j loop # change completed; now repeat done: # continuation of the program
@justinstark5732
3 жыл бұрын
why do you do we need double sign $zero?
@dimitrisfilippou
6 жыл бұрын
Thank you from AUEB
@amellperalta
6 жыл бұрын
You're welcome. Happy coding!
@TheTyTyXD
7 жыл бұрын
Why do you choose addi vs li? Is it because LI is not an actual instruction and gets translated into addi by the assembler?
@ewanmcdonnell6990
8 жыл бұрын
If you want to make KZitem videos like this what software do you use for the sound and images?
@amellperalta
8 жыл бұрын
+Ewan McDonnell I was using CamStudio, which is an open source software. However, Camtasia is much better for making tutorial videos (I think).
@tunganhnguyen8309
7 жыл бұрын
Hey at the end, what's the purpose of li $v0, 1 Sorry I'm new to this. THanks in advance.
@amellperalta
7 жыл бұрын
The purpose of li $v0, 1 is to indicate to the operating system that you want to execute the system call (syscall) for printing an integer. There are several system calls available, and they all have their own code number. In this case, the code number is 1, and that code number is for displaying an integer.
@zuowang5481
6 жыл бұрын
how do you load the second value in this array
@zuowang5481
6 жыл бұрын
nvm i got it. use a register to store number 4 to replace $zero
@nero1563
8 жыл бұрын
Thank you
@amellperalta
8 жыл бұрын
+Nergal Givarkes You're welcome, Nergal.
@mcvstrider
9 жыл бұрын
Thanks bro :) But I have a little problem here in my code I want a loop to store every value in my array it can't store 1 number I didn't overpass the array size boundary :/ compiler says: Runtime exception at 0x00400120: store address not aligned on word boundary 0x100100ab loop: beq $s0,$s1,return move $a0,$s1 sw $a0, myArray($t3) li $v0,1 syscall addi $s1,$s1,1 addi $t3,$t3,4 b loop This is my declaration myArray: .space 40
@NOLAMarathon2010
3 жыл бұрын
My version of MARS said ".space" is not a valid integer constant or label.
@jgraiver
7 жыл бұрын
how would you do an array with an unknown length? As in, if the user inputted a sentence and you wanted to store each character as a place in the array?
@amellperalta
7 жыл бұрын
Depending on the program, I could use dynamic memory allocation. Example of dynamic allocation: .data .text main: # Array Size in $t0 (2 bytes for two chars) li $t0, 2 # Dynamic memory allocation: Allocate memory in the heap for 2 bytes. li $v0, 9 move $a0, $t0 syscall # $t1 gets the address of new allocated memory. move $t1, $v0 # Store 'a' in array[0] and 'm' in array[1] li $t2, 'a' li $t3, 'm' sb $t2, 0($t1) sb $t3, 1($t1) # Display the characters in the array. li $v0, 4 move $a0, $t1 syscall # End program. li $v0, 10 syscall
@amellperalta
7 жыл бұрын
If I don't need dynamic allocation, then I could simply declare an array of a fixed size, and then use the appropriate system calls to read the sentence from the user. Fully working example: .data array: .space 256 str1: .asciiz "Enter string (max 256 chars): " str2: .asciiz "You wrote: " .text .globl __start __start: la $a0, str1 #Load and print string asking for string li $v0, 4 syscall li $v0,8 #take in input la $a0, array #load byte space into address li $a1, 256 # allot the byte space for string move $t0, $a0 #save string to t0 syscall la $a0, str2 #load and print "you wrote" string li $v0, 4 syscall la $a0, array #reload byte space to primary address move $a0,$t0 # primary address = t0 address (load pointer) li $v0, 4 # print string syscall li $v0, 10 #end program syscall
@jgraiver
7 жыл бұрын
Thank you so much Amell, your tutorials are helping me so much!
@amellperalta
7 жыл бұрын
You're quite welcome!
@abdulmagedkhaled9480
7 жыл бұрын
well explained
@amellperalta
7 жыл бұрын
Thank you.
@goncaloferreira1756
8 жыл бұрын
How to make a 2x2 matrix in mips language? You can make a video to explain? I hope to answer, thanks;)
@benjaminr8229
7 жыл бұрын
en.wikipedia.org/wiki/Row-major_order
@joanacoronelsoler3977
6 жыл бұрын
If instead of typing in the last step "lw $t6, myArray($zero)" you had typed "lw $t6, my Array($s1)", would have appeared the number 10 on the screen?
@user-db2fo7of7e
4 ай бұрын
legende
@kakoshas1888
2 жыл бұрын
u know any mounaki?
@danielgarcia4450
8 жыл бұрын
How would you do a 2 dimensional array?
@malteeaser101
8 жыл бұрын
Probably the address of an array stored in each element. I don't know.
@benjaminr8229
7 жыл бұрын
Row major ordering en.wikipedia.org/wiki/Row-major_order
@lichd2160
6 жыл бұрын
If you wanted to retrieve the next integer in the array which would be 10, would you just use the code: lw $t7, myArray(4) because the value is in the 4 spot? lw
@amellperalta
6 жыл бұрын
Your semantics is correct, but your syntax is not. You are not allowed to place a constant value of 4 inside parenthesis to access an element; it has to be a register that contains the value 4.
@lichd2160
6 жыл бұрын
so how would i access the value of 10 in the array?
@amellperalta
6 жыл бұрын
Example: .data myArray: .word 3, 10, 2 .text li $s0, 4 lw $t0, myArray($s0) li $v0, 1 move $a0, $t0 syscall li $v0, 10 syscall
@long8398
4 жыл бұрын
@@amellperalta thats not what he meant. his question was how do you print the next value. how can he print the number 10 which you stored 4 bytes away from ur first value which is 4. can you reply?
@long8398
4 жыл бұрын
@@amellperalta alright, i get it. but it would be nice if yu explain it with ur example in the video.
@groverkennedy2049
3 жыл бұрын
Come teach at my university. We need some new professors.
@MinhNguyen-yf8ls
9 жыл бұрын
how do you do an arrays of floating point?
@amellperalta
9 жыл бұрын
Minh Nguyen You can declare and initialize it like this:myArray: .float 3.14, 4,4, 5.6, 10.2 Instead of using lw and sw, you use l.s and s.s to save float values to the array. These are some useful links: stackoverflow.com/questions/20406982/printing-an-array-of-float-numbers-in-mips stackoverflow.com/questions/15737204/setting-up-an-array-of-floats-and-printing-them-in-mips
@MinhNguyen-yf8ls
9 жыл бұрын
Quasar Distant how about the size and iterator do we also declare it as .float for example .data myArray: .float 3.14, 4,4, 5.6, 10.2 iterator: .float 0.0 size: .float 3.0
@amellperalta
9 жыл бұрын
You should declare size and iterator to be of type .word. You do not need float for size and iterators. Remember that floats require four bytes in RAM, which is the same as integers. So if you just increase the iterator by 4 every iteration, you will be iterating through each element one by one.
@MinhNguyen-yf8ls
9 жыл бұрын
alright thanks for the help, now I am trying to sum the arrays of floating points but keep running into troubles any advice for what I can do?
@amellperalta
9 жыл бұрын
For summing floats you need to use the $f registers. Chech my tutorials on floating point arithmetic.
@Tincho750
8 жыл бұрын
gracias me ayudo mucho, por cierto that ingles XD
@amellperalta
8 жыл бұрын
De nada. Buena suerte!
@hafsakarim768
3 жыл бұрын
3. Write a Program in MIPS Assembly Language that add the integers in an array of 12 (the array declare with first 6 odd numbers) and then saves the result in data segment. sir kindely slove this problem
@BharatKumar-rc8vn
5 ай бұрын
5:48 , addi t0,t0,4 ,here 4 because, mips has byte addressable memory i.e each word contains 4 bytes therefore every instruction takes 4 bytes or 1 word of memory.
@teodorfon8159
4 жыл бұрын
sis-ko
@TheEntimaniac
9 жыл бұрын
You don't sound THAT excited lol
@boringchannel6313
Жыл бұрын
but if i have a string it would be a deferent story for real
@helloguys6946
2 жыл бұрын
lol if you dont know what an array is then you wont even be here hahahaha
@groverkennedy2049
3 жыл бұрын
Send me your email if you're interested.
@assemha1632
4 жыл бұрын
how to find the maximum in Array?
@assemha1632
4 жыл бұрын
.data Array: .word 1,2,3,15,4,4,9 Max: .word .text main: lw $a0,Array li $s0,1 li $t1,9 Condition: slt $t0,$t1,$s0 bne $t0,$zero,end sll $t0,$s0,2 lw $a1,Array($t0) Maximum: slt $t0,$a0,$a1 beq $t0,$zero,Maxi move $v0,$a1 move $a0,$a1 sw $v0,Max addi $s0,$s0,1 j Condition FMaxi: move $v0,$a0 sw $v0,Max addi $s0,$s0,1 j Condition end: li $v0,1 lw $t0,Max syscall finally is done thanks alot for help
Пікірлер: 168