Saturday 11 February 2012

February already

Things have been a little slow on the programming front over the last 2 months, however I have finally found a bit of free time to crack on. Currently in the middle of cleaning up the op codes and putting in the last remaining of what I would call the 'difficult' rotate and shift opcodes in place.

Notepad++ with ASM syntax highlighting has been a godsend, so has StudioStyles which host 900 + Visual Studio (2008 and 2010) themes. Currently using  this one, very easy on the eyes.



Wednesday 14 December 2011

Gameboy Emulator Programming Resources

Here are a few things I have bookmarked and collected while working on this thing:

Reference

The official Gamboy and Gameboy Colour programming document from Nintendo:
http://www.scribd.com/doc/6930922/Gameboy-Advance-Programming-Manual-v1-1/

Gameboy cribsheet, great for a quick opcode reference:
http://www.otakunozoku.com/nintendo-gameboy-cribsheet/

Pan docs, originally by Pan and updated by a few people along the way. 'The' Gameboy document.
http://nocash.emubase.de/pandocs.htm

Great document by someone called DP, pretty much a complete overview. My most used doc while working on the Opcodes.
http://codeslinger.co.uk/pages/projects/gameboy/files/GB.pdf

Sites/Emulator Programming


Great site by Codeslinger, loads of detail about how he approached programming his Gameboy emulator in C++. Also has Sega stuff.
http://codeslinger.co.uk/pages/projects/gameboy.html

A site by Imran Nazar about his Javascript/HTML5 Gameboy emulator. Goes into great detail about concepts.
http://imrannazar.com/GameBoy-Emulation-in-JavaScript

A 113 page thread over at Emutalk that originally started in May 2004. A huge amount of information in here, great to see people start with the bare bones and progress to a finished article. Codeslinger cut his teeth in this thread. Worth a read.
http://www.emutalk.net/threads/41525-Game-Boy

Christmas Shopping

Really wanted to code today but Christmas shopping called, guess it was better to do it on a weekday then at the weekend. London was pretty calm actually.

Tuesday 13 December 2011

Status

So what does it do so far? short answer not much, prints some debug information to screen after processing about 900 instructions from the Tetris ROM. I wanted to write this thing from scratch (I could have used a Z80 CPU core from http://opencores.org, or from another emulator) so that means I need to write every instruction and test them as i go.

So what is in place so far?

- 70% of opcodes (mainly basic ones like loads, jumps, xor, or)
- Debug output to screen/file (useful!)
- CPU registers, flags
- Crude memory implementation (one huge variable)

Currently the emulator runs and gets into a loop waiting for a certain value at a memory location, this value is is the vertical line counter for the LCD, pretty important so that will next to be implanted ASAP. So next up interrupts and because interrupts require stack usage i guess i will have to implement a stack and the PUSH and POP opcodes.. yay :(

Here is the where the emulator is currently getting stuck, the first number is the memory location.

0x0233 ld a,(ff00+44) ; Tries to load a value from memory into register a
0x0235 cp a,94 ; Compare 94 to what we just pushed into a. If a=94 then set a flag.
0x0237 jr nz,0x0233 ; Flag not set? ok jump back to 0x233 and continue.


So the above loop never exits due to the value at FF44 never increasing. 


OK better get cracking, oh and below is what everything looks like at the moment, click for big.

First post

So here goes, finally going to start this thing.

I wanted to keep track of my accomplishments (or lack of) on a few projects, hopefully this blog will spur me on in making some progress. The first project I plan to use this blog for is my GameBoy emulator, something I have been playing around with for a few years now. I wont proclaim to be a great programmer but its something i enjoy, I also enjoy learning about how things work; I have always needed to know how things work even when i got my first GameBoy years ago I remember taking it apart on the kitchen table trying to work out how all the bits came together. So on to the goals, my two goals are based around the first game I ever played on the GamBoy and the game i played the most - Zelda.

1. Get Tetris running
2. Play Super Mario World and Zelda: Links Awakening