title: A Reference on the layout and structure of GameBoy Color Roms?
body: <p>Does anyone have a reference or source about how GameBoy Color roms are laid out - where the data and code, what machine code instructions are used, how the clock works etc? I'm interested in perhaps building an emulator myself but I can't find any information about the roms' setup other than looking at them in a hex editor. I'm interested in roms in the <code>.gbc</code> file format.</p>
  
  <p>I can of course look at the <a href="http://imrannazar.com/GameBoy-Emulation-in-JavaScript:-The-CPU" rel="noreferrer">source of a working emulator</a>, but I'm interested in something a bit more high level than that while I'm starting off. </p>
  
  <hr>
  
  <p><strong>Edit:</strong> Here are a load of really good resources I found:</p>
  
  <ul>
  <li><a href="http://imrannazar.com/GameBoy-Emulation-in-JavaScript:-The-CPU" rel="noreferrer">A Emulator being built in javascript</a> with <a href="http://github.com/Two9A/jsGB" rel="noreferrer">more up to date source</a>.</li>
  <li><a href="http://www.devrs.com/gb/files/gbspec.txt" rel="noreferrer">"The PAN documents" a detailed spec of the gameboy</a></li>
  <li><strong><a href="http://meatfighter.com/gameboy/TheNintendoGameboy.pdf" rel="noreferrer">A more up to date and better version of the previous item, with loads of stuff. Best resource</a>.</strong></li>
  <li><a href="http://nemesis.lonestar.org/computers/tandy/software/apps/m4/qd/opcodes.html" rel="noreferrer">Standard Z80 opcodes</a></li>
  <li><a href="http://imrannazar.com/Gameboy-Z80-Opcode-Map" rel="noreferrer"><strong>All the opcodes in the Gameboy Z80</strong></a></li>
  <li><a href="http://www.z80.info/z80gboy.txt" rel="noreferrer">A list of opcodes changed/removed in the Gameboy</a></li>
  <li><a href="http://www.zilog.com/docs/z80/um0080.pdf" rel="noreferrer">Z80 user manual (useful for flags)</a></li>
  <li><a href="http://verhoeven272.nl/cgi-bin/FS?fruttenboel/Gameboy&amp;Gameboy+section&amp;GBtop&amp;GBsummary&amp;GBcontent" rel="noreferrer">Discussion of differences between Gameboy <strong>Color</strong> Z80 and 8080/Z80</a></li>
  <li><a href="http://verhoeven272.nl/fruttenboel/Gameboy/index.html" rel="noreferrer"><strong>Massive site dedicated to gameboy architecture (+GBA)</strong></a></li>
  <li><a href="http://meatfighter.com/gameboy/GBCPUman.pdf" rel="noreferrer">Another document on GBSpec, with timings</a></li>
  </ul>
  
  <p>Also, <a href="http://github.com/CRogers/GbcEmulator" rel="noreferrer">see the source for my currently developing project</a> and <a href="http://meatfighter.com/gameboy/" rel="noreferrer">this finished one in C# for the Gameboy Classic (more docs)</a></p>