Page 1
PROGRAMMING MANUAL Version 1.1 DMG-06-4216-001-B Released 12/03/1999...
Page 2
“Confidential” This document contains confidential and proprietary information of Nintendo and is also protected under the copyright laws of the United States and foreign countries. No part of this document may be released, distributed, transmitted or reproduced in any form or by any electronic or mechanical means, including information storage and retrieval systems, without permission in writing from Nintendo.
This manual is a combination and reorganization of the information presented in the Game Boy Development Manual, revision G, and the Game Boy Color User's Guide, version 1.3. In addition, it incorporates all information related to Game Boy programming, including programming for Super Game Boy and the Game Boy Pocket Printer.
Page 4
Game Boy Programming Manual THIS PAGE WAS INTENTIONALLY LEFT BLANK.
CGB software and/or product proposals are evaluated based on the following criteria: • Use of Color To ensure that the expectations of the Game Boy Color consumer are met, Mario Club will evaluate the use of color in all CGB games (dual or dedicated) using the following criteria: ◊...
Page 6
Also state whether the game will be compatible with the monochrome Game Boy hardware or if it is dedicated to CGB hardware. For the current Game Pak prices and configurations available, please contact Nintendo’s Licensing Department.
Chapter 3 Sound Functions............... 77 Chapter 4 CPU Instruction Set ............93 Chapter 5 Miscellaneous General Information....... 125 Chapter 6 The Super Game Boy System ........137 Chapter 7 Super Game Boy Sound ..........187 Chapter 8 Game Boy Memory Controllers(MBC) ......215 Chapter 9 Pocket Printer..............
Page 8
Game Boy Programming Manual THIS PAGE WAS INTENTIONALLY LEFT BLANK.
Page 9
CHAPTER 1: SYSTEM .............. 11 Revision History…………………………………………………………….10 GENERAL SYSTEM ..............11 1.1 System Overview ..................11 1.2 Game Boy Block Diagram ............... 13 1.3 Memory Configuration................14 1.4 Memory Map ..................... 15 1.5 Feature Comparison ................16 1.6 Register Comparison................17 CPU....................18...
! Input connector for external power source Types of Game Pak Supported 1 Game Boy Game Pak (Software that uses only the Game Boy functions. When used with Game Boy Color, 4- 10 colors are displayed.) 2 Game Boy Color Game Pak...
Page 12
Game Boy Programming Manual Operating Modes (the following modes apply only to CGB) DMG Mode (when using software for DMG) The new registers, expanded memory area, and new features for CGB are not used. Color applications previously associated with palette data BGP, OBP0, and OBP1 are performed by the system.
Chapter 1: System GAME Boy Block Diagram External Power Source Battery Terminal LCD Panel Power Switch Power to DC-DC System LCD Driver Converter Headphone Terminal Volume Speaker Display RAM DMG: 64 Kbit CGB: 128 Kbit 8-bit Microprocessor Infrared Communication (CGB only)
Game Boy Programming Manual Memory Configuration In DMG and CGB, the 32 KB from 0h to 7FFFh is available as program area. 000h-0FFh: Allocated as the destination address for RST instructions and the starting address for interrupts. 100h-14Fh: Allocated as the ROM area for storing data such as the name of the game.
Chapter 1: System Memory Map Note: In DMG, there is no bank switching at 8000h-9FFFh and C000h-DFFFh. 000h Interrupt Address RST Address 100h ROM Data Area 150h Program Start Address User Program Area 32 KB Lower Dot Data 8000h 8001h Upper Dot Data 8000h Bank 1...
Game Boy Programming Manual Feature Comparison Item DMG CPU CGB CPU CPU Speed 1.05 MHz 1.05 MHz (normal mode) (system operating frequency) 2.10 MHz (double-speed mode) Game Boy RAM ← ← ← ← Work and Stack RAM 127 x 8 bits...
! Infrared I/O Port <CGB only> LCD Controller Functions Game Boy is equipped with functions that provide control of the images displayed on the LCD. Character data used for display is held in system RAM. ! DMG: 4 shades of gray; CGB: 32 shades of gray for each RGB color...
Page 19
Miscellaneous ! An internal monitor program is built into DMG/CGB CPUs. When power is turned on or the Game Boy is reset, the internal monitor program first initializes components such as the ports, then passes control to the user program.
Game Boy Programming Manual 2.2 CPU Block Diagram Game Boy (DMG/MGB) CPU D0~D7 TEST1,2 /RESET ..Timing Data Buffer Controller Control CPU Core Port 127 bytes Address Buffer Interrupt Controller Sound 1 NR10-NR14 Sound 2 @ @ @ @ @ @ @ @ @ Ø...
Page 21
Chapter 1: System Game Boy Color CPU /RD/WR/CS MD0-MD7 D0-D7 /NMI P00-P03 P10-P13 ..Keyport /MRD Timing Data Buffer /MWR Control /CS1 Interrupt 127 bytes Controller CPU Core A0-A15 2 Kbytes Sound 1 NR10-NR14 Sound 2 MA0-MA12 NR20-NR23 Sound 3...
Game Boy Programming Manual 2.3 Description of CPU Functions Interrupts There are five types of interrupts available, including 4 types of maskable internal interrupts and 1 type of maskable external interrupt. The IE flag is used to control interrupts. The IF flag indicates which type of interrupt is set.
Page 23
(source oscillation). HALT Mode Game Boy switches to HALT mode when a HALT instruction is executed. The system clock and CPU operation halt in this mode. However, operation of source oscillation circuitry between terminals CK1 and CK2 continues. Thus, the functions that do not require the system clock (e.g,, DIV, SIO, timer, LCD controller, and sound circuit)
Game Boy Programming Manual 2.4 CPU Functions (Common to DMG/CGB ) The CPU functions described here are those that are identical in DMG and CGB. CPU functions that are enhanced in CGB are described in Section 2.5, CPU Functions (Common to DMG/CGB ). CPU functions that cannot be used for DMG are described in Section 2.6, CPU Function (CGB only).
Page 25
Chapter 1: System The interrupt request flag (IF: 4) is set by negative edge input at one of the P13- P10 terminals. Negative edge input requires a LOW period of 2 times source oscillation (DMG = 4 MHz, CGB = 4 MHz/8 MHz). The interrupt request flag (IF: 4) also is set when a reset signal is input to the /RESET terminal with a P13~P10 terminal in the LOW state.
Page 26
Game Boy Programming Manual The timer consists of TIMA, TMA, and TAC. The timer input clock is selected by TAC. TIMA is the timer itself and operates using the clock selected by TAC. TMA is the modulo register of TIMA. When TIMA overflows, the TMA data is loaded into TIMA.
Page 27
Chapter 1: System The 5 types of interrupts are as follows: Interrupt starting The LCDC interrupt Cause of Interrupt Priority address mode can be selected (see STAT register). Vertical blanking 0040h Mode 00 Mode 01 LCDC status interrupt 0048h Mode 10 LYC=LY Timer overflow 0050h...
Game Boy Programming Manual 2.5 CPU Functions (Common to DMG/CGB ) This section describes the CPU functions that have been enhanced in CGB. Functions that are identical in DMG and CGB are described in Section 2.4, CPU Functions (Common to DMG/CGB ).
Page 29
Chapter 1: System When the shift clock goes low, the contents of the SB register are shifted leftward and the data is output from the highest bit. When the shift clock goes high, input data from the SIN terminal are output to the lowest bit of the SB register.
Page 30
Game Boy Programming Manual SIO Block Diagram 8-bit Shift Register SOUT 3-Bit Counter Resistance Gate 3-State Buffer CTRL Inverter Serial Control (SC) Switch CTRL Transfer Start External/Internal Clock Selection Internal Shift Clock (8 KHz/256 KHz)
Page 31
Chapter 1: System 2.5.2 Serial Cable Communication: Reference flowchart Flow until start of game Start (SB) Slave Code RD Clear -Select code other than $00 and $FF. (For both slave and master code). -Clear the receive data buffer (RD). (SC) -Both sides wait in receive-wait status.
Page 32
Game Boy Programming Manual Flow after game start If Slave If Master Master Game Slave Game Key Input Key Input (Transfer Data) (Transfer Data) Game Processing Transfer Game Processing SIO Finished? V_BLANK Slave waits for finish of SIO to synchronize with Transfer master.
Page 33
Chapter 1: System In the example, 1 byte is sent per frame. (This is not required.) If several bytes are sent continuously, a transmission interval longer than the processing time of other interrupts (e.g. V_BLANK) should be used (usually around 1 mS). The reason is that if an attempt is made to communicate with the slave during another interrupt, the slave cannot receive the data until after the interrupt is finished.
2.6.1 Bank Register for Game Boy Working RAM The 32 KB of Game Boy working RAM is divided into 8 banks of 4 KB each. The CPU memory space C000h-CFFFh is set to Bank 0, and the space D000h-DFFFh is switched between banks 1-7.
Page 35
Chapter 1: System Note: When bit 0 of register Key 1 is set to 1, the standby function cannot be used. When using the standby function, always confirm that bit 0 of register Key 1 is set to 0. When switching the CPU speed, all interrupt- enable flags should be reset and a STOP instruction executed with bits 4 and 5 of the P1 port register set to 1, as with the standby function (STOP mode).
Page 36
Game Boy Programming Manual Flow of Switching (when switching to double-speed mode) In case the CPU operating speed needed to be switched, the current speed should always be checked first using the speed flag (bit 7 of the KEY 1 register). This ensures that the speed will be switched to the intended speed.
Page 37
Consequently, to ensure proper data transmission from sender to receiver in Game Boy Color infrared communication, signals are distinguished by the size of the interval between the rising edge of the pulse of one received signal to the rising...
Page 38
To use infrared communication, data reception must be enabled by setting bits 6 and 7 of Game Boy Color RP register to 1. However, even with both of these bits set to 1, data cannot immediately be received. After setting bits 6 and 7 to 1, at least 50 ms should be...
Page 39
Following this, the communication status is returned from receiver to sender. 2.6.3.6 Flow of Data Transmission and Reception When data is transmitted and received, both Game Boy Color units are first placed in receive status. The one with the send indicator is then designated as the sender, and the other one is designated as the receiver.
Page 40
(Indicates reading of the RP register) Light emission Sender Light detection Light emission Receiver Light detection The two Game Boy Color machines perform initial data reception, then the one designated as the sender (e.g., by operations such as pressing button A) begins transmission.
Page 41
Chapter 1: System The following illustrates the flow for implementing a connection. Start of infrared communication Read bit 1 of RP Transmission Register Signal received? Value read=0? Pulse-width measurement Transmission of (software measurement of connecting pulse High and Low periods) Received signal a Start of reception, proper connecting...
Page 42
! The wrong communication protocol is used. ! Data is transmitted using the wrong pulse width. ! One of the Game Boy Color units is operating in double-speed mode and the other is operating in normal mode. ! Communication is affected by sunlight or obstruction of the signal light.
Page 43
Communication error: Communication prevented by other causes. The subroutine provided by Nintendo treats as an error the case when the data value of the second byte of the received header exceeds the number of data items to be received, as determined beforehand by the receiver.
Page 44
! Depending on the power reserve of the battery, infrared communication may cause a sudden drop in battery voltage and a complete loss of power. ! Ensure that the speed of the two communicating Game Boy Color machines is the same (both double-speed or both normal speed during communication).
Page 45
Chapter 1: System 2.6.3.11 Specifications 1) Communication Speed Normal-speed mode: approximately 7.5 Kbps Double-speed mode: approximately 9.5 Kbps 2) Communication distances: Minimum, 10 cm, Typical, 15 cm 3) Recommended directional angle: approximately ± 15º...
Page 46
Game Boy Programming Manual THIS PAGE WAS INTENTIONALLY LEFT BLANK.
Game Boy Programming Manual CHAPTER 2: DISPLAY FUNCTIONS 1. GENERAL DISPLAY FUNCTIONS 1.1 Character Composition The basic character size is an 8 x 8-dot composition. With characters of the basic size: • 128 OBJ-only characters are available (256 with CGB) •...
Chapter 2: Display Functions 1.2 LCD Display RAM The DMG CPU has 8 KB (64 Kbits) of built-in LCD display RAM. In CGB, 16 KB of memory can be joined in the 8 MB (64-Mbit) memory area (8000h-9FFFh) by bank switching using the register VBK (FF4Fh). Bank switching is used exclusively in CGB and cannot be used in DMG mode.
Game Boy Programming Manual 1.3 Character RAM Character data can be written to the 6144 bytes from 8000h to 97FFh. The area from 8000h to 8FFFh is allocated for OBJ character data storage. The register LCDC can be used to select either 8000h-8FFFh or 8800h-97FFh as the area for storing BG and window character data.
Page 51
Chapter 2: Display Functions Character Code Mapping Data for 1 dot CHR Code Address Bank 0 Bank 1(CGB only) Shade Lower Shade Upper 7 6 5 4 3 2 1 0 8000h OBJ Code OBJ Code "000" "100" Dot Data Dot Data 800Fh 8010h...
Page 52
Game Boy Programming Manual 8 x 16 dots/block (OBJ) and 8 x 8 dots/block (BG): CHR Code Address Bank 0 Bank 1 (CGB only) 8000h OBJ Code OBJ Code 800Fh "000" Dot Data "100" Dot Data 8010h 801Fh 8020h OBJ Code "002"...
Page 53
Chapter 2: Display Functions the dot data that correspond to the CHR codes also are the same. Note: Because bank switching is not available in DMG mode, Bank 1 on the right side of the figure is not present in this mode.
Game Boy Programming Manual 1.4 BG Display Bank 1 (CGB only) Address Bank 0 7 6 5 4 3 2 1 0 9800h CHR Code (8 bits) 9FFFh Specifies the color palette Display Priority Flag Specifies the character 0: Display according to OBJ display priority flag...
Game Boy Programming Manual 1.5 LCD Screen Window Display Specifying a position on the LCD screen using registers WX and WY causes the window to open downward and rightward beginning from that position. Window display data also can be specified as character codes, beginning from 9800h or 9C00h in external SRAM.
Chapter 2: Display Functions 1.6 LCD Display Registers NAME ADDRESS FF40h LCDC LCD Control Register CGB Mode: BG display always on DMG Mode: 0: BG display off 1: BG display on OBJ On Flag 0: Off 1: On OBJ Block Composition Selection Flag 0: 8 x 8 dots 1: 8 x 16 dots BG Code Area Selection Flag...
Page 58
Game Boy Programming Manual NAME ADDRESS STAT FF41h LCD Status Flag Mode Flag 00: Enable CPU Access to all Display RAM 01: In vertical blanking period 10: Searching OAM RAM 11: Transferring data to LCD Driver Match Flag 0: LYC = LCDC LY...
Page 59
Chapter 2: Display Functions Changing the values of SCY and SCX scrolls the BG screen vertically and horizontally one bit at a time. 7 6 5 4 3 2 1 0 NAME ADDRESS FF44h LCDC y-coordinate LY indicates which line of data is currently being transferred to the LCD driver. LY takes a value of 0-153, with 144-153 representing the vertical blanking period.
Page 60
Game Boy Programming Manual NAME ADDRESS FF47h BG Palette Data Data for dot data 00 Data for dot data 01 Data for dot data 10 Data for dot data 11 NAME ADDRESS OBP0 FF48h OBJ Palette Data 0 When value of OAM palette selection flag is...
Page 61
Chapter 2: Display Functions LCD Screen Area Window Display Area OBJ characters are displayed in the same manner in the window as on BG.
Game Boy Programming Manual 1.7 OAM Registers OBJ (Object) Data for 40 objects (OBJ) can be loaded into internal OAM RAM in the CPU (FE00h-FE9Fh), and 40 objects can be displayed to the LCD. Up to 10 objects can be displayed on the same Y line.
Page 63
Chapter 2: Display Functions OAM Register NAME ADDRESS LCD y-coordinate FE00 OBJ0 00h-FFh With y = 10, object displayed from top edge of LCD screen. LCD x-coordinate FE01 00h-FFh With x = 8, object displayed from left edge of LCD screen. CHR code FE02 00h-FFh...
Game Boy Programming Manual 1.8 DMA Registers 1.8.1 DMA Transfers in DMG DMA transfers of 40 x 32 bits of data can be performed from the RAM area (8000h-DFFFh) to OAM (FE00h-FE9Fh). The transfer time is 160 µs. Note that in DMG, data cannot be transferred by DMA from RAM area 0000h-7FFFh.
Page 65
Chapter 2: Display Functions 2. Example of program that writes the above instructions to internal RAM starting from 0xFF80: Label Instruction C, 80H B, 10 HL, DMADATA A, (HLI) (C), A NZ, L2 • • • DMADATA 3EH, 0C0H, 0E0H, 46H, 28H, 3DH,...
Page 66
Game Boy Programming Manual 3) When the DMA transfer is performed, the subroutine written to internal RAM shown in 1) above is executed: CALL 0FF80h ;DMA transfer Note: The preceding program is used for DMA transfers performed within routines for processing interrupts implemented by vertical blanking.
Page 67
Chapter 2: Display Functions 1.8.2 DMA Transfers in CGB Using the Earlier DMA Transfer Method This DMA method transfers only 40 x 32 bits of data from 0-DFFFh to OAM (FE00h-FE9Fh). The transfer starting address can be specified as 0-DFFFh in increments of 100h. The transfer method is the same as that used in DMG, but when data are transferred from 8000h-9FFFh (LCD display RAM area), the data transferred are those in the bank specified by bit 0 of register VBK.
Page 68
Game Boy Programming Manual Special Notes The number of bytes transferred by the new DMA method must be specified in 16- byte increments; byte counts that are not a multiple of 16 cannot be transferred. With the new DMA transfer method, transfers are performed at a fixed rate regardless of whether the CPU is set to operate at normal or double-speed.
Page 69
Chapter 2: Display Functions 1.8.4 New DMA Control Registers: CGB only ADDRESS NAME Specifies higher-order transfer source address HDMA1 FF51 00h-7Fh(program ROM) A0h-DFh (external and unit working RAM) Specifies lower-order transfer source HDMA2 FF52 address 0Xh-FXh Combined with HDMA1, specifies the upper 12 bits of the transfer source area (0x000X-0x7FFX or 0xA00X-0xDFFX) Specifies higher-order transfer destination...
Game Boy Programming Manual 1.9 OBJ Display Priority As a rule, when objects overlap, the one with the lower OBJ number is given priority. In DMG or CGB in DMG mode, among overlapping objects with different x-coordinates, priority is given to the object with the smallest x-coordinate.
Page 71
Chapter 2: Display Functions 3. Different x-coordinates: DMG/CGB in DMG Mode In DMG mode and with objects with different x-coordinates, the object with the smallest x- coordinate is given priority. a = No. of OBJ A b = No. of OBJ B When a <...
Game Boy Programming Manual 2 LCD COLOR DISPLAY (CGB ONLY) The LCD unit of the CGB system can display 32 shades each for RGB, for a total 32,768 colors. A single color palette consists of 4 colors selected from among these 32,768. One of 8 palettes can be selected for each BG and OBJ character.
Chapter 2: Display Functions 2.2 Color Palette Composition 1. BG Color Palettes Color Palette No. Palette Data No. Color palette H00 Color palette L00 Color palette H01 Color palette L01 Color palette 0 Color palette H02 Color palette L02 Color palette H03 Color palette L03 Color palettes 1-7 ...
Page 74
Game Boy Programming Manual ADDRESS NAME Specifies a BG write BCPS FF68 Specifies H/L (H: 1, L: 0) Specifies the palette data no. Specifies the palette no. 1: With each write, specifies the next palette 0: Values of bits 0-5 fixed...
Chapter 2: Display Functions 2.4 Overlapping OBJ and BG When objects are displayed, overlapping objects and background are displayed according to the display priority flags for OBJ and BG, as indicated below. The BG display priority flag can be used to assign BG display priority to individual characters. Display Priority Flag Dot Data Screen Display...
Game Boy Programming Manual 2.5 Display Using Earlier DMG Software (DMG mode) When earlier DMG software is used, coloring is performed automatically by the system using registers BGP, 0BP0, and 0BP1. However, the display uses 3 palettes, 1 for BG, with 4 colors, and 2 for OBJ, each with 3 colors (excluding transparent;...
Page 78
Game Boy Programming Manual Revision History Date Section Description 12/3/99 Addition of “Usage Notes” 12/3/99 Revision and addition of Notes in Mode Registers for Sound 1, 2, 4...
Chapter 3: Sound Functions CHAPTER 3: SOUND FUNCTIONS 1. OVERVIEW OF SOUND FUNCTIONS The sound circuitry consists of circuits that generate 4 types of sounds (Sounds 1-4). It can also synthesize external audio input waveforms and output sounds. (External audio input is a function available only in CGB).
Page 80
Game Boy Programming Manual ♦ ♦ ♦ ♦ OFF Mode Stops operation of the frequency counter and D/A converter and halts sound output. ♦ ♦ ♦ ♦ Sounds 1, 2, and 4: -When the default level is set to 0000 with the envelope in DOWN mode (initialization not required) ♦...
Chapter 3: Sound Functions 2. SOUND CONTROL REGISTERS 2.1 Sound 1 Mode Registers Sound 1 is a circuit that generates a rectangle waveform with sweep and envelope functions. It is set by registers NR10, NR11, NR12, NR13, and NR14. ♦ ♦ ♦ ♦ Sweep Shift Number Name Address R/W(Only the shaded portion...
Page 82
Game Boy Programming Manual Example: When NR10 = 79h and the default frequency = 400h, the sweep waveform appears as follows. 11.7ms 7.8ms 13.6ms 54.7ms 54.7ms 54.7ms Note: When the sweep function is not used, the increase/decrease flag should be set to 1 (subtraction mode).
Page 83
Chapter 3: Sound Functions Example: When NR12 = 94h, the Amp Gain is as follows. Amp. Gain 4/64 sec. Note: By Setting the envelope register only nothing will be reflected in the output. Always set the initial flag. Name Address R/W(Low-order Frequency Data FF13 NR13...
Game Boy Programming Manual ♦ ♦ ♦ ♦ Sound 1 Usage Notes -When no sweep function is used with Sound 1, the sweep time should be set to 0 (sweep OFF). In addition, either the sweep increase/decrease flag should be set to 1 or the sweep shift number set to 0 (set to 08h-0Fh or 00h in NR10).
Chapter 3: Sound Functions Name Address NR23 FF18 W Lower Frequency Data Name Address R/W(Only the shaded portion NR24 FF19 can be read.) High-order Frequency Data(3 bits) Counter/Continuous Selection Initialize Counter/Continous Selection 0: Outputs continuous sound regardless of length data in register NR21. 1: Outputs sound for the duration specified by the length data in register NR21.
Page 86
Game Boy Programming Manual Name Address R/W(Only the shaded portion NR32 FF1C can be read.) Output Level Selection Output Level: 00: Mute 01: Output waveform RAM data (4-bit length) unmodified. 10: Output waveform RAM data (4-bit length) shifted 1 bit to the right (1/2).
Chapter 3: Sound Functions ♦ ♦ ♦ ♦ Sound 3 Usage Notes • • • • The initialization flag should not be set when the frequency is changed during Sound 3 output. • • • • Setting the initialization flag during Sound 3 operation (Sound 3 ON flag = 1) may destroy the contents of waveform RAM.
Page 88
Game Boy Programming Manual Name Address NR42 FF21 Length of Envelope Steps n(n=0 to 7) Envelope Up/Down 0: Decrease 1: Increase Default Envelope Value Note: By only setting the envelope register nothing will be reflected in the output. Always set the initial flag.
Page 89
Chapter 3: Sound Functions Name Address R/W(Only the shaded portion NR44 FF23 can be read.) Counter/Continous Selection Initialize Counter/Continuous Selection: 0: Outputs continuous sound regardless of length data in register NR41. 1: Outputs sound for the duration specified by the length data in register NR41.
Game Boy Programming Manual 2.5 Sound Control Registers Name Address FF24 NR50 SO1 Output Level(0-7) S01 On/Off SO2 Output Level(0-7) S02 On/Off Output Level: 000: Minimum level (Maximum level 8) 111: Maximum level V i n!SO1 ON/OFF (V i nSO2!ON/OFF) Synthesizes audio input from Vin terminal with sounds 1-4 and ouputs the result.
Chapter 3: Sound Functions 3. VIN TERMINAL USAGE NOTES • • • • The VIN terminal can be used normally only in CGB. (Since the signal from the VIN terminal is too low to be used, the VIN terminal cannot be used in DMG.) •...
Page 92
Game Boy Programming Manual THIS PAGE WAS INTENTIONALLY LEFT BLANK.
Chapter 4: CPU Instruction Set CHAPTER 4: CPU INSTRUCTION SET........94 1. GENERAL PURPOSE REGISTERS...........94 2. DESCRIPTION OF INSTRUCTIONS..........95 2.1 8-Bit Transfer and Input/Output Instructions..........95 2.2 16-Bit Transfer Instructions ..............100 2.3 8-Bit Arithmetic and Logical Operation Instructions ......102 2.4 16-Bit Arithmetic Operation Instructions ..........
Game Boy Programming Manual CHAPTER 4: CPU INSTRUCTION SET 1. GENERAL PURPOSE REGISTERS • Accumulator: A An 8-bit register for storing data and the results of arithmetic and logical operations. • Auxiliary registers: B, C, D, E, F, H, and L These serve as auxiliary registers to the accumulator.
Chapter 4: CPU Instruction Set • Flag Register: Consists of 4 flags that are set and reset according to the results of instruction execution. Flags CY and Z are tested by various conditional branch instructions. Z: Set to 1 when the result of an operation is 0; otherwise reset. N: Set to 1 following execution of the substruction instruction, regardless of the result.
Page 96
Game Boy Programming Manual CYCL 5 4 3 2 1 0 r ← n Loads 8-bit immediate data n into register r ← Example: L D B, 24h ; B CYCL 5 4 3 2 1 0 r ← (HL) (HL) Loads the contents of memory (8 bits) specified by register pair HL into register r.
Page 97
Chapter 4: CPU Instruction Set CYCL 5 4 3 2 1 0 A ← (FF00H+C) Loads into register A the contents of the internal RAM, port register, or mode register at the address in the range FF00h-FFFFh specified by register C. Example: When C = 95h, LD A, (C) ;...
Page 98
Game Boy Programming Manual CYCL 5 4 3 2 1 0 A ← (nn) (nn) Loads into register A the contents of the internal RAM or register specified by 16-bit immediate operand Example: LD A, (FF44h) ; A ← (LY) LD A, (8000h) ;...
Page 99
Chapter 4: CPU Instruction Set CYCL 5 4 3 2 1 0 (BC) ← A (BC), Stores the contents of register A in the memory specified by register pair BC. Example: When BC = 205Fh and A = 3Fh, LD (BC) , A ; (205Fh) ← 3Fh CYCL 5 4 3 2 1 0...
Game Boy Programming Manual 2.2 16-Bit Transfer Instructions CYCL 5 4 3 2 1 0 dd ← nn L-ADRS H-ADRS Loads 2 bytes of immediate data to register pair dd. codes are as follows: Register Pair Example: LD HL, 3A5Bh ; H ← 3Ah, L ← 5Bh...
Page 101
Chapter 4: CPU Instruction Set CYCL 5 4 3 2 1 0 qqL ← (SP) qqH ← (SP+1) SP ← SP+2 Pops contents from the memory stack and into register pair qq. First the contents of memory specified by the contents of SP are loaded in the lower portion of qq. Next, the contents of SP are incremented by 1 and the contents of the memory they specify are loaded in the upper portion of qq.
Game Boy Programming Manual 2.3 8-Bit Arithmetic and Logical Operation Instructions CYCL 5 4 3 2 1 0 A ← A + r Adds the contents of register r to those of register A and stores the results in register A.
Page 103
Chapter 4: CPU Instruction Set CYCL (HL) Examples: When A = E1h, E = 0Fh, (HL) = 1Eh, and CY = 1, ADC A, E ; A ← F1h, Z ← 0, H ← 1, CY ← 0 ADC A, 3Bh ; A ← 1Dh, Z ← 0, H ← 0, CY ← -1 ADC A, (HL) ;...
Page 104
Game Boy Programming Manual CYCL 5 4 3 2 1 0 (HL) Examples: When A = 3Bh, (HL) = 4Fh, H = 2Ah, and CY = 1, A ← 10h, Z ← 0, H ← 0, N ← 1 CY ← 0 SBC A, H ;...
Page 105
Chapter 4: CPU Instruction Set CYCL (HL) Examples: When A = 5Ah, (HL) = 0Fh, A ← 5Ah, Z ← 0 OR A A ← 5Bh, Z ← 0 OR 3 OR (HL) ; A ← 5Fh, Z ← 0 CYCL 5 4 3 2 1 0...
Page 106
Game Boy Programming Manual CYCL (HL) Examples: When A = 3Ch, B = 2Fh, and (HL) = 40h, ; Z ← 0, H ← 1, N ← 1, CY ← 0 CP B CP 3Ch ; Z ← 1, H ← 0, N ← 1, CY ← 0 CP (HL) ;...
Chapter 4: CPU Instruction Set 2.4 16-Bit Arithmetic Operation Instructions CYCL 5 4 3 2 1 0 HL ← HL + ss Adds the contents of register pair ss to the contents of register pair HL and stores the results in HL. ss codes are as follows: Register Pair Flag...
Page 108
Game Boy Programming Manual CYCL 5 4 3 2 1 0 ss ← ss - 1 Decrements the contents of register pair ss by 1. Example: When DE = 235Fh, DEC DE ; DE ← 235Eh...
Chapter 4: CPU Instruction Set 2.5 Rotate Shift Instructions CYCL 5 4 3 2 1 0 RLCA Rotates the contents of register A to the left. That is, the contents of bit 0 are copied to bit 1 and the previous contents of bit 1 (the contents before the copy operation) are copied to bit 2.
Page 110
Game Boy Programming Manual CYCL 5 4 3 2 1 0 Rotates the contents of operand m to the left. r and (HL) are used for operand m. CYCL 5 4 3 2 1 0 (HL) Examples: When B = 85h, (HL) = 0, and CY = 0, RLC B ;...
Page 111
Chapter 4: CPU Instruction Set CYCL 5 4 3 2 1 0 Rotates the contents of operand m to the right. r and (HL) are used for operand m. CYCL 5 4 3 2 1 0 (HL) Examples: When C = 1h, (HL) = 0h, CY = 0, RRC C ;...
Page 112
Game Boy Programming Manual CYCL 5 4 3 2 1 0 Shifts the contents of operand m to the left. That is, the contents of bit 0 are copied to bit 1 and the previous contents of bit 1 (the contents before the copy operation) are copied to bit 2. The same operation is repeated in sequence for the rest of the operand.
Page 113
Chapter 4: CPU Instruction Set CYCL 5 4 3 2 1 0 Shifts the contents of operand m to the right. That is, the contents of bit 7 are copied to bit 6 and the previous contents of bit 6 (the contents before the copy operation) are copied to bit 5. The same operation is repeated in sequence for the rest of the operand .
Game Boy Programming Manual 2.6 Bit Operations CYCL 5 4 3 2 1 0 Z ← Copies the complement of the contents of the specified bit in register r to the Z flag of the program status word (PSW). The codes for b and r are as follows.
Page 115
Chapter 4: CPU Instruction Set CYCL 5 4 3 2 1 0 ← 1 Sets to 1 the specified bit in specified register r. Example: When A = 80h and L = 3Bh, SET 3, A ; A ← 0x84 SET 7, L ;...
Game Boy Programming Manual 2.7 Jump Instructions CYCL 5 4 3 2 1 0 PC ← nn L - ADRS H - ADRS Loads the operand nn to the program counter (PC). nn specifies the address of the subsequently executed instruction.
Page 117
Chapter 4: CPU Instruction Set CYCL 5 4 3 2 1 0 PC ← PC + e e - 2 e = -127 to +129 Jumps -127 to +129 steps from the current address. CYCL 5 4 3 2 1 0 If cc true, PC ←...
Game Boy Programming Manual 2.8 Call and Return Instructions CYCL 5 4 3 2 1 0 (SP - 1) ← PC CALL (SP - 2) ← PC PC ← nn L - ADRS SP ← SP-2 H - ADRS In memory, pushes the PC value corresponding to the instruction at the address following that of the CALL instruction to the 2 bytes following the byte specified by the current SP.
Page 119
Chapter 4: CPU Instruction Set CYCL 5 4 3 2 1 0 ← (SP) ← (SP + 1) SP ← SP + 2 Pops from the memory stack the PC value pushed when the subroutine was called, returning control to the source program.
Page 120
Game Boy Programming Manual CYCL 5 4 3 2 1 0 If cc true, ← (SP) ← (SP+1) SP ← SP + 2 If condition cc and the flag match, control is returned to the source program by popping from the memory stack the PC value pushed to the stack when the subroutine was called.
Page 121
Chapter 4: CPU Instruction Set CYCL 5 4 3 2 1 0 (SP - 1) ← PC (SP - 2) ← PC SP ← SP - 2 ← 0 PC ← P Pushes the current value of the PC to the memory stack and loads to the PC the page 0 memory addresses provided by operand t.
Game Boy Programming Manual 2.9 General-Purpose Arithmetic Operations and CPU Control Instructions CYCL 5 4 3 2 1 0 Decimal adjust acc When performing addition and subtraction, binary coded decimal representation is used to set the contents of register A to a binary coded decimal number (BCD).
Page 123
Chapter 4: CPU Instruction Set CYCL 5 4 3 2 1 0 CY ← (CY) (CY) Flips the carry flag CY. Example: When CY = 1, ; CY ← 0 CYCL 5 4 3 2 1 0 CY ← 1 Sets the carry flag CY.
Page 124
Game Boy Programming Manual CYCL 5 4 3 2 1 0 HALT Halt After a HALT instruction is executed, the system clock is stopped and HALT mode is entered. Although the system clock is stopped in this status, the oscillator circuit and LCD controller continue to operate.
Chapter 5: Miscellaneous General Information CHAPTER 5: MISCELLANEOUS GENERAL INFORMATION ...................126 1. MONITOR ROM ..............126 2. RECOGNITION DATA FOR CGB ONLY IN ROM-REGISTERED DATA..................127 3. POWER-SAVING ROUTINES FOR THE MAIN PROGRAM ....................128 4. SOFTWARE CREATED EXCLUSIVELY FOR CGB.....130 5. SOFTWARE CREATED TO OPERATE ON CGB ....131 6.
When power on the hardware is turned on, the monitor ROM checks for errors in the ‘Nintendo’ logo character data within the game software. If the data is correct, the Nintendo logo is displayed and the program is then started. If there is an error in the data, the screen flashes repeatedly.
Non-CGB: When operating on CGB, up to 10 colors can be displayed on a single screen. Note: Regardless of the type of game, the following fixed values should be stored at the following addresses. ! Address 100h=00h ! Address 101h=C3h ! Address 14Bh=33h ! Addresses 104h – 133h=‘Nintendo’ character data...
Game Boy Programming Manual 3. POWER-SAVING ROUTINES FOR THE MAIN PROGRAM To minimize battery power consumption and extend battery life, inclusion of programs such as those shown below is recommended. During waiting for vertical blanking, halt the CPU system clock to reduce power consumption by the CPU and ROM.
Page 129
Chapter 5: Miscellaneous General Information HALT instructions should not be executed while CGB horizontal blanking DMA is executed. (See Appendix 1, Programming Cautions.)
For information on software methods of distinguishing game units, see Section 6 of this chapter, Software Created for CGB: Example. Sample Message Display [Game Title] This software is intended only for use with Game Boy Color. Please use it with Game Boy Color.
Chapter 5: Miscellaneous General Information 5. SOFTWARE CREATED TO OPERATE ON CGB As is shown below, CGB and DMG differ slightly in their specifications and operation. When creating software to operate on CGB, please give appropriate consideration to these differences. When objects with different x- When objects with different x- coordinates overlap, the object with...
Game Boy Programming Manual 6. SOFTWARE CREATED TO OPERATE ON CGB: EXAMPLE When creating software for CGB, a CGB support code is set in the ROM data area, and processing branches according to the hardware used internally by the program. For more information, see the flowchart in Part 1 of Section 6.3 of this chapter.
Chapter 5: Miscellaneous General Information 6.2 CGB Recognition Method Immediately after program startup, the initial value of the accumulator (register A) is read to determine whether the hardware on which the program is operating is a DMG (SGB), MGB/MGL (SGB2), or CGB. 01h →...
Game Boy Programming Manual 6.3 Flowcharts 1) Branched Processing for CGB and DMG/MGB/MGL CGB support code (0x80) written to ROM data area (address 0x143) Start Supplemental processing for CGB support 0x11 CGB Unit Discrimination: Value of register A is read...
Page 135
Chapter 5: Miscellaneous General Information 2) Uniform processing for CGB and DMG/MGB/MGL CGB support code (80h) written to ROM data area (address 143h) Supplemental processing for Start CGB support Initialization Color Palette Transfer (rewrite) OAM Transfer BG Attribute Transfer (LCD Display RAM Bank 1) BG CHR Code Transfer (LCD Display RAM Bank 0) LCDC ON...
Page 136
Game Boy Programming Manual THIS PAGE WAS INTENTIONALLY LEFT BLANK.
Chapter 6: The Super Game Boy System CHAPTER 6: THE SUPER GAME BOY SYSTEM.........138 1. OVERVIEW ..................138 1.1 What is Super Game Boy?..............138 1.2 Block Diagram ..................139 1.3 Functions ....................139 1.4 System Program ..................140 2. SENDING COMMANDS AND DATA TO SUPER NES ....141 2.1 System Commands ................
1. OVERVIEW 1.1 What is Super Game Boy? SGB is a device that enables Game Boy software to be enjoyed on a TV screen. Game Boy software can be plugged into the SGB, which operates on the Super Nintendo Entertainment System (Super NES).
Chapter 6: The Super Game Boy System 1.2 Block Diagram 6-Pin Subconnector (SGB2 only) SYS CLK VISUAL DATA Address KEY DATA System Program Address Data SGBRA Register file Data SGB-CPU SOUND L, R W-RAM V-RAM 64Kbit 64Kbit 32P Card Connector...
Game Boy Programming Manual Sound Functions The rich variety of sound effects included in the system program can be generated by the Super NES audio processing unit (APU). The sound generator included in the system program can be used by transferring music data.
Chapter 6: The Super Game Boy System 2. SENDING COMMANDS AND DATA TO SUPER NES The following 2 methods can be used to send data from a DMG program to Super NES. Send data to the register file using P14 and P15. The size of the register file is 128 bits; this is referred to as 1 packet.
Page 142
Game Boy Programming Manual Write 1 P14 is fixed at HIGH, and a LOW pulse is output to P15. 2) Pulse Width or P15 Pulse Width 5 µ s (min) a, c, e or P14 15 µ s (min) b, d 3) Write Example …...
Page 143
Chapter 6: The Super Game Boy System d7 d6 d5 d4 d3 d2 d1 d0 Transmitted Data 0 transmitted in bit 129 If 2 or more packets are used for one system command, bits 00h-Fh of the second packet onward are used for data.
Game Boy Programming Manual 6. Transmission of 0 in bit 129 Bit 129: 0 5) Transmission Interval The interval between completion of transmission of one packet (128 bits + 1 bit) and transmission of the next packet is set at approximately 60 msec (4 frames).
Game Boy Programming Manual 3.2 System Command Details Please refer to the following map in the discussion of coordinate settings and color palette area specifications in the description of the system command functions. 160 dots [20 Characters] 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11...
Page 147
Chapter 6: The Super Game Boy System Setting the Color Palettes and Attributes DMG Window SGB Color Palette SGB Color Palette0 SGB Color Palette1 Indirect setting of attributes by file number SGB Color Palette2 (Command ATTR-SET) Direct setting of attributes...
Page 148
Game Boy Programming Manual DMG Color Palettes and SGB Color Palettes With DMG screen data representations, colors in SGB are converted from the grayscale data registered in the DMG color palettes, rather than being converted from the bit data for the character.
Page 149
Chapter 6: The Super Game Boy System When representing DMG grayscale on SGB, the image can be faithfully represented if 00 of the SGB palette is set to a light color and 11 to a dark color. Command: PAL01 (Code: 00h) Function: Sets the color data of SGB color palettes 0 and 1.
Page 150
Game Boy Programming Manual Palette2 Color00 Data LOW 8bit Palette2 Color00 Data HIGH 7bit Palette2 Color01 Data LOW 8bit Palette2 Color01 Data HIGH 7bit Palette2 Color10 Data LOW 8bit Palette2 Color10 Data HIGH 7bit Palette2 Color11 Data LOW 8bit Palette2 Color11 Data HIGH 7bit...
Page 151
Chapter 6: The Super Game Boy System Palette3 Color01 Data LOW 8bit Palette3 Color01 Data HIGH 7bit Palette3 Color10 Data LOW 8bit Palette3 Color10 Data HIGH 7bit 0Eh -- Palette3 Color11 Data LOW 8bit Palette3 Color11 Data HIGH 7bit 0Fh 0 Command: PAL12 Code: 03h Function: Sets the color data for SGB color palettes 1 and 2.
Page 152
Game Boy Programming Manual Command Code: ATTR_BLK (Code: 04h) Function: Applies the specified color palette attributes to areas inside and outside the square. Number of packets: 1h – 7h Command code: 04h Number of data groups: 1h- 12h (max) (A single group consists of a control code, color palette specification, and coordinates.)
Page 153
Chapter 6: The Super Game Boy System Specifies the color palette Color palette number for the area inside the square. Color palette number for character area on the square Color palette number for area outside the square. Starting point H1 Starting (upper left) and ending (lower right) points of the square.
Page 154
Game Boy Programming Manual When the number of packets exceeds 1: Control Code ↑Remainder of previous/first packet Color palette specification ↓ Second packet Starting point H3 Starting point V3 Coordinate data Ending point h3 Ending point v3 Control code Color palette specification...
Page 155
Chapter 6: The Super Game Boy System Note: When there is no area inside the square border (e.g., h1 = H1 + 1), a control code such as one that sets the color attribute for the area inside the border cannot be used.
Page 156
Game Boy Programming Manual data item Character Line Character Line data item Character Line data item data item Character Line Packet Character Line Character Line Character Line * See the note on ATTR_BLK.
Page 157
Chapter 6: The Super Game Boy System Example: Number of packets transmitted: 1 Command code: 05h Number of data groups: 2 Character line number: 0Fh Palette number: 1 Coordinate setting: V Character line number: 02h Palette number: 0 Coordinate setting: H Applies the Palette 0 attribute to this line.
Page 158
Game Boy Programming Manual Command: ATTR_DIV (Code: 06h) Function: Divides the color palette attributes of the screen by the specified coordinates. Number of packets: 1h Command code: 06h Number of the color palette of the bottom or right division. Number of the color palette of the top or left division.
Page 159
Chapter 6: The Super Game Boy System Palette: 3 Palette: 1 Palette: 2 Coordinate setting: H Character line number: 06h Sets this character line to the Palette 2 attribute. ↓ →H ↓ Palette 1 Palette 3 Command: ATTRIBUTE_CHR (Code: 07h) Function: Specifies a color palette for each character.
Page 160
Game Boy Programming Manual V coordinate of start of write Number of data items to send Each data item (2 bits) specifies a color palette. Most significant bit of number of data items sent, specified in 03h (The maximum number of data items required is 360.) Write horizontally: 0;...
Page 161
Chapter 6: The Super Game Boy System Packet Pal . No. Pal . No. Pal . No. Pal . No. Data items nos. 357, 358, 359, and 360. Pal . No. Pal . No. Pal . No. Pal . No.
Page 162
The beginning of the data for transfer contains a 16-bit representation of the number of data items and the transfer destination address, and the end contains an ending code and the starting address of the program. For more information, see Chapter 7: Super Game Boy Sound. APU RAM program area: 0400h – 2AFFh/9.75 Kbytes APU RAM music data area: 2B00h –...
Page 163
Chapter 6: The Super Game Boy System Command: PAL_SET (Code: 0Ah) Function: Applies system color palettes to SGB color palettes. 0 1 0 Number of packets: 1h (fixed) Command code: 0Ah Number of the system color palette to apply to SGB color...
Page 164
Game Boy Programming Manual HIGH Specifies the attribute file (ATF) number (00h – 2Ch) 0: No change 1: Cancels masking after the data is set. 0: Not specified. 1: The specified attribute file number. * 0Ah - 0Fh should be filled with 00h.
Page 165
Chapter 6: The Super Game Boy System Byte 1 System Color Palette 000 bit 00 color System Color Palette 000 bit 00 color code HIGH System Color Palette 000 bit 01 color code HIGH System Color Palette 000 bit 01 color code...
Page 166
Game Boy Programming Manual Mario 7 min. (5 min.) Cork 3 min. (5 min.) Landscape 1 min. (1 min.) Cinema 3 mins. Cats 3 mins. Pencils 3 mins. (5 mins.) Escher art 7 mins. (5 mins.) Command: ICON_EN (Code: 0Eh) Function: Enables and disables the icon function.
Page 167
Chapter 6: The Super Game Boy System Command: DATA_SND (Code: 0Fh) Function: Transfers data to Super NES W-RAM using the register file. Number of packets: 1h (fixed) Command code: 0Fh Transfer destination address (LOW) Transfer destination address (HIGH) Bank number...
Page 168
Game Boy Programming Manual * Free Addresses Bank 00h 1800h - 1FFFh Data Bank 7Eh B000h – BFFFh Bank 7Fh 0000h – FFFFh Command: DATA_TRN (Code: 10h) (Data Transfer using VRAM) Function: Transfers data in SGB RAM to Super NES W-RAM.
Page 169
Chapter 6: The Super Game Boy System * Free Addresses Bank 00h 1800h – 1FFFh Bank 7Eh B000h – BFFFh Bank 7Fh 0000h – FFFFh Note: When an Super NES program is tranferred to W-RAM and executed, 00h should be written to 1700h of bank 00. This can be written either by using DATA_SND or DATA_TRN or by using the transferred program.
Page 170
Game Boy Programming Manual Command: JUMP (Code: 12h) Function: Sets the Super NES program counter to the specified address. Number of packets: 1h (fixed) Command code: 12h Address (LOW) Address (HIGH) Bank number New NMI vector address (LOW) New NMI vector address (HIGH)
Page 171
Chapter 6: The Super Game Boy System Note: If all addresses from 04h to 06h are set to 0, the NMI jumps to the original vector. NMI is disabled in the system program, so it must be enabled to be used.
Page 172
Game Boy Programming Manual Number of packets: 1h (fixed) Command code: 14h * The 4 Kbytes of SGB RAM immediately following this command are handled as screen data and transferred to Super NES VRAM. START DMG Window (Number of characters: 1,024) Picture Frame There should be 1,024 uncompressed characters of screen data.
Page 173
Chapter 6: The Super Game Boy System * The 4 Kbytes of SGB RAM immediately following this command are transferred to W-RAM as attribute files. (The capacity of each attribute file is 2 x 20 x 18/8 = 90 bytes. Thus, 45 attribute files occupy 4,050 bytes, ATF0h-ATF44h.
Page 174
Game Boy Programming Manual Command: MASK_EN (Code: 17h) Function: Masks the DMG window. Number of packets: 1h (fixed) Command code: 17h -- -- 00: Cancels masking 01: Freezes the screen immediately before masking. (No transfers to Super NES VRAM are performed from after the command is issued until masking is canceled.)
Chapter 6: The Super Game Boy System Number of packets: 1h (fixed) Command code: 19h 0: Priority to the player-selected color palette 1: Priority to the application color palette * Default is 0. Priority to Player-Selected Color Palette When a screen that uses a player-selected color palette is displayed, any color or attribute settings commands that were sent have no effect on the DMG window.
Game Boy Programming Manual 3.4 Sound Flag Summary Pre-loaded sound effects A and B can be played simultaneously using system commands. The A sound effects are formants, primarily action sounds, and the B sound effects are looping sounds, primarily ambient sounds.
Page 177
Chapter 6: The Super Game Boy System 3.4.1 Sound Effect A Flags SOUND Command d7-d0 [bit] 03j d1-d0 [bit] Recommended Code Flag Meaning Voices Used Interval Value Dummy flag for retriggering • • 6 • 7 Sound effect A stop (mute) •...
Page 178
Game Boy Programming Manual SOUND Command d7-d0 [bit] 03h d1-d0 [bit] Recommended Code Flag Meaning Voices Used Interval Value Jump d1 = 1 • d0 = 1 • • • 7 Fast jump d1 = 1 • d0 = 1 •...
Page 179
Chapter 6: The Super Game Boy System 3.4.2 Sound Effect B Flags SOUND Command d7-d0 [bit] 03h d5-d4 [bit] Recommended Code Flag Meaning Voices Used Interval Value Dummy flag for retriggering 0 • 1 • 4 • 5 Sound Effects B stop (mute) 0 •...
Page 180
Game Boy Programming Manual SOUND Command d7-d0 [bit] 03h d5-d4 [bit] Recommended Code Flag Meaning Voices Used Interval Value Fire d5 = 1 • d4 = 0 • • • 5 Camera shutter (formant) d5 = 0 • d4 = 0 0 •...
Chapter 6: The Super Game Boy System 3.4.3 Attributes of A and B Sound Effects SOUND Command Interval (short) Interval (med-short) Interval (med-long) Sound Interval (long) Effects Volume (high) Volume (med) Volume (low) Interval (short) Interval (med-short) Interval (med-long) Sound...
4.2 Recognizing SGB 4.2.1 Distinguishing between Game Boy types (DMG, MGB/MGL, SGB, and SGB2) The program uses the following methods to determine which of the 4 types is operating. Checks the initial value of the internal accumulator of the CPU. (distinguishes between previous/new versions of CPU).
Page 183
Accumulator Multiplayer Mode No switch Switch No switch MGB/MGL Switch SGB2 4.2.2 Usage Example: Distinguishing Between the 4 Game Boy Types START Distinguish Between the 4 GB Types (See 4.2.1) SGB2 MGB/MGL DMG Communication Mode O DMG Communication Mode O...
Game Boy Programming Manual 4.3 SGB Register Summary The following registers can be used to perform functions such as resetting the SGB CPU from a program transferred to Super NES W-RAM and receiving and passing data to a DMG program.
Chapter 6: The Super Game Boy System 4.4 Flowchart of Initial Settings Routine Start Reset Processing ;Wait for completion of initial SGB settings Wait about 1 sec. Operating on DMG or MGB/MGL Distinguish Between GB Types Operating on SGB or SGB2...
Game Boy Programming Manual 5. PROGRAMMING CAUTIONS 5.1 ROM Registration Data To use SGB functions (system commands), the following values must be stored at the ROM addresses indicated. 146h 14Bh 5.2 Initial Data When writing programs that use the system commands of SGB and SGB2, use the initialization routine of the game program to send the following 8 packets of default data to the register file.
Page 187
Chapter 7: Super Game Boy Sound CHAPTER 7: SUPER GAME BOY SOUND..........188 1. SGB SOUND PROGRAM OVERVIEW........188 2. MEMORY MAPPING (SUPER NES APU)........189 3. CREATING AND TRANSFERRING SCORE DATA....190 3.1 Transferring Score Data ................ 190 3.2 Summary of BGM Flags ................ 190 3.3 Overview of Creating Score Data ............
Using the SGB system commands, pre-loaded sound effects in the sound program can be used in Game Boy application programs that support SGB (SGB software). These commands can be used to set each of the 73 types of pre-loaded sound effects to 4 intervals (playback frequencies) and 3 volume levels.
Game Boy Programming Manual 3. CREATING AND TRANSFERRING SCORE DATA 3.1 Transferring Score Data BGM can be played with the APU by using the SOU_TRN command to transfer original score data to the prescribed area of APU RAM. The user area is the 8 Kbytes from 2B00h to 4AFFh.
Chapter 7: Super Game Boy Sound 3.3 Overview of Creating Score Data Original BGM can be played with the SGB sound program by transferring score data to the APU using system commands. Fifty-seven sounds can be used in BGM, and the score data can be up to just under 8 Kbytes in size.
Page 192
Game Boy Programming Manual % tar xvf /dev/rfh0a sgbt.asm sample.kan check.kan kankichib.hex kan.equ * The organization and address settings in kankichib.hex are as shown below. * Use the installed kankichib.hex file when starting up mapu. Item Setting Kan.equ 4c30h Kan.tan...
Chapter 7: Super Game Boy Sound Cautions When Using Kankichi-kun 1. Copy sample.kan to a newly created score data file, [score_name].kan. % cp sample.kan xxx.kan * This avoids the task of creating a source list in source-list order when using mapu.
Page 194
Game Boy Programming Manual 3. Set Velocity Table data to 025 · 050 · 076 · 101 · 114 · 127 · 140 · 152 · 165 · 178 · 191 · 203 · 216· 229 · 242 · 252.
Chapter 7: Super Game Boy Sound 3.6 Score Data Format When Using Original Tools The score data format has been made openly available for the benefit of those using original development tools. Data that is not in this format will not operate on SGB.
Page 196
Game Boy Programming Manual Overall Format of Score Data Example 1: (Area inside frame = Data table for 1 tune) org 02b00h ; (a) Starting address of score data gft: ; (b) Tune table dw bgm1,bgm2, ··· ; Indicate the tune labels bgm1: ;...
Page 197
Chapter 7: Super Game Boy Sound bgm1_block3_0: Block03 (h) Part 0 performance data db sno,$1a,pv1,200,pan,012,tun,050 db • • • • • • • • • • • • • • • • • • db 00 • Description of Example 1 (a) The score data map to memory addresses 2B00h-4AFFh in the APU.
Page 198
Game Boy Programming Manual The lower parts and blocks are set in the same manner. Code Summaries a) Length Data (step time) This is the length (step time) to the subsequent sound; it corresponds to the length of the sound envelope.
Page 200
Game Boy Programming Manual c) Interval Data Intervals for 6 octaves can be set here. Depending on the sound, however, high sounds may not be heard. The following table shows the correspondence between code settings and intervals. Please refer to this table when setting an interval.
Page 201
Chapter 7: Super Game Boy Sound Octave 4 Octave 5 Misc. Interval Code Interval Code Rest KYU Τ Note 1: A value of 1 in the right-most position of the interval symbol indicates a Ι Τ is represented as the of one interval lower.
Page 202
Game Boy Programming Manual d) Special Symbols The special symbols represent special data for implementing a variety of special effects. These include sound change, crescendo, panpot change, vibrato, tremolo, and echo. Each symbol has its own parameters. The following table lists these special symbols, their parameters, and the valid values for these parameters.
Page 203
Chapter 7: Super Game Boy Sound Special Symbols Summary No. 2 Symbol First Argument Second Argument Third Argument Function Code (range) (range) (range) No. of hold steps Rate Depth Tremelo (no. of hold steps is the ≤ ≤ ≤ ≤...
Page 204
Game Boy Programming Manual Symbol First Argument Second Argument Third Argument Function Code (range) (range) (range) No. of steps ECHO-VOL(L) ECHO-VOL(R) Move echo volume ≤ ≤ ≤ ≤ ($F8) 1≤X≤255 (YZ values take effect after X steps) No. of hold steps No.
Chapter 7: Super Game Boy Sound *When using a symbol to set a special symbol for score data, assemble after defining the equals statement according to the Special Symbols table. *The special symbols and the arguments that follow should be set in the order shown in the tables.
Game Boy Programming Manual Score Data Settings Special Echo Channel Echo Volume L Echo Volume R Symbol ΟΟΟ (Note 1) Special Echo Time Feed Back Filter No. Symbol 2 (Note 2) Note 1: If echo is not used, specify eof (special symbol) instead of ecv.
Page 207
Chapter 7: Super Game Boy Sound Line No. Before Changed After Changed gft : 02b00h gft : yyy$, · · · · · · · · ; include xxx.dat include yyy.dat · · · · · · · · · · ·...
Page 208
Game Boy Programming Manual If the data exceed 4 Kbytes, divide them into 2 files. Transfer of score data is completely executed using system commands.
Chapter 7: Super Game Boy Sound 4. SGB SOUND PROGRAM SOURCE LIST Envelope Type Recommended Kankichi-kun so No. so Name Sound Family Interval so No. /Specific Sound Tuning 000h +d0.so Normal envelope 001h +Dch.so Envelope with extremely short decay 002h +d1.so...
Page 210
Game Boy Programming Manual Envelope Type/ Recommended Kankichi-kun so No. so Name Sound Family Interval so No. Specific Sound Tuning +d1.so Electric keyboard envelope Electric 019h +d3.so Pedal organ envelope Keyboard Family 2 01ah epf.so Electric keyboard, soft type 01bh pipe.so...
Page 211
Chapter 7: Super Game Boy Sound Envelope Type Recommended Kankichi-kun so No. so Name Sound Family Interval so No. Specific Sounds Tuning 031h Db.so Bass drum 032h +Dch.so Percussion Closed high-hat Instrument 033h Doh.so Family Open high-hat 034h sdr3.so Snare 1 035h Ds.so...
Game Boy Programming Manual 5. TRANSFERRING AUDIO DATA TO THE SCORE AREA In general, the score area (8 K) is provided for transferring only score data. However, audio data also can be transferred for output. Audio data can be transferred only if the following conditions are met.
Chapter 7: Super Game Boy Sound 5.2 Transfer File Example With sampling data consisting of a single sound with a sound number of 002h, the Directory data would be the 4 bytes beginning at 4B08h, and the sod data would occupy the 6 bytes beginning at 4C3Ch.
Page 214
Game Boy Programming Manual THIS PAGE WAS INTENTIONALLY LEFT BLANK.
Page 215
Chapter 8: Game Boy Memory Controllers (MBC) CHAPTER 8: GAME BOY MEMORY CONTROLLERS (MBC) ..216 1. MBC1 ..................216 1.1 Overview ....................216 1.2 Description of Registers ..............216 1.3 Memory Map ..................218 2. MBC2 ..................219 2.1 Overview ....................219 2.2 Description of Registers ..............219 2.3 Memory Map ..................219...
Game Boy Programming Manual CHAPTER 8: GAME BOY MEMORY CONTROLLERS (MBC) 1. MBC1 1.1 Overview MBC1 is a memory controller that enables the use of 512 Kbits (64 Kbytes) or more of ROM and 256 Kbits (32 Kbytes) of RAM. It can be used as follows.
Page 217
Chapter 8: Game Boy Memory Controllers (MBC) ! Register 3: ROM/RAM change Write addresses: 6000h-7FFFh Write Data: 0-1 Writing 0 causes the register 2 output to control switching of the higher ROM bank. Writing 1 causes the register 2 output to control switching of the RAM bank.
Game Boy Programming Manual 1.3 Memory Map ! When Used to Control up to 4 Mbits of ROM RAM Address CPU Address ROM Address 7FFFFH 7FFFh DFFFH Internal Bank 3 Bank 1Fh Working 6000h Bank 2 Bank 1Eh C000H External...
Chapter 8: Game Boy Memory Controllers (MBC) 2. MBC2 2.1 Overview Controller for up to 2 Mbits (256 Kbytes) of ROM with built-in backup RAM (512 x 4 bits). 2.2 Description of Registers ! Register 0: RAMCS gate data (serves as write-protection for RAM) Write addresses: 000h-0FFFh Write data: 0Ah Writing 0Ah to 000-0FFFh causes the CS to be output, allowing access to RAM.
Game Boy Programming Manual 3. MBC3 3.1 Overview MBC3 is the memory bank controller that allows use of between 512 Kbits (64 Kbytes) and 16 Mbits (2 MB) of ROM and 256 Kbits (32 Kbytes) of RAM. Built into the controller are clock counters that operate by means of an external crystal oscillator (32.768 KHz).
Chapter 8: Game Boy Memory Controllers (MBC) Write addresses: 6000h-7FFFh Write Data: 0 → 1 Writing 0 → 1 causes all counter data to be latched. The latched contents are retained until 0 → 1 is written again. 3.3 Accessing the Clock Counters The clock counter registers are assigned to the external expansion RAM area of the CPU address space.
Game Boy Programming Manual ! One bank from among RAM banks 0-3 and the clock counter registers (RAM banks 08h-0Ch) can be assigned to the external expansion working RAM area (A000h-BFFFh) of the CPU memory space. ROM Address CPU Address...
Page 223
Although control registers 0-3 are initialized (see Section 3.2, Description of Registers) when Game Boy power is turned on, they are not initialized by a hard reset of SNES when Super Game Boy is used. Therefore, please be sure to implement a software reset of these registers.
Game Boy Programming Manual 4. MBC5 4.1 Overview Supports CGB double-speed mode. MBC5 can use up to 64 Mbits of ROM (512 banks of 128 bits each) and 1 Mbit of RAM (16 banks of 64 Kbits each). Upwardly compatible with MBC1.
Chapter 8: Game Boy Memory Controllers (MBC) 4.4 Description of Registers ! Register for Specifying External Expansion Memory (RAMG) Specifies whether external expansion RAM is accessible. Access to this RAM is enabled by writing 0Ah to the RAMG register space, 0000h-1FFFh. Writing any other value to this register disables reading to and writing from RAM.
Game Boy Programming Manual 4.5 Programming Cautions 4.5.1 When Migrating from MBC1 to MBC5 ! Use of Register 1 If an MBC1 program uses register 1 (ROM bank control register) addresses 3000h- 3FFFh, the bank intended for selection by ROMB1 in MBC5 will not be selected.
Chapter 8: Game Boy Memory Controllers (MBC) 4.6 Examples of MBC5 programs on DMG and CGB ! Set the bank switching area (4000h-7FFFh) to 1FFh. LD A,$FF LD ($2000),A ;ROMB0 setting LD A,$01 LD ($3000),A ;ROMB1 setting ! Set the external expansion memory area (A000h-BFFFh) to 0Fh.
Game Boy Programming Manual 5. MBC5 (WITH RUMBLE FEATURE) 5.1 Overview This cartridge is the same as the previous MBC5 cartridge but also includes a rumble motor and size AAA battery to power the motor. The motor is controlled by the program using the MBC5 RAM bank register (RAMB, bit 3).
Chapter 8: Game Boy Memory Controllers (MBC) 5.3 Memory Map CPU Address FFFFh Unit Registers Bank 3 Highest bank, 0x1FF E000h Internal Maximum of 256 Bank 2 Working Kbits (Banks 0-3) Set by register RAMB Bank 1 C000h External Accessible only when...
Game Boy Programming Manual Upper ROM Bank Register (ROMB1) Specifies the higher-order 1 bit of a 9-bit ROM bank. The ROM bank can be changed by writing the desired ROM bank number to the ROMB1 register (any single address in 3000h-3FFFh).
Chapter 8: Game Boy Memory Controllers (MBC) 5.5.2 Vibration Pulse Examples RAMB Bit 3 Example 1: Strong Frames Startup Example 2: Pulse Slightly strong Frames Example 3: Startup Pulse Slightly weak Frames Startup Example 4: Pulse Strong Frames Example 5:...
Page 232
Game Boy Programming Manual 5.6.3 Specifying External Sound Input (VIN) Always use the sound control register (NR50) with bits 7 and 3 set to 0 (VIN function OFF). Because the VIN terminal is used in development flash ROM cartridges, using the register with VIN set to ON will produce sound abnormalities.
Chapter 8: Game Boy Memory Controllers (MBC) Therefore, rumble operation should be checked both when the battery is new (1.6 V) and when it is at the end of its life (1.1 V). 5.7 Physical Effects of Vibration on the Body Users have occasionally experienced numbness for some time after continuous vibration lasting several tens of seconds to several minutes.
Page 234
Game Boy Programming Manual THIS PAGE WAS INTENTIONALLY LEFT BLANK.
Page 235
Chapter 9: Pocket Printer CHAPTER 9: POCKET PRINTER ........... 237 1. OVERVIEW..................237 2. COMMUNICATION SPECIFICATION ..........237 2.1 Bidirectional Communication ............... 237 2.2 Transfer Interval for Each Byte............. 237 2.3 Packets and the Transfer Interval ............237 2.4 Synchronism Check when Connecting..........237 3.
Page 236
Game Boy Programming Manual 11. MISCELLANEOUS..............251 11.1 Cautions when Debugging ..............251 11.2 Sample Programs Provided by Nintendo (subroutines)....251...
2.3 Packets and the Transfer Interval Each type of data sent by the Game Boy is sent in a packet. An interval of 270 µs to 117 ms must be allowed between the transfer of each packet. Thus, care should be exercised regarding factors like interrupts when programming.
Data volume (2 bytes), number of bytes of data Data: Data in Game Boy character data format. Print instruction data. Checksum: 2 bytes of data representing the sum of the header + all data in the data portion of the packet.
Status information is sent in reply to each 2 bytes of dummy data sent by the Game Boy. * The status returned by the printer is FF FF when the printer is not connected to the Game Boy or not powered on.
Page 240
Game Boy Programming Manual When an error is generated, always sever communication with the printer and inform the user of the type of error. A value other than 81h for the first status byte means that a device other than the Pocket Printer is...
4.1 The Initialization and Connection Packet This packet is used to initialize the printer and check the connection. If the Game Boy sends a packet for checking the printer connection and a printer is connected, it returns a 2-byte status code and initializes for the start of print processing.
Game Boy Programming Manual Cautions Regarding Print Instructions (Caution Required) ! Although applications can print 2-255 pages continuously, this may take a long time. Thus, the user should be provided with a means of halting a print job in progress. (See Section 4.5, Break Packet.)
Chapter 9: Pocket Printer One Game Boy screen of data is represented by 9 data packets. However, a data-end packet can be sent even if the number of data packets sent is less than 9. In this case, the printer will print only the number of lines received.
Game Boy Programming Manual Actual Data Header Checksum Dummy This packet has no data section. 4.7 Packet Error Except in the case of a checksum error, if a packet of one of these types is sent but does not match the specification described, the printer will return a packet error.
Chapter 9: Pocket Printer 5. PRINTER STATUS AND PACKETS The following table shows the packets that can and cannot be sent from the Game Boy to the printer while the printer is in various states. Disconnected Immediately Print Buffer While...
Game Boy Programming Manual 6. PRINTER PRINT SEQUENCE The print sequence used in the Game Boy. Status evaluation Printer connected? Send init/connection packet Print instruction? Resend Packet if SumError Printer connected? Transferred data present? FULL bit=1 The printer is not connected...
FAILURE 7.1 Connection Evaluation (includes cable disconnection) To check whether a printer is connected to the Game Boy, it sends a NUL packet. If nothing is connected, the value 0xFF is received; if there is a connection, 0x00 is received.
Page 248
Game Boy Programming Manual Game Boy Printer Printer normal ↓ Printer status normal ↓ Wait to receive data ↓ Start communication ↓ Data reception ↓ Cable disconnects during data transfer ↓ Preamble detection failure ↓ Printer status = FFh ↓...
Chapter 9: Pocket Printer 8. PRINT DATA The print data transferred in data packets is in character data format. Printing Example Line1 Line2 Line3 Line4 Line5 Line6 Line7 Line8 Line9 X00 X01 X02 X03 X09 X0A X0B X0C Transfer Order Y0.X00 -->...
Game Boy Programming Manual 9. COMPRESSION ALGORITHM Compressed data essentially consist of control codes specifying the data type and length and the actual data. Control code 1 + raw data Control code 2 + loop data Control Code Control Code...
Hosiden are manufactured according to the special Pocket Printer Pikachu Yellow specification. However, depending on the needs of the manufacturers, there is no guarantee that this distinction will hold true in the future. If obtaining a printer proves difficult, please contact Nintendo for a special consultation.
Page 252
Game Boy Programming Manual THIS PAGE WAS INTENTIONALLY LEFT BLANK.
Page 253
5.3 Print Density (Recommended).............. 264 5.4 Operation After the Motor is Stopped (Required) ....... 264 5.5 Feeds (Required)..................264 5.6 Point of Caution During Debugging (Recommended) ......264 5.7 Sample Program Provided by Nintendo (Recommended) ....264 6. PROGRAMMING CAUTIONS FOR U.S. PROGRAMMERS ..265...
Purpose and Scope These programming notes provide information on how to avoid easily made mistakes during program development, information on unique Game Boy programming issues that require special attention, and special issues regarding peripheral devices. Items Covered in this Manual Many of the topics covered in this appendix also are covered elsewhere in different chapters of this manual.
Appendix 1: Programming Cautions 2. PROGRAMMING CAUTIONS REGARDING GAME BOY Covers: DMG: DMG, MGB, and MGL SGB: SGB and SGB2 CGB: CGB 2.1 LCDC/VRAM 2.1.1 Setting the LCDC to OFF (Recommended) Covers: DMG and CGB In early DMGs, a black horizontal line appears on the screen if the LCDC is stopped (LCDC register bit 7 ←...
Game Boy Programming Manual Reference Notes: 1. Accessing VRAM Outside of a V-blanking period In early DMGs, accessing VRAM outside of a V-blanking period would corrupt the screen. 2. Length of H-blanking The length of the H-blanking period changes depending on the conditions of OBJ use, so caution is recommended when using H-blanking.
Appendix 1: Programming Cautions When sound 3 is used, data should always first be specified for addresses FF30h-FF3Fh of waveform RAM. If the initial flag is set during sound 3 operation (sound 3 ON flag = 1), the contents of waveform RAM will be destroyed. 2.4 Miscellaneous Notes 2.4.1 Using Interrupts (Required) Covers: DMG, SGB, and CGB...
Page 258
Game Boy Programming Manual A,(HLD) (HLI),A (HLD),A 2.4.6 Using the HALT Instruction (Required) Covers: DMG, SGB, and CGB When using a HALT instruction, always add an NOP instruction immediately after the HALT instruction. Not adding the NOP instruction may in rare cases cause the instruction after the HALT instruction not to be executed.
Page 259
Appendix 1: Programming Cautions 2.4.12 Chattering (Recommended) Covers: DMG, SGB, and CGB To prevent buttons from inadvertently being pressed twice, an interval should be provided between key reads. (Although this varies with the software, keys are normally read approximately once per frame.)
Game Boy Programming Manual 3. PROGRAMMING CAUTIONS REGARDING MBCS 3.1 All MBCs 3.1.1 Protecting RAM Data (Recommended) To protect RAM data, access to RAM should be disabled (RAMG←00h) when it is not being accessed. 3.2 MBC3 3.2.1 Accessing the Clock Counters (Required) If the clock counters themselves are counted up, accessing of the clock counters by the CPU is performed asynchronously.
Although control registers 0-3 are initialized (see Section 3.2, Description of Registers) when the Game Boy power is turned on, they are not initialized by a hard reset of Super NES when Super Game Boy is used. Therefore, please be sure to implement a software reset of these registers.
Page 262
Game Boy Programming Manual 3.3.5 Limiting the Period of Continuous Vibration (Recommended) To prevent physical effects in the user such as numbness as a result of continuous vibration, limit the duration of continuous vibration as indicated below, regardless of the vibration strength.
Appendix 1: Programming Cautions 4. SGB PROGRAMMING CAUTIONS 4.1 ROM Data (Required) To use the functions of SGB (system commands), the following values must be stored in ROM at the locations indicated. 146h ← 03h, 14Bh ← 33h 4.2 Default Data (Required) When writing programs that use the functions of SGB, use the initialization routine of the game program to send default data (see Chapter 6) to the register file.
Hosiden). As part of final debugging, the program should be checked with at least one printer of each type. 5.7 Sample Program Provided by Nintendo (Recommended) Modifying the program to suit the intended use is permitted. However, in creating the original program, values for timing and other parameters were calculated to allow normal operation.
6. PROGRAMMING CAUTIONS FOR U.S. PROGRAMMERS If you are unable to verify that the system is a Super Game Boy, and the Accumulator returns the same value if the game is inserted in the Super Game Boy or original Game Boy hardware, follow the instructions below.
Page 266
Game Boy Programming Manual THIS PAGE WAS INTENTIONALLY LEFT BLANK.
Appendix 2. Register and Instruction Set Summaries APPENDIX 2: REGISTER AND INSTRUCTION SET SUMMARIES.. 268 1. CONTROL REGISTER SUMMARY............268 2. SOUND REGISTER SUMMARY............273 3. CPU INSTRUCTION SET SUMMARY........... 277...
Game Boy Programming Manual APPENDIX 2: REGISTER AND INSTRUCTION SET SUMMARIES 1. CONTROL REGISTER SUMMARY Register Address Comment FF00 Control of Port P15- transfer data by P14, FF01 Serial Transfer data transfer register FF02 Transfer Clock Shift start speed clock...
Page 269
Appendix 2. Register and Instruction Set Summaries Register Address Comment Reset with DI; Interrupt set with EI master 0: Disable enable interrupts 1: Enable interrupts LCDC FF40 Controller WIN Area Window BG Area 0: Stop 0: 9800- 0: OFF Characters 0: 9800- Block Display...
Page 270
Game Boy Programming Manual Register Address Comment FF47 Palette data for Palette data for Palette data for Palette data for character dot data character dot data character dot character dot data BG Palette 11 in DMG mode. 10 in DMG mode.
Page 271
Appendix 2. Register and Instruction Set Summaries Register Address Comment HDMA4 FF54 Lower-order 0Xh – FXh address of HDMA transfer destination 0 ≤ n ≤ 127 HDMA5 FF55 H-blank and selection Total number of transferred bytes: 16 x (n+1) H-blanking general- stopped by purpose DMA...
Page 272
Game Boy Programming Manual Register Address Comment SVBK FF70 Banks specification 0,1: Specifies bank 1 WRAM Bank 2-7: Specifies banks 2-7 specification OBJ0 00h – FFh LCD y- Top edge coordinate when Y= 10h 00h – FFh LCD x- Left edge...
Page 273
Appendix 2. Register and Instruction Set Summaries 2. SOUND REGISTER SUMMARY All values shown in the following table apply to normal mode. The values for double-speed mode should be calculated by doubling the system clock frequency. Register Address Comment NR10 FF10 Sweep time: 010:15.6ms...
10.1 Description of ROM Registration Data ..........296 11. STORING DATA TO THE FLOPPY DISK ........300 12. PRODUCTION SOFTWARE SELECTION .........301 13. DEVELOPMENT SOFTWARE SELECTION......302 14. GAME CONTENT GUIDELINES..........304 15. GAME BOY PRICE QUOTE REQUEST FORM......304...
APPENDIX 3: SOFTWARE SUBMISSION REQUIREMENTS 1. THE SOFTWARE SUBMISSION PROCESS All software submissions to Nintendo of America Inc. must be forwarded to the attention of NOA Product Testing Supervisor. Otherwise, the submission’s placement into the testing queue may be delayed. To help reduce a submission’s turn-around time, it is suggested that licensees assign a primary contact...
11. A Game Boy Color dedicated game must include a hardware check upon power-up, which will display the following message when it is connected to a device other than Game Boy Color. The official game title must also be displayed in the upper portion of the display screen.
1992 ABC Corporation LICENSED BY NINTENDO If a blank screen appears for more than two seconds when powered up, Nintendo suggests placing a message or graphic on the screen so that consumers do not think their game is inoperable (e.g., -- “Please Wait”--).
Page 289
23. Referring to the Nintendo Game Pak by an unacceptable term, such as; “Game Cassette”, etc. 24. Referring to the Game Boy Game Link by an unacceptable term, such as; “Video Link”, etc. Note: If Licensor approval is required, please assure that this has been finalized...
7. A NOTE ON OBJECTIONABLE MATERIAL A copy of the Nintendo “Game Content Guidelines” is included at the end of this document. If you are unsure of whether an item of text or element of a game is within Nintendo Software Standards, you may contact our Engineering Department early in the development process and they will discuss questionable items over the phone.
Page 291
12. Game Title Registration Enter the game title registered in the master ROM using ASCII characters and their ASCII codes. Also enter the Game Code assigned by Nintendo. Refer to “Character Code List for Game Title Registration” for these entries.
Page 292
Game Boy Programming Manual Example Version First Second Third Fourth Fifth Mask ROM Change after Version first production EEPROM Version Version on Title Label of EEPROM First Production Sixth Seventh Change after second production Second Production Third Production 16. File Name and Check Sums Print the file name on each disk using the following format: *** **-*.GB...
Page 293
(N64 GB Pak is a peripheral device that allows the N64 system to read data from and write to a standard Game Boy Game Pak. This device is not marketed in the U.S. For more information, please contact Nintendo Technical Support.) 17.
RAM Size Destination Code Mask ROM Version Complement Check Checksum Note: The following data will be stored in Game Boy Memory for all Game Boy software. 0100H = 00H 0101H = C3H 014BH = 33H 0104H~0133H = “Nintendo” character data...
10.1 Description of ROM Registration Data 1. Start Address (0102H, 0103H) The Game Boy (Super Game Boy) program starts after Initial Program Load (IPL) is run on the CPU. The low byte of the starting address is stored first, then the high byte.
Page 297
Super Game Boy Function Game Boy (will also run on Super Game Boy) Uses Super Game Boy Functions Note: In order to use Super Game Boy functions, the following data must be registered. 0146H = 03H and 014BH = 33H...
Page 298
Game Boy Programming Manual 8. Software Type (0147H) Store the appropriate code for the type of software (Game Pak parts configuration) being used. Parts Configuration Address MBC-3 MBC5 Backup 0147H Battery ROM MBC-1 MBC-2 SRAM Rumble Rumble...
Page 299
Appendix 3: Software Submission Requirements 9. ROM Size (0148H) Store the code for the program ROM size from the table below. 0148H ROM Size 256 KBit 512 KBit 1 MBit 2 MBit 4 MBit 8 MBit 16 MBit 32 Mbit 64 Mbit 10.
2. The data must be submitted in binary (ROM) format. Do not compress the data. The maximum amount of data stored on each floppy should be 8Mbit. 3. The file name should be formatted as described in item #16 of "Instructions for Game Boy Software Specification Sheet - File Name and Check Sums.”...
( ) : At the present time, a mask ROM cannot be prepared. If necessary, please contact NOA Licensing Dept. at (425)861-2091. [Notes] MBC-1, 2, and 3 do not support Game Boy Color double-speed mode (including H-DMA and General Purpose DMA. Please refer to your Programming Manual.
Game Boy Programming Manual 13. DEVELOPMENT SOFTWARE SELECTION 256K 512K Comments ROM SIZE SRAM SIZE None None None • Built-in 64K SRAM MBC-1 With or without backup battery 64K/None • Built-in 256K SRAM 256K/64K/None With or without backup battery None MBC-2 •...
Page 303
Emulator [Notes] MBC-1, 2, and 3 do not support Game Boy Color double-speed mode (including H-DMA and General Purpose DMA. Please refer to your Programming Manual. There are some restrictions in memory mapping when MBC-1 ROM size is 1M or larger. Please refer to "Memory Controllers" in your Programming Manual.
Nintendo’s corporate philosophy. Exceptions may be made when an objectional item is necessary to maintain the integrity of the product or the games’ theme. Nintendo will only approve products (i.e., audio-visual work, packaging and instruction manuals) which do not: •...
Need help?
Do you have a question about the GAME BOY and is the answer not in the manual?
Questions and answers