
GameBoy Programming Manual  - robert-boehnke
http://www.scribd.com/doc/39999184/GameBoy-Programming-Manual
======
deletes
Maybe i missed something, but the options are: Login with facebook or Pay Us.

>>To download this document you must become a Premium Reader<<

EDIT:

[http://www.romhacking.net/documents/544/](http://www.romhacking.net/documents/544/)

[https://www.google.com/search?hl=en&safe=off&q=GameBoy+Progr...](https://www.google.com/search?hl=en&safe=off&q=GameBoy+Programming+Manual)

~~~
0x09
This post seems to have been inspired by a comment I made yesterday with the
original PDF （ ´_ゝ`）

[https://news.ycombinator.com/item?id=6119347](https://news.ycombinator.com/item?id=6119347)

[http://chrisantonellis.com/files/gameboy/gb-programming-
manu...](http://chrisantonellis.com/files/gameboy/gb-programming-manual.pdf)

------
adjwilli
I can hardly understand anything in that doc. I'm a decent-enough iOS
programmer from a LAMP and design background. It makes me wonder if in 20
years people like me will look back at the iOS programming guide and be
equally confused. As programming gets abstracted out, put into frameworks and
simplified at the user-level it's sure to go even more visual.

~~~
segmondy
I like that you said you are an "iOS programmer" that's the problem with
programming today. you are not a programmer. if you were a programmer, you
would be able to make sense of that document. so to answer your question, 20
years from now, programmers of that era will be able to make look at iOS
programming docs and understand it, meanwhile "20 year future language
programmers" won't. I say this because I learned gameboy programming in my
first year of college (1997) by learning z80 and reading gameboy programming
text files that were probably around 5 pages. that low level programming, till
today serves me well.

~~~
general_failure
Truly spoken like someone who has never written iOS programs. Some iOS
programs are actually truly inspiring and I know of many people who haven't
gotten into that market because it's too competitive (programming wise).

FWIW, I know my x86 assembly and am not an iOS programmer. But I have huge
respect for good iOS programmers. Some of those apps are phenomenal.

~~~
LukeShu
He's not claiming that someone who programs for iOS is a bad programmer. At
all.

He's claiming that people who _identify_ themselves as an "iOS programmer",
rather than just a "programmer", aren't really programmers. A "programmer"
might be able to write inspiring stuff for iOS, but they haven't pigeon-holed
themselfs into being an "iOS programmer"

------
plnewman
Back when I was teaching English in Japan, I stayed up late hacking on Game
Boy code to keep that part of my brain active. It was during that time that I
really realized that I wanted to work in software, or at least something with
some creative output.

I didn't use any of this though, I found a Japanese book on the GBDK C
compiler. It's still available here:
[http://gbdk.sourceforge.net/](http://gbdk.sourceforge.net/) and there are
more resources here:
[http://devrs.com/gb/software.php#assemble](http://devrs.com/gb/software.php#assemble)

I've thought since then that working on a simple machine like that is a great
way to learn the fundamentals of computer science.

~~~
mackwic
As I understand CS, it deals a lot with Data structure construction and
management.

In my school, we began with high-level functional languages and it's only
after 3 years of programming than we discovered low level programming and
could write a Kernel.

Can you explain how a RISC assembly language can help you learn CS ?

~~~
plnewman
I'm not sure if I define CS that narrowly, but anyway I was working with the C
compiler, not the asm code. It was a good learning tool for me because of the
simple output and the slow processor, which meant that I didn't need to worry
much about the graphics and that poorly performing code was immediately,
painfully noticeable. There were plenty of data structures to work with
sprites, characters, screens, etc.

My CS course (in the late 90s) kind of went the other way. One of the earliest
courses was one that taught how a cpu operates -- what a register is, what the
accumulator is, etc. There was no actually programming, just working through
the steps of what the computer does to perform a given operation. After that
there were a number of directions to go in.

~~~
mackwic
Aw right, I missed the C compiler point.

> I'm not sure if I define CS that narrowly

I mostly wanted to bold the data structure manipulation, something you
wouldn't see when manipulating directly the assembly code.

~~~
sukuriant
You'll manipulate data structures in assembly if you need to. Graphing
algorithms are everywhere; and, they require some sort of data structure.

You would be amazed what crazy and complex things were written to create some
of the older games you know and enjoy.

------
gcv
I didn't know that GB consoles didn't have a flat memory model. That was
horrible to program with x86/DOS and must have sucked even more on a tiny
hand-held.

~~~
pdw
x86/DOS actually was much nicer than most consoles, as it had a 20 bit address
space. All memory in the machine could be addressed, even if you had to juggle
NEAR and FAR pointers.

The 8/16-bit consoles could only address 64k, which was to be used for
program, data, VRAM and memory-mapped I/O. So you were forced to partition
your code and data in 8k or 16k banks and manually swap them in and out. If
bank 1 was swapped in, there was no way to access bank 2...

~~~
g-rex
The NES had 32K addressable RAM...while some behemoths like Castlevania 3
([http://en.wikipedia.org/wiki/Castlevania_III:_Dracula%27s_Cu...](http://en.wikipedia.org/wiki/Castlevania_III:_Dracula%27s_Curse))
had 256K of program code to fit in that little box. Every game company solved
this problem differently, it seems:
[http://wiki.nesdev.com/w/index.php/Mapper](http://wiki.nesdev.com/w/index.php/Mapper)

------
felipebueno
Thanks for the manual. =]

I know it's not an official manual but it's worth mentioning: GBA Tonc -
[http://www.coranac.com/tonc/text/toc.htm](http://www.coranac.com/tonc/text/toc.htm)

PDF download:
[http://www.coranac.com/files/tonc.pdf](http://www.coranac.com/files/tonc.pdf)

~~~
rtpg
I've really been wanting to get into GBA programming. I really would like to
buy a cart to be able to develop directly on my DS ( I thought I would be able
to find one in Akiba, but they seem a bit impossible to find in person, and
all the online stores I've seen seem mega shady)

~~~
dyselon
Practically speaking, most of your iteration will be on emulators anyway, so
don't let not having a cart stop you from getting started. GBA programming is
a ton of fun!

------
deletes
So if i understand this correctly, you can only write in the screen buffer
using a character of 8x8 pixels.

~~~
bluedino
Right - everything has to be a sprite. That way you can represent the screen
with something like 360 (20x18) sprites, instead of 23040 (160x144)) pixels.
The sprites are also done by blitting hardware, the Z80 CPU presumably
couldn't update a 160x144 screen at a playable framerate if it had to update
pixel by pixel.

------
Keyframe
It's always interesting to see game console programming. On a similar note
tonc [http://www.coranac.com/tonc/text/](http://www.coranac.com/tonc/text/) is
a great intro to homebrew GBA programming.

------
jevinskie
This cribsheet was very handy when I was writing a Z80 emulator.

[http://www.otakunozoku.com/nintendo-gameboy-
cribsheet/](http://www.otakunozoku.com/nintendo-gameboy-cribsheet/)

------
jorgeleo
from the manual:

"2\. CPU 2.1 OVERVIEW OF CPU FEATURES The CPUs of DMG and CGB are ICs
customized for DMG/CGB use, and have the following features. CPU Features
Central to the 8-bit CPU are the following features, including an I/O port and
timer. 127 x 8 bits of built-in RAM (working and stack)"

How much memory is needed today to make games that are only half entertaining?

~~~
deletes
Of course modern games use more memory as they are running on completely
different platforms. Memory usage has nothing to do with entertainment level.
A 8-bit Chess Game might be as entertaining to someone as is Call of Duty 26
to someone else.

(Game boy has 8192 bytes of working ram. 127x8 bits is only for stack)

~~~
pdw
And cartridges could have additional RAM for games that needed it.

------
brickmort
wow. My childhood dissected into something I can (to a marginal extent)
comprehend. It's quite the fascinating reality check. It isn't _really_ magic
after all.

------
NanoWar
Awesome find, this also helps to program for other devices that run the z80
processor (TI83 anyone?)! :-D

~~~
dmm
Not particularly... The game boy's processor is more like a i8080 than a z80.
It lacks the second register set used for interrupt handling and the iX and iY
registers and the super-sweet addressing mode they enable.

Game boy assemblers do use the z80 syntax rather than the crazy i8080 syntax,
thankfully.

------
laurent123456
That's an amazing document, looking forward to read it.

------
kowdermeister
No jQuery plugin for app dev? :)

~~~
krallja
[http://imrannazar.com/GameBoy-Emulation-in-
JavaScript:-The-C...](http://imrannazar.com/GameBoy-Emulation-in-
JavaScript:-The-CPU)

