# Cartridges, the BIOS, the RTC and power Sources as in [start-here.md](start-here.md): **JT** Judge's ngpctech.txt, **T11** Gollum's tech-11.txt, **ares** `6e67c8b` (ISC, tier 5, OBSERVED), **MAME** 0.285 (closed box), the No-Intro census ([census.md](census.md)). ## Cartridges - **Flash, not mask ROM**: games are on flash chips of 4, 8 or 16 Mbit; a 32 Mbit game uses two 16 Mbit chips, the second at 800000 (T11; ares cartridge/flash.cpp; the census: sizes 512 KiB, 1, 2 and 4 MiB, the 4 MiB images being the two-chip games such as Densha de Go! 2, Metal Slug 2nd Mission and SNK vs. Capcom - Match of the Millennium). - **Saves are written into the cartridge's own flash** through the BIOS (no separate SRAM or EEPROM): the board must model the flash chip's command set (read ID, program, block erase, protect), and a save file is the flash image or its changed blocks. - ares models a JEDEC-style flash: `ReadID` returns vendor 0x98 (Toshiba) and device 0xAB / 0x2C / 0x2F for 4 / 8 / 16 Mbit, then 0x02, 0x80 ("unknown purpose"); blocks of 64 KiB with the top 64 KiB split 32 + 8 + 8 + 16 KiB (a boot-block layout). Its comments mark the address mask, ID-mode reads past offset 3, erase versus protect and invalid block ids as unknown. Sharp (0xB0) and Samsung (0xEC) parts are named in its comments as other vendors. Which chips real cartridges carry, and whether the BIOS accepts every ID, is U8. - **Header** (first 64 bytes; JT, checked against all 137 No-Intro cartridge images by `scripts/census.py`): 0x00-0x1B licence string, either "COPYRIGHT BY SNK CORPORATION" (33 images) or " LICENSED BY SNK CORPORATION" (104); 0x1C-0x1E the entry point (all in 200000-3FFFFF; KOF R-1 & Melon-chan demo starts at 300000); 0x20-0x21 catalog number; 0x22 sub-catalog (version); 0x23 colour mode (00 monochrome, 10 colour); 0x24-0x2F title. The BIOS checks the licence string (U9: which strings it accepts). - Census oddities: the NGPC folder holds one monochrome-mode prototype (Cool Cool Jam (USA) (Proto), catalog 1234/A1) and the BIOS itself as a No-Intro entry (`[BIOS] SNK NeoGeo Pocket Color (World) (En,Ja)`, same SHA-1 as MAME's `ngpcbios.rom`); the NGP folder holds three BIOS entries (the MAME image, a beta and a "(Monochrome)" variant). ## The BIOS - 64 KiB at FF0000 (JT, T11, MAME). Four images are known: the NGP's (MAME `ngp`), an NGP beta, an NGP "(Monochrome)" variant (both No-Intro only) and the NGPC's; SHA-1s in [census.md](census.md). Never fetched or committed; the player supplies it, identified by SHA-1. - It boots the machine (MAME: the NGPC BIOS starts at FF204A after reset), shows the setup screens (language, then date and time on first boot: MAME showed the NGP's language screen at 10 s), checks the cartridge, copies a Z80 program into shared RAM and starts the Z80 (JT), and offers system calls: a jump table at FFFE00 and `SWI 1` with parameters in register bank 3 (JT lists vectors 00-13 with guesses: flash writing, link-cable send and receive). - Games install interrupt handlers in the table at 6FB8-6FFF; the BIOS's own handlers run first and call the game's (JT). - Power: the machine halts at power-on until the power button is pressed (ares cpu.cpp: "real hardware boots once batteries are connected and goes into a halt state"; MAME stayed blank until its `:Power` input was set). The BIOS powers the machine down through the SoC (U10: the shutdown and resume path, the "resume" state games can use). - **HLE**: ares has a "Fast Boot" option and MAME needs the real BIOS. An HLE BIOS would be a functional model of SNK's program; the real BIOS is the default here and an HLE is open decision 4. ## The RTC In the SoC's I/O window (ares cpu/io.cpp and rtc.cpp): 0x90 enable, 0x91-0x96 year, month, day, hour, minute, second in **BCD**, 0x97 weekday (bits 0-3) and year mod 4 (bits 4-7); it ticks once a second of CPU time with BCD carries. "It is unknown what happens when invalid BCD values are fed into the RTC" (ares). Whether the RTC has an alarm or interrupt, and its registers above 0x97, is not in any source read: U11. The board's RTC follows the host's clock only through the save state (a deterministic tick from the board's own time), never the wall clock during emulation. ## Link cable and other I/O Serial channel 1 (JT: vectors 0B, 0C send/receive) and the link cable to another NGP or a Dreamcast (games like SNK vs. Capcom); input from the controls register (JT 6F82 is the BIOS's copy; MAME's `:Controls` port: Up, Down, Left, Right, A, B, Option). The link cable is a socket for a later milestone.