Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)
You are not logged in.
Hi everyone,
Apologies if this is obvious to anyone, I don't have the greatest understanding of z80 instructions or the gameboy yet, I've been working through the DMB BootRom and writing out the various opcodes, It's clear I need to start following the jumps, JR NZ is jump if the last result was not 0, the address is $FB though, in the disassembled version its annotated as Addr_0007, this is the bootrom so it's loaded into memory by the CPU and copied over later.
In writing this, i've possibly worked it out, I might need to read some more, FB would be what ever code resides at FB location in the gameboy memory?
Thanks and sorry if this is a bit scrambley, knowledge is still forming.
Can i ask a random question, has anyone hooked up a virtual Gameboy CPU to physical hardware?
Thanks
Si
Last edited by blackpenny15 (2015-01-05 16:02:17)
Offline
jr is a relative jump with a signed 8 bit argument, which can be positive or negative, relative to the address after the instruction. 18 is the opcode for an (unconditional) relative jump. A couple of example:
18 00 = Jump to the address after the 00 byte, ie continute immediately after the jr instruction.
18 FE = Endless loop, ie jump back two steps to the jr instruction.
So, a relative jump to FB jumps three bytes before jr instruction.
For an absolute jump, use the jp opcode.
Offline