Hey, so this week in Console Development we have been assigned the task of looking into assembly language, something that we are going to be using to create a psp application later in the year. Why assembly you ask? Because it allows us to optimise our code a lot more than if we were using a language such as C or C++.
In the previous week my group dissasembled a Playstation 2, so naturally our task was to find out about the Instruction Set Architecture (ISA) of the console. After some googling I found that it uses the "MIPS" architecture which consists of 107 instructions for operating on four 32-bit, eight 16-bit or sixteen 8-bit integers simultaneously (Love the copy paste?).
After looking through the different instructions for a while and eventually feeling their wrath I decided it was time to dive in to the deep end and see what this assembly language is all about. I picked a game that I still love today in Crazy Taxi and then went on to find a decompiler for it. If you want to have a go the decompiler I used can be found
here.
There was a few things I noticed when looking at the code the first time... 1) I had no idea what anything meant and 2) I had absolutely no idea what anything meant. After a bit more researching, and thanks to a wiki page full of instructions, I was able to decipher some code...
sw s0, $0000(a1)-This stores a word into the provided memory address and the following three bytes.
jal $00005d98-This jumps to a memory address and also provides a return address to allow a subroutine to return to the main body after completion.
nop-This simply states that no operation will take place
bne v0, zero, $00005bf0-This jumps to an address if two registers are not equal.
lui a0, $0000-This is a pseudo instruction, it loads an address however the assembler does not see it as an instruction, but is able to translate it into a sequence of real instructions.
Overall this was a really interesting exercise, even more so considering I now know what I am up against in this module. I am going to spend more time analysing the code to try and get a firmer grasp, but I would definitely suggest this to anyone who is interested in how games are put together.
B