MAME Emulation Gaps
MAME Emulation Gaps
The KN5000 driver boots, plays and runs its UI. What it cannot do is start the way real hardware starts or install a firmware update from a floppy — and those two are the same problem seen from two ends, because everything the update path touches is also everything the first-stage bootloader owns.
This page inventories what the emulator does not model, distinguishes what is a fidelity defect from what is merely a shortcut that happens to land in the right place, and gives the order in which the three prerequisites have to be built. The KN7000’s gaps in the project’s overlay emulator are in their own section, KN7000: the overlay emulator.
Every claim here was checked against the MAME sources in
kn7000_mame/src/andmame/src/in August-September 2026 (IC19: 2026-09-05). Unless a row says otherwise, “MAME” below means thekn7000_mameoverlay build. Mainline MAME’skn5000lacks more: its floppy controller is instantiated but not mapped into the main CPU’s address space, IC19 is a plain.rom()region, the tone generator, keybed and DSP1 arenoprw()stubs (it is flaggedMACHINE_NO_SOUND), and no MIDI port is wired. Line numbers drift; the file and symbol names are the durable part.
What the emulator does today
| Aspect | Hardware | MAME | Verdict |
|---|---|---|---|
| Address decode | six programmable chip-select blocks | registers stored, never consulted | not modelled |
| Reset entry | table-data bootloader at 0xFFB4E8 |
program flash at 0xEF03C6 |
wrong path, right end state |
| Program flash IC4/IC6 | writable flash pair | .rom() region |
not modelled |
| Table data IC1/IC3 | mask ROM or flash — unresolved | .rom() region |
unknown |
| Custom data IC19 | AM29F400/800B-family flash | amd_29f800b_16bit flash device |
modelled — JEDEC autoselect returns device ID 0x2258 |
| FDC | µPD72068GF | UPD72067 device |
approximation |
| Floppy formats | 1.44 MB PC-format discs | MFM containers only, no FLOPPY_PC_FORMAT |
cannot mount .img |
| Sub-CPU DRAM strap | Port G bit 0 selects chip-select-3 sizing | hardcoded, sub-CPU port G unimplemented | one variant silently chosen |
| Region code | 4 values on a two-pin strap | AREA dip offers 3 |
Region 4 unreachable |
| HD-AE5000 window | firmware treats 0x280000 as banked |
flat 512 KB .rom() |
possibly a superset never exercised |
Gap 1 — the FDC and its disc formats
The cheapest blocker, and the one that gates any end-to-end test.
kn5000.cpp registers the floppy connector with
floppy_image_device::default_mfm_floppy_formats. That helper calls
format_registration::add_mfm_containers(), which, with the base registration, gives
MFI/DFI/MFM/TD0/IMD/86F/D88/CQM/DSK — and not FLOPPY_PC_FORMAT. Only
add_pc_formats() adds that. So the driver cannot
open a raw 1.44 MB .img, which is exactly the form every archived Technics update disc
takes. Mainline moved the drive to 35hd and added a kn5000_flop software list in
#16415 (merged 2026-10-13), but kept
default_mfm_floppy_formats. It therefore cannot mount its own list: every entry is a raw
1,474,560-byte .img, and a build with mainline’s floppy lines stops with “Unable to
identify image file format” on -flop1 idd5000. Mainline’s FDC is also still unmapped
(//FIXME at 0x110000/0x120000 in maincpu_mem).
Switching to default_pc_floppy_formats is a one-line change and is a prerequisite for
everything below.
Second, smaller issue. The driver instantiates UPD72067 with the comment that the
real part is a µPD72068GF-3B9. MAME’s own precedent for a 72068 is elsewhere
(akai/mpc2000.cpp uses UPD72069 with the comment “actually UPD72068, which is
software-identical”). The two device classes differ in auxcmd_w: upd72067_device
switches on data & 0x0f and its source comment says only the minimum needed for one
other driver’s diagnostic was implemented, whereas upd72069_device decodes the full byte
including the “control internal mode” data-rate command. Whether that matters here is
unmeasured — it depends on which aux bytes the KN5000 firmware actually writes to
0x110008, and nobody has logged a boot with a disc operation. Graded strong that the
device choice is questionable, undecided whether it is load-bearing.
Gap 2 — real flash devices
Three flash populations exist on the main board. IC19 (custom data) is a real flash
device; the program and table-data pairs are .rom(), by design.
| Window | Devices | Bus | MAME |
|---|---|---|---|
0x300000-0x3FFFFF |
IC19, one ×16 part (or two on Region 4) | 16-bit | amd_29f800b_16bit flash |
0x800000-0x9FFFFF |
pair of ×16 dies (table data) | 32-bit | .rom() |
0xE00000-0xFFFFFF |
pair of ×16 dies (program) | 32-bit | .rom() |
IC19 is an exact-match device. amd_29f800b_16bit_device is 0x100000 bytes, 16-bit,
manufacturer MFG_AMD, device ID 0x2258 — the right size, the right bus width, and an ID
the KN5000’s Flash_IdentifyAndValidateChip explicitly accepts. Its AMD command decoder
accepts the address form the firmware emits: the firmware unlocks at base + 0xAAAA and
base + 0x5554 (byte) = word 0x5555/0x2AAA, and intelfsh.cpp matches on
(address & 0xffff) == 0x5555 / 0x2aaa. With the device in place, Flash_InitAllBanks’s
boot-time JEDEC autoselect stores a valid device ID (0x2258) at DRAM 0x0205E0 instead of
the 0xFFFF a .rom() region reads back — the prerequisite for the firmware-update path.
(FUJITSU_29LV800B, ID 0x225b, would be rejected by this firmware, so the wrong
device silently breaks chip identification.)
The program and table-data pairs stay .rom() on purpose. Only custom data carries a
JEDEC ID the resident firmware consumes. Flash_InitAllBanks runs the autoselect on
table data too but reads and discards the result, and the program flash is never put
in command mode by resident firmware (the floppy updater reaches it by a different path).
Converting either would add regression risk for no boot-consumed benefit.
A trap for whoever extends this to the other two. Preloading an
intelfsh16device from a ROM region byte-swaps the contents.nvram_default()readsm_region->as_u16(offs/2)and stores it big-endian (m_data[offs] = v >> 8), whileread_raw()returnsm_data[offset*2] | (m_data[offset*2+1] << 8). AROM_REGION16_LEpreload of the IC19 dump therefore reads back wrong.
Open question that changes the shape of the work: are IC1/IC3 mask ROM or flash? The
service-manual parts list calls them ROM, but IC4/IC6 (program) and IC19 (known flash) all
share the same house number QV1GFKN5KAX1, the firmware has erase/program/verify handlers
targeting 0x800000, and the update-disc catalogue includes “Table DATA FILE” types.
Graded plausible, unresolved — and worth asking someone who can read the chip markings.
Is IC19 a top-boot or bottom-boot part? The firmware accepts both. MAME’s 16-bit AMD device is bottom-boot, so a drop-in gives bottom-boot geometry; the distinction only matters once the firmware starts erasing.
Gap 3 — the dynamic memory map
tmp94c241.cpp stores MSAR, MAMR and BnCS and never consults them: bNcs_w() is a
bare COMBINE_DATA, mamr_w/msar_w are plain assignments, and the members appear only in
the constructor, save_item(), device_reset() and the accessors. device_reset() fills
the arrays with 0xFF and sets m_block_cs[2] = 0x1000; //FIXME!. BnCSL/BnCSH are
mapped write-only, BEXCS is not mapped, and the DRAM-controller/PMEMCR registers at
0x160–0x167 are not mapped at all — so those firmware writes fall through the internal
map into the driver’s work DRAM.
The consequence for the KN5000 is that reset reads the vector from program[0x1FFF00] and
control starts at 0xEF03C6. The table-data first-stage bootloader never executes.
Everything reachable only through it is dead code under emulation: the boot FDC driver
(0x9FD8A5–0x9FEA9C), the 16-bit flash routines (0x9FB812+), Boot_DetectDiskType
(0x9FBFC4), Boot_CheckDiskPresent, Boot_ProbeExternalDevice and the whole boot
CP-serial stack — none of which any regression would ever catch a mistake in.
The static map happens to equal the post-handover steady state, so this is accidentally
correct rather than actively wrong. One known deviation: only the upper of the program
flash’s two mirrors is modelled; the 0xC00000–0xDFFFFF mirror that the reconstruction
predicts is absent. (A cheap check before relying on the “accidentally correct” framing:
scan both 2 MB images for 24-bit immediates in 0xC00000–0xDFFFFF.)
What implementing it would take
Do not build a full chip-select decoder yet. The exact MSAR/MAMR decode rule is
not established — no datasheet exists on this project’s machines, and two mutually
incompatible calibrations were each reported as confirmed before the contradiction was
noticed. A decoder built on the wrong rule will not reproduce the one behaviour that
matters. See
TMP94C241 Memory Controller.
The one behaviour that matters is a single 4 MB window swap at the boot handover. A
memory_view with two states — table-data-high and program-high — reproduces it without
committing to a decode rule, and is the pragmatic option.
Two things will need rework when it lands:
- The driver already performs runtime installs:
machine_start()callsm_extension->program_map(m_maincpu->space(AS_PROGRAM)), and the HD-AE5000 card doesspace.install_device(0x000000, 0x2fffff, …)against the root space. If any of that range becomes the interior of a view it will be shadowed, and the install must move into the view slot or be re-applied on every switch. - The interrupt vector table is ROM-resident at
0xFFFF00and is never copied to RAM, so it swaps identity with the ROM. The view has to switch code and vectors atomically; a bootloader interrupt taken one cycle late would dispatch into the wrong ROM.
Resolve this contradiction first
There are two complete copies of the flash-update subsystem — one in the table-data
bootloader around 0x9FA000–0x9FFFFF, one in the program flash — and each can only
program the chip the other executes from. That is a natural consequence of the single CS2
swap: pre-handover 0x800000 is the program pair, post-handover it is the table pair.
But the program-flash copy of the type-007 handler decompresses stream 1 (the 2 MB main
program) to 0x800000, which post-handover is the table-data pair. Either that handler
is unreachable in practice — updates always enter through the bootloader, which owns the
boot FDC driver — or a second remap exists that nobody has found. The update gate (Gap 3.5)
favours the first: in the program flash the type-007 handler is reached only through
FLASH_MEM_UPDATE, whose one caller (BootInit_SeqAndPanel) needs 0xFFFFE8 to read
0xFF, and the v7, v9 and v10 program images hold their version byte there. Settle this
before designing the view, because a second remap would change its shape.
Dependency order
[1] FDC container formats (one line; nothing else can be tested without it)
│
├──> [2] IC19 flash device -- in place (amd_29f800b_16bit); the
│ 0x800000/0xE00000 pairs stay .rom() by design (see Gap 2)
│ │
│ └──> [4] run a type-007 install end to end from
│ kn5000_v10_disk.img, and diff the resulting
│ IC19 image against the predicted post-install
│ content (93,203 B stream + 68 x 0x00 + 37,801 x 0xE5)
│
└──> [3] update-mode entry (see below -- the real blocker)
[5] dynamic memory map (memory_view, two states)
- also a prerequisite for [4], short of patching the version byte:
the program flash's updater (FLASH_MEM_UPDATE) has one caller,
behind a test that 0xFFFFE8 reads 0xFF -- true only of the
table-data image; under the static map it reads the program's
version byte (v10: 0x0A)
- IS a prerequisite for a faithful cold boot and for exercising the
bootloader's own copy of the updater
- blocked on: resolving the two-updaters contradiction above, and
ideally on obtaining the TMP94C241 datasheet
Gap 3.5 — entering update mode is the real unresolved blocker. The update path is gated
on a sentinel byte at ROM 0xFFFFE8 being 0xFF (read by Get_Firmware_Version, 0xFFFEE5;
tested in Boot_RunSelfTest, 0xEF0529, and again in BootInit_SeqAndPanel, 0xEF05B5,
just before its call to FLASH_MEM_UPDATE), on a disc change, and on a panel button
combination held through power-on. Only the table-data image holds 0xFF at that offset: in
the program images byte 0x1FFFE8 is the version number (0x07, 0x09, 0x0A for v7, v9,
v10), which is why the disassembly names the 0xFF branch
We_seem_to_be_running_boot_ROM_code. Under MAME’s static map 0xFFFFE8 always reads the
program image, so this gate is closed in emulation whatever is held. The button combination
is known: combo 4, all four PANEL MEMORY buttons (CPanel_CheckSpecialCombos tests
CPR_SEG6 == 0x0F; see Test Modes). How to hold them from
reset through the HLE’d kn5000_cpanel_device is not established.
Even with all of that, the boot path has further gates that MAME cannot currently reach:
Boot_CheckDiskPresent (Port D bit 6, active low), BootSerial_Init, and
Boot_ProbeExternalDevice returning code 4. Despite its name it probes no external device: it
is the bootloader’s copy of the same power-on combo check, run on its own poll of the panel,
and it returns 4 only when PANEL MEMORY 1-4 are held (its copy of CPR_SEG6, at 0x1028,
reads 0x0F). So the HLE panel has to report the combination above to the bootloader as
well; see Boot CP-Serial Link.
Secondary gaps
- Region 4.
Detect_Region_Codereads Port H bits 2 and 1;00= Region 4. The driver’sAREAdip offers only0x02/0x04/0x06, so Region 4 has never run under emulation. Its branches assume the IC19 slot holds two 512 KB devices with a+0x80000command base, and skip the HD-AE5000 factory init. Deferrable (the default is not Region 4) but it should be recorded in the driver. - Sub-CPU DRAM strap. Port G bit 0 selects
MAMR30x1F/0x0FandB3CSH0x8A/0x89— a genuine two-board-variant DRAM configuration. MAME hardcodes 1 MB at0x000000and does not configure sub-CPU port G at all, so the emulator silently picks one revision. - Sub-CPU CS2 window. MAME maps IC30 as 128 KB at
0xFE0000. Under one reading of the decode rule the CPU’s own chip select covers only 64 KB at0xFF0000— and all 4,352 non-0xFFbytes of the dump lie in that upper 64 KB, while the 2 KB read at0xFE0000came back blank. Worth confirming against the schematic before the full re-dump, because it bounds how much of IC30 can matter. - HD-AE5000 window banking. The firmware programs
0x280000in 8 × 128 KB banks selected through the 8255 PPI at0x160000, and reads anhkt_signature at0x2FFFC0with bank 7 selected.hdae5000.cppmaps a flat read-only 512 KB with no bank register. Possibly a superset never exercised in normal operation; unverified. - Bus widths.
BnCSHalso carries per-block data-bus width. MAME’s TLCS-900 core fixes the external width for the whole space viam_am8_16, and the KN5000 driver never callsset_am8_16for either CPU. Whether any block is genuinely 8-bit, and whether it matters, is unmeasured. -
Keybed service test modes: not established. The factory keybed diagnostics (Tests 3–8, mode codes
0xF5–0xFC) are entered by holding one key pair at power-on;SelfTest_FirmwareVersionCheckasks the sub-CPU for the held-key bitmap over the inter-CPU link (command0xF002) once the payload is running, and only Test 4 needs the checking device. Under emulation the sub-CPU sees the keybed throughkn5000_tonegen_device’s event FIFO (push_keybed_event,m_keybed_queue), whichkeybed_scanfeeds every millisecond from machine start; whether the sub-CPU’s reply then reflects keys held from power-on has not been measured, and no keybed test mode is on record as entered. These self-tests are among the cheapest fidelity evidence available, so one measured run settles it. See Test Modes. - Most voices are silent, every drum kit is, and an organ’s note does not end. Three of the four
wave ROMs are undumped (their sockets hold copies of IC307). Measured 2026-10-23 with a converter
that plays one note per voice (technics-anotherworld
kn5000cnv,SND_TEST=1): of 66 voices, about twenty are heard (the pianos, Electric and Mute Bass, Glockenspiel, Steel Drum, Sleigh Bell, Halo Pad, Sine Lead, Dream, Kalimba, Agogo, Wood Block, Taiko, Synth Drum, Seashore, Gun Shot, the organs); no drum key sounds on the rhythm part or on the MIDI drum part with either kit; the Chapel Organ’s note goes on after its note-off. The first two follow from the missing ROMs; the third has not been looked into. - IC311’s return is not mixed. The effects DSP’s core is left out of the default build
(
KN5000_ENABLE_DSP1=0), and even with it in, its wet return into IC303 is not wired: nothing it computes is heard. Any work on programs of ours for the chip needs this first (research plan, Q9).
Acceptance tests worth writing
Two of these are exact and mechanical, which is unusual and worth exploiting:
- Install replay. Boot with
kn5000_v10_disk.imgin the drive, run a type-007 update, then dump0x3E0000–0x3FFFFFand compare against the predicted post-install image: 93,203 bytes of SLIDE4K stream, 68 bytes of0x00, 37,801 bytes of0xE5. Any deviation is a bug in the emulated flash or FDC, not an interpretation dispute. - Bootloader liveness. Once the memory view exists, assert that the CPU executes at
0xFFB4E8before0xEF050F, and that a read of0xFFFEDCreturnsFF FF FF FFbefore theMSAR2store and1B 0F 05 EFafter it.
KN7000: the overlay emulator
The project’s own build of the KN7000 is the kn7000_mame overlay. Its published binary is
kn7000-emulator/kn7000, md5 06334896…, from kn7000_mame 7ad5627 (2026-10-21). The overlay
keeps a living list of what it still lacks, OVERLAY-GAPS.md in that repository, and the items
below come from it. Mainline MAME’s kn7000 has none of the sound work: it is
MACHINE_NO_SOUND, without a tone-generator voice engine or an effects DSP.
Closed on 2026-10-20, each against a measurement on the owner’s unit:
| gap (OVERLAY-GAPS item) | what the overlay does now | evidence on the unit |
|---|---|---|
| voices on placeholder samples (G13) | the KN7000’s voices play the four dumped wave ROMs: the 20-bit select, the page directories, the pitch law (Sound Subsystem) | the wave ROMs read twice, sums as the firmware expects |
| the board strap (G13) | answers 0xF8F7, hardware subtype 2; it read 0x9406 before, and subtype 5 before that, which sent every voice to the expansion range |
pass 9 |
| DSP reads of MSGR registers (G4) | the kernel’s reads of MSGR0-7 return what was written; before, the mic reverbs’ ring-3 pointer became 0 and a SPORT transfer block was zeroed | pass 7 (MSGR2 moves; the TCB survives) |
| the 1 kHz tick and the DSP handshake (G20) | the tick is timer 4 as the firmware programs it; the group-0x17 handshake comes once per DSP frame; FLAG3 is high on every other frame | pass 8 (44.1 kHz, one handshake per frame) |
| SPORT DMA registers (G20) | DMASTAT, each ring’s index and count, and the transmit status read live, at the unit’s phase | pass 6 |
| CPU timing (G22) | 64 MHz, per-instruction cycles, a fetch queue, 4 KB instruction and data caches (their timing), per-chip-select bus costs; CHCTR and MEMCTR read back | pass 9 (99 of 109 tests within 3 %), pass 8 |
| the floppy’s last byte (with G22) | IRQ1 is raised again for a sector’s last byte, which MAME’s 82077 delivers without a DMA request edge; at the real CPU speed STYLE CONVERT could not load otherwise | the unit loads from floppy |
| IC23 (G6) | a 256 KB battery-backed NVRAM repeating every 256 KB; panel memories survive a session that ends with the machine’s POWER OFF input | pass 5 (the 256 KB repeat) |
The timing work shows. Another World’s speed build plays its intro at 17 frames per second in the overlay, with its speed display on, where it used to run at 38. The KN7000 audio oracle of the overlay’s gate moved with each change and was re-baselined each time.
Closed on 2026-10-21: the effects DSP’s clock (G5). The overlay ran the ADSP-21065L at 66 MHz; it now runs it at 60 MHz. The part is the 60 MHz grade, and the SDRAM refresh divisor the kernel writes (SDRDIV 930, with its IOCTL’s CAS latency 2 and tRP 2) is the manual’s own worked example for a 30 MHz CLKIN, which the chip doubles. This comes from reading, not from the unit: a timer probe on the DSP (E3, below) would measure the clock. The gate’s audio oracle did not move, DSPTONE’s MAME test passed 10 of 10, and Another World’s DSP mode gave the 66 MHz run’s event log line for line.
Closed on 2026-10-26 and 2026-10-27, each against a probe of the Pinball Fantasies port or the ROM survey on the owner’s unit (program 893; Display Subsystem, memory map):
| gap | what the overlay does now (kn7000_mame commit) | evidence |
|---|---|---|
| the LCD’s start address and line offset | the controller’s view follows them, fetched backwards from the bottom-right word (180-degree SwivelView; bddb979, 2c1cdd8) |
PFT14: the picture upright, scrolling |
| the LCD’s ink layer | the 2-bit overlay at 0x140000 − n × 8 KB (38647a4, c562a75) |
PFT17 |
| the LCD’s display memory | 1280 KB, an S1D13806’s: from 0x9CF40000 reads return 0xFFDF and writes are dropped (c562a75) |
PFT16, PFT17 |
| the LCD’s non-display period | an 888 × 256 dot frame, as LcdControllerInit sets it; REG[03Ah] bit 7 reads 1 in its 16 non-display lines (318d44b) |
the manual (the unit differs: below) |
| the LCD’s 8 bits a pixel | REG[040h] bits 2-0 = 3 through the 256-entry look-up table, 4 bits a primary (0678562) |
PFT15 |
| the panel’s ATN during a firmware burst | raised only after the CPU has sent nothing to the panel for 300 µs; before, a mid-burst ATN could lose every later button (c5392ca) |
program 893’s code |
| the library SRAM and the work DRAM | 256 KB repeating through CS3 and 4 MB through CS4, in both views; before, 16 MB of plain RAM at CS3 and nothing above 4 MB (4fe2f1f) |
PFT18 |
| CS5 and the top of CS0 (G7, G10) | open bus (0xFF) but IC21 and IC19 at all their copies, in both views (CS5 ignores A25); the service ROM test’s IC19 sum at 0x97800000 is right (798a164) |
ROM survey passes 4 and 5 |
The “noise” in MAME’s KN7000 sound is emulation speed, not wrong audio (kn7000_mame
notes/dsp-noise-2026-10-21/README.md, 2026-10-21). What MAME computes is clean: a -wavwrite
recording has no broadband noise and no clipping, and it is identical, md5 for md5, at any host
speed. What a listener hears is that stream played at the emulation’s speed. Below 100 % it comes out
stretched, flat (a C4 at 241 Hz for 261.5 at 60 % speed) and with a noise floor between the
harmonics 13-21 dB higher, with the DSP emulated or bypassed alike; at about 100 % the live sound
equals the computed stream. The owner listened to the computed recording of Another World’s intro in
the DSP mode and called it perfect. Where the host’s time goes on the project’s VM, in a window: the
window’s drawing about 56 %, the SHARC about 27 %, everything else 29 % (from separate runs, so they
do not add exactly). How to get closer to 100 % is below.
Still open (the full list, with sizes and states, is OVERLAY-GAPS.md):
- Effects DSP save state (G3). After a state load the effects freeze; a run on 2026-10-21 confirmed it. Trivial to fix (plan step S1).
- With REVERB on, MAME drops the dry sound. The bridge between the DSP and the DAC then plays unit 0’s return alone, and the reverb programs write only the wet signal. MAME’s output with REVERB on (the boot state) is 6-7 dB quieter than with it off: a held C4 7.2 dB under the same note dry, and every section of a MIDI file 6.0-6.5 dB, with the reverb’s pre-delay before the first sound. That the instrument keeps its dry sound rests on reading the firmware, not on a recording; one from the unit would settle it (plan D2, step S4, Help Wanted).
- The CHORUS unit’s return. The overlay mixes effect unit 9’s return only while CHORUS is on. The instrument mixes it whatever CHORUS is: the owner heard Another World’s DSP sound with REVERB and CHORUS both off (2026-10-21), so the overlay is wrong here (Effects DSP; plan D1, step S5). The level of every DSP return against the dry sound is uncalibrated.
Notes received over MIDI don’t stop.Fixed 2026-10-21 (G23, kn7000_mame7ad5627). It was not MIDI-only: the firmware polls the tone generators for which voices are still sounding (status addresses0xFC08 + g, 16 bits per group, and0xFC02 | slot<<4, a voice’s level, read back through the data port), and the emulator answered every such read with 0. So 43-82 ms after each note-on the firmware dropped the new voice as silent and, at note-off, had nothing left to release: a one-voice GM piano, strings or pad got no tone-generator write at all, and a two-voice note lost one voice early. The overlay now answers the status reads from its voice state and releases a voice on the firmware’s own key-off write (r0with low-byte bit 7 set, at that write’s rate). Measured after the fix (40 dB fall after the note-off, REVERB off): GM piano 0.36 s, strings 0.59 s, pad 0.89 s, organ 0.13 s, the keybed’s C4 0.32 s; CC 123 and CC 120 end every note. That “still sounding” reading is inferred from the firmware code, and the release-rate law is still a provisional fit (kn7000_mamenotes/tg-release-2026-10-21/README.md).- The rest of the effects DSP branch (G4). The other IOP registers still read 0 to the kernel, and the SPORT transfers still go through fixed ring slots, not the DMA. STCTL0’s sticky start-up underflow bit is not modelled. Host uploads go straight into DSP memory; the chip moves them through the EPB0 FIFO and DMA channel 8.
- The SHARC interpreter misses frames. MAME already runs the effects DSP under its recompiler
(DRC), which finishes all 44,100 frames a second, as the chip does. The interpreter (
-nodrc) checks for interrupts only once per time slice, so it takes the frame interrupt late and finishes about 11,800 frames a second; with REVERB on its sound is noise. That is the cause of the 22 % of samples by which the two differ (plan D11, step S15). Never pass-nodrcto the KN7000. - No switch to bypass the effects DSP (G19). It is still planned (step S2) for research, but it is not what removes the noise: bypassed, the sound is just as broken below 100 % speed.
- The power-on path (G9). The CPU really starts in IC18’s boot code at
0x40000000, with the flash updater; the overlay starts at the program flash. Interrupt vectors through IVAR (G8). - Cache contents. The timing model counts hits, misses and write-backs, but every access reaches memory, so a stale or dirty line cannot happen in MAME. A program that loads code without syncing the caches can run in MAME and fail on the unit, as one did on 2026-10-27 (the caches).
REG[03Ah]bit 7 on the unit. The overlay raises it for 16 of 256 lines, as the S1D13506’s notes describe. On the unit it read 1 before only 1 of 339 start-address writes, where that would give about 21; what the bit does there is open.- The LCD under load. The timing model uses pass 9’s clean LCD costs. On the unit the LCD is slower while the display runs (3-4 times, by Another World’s benchmark), so bulk LCD writes are still faster in the overlay than on the instrument.
- Instruction classes pass 9 did not time (jmp and call with 32-bit targets, bit operations, rti, trap, the extension unit, interrupt acceptance) use the manual’s counts or guesses.
- The SD sub-CPU IC401 (G21), the SD card read with no card selected (G14), the custom data byte order (G11).
Running it at full speed
The KN7000 needs 100 % speed for its sound to come out right. The published binary already runs the SHARC under the DRC at 60 MHz; on the project’s VM the window’s drawing is the biggest cost. Measured there on 2026-10-21, 60 emulated seconds each (“throttled” is as you play):
| setting | throttled | unthrottled |
|---|---|---|
-window alone |
69.8 % | 69.2 % |
-autoframeskip |
88.5 % | 67.8 % |
-view "Screen Block" |
68.6 % | 76.4 % |
-autoframeskip -view "Screen Block" |
92.6 % | 75.2 % |
-frameskip 10 -view "Screen Block" |
86.7 % | |
-autoframeskip -nofilter |
71.2 % | |
-video soft |
64.3 % |
So the best setting found is:
cd ~/compartilhado/kn7000-emulator
./run.sh -window -autoframeskip -view "Screen Block"
still short of 100 % on that VM. -autoframeskip skips drawing frames while the emulation is behind
(the screen gets jerkier, the sound does not), and it only acts while MAME is throttled, which is why
it gains nothing unthrottled. -view "Screen Block" draws only the LCD block of the panel artwork,
so the buttons outside it cannot be clicked. Two more to try: -audio_latency 2 to 4, a larger
sound buffer that rides out short stalls (the sound lags the keys a little), and -nofilter. Press
F11 to show the speed, or read “Average speed” when MAME exits. Repeat runs on the shared VM vary
by several points (-video none, throttled, read 98.5 % in one session and 84.8 % in another), so
compare settings in one sitting, on a quiet machine; your own host will differ.
Source: RUNNING-THE-BUILDS.md in the KN7000 repository, “Running the KN7000 at full speed”, which
also has tools/mame-speed/speed.sh, a script that measures a setting the same way every time on a
copy of the factory SD card, with its own cfg and nvram.
The effects DSP plan (2026-10-21)
The overlay’s plan for the KN7000’s effects DSP (IC306, an ADSP-21065L) is
notes/PLAN-2026-10-21-dsp-emulation.md in kn7000_mame. It is planning only, written for the owner to
choose from. Its reading of the present state:
- Faithful, by the unit’s passes 6-8: the downloaded code, the set-up registers, the 44.1 kHz frame rate, the per-frame handshake and FLAG3. DSPTONE and Another World’s mixer run on both the unit and MAME.
- Not faithful: everything between the SHARC and the DAC. The serial ports carry no data (the driver reads and writes fixed ring words once a frame), and a hand-tuned bridge mixes the returns with constants. Two errors are audible from it: the dry sound missing with REVERB on (D2), and unit 9’s return mixed only with CHORUS on (D1).
| phase | steps | state |
|---|---|---|
| 1, cheap correctness | S1 the save state (G3); S2 the bypass switch (G19); S3 60 MHz (G5) | S3 done and published; S1 and S2 open |
| 2, the two audible errors | S4 keep the dry sound with REVERB on (D2); S5 always mix unit 9’s return (D1); S6 return gains from the unit | open; S6 waits for the unit’s recordings |
| 3, the serial audio path | S7 one SHARC core with the upstream branch’s fixes; S8 SPORT DMA moving the words; S9 the tone generator owning sends and returns; S10 units 7 and 8 | open |
| 4, chip fidelity | S10a-S16: the memory map, status registers, timers, arithmetic, the interpreter’s interrupts (S15), the handshake from the DSP | open; several wait for a probe on the unit |
| 5, the other machines | S19-S21: the KN6000/KN6500 unit map and flags, the KN2400/KN2600’s inherited SHARC | open |
Its next steps, in order: S1-S3, then S4-S5 (each a small change in the bridge), then S8, S9 and S11-S14. Its experiments on the unit, cheapest first, all through the program menu’s route and undone by a power cycle: E2, a recording of a supplied MIDI file with REVERB off and on (no code; it settles D2); E1, an app that puts a different tone on every DSP transmit slot (which returns reach the DAC, at what gain); E3, a timer read every frame (the DSP’s clock and each effect’s cost). What it asks the owner to record is on Help Wanted. Decisions left to him include the bypass switch’s default, the reference for the SHARC core (the overlay or the upstream branch), and whether the core fixes go upstream ahead of the tone-generator pull request.