Gameboy Development Forum

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.


#1 2015-01-05 16:01:42

New member
Registered: 2015-01-05
Posts: 1

JR NZ, $FB Help needed with where $FB is

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?



Last edited by blackpenny15 (2015-01-05 16:02:17)



#2 2015-01-05 20:50:44

Registered: 2008-02-22
Posts: 245

Re: JR NZ, $FB Help needed with where $FB is

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.

Blog: Gameboy Genius
"A journey of a thousand miles begins with one small step"
Old Chinese Proverb



Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson