Tuesday, 21 October 2008

The Confusing World....

of MIPS assembly programming.




or rather, the advancement of a migraine as time progresses brought on by the use of MIPS, and extenuating circumstances that adversly affect performance..




as a beginner in using MIPS, though competent in the use of binary to a degree, and hexadecimal to a slightly greater degree, i took my lecturers advice and started learning about mips (and SPIM) at chapter 9 of the tutorials (the link for which is in my previous post). and while learning this new language, and developementenvironment was fascinating, reading a very bright screen in a gradually darkening room, while your neighbours have a party and attempt to set fire to your house, a headache can easily develope.




agonising over, lets get onto that code.




Lets begin with the tasks set for us to achieve by wednesday the 12th of October.




namely the programmes for chapter 13


let us begin shall we, at the very begining.


"Exercise 1 — Column Addition
Write a program that adds up the following
integers: 456
-229
325
-552
Leave the answer in register $8. "


my programme goes a little something like this


(my sincere apologies for having this as an image file, blogger doesn't like it when i copy directly from notepad, it refuses to keep my indentations, or let me edit them here)
as you can see this is a rather roundabout route to finding the answer, which incidentaly is 0, as it is techically possible (working with MARS at least) to use addu with a negative number, the programme automatically compensates for you not reflecting the number. this can be useful, but i am not sure that it works in every simulator, and more importantly, in real use.

No comments: