# Video: tiles and sprites ## Tiles - 28 x 36 visible tiles of 8 x 8 pixels, 2 bits a pixel, from a 4 KB tile ROM (`5e`): 256 tiles of 16 bytes (LOM). - Two 1 KB RAMs: tile codes at 4000-43FF and tile colour (a palette number, low bits used) at 4400-47FF (LOM). - Address order is not row-major: the 896 addresses 040-3BF fill the central 28 x 32 area column by column (top to bottom, right to left in the player's view), and the first and last 64 addresses make two 32-wide rows at the bottom and at the top, four of each row's tiles off screen (LOM figures 7-8). This is the V-RAM addresser's job (NVC284; plug-in equivalent on PMM p. 38: to be read, U3). - Pixel order within a tile: each byte holds four pixels of a column, bit-plane split (bits 0-3 low plane, 4-7 high plane), in 8 x 4 strips (LOM; LOM marks its own sprite ordering "TODO - check"). ## Sprites - Eight 16 x 16 sprites, 2 bits a pixel, from a 4 KB sprite ROM (`5f`): 64 shapes of 64 bytes (LOM). - Per sprite: shape number (bits 2-7), X flip (bit 1) and Y flip (bit 0) at 4FF0 + 2n, palette at 4FF1 + 2n; X and Y at 5060 + 2n and 5061 + 2n (LOM). - The hardware draws sprites over tiles from a line buffer (the 74S89s and 1K x 1 RAMs in the parts list are candidates; HYPOTHESIS until the schematic is traced: U4). The limits that matter to games (sprites per line, priority between sprites, transparency rule, the first two sprites' offset, behaviour at the screen edges) are not in LOM; they are read from the schematic and checked against MAME (U5). ## Colour - A 32 x 8 colour PROM (`7f`, 82S123) holds colours as 3 bits red, 3 bits green, 2 bits blue; only 16 are used in Pac-Man (LOM). - A 256 x 4 palette PROM (`4a`, 82S126) maps (palette number x 4 + pixel value) to a colour index (LOM). - The resistor weights LOM gives (red and green 1 k, 470, 220 ohm; blue 470, 220 ohm) are to be checked against the schematic (U6): they set the analog levels a host shows, not anything a program can see. ## Timing and the beam 384 pixel clocks a line at 6.144 MHz, 264 lines, 60.606 Hz; 288 x 224 visible (MAME). The vertical blank interrupt is the only interrupt (start-here.md). The specification draws each line as the beam passes from the tile and sprite state at that moment; programs normally write during vertical blank, so a per-frame draw is a turbo shortcut to be proven against the per-line one. ## Flip 5003 bit 0 flips the screen (cocktail). Modelled in the video pipeline.