# Video: LSPC (LSPC2-A2 / LSPC-A0), NEO-B1, the palette, and the timer The Neo Geo has no background layer: everything is **sprites** (381 vertical strips of 16 x 16 tiles, up to 96 per line) plus a 40 x 32 **fix** layer of 8 x 8 tiles on top. The LSPC parses sprite attributes in VRAM, builds a per-line list, addresses the cartridge's C (sprite), S (fix) and the board's L0 (shrink) ROMs, makes the sync, the vblank IRQ and the timer IRQ. That NEO-B1 holds the line buffers, addresses the palette and arbitrates the CPU's palette access (and holds the watchdog) is [HYPOTHESIS: was wiki NEO-B1]; MacDonald places "two on-chip line buffers" in "the sprite chip" [CM:844-845] and does not name the watchdog's chip. Early boards (MV-1, MV-2B, MV-4, MV-6) carry LSPC-A0 + PRO-B0 + PRO-C0 instead [MAME neogeo.cpp:70-88]; that the three split the same work is [HYPOTHESIS: was wiki PRO-B0, PRO-C0, Rendering logic]. Citation keys: **[CM:L]** `mvstech.txt` line (tier 3, measured on an MV2F); **[SNK pN]** `NG.pdf` PDF page (tier 2; the printed "Hardware-N" footer is the PDF page minus 2); **[MAME f:L]** `src/mame/neogeo/` file and line (tier 5); **[GEO f:L]** Geolith `src/` (tier 5; Geolith credits the Neo Geo Development Wiki, so it is not independent of it). **[HYPOTHESIS: was wiki Page]**: the statement came from that Neo Geo Development Wiki page, which was set aside on 2026-11-26 out of respect for its main author's objection to AI use; no other source read here states it, so it needs new evidence before code rests on it ([provenance.md](provenance.md), "Author respect"). Conflicts carry the brief's C numbers. Gathered on 2026-11-12; the main MAME claims were spot-checked against the source. SiliconRE was not opened ([validation.md](validation.md)). ## Raster timing One timeline in master clocks (24 MHz). Pixel = 4 mclk; 68000 clock = 2 mclk. **A line is 1536 mclk** (384 pixels, 768 68000 clocks). Measured from /HSYNC rising [CM:84-101]: | mclk | Event | | --- | --- | | 0 | /HSYNC rises (end of sync) | | 0-118 | left border | | 118 | /HBLANK rises: active display starts | | 1398 | /HBLANK falls: 1280 mclk = 320 pixels active | | 1425 | /HSYNC falls (sync start; the pulse is 111 mclk) | | 1536 | next line | MAME uses rounder numbers (HBEND 28 pixels, HBSTART 348) [MAME neogeo_spr.h:10-16]; its comment says HBEND was "verified from" the wiki's Display timing page, so MAME is not independent here (C8: follow MacDonald). During horizontal blank palette entry 0 is output [CM:217-222]; during vertical blank the DAC latches are held at zero [CM:118-121]. **A frame is 264 lines (NTSC).** The 9-bit line counter (bits 15-7 of a `$3C0006` read) runs [CM:381-391], [SNK p9]: | Counter | Lines | | --- | --- | | `$0F8-$0FF` | vertical sync | | `$100-$10F` | top border (blanked) | | `$110-$1EF` | the 224 active lines | | `$1F0-$1FF` | bottom border (blanked); vblank starts here | MAME's `vpos` 0 is counter `$100` [MAME neogeo_v.cpp:199-205]; Geolith reports scanline + `$F8` [GEO geo_lspc.c:480] and supports only 60 Hz. **The mclk at which the counter increments is not known** (MAME: its hpos 0; Geolith: about mclk 1424, "educated guess"). **PAL** (LSPC2 only, chosen by a pin latched at reset; software can only read it): 312 lines, 16 more display lines top and bottom [SNK p4]. The PAL counter range is undocumented and neither detector implements PAL (U-list). Status bit 3 of the `$3C0006` read gives the standard: MAME's game evidence (samsho3, trally) [MAME neogeo_v.cpp:184-195] and Geolith say 1 = 50 Hz (also [HYPOTHESIS: was wiki Display timing]); SNK p9 says 0 = PAL; MacDonald marks the bit unused (C4: **provisional**, it followed the wiki until 2026-11-26; open for Aubrey). ## The CPU interface (`$3C0000-$3C000E`) Writes repeat every 8 words through `$3DFFFF`, reads every 4 words; `+8`/`+A` read back as VRAM data, `+C` as the modulo, `+E` as the status [CM:345-358], [MAME neogeo.cpp:1720-1721]. | Offset | Write | Read | | --- | --- | --- | | `+0` | VRAM address | VRAM data (read buffer) | | `+2` | VRAM data; then address += modulo | VRAM data (read buffer; no increment) | | `+4` | modulo | modulo | | `+6` | bits 15-8 auto-animation reload, 7 timer reload on underflow, 6 at frame start, 5 on write of `+A`, 4 timer IRQ enable, 3 auto-animation off | bits 15-7 line counter, 3 video standard, 2-0 auto-animation counter | | `+8`, `+A` | timer reload, high and low words | (as `+0`) | | `+C` | IRQ acknowledge: bit 2 vblank, 1 timer, 0 cold-boot IRQ3 | (as `+4`) | | `+E` | bit 0: stop the timer in PAL borders (LSPC2 only) | (as `+6`) | Byte writes to even addresses store the byte in both halves; odd byte writes are ignored; odd byte reads return the last bus value [CM:671-690], [MAME neogeo_v.cpp:232-258]. **VRAM access rules** (these make games break if wrong): - The modulo is 16 bits latched, 15 used: address bit 15 does not take part in the add, so the two VRAM halves wrap separately [CM:609-630]. It is not reset; it reads 0 after a cold boot [CM:632]. - A read of `+2` sooner than **56 mclk** after an address or data write returns the old buffer (52 is too short); back-to-back data writes can lose an increment; a `MOVE.L` that writes data and then the modulo uses either modulo [CM:651-669]. SNK's programming rules: read at least 16 CPU clocks after an address write, another write at least 12 clocks after a data write, an explicit address write when crossing between `$0000-$7FFF` and `$8000-$FFFF` [SNK p9-10]. - Whether the read buffer is loaded once per address/data write (MacDonald, MAME) or refreshed continuously by the CPU slot ([HYPOTHESIS: was wiki Rendering logic]) is C20; Geolith reads live VRAM. - Upper VRAM is `$8000-$87FF`; above that MacDonald and MAME mirror it, Geolith drops writes (C24). **VRAM slots** [HYPOTHESIS: was wiki Rendering logic]: the slow VRAM (`$0000-$7FFF`) gives four 4-mclk slots per 16 mclk (SCB1 even word, SCB1 odd word, CPU, fix map); the fast VRAM (`$8000-$87FF`) ten slots per 16 mclk (five parse slots, the active-list read, SCB2, SCB3, SCB4, CPU). So the CPU would get one slot per 16 mclk in each half, which would explain the 56-mclk read latency. Parsing a line would take 480 fast slots: 381 SCB3 reads + 96 list writes + 3 idle. What is measured: rendering is 96 x 16 mclk, the whole line, and the 381 is 4 clocks per sprite plus 12 of setup [CM:821-831]. ## VRAM map | Words | What | | --- | --- | | `$0000-$6FFF` | SCB1: 64 words per sprite, a word pair per tile, tiles 0-31 top to bottom | | `$7000-$74FF` | fix map, 40 columns x 32 rows, column-major | | `$7500-$75FF` | extension read during blanking (columns 40-47): NEO-CMC's fix bank data | | `$7600-$7FFF` | free (the system ROM keeps work data here) | | `$8000-$81FF` | SCB2 shrink | | `$8200-$83FF` | SCB3 Y, chain, height | | `$8400-$85FF` | SCB4 X | | `$8600-$867F`, `$8680-$86FF` | the two per-line sprite lists the LSPC writes (even, odd lines) | MacDonald's two tables put the end of the fix map at `$75FF` and `$77FF`, and give the lists as 96 words plus unused space where Geolith gives 128 each [CM:716, 768, 775-777]. ## Sprites **Attributes** [SNK p19], [CM:788-946]: - **SCB1 even word**: tile number bits 15-0. **Odd word**: palette (bits 15-8), tile number bits 19-16 (bits 7-4), 8-frame auto-animation (3), 4-frame auto-animation (2), vertical flip (1), horizontal flip (0). Bit 3 wins over bit 2. MacDonald has only bits 6-4 and calls 7 unknown; SNK adds "presently only bit 4 is used" (C16; MAME and Geolith use 20 bits). Unused high tile bits depend on the cartridge's wiring [CM:796-799]; emulators mask to the ROM size. - **SCB2** (`$8000 + n`): horizontal shrink bits 11-8 (`$F` = full width), vertical shrink bits 7-0 (`$FF` = full height). - **SCB3** (`$8200 + n`): Y in bits 15-7, chain ("sticky") bit 6, height in tiles bits 5-0. - **SCB4** (`$8400 + n`): X in bits 15-7. **Y and height.** The top line is at 496 - Y counted from the first active line; positions wrap at 512 [CM:932-939]. MAME: `y = $200 - (SCB3 >> 7)` against its vpos, and a sprite is on a line when `((line - y) & $1FF) < 16 * rows`, with rows of `$20` or more always on [MAME neogeo_spr.cpp:292-295, 330]. Height 0 keeps a sprite (and its whole chain, if it leads one) out of the list at parse time only; a list entry with height 0 that is drawn anyway acts as the maximum height [CM:873-876, 903-910, 927-930]. Height 33 is SNK's loop mode [SNK p5]; for `$21-$3F` MacDonald says "as `$20`", MAME loops for every height above `$20`, Geolith loops only at exactly 33 (C13; test case: Tecmo World Soccer '96's pitch, [GEO geo_lspc.c:840-844]). **Chaining.** A sprite with the chain bit takes Y, height and vertical shrink from the one before and ignores its own; its X is the previous X **plus the previous sprite's horizontal shrink + 1**, wrapping at 512 [MAME neogeo_spr.cpp:320-326 checked], [GEO geo_lspc.c:791-797]; the mechanism ("no LD pulse for chained sprites") is [HYPOTHESIS: was wiki Rendering logic, Sticky bit]. MacDonald writes "+16" (C12: **provisional**, follow MAME, since a shrunk chain would show gaps otherwise; until 2026-11-26 the wiki's mechanism was the second support). **Vertical shrink** [MAME neogeo_spr.cpp:344-371], [GEO 832-857]: L0 is the first 64 KiB of `000-lo.lo` (CRC `5A86CFF2`), 256 tables of 256 bytes indexed `(zoom_y << 8) | zline`. With `sl = (line - y) & $1FF`, `zline = sl & $FF`, `inv = sl >> 8`: if `inv`, `zline ^= $FF`; the byte gives the tile index (high nibble) and the row (low nibble); if `inv`, `tile ^= $1F` and `row ^= $F`. In loop mode `zline %= 2 (zoom_y + 1)` and the upper half mirrors with `inv` toggled. Vertical flip (`row ^= $F`) applies after L0, then auto-animation replaces tile bits. Past 16 tiles of shrunk graphics the table's `$FF` padding repeats the last row of tile 15 [HYPOTHESIS: was wiki Sprite shrinking]; SNK asks for tiles `$1E` and `$20` to be transparent when shrinking [SNK p13]. **Horizontal shrink**: 16 fixed pixel-drop patterns inside the LSPC (no ROM). As masks with bit 15 = leftmost pixel: `0080 0880 0888 2888 288A 2A8A 2AAA AAAA AAEA BAEA BAEB BBEB BBEF FBEF FBFF FFFF` [MAME neogeo_spr.cpp:273-274] (tier 5 only: that the patterns match hardware was the wiki's claim, set aside 2026-11-26; Geolith's table says "from neogeodev"). **Shrinking never saves time**: every listed sprite costs 16 mclk of the line [CM:826-831]. **The per-line limit** [CM:833-886], [MAME neogeo_spr.cpp:460-500]: the LSPC scans sprites in number order and lists the first **96** that are on the next line; later ones are dropped; the rest of the list is zero-filled. Rendering always walks all 96 entries, so **sprite 0 is drawn for every empty slot**: if its chain bit is set, each copy chains to the one before, so it tiles across the line, and the last real sprite's height cannot switch a chained sprite 0 off. That is why SNK's initialisation writes transparent tile `$20` to sprite 0 and `$0000` to `$8200` [SNK p13]. Lists can be written by hand (any number 0-511, at most 96 drawn) [CM:868-871]. MAME draws at most one sprite-0 fill, "not 100% correct ... but we need the speed" [MAME neogeo_spr.cpp:298-312, checked]; Geolith parses sprites 1-381 and never draws sprite 0 (C7). **No emulator models MacDonald's repeated sprite 0**: the board must, and it is a test case. **Sprites per frame**: SNK numbers 380 usable sprites (1-380, sprite 0 neutralised) [SNK p13, p20]; MacDonald and MAME parse 0-380 (381) (C7). **Priority**: list order: later entries overwrite earlier ones in the line buffer, so higher-numbered sprites are in front (SNK numbers the sprites "by low priority" [SNK p20]; MAME draws the list in order [MAME neogeo_spr.cpp:298-330]); trailing sprite-0 copies therefore sit on top. **X**: 9 bits, 0-319 visible, wraps at 512 [MAME neogeo_spr.cpp:329-338]. **C ROM tiles**: 16 x 16, 4 bitplanes, 128 bytes. In MAME's interleaved C1/C2 image (C1 even bytes, C2 odd) each row is 4 bytes `[bp0, bp2, bp1, bp3]`; bit x is pixel x of the 8-pixel half (bit 0 leftmost); bytes `$40-$7F` are the left half, `$00-$3F` the right [MAME neogeo_spr.cpp:673-692], [GEO 762-776] (the two emulators agree on bit x). The CD stores bytes in the order 1/0/3/2 [HYPOTHESIS: was wiki Sprite graphics format; MAME's CD swizzles sprite addresses, neogeocd.cpp:420-421]. **Auto-animation** [CM:393-417], [MAME neogeo_spr.cpp:131-143]: an 8-bit frame down-counter reloads from `$3C0006` bits 15-8 **only on underflow** (period n + 1 frames; SNK writes "value x 16 ms": C19); each underflow steps a 3-bit counter (readable, bits 2-0) that **replaces** tile bits 1-0 or 2-0. Bit 3 of the mode stops the substitution only. The frame counter is clocked at the start of vertical sync (`$0F8`) [CM:399], [MAME neogeo_spr.cpp:140-147]; Geolith clocks it at `$100` (C21). ### When the sprite list for a line is built | Source | Parse for line N | Render | Output | | --- | --- | --- | --- | | [HYPOTHESIS: was wiki Rendering logic] (page marked draft) | during N-2 | during N-1 | N | | MacDonald | "the next scanline"; line buffers swap every line | | | | Geolith | 2 lines ahead | | | | MAME | at the start of N | at the start of N+1, from end-of-line VRAM | | So MAME sees raster-time VRAM writes about two lines later than hardware would, and its header admits raster effects "off by a couple of lines" [MAME neogeo.cpp:26-27] (C23). Lists alternate `$8600` (even) and `$8680` (odd) by line bit 0 [CM:775-777], [MAME neogeo_spr.cpp:293-297]. Hardware-confirmed: Master of Syougi's title reflection starts one line late [Geolith NONBUGS]. **Provisional** (C23, open for Aubrey): until 2026-11-26 the board was to follow the wiki's two-line pipeline, the only one with a mechanism behind it; that mechanism is now a hypothesis, Geolith (which credits the wiki) also parses two lines ahead, and mosyougi stays the test that must decide it. ## Fix layer - Map word at `$7000 + 32 x column + row`: palette bits 15-12 (palettes 0-15), tile bits 11-0 [CM:700-723], [SNK p17-18]. NTSC shows rows 2-29; PAL all 32 [SNK p18]. SNK's safe area is 38 x 28. - S ROM tile: 32 bytes; byte `tile << 5 | half << 4 | column << 3 | line` with half 1 = left; each byte holds two pixels, low nibble left; pixel pairs 0-3 at byte offsets `$10, $18, $00, $08` [MAME neogeo_spr.cpp:262]. - **Drawn in real time, in step with the raster, never buffered** [CM:731-732]. The map is fetched per half tile in the slow VRAM's fourth slot; data is latched about 32 mclk (8 pixels) before display, so a write 26-28 mclk before display changes only the other half [CM:731-746]. Both detectors draw a whole fix line at once. Hardware-confirmed artifact: the fix's top-right corner is slow to update (MVS system ROM boot screen; samsho4/5 transitions) [Geolith NONBUGS]. - **Source**: latch bit 5 picks the board's SFIX (`$3A000B`) or the cartridge's S ROM (`$3A001B`) and, with it, SM1 or M1 for the Z80; reset picks the board's [CM:175], [MAME neogeo.cpp:1133-1138]. The AES has no SFIX. - **NEO-CMC fix banking** (cartridge, [cartridges.md](cartridges.md)): the S data is taken from the end of the C ROM; the bank (2 bits, inverted) comes from VRAM `$7500-$75FF`, which the LSPC reads during blanking. Type 1 (per line; garou, mslug3, mslug4, most CMC42) and type 2 (per tile; kof2000, the PVC games, kof2002 class): MAME's algorithms [MAME neogeo_spr.cpp:211-236]. Geolith copies them from MAME, so it is not an independent detector here. How the bank bits reach the cartridge is unknown (no source read here says); Metal Slug 4's advisory screen shows wrong banking on hardware [Geolith NONBUGS]. ## The timer (IRQ2) - A 32-bit down counter at the 6 MHz pixel clock; reload register `$3C0008`/`$3C000A` [CM:451-453], [SNK p7-9]. **Period = reload + 1 pixels**: `$17F` gives one per line, 384 x 264 - 1 one per frame [CM:505-506], [SNK p8], [MAME neogeo.cpp:762]; Geolith counts one pixel short (C17). Longest period about 11.9 minutes. - Mode bits (`$3C0006`, effective at once): 4 IRQ enable; 5 load the counter when `$3C000A` is written; 6 load at the frame point; 7 load on underflow. Without bit 5 a reload write waits for 6 or 7. SNK's recipes: `$9x` periodic, `$Dx` chained positions; never reload with 0 [SNK p8]; keep it above 4 or the CPU floods [HYPOTHESIS: was wiki Timer interrupt]. - **Frame reload point** (C3): MacDonald measured line `$1F0`, **1146 mclk after /HSYNC rises** (active pixel 257, 252 mclk before /HBLANK falls) [CM:463-481]; MAME and Geolith use 1146; SNK says "beginning of the horizontal blanking of the first vertical blanking line" [SNK p8]. Follow the measurement. - The pending flag sets at underflow if bit 4 is set then [MAME neogeo.cpp:818-835]. The 68000 starts the handler 70-88 CPU clocks later (17.5-22 pixels to the right), the spread being the acknowledge cycle (C6) [CM:582-584]. - After an underflow without bit 7: MAME stops the timer, Geolith wraps to `$FFFFFFFF` (U-list). - **PAL stop** (`$3C000E` bit 0, LSPC2): stops the counter in PAL for "32 lines (18,432 pixels)" by SNK's own two numbers, which disagree (48 lines) [SNK p9]; the first and last 16 lines is [HYPOTHESIS: was wiki Timer interrupt]; both detectors ignore it (C18). lstbld2 and samsho3 clear it when they see PAL [MAME neogeo_v.cpp:192-195]. - **Vblank IRQ1** at line `$1F0`, 58 mclk after /HSYNC rises, before the frame reload ([interrupts.md](interrupts.md)); Geolith raises it a line later, after the reload (C22). ## Palette and the dark bit - 2 banks of 4096 words at `$400000-$401FFF` (mirrored to `$7FFFFF`), bank by latch bit 7 (`$3A000F` bank 0, `$3A001F` bank 1), switchable at any time [CM:177, 194-195]. Byte writes store the byte in both halves (/WE tied) [HYPOTHESIS: was wiki Palettes]; Geolith writes one lane; MAME's handler takes no byte mask [MAME neogeo_v.cpp:95-98] (C25, **provisional**, open). SNK: word or long accesses only [SNK p12]. - Word: bit 15 **dark**, bits 14/13/12 the lowest bit of R/G/B, bits 11-8 R4-R1, 7-4 G4-G1, 3-0 B4-B1 [CM:198-202], [SNK p21], [MAME neogeo_v.cpp:100-103]. - Entry 0 is shown during horizontal blank (use `$0000` or `$8000`); entry `$0FFF` is the backdrop [CM:214-234]. Fix uses palettes 0-15, sprites 0-255 [SNK p21]. - **DAC** [CM:248-270]: each 5-bit component through a '273 latch and resistors 3.9 k (LSB), 2.2 k, 1 k, 470, 220 (MSB); the dark bit pulls down through 8.2 k via a 74LS05 open collector; the shadow latch (`$3A0011`) pulls down through 150 ohms. MAME's model [MAME neogeo_v.cpp:23-65]: `V = sum(1/R over set bits) / (sum(1/R all) + dark/8200 + shadow/150)`, scaled so 31 without dark or shadow is 255; dark is x0.986, shadow x0.557. MacDonald saw `$8000` as "a slightly darker black than `$0000`", which the ideal model cannot produce (U-list). The MVS DAC drives the JAMMA edge with no amplification [CM:262-264]; AES output divided by about 4.1 and MVS levels of 0-3.5 V are [HYPOTHESIS: was wiki Video DAC]. - **Compare pictures at the palette word, not at RGB**: the conversion is a model; the 16-bit word per pixel is what the hardware decides. - **CPU access during display**: the CPU wins; the pixel being output shows the word the CPU accessed [CM:236-241]. Neither detector models it; the board should (U: how many pixels). ## Composition Back to front: backdrop `$0FFF`, sprites in list order, fix [SNK p6], [CM:232-234]. Two line buffers, one drawn while the other is shown, swapped every line [CM:844-848]. Their inner workings are [HYPOTHESIS: was wiki Line buffers, Rendering logic]: two pairs (even and odd pixels), 12 bits per pixel (palette and index); pixels written two at a time; transparent pixels clock the pointer without a write, shrink-dropped pixels do not clock it; LD reloads the X pointer for each sprite that is not chained; the buffer being output is cleared to the backdrop. **LSPC-A0 + PRO-B0/C0 versus LSPC2-A2 + NEO-B1**: the only differences software can see are LSPC2's PAL ability, the status bit 3 and `$3C000E` [SNK p4, p9]. No timing difference is documented (U-list). ## Test material Functional: the diagnostics BIOS (palette, VRAM, MMIO, video DAC, a CPU/PAL address test whose dots appear on hardware and not in MAME: its `docs/tests/68k/cpu_pal_addr.md`). Timing: none with published hardware results; the hardware-confirmed behaviours in Geolith's NONBUGS (mosyougi one line late, samsho4 block vanishing at the sprite limit, the fix corner lag, mslug4 fix banking, Super Sidekicks 2 field, Shock Troopers 2nd Squad top-line corruption, Ninja Commando panels) and the games MAME names as probes (mosyougi, sdodgeb, zedblade: line counter; trally, samsho3: PAL bit; lstbld2: `$3C000E`; turfmast: timer) become the video smoke list.