# The VIP (Virtual Image Processor) Source: STS "VIP - Virtual Image Processor" (DOC, tier 3) throughout unless marked. ## The display hardware Each eye's display is one column of red LEDs projected onto an oscillating mirror; the two mirrors move in opposition (Reflection Technology's design). Images are **384 x 224 pixels per eye**, 2 bits per pixel (black plus three brightness levels), shown at **50 Hz** (a 20 ms display frame). MAME's frame is 19.985 ms (OBSERVED: 600 frames = 11.9909 s), a 0.07 % difference from STS's round figure (C1). ## Memory (256 KiB, mirrored every 512 KiB) | Range | What | | --- | --- | | 00000-05FFF, 08000-0DFFF | left frame buffers 0 and 1 | | 10000-15FFF, 18000-1DFFF | right frame buffers 0 and 1 | | 06000-07FFF, 0E000-0FFFF, 16000-17FFF, 1E000-1FFFF | character tables 0-3 (2,048 characters of 16 bytes), also mirrored contiguously at 78000-7FFFF | | 20000-3D7FF | background maps (up to 14 of 64 x 64 cells) and world parameters (H-bias and affine tables) | | 3D800-3DBFF | world attributes (32 worlds) | | 3DC00-3DDFF, 3DE00-3DFFF | left and right column tables (256 entries each) | | 3E000-3FFFF | object attributes (1,024 objects) | | 5E000-5FFFF | registers (INTPND/INTENB/INTCLR, DPSTTS/DPCTRL, BRTA-C, REST, FRMCYC, CTA, XPSTTS/XPCTRL, VER, SPT0-3, GPLT0-3, JPLT0-3, BKCOL) | The VIP's memory bus is 16 bits wide. ## Two procedures on two clocks - **Display** (every 20 ms): FCLK rises at 0 ms; the left frame buffer displays from 3 to 8 ms; FCLK falls at 10 ms; the right displays from 13 to 18 ms. For each eye, the column table pointer starts from CTA and steps per group of 4 columns, DPBSY flags mark the busy interval, interrupts LFBEND/RFBEND/FRAMESTART fire at the edges. The column table entry gives a repeat count and a column length in 200 ns units; BRTA-C give the LED pulse per brightness level and REST the idle time, in 5 ns units. - **Drawing** (every game frame = FRMCYC + 1 display frames): starts when FCLK rises; draws into the frame buffer pair not being displayed (alternating 0/1); sets OVERTIME (and TIMEERR) if the previous drawing has not finished. The work: for each 1 x 8-pixel halfword of the frame buffer, left to right within a row of 8, rows of 8 top to bottom (28 of them): fill with BKCOL, then walk worlds 31 down to 0 (stop at a control world, skip dummies, object worlds take object groups 3, 2, 1, 0 via SPT3..SPT0), then write the halfword once. SBCOUNT says which row group is being drawn; SBCMP/SBHIT interrupt on a chosen one. - **Frame buffers are column-major**: each halfword holds 8 vertically adjacent pixels, low bits on top; 384 x 256 pixels per buffer (the bottom 32 rows are never drawn or displayed but are real memory). ## Worlds, backgrounds, objects - **Characters** 8 x 8 at 2 bpp; **palettes** GPLT0-3 (backgrounds) and JPLT0-3 (objects) map each 2-bit value to one of four shades, value 0 transparent. - **Background maps**: 64 x 64 cells of 16-bit entries (character, palette, flips); a world's background is a mosaic of 1, 2, 4 or 8 maps per side (World Attributes). - **World kinds** (by BGM): normal; H-bias (a per-row horizontal shift per eye, from the world parameter table); affine (a per-row source point and step vector in fixed point: rotation, scaling, perspective); object (draws an object group). LON/RON enable each eye; GX/GP/GY, MX/MP/MY and W/H place and size the window; a parallax term separates the eyes. - **Objects**: 1,024 entries of 4 halfwords (position, parallax, eye enables, palette, flips, character); objects within a group are drawn in a fixed order (STS "Objects"). ## Brightness and the column table The apparent brightness of a pixel is (its level's pulse) x (the column's repeat count); above about 128 units, longer pulses no longer look brighter (STS "Apparent Brightness"). Nintendo shipped a **recommended column table** used by all commercial software (STS gives the data; the board need not invent one, software loads it). For a picture on a flat screen the board outputs the 2-bit frame buffer through BRTA-C as intensities: **how column-table repeats and REST should change a flat picture is a presentation choice, not hardware behaviour** (open decision 3). ## What nobody has documented (the board's unknowns) - **Drawing time** per world kind, per object, per affine row: STS says "research is needed" and gives one figure, about 2.8 ms for an empty frame (U6). Games that overrun (OVERTIME) depend on it, and so does the CPU's VIP-memory wait while drawing (U4). - **When the drawn buffer becomes the displayed one** (STS: "may occur when FCLK goes high"; U7); which buffer is first after reset (U8). - Frame buffer and world-parameter access by the CPU *during* drawing: collisions and waits (U4). - The exact affine fixed-point arithmetic and rounding (STS gives the formats; the per-pixel accumulation order is to be checked, U9). - SCANERR and the mirror servo (an analogue loop the emulator models as "always stable"; HYPOTHESIS, U10).