← All cores
BraveBlade (kyledlester)
Notes where it differs from MAME — 1
- README.md:178 **Song start timing** can differ from MAME by one tempo tick (8 ms).
Cites MAME source — 89
- source/ZN1.sv:1013 Real hardware enforces these; MAME's interpreter may not.
- source/ZN1.sv:1379 MAME routes the PSX SPU at 0.35 and the YMF271 at 1.0 (full scale = YMF mix/4, which ymf_l/ymf_r already are).
- source/rtl/zn1_io.vhd:91 build #117b: store the full znsecsel byte for verifiable readback (MAME returns whatever was written).
- source/rtl/zn1_io.vhd:149 Real AT28C16 returns inverted bit 7 during 200μs write cycle (per MAME at28c16_device::read).
- source/rtl/zn1_io.vhd:205 MAME at28c16_device::write(): the busy/data-poll window (and the write) only engage when the new byte DIFFERS from what is stored (read_byte(offset) != data).
- source/rtl/zn1_io.vhd:275 Per MAME: read returns m_last_write XOR 0x80 during write-in-progress.
- source/rtl/zn1_io.vhd:299 build #115: initialize EEPROM BRAM to 0xFF (AT28C16 factory state per MAME nvram_default).
- source/rtl/zn1_io.vhd:398 0x060000 zn2_spu_hack (MAME toggles bit 3 each read)
- source/rtl/zn1_io.vhd:401 MAME: noprw/nopr returns 0 for unrecognised ZN I/O addresses
- source/rtl/zn_sio.vhd:9 sec_select[2:0] = {data_write[7], data_write[3], data_write[2]} from BIOS write to 0x1FA10300: sec_select="000" (0x00: bit3=0,bit2=0) → BOTH chips active (wired-AND TXD) ← Tecmo BIOS sec_select="101" (0x84: bit7=1,bit3=0,bit2=1) → KN02 onl
- source/rtl/zn_sio.vhd:34 ZN security select (from zn1_io register 0x1FA10300) [2]=data[7], [1]=data[3], [0]=data[2]; ZNMCU when all three bits set ("111"=0x8C per MAME logic)
- source/rtl/zn_sio.vhd:50 Expected 0xFF per MAME exchange 0.
- source/rtl/zn_sio.vhd:51 Expected 0xAF per MAME psyforce exchange 8.
- source/rtl/zn_sio.vhd:57 MAME ground truth for BR2 Ex1 with et01 motherboard key: byte0 = 0xFF, byte3 = 0x0A.
- source/rtl/zn_sio.vhd:64 1-cycle strobe emitted ~50us after the ZNMCU is selected (and again after byte0), mirroring MAME znmcu_device's DSR line.
- source/rtl/zn_sio.vhd:75 tondemo runs its game-side CAT702 driver at JOY_BAUD=2 (~2 MHz, byte=16 clk) and bounds its I_STAT-bit7 poll to ~81 iterations; the old fixed DELAY1=1200 exceeded that budget, so every byte "timed out", the driver aborted (RX path itself wa
- source/rtl/zn_sio.vhd:209 ZNMCU state (MAME reference: src/mame/sony/znmcu.cpp znmcu_device) MAME protocol: select is active when (znsecsel & 0x8C) == 0x8C.
- source/rtl/zn_sio.vhd:224 The Taito FX-1 BIOS polls JOY_STAT bit7 for that pulse (BFC0B0A0..BFC0B11C) but falls through after a bounded 0x2710-iteration timeout and clocks the byte anyway, so the missing pre-byte pulse is non-fatal (verified via MAME debugger trace)
- source/rtl/zn_sio.vhd:231 While set, receive_valid/ack are asserted as LEVELS so that port-1 (JOY_CTRL bit13=0) transfers — sampled by joypad.vhd's internal baud engine ~JOY_BAUD*8 cycles after beginTransfer, long before this FSM's SNAC pulses at DELAY1 — still pick
- source/rtl/zn_sio.vhd:241 ===== PROPOSED FIX (Tecmo ZNMCU boot-hang) ===== MAME znmcu_device arms a 50us timer on select-active that drives DSR low (raising SIO0 IRQ7 / I_STAT bit7), then re-arms after each byte while the transferred byte index < databytes.
- source/rtl/zn_sio.vhd:244 In this core databytes is always 1 (standard digital mode, see header), so MAME emits exactly TWO DSR pulses per session: one on select (before byte0) and one after byte0 (before byte1).
- source/rtl/zn_sio.vhd:274 B123: capture KN02 byte at index 50 (= MAME's last).
- source/rtl/zn_sio.vhd:393 Per-chip CAT702 reset: mirrors MAME cat702_device::write_select(0).
- source/rtl/zn_sio.vhd:408 ZNMCU newly selected: mirrors MAME znmcu_device::select(0), which resets the bit/byte counters on the select-active edge (znsecsel write where bits 7,3,2 all become set, e.g. 0x8C).
- source/rtl/zn_sio.vhd:415 Mirrors MAME znmcu.select(0) arming the 50us DSR timer.
- source/rtl/zn_sio.vhd:436 ZNMCU mode (MAME src/mame/sony/znmcu.cpp): the response never depends on the TX byte, so unlike CAT702 it can (and must) be loaded immediately: port-1 transfers are consumed by joypad.vhd's internal baud engine within ~JOY_BAUD*8 cycles of
- source/rtl/zn_sio.vhd:441 byte0 = (databytes<<4)|(dsw&0xF) = 0x10|dsw[3:0] (standard mode, databytes=1 — znsecsel bits 4/5 not wired, see header) byte1..n = 0x00 (MAME m_send[] is zero-filled; bytes beyond databytes shift out 0 bits, NOT 0xFF)
- source/rtl/zn_sio.vhd:467 ZNMCU mode: sec_select="111" (0x8C, all bits set) activates ZNMCU per MAME znmcu.select((data & 0x8C) == 0x8C).
- source/rtl/zn_sio.vhd:518 51st event (first spurious after MAME's 50)
- source/rtl/zn_sio.vhd:550 MAME emits DSR before byte0 (armed on select) and before byte1 (armed here after byte0).
- source/rtl/psx_top.vhd:690 build #150: sticky latches for CPU PC at the cube CLUT PIO upload site (MAME PC 0x8003CB20).
- source/rtl/psx_top.vhd:2442 HW-accurate: MAME znmcu_device drives DSR on select the same way.
- source/rtl/psx_top.vhd:2466 X=768 is the ONLY CLUT at X>=512 in lpadv's entire stream (MAME log: CLUT X in {0,256,768}), so a sticky latch firing == the cubes.
- source/rtl/psx_top.vhd:2507 RED = h40_cube_clut_loaded_ever — CLUTwrenA + CLUTaddrA=0 + vram_DOUT[31:16]=0x7FFF + vram_DOUT[47:32]=0x023F (cube CLUT word 0 loaded into dpram with the EXACT MAME-verified values) GREEN = h40_clut_read_7fff_ever — any CLUTDataB lane
- source/rtl/psx_top.vhd:2552 Display origin is at Y=240 per MAME GP1 0x05 trace, so screen shows the empty front buffer.
- source/rtl/psx_top.vhd:3060 Banking + MRA ROM layout were proven correct vs MAME (byte-for-byte), so the upstream ROM->SDRAM->banked-read path is clean.
- source/rtl/psx_top.vhd:3062 The classification now happens in gpu.vhd gated on the cube CLUT's UNIQUE VRAM destination (X<256, Y=488 = MAME's exact cube-CLUT upload), removing the value/address ambiguity that contaminated builds #40-43.
- source/rtl/gpu_pixelpipeline.vhd:115 Expected entries 0..3 (MAME-verified): 0x0000, 0x7FFF, 0x023F, 0x3FFF.
- source/rtl/gpu_pixelpipeline.vhd:220 MAME ground truth says CLUT[3] != 0x0003.
- source/rtl/gpu_cpu2vram.vhd:76 Three stickys distinguish where it goes: A any_ever — any such upload ever (sanity) B y482_ever — and copyDstY=482 (MAME ground truth) C y488_ever — and copyDstY=488 (FPGA's existing in_cube guess)
- source/rtl/gpu_cpu2vram.vhd:253 This tells us what data accompanies the suspect upload: if it's MAME's cube CLUT (entry0=0x0000, entry1=0x7FFF), only the position is wrong.
- source/rtl/gpu_cpu2vram.vhd:417 GREEN = h49_fifo_data(24:16) — entry 1 (upper halfword) bits 8:0 (includes R[4:0] in 4:0) BLUE = anchor sticky — fired at first WRITING+copySizeX=16+copySizeY=1+copyDstY∈[472..476] MAME-expected values (cube CLUT first FIFO word = 0x7FFF00
- source/rtl/gpu_poly.vhd:536 MAME stream for DoA++ shows 267 of 2270 textured polys use extended Y CLUTs (Y >= 512) via bit 15 of polygon CLUT word.
- source/rtl/gpu.vhd:712 Per MAME: 109 bank switches during cube attract (game code at 0x800504F0 loads assets from banks).
- source/rtl/gpu.vhd:729 Tests whether DMA can carry MAME's expected R=31 for cube CLUT entries.
- source/rtl/gpu.vhd:2329 Cube attract drives global drawMode[3:0] to 0xA (TexPage X=640) or 0xB (X=704) per MAME ground truth.
- source/rtl/gpu.vhd:2345 B125/B126 (Y=482 exact) showed write_R=read_R=0, suggesting cube CLUT might use different Y. Y∈[460,500] covers Y=462 (text font) + Y=480-487 (cube CLUT band per MAME).
- source/rtl/cat702.vhd:53 Compute c[sel][bit] using the recursive Shift derivation from MAME.
- source/rtl/znmcu.vhd:7 Protocol observed in MAME znmcu.cpp: The host writes 0x00 (DSW poll) or 0x01 (analog/trackball poll) via SIO0.
- source/rtl/gpu_rect.vhd:243 MAME stream for DoA++ shows 267 textured polys use bit 15 of CLUT word to address Y>=512 in extended VRAM.
- source/rtl/memorymux.vhd:145 Raizing/Eighting sound board (MAME raizing_zn_state): one-clock pulses on PSX writes to 0x1FB00000 (8-bit sound latch) and 0x1FB00004 (68000 IRQ2)
- source/rtl/memorymux.vhd:304 In MAME (sony/zn.cpp taito_fx1z_state) it is a PLAIN memory-mapped array at 0x1FB00000-0x1FB003FF (umask 0x00ff00ff), read/written via trivial fram_r/fram_w (NOT a serial/bit-banged protocol).
- source/rtl/memorymux.vhd:313 Power-up state is 0x00 (no init) rather than MAME's 0xFF, which is harmless: gdarius checksums and REINITS the region on any invalid content, and writes now persist, so it self-heals to a valid state and boots.
- source/rtl/memorymux.vhd:316 (For byte-exact MAME parity / true persistence, an ioctl-loaded MIF + save path is the follow-up — same NVRAM infra the FX-1A EEPROM needs.)
- source/rtl/memorymux.vhd:1025 VRAM destination (per MAME): X=256, Y=482, 4-bit CLUT 16×1.
- source/rtl/memorymux.vhd:1026 MAME 20s trace shows NO direct CPU read at 0x1F7B61CC, so the load likely happens via I/D-cache fill of a 32-byte line, or via a bulk DMA copy.
- source/rtl/memorymux.vhd:1086 Taito FX bank register write: MAME taito_fx uses only bits[1:0] (BIT(data,0,2)); bit5 is the MB3773 watchdog strobe, bit2 unused.
- source/rtl/memorymux.vhd:1094 MAME atlus_zn_state::bank_w uses data & 3 (2 bits); was bits[18:16].
- source/rtl/memorymux.vhd:1109 Per MAME's analysis, 109 bank switches happen during cube attract via game code at 0x800504F0.
- source/rtl/memorymux.vhd:1123 build #79 fix: Raizing bank is data & 3 (bits[1:0]) per MAME raizing_zn_state::znsecsel_w.
- source/rtl/memorymux.vhd:1168 MAME: unknown_r() returns 0x0000FFFF for all ZN platforms
- source/rtl/memorymux.vhd:1176 Two addresses matter to the main CPU's sound dispatcher (game code at 0x800B2A34): 0x1FBC0000 sound_irq_r : MAME returns 0; game does andi 1 / bne — if bit0 reads 1 the dispatcher bails WITHOUT draining its command queue (0x800B2A48-58), w
- source/rtl/memorymux.vhd:1187 Both stubs mirror MAME's ground-truth handshake WITHOUT the sound CPU.
- source/rtl/memorymux.vhd:1373 Mirrors MAME sound_irq_r()==0.
- source/rtl/raizing_snd/ymf271.sv:4 Behavioural reference: MAME 0.289 src/devices/sound/ymf271.cpp (BSD-3-Clause; Olivier Galibert, R. Belmont, hap).
- source/rtl/raizing_snd/ymf271.sv:7 The ROM tables are generated with MAME's own expressions (tools/ymf271 table generator, *.hex here).
- source/rtl/raizing_snd/ymf271.sv:24 Not implemented (also unimplemented/TODO in MAME): PFM, detune, alternate loop, Acc On, EXT out, external-memory read-back (reg 2 reads 0xFF), PCM on groups whose index is not a multiple of 4 (they have no PCM address regs).
- source/rtl/raizing_snd/ymf271.sv:127 MAME RKS_Table[keycode][keyscale]
- source/rtl/raizing_snd/ymf271.sv:354 busy (bit 7) reads 0 like MAME: the write queue drains faster than the 68000 can write
- source/rtl/raizing_snd/ymf271.sv:726 MAME update_pcm: loop check before the sample read
- source/rtl/raizing_snd/raizing_snd.sv:5 Reference: MAME 0.289 src/mame/sony/zn.cpp raizing_zn_state: PSX 0x1FB00000 write -> sound latch (8 bit) PSX 0x1FB00004 write -> 68000 IRQ2, HOLD_LINE (cleared by the acknowledge) 68K 0x000000-0x07FFFF program ROM (SDRAM, through a 4
- source/rtl/raizing_snd/raizing_snd.sv:101 Sound latch and IRQ2 (MAME HOLD_LINE: stays asserted until acknowledged)
- README.md:39 Put your ROM zips in the MiSTer arcade ROM folder (`games/mame/` or `_Arcade/mame/`).
- README.md:61 In MAME they differ only in a small region EEPROM, which the regional MRAs load.
- README.md:98 MAME emulates this board in `src/mame/sony/zn.cpp` (`raizing_zn_state`) and `src/devices/sound/ymf271.cpp`.
- README.md:102 Measuring the real behaviour in MAME
- README.md:104 Before writing any hardware, the board was traced in MAME 0.289 with Lua scripts (`source/sim/mame/`), recording 150 seconds of boot, attract mode, coin-up, sta
- README.md:126 MAME's YMF271 was ported to a standalone C++ program (`source/sim/model/ymf_mame.h`) that replays the captured register writes.
- README.md:129 A second, fixed-point model (`ymf_fx.h`) was written with the same structure the hardware would have: integer arithmetic only, lookup tables generated from MAME
- README.md:150 It keeps MAME's balance between the PlayStation SPU (sound effects) and the YMF271 (music), 0.35 : 1.0, with +6 dB overall headroom.
- README.md:159 **Whole sound board, running the real Brave Blade sound program** in a Verilator simulation, with the game's commands injected at the times MAME recorded, over
- README.md:162 it made 177,684 YMF271 register writes against MAME's 177,696;
- README.md:181 **Unused YMF271 features are not implemented** (they are also missing or incomplete in MAME): PFM, detune, alternate loop, "Acc On", external outputs, and readi
- README.md:206 **The MAME team**, in particular the authors of `ymf271.cpp` (R. Belmont, Olivier Galibert, hap) and the ZN driver: the behavioural reference for the sound boar
- README.md:233 This core derives from **PSX_MiSTer** by Robert Peip (FPGAzumSpass) and the **MiSTer framework**; the ZN-1 board support (per-manufacturer boot ROM, CAT702 secu
- README.md:240 The Raizing sound board and YMF271 RTL are an independent re-implementation written with reference to MAME's behaviour.
- README.md:242 The standalone MAME YMF271 port used only for verification (`source/sim/model/ymf_mame.h`) retains its BSD-3-Clause attribution to its original authors.
- README.md:266 The FPGA logic is an original re-implementation of the ZN-1 board's behavior, developed from observation and from publicly available documentation and reference
- README.md:268 This core re-implements that logic for interoperability and preservation, in the same manner as MAME and comparable FPGA cores.
Says it matches, follows or was checked against MAME — 12
- source/rtl/zn1_io.vhd:17 Input bit encoding for P1/P2 (active-low, matches ZN MAME driver):
- source/rtl/zn1_io.vhd:138 Board config register value (matches MAME zn_state::boardconfig_r): [7:5] = "011" → rev=1 (always for ZN-1) [3] = vmem (1=2MB, 0=1MB) — set by m_gpu->vram_size() in MAME [2] = smem (1=2MB SPU SGRAM) — MAME never sets this; left 0 [1:0]
- source/rtl/zn1_io.vhd:357 FIX (loading): toggle bit 3 of the zn2_spu_hack reg (0x1FA60000) exactly once per read (rising edge of read_en at that address), matching MAME's `m_zn2_spu_hack ^= 8` so the load's poll exits.
- source/rtl/zn_sio.vhd:271 build #119/120/121/122/123 diagnostics B119-121: verified KN02 bytes 1-4 = AF, 95, 94, 14 match MAME exchange 8 exactly B122: FPGA count=58 vs MAME=50 → 8 EXTRA KN02 byte events on FPGA.
- source/rtl/gpu_cpu2vram.vhd:60 Cube CLUT is uploaded at copyDstX=256, copyDstY=482 (verified via MAME GP0 stream).
- source/rtl/gpu.vhd:1390 reset to 1023, matching real hardware (MAME: n_drawarea_x2=1023)
- source/rtl/gpu.vhd:1391 reset to 1023, matching real hardware (MAME: n_drawarea_y2=1023)
- source/rtl/cat702.vhd:37 The live CAT702 implementation is the `cat702_byte` procedure in zn_sio.vhd, which already applies TF2 every byte (correctly matching MAME).
- source/rtl/memorymux.vhd:1140 ZN-1 has no CD-ROM: return 0xFF for reads (matches MAME open-bus), ignore writes
- README.md:127 Its output matches MAME's own recording (correlation 0.998).
- README.md:131 It matches the MAME port on 99.98 % of samples.
- README.md:163 after each of the 23 commands the write counts match MAME;
Says it was translated, ported or taken from MAME — 1
Keeps a MAME approximation — 3
- source/rtl/zn1_io.vhd:94 MAME's zn2_spu_hack_r TOGGLES bit 3 (^=8) on every read; DoA++ (and likely other ZN titles) poll this register during the post-coin load waiting for that bit to change.
- source/rtl/zn1_io.vhd:99 Replicate MAME: return spu_hack_reg, toggling bit 3 once per read.
- source/rtl/zn1_io.vhd:357 FIX (loading): toggle bit 3 of the zn2_spu_hack reg (0x1FA60000) exactly once per read (rising edge of read_en at that address), matching MAME's `m_zn2_spu_hack ^= 8` so the load's poll exits.