Monday 12 October 2009

MIPS



In console development we are going to program in assembly language so that our code is optimal. As you may or may not know, there is not one standard assembly language, what language you use depends on the processor of the hardware you are using. In the last lecture I took apart a PlayStation 2 so, as research, I disassembled a PlayStation 2 rom to take a look at the code.

It turns out that PS2 assembly is "MIPS" assembly. I was pleased to hear this as this is the same assembly used to program on the PSP that I will be developing for soon. I read up on a few basic MIPS commands, brushed up on my binary and hexadecimal number systems and had a quick look at some of my A level computing work to do with assembly.

The game I chose to disassemble was "Naruto Uzumaki Chronicles 2". I took a look at the first few lines of code and annotated them to show the command used.

Srlv zero, zero, zero <-- Shift Word Right Logical Variable

subu s6, zero, v0 <-- Subtract Unsigned Word

Mfhi zero <-- mfhi moves the contents of the hi register to register rd.

tge zero, a0 (19e) <-- Trap if Greater or Equal

(dmultu) zero, zero <-- Doubleword Multiply Unsigned

dsrav at, a0, zero <-- Doubleword Shift Right Arithmetic variable

break (00400) <-- Breakpoint

While each line on its own is very easy to understand, looking at the large amount of assembly was fairly daunting. I am looking forward to using assembly. Hopefully it will not be too long before this becomes fully readable for what it is.
Looking forward to developing for one of these.

1 comment:

r4 said...

Nice work on your game development. I can't say enough about game development. Thank you so much for your help.