Memory Maps

There is one more detail to cover before we begin to write the CPU emulator. All the CPUs have the ability to talk to a certain number of addresses. For old processors, this is either 16, 24, or 32 bit address. The 8080 has 16 address pins, so its addresses will be 0-$FFFF.

We are going to use some research to find the game's memory map. Combining information from here and here, I learn that the game's ROM is located at address 0, and the game has 8K of RAM starting at address $2000.

The author of one of the pages volunteers that the video buffer starts in the RAM at $2400, and also tells us how the 8080's I/O ports are used to talk to the controls and the sound hardware. Sweet!

The ROM file that is around the net has 4 files in it, invaders.e, .f, .g, and .h. Googling led me here led me to an informative write up that told me how put those files into memory:

   Space Invaders, (C) Taito 1978, Midway 1979

   CPU: Intel 8080 @ 2MHz (CPU similar to the (newer) Zilog Z80)    

   Interrupts: $cf (RST 8) at the start of vblank, $d7 (RST $10) at the end of vblank.    

   Video: 256(x)*224(y) @ 60Hz, vertical monitor. Colours are simulated with a    
   plastic transparent overlay and a background picture.    
   Video hardware is very simple: 7168 bytes 1bpp bitmap (32 bytes per scanline).    

   Sound: SN76477 and samples.    

   Memory map:    
    $0000-$07ff:    invaders.h    
    $0800-$0fff:    invaders.g    
    $1000-$17ff:    invaders.f    
    $1800-$1fff:    invaders.e    

    $2000-$23ff:    work RAM    
    $2400-$3fff:    video RAM    

    $4000-:     RAM mirror    

There is some other good info there too, but I don't think we're ready for it quite yet.

Gory Details

If you want to know how much address space a processor has, you could figure it out by looking at its specs. The 8080 spec shows that there are 16 address pins on it, so it uses a 16-bit address. (Or just read the data book, or Wikipedia, or google, or....)

Space Invaders has plenty of hardware information available on the internet. If you weren't able to have that information, you could figure it out in a couple of ways:

It might be fun and educational to try to figure that out by yourself by watching the code execute. Someone had to do that to figure it out the first time.

← Prev: disassembler-pt-1   Next: developing-on-the-command-line →