Memory map: ----------- 0000 - 07FF: Screen RAM 0800 - 09FF: Control registers 0A00 - 0BFF: Save area 0C00 - 0FFF: Sound samples RAM 1000 - 1FFF: Small sprites bitmaps RAM 2000 - 3FFF: Character bitmaps RAM 4000 - 7FFF: Large sprites bitmaps RAM Screen RAM: (0000 - 07FF) ----------- 32 lines of 64 characters each. Only a 24 lines X 32 characters "window" is displayed on screen. Each screen line starts 64 bytes after the start of the previous one. Each character is 8x8 pixels. Scrolling is controlled by the 11 bit register at address 08C0: 08C0 | 08C1 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | | | | | | V | V | V | V | V | V | V | V | V | V | V | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ This 11 bits value indicates the offset in Screen RAM for the first character displayed on screen. This allows to scroll the window in 8 pixel increments. Two smooth scroll registers (one vertical and one horizontal) at address 08C2 can be used to scroll the characters in one pixel increments (up to 15 pixels in each direction): 08C2 +---+---+---+---+---+---+---+---+ | V | V | V | V | H | H | H | H | +---+---+---+---+---+---+---+---+ Control registers: (0800 - 09FF) ------------------ 0800 - 81F: 16 character colormap registers, each with a 15 bit color: | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | | R | R | R | R | R | G | G | G | G | G | B | B | B | B | B | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ After a reset the first two registers are set to: blue, white. 0820 - 083D: 15 sprite colormap registers, each with a 15 bit color (same bits layout as the character colormap registers). 0840 - 08BF: 32 sprites control registers (4 bytes for each sprite): The sprites are ordered by priority. The first sprites have higher priority (are drawn on top of) than the last ones. 0 | 1 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | S | N | N | N | N | N | N | N | H | H | H | H | H | H | H | H | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 2 | 3 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | V | V | V | V | V | V | V | V | | | | | | | | h | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ S: sprite size (0 = 16x16, 1 = 8x8) NNNNNNN: sprite bitmap # (0 -> 127) hHHHHHHHH: sprite X pos + 16 (-16 -> 495) VVVVVVVV: sprite Y pos + 16 (-16 -> 239) 08C0 - 08C2: Screen RAM scroll control (see above) 08C4 - 08C4: Buttons I/O, one byte with one bit for each button. +---+---+---+---+---+---+---+---+ | P | S | C | E | R | L | D | U | +---+---+---+---+---+---+---+---+ P: "P" S: Space C: Control E: Enter R: Right L: Left D: Down U: Up 08C6 - 0905: Audio control registers, 4 sets of registers with 16 bytes each (only the first 9 bytes are used): 0 | 1 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 2 | 3 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | A | A | A | A | A | A | A | A | A | A | A | A | A | A | A | A | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 4 | 5 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | D | D | D | D | D | D | D | D | D | D | D | D | D | D | D | D | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 6 | 7 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | R | R | R | R | R | R | R | R | R | R | R | R | R | R | R | R | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 8 +---+---+---+---+---+---+---+---+ | t | f | S | S | V | V | V | V | +---+---+---+---+---+---+---+---+ FFFFFFFFFFFFFFFF: sound frequency (frequency in Hz is value X 0.042057037353515625) AAAAAAAAAAAAAAAA: Attack time in milliseconds DDDDDDDDDDDDDDDD: Decay time in milliseconds RRRRRRRRRRRRRRRR: Release time in milliseconds VVVV: Max volume (at end of attack time) SS: Sustain volume (at end of decay), as percentage of max volume (3 = 100%, 2 = 66.67%, 1 = 33.33%, 0 = 0%). t: play note command (hardware resets to 0 after accepting command) f: release note command (hardware resets to 0 after accepting command) 0906-0906: Save Control +---+---+---+---+---+---+---+---+ | | | | | | | R | W | +---+---+---+---+---+---+---+---+ W: Write contents of Save Area to disk (hardware resets to 0 when write is done) R: Read contents of Save Area from disk (hardware resets to 0 when read is done) Save Area: (0A00 - 0BFF) ---------- This 512 bytes area used for saving game info (high scores, etc.) Sound samples RAM: (0C00 - 0FFF) ------------------ 4 banks, each with 256 eight bit signed samples (-128 -> 127). After a reset each of these banks contains one cycle of a square wave. Small sprites bitmaps RAM: (1000 - 1FFF) -------------------------- 128 bitmaps of 8x8 pixels each. For each pixel 4 bits are used to indicate its color. Values from 0 to 14 are mapped to the 15 sprite colormap registers. Value 15 indicates a "transparent" pixel. Each bitmap is 32 bytes long (8x8/2). Character bitmaps RAM: (2000 - 3FFF) ---------------------- 256 bitmaps of 8x8 pixels each. For each pixel 4 bits are used to indicate its color. Values from 0 to 15 are mapped to the 16 character colormap registers. Each bitmap is 32 bytes long (8x8/2). After a reset it is filled with standard character bitmaps (using only the first two character colormap registers). Large sprites bitmaps RAM: (4000 - 7FFF) -------------------------- 128 bitmaps of 16x16 pixels each. For each pixel 4 bits are used to indicate its color. Values from 0 to 14 are mapped to the 15 sprite colormap registers. Value 15 indicates a "transparent" pixel. Each bitmap is 128 bytes long (16x16/2).