2012-10-16 05:40:29 Posted by RetroZelda

Mips Memory Management

Halfway through October, and not a word of what my abundant spare time has brought to this lovely world. Well, I have been reading a lot of articles on random things like occlusion culling, hardware emulation, and different CPU pipelines and instructions. I first started reading about SH-2 and SH-4 processors(found in the Sega Saturn and Dreamcast respectively), and after giving me an aneurysm of knowledge, I decided to find a cleaner CPU set to build upon. x86? Screw x86! With a vita that has a psp emulator that has just been introduced to the existing "e;psp hacking scene"e;, I decided that maybe working with that stuff first would give me a nice foot in the door. So, after reading about low level PSP hacking crap, I now understand buffer overflows and I think i have a few things I know I can do to not allow those(because I do love me some file I/O), and I was introduced to MIPS assembly. The instructions are simple, and the registers are even simpler, so why wouldn't mips be a good starting point? Well, it was great! I am fairly glad that I put off working on Nyanimals(idk if I mentioned that side PSM project or not, but hit me up on twitter or linked-in if you really care) for a week to put my time into MIPS. Well, after just screwing around and figuring out how to actually use the stack(lack of push and pop instructions), I decided a couple days ago to try a math library. Obviously I gave up on that fast and decided to handle dynamic memory allocation. So, with this post, I give you my MIPS malloc and free. Next on my list is calloc and realloc, but I will need to do some other functions first(e.g. memset), then I think I will be able to handle math stuff and I can dive into the FPU. Anyway, I have the malloc and free routines attached so download and enjoy. I have been using Mars as my simulator, so I will provide a link to that somewhere... anyhoo, if you do decide to try it out, good luck reading it. I have the normal massive ammount of comments that ASM requires, but, especially in the free routine, its still... well... you will see :) So, to conclude, I plan to do some MIPS as well as work on Nyanimals(as it is the longest side project I have had the attention for). And I think I am going to make it build for PSM and XNA so I can play around with compiler settings. Although I have been lacking time with the super cute C++, so I might do some data structures or even look into CUDA(probably not...) Anyway, before this turns into another rant... ciao fur niao! Mars: http://courses.missouristate.edu/kenvollmar/mars/