Questions tagged [gameboy]

The Game Boy was the first portable console released by Nintendo. It has a black and white screen and, compared to more recent portable devices, it has relatively simple programming API.

The Game Boy was the first portable console released by Nintendo. It has a black and white screen and, compared to more recent portable devices, it has relatively simple programming API.

Questions relating to the Nintendo Game Boy and Nintendo Game Boy Color consoles, along with development of games and their .

Questions relating to the Nintendo DS and subsequent consoles belong on . Questions relating to the Nintendo Game Boy Advance should use .

Useful resources

  • GBDK: GameBoy Developers Kit. Contains some of the essential tools for DMG Game Boy development, including an ANSI C compiler, assembler, linker, several libraries, and some example programs.
  • RGBDS: Rednex Game Boy Development System. An assembly toolchain for the Nintendo Game Boy & Game Boy Color
  • Awesome List: A curated list of Game Boy development resources such as tools, guides, technical documentation, tutorials, emulators, related projects and open-source ROMs.
  • GameBoy Dev'rs: Various resources, tutorials, and documentation for the original Game Boy.
  • GameBoy Advance Dev'rs: Various resources, tutorials, and documentation for the Game Boy Advance.
104 questions
40
votes
3 answers

Game Boy: What constitutes a "half-carry"?

The Game Boy Z80 CPU has a half-carry flag, and I can't seem to find much information about when to set/clear it. What I understand so far is that any 8-bit add, subtract, shift, or rotate operation (and maybe others?) set it to bit 4 of the…
Rena
  • 3,923
  • 3
  • 22
  • 19
17
votes
2 answers

Game Boy: Half-carry flag and 16-bit instructions (especially opcode 0xE8)

Like so many others, I am writing a Game Boy emulator and I have a couple of questions regarding the instruction 0xE8 (ADD SP, n with an 8-bit immediate). It is claimed here that in 16-bit instructions the half-carry flag is set if a carry occurs…
0x4d45
  • 704
  • 1
  • 7
  • 18
15
votes
1 answer

Zilog Z80 OP-Code implementation

I'm currently developing an emulator for the good old GameBoy and I'm facing some problems understandig how some basic operation codes have to be implemented. Right now I'm implementing the AND operations; the first few (0xA0 -> 0xA3; 0xA6 & 0xA7)…
Sepultura
  • 997
  • 1
  • 9
  • 28
14
votes
2 answers

What's the purpose of instructions for loading a register to itself?

While looking through the Gameboy's instruction set, I came across instructions such as: LD A, A LD B, B LD C, C LD D, D ... Each of these instructions has it's own opcode in this table, which makes me think they are of some importance due to the…
Spooze
  • 378
  • 1
  • 10
14
votes
3 answers

How to decode the Nintendo logo from gameboy?

I've tried to decode the following bitmap using the background pallete scheme described at http://imrannazar.com/GameBoy-Emulation-in-JavaScript:-Graphics CE ED 66 66 CC 0D 00 0B 03 73 00 83 00 0C 00 0D 00 08 11 1F 88 89 00 0E DC CC 6E E6 DD DD…
Julio Rodrigues
  • 3,373
  • 3
  • 24
  • 33
13
votes
4 answers

Game Boy emulator with a full debugger?

As part of the work I've been doing to answer this question about the technical workings of a glitch in Pokémon Red, I've been looking for a way to use a standard debugger to debug a Game Boy ROM. Although many of the emulators I've found have some…
templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
13
votes
2 answers

Optimizing a bit-manipulating algorithm in GameBoy Z80

This is not a homework problem, it's for a game I'm developing. I have two 16-bit RGB colors, and would like to vary their six channels according to six other four-bit quantities. The algorithm is simple but tedious; I'm looking for a way to…
Remy
  • 401
  • 2
  • 19
13
votes
3 answers

Game Boy: What is the purpose of instructions that don't modify anything (e.g. AND A)?

I've been working on a Game Boy emulator, and I've noticed that there are certain opcodes that exist that would never change any values, such as LD A, A, LD B, B, etc. and also AND A. The first ones obviously don't change anything as they load the…
Zach Brantmeier
  • 716
  • 3
  • 8
  • 23
11
votes
1 answer

What is the behavior of the carry flag for CP on a Game Boy?

On the page 87 of the Game Boy CPU Manual it is claimed that the CP n instruction sets the carry flag when there was no borrow and that it means that A < n. This seems to conflict itself, because the carry flag is set when A > n. An example: If A=0…
Hassedev
  • 621
  • 6
  • 17
10
votes
1 answer

Length of instruction LD A,(C) in gameboy ~Z80 processor

Hello I'm writing an emulator for Game Boy. I use this reference : Gameboy CPU (LR35902) instruction set This document states that opcodes : 0xE2 LD (C),A and 0xF2 LD A,(C) have a length of 2. The Game Boy CPU Manual says that these instructions…
Demeter Purjon
  • 373
  • 1
  • 12
10
votes
1 answer

Entering HALT mode with master interrupt enabled but no Interrupt Enable (0xFF0F = 0)?

According to Gameboy Programming Manual, HALT mode is canceled by the following events, which have the starting addresses indicated. A LOW signal to the /RESET terminal Starting address: 0x0000 The interrupt-enable flag and its corresponding…
GabrielOshiro
  • 7,986
  • 4
  • 45
  • 57
9
votes
1 answer

Is the Z80 'Game Boy' CPU 8 or 16 bits?

I was reading a tutorial about creating a Game Boy emulator, I understand that the Game Boy uses an 8-bit CPU, but I can't understand why the Gameboy uses two types of data: bytes (8 bits) and words (16 bits). If the CPU has a capacity of 8 bits,…
Toni
  • 95
  • 6
7
votes
2 answers

GBZ80: How does LD HL,(SP+e) affect H and C flags?

On Gameboy Z80, exactly how does the LD HL,(SP+e) operation affect H and C flags? (Half-carry + carry) Reference: http://www.devrs.com/gb/files/opcodes.html
Johan Kotlinski
  • 25,185
  • 9
  • 78
  • 101
7
votes
1 answer

What are the differences between the Game Boy and the Game Boy Color in terms of emulation?

I'm writing an emulator for the game boy color (for fun). I've found tonnes of resources and references for the original game boy's hardware, namely Imran Nazar's tutorial (http://imrannazar.com/GameBoy-Emulation-in-JavaScript) and Zak's Book (Z80…
DNg
  • 422
  • 2
  • 15
7
votes
2 answers

GameBoy 16-bit load into 8-bit memory

I have begun programming an emulator for the Gameboy classic, my next project after a successful Chip 8 Emulator. As a reference I use the GameBoy CPU Manual. Now on page 66 it says: LD A,(HL) 7E 8 Basically, load the value HL into register…
1
2 3 4 5 6 7