The Eclair

rom header
4 byte checksum
64 byte name, zero-terminated

the rest is all data (first, rom bank zero.. then other banks)
initial IP goes in 2FFE (of rom bank zero)

speed throttling:
the system runs at a constant 60fps per second
the CPU runs at 4.7mhz
that's 78333 cycles per frame
297 cycles per scanline
the vblank period lasts 11880 cycles (about the time for 40 scanlines)

display:
256x224 pixels
64x56 tiles
each scanline is drawn in its entirety based on the settings at the start
(and the palette can be changed on a per-scanline basis)
the vertical retrace produces an NMI which causes a call to 66h
install an NMI handler here to trap the vblank

drawing order is background colors, background sprites, tiles,
foreground sprites

sound:
output is 22050hz, 16bit, mono (8-bit channels mixed into a 16-bit output)
PCM data is variable frequency, 8-bit(signed) mono

bit fields are from low-high

MEMORY LAYOUT (all memory 100h+ is initialized to 0 upon reset)

you can install an NMI handler (vblank handler) at 66h, and a reset handler
at 38h
0000-00FF system memory
0100-2EFF general ram (remember, you have to fit your stack in here!)

2F00-3EFF sprite tile data
  256 tiles, 4x4 8bit pixels (16 bytes) each, 0 is transparent

3F00-4EFF tile data
  Same as sprite tile data

4F00-6AFF image data (0 is no tile)
  7168 tiles (2 screens).  3584 tiles make up a screen.
  (viewport and pitch controlled elsewhere)

6B00-6EFF sprite data
  256 sprites
    1 byte selects which sprite tile
    2 bytes x,y (screen offset)
    1 bit used?
    1 bit horiz flip
    1 bit vert flip
    1 bit goes behind background
    1 bit absolute position

((when interrupts are enabled, this memory and the I register are reserved for
 use by the system. you will want to disable interrupts if you dont want the
 scanline interrupt, and if you do disable them, you can use the I register
 freely. interrupts are disabled by default. if you mess with I, make sure to
 reset it to 6Fh if you re-enable them. if you want to enable interrupts,
 make sure to set the interrupt mode to 2 with IM 2. Interrupts are disabled
 by default)
)6F00-6FFF interrupt table (vectors are words)
  00h - scanline
  38h - reserved
  66h - reserved
  the unused entries can be used as general memory.. if you really need it

7000-9FFF rom bank zero (12k)
A000-CFFF rom bank X
D000-FFFF rom bank Y


I/O PORTS (all initialized to zero on reset, except where stated otherwise)
all values are read/write, except where otherwise specified

10-2B sound
  7 channels
    2 bytes freq (0-22049)
    1 byte vol
    2 bits type (sq/sine/tri/noise)
    6 bits PW

2C-34 PCM channel
    2 bytes frequency (0-22050Hz)
    2 bytes offset (absolute. not relative to loop. updated by playback unit)
    2 bytes loop start (loop end is exclusive)
    2 bytes loop end
    1 byte  status
      2 bits loop type (none[stop at loop end]/normal/reverse/ping-pong)
	  (note that 'none' stops the loop by setting end equal to start)

35-36 (R/O)
  2 controllers
    4 bits directional (up/down/left/right), 4 bits buttons (A/B/X/Y)

37-3A left,top,right,bottom of tile viewport (in tiles, r/b exclusive)
3B virtual screen pitch (initialized to 96 [60h])
3C horizontal panning
3D vertical panning
3E current scanline (R/O. 255 if in vblank period)
3F which rom bank X
40 which rom bank Y

(palette entry 0 is never used, as color 0 is ALWAYS transparent)
41 set palette entry
42 palette entry low
43 palette entry high (accessing this increments palette entry)

44 random seed (W/O)
45 random number (R/O)

46 background color inside viewpoint
47 background color outside viewpoint

(these only work when a debugger is attached to the system)
50 output a hex byte
51 output an ASCII character
52 output a decimal number
