Manual
Page 1
THIS DOCUMENT IS PRINTED ON DIN A5 SIZE PAPER (148mm x 210mm)! Version: 1.01 by DP Note: Game BoyTM, Game Boy PocketTM, Super Game BoyTM and Game Boy ColorTM are registered trademarks of Anthrox, GABY, Marat Fayzullin, Pascal Felber, Paul Robson, Martin Korth, kOOPa, Bowser Contents: Assembly Language Commands, Timings and Opcodes, and everything you always wanted to know about GB but were afraid to 1999 by Nintendo CO., LTD. Game BoyTM CPU Manual Sources by: Pan of Nintendo CO., LTD. © 1989 to ask.
THIS DOCUMENT IS PRINTED ON DIN A5 SIZE PAPER (148mm x 210mm)! Version: 1.01 by DP Note: Game BoyTM, Game Boy PocketTM, Super Game BoyTM and Game Boy ColorTM are registered trademarks of Anthrox, GABY, Marat Fayzullin, Pascal Felber, Paul Robson, Martin Korth, kOOPa, Bowser Contents: Assembly Language Commands, Timings and Opcodes, and everything you always wanted to know about GB but were afraid to 1999 by Nintendo CO., LTD. Game BoyTM CPU Manual Sources by: Pan of Nintendo CO., LTD. © 1989 to ask.
Manual
Page 2
... 2.5.1. Reserved Memory Locations 10 2.6. Stop Mode 19 2.7.3. Interrupt Descriptions 34 2.13. Special Registers 35 2.13.1. Hardware specifications 5 2.1. Game Boy Specs 6 2.4. User I /O 31 2.12. Video 22 2.8.1. Tiles 22 2.8.2. Timer 30 2.11. 1. Echo of Contents 1. ...Forward 5 2.2. Terms 5 2.3. Special modi 17 2.7.1. Sprite RAM Bug 27 2.9. Interrupt Procedure 32 2.12.2. Foreword Game BoyTM CPU Manual Table of 8kB Internal RAM 9 2.5.3. Serial I /O 9 2.5.4. General memory map 8 2.5.2. Sprites 25 2.8.3. Foreword 4 2. I/O Registers 35 Page...
... 2.5.1. Reserved Memory Locations 10 2.6. Stop Mode 19 2.7.3. Interrupt Descriptions 34 2.13. Special Registers 35 2.13.1. Hardware specifications 5 2.1. Game Boy Specs 6 2.4. User I /O 31 2.12. Video 22 2.8.1. Tiles 22 2.8.2. Timer 30 2.11. 1. Echo of Contents 1. ...Forward 5 2.2. Terms 5 2.3. Special modi 17 2.7.1. Sprite RAM Bug 27 2.9. Interrupt Procedure 32 2.12.2. Foreword Game BoyTM CPU Manual Table of 8kB Internal RAM 9 2.5.3. Serial I /O 9 2.5.4. General memory map 8 2.5.2. Sprites 25 2.8.3. Foreword 4 2. I/O Registers 35 Page...
Manual
Page 3
Game BoyTM CPU Manual 1. Game Boy command overview 61 3.1. Foreword 61 3.2. Commands 65 3.3.1. 8-Bit Loads 65 3.3.2. 16-Bit Loads 76 3.3.3. 8-Bit ALU 80 3.3.4. 16-Bit Arithmetic 90 3.3.5. Miscellaneous 94 3.3.6. Restarts 116 3.3.... 5.2. Generally 61 3.2.2. Stack Pointer 63 3.3. Rotates & Shifts 99 3.3.7. SGB Border 120 4.4. Commands 122 5. Returns 117 4. Flag Register 62 3.2.3. Foreword 3. Program Counter 63 3.2.4. Jumps 111 3.3.9. Super Game Boy commands 119 4.1. Appendix A 134 5.1. Bit Opcodes 108 3.3.8. Palettes 119 4.3.
Game BoyTM CPU Manual 1. Game Boy command overview 61 3.1. Foreword 61 3.2. Commands 65 3.3.1. 8-Bit Loads 65 3.3.2. 16-Bit Loads 76 3.3.3. 8-Bit ALU 80 3.3.4. 16-Bit Arithmetic 90 3.3.5. Miscellaneous 94 3.3.6. Restarts 116 3.3.... 5.2. Generally 61 3.2.2. Stack Pointer 63 3.3. Rotates & Shifts 99 3.3.7. SGB Border 120 4.4. Commands 122 5. Returns 117 4. Flag Register 62 3.2.3. Foreword 3. Program Counter 63 3.2.4. Jumps 111 3.3.9. Super Game Boy commands 119 4.1. Appendix A 134 5.1. Bit Opcodes 108 3.3.8. Palettes 119 4.3.
Manual
Page 4
... summary of a typical read and write operation on a real Game Boy can be found here (thanks to be found in paragraph 2. Foreword This Document was ment ...to Philippe Pouliquen). Foreword Game BoyTM CPU Manual 1. The documents consists of Anthrox, Marat Fayzullin, Pascal ...diagram of specifications and commands for Nintendo Super Game Boy speciffic programming by kOOPa and Bowser. 1. It was designed to kOOPa). The first is a mixture of several documents from 'Game Boy Assembly Language Primer (GALP) ...
... summary of a typical read and write operation on a real Game Boy can be found here (thanks to be found in paragraph 2. Foreword This Document was ment ...to Philippe Pouliquen). Foreword Game BoyTM CPU Manual 1. The documents consists of Anthrox, Marat Fayzullin, Pascal ...diagram of specifications and commands for Nintendo Super Game Boy speciffic programming by kOOPa and Bowser. 1. It was designed to kOOPa). The first is a mixture of several documents from 'Game Boy Assembly Language Primer (GALP) ...
Manual
Page 5
Hardware specifications 2.1. Any reference to inform a user on the hand-held game machine known as Game Boy, manufactured and designed by Nintendo Co., LTD. Hardware specifications 2. This info is presented to copyrighted material is copyrighted by DP Page 5 Game BoyTM CPU Manual 2. GameBoy is not presented for monetary gain, but for informational purposes regarding the inner...
Hardware specifications 2.1. Any reference to inform a user on the hand-held game machine known as Game Boy, manufactured and designed by Nintendo Co., LTD. Hardware specifications 2. This info is presented to copyrighted material is copyrighted by DP Page 5 Game BoyTM CPU Manual 2. GameBoy is not presented for monetary gain, but for informational purposes regarding the inner...
Manual
Page 6
...; CPU: 8-bit (Similar to an Intel 8080. Here is more similar to the Z80, some instructions Page 6 V 1.01 Game Boy Specs Game BoyTM CPU Manual 2.3. In many ways the processor is the translation: 1 machine cycle = 4 clock cycles Machine Cycles Clock Cycles GB CPU Speed 1....59.73 Hz (61.17 Hz for SGB) • Sound: 4 channels with stereo sound • Power: DC6V 0.7W (DC3V 0.7W for GB Pocket) Nintendo documents describe the CPU & instructions speed in machine cycles while this document describes them in clock cycles. 2.3. Processor The GameBoy uses a computer chip similar to...
...; CPU: 8-bit (Similar to an Intel 8080. Here is more similar to the Z80, some instructions Page 6 V 1.01 Game Boy Specs Game BoyTM CPU Manual 2.3. In many ways the processor is the translation: 1 machine cycle = 4 clock cycles Machine Cycles Clock Cycles GB CPU Speed 1....59.73 Hz (61.17 Hz for SGB) • Sound: 4 channels with stereo sound • Power: DC6V 0.7W (DC3V 0.7W for GB Pocket) Nintendo documents describe the CPU & instructions speed in machine cycles while this document describes them in clock cycles. 2.3. Processor The GameBoy uses a computer chip similar to...
Manual
Page 21
... first HALT causes the second HALT to be repeated, which therefore causes the following command (=itself) to be repeated - game operation jr Main by DP Page 21 Clear V-Blank flag call call Controls Game ; Placing a NOP between the two halts would cause the NOP to be repeated once, the second HALT wouldn... 34 12 ld a,(34FA) ld (de),a 3) Finally an interesting side effect 76 halt 76 halt This combination hangs the cpu. Below is suggested code for Game Boy programs: ; **** Main Game Loop **** Main: halt ;
... first HALT causes the second HALT to be repeated, which therefore causes the following command (=itself) to be repeated - game operation jr Main by DP Page 21 Clear V-Blank flag call call Controls Game ; Placing a NOP between the two halts would cause the NOP to be repeated once, the second HALT wouldn... 34 12 ld a,(34FA) ld (de),a 3) Finally an interesting side effect 76 halt 76 halt This combination hangs the cpu. Below is suggested code for Game Boy programs: ; **** Main Game Loop **** Main: halt ;
Manual
Page 61
... two 16bit registers SP & PC: 15..8 7..0 A F B C D E H L SP PC Some instructions, however, allow you to use the registers A,B,C,D,E,H, & L as 16-bit registers by DP Page 61 Game Boy command overview 3.1. The F register is indirectly accessible by the by pairing them up in the following manner: AF,BC,DE, & HL...
... two 16bit registers SP & PC: 15..8 7..0 A F B C D E H L SP PC Some instructions, however, allow you to use the registers A,B,C,D,E,H, & L as 16-bit registers by DP Page 61 Game Boy command overview 3.1. The F register is indirectly accessible by the by pairing them up in the following manner: AF,BC,DE, & HL...
Manual
Page 62
...set if a carry occurred from the last math operation or if register A is the smaller value when executing the CP instruction. Page 62 V 1.01 The SP, or Stack Pointer, register points to store the results of a math operation is zero or two values match when using the CP ...subtraction was performed in the last math instruction. • Half Carry Flag (H): This bit is set if a carry occurred from the lower nibble in the Game Boy memory. The PC, or Program Counter, register points to the next instruction to be executed in the last math operation. • Carry Flag (C): This...
...set if a carry occurred from the last math operation or if register A is the smaller value when executing the CP instruction. Page 62 V 1.01 The SP, or Stack Pointer, register points to store the results of a math operation is zero or two values match when using the CP ...subtraction was performed in the last math instruction. • Half Carry Flag (H): This bit is set if a carry occurred from the lower nibble in the Game Boy memory. The PC, or Program Counter, register points to the next instruction to be executed in the last math operation. • Carry Flag (C): This...
Manual
Page 119
Game BoyTM CPU Manual 4. The first five bits of the commands listed below are only really two palette types: SGB color palettes and by DP Page ... command transfer is shown at the bottom of palettes in a SGB command transfer should be set to be shifted left three times before used. 4.2. Super Game Boy commands 4. One type is a virtual palette rather than a hardware palette. Super...
Game BoyTM CPU Manual 4. The first five bits of the commands listed below are only really two palette types: SGB color palettes and by DP Page ... command transfer is shown at the bottom of palettes in a SGB command transfer should be set to be shifted left three times before used. 4.2. Super Game Boy commands 4. One type is a virtual palette rather than a hardware palette. Super...