Manual
Page 1
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 Nintendo CO., LTD. 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 DP
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 Nintendo CO., LTD. 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 DP
Manual
Page 2
... Mode 19 2.8. 1. Hardware specifications 5 2.1. Stop Mode 19 2.7.3. Sound 28 2.10. Game Boy Specs 6 2.4. Processor 6 2.5. Interrupts 32 2.12.1. Interrupt Descriptions 34 2.13. I /O 31 2.12. Foreword 4 2. Sprites 25 2.8.3. Special Registers 35 2.13.1. Terms 5 2.3. Memory Map 8 2.5.1. Sprite RAM Bug 27 2.9. Serial I /O Registers 35 Page 2 V 1.01 General memory map 8 2.5.2. Power Up Sequence 17 2.7.2. Timer 30 2.11. User...
... Mode 19 2.8. 1. Hardware specifications 5 2.1. Stop Mode 19 2.7.3. Sound 28 2.10. Game Boy Specs 6 2.4. Processor 6 2.5. Interrupts 32 2.12.1. Interrupt Descriptions 34 2.13. I /O 31 2.12. Foreword 4 2. Sprites 25 2.8.3. Special Registers 35 2.13.1. Terms 5 2.3. Memory Map 8 2.5.1. Sprite RAM Bug 27 2.9. Serial I /O Registers 35 Page 2 V 1.01 General memory map 8 2.5.2. Power Up Sequence 17 2.7.2. Timer 30 2.11. User...
Manual
Page 3
... 3.2.4. Miscellaneous 94 3.3.6. Calls 114 3.3.10. Returns 117 4. Typical timing diagram 137 by DP Page 3 Foreword 61 3.2. CPU Registers 61 3.2.1. Game Boy command overview 61 3.1. Generally 61 3.2.2. Stack Pointer 63 3.3. Bit Opcodes 108 3.3.8. Super Game Boy commands 119 4.1. Foreword 119 4.2. Commands 122 5. Appendix A 134 5.1. Emulator Notes 134 5.2. Rotates & Shifts 99 3.3.7. Palettes 119 4.3. Jumps 111 3.3.9. SGB...
... 3.2.4. Miscellaneous 94 3.3.6. Calls 114 3.3.10. Returns 117 4. Typical timing diagram 137 by DP Page 3 Foreword 61 3.2. CPU Registers 61 3.2.1. Game Boy command overview 61 3.1. Generally 61 3.2.2. Stack Pointer 63 3.3. Bit Opcodes 108 3.3.8. Super Game Boy commands 119 4.1. Foreword 119 4.2. Commands 122 5. Appendix A 134 5.1. Emulator Notes 134 5.2. Rotates & Shifts 99 3.3.7. Palettes 119 4.3. Jumps 111 3.3.9. SGB...
Manual
Page 4
you programming the Game BoyTM Classic, Game BoyTM Pocket, Super Game BoyTM and Game BoyTM Color (basics - See paragraph 3. DP Page 4 V 1.01 The documents consists of several documents from 'Game Boy Assembly Language Primer (GALP) V1.0'by GABY (GAmeBoY). On the last page a quick reference of ...for the hardware. It was designed to start right off coding for Nintendo Super Game Boy speciffic programming by Pan of Anthrox, Marat Fayzullin, Pascal Felber, Paul Robson, Martin Korth, kOOPa. Foreword Game BoyTM CPU Manual 1. Foreword This Document was ment to be found ...
you programming the Game BoyTM Classic, Game BoyTM Pocket, Super Game BoyTM and Game BoyTM Color (basics - See paragraph 3. DP Page 4 V 1.01 The documents consists of several documents from 'Game Boy Assembly Language Primer (GALP) V1.0'by GABY (GAmeBoY). On the last page a quick reference of ...for the hardware. It was designed to start right off coding for Nintendo Super Game Boy speciffic programming by Pan of Anthrox, Marat Fayzullin, Pascal Felber, Paul Robson, Martin Korth, kOOPa. Foreword Game BoyTM CPU Manual 1. Foreword This Document was ment to be found ...
Manual
Page 5
...= Super GameBoy by Nintendo Co., LTD. Forward: The following was typed up for educational purposes and higher learning. 2.2. GameBoy is presented to copyrighted material is not presented for monetary gain, but for informational purposes regarding the inner workings on how their Game Boy works and what makes ...it "tick". Game BoyTM CPU Manual 2. Hardware specifications 2. Any reference to inform a user on the hand-held...
...= Super GameBoy by Nintendo Co., LTD. Forward: The following was typed up for educational purposes and higher learning. 2.2. GameBoy is presented to copyrighted material is not presented for monetary gain, but for informational purposes regarding the inner workings on how their Game Boy works and what makes ...it "tick". Game BoyTM CPU Manual 2. Hardware specifications 2. Any reference to inform a user on the hand-held...
Manual
Page 6
Game Boy Specs Game BoyTM CPU Manual 2.3. Game Boy Specs • CPU: 8-bit (Similar to an Intel 8080. Processor The GameBoy...CPU Speed 1.05MHz 4.19MHz NOP Instruction 1 cycle 4 cycles 2.4. Here is more similar to the Z80, some instructions Page 6 V 1.01 2.3. It contains all of the instructions of sprites: 40 • Max # sprites/line: 10 • Max sprite size: 8x16 ...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.
Game Boy Specs Game BoyTM CPU Manual 2.3. Game Boy Specs • CPU: 8-bit (Similar to an Intel 8080. Processor The GameBoy...CPU Speed 1.05MHz 4.19MHz NOP Instruction 1 cycle 4 cycles 2.4. Here is more similar to the Z80, some instructions Page 6 V 1.01 2.3. It contains all of the instructions of sprites: 40 • Max # sprites/line: 10 • Max sprite size: 8x16 ...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.
Manual
Page 21
again and again. stop system clock ; V-Blank interrupt ? No, some other ; 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't lock the ...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 ; button inputs ; game operation jr Main by DP Page 21 interrupted nop ; (See WARNING above.) ld a,(VblnkFlag) or a ; interrupt xor a ld (...
again and again. stop system clock ; V-Blank interrupt ? No, some other ; 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't lock the ...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 ; button inputs ; game operation jr Main by DP Page 21 interrupted nop ; (See WARNING above.) ld a,(VblnkFlag) or a ; interrupt xor a ld (...
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. Game Boy command overview 3.1. CPU Registers 3.2.1. Game BoyTM CPU Manual 3.
... 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. Game Boy command overview 3.1. CPU Registers 3.2.1. Game BoyTM CPU Manual 3.
Manual
Page 62
... Flag (C): This bit is set if a carry occurred from the last math operation or if register A is used to the current stack position. 3.2.2. Page 62 V 1.01 Flag Register The Fleg Register consists of the following bits: 76543210 ZNHC0000 • Zero Flag (Z): This bit is set when the result of various math... a 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. 3.2.1. Generally Game BoyTM CPU Manual programmer and is the smaller value when executing the CP instruction.
... Flag (C): This bit is set if a carry occurred from the last math operation or if register A is used to the current stack position. 3.2.2. Page 62 V 1.01 Flag Register The Fleg Register consists of the following bits: 76543210 ZNHC0000 • Zero Flag (Z): This bit is set when the result of various math... a 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. 3.2.1. Generally Game BoyTM CPU Manual programmer and is the smaller value when executing the CP instruction.
Manual
Page 119
... left three times before used. 4.2. The hardware color palette is shown at the bottom of the first byte is 128 bits + a zero bit. Game BoyTM CPU Manual 4. Super Game Boy commands 4.1. One type is a virtual palette rather than a hardware palette. Unused bits in the SGB. The last 3 bits of the first byte represent... command byte. Palettes There are only really two palette types: SGB color palettes and by the # character to remind you that they have to 0. Super Game Boy commands 4.
... left three times before used. 4.2. The hardware color palette is shown at the bottom of the first byte is 128 bits + a zero bit. Game BoyTM CPU Manual 4. Super Game Boy commands 4.1. One type is a virtual palette rather than a hardware palette. Unused bits in the SGB. The last 3 bits of the first byte represent... command byte. Palettes There are only really two palette types: SGB color palettes and by the # character to remind you that they have to 0. Super Game Boy commands 4.