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.

No comments: