Search code examples
compiler-constructionhardware

How to program to old game consoles?


I want to know how to program to old game consoles for fun.

Can I use a programming language such as C? Will I have to use assembly? I do not know any console compiler, assembler or API. I will need to compile into ROM image and test with emulators, because I do not own any console.

Each console has its interesting features and I would like to play with them.

  • Atari 2600 (only 128 bytes of RAM)
  • NES (only 8-bit)
  • SNES (a good console, 16-bit)
  • PS1 (3D, complex)
  • Game Boy (simple, monochromatic)

Solution

  • Older systems like the Atari, NES, and GameBoy are typically programmed in Assembly or C. There are a variety of development tools for the GameBoy I've played around with such as:

    Rednex Gameboy Development (ASM): http://www.otakunozoku.com/rednex-gameboy-development-system/
    GBDK (C): http://gbdk.sourceforge.net/

    And while there are a lot of dead links on it, this page has a lot of good information and links on GameBoy development in general: http://www.devrs.com/gb/

    For the NES there are two assembly tutorials I know of. The second tutorial is linked to from the first with the claim it is superior but I can't really comment as the second link didn't exist last time I was interested in this topic.
    http://www.patater.com/nes-asm-tutorials
    http://www.nintendoage.com/forum/messageview.cfm?catid=22&threadid=7155 (this link is no longer valid, use the wayback machine)

    If it isn't too new for you the GBA has a lot of great homebrew resources and is typically programmed using C. The wealth of information on the GBA makes it a good place to start:

    DevKitPro provides a complete GNU toolchain for GBA development (DevKitARM + libgba): http://www.devkitpro.org/

    TONC is a very good guide for the GBA with a lot of detailed explaination: http://www.coranac.com/tonc/text/

    Lastly, the indispensible gbatek sheet that details the GBA's hardware. This will tell you what registers on the GBA you have to play with to change graphics modes, sound modes, use interrupts, etc.
    http://nocash.emubase.de/gbatek.htm

    Programming for these older game systems shares a lot in common with programming microcontrollers. Without some sort of abstraction layer you have to do a lot of bitwise manipulation of registers to do even the most basic things.

    Edit: The main issue I came across when doing GBA programming was figuring out how the sound registers work. It was (is?) a real blind spot in terms of tutorials. The best resource at the time was studying the gbatek sheet and these sites:
    http://deku.rydia.net/program/sound1.html
    http://belogic.com/gba/