Language…
22 users online: Aclais,  Ahrion, autisticsceptile1993, crm0622,  Eden_, Ekimnoid, Gamet2004, Golden Yoshi, JezJitzu, koffe190,  MarioFanGamer, Mischievous Marc, neidoodle, NewPointless, Rauf, RZRider, Scags, schema_tuna, shaoshao, sinseiga, StarWolf3000, The_Uber_Camper - Guests: 268 - Bots: 262
Users: 64,795 (2,376 active)
Latest user: mathew

Assembler (MIPS R4300i) Tutorial

Link Thread Closed
NEW TUTORIAL HERE:
http://sites.google.com/site/cajetan64/megatutorials/mips-asm

Updated! Old Assembly tutorial trashed and wrote the new one from scratch. I extend it currently.

you obviously haven't even wrote a single asm code. because if you'd write an asm code and use the instructions like this, you would realize, that everything, that you didn't copy+pasted from google, is completly wrong.
</div></div>
(http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/altReg.html)

Originally posted by Tarek701

Code
lw $t0, 5 # $t0 := 5
lw $t0, 9 # $t0 := 9

Seeing this hurts so much. It's not even possible to assemble this shit :V

correct use (and i tried to explain you this, but you are seemingly a bit stubborn...):

Code
LUI T0, $8033       #T0 :=80330000
LW T0, $ddf4 (T0)   #T0 :=the content of 8033DDF4


If you want to load a value into something, do it like this:
Code
ADDIU A0, R0, $0005  #A0 := 5
OR
ORI A0, R0, $0005 #A0 := 5


guess, i'll make a passable tutorial soon, i'm scared, that you are continuing this.


stop making such dumb tutorials, that are completly wrong and give people wrong informations.
Originally posted by Kazeshin
you obviously haven't even wrote a single asm code. because if you'd write an asm code and use the instructions like this, you would realize, that everything, that you didn't copy+pasted from google, is completly wrong.
(http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/altReg.html)

Originally posted by Tarek701

Code
lw $t0, 5 # $t0 := 5
lw $t0, 9 # $t0 := 9

Seeing this hurts so much. It's not even possible to assemble this shit :V

correct use (and i tried to explain you this, but you are seemingly a bit stubborn...):

Code
LUI T0, $8033       #T0 :=80330000
LW T0, $ddf4 (T0)   #T0 :=the content of 8033DDF4


If you want to load a value into something, do it like this:
Code
ADDIU A0, R0, $0005  #A0 := 5
OR
ORI A0, R0, $0005 #A0 := 5


guess, i'll make a passable tutorial soon, i'm scared, that you are continuing this.


stop making such dumb tutorials, that are completly wrong and give people wrong informations.


There is a little difference between SPIM and SM64(There is a difference in syntax. It's sad, that you didn't know that). Please get your facts right. I've used LW as it is used for SPIM. I also explained, that we don't use LW and SW, as it is NOT for SM64. This tutorial (the basics first) are simply just teaching the opcodes and not how to assemble them into game. This is something, which comes in Lesson 2 first.

Also, if you want to complain, go here:
Department of Computer Science
University of Maryland
A.V. Williams Building
College Park, MD 20742
Web: www.cs.umd.edu
Phone: (301) 405-2662
Fax: (301) 405-6707

That's the department of computer science, the people who helped me and many others with the MIPS assembly tutorial, that's also the people, where I got the register documentary from. I'm sure you will get to hear a nice: "Yes, we gave him permission to use the 2003 documentary about MIPS"
The restly code is written completly by me.

Originally posted by Tarek701
MIPS R4300i Tutorial



okay, sorry, i though you wanted to make a tutorial about MIPS R4300i. Guess, i shouldn't have read the title of the topic, stupid me :V
(sarcasm, obviously)

also, verrify your shit; in SPIM your LW is wrong, too.
(quoting the website, you've send:
lw Loads a word from a location in memory to a register. Address in memory must be word-aligned
so don't put this university into shame.)
Originally posted by Kazeshin
Originally posted by Tarek701
MIPS R4300i Tutorial



okay, sorry, i though you wanted to make a tutorial about MIPS R4300i. Guess, i shouldn't have read the title of the topic, stupid me :V
(sarcasm, obviously)

also, verrify your shit; in SPIM your LW is wrong, too.


Damn me, I didn't know, that you lack on a very important part of information. Assembler Tutorial and Assembling Code to Game is something completly different.

SPIM is a MIPS Simulator, and so it uses a different syntax. Are you that damn stupid to get that?

Btw, What kind of MIPS Simulator are you using? The name of the application please to be exact. Just saying, as you sometimes misinterpretate my arguments and come up with some shit, that doesn't haves anything to do with what I was waiting for.

Originally posted by Tarek701
Damn me, I didn't know, that you lack on a very important part of information. Assembler Tutorial and Assembling Code to Game is something completly different.

verrification please. this doesn't make any sense to me

Originally posted by Tarek701
SPIM is a MIPS Simulator, and so it uses a different syntax. Are you that damn stupid to get that?

It uses a different syntax, but not a completly wrong.


Originally posted by Tarek701
Btw, What kind of MIPS Simulator are you using? The name of the application please to be exact. Just saying, as you sometimes misinterpretate my arguments and come up with some shit, that doesn't haves anything to do with what I was waiting for.

Project 64 1.6
Originally posted by Kazeshin
Originally posted by Tarek701
Damn me, I didn't know, that you lack on a very important part of information. Assembler Tutorial and Assembling Code to Game is something completly different.

verrification please. this doesn't make any sense to me

Originally posted by Tarek701
SPIM is a MIPS Simulator, and so it uses a different syntax. Are you that damn stupid to get that?

It uses a different syntax, but not a completly wrong, sir.


Originally posted by Tarek701
Btw, What kind of MIPS Simulator are you using? The name of the application please to be exact. Just saying, as you sometimes misinterpretate my arguments and come up with some shit, that doesn't haves anything to do with what I was waiting for.

Project 64 1.6


Mhhh, scratching my head... I believe there was a difference between a simulator and an emulator? Wasn't it?

With pleasure, read following:
http://www.inf.fu-berlin.de/lehre/SS00/19502-V/spimdoku.pdf

Look at page 13, you will find another example code, like the one I used here. He uses the same SPIM program like me. And so, I use the syntax that is given there. And maybe you actually read my replies: I've said, that I'm teaching in Lesson 1 generally the opcodes! Assembling them into game is something different, meaning, that I can't just use lw, but doing it the way like you described. And that's actually the lesson, which I'm currently writing on.

It's also a pleasure to me, that you call-ed me "sir". Why did you edited it out? You can't resist my attendance, can you?

i'm pretty sure, they wrote it with an other meaning down there, because later,
Originally posted by Tarek701

With pleasure, read following:
http://www.inf.fu-berlin.de/lehre/SS00/19502-V/spimdoku.pdf


if you'd look at page 18, you'd see, that the syntax is different. this site is giving 2 contradict informations, understanding the tutorial like you.
i think you didn't got the whole point of the LW syntax, how is it different from LI in your mind?
Originally posted by Kazeshin
i'm pretty sure, they wrote it with an other meaning down there, because later,
Originally posted by Tarek701

With pleasure, read following:
http://www.inf.fu-berlin.de/lehre/SS00/19502-V/spimdoku.pdf


if you'd look at page 18, you'd see, that the syntax is different. this site is giving 2 contradict informations, understanding the tutorial like you.
i think you didn't got the whole point of the LW syntax, how is it different from LI in your mind?


The codes in my tutorial work in SPIM perfectly. No errors, nothing. If I try the way, like it's supposed for SM64, it gives me an error.

Well, whatever. I delete that part of the tutorial and rewrite it, to make it more SM64-specific.

This really is seeming like a thread full of misinformation. If one were to read a tutorial here explaining MIPS assembly, they'd expect to be learning MIPS opcodes relevant to the Nintendo 64, rather than non-existent 'LI' commands and improperly used Load Words.
Updated the tutorial, most things are hopefully correct now.
Link is here:
https://sites.google.com/site/cajetan64/home/mips-asm

Originally posted by Tarek701
Updated the tutorial, most things are hopefully correct now.
Link is here:
https://sites.google.com/site/cajetan64/home/mips-asm


much better, but still some mistakes/misleading informations;

Originally posted by Tutorial
SW t2, $2000(t0) ; Store $00030000 into t2, in memory location of t0


this Stores $00030000 from T2 into memory location of T0+$2000.

Originally posted by Tutorial
Then the sw opcode, does store the value from t1 into t0


this may be left from the old tutorial; sw doesn't change the value of any register.

Originally posted by Tutorial
This loads a half-word/16-bits value of $056C369C into t1 and loading it back to t0


This loads a half-word/16-bits value of $056C369C into t1. and loading it back to t0

Originally posted by Tutorial
This code loads $001C669C into t1, however it's only storing back $001C into t0, which is in address $11AD7FFF.


This code loads $001C669C into t1, however it's only storing back $669C (the last 16 bits) into 11AD7FFF.

(the sb command has the same mistake)

srsly, this starts to annoy me.
N64 Instructions-Opcodes List

This is a file that I have used a lot, it might be useful to have a list of all the instructions in one and be able to match an ASM instuction to an opcode and the other way around.

I haven't read the whole thing ( just the section titles ) but it looks like there is nothing about the FPU ( COP1 ), and I still found a mistake in your color coding at the end ( blue is an immediate value, not a destination register ).

The link above will also help for any particular instruction not in this tut ( like "JALR" and such ).
Uber Mario 64 Demo released, 16 awesomely challenging stars awaits YOU!
Originally posted by Kazeshin
Originally posted by Tarek701
Updated the tutorial, most things are hopefully correct now.
Link is here:
https://sites.google.com/site/cajetan64/home/mips-asm


much better, but still some mistakes/misleading informations;

Originally posted by Tutorial
SW t2, $2000(t0) ; Store $00030000 into t2, in memory location of t0


this Stores $00030000 from T2 into memory location of T0+$2000.

Originally posted by Tutorial
Then the sw opcode, does store the value from t1 into t0


this may be left from the old tutorial; sw doesn't change the value of any register.

Originally posted by Tutorial
This loads a half-word/16-bits value of $056C369C into t1 and loading it back to t0


This loads a half-word/16-bits value of $056C369C into t1. and loading it back to t0

Originally posted by Tutorial
This code loads $001C669C into t1, however it's only storing back $001C into t0, which is in address $11AD7FFF.


This code loads $001C669C into t1, however it's only storing back $669C (the last 16 bits) into 11AD7FFF.

(the sb command has the same mistake)

srsly, this starts to annoy me.


Thank you. I fixed some errors. Yes, some were from the old tutorial and I forgot to delete them. Now, I did.

Originally posted by ArchangelGabriel
N64 Instructions-Opcodes List

This is a file that I have used a lot, it might be useful to have a list of all the instructions in one and be able to match an ASM instuction to an opcode and the other way around.

I haven't read the whole thing ( just the section titles ) but it looks like there is nothing about the FPU ( COP1 ), and I still found a mistake in your color coding at the end ( blue is an immediate value, not a destination register ).

The link above will also help for any particular instruction not in this tut ( like "JALR" and such ).


The FPU and COP is a thing, that will soon come. The tutorial is not done yet. The thing is, I have to learn myself. I have to say however, that I learned a lot in that short time. Of course, I will extend the tutorial for FPU and COP. The thing is, we have to start with the basics first like simple loading/storing of values, branching and of course subroutines.

But thank you for that doc. I'm currently writing a MIPS r4300i patcher in C#, and I needed some good documentary about the instructions.

Btw, about that error;
It's actually not wrong. The syntax of BEQ says following:
"beq $s, $t, offset
Encoding:
0001 00ss ssst tttt iiii iiii iiii iiii"

$offset is in this case the destination. To avoid confusion I wrote $offset instead of rd into this.

EDIT:
If you're searching for the full N64ops, I have a even newer version, which is complete. It contains all N64ops docs:
http://www.smwcentral.net/?p=section&a=details&id=5694

Link Thread Closed