Hi Guys,
After finishing my chip8 emu I thought the next logical step would be a gameboy emulator. I'm currently implementing the cpu opcodes but getting stuck on the basics. Without knowing any assembler language and only codng a chip8 emulator the learning curve is seeming very steep at the moment. Much steeper than learning the chip8 was.
Still sounds like a fun project.
So please excuse my n00b questions:
1. Opcode 0xC3 is a jump opcode and the description is the following:
Jump to address nn, where nn is two byte immediate data, LS byte first.
So if i had the following in memory
C3 AB CD
the C3 command will do the following?
Code:
int jmp = m_MemoryAddress[m_ProgramCounter+2] << 8 ;
jmp |= m_MemoryAddress[m_ProgramCounter+1] ;
m_ProgramCounter = jmp ;
2. As you can see with the above opcode, when it uses 2 immediate data bytes does it always do LS byte first, or only if it specifies?
For example opcode 0x01 loads two immediate byte into register BC. But this doesn't specify if it is LS byte first.
3. One of my main issues is with the difference between the following:
ld HL, nn ;
ld (HL), nn ;
What difference does putting brackets around the register signify and how is this implemented?
I'm guessing that it is something to do with the address of the register and not its contents, but im getting a bit lost with how it works.
Actually i just had an idea, could (HL) be reffering to the actual game memory, for example if the contents of HL was 0xAB then would it be the following:
m_GameMemory[0xAB] = nn ;
4. Last question
Opcode E2 is LD ($FF00+C), A
what does $FF00 represent? Is it game memory again? So if C was 0xBC would i have the following:
m_GameMemory[0xFFBC] = A;
Thanks guys for any help.
BTW im reading the entire rom into a byte array and not accessing it via pages or anything, just one big byte array. Anything wrong with this?