← All cores
Model2 (alphanu1)
Cites hardware documentation that MAME's driver does not — 6
- Model2.sv:5125 Simulation at 30M instructions reaches 399 matrix writes, 553 objects and 3,038 polygons; the board sits at 2 focal writes and nothing else, unchanged across 382 records in 60 seconds.
- rtl/cpu/i960/i960_memmap.sv:69 Both sheets carry .mirror(0x200000) with the BURST flag (model2_tgp_mem: 0x12000000-0x121fffff and 0x12400000-0x125fffff), so sheet 1's mirror 0x12600000-0x127fffff is a burst region too.
- rtl/cpu/i960/i960_memmap.sv:71 It ended at 0x12600000, and a multi-word store there put all its words on its first address: Dynamite Cop, Dead or Alive, Sky Target and Motor Raid upload sheet 1 with stq through that mirror -- three texel words in four never written, the
- rtl/io/m2_cpu_bridge.sv:776 R264: texture sheet 0, and its mirror at +0x200000.
- rtl/io/m2_cpu_bridge.sv:783 Taking it as part of the index put every mirrored write half a megaword past the base: sheet 0's mirror landed on sheet 1, and sheet 1's mirror landed on the LUMA TABLE.
- rtl/io/m2_rom_loader.sv:41 Sized from MEASURED ROM extents across all ten dumped Model 1 games, not from MAME's ROM_REGION declarations.
Cites hardware references or measurements that MAME's driver also gives — 1
Says it was checked on “real hardware” — 1
- rtl/io/m2_cpu_bridge.sv:901 Measured: the CPU issues a byte store (data 0x27272727, be=0001 -- correct i960 behaviour, it replicates the byte and relies on the enables), the bridge forwards be=01 (verified on hardware), and every lane still lands.
Notes where it differs from MAME — 2
- rtl/cpu/i960/i960_icache.sv:16 MAME does not model an instruction cache at all: its `m_cache` is an address space accessor, and the IAC that would invalidate the real cache — 0x89, "invalidate internal instruction cache" — is logged rather than executed.
- rtl/tgp/m2_tgp.sv:370 It must not block, and the comment that used to stand here - "MAME's generic_fifo blocks the same way" - was wrong about the one thing it was cited for.
Cites MAME source — 493
- Model2.sv:150 R997: M2_I960_RING, the i960's local-register cache as the chip keeps it (2A's R927, i960_top RC_RING): a ring of eight saved frames that goes to memory only when a call finds it full, where MAME's rule sends every frame deeper than four to
- Model2.sv:153 On by default; VERILOG_MACRO "M2_I960_RING=0" builds MAME's rule, the core before R997 exactly.
- Model2.sv:299 model2.cpp's screen_vblank walks the list only on even frames when the game is in 30 Hz mode -- "if 60 Hz mode or frame number is even" -- and this core has always walked every vblank.
- Model2.sv:322 1 is MAME's sharpness; 2, 4 and 8 draw faster (a heavy list draws in ~5.2, 3.1, 1.9 video frames at 1, 2, 4 -- a list comes every ~2.1) and the 3D updates at whichever is slower, the game or the draw.
- Model2.sv:352 MAME's is entry zero, the reference; Mild lifts the darks; Off is the colour table's raw values.
- Model2.sv:354 Menu 0 Off, 1 MAME, 2 Mild, mapped below to the palette's encoding (0 MAME, 1 mild, 2/3 off).
- Model2.sv:356 R790: MAME first now -- Ben's default.
- Model2.sv:356 Menu 0 MAME, 1 Off, 2 Mild.
- Model2.sv:574 MAME declares Model 2's pixel clock as `32_MHz_XTAL/2`, so this is the reference rate and not an approximation of it.
- Model2.sv:817 TEXTURES ARE NOT CONTIGUOUS WITH MAME'S REGION, and the texture unit will need to know.
- Model2.sv:818 model2.cpp's "textures" is 16 MB with mpr-16522/16521 at 0x000000 and mpr-16517/16516 at 0x800000 -- a 4 MB hole in the middle.
- Model2.sv:819 The MRA streams both pairs back to back with no gap, so an address computed against MAME's layout is 4 MB out for everything above the hole.
- Model2.sv:832 R725: DAYTONA '94 (MAME `daytona`, Revision A) HAS 16 MB OF POLYGON ROM, '93 13 -- its ic19/ic23 pair is 4 MB to '93's 1.
- Model2.sv:885 R639: menu 0 Off -> 2, 1 MAME -> 0, 2 Mild -> 1, 3 (unused) -> off.
- Model2.sv:886 R790: menu 0 MAME -> 0, 1 Off -> 2, 2 Mild -> 1, 3 (unused) -> off.
- Model2.sv:1289 pcm1 is the first 4 MB and pcm2 the second, which is not the MRA's ordering taken on trust: MAME's own region contents were read back and matched against the files, and pcm1 is mpr-16491+16492 while pcm2 is mpr-16493+16494.
- Model2.sv:1558 On the board a Double Buffered menu walks and draws in alternate vblanks and the game flips every second one, though its frame is ~1 ms of CPU in MAME; the CPU's SDRAM wait was measured 86% behind texels (R606), and round-robin behind four
- Model2.sv:1835 model2.cpp: "initialize bufferram to a sane default", m_bufferram[i] = 0x07800f0f.
- Model2.sv:1962 MAME's raster_state is value-initialised, so those headers read ZERO there: renderer 0, flat and opaque, colour base 0, and they are drawn.
- Model2.sv:2000 No CPU exists in this slice, so nothing writes the tilemap; the contents come from a state captured out of MAME at a known frame (docs/rom-layout.md) and streamed in as ROM:
- Model2.sv:2054 MAME's polygon_ram0/1 are 0x8000 DWORDS each -- 128 KB apiece, 256 KB together, which is 205 M10K blocks of the 553 on this part.
- Model2.sv:2320 MAME's base offsets are 0x0080>>1, 0x4080>>1 and 0x8080>>1 in words.
- Model2.sv:2732 Transcribed from model2.cpp; each of these was found by logging the address a poll loop was reading, not by reasoning about it.
- Model2.sv:2742 V-blank into bit 0, the same line MAME's screen_vblank sets.
- Model2.sv:2789 model2.cpp raises it from sound_ready_w whenever TXRDY or RXRDY changes and either is then active, and again from irq_mask_delayed_update when the mask itself is written.
- Model2.sv:2821 Byte-wide at bytes 0 and 2 of the dword -- model2.cpp maps it .umask16(0x00ff) -- so it is the same shape as the I/O board's DPRAM: data in byte 0, status/command in byte 2, and the byte enables say which one an access names.
- Model2.sv:2847 MAME writes this port 59 times over 900 frames -- 11 control, 48 data, first data byte at frame 13 -- and never reads it back, so the board has a number to be wrong against.
- Model2.sv:3108 The DPRAM is EIGHT BITS WIDE at bytes 0 and 2 of each dword -- model2.cpp maps it .umask32(0x00ff00ff) -- so both live in the same 32-bit word and the value is 0x00400000.
- Model2.sv:3113 A 4 KB capture of MAME's DPRAM was tried first and gets no further: it produced the same boot and WORSE settings values, because a recording answers questions from a moment that is not this one.
- Model2.sv:3132 // if 60 Hz mode or frame number is even, trigger geometrizer to start new frame if ((m_videocontrol & 1) == 0 || (m_framenum & 1) == 0) geo_parse(); -- model2.cpp, screen_vblank
- Model2.sv:3155 This gated the walk start and the renderer's swap to even frames when videocontrol bit 0 was set -- MAME's screen_vblank rule for when geo_parse runs.
- Model2.sv:3214 NOT the current boot blocker, and that is measured rather than assumed -- MAME's boot trace references this region once, at 0x980000, and never reads the ID.
- Model2.sv:3219 R765: MAME's videoctl_r exactly -- the frame bit ALWAYS in bit 2, frame bit 0 in 60 Hz render mode and bit 1 in 30 Hz.
- Model2.sv:3220 This was keyed on videocontrol bit 0 and put frame bit 1 in bit 3 when it was clear; Daytona writes videocontrol 0 and render mode 1, reads bit 2 once a frame (0x17cb8) to pick the list buffer -- and so always got 0: single-buffered at dwor
- Model2.sv:3244 Three regions, from model2.cpp's map.
- Model2.sv:3266 That was WRONG, and it was wrong because of a bad measurement: MAME's TGP program space is WORD-addressed, so it must be read as `read_u32(word)`, and it had been read as `read_u32(word*4)`.
- Model2.sv:3270 Read correctly, MAME's program is 2024 non-zero words and satisfies program[i] == write[i].
- Model2.sv:3273 The command code is the address: MAME takes (offset >> 2) & 0xff of a dword offset, which is bits 11:4 of the byte address.
- Model2.sv:3312 The game starts a step only after a vblank IRQ that comes after its last step's flip (0x138c waits for the IRQ's count to change, MAME debugger, Rev A), and that IRQ writes the scroll for the list two before the new step: so the words writt
- Model2.sv:3341 Dumped MAME's buffer RAM at the same frame and compared it word for word with ours.
- Model2.sv:3344 dword MAME ours
- Model2.sv:3352 geo_w (model2.cpp) reconstructs the command word from the WRITE ADDRESS:
- Model2.sv:3565 MAME's polygon_rom_mask is not a power of two either.
- Model2.sv:3684 MIPZ_B: a polygon is drawn at level 0 when MAME's own level (the game's texlod) is at most -MIPZ_B over all of it.
- Model2.sv:3701 MAME draws the last window opened first and in front of the rest (render_polygons); Virtua Cop's revolver -- its ammo display -- is window 5, at a z behind the whole scene (window 1), so a z-only sort hid it under the scene.
- Model2.sv:3714 Ben 2026-10-20: every game, as MAME draws by window
- Model2.sv:3716 R925 (the 2A branch's R867): THE TEXTURED COLOUR THROUGH THE GAME'S OWN LUMA RAM, 3D PALETTE AND COLOUR TABLE (m2_span_tex TEXLUT), per pixel as MAME colours it.
- Model2.sv:3775 MAME builds them from the rasterizer's viewport and centre (model2_v.cpp:882); for a 496x384 screen centred at (248,192) they come out as -248, +248, +192, -192.
- Model2.sv:3779 The walker reads geo_window_data and m2_geo_view turns its viewport and centre into these, as MAME does; the CRTC offsets (0, 128 on Daytona, logged from MAME) are its parameters.
- Model2.sv:3907 MAME: 6, 7, 8, 9, 0x14.
- Model2.sv:4212 Driven combinationally, hps_io's ioctl_upload fed the debug-port address mux whose data fed ioctl_din straight back into hps_io, and Quartus 17.0's fitter timing engine CRASHED on the apparent cycle -- Internal Error, sta_scc.cpp:1041, repr
- Model2.sv:4332 MAME's rest positions
- Model2.sv:4361 an_callback<0..2> are STEER/ACCEL/BRAKE; <3> is never bound for this game and an unbound devcb_read8 reads 0xFF, which is what MAME's firmware deposits at DPRAM 0x03.
- Model2.sv:4373 The buttons are mapped, the firmware path is proven in simulation (R65: in0=FB puts FB in DPRAM byte 0x08, byte for byte what MAME's machine does), and the board still does nothing.
- Model2.sv:4506 The i960 core implements exactly the opcode set the REFERENCE implements; anything MAME reaches fatalerror on is trapped LOUDLY rather than implemented blind, so "a game that needs more announces itself instead of drifting" (docs/p1-i960-sp
- Model2.sv:4603 The block capture did its job: the firmware sweeps 0x100-0x17f with 7F/FF, 384 times a minute, where MAME's firmware writes it ONCE (frame 10, "SEGA...") and never touches it again.
- Model2.sv:4606 MAME puts it at DPRAM 0x00-0x0d and the bytes are known exactly:
- Model2.sv:4721 MAME's game reads real settings there; if the board reads something else, that difference is the thing being rejected, and it names itself.
- Model2.sv:4887 MAME holds 1,274 distinct values there; the board held SIX, which was the flat screen.
- Model2.sv:4896 MAME emits exactly 59 bytes to this port over 900 frames of attract mode, so the board either sends that stream or it does not -- and that is checkable before a single sound chip exists.
- Model2.sv:4932 Reading ipring_q into the streamer made quartus_fit die with "Internal Error: TDB, tdb_node.cpp:2080" on TWO consecutive seeds -- 19 and 31 -- where the same design without it built fine.
- Model2.sv:4948 The previous build measured THREE io reads in 45 s where MAME's TGP hammers its math units, which says the coprocessor is executing something, but not the geometry code.
- Model2.sv:5118 MAME has exactly two writers of geo->matrix, geo_matrix_write (0x0b, twelve words) and geo_translate_write (0x0c, matrix[9..11]), and this core implements both.
- Model2.sv:5412 MAME's real machine holds 00 03 03 00 at window offsets 0x114-0x117 and holds it stable for hundreds of frames; our board fills the window with the 7F FF RAM-test pattern.
- Model2.sv:5501 DOES OUR i960 RESPOND TO THE COIN THE WAY MAME'S DOES?
- Model2.sv:5509 MAME's i960 answers a coin by starting a repeated write to 0x01c0001c byte 2 -- dword 7, the high lane -- which does NOT happen before the coin.
- Model2.sv:5515 The second would be coinage: MAME on a fresh nvram wants THREE coins, and shows "CREDIT 0/3" climbing to "CREDITS 2/3" as they go in.
- Model2.sv:5901 XOR and SUM over the values written, plus the smallest and largest seen, are four numbers MAME can be asked for exactly.
- Model2.sv:5905 Folding the WRITES was not decisive: the board's range 0x0020..0x8020 contains MAME's 0x3000..0x3d8d, so spaces written while clearing widen it without saying what the final content is.
- Model2.sv:5912 MAME's map2 holds 1,274 distinct values between 0x3000 and 0x3d8d; if this comes back as a handful of values, that is the flat screen and it is a data fault, not a rendering one.
- Model2.sv:5918 MAME holds count=0x13, base=0x00505100, size=0x300 and leaves after nineteen passes.
- Model2.sv:6464 The frame simulation that reproduces MAME's picture ends with layer 0 holding 0x310 and layers 1-3 at zero, so that is what a working board must show.
- Model2.sv:6633 The vblank the game takes (its interrupt, R652's hold included) drives the board's tick, as MAME's screen_vblank and the recomp's vblank_start do; every video frame is the helper's heartbeat.
- Model2.sv:6681 Each is written where the CPU's own write lands in SDRAM (m2_cpu_bridge's port 1): eight rows of the luma RAM (one byte a 16-bit word, R264), the 3D palette (palram 0x1000-0x13ff) and the colour table's first 64 lumas of each component -- a
- Model2.sv:6685 THE EIGHT ROWS (MAME 0.289, every polygon drawn in 420 s of attract and play): Virtua Cop draws rows 0, 1 and 16, Desert Tank rows 0, 11 and 30-40, all one table with rows 0-65 but 7 -- so slots {row[4], row[1:0]} (rows 0-3, 16-19 captured;
- Model2.sv:6817 poly_tex[11] is texheader[0] bit 15, MAME's `checker` (model2_v.cpp): the polygon paints every other pixel on a (x ^ y) grid -- how Model 2 draws the car's shadow and the minimap panel.
- Model2.sv:6910 Tile overruns: 0 on 114 MAME frames at the board's latency (was 8 a frame).
- Model2.sv:6979 Those are MAME's set_raw numbers (docs and sim/video/tb_m2_video_timing.cpp assert the same two).
- Model2.sv:6986 They existed to prove m2_video_timing produced MAME's 424 lines and 496 visible pixels, they proved it on hardware, and sim/video/tb_m2_video_timing.cpp asserts both every run.
- rtl/cpu/i960/i960_alu.sv:35 MAME computes carry as:
- rtl/cpu/i960/i960_alu.sv:44 MAME's addc and subc never set carry at all.
- rtl/cpu/i960/i960_alu.sv:58 The reference model carries a switch to reproduce MAME's result so lockstep can still run; see i960_alu_ref.h. Design study §2 and R7 record this.
- rtl/cpu/i960/i960_alu.sv:70 MAME t1
- rtl/cpu/i960/i960_alu.sv:71 MAME t2
- rtl/cpu/i960/i960_dec.sv:32 Per docs/p1-i960-spike.md §1 that is deliberate: anything MAME reaches fatalerror on is unreachable in practice, so it is trapped loudly rather than implemented blind.
- rtl/cpu/i960/i960_dec.sv:87 Format ranges follow i960dis.cpp's mnemonic table, where the format column is 1=CTRL, 2=COBR, 3=MEM, 4=REG:
- rtl/cpu/i960/i960_dec.sv:101 From i960.cpp:
- rtl/cpu/i960/i960_dec.sv:163 MAME: get_disp = sext(opcode, 24) - 4 get_disp_s = sext(opcode, 13) - 4
- rtl/cpu/i960/i960_fpmisc.sv:32 R972: mode 0 was round half AWAY FROM ZERO, MAME's C round(), and this header said the i960 is "NOT round-to-nearest-even".
- rtl/cpu/i960/i960_fpmisc.sv:33 That was MAME's rule, not Intel's: the manual's mode 00 is "round to nearest (even)".
- rtl/cpu/i960/i960_fpmisc.sv:334 It was 0x8000_0000 for both signs, from MAME's int32_t cast (x86's indefinite value), and R12 recorded the manual as giving "the truncated low 32 bits" -- this manual does not say that (R970).
- rtl/cpu/i960/i960_fptrans.sv:17 MAME computes them with the host's libm; the programs (tools/i960_fptrans.py, which also generates i960_fptrans_rom.svh and is this module's reference) work in double-double and round once, so the result is the correctly rounded value -- wh
- rtl/cpu/i960/i960_memmap.sv:11 Region table from MAME's model2.cpp — model2_base_mem, model2_tgp_mem and model2a_crx_mem (BSD-3-Clause).
- rtl/cpu/i960/i960_regs.sv:32 It is wrong here, and the reason is easy to miss: MAME copies the locals into the cache and **does not clear them**, so the callee's frame starts life holding the caller's register values.
- rtl/cpu/i960/i960_regs.sv:84 Do not change with RING = 0: MAME's rule and its memory stream, which the lockstep benches compare.
- rtl/cpu/i960/i960_regs.sv:88 0: MAME's do_call / do_ret_0 (the frames at depth 0-3 since the last flushreg live in the cache, EVERY deeper one goes to memory on its call and comes back on its return).
- rtl/cpu/i960/i960_regs.sv:95 The difference is visible only in the 64-byte register save areas, which the architecture leaves undefined until flushreg (MAME's own stream is one implementation's).
- rtl/cpu/i960/i960_regs.sv:119 MAME dispatches: 0 is an ordinary return, 7 is an interrupt return that also restores PC and AC from the frame, and 1 to 6 are fatalerror.
- rtl/cpu/i960/i960_regs.sv:125 TYPE 7 IS NOT AN ERROR: it is the interrupt return, and MAME performs a full do_ret_0 for it and then restores PC and AC from the frame.
- rtl/cpu/i960/i960_regs.sv:154 i960.cpp's device_reset:
- rtl/cpu/i960/i960_regs.sv:227 Depth counter, exactly MAME's m_rcache_pos.
- rtl/cpu/i960/i960_regs.sv:251 It was removed as dead logic that also changed semantics in a case with no oracle -- an overlapping movl/movt/movq (`movl r4, r5`), where T_MULTI writes word i while reading word i+1, and which MAME implements with memcpy on overlapping reg
- rtl/cpu/i960/i960_top.sv:45 Desert Tank runs them from the title's end (MAME: first movrl at frame 1105, 19.23 s) and this core trapped on every one, halting the i960.
- rtl/cpu/i960/i960_top.sv:49 R839: THE FORMS VIRTUA COP RUNS AND DAYTONA NEVER DID -- sqrtrl (0x69.8), cpysre (0x6e.2) and cvtzril (0x6c.3), MAME's semantics.
- rtl/cpu/i960/i960_top.sv:54 R997 (2A's R927): THE LOCAL-REGISTER CACHE AS THE CHIP KEEPS IT (i960_regs RING): a ring of RC_FRAMES saved frames that writes a frame to memory only when a call finds it full, instead of MAME's rule (every frame deeper than four goes out o
- rtl/cpu/i960/i960_top.sv:58 0 is MAME's rule and its memory stream exactly, as the lockstep benches compare it.
- rtl/cpu/i960/i960_top.sv:86 Sega and Namco both wired the i960 in "normal" mode only, which is the subset MAME implements and the only one modelled here.
- rtl/cpu/i960/i960_top.sv:147 ARCHITECTURAL STATE THE INTERRUPT PATH CONSUMES, with MAME's reset values (i960.cpp device_reset).
- rtl/cpu/i960/i960_top.sv:178 WHEN an interrupt is taken is the one place this does not follow MAME literally.
- rtl/cpu/i960/i960_top.sv:179 MAME calls check_immediate_irqs() once per execute_run(), a scheduler timeslice boundary, which is an emulator artifact; silicon takes it at the next instruction boundary and so does this.
- rtl/cpu/i960/i960_top.sv:187 the single immediate slot MAME models
- rtl/cpu/i960/i960_top.sv:206 Only the message TYPE of the first IAC word is kept -- the low 24 bits are never read by any message MAME implements.
- rtl/cpu/i960/i960_top.sv:238 MAME's order is whatever the driving machine calls execute_set_input in; a fixed order is needed for lockstep, and the reference uses the same one.
- rtl/cpu/i960/i960_top.sv:274 MAME walks 31 down to 0 and takes the first hit, so this is a find-highest-set over the eligible mask.
- rtl/cpu/i960/i960_top.sv:599 R836: A LONG-REAL REGISTER OPERAND IS THE EVEN-ALIGNED PAIR read as one double (MAME get_1_rifl / get_2_rifl: m_r[n & 0x1e] low, m_r[(n & 0x1e)+1] high).
- rtl/cpu/i960/i960_top.sv:761 R839: get_1_rifl -> sqrt -> set_rifl; cpysre: |src1| with src2's "sign" as MAME tests it (src2 >= 0.0, so -0.0 counts as positive and a NaN as negative); cvtzril: get_1_rif (the single-form operand) -> (int64_t) -> set_ri64, the unmasked pa
- rtl/cpu/i960/i960_top.sv:821 MAME: t2f >= 0.0 ?
- rtl/cpu/i960/i960_top.sv:981 The i960 reads its startup state from low memory before it executes anything (MAME i960.cpp device_reset):
- rtl/cpu/i960/i960_top.sv:1368 m_r[I960_FP] = m_program.read_dword(m_PRCB+24); i960.cpp
- rtl/cpu/i960/i960_top.sv:1441 Vector 0 means the line is in IAC mode, which MAME logs and declines to handle.
- rtl/cpu/i960/i960_top.sv:1511 A two-word instruction used the cache port for its displacement, so the word after it was never prefetched and every one paid T_FETCH + two cycles of T_FETCH_W for the next instruction even on a hit -- 11-16% of the game's instructions are
- rtl/cpu/i960/i960_top.sv:1632 That is the only way ICR is ever written, and ICR supplies the vector byte for each external IRQ line -- so interrupts are unreachable without it (MAME i960.cpp 0x60.0).
- rtl/cpu/i960/i960_top.sv:1658 MAME fatalerrors on every other 0x60 sub-opcode.
- rtl/cpu/i960/i960_top.sv:1696 i960_regs has always done the work (MAME's: clamp the depth to the cache, write every cached frame out, depth 0); only the dispatch was missing.
- rtl/cpu/i960/i960_top.sv:1738 The link register takes ip_next, because MAME's m_IP is already past the instruction when execute_op runs.
- rtl/cpu/i960/i960_top.sv:1897 Giving up the priority this interrupt ran at can release a queued one, so MAME checks here.
- rtl/cpu/i960/i960_top.sv:1966 Generate IRQ, invalidate I-cache, breakpoints, stop, continue: MAME logs and ignores each one.
- rtl/cpu/i960/i960_top.sv:2014 Only a priority that went DOWN can release a queued interrupt, and MAME checks on exactly that condition rather than on any change.
- rtl/cpu/i960/i960_top.sv:2061 MAME does not guard vector < 8, and the wrap is reproduced rather than corrected: vectors below 8 are reserved on the part, so the address it forms is undefined either way and inventing a guard here would make this disagree with the oracle
- rtl/cpu/i960/i960_top.sv:2080 The +64 is MAME's padding against a save underflow and is not optional -- the three writes below land under FP.
- rtl/cpu/i960/i960_top.sv:2114 MAME clears 0x1f00 -- bits 8 to 12 -- and then ORs the new level into bits 16 to 20 WITHOUT clearing them first.
- rtl/cpu/i960/i960_top.sv:2190 MAME logs, clears the level and gives up rather than taking anything; reproduced, because a generator can build this state.
- rtl/io/m2_backup.sv:27 DEFAULT_ALL_1 above, and it is the one region MAME fills with 0xFF rather than zero -- it is also the region whose contents the boot signature-checks before deciding whether to initialise it, so 0x00 versus 0xFF is a branch and not a detail
- rtl/io/m2_cab_inputs.sv:49 model2.cpp's `daytona` port map, which is `model2` plus `gears` with IN0 and IN1 modified.
- rtl/io/m2_cab_inputs.sv:61 MAME's own limits are PORT_MINMAX(0x20, 0xe0) on all three.
- rtl/io/m2_cab_inputs.sv:67 The cabinet has a five-position shifter and MAME models it as five buttons feeding daytona_gearbox_r, which returns gearvalue[] = {0, 2, 1, 6, 5} for N,1,2,3,4 -- deliberately NOT a binary count, because the real shifter is a set of microsw
- rtl/io/m2_cab_inputs.sv:97 R835: DESERT TANK'S IN1 -- model2.cpp INPUT_PORTS_START(desert): 0x01 Shift (PORT_TOGGLE), 0x10 Machine Gun, 0x20 Cannon, the rest unused; all active low.
- rtl/io/m2_cab_inputs.sv:103 SHIFT IS A LEVER, NOT A BUTTON: the cabinet's forward / reverse switch latches, and MAME models it as a toggle.
- rtl/io/m2_cab_inputs.sv:104 Out of reset it reads 1 (released), MAME's default -- forward.
- rtl/io/m2_cab_inputs.sv:108 With bit 0 low for reverse (R837, read off MAME's input test) Ben's Forward drove the tank backwards and Reverse forwards on s1107, so bit 0 is HIGH in reverse.
- rtl/io/m2_cab_inputs.sv:118 MAME's range is 0x20..0xe0, so +-96 about 0x80.
- rtl/io/m2_cab_inputs.sv:257 THE RANGE IS MODEL 2'S, NOT MODEL 1'S. This board's ADC idles at 0x20 and tops at 0xe0 -- MAME's PORT_MINMAX(0x20,0xe0) on all three channels -- where Model 1 runs 0x01..0xff.
- rtl/io/m2_cab_inputs.sv:270 MAME gives its pedals 0x00..0xff and its wheel 0x00..0xff (no PORT_MINMAX), but the game itself clamps: in MAME 0.289 a race with the accelerator held at 0x20 is the same run, frame for frame, as one at 0x00 ("GAS PEDAL", the tank stands),
- rtl/io/m2_cab_inputs.sv:345 THE GAME NAMES ITS CHANNELS (service mode, INPUT TEST, MAME 0.289): HANDLE (0), ACCEL (1), TURRET (2) -- three, and nothing on 3-7.
- rtl/io/m2_cab_inputs.sv:346 There is no brake: channel 2 is the CANNON'S ELEVATION, an absolute position with 0x80 at centre (MAME's own default for it), lower = aim up (the crosshair at the top of the screen by 0x28), higher = aim down; the game slews the gun to it i
- rtl/io/m2_cab_inputs.sv:420 MAME 0.289 (sim/io/mame_m2_desert_input.lua): with the gun fully up, a jump of the TURRET value to 0xc8 or beyond (0x20 -> 0xc8 / 0xd0 / 0xe0, 0x30 -> 0xe0) sends the gun the wrong way -- it stays pinned up, ignores the input for 10-20 s an
- rtl/io/m2_comm.sv:9 WHAT THE GAME SEES, from the recomp's src/runtime/comm_board.{h,cpp} and m2_board.cpp (the reference for link play -- itself MAME's m2comm in its M2COMM_SIMULATION mode, BSD-3, Ariane Fugmann):
- rtl/io/m2_cpu_bridge.sv:121 Measured in MAME over 900 attract frames: 33,554 writes and 12,269 reads.
- rtl/io/m2_cpu_bridge.sv:204 MAME's generic_fifo never drops -- push() into a full FIFO queues the value and HALTS THE SOURCE -- and this core dropped 429,406 of the i960's commands in one boot because a full FIFO looked like an overflow to guard against rather than a
- rtl/io/m2_cpu_bridge.sv:667 Regions are tested in the order model2.cpp declares them, and the ROM mirror is tested BEFORE the RAM it overlaps so a stray write cannot shadow it.
- rtl/io/m2_cpu_bridge.sv:858 model2.cpp reads it:
- rtl/io/m2_cpu_bridge.sv:1163 Daytona's `stis g0,0x1800000(g4)` at 0x2784 is a HALFWORD store: MAME clears palette entry 0 and leaves entry 1 holding ffff, and we cleared both -- which is precisely why its test menu drew green values and no white labels.
- rtl/io/m2_drive_ffb.sv:14 MAME runs that board's Z80 but leaves its motor output unconnected (model2.cpp, driveio_port_w: "TODO: hook up to the main CPU"), so MAME has no reference for the force.
- rtl/io/m2_drive_ffb.sv:22 The game writes DPRAM 0x11 only when the command changes; the I/O board's firmware copies it to port E once per pass of its loop, about once a frame (measured in MAME 0.289, 9,038 PE writes in 9,038 frames).
- rtl/io/m2_drive_ffb.sv:45 MAME's capture took the first 0x07 only because a slow game frame left it on port E for two scans.
- rtl/io/m2_drive_ffb.sv:71 Uncentring: level * 32767 away from the centre by the steering value the I/O board's ADC reads (0x80 centre, higher = right -- the game's own mapping, MAME daytona with STEER 0xE0 drives into the right-hand wall), 0 within DEAD counts of th
- rtl/io/m2_ioboard.sv:8 On the real cabinet a Z80 behind a 315-5338A sits here running EPR-14869 -- the SAME board and the SAME ROM as Model 1's, confirmed from model2.cpp: model2o instantiates SEGA_MODEL1IO with bios epr14869c.
- rtl/io/m2_ioboard.sv:64 MEASURED: MAME clears it on frame 174 of a 57.5 Hz refresh, which is 3.026 s. At 25 MHz that is 75,652,174 -- a 27-bit counter, and it counts once.
- rtl/io/m2_ioboard.sv:121 MEASURED, not argued: the differential against MAME diverges at 2,609,803 instructions with the window left empty and at 1,300,259 with the block pushed.
- rtl/io/m2_ioboard.sv:187 The Z80's publication of DPRAM word 4 -- byte 0x10 to the i960, which MAME says is the ONE byte a coin changes.
- rtl/io/m2_ioboard.sv:240 MAME says a coin changes exactly that byte and nothing else -- ff to fe, bit 0 low for COIN1 -- so the Z80 publishes the input scan and the i960 does the crediting.
- rtl/io/m2_ioboard.sv:260 MAME's DPRAM is umasked to bytes 0 and 2 of each dword, so DPRAM byte 0x08 -- where R65 measured in0 -- is i960 address 0x01c00010 is dword 4 is dp_lo[4].
- rtl/io/m2_ioboard.sv:262 R65's "byte 0x08" and the MAME write tap's "byte 0x10" are the same place in two numberings.
- rtl/io/m2_ioboard.sv:322 Values are MAME's, sampled at frames 10, 60, 120, 300 and 900 and identical at all five (tools/mame_m2_idblock.lua).
- rtl/io/m2_ioboard.sv:461 The first version cleared the flag exactly once, because MAME clears it exactly once.
- rtl/io/m2_ioz80.sv:34 315-5338A ports, per model1io.cpp's bindings: PB (1) / PC (2) / PD (3) <- IN0 / IN1 / IN2, or DSW1-3 when the firmware selects SECONDARY controls with PA bit 0.
- rtl/io/m2_ioz80.sv:69 R839: THE TYPE-2 BOARD (MAME model1io2, Virtua Cop's 837-11130 with EPR-17181).
- rtl/io/m2_ioz80.sv:87 The light guns, as MAME's model1io2 fpga_r hands them over: 10-bit coordinates in the game's own units, and the off-screen bits {P2, P1}.
- rtl/io/m2_ioz80.sv:101 Cabinet inputs, ACTIVE LOW at rest (0xff = nothing pressed), matching model2.cpp's port definitions: IN0 = {VR3,VR2,VR1,START1,SERVICE,TEST, COIN2,COIN1}, IN1 bits 6:4 = gearbox (ACTIVE HIGH), bit 0 = VR4.
- rtl/io/m2_ioz80.sv:316 model1io.cpp, io_pa_w: "-------0 control switch (0 = first, 1 = second)" and every input port is muxed on it:
- rtl/io/m2_ioz80.sv:329 No new register: PA writes already land in port_out[0], which is exactly where MAME takes the bit from.
- rtl/io/m2_ioz80.sv:420 ------------------------------------------------------------ 93C46 EEPROM The board's own settings store, bit-banged by the firmware through the 315-5338A: PA7 = CLK, PA6 = CS, PA5 = DI, PG7 = DO (model1io.cpp io_pa_w).
- rtl/io/m2_ioz80.sv:451 R839: the type-2 board wires the 93C46 to PF (model1io2.cpp io_pf_w: bit 6 DI, bit 5 CLK, bit 4 CS) and reads DO at 0x8040 bit 6.
- rtl/io/m2_ioz80.sv:477 R839: the type-2 firmware reads the 93C46 the way MAME models it (eepromser.cpp, 93Cxx: output on the FALLING clock): the dummy 0 as the address's last bit is taken, then D15 at the first falling edge.
- rtl/io/m2_ioz80.sv:484 and ones after D0, as MAME shifts in
- rtl/io/m2_ioz80.sv:499 R839: MAME's dummy 0, now
- rtl/io/m2_ioz80.sv:552 MEASURED ON HARDWARE, against MAME running the same firmware: every analog byte the firmware deposited was its input shifted LEFT BY ONE.
- rtl/io/m2_ioz80.sv:555 DPRAM board MAME fed in
- rtl/io/m2_ioz80.sv:585 "analog port switching is handled by two 74hc4066 analog switches" -- model1io.cpp, and analogN_r picks an_cb[N+4] when secondary is selected.
- rtl/io/m2_ioz80.sv:602 What EPR-17181 was measured to touch (MAME 0.289, sim/io/mame_m2_vcop_io .lua: power-on, attract, a coin, a game with both guns, 300 s):
- rtl/io/m2_ioz80.sv:618 0x8200 the MSM6253, mirrored at 0x8204: Virtua Cop binds no channel, so every read is 0x01 (MAME: n 75,792 per address, value 01 always).
- rtl/io/m2_ioz80.sv:765 Status (0x0d) is MAME's 0x08 with BUSY in bit 0.
- rtl/io/m2_rom_loader.sv:46 The V60's four sub-regions are the one place the stream is not a plain copy of a MAME region, because `maincpu` is sparse: it spans 19.5 MB of address space holding 5.5 MB of ROM, with the program at 0x200000, the boot vectors at 0xf80000 a
- rtl/io/m2_vcop_guns.sv:15 MAME 0.289 INPUT_PORTS_START(vcop), which are also the game's own default calibration (its GUN MARK CHECK screen shows these four ranges as AD1 / AD2 XMIN..YMAX):
- rtl/io/m2_vcop_guns.sv:22 model1io2.cpp fpga_r sets a gun's off-screen bit when any coordinate is within 5% of its range of either end (int(span * 0.05): X 24, Y 19 units = 24 / 19 px), which kept the crosshair and every shot 19-24 px from each edge.
- rtl/io/m2_vcop_guns.sv:27 The game has no range test of its own: in MAME, shots at units 0x086 / 0x273 (x px 2 / 493) and 0x027 / 0x1a6 (y px 2 / 381) with the bit clear each spend a round; the bit set reloads.
- rtl/io/m2_vcop_guns.sv:48 The game's own aim mark (GUN MARK CHECK) sits on pixel floor((v - min) * 496 / span) -- MAME's crosshair pixel -- within 0.7 px over 43 marks (R846), so each pixel maps to the smallest unit that lands on it, v - min = ceil(px * span / 496):
- rtl/io/m2_vcop_guns.sv:76 VIRTUA COP 2 (V2 = 1, the 2A build's M2_2A_VCOP2_GUN; R870): the same sticks, mouse, buttons, reload and crosshairs, scaled to MAME 0.289 INPUT_PORTS_START(vcop2):
- rtl/io/m2_vcop_guns.sv:83 Off-screen (R960): the crosshair within 2 px of an edge, or a reload -- NOT MAME's int(span * 0.05f) border (lightgun_offscreen_r: X 24, Y 19 units = 24 / 19 px), which the board showed as a gun that reloads 19-24 px short of every edge.
- rtl/io/m2_vcop_guns.sv:89 Pixels 165, 330 and 495 have no unit of their own (MAME's crosshair skips them); they take the next pixel's. The game reads the four coordinates and the off-screen bits through the 315-5649's serial channel 2 (m2_315_5649 GUN), not an I/O b
- rtl/io/m2_vcop_guns.sv:106 R924: The House of the Dead's ranges instead (the 2C build, where no Virtua Cop 2 runs; with V2): MAME 0.289 INPUT_PORTS_START(hotd) P1_X 173..596 P1_Y 87..380 P2_X 163..596 P2_Y 87..380 rest 0x180 / 0x0e9 / 0x17b / 0x0e9; off-screen int
- rtl/io/m2_vcop_guns.sv:110 The game draws its calibrated min / max on screen pixels x 31.9 / 461.6, y 33.4 / 351.2 (its GUN MARK CHECK, the default calibration, in MAME and on the board alike), so the units a pixel gets are the game's own: v = (px * K + C) >> 16, P1_
- rtl/io/m2_vcop_guns.sv:241 MAME's rest positions
- rtl/io/m2_vcop_guns.sv:275 MAME's 5% border lost 18-25 px at every edge to "reload" (the board, R960); R961 made it 2 px (a calibrated stick at +-127 lands on pixel 1 / 494 / 382: off).
- rtl/io/m2_vcop_guns.sv:302 MAME's rest positions
- rtl/io/m2_vcop_guns.sv:323 ------------------------------------------------------ stage D: off-screen, the ports from the pixel, edge_q (R960: Virtua Cop 2, House of the Dead; R961: Virtua Cop) -- not MAME's 5% border on the coordinates
- rtl/io/m2_vcop_state.sv:17 Found in MAME 0.289 vcopa (sim/io/mame_m2_vcop_play.lua; R849): 0x5016d4 byte 0 the game's mode: 0 boot, 1 attract, 2 credited start, 3 / 4 / 6 stage select and its way in, 7 PLAYING, 0x0c continue, 0x0d game over 0x50ee30 byte 0 player 1
- rtl/io/m2_vcop_state.sv:26 TEST MODE entered during a game leaves all three words as they were (mode stays 7 for the ~3 s of the test screens, MAME) and the game reboots on leaving it, writing the mode word.
- rtl/mem/m2_char_cdc.sv:25 * Every simulation answered char_ack in m2_video's OWN clock, so the frame render reproduced MAME's picture exactly while the board showed a screen of one flat colour -- red through a garbage palette, black once the palette was correct.
- rtl/mem/m2_ddr3.sv:12 The framebuffer is what the hardware does -- MAME redisplays a persistent bitmap when the geometrizer presents nothing new -- and the framework already owns the SCANOUT through FB_EN, so only the write side is ours to build.
- rtl/tgp/fp_div.sv:13 MAME evaluates it as f2u(u2f(m_d) / u2f(m_a)) — plain host division with the default round-to-nearest-even.
- rtl/tgp/fp_mul.sv:30 MAME evaluates with host floats, which are fully IEEE and honour denormals.
- rtl/tgp/m2_copro.sv:9 THE INTERFACE, from model2.cpp's own address map rather than description:
- rtl/tgp/m2_copro.sv:62 model2.cpp:
- rtl/tgp/m2_copro.sv:121 MAME's generic_fifo NEVER drops: push() into a full FIFO stores the value in m_extra_values and halts the source.
- rtl/tgp/m2_copro.sv:188 model2.cpp sets both up as EIGHT deep, and the outbound one is exactly eight here: the TGP writing into a full output FIFO must stall, and it does, by having its acknowledge withheld.
- rtl/tgp/m2_copro.sv:193 MAME's generic_fifo does NOT block a push into a full FIFO -- gen_fifo.cpp, push():
- rtl/tgp/m2_copro.sv:255 model2.cpp:202-205 sets up copro_fifo_out with `m_maincpu->i960_stall()` as its on-empty callback, and gen_fifo.cpp:109-115 fires that callback BEFORE returning T(): the zero is returned to an instruction that has already been cancelled.
- rtl/tgp/m2_copro.sv:258 i960.h:71-75 is the whole of i960_stall() -- `m_stalled = true; m_IP = m_PIP;` -- and i960.cpp:2053 refuses to write the destination register while stalled.
- rtl/tgp/m2_copro.sv:297 The reference has no such state: MAME's TGP is a scheduled device that is always able to run, so `on_fifo_unempty` can always arrive.
- rtl/tgp/m2_copro.sv:420 model2.cpp:193-196 sets up copro_fifo_in with `m_copro_tgp->stall()` on empty, then HALT at the sync; gen_fifo.cpp:109-115 fires it before returning T(); mb86233.cpp:1225-1227 (`do_stall: m_pc = m_ppc`) replays the instruction.
- rtl/tgp/m2_copro.sv:423 MAME's TGP parks at 004c with the FIFO empty -- it does NOT fall through `0053 brif !zrd` into the idle handler.
- rtl/tgp/m2_copro.sv:433 With the pop held, the only read that can consume a command is the dispatch at 004c, exactly as in MAME.
- rtl/tgp/m2_tgp.sv:14 From model1.cpp's machine config and model1_m.cpp's handlers — see docs/m2-tgp-integration.md for the full transcription.
- rtl/tgp/m2_tgp.sv:24 It has FOUR address registers, selected by IO address bits 4:3 — MAME's `.select(0x18)` with `m_copro_ram_adr[offset >> 3]` — and its increment is unconditional, stepping by FOUR when bit 18 of the register is set and by one otherwise.
- rtl/tgp/m2_tgp.sv:50 gen_fifo.cpp's pop() returns T() on an empty FIFO -- but only AFTER firing the on-empty callback, which for the Model 2 TGP is `m_copro_tgp->stall()` (model2.cpp:193-196).
- rtl/tgp/m2_tgp.sv:52 mb86233.cpp:1225-1227 then replays the instruction: `do_stall: m_pc = m_ppc`.
- rtl/tgp/m2_tgp.sv:53 MAME's TGP sits at 004c until a word arrives and never enters the idle handler on an empty FIFO.
- rtl/tgp/m2_tgp.sv:396 That direction is the V60 reading results, where acknowledging an empty read returned a stale word and hung the CPU at fed5a4; MAME halts the maincpu there rather than letting it proceed.
- rtl/tgp/m2_tgp.sv:401 may be bigger than the fifo size" -- so the reference TGP carries straight on and MAME cannot reach the state this created.
- rtl/tgp/m2_tgp.sv:404 MEASURED, and it is why the board sat at frame 1: the i960 parks on the mailbox poll at 0x1166C (R142), stops draining results, `fout` fills, and the coprocessor freezes here -- 10,815 retires in 40 SECONDS, about 270 instructions per secon
- rtl/tgp/m2_tgp.sv:463 model2.cpp installs the math units and THEN the view, over the whole space:
- rtl/tgp/m2_tgp.sv:487 sel_radr/sel_rdat are a MODEL 1 inheritance in any case -- model1_m.cpp's copro RAM window.
- rtl/tgp/m2_tgp.sv:493 The 0x10 read R156 was aimed at is real and still owed -- but sel_math was gated with it, on an argument from MAME's view semantics rather than a measurement, and the pair has never been separated.
- rtl/tgp/m2_tgp.sv:505 That half was an argument from MAME's view semantics, not a measurement, and on the board it cost the tilemap -- the TGP hung, the i960 stalled on its next FIFO read, and the CPU never drew.
- rtl/tgp/m2_tgp.sv:517 GATED BY THE WINDOW, AS THE FULL R156 HAD IT AND AS MAME'S VIEW SEMANTICS SAY.
- rtl/tgp/m2_tgp.sv:532 sincos, atan, inv and isqrt, read off model1_m.cpp's copro_sincos_r, copro_atan_r, copro_inv_r and copro_isqrt_r.
- rtl/tgp/m2_tgp.sv:576 ATAN, PER MODEL 2 (model2.cpp copro_atan_r), NOT MODEL 1 (R212).
- rtl/tgp/m2_tgp.sv:618 The table-word fixup that stood here was Model 1's (model1_m.cpp corrects a ROM table on the way out); Model 2's handler reads its table as it is.
- rtl/tgp/m2_tgp.sv:749 R146: the mailbox word is a computed float result, and ours is 0xFFFFFFFF where MAME's is 0.
- rtl/tgp/m2_tgp.sv:777 MAME does this on both the read and the write handler.
- rtl/tgp/mb86233_agu.sv:13 src/devices/cpu/mb86233/mb86233.cpp (ea_pre_0/1, ea_post_0/1) SPDX-License-Identifier: BSD-3-Clause Copyright-holders: Olivier Galibert
- rtl/tgp/mb86233_agu.sv:21 MAME's ea_pre_* computes the effective address and ea_post_* updates the index register; both are functions of the same instruction field, so there is no state here.
- rtl/tgp/mb86233_agu.sv:28 MAME's header comment calls it the "automatic 0x200 adder", which reads as if ea_pre_* applies it.
- rtl/tgp/mb86233_agu.sv:29 It does not: ea_pre_* never mentions 0x200, and the adder is applied by individual instruction forms at their call sites — the `mem + 0x200` variants at mb86233.cpp lines 770, 785, 870 and 912, plus write_mem_internal_1's bank flag.
- rtl/tgp/mb86233_agu.sv:59 MAME does it both ways: 1: u16 arithmetic, wraps at 0x10000 (write_mem_internal_1) 0: u32 arithmetic, so 0xffff + 0x200 reaches 0x101ff (the mem + 0x200 instruction forms) Only reachable with an EA already near 0xffff, but the two disagree
- rtl/tgp/mb86233_alu.sv:13 src/devices/cpu/mb86233/mb86233.cpp (alu_pre / alu_post_1 / alu_post_2) SPDX-License-Identifier: BSD-3-Clause Copyright-holders: Olivier Galibert
- rtl/tgp/mb86233_alu.sv:63 SFT is a u8 in MAME; only [4:0] are used
- rtl/tgp/mb86233_alu.sv:73 MAME's case 0x0f (rep/clr0/clr1/set) calls alu_pre and alu_post_1 and then STOPS — it never calls alu_post_2 — so an FP op encoded there computes its result and discards it.
- rtl/tgp/mb86233_alu.sv:145 Numerator is D, denominator is A: MAME evaluates f2u(u2f(m_d) / u2f(m_a)).
- rtl/tgp/mb86233_alu.sv:171 MAME's flag model never sets OVD, UND or DVZD from anywhere: alu_pre puts them in the clear-mask and stset_set_sz_* only ever sets ZRD or SGD.
- rtl/tgp/mb86233_alu.sv:239 Round to nearest, ties to even — the host FPU default that MAME's f2u(s32) inherits.
- rtl/tgp/mb86233_alu.sv:256 Modes are MAME's, and mode 0 is C's roundf: half away from zero, NOT the half-to-even the FP units use for their own rounding.
- rtl/tgp/mb86233_alu.sv:340 SFT is a u8 but MAME evaluates `m_d >> m_sft` directly, which is undefined in C++ above 31 and masks to 5 bits on x86.
- rtl/tgp/mb86233_alu.sv:373 MAME keeps them as separate cases computing identical expressions; so do we.
- rtl/tgp/mb86233_alu.sv:383 fned leaves +0 alone rather than producing -0: MAME writes `m_d ?
- rtl/tgp/mb86233_alu.sv:526 Gating only the mask still ORs ZRD in — a zeroed r1 reads as "result was zero" — so nop, fml and every undecoded opcode would set ZRD on an instruction MAME leaves ST completely alone for.
- rtl/tgp/mb86233_alu.sv:538 Write-priority arbitration, from MAME's own comment: with two writes to one register in a single instruction, transfers beat integer ops but FP ops beat transfers.
- rtl/tgp/mb86233_core.sv:13 src/devices/cpu/mb86233/mb86233.cpp (execute_run) SPDX-License-Identifier: BSD-3-Clause Copyright-holders: Olivier Galibert
- rtl/tgp/mb86233_core.sv:25 TIMING IS NOT MAME'S. MAME executes an instruction atomically and charges cycles afterwards; this is a multi-cycle FSM.
- rtl/tgp/mb86233_core.sv:32 MAME models an incomplete external access as `m_stall` plus `goto do_stall`, which resets PC to ppc and re-executes the whole instruction.
- rtl/tgp/mb86233_core.sv:327 MAME keeps m_st as state and updates it exactly once per instruction:
- rtl/tgp/mb86233_core.sv:328 mb86233.cpp:201 m_st = F_ZRC|F_ZRD|F_ZX0|F_ZX1|F_ZX2|F_ZC0|F_ZC1;
- rtl/tgp/mb86233_core.sv:329 mb86233.cpp:499 m_st = (m_st & ~m_alu_stmask) | m_alu_stset; That is what this now is.
- rtl/tgp/mb86233_core.sv:336 Reset value is MAME's, minus the two the sequencer owns:
- rtl/tgp/mb86233_core.sv:414 MAME calls alu_pre(alu) at the TOP of every instruction, before the memory access and before the parallel transfer writes its register.
- rtl/tgp/mb86233_core.sv:614 MAME calls alu_pre and alu_post only from cases 0x00, 0x07 and 0x0f; everywhere else the bits that would be the ALU field are immediate data that merely aliases onto it.
- rtl/tgp/mb86233_core.sv:657 MAME reads A with ea_pre_0(r1) and B with ea_pre_1(r2) - different field, different bank, and ea_post_1(r2) afterwards.
- rtl/tgp/mb86233_core.sv:764 Bit 14 of the instruction's low half selects register over memory, exactly as MAME's `opcode & 0x4000` does.
- rtl/tgp/mb86233_core.sv:770 MAME's ea_pre_0: `switch(r & 0x180) case 0x000: return r & 0x7f`.
- rtl/tgp/mb86233_core.sv:793 Everything else read index 0 (b0) -- including a register-sourced rep, still: Model 1's deb6642 reads opcode[5:0] there (MAME), not ported (R732), and that is now the 6'd0 below.
- rtl/tgp/mb86233_core.sv:909 MAME, mb86233.cpp case 6: when the condition passes, `v = m_data.read_dword(ea_pre_0(opcode)); ea_post_0(opcode); write_reg(opcode >> 9, v)`.
- rtl/tgp/mb86233_core.sv:934 MAME's pop on an empty FIFO returns zero AND calls stall(), and `goto do_stall` re-executes the instruction -- so the read does not retire until a command arrives.
- rtl/tgp/mb86233_core.sv:965 `lab` is load A AND B - MAME's case 0x00 ends `m_a = v1; m_b = v2;` - and this state issued the read for v2, waited for it, and never captured it, while lab_a_val was assigned and never read by anything.
- rtl/tgp/mb86233_core.sv:976 MAME calls alu_pre(alu) at the top of the instruction and only then assigns m_a/m_b, so the parallel ALU op of a `lab` sees the OLD operands.
- rtl/tgp/mb86233_core.sv:1016 Only sub-op 5 is implemented in MAME; the rest log.
- rtl/tgp/mb86233_core.sv:1058 EA = opcode & 0x7f, MAME's ea_pre_0 mode 0.
- rtl/tgp/mb86233_core.sv:1127 MAME, mb86233.cpp case 1 (brul) and case 3 (bsul): if(opcode & 0x4000) { v = read_reg(opcode); } // register else { ea = ea_pre_0(opcode); v = read_dword(ea); } // memory and read_reg masks its argument to SIX bits (`r &= 0x3f`), so
- rtl/tgp/mb86233_dec.sv:13 src/devices/cpu/mb86233/mb86233.cpp (execute_run dispatch) SPDX-License-Identifier: BSD-3-Clause Copyright-holders: Olivier Galibert
- rtl/tgp/mb86233_dec.sv:25 The encoding exists nowhere but MAME.
- rtl/tgp/mb86233_dec.sv:25 mb86233d.cpp gives the field layout and mb86233.cpp gives the semantics; there is no datasheet with opcode encodings.
- rtl/tgp/mb86233_dec.sv:32 0x0d stm / clm only sub-op 5 (stmh) is implemented in MAME
- rtl/tgp/mb86233_dec.sv:39 MAME has `(opcode >> 21) & 0x1f` in the first two and `(opcode >> 20) & 0x1f` in the third.
- rtl/tgp/mb86233_dec.sv:129 bit 30 is what separates 0x2f from 0x3f, and MAME reads it directly as `opcode & 0x40000000` rather than deriving it from the dispatch value.
- rtl/tgp/mb86233_dec.sv:163 MAME assigns to a u8 either way, so only the low 8 bits survive.
- rtl/tgp/mb86233_mem.sv:13 src/mame/sega/model1_m.cpp (copro_data_map) BSD-3-Clause / GPL-2.0 mixed — see THIRD-PARTY.md
- rtl/tgp/mb86233_mem.sv:92 Kept as two separate arrays rather than one 0x000-0x3ff block with a hole: the banks are physically distinct on the die (the 86233 has "two normal independent ram banks, one of 256 dwords and one of 512" per MAME's header) and inferring the
- rtl/tgp/mb86233_mem.sv:166 MAME models this as m_stall plus `goto do_stall`, which re-executes the whole instruction.
- rtl/tgp/mb86233_pkg.sv:11 Portions of this file transcribe constants (opcode numbering, status flag bit positions, exponent/mantissa field accessors) from MAME's MB86233 device model:
- rtl/tgp/mb86233_pkg.sv:15 src/devices/cpu/mb86233/mb86233.cpp SPDX-License-Identifier: BSD-3-Clause Copyright-holders: Olivier Galibert
- rtl/tgp/mb86233_pkg.sv:60 Both MAME sources agree they are 0x16 ..
- rtl/tgp/mb86233_pkg.sv:61 0x1b: mb86233.cpp alu_pre cases 0x16-0x1b, and mb86233d.cpp lines 243-248 disassemble the same numbering.
- rtl/tgp/mb86233_pkg.sv:71 SFT is a u8 in MAME and the shift ops evaluate `m_d >> m_sft` directly, which is undefined in C++ for counts above 31.
- rtl/tgp/mb86233_pkg.sv:72 On x86 the host masks to 5 bits, so that is what MAME exhibits in practice and what is modelled here.
- rtl/tgp/mb86233_pkg.sv:103 Ops that write D from the integer path (MAME alu_post_1).
- rtl/tgp/mb86233_pkg.sv:105 Note cxfd/cfxd sit here despite one of them producing a float: MAME dispatches both from alu_post_1, not alu_post_2.
- rtl/tgp/mb86233_pkg.sv:122 Ops dispatched from MAME alu_post_2, every one of which does m_icount--.
- rtl/tgp/mb86233_pkg.sv:132 MAME computes its flags with stset_set_sz_int on the float bit pattern.
- rtl/tgp/mb86233_pkg.sv:151 MAME's alu_pre default plus nop (0x00, 0x12, 0x15, 0x1c-0x1f).
- rtl/tgp/mb86233_regs.sv:13 src/devices/cpu/mb86233/mb86233.cpp (read_reg / write_reg) SPDX-License-Identifier: BSD-3-Clause Copyright-holders: Olivier Galibert
- rtl/tgp/mb86233_regs.sv:57 read_reg — combinational, as MAME's is
- rtl/tgp/mb86233_regs.sv:73 and model2.cpp's copro_tgp_rf_map puts the input FIFO at rf 1 and the output FIFO at rf 2.
- rtl/tgp/mb86233_regs.sv:132 Sixteen 32-bit registers are flip-flops on the device and come up cleared; MAME's RF space is zero-filled RAM.
- rtl/tgp/mb86233_regs.sv:222 explicit no-op in MAME
- rtl/tgp/mb86233_regs.sv:260 MAME: case 0x0f: break;
- rtl/tgp/mb86233_regs.sv:276 logs in MAME, no state change
- rtl/tgp/mb86233_regs.sv:292 clr0 last: MAME applies it inside the 0x0f case, after alu_pre and before alu_post_1, so it beats anything the transfer path wrote.
- rtl/tgp/mb86233_seq.sv:13 src/devices/cpu/mb86233/mb86233.cpp (execute_run, pcs_push/pcs_pop) SPDX-License-Identifier: BSD-3-Clause Copyright-holders: Olivier Galibert
- rtl/tgp/mb86233_seq.sv:30 MAME's `if(m_r != 1) { m_pc = m_ppc; m_r--; }` sits below the whole instruction switch, so a taken branch inside an active repeat is computed and then discarded.
- rtl/tgp/mb86233_seq.sv:94 That is MAME's behaviour and it is reachable.
- … 193 more
Says it matches, follows or was checked against MAME — 18
- Model2.sv:2881 The board's 48 bytes went out over that wire and matched MAME's signature exactly; they now go to a 68000 that reads them.
- Model2.sv:3401 The words themselves are now known good: the board pushes 01800000 (op 03 window_data, byte-identical to MAME's dword 2) and 07800000 (op 0f geo_end).
- Model2.sv:4088 Low half first, which is the order the MRA's interleave puts them in: opr-14742a supplies bits 15:0 and opr-14743a bits 31:16, verified against MAME's own copro_tgp_tables region.
- Model2.sv:5504 Everything upstream measures identical to MAME: the button gives 20 edges for 20 presses, the Z80 publishes DPRAM word 4 with a lowest-ever 0xFE exactly as MAME's does, and the i960 demonstrably reads that byte because Start, Test and Servi
- Model2.sv:5880 The tilemaps are RIGHT -- maps 2 and 3 match MAME's content exactly, 4,096 real tiles each -- and the screen is two flat bands.
- rtl/cpu/i960/i960_top.sv:1374 It survived 803,355 instructions verified against MAME because NOTHING TOUCHES MEMORY UNTIL A FRAME SPILLS, and a spill needs the call depth to exceed the four-frame register cache.
- rtl/io/m2_cpu_bridge.sv:874 Found from the board: the CPU builds a correct palette (4,036 of 4,096 words matching MAME) and a correct tilemap (32,340 of 32,768), and the screen was still white.
- rtl/tgp/fp_mul.sv:34 Default matches MAME.
- rtl/tgp/mb86233_pkg.sv:23 Ground truth: MAME src/devices/cpu/mb86233/mb86233.cpp (Olivier Galibert).
- rtl/tgp/mb86233_pkg.sv:202 Kept verbatim only so the transcription matches MAME line for line.
- rtl/tgp/mb86233_regs.sv:286 The AGU's post-increment likewise beats a same-cycle write_reg to the index register, matching MAME's ordering: ea_post_* runs after the transfer that used the address.
- rtl/video/m2_geo_xform.sv:52 WHY IT IS BIT-EXACT AGAINST MAME AND NOT MERELY CLOSE
- rtl/video/m2_geo_xform.sv:54 MAME evaluates the geometry in host `float`, and fp_mul and fp_add are fuzzed against host float directly (sim/tgp/tb_fp_mul.cpp: "reference is the host C float, matching MAME's evaluation model").
- rtl/video/m2_geometry.sv:80 Matched on the texture's place on its sheet, its size and (where a place is shared with other content) its wrap-x bit -- each entry was checked against every polygon MAME drew over 32,490 frames of both Daytona sets, all three courses, attr
- README.md:47 | **TGP coprocessor** | The MB86233 runs the game's own microcode, which the core extracts from the data ROM. On a recorded race its results match MAME's, apart
- README.md:49 | **2D tilemap** | Pixel-exact against MAME. A four-line buffer ring stops it dropping scanlines on busy screens. |
- README.md:50 | **Sound board** | Its own 68000 (fx68k), the YM3438 (jt12), and both MultiPCM sample chips on one shared engine. Levels match MAME's to within about a dB. |
- README.md:77 | **P1.5** | 2D on hardware | Done, pixel-exact against MAME. |
Says it was translated, ported or taken from MAME — 18
- rtl/cpu/i960/i960_agu.sv:11 Transcribed from MAME's i960 device, get_ea (BSD-3-Clause, Farfetch'd and R. Belmont).
- rtl/cpu/i960/i960_alu.sv:11 Semantics transcribed from MAME's i960 device (BSD-3-Clause, Farfetch'd and R. Belmont), execute_op cases 0x58-0x5b.
- rtl/cpu/i960/i960_dec.sv:11 Encoding transcribed from MAME's i960 device (BSD-3-Clause, Farfetch'd and R. Belmont).
- rtl/cpu/i960/i960_ldst.sv:11 Transcribed from MAME's i960 device, MEM opcodes 0x80-0xca and the i960_read/write_*_unaligned helpers (BSD-3-Clause, Farfetch'd, R. Belmont).
- rtl/cpu/i960/i960_lsu.sv:11 Sequencing transcribed from MAME's i960 device: the MEM opcodes and i960_read/write_word/dword_unaligned (BSD-3-Clause, Farfetch'd, R. Belmont).
- rtl/cpu/i960/i960_muldiv.sv:11 Transcribed from MAME's i960 device, REG blocks 0x67, 0x70 and 0x74 (BSD-3-Clause, Farfetch'd and R. Belmont).
- rtl/cpu/i960/i960_regs.sv:11 Semantics transcribed from MAME's i960 device (BSD-3-Clause, Farfetch'd and R. Belmont): do_call, do_ret, do_ret_0 and flushreg.
- rtl/cpu/i960/i960_top.sv:169 ------------------------------------------------------- interrupt state Transcribed from MAME i960.cpp.
- rtl/io/m2_ioz80.sv:20 The map and devices are taken from MAME (model1io.cpp, 315_5338a.cpp, msm6253.cpp), which is this project's ruling reference:
- rtl/tgp/mb86233_agu.sv:11 Behaviour transcribed from MAME's MB86233 device model:
- rtl/tgp/mb86233_alu.sv:11 Behaviour transcribed from MAME's MB86233 device model:
- rtl/tgp/mb86233_core.sv:11 Behaviour transcribed from MAME's MB86233 device model:
- rtl/tgp/mb86233_dec.sv:11 Behaviour transcribed from MAME's MB86233 device model:
- rtl/tgp/mb86233_mem.sv:11 Behaviour transcribed from MAME's Model 1 driver:
- rtl/tgp/mb86233_pkg.sv:192 Copied verbatim from MAME.
- rtl/tgp/mb86233_regs.sv:11 Behaviour transcribed from MAME's MB86233 device model:
- rtl/tgp/mb86233_seq.sv:11 Behaviour transcribed from MAME's MB86233 device model:
- rtl/tgp/mb86233_xfer.sv:11 Behaviour transcribed from MAME's MB86233 device model:
Keeps a MAME approximation — 2
- Model2.sv:350 R630: GAMMA, because MAME's curve is MAME's guess at cabinet calibration (m2_palette) and the board is judged on Ben's own screen.
- README.md:75 | **P0** | Measure before building | Done. The approach was costed from instrumented MAME and from other cores on this chip, not guessed. |
Shares text with the MAME driver without saying so — 47
- Model2.sv:1835 model2.cpp: "initialize bufferram to a sane default", m_bufferram[i] = — shares text with sega/model2.cpp:299
- Model2.sv:3132 // if 60 Hz mode or frame number is even, trigger geometrizer to start new frame — shares text with sega/model2.cpp:2427
- Model2.sv:3133 if ((m_videocontrol & 1) == 0 || (m_framenum & 1) == 0) — shares text with sega/model2.cpp:2428
- Model2.sv:3208 unsigned char ID[]={0,'T','A','H',0,'A','K','O',0,'Z','A','K',0,'M','T','K'}; — shares text with sega/model2.cpp:1016
- Model2.sv:3360 r |= ((address >> 10) & 3) << 29; // eye mode, Sega Rally — shares text with sega/model2.cpp:875
- rtl/io/m2_backup.sv:8 map(0x01d00000, 0x01d03fff).ram().share("backup1") — shares text with sega/model2.cpp:1065
- rtl/io/m2_backup.sv:9 NVRAM(config, "backup1", nvram_device::DEFAULT_ALL_1) — shares text with sega/model2.cpp:2569
- rtl/io/m2_cpu_bridge.sv:118 `map(0x00900000,0x0091ffff).mirror(0x60000).ram().share("bufferram")` -- — shares text with sega/model2.cpp:1040
- rtl/io/m2_cpu_bridge.sv:860 r = m_colorxlat[(0x0080 >> 1) + (((palcolor >> 0) & 0x1f) << 8)]; — shares text with sega/model2.cpp:367
- rtl/io/m2_drive_ffb.sv:16 driveio_port_w: "TODO: hook up to the main CPU"), so MAME has no reference — shares text with sega/model2.cpp:2611
- rtl/tgp/m2_copro.sv:21 void model2_tgp_state::copro_fifo_w(u32 data) — shares text with sega/model2.cpp:624
- rtl/tgp/m2_copro.sv:23 if (m_coproctl & 0x80000000) { m_copro_tgp_program[m_coprocnt] = data; — shares text with sega/model2.cpp:626
- rtl/tgp/m2_copro.sv:25 else m_copro_fifo_in->push(u32(data)); — shares text with sega/model2.cpp:631
- rtl/tgp/m2_copro.sv:40 FIFO DEPTH IS EIGHT, from `m_copro_fifo_in->setup(8, ...)`. Not a guess and — shares text with sega/model2.cpp:193
- rtl/tgp/m2_copro.sv:64 void copro_function_port_w(offs_t offset, u32 data) { — shares text with sega/model2.cpp:599
- rtl/tgp/m2_copro.sv:68 m_copro_fifo_in->push(u32(d)); — shares text with sega/model2.cpp:605
- rtl/tgp/m2_tgp.sv:466 map(0x0000, 0xffff).view(m_copro_tgp_bank); — shares text with sega/model2.cpp:470
- rtl/tgp/m2_tgp.sv:467 m_copro_tgp_bank[0](0x0000, 0xffff).rw(copro_tgp_memory_r, ...); — shares text with sega/model2.cpp:471
- rtl/video/m2_geo.sv:11 void geo_prg_w(u32 data) { — shares text with sega/model2.h:174
- rtl/video/m2_geo.sv:15 void push_geo_data(u32 d) { m_bufferram[m_geo_write_start_address/4] = d; — shares text with sega/model2.cpp:780
- rtl/video/m2_geo.sv:16 m_geo_write_start_address += 4; } — shares text with sega/model2.cpp:780
- rtl/video/m2_geo.sv:722 for (i = 0; i < 3; i++) geo->matrix[i+9] = u2f(*input++); — shares text with sega/model2_v.cpp:544
- rtl/video/m2_geo.sv:866 `(m_geo_read_start_address & 0x1ffff)/4`, and the mask is not — shares text with sega/model2_v.cpp:2329
- rtl/video/m2_geo_engine.sv:54 "if count == 0 then rolls over to max size" gives 0xfffff -- 1,048,575 — shares text with sega/model2_v.cpp:1747
- rtl/video/m2_geo_engine.sv:545 model2_3d_push(raster, luma << 15); — shares text with sega/model2_v.cpp:1111
- rtl/video/m2_geo_engine.sv:622 "if count == 0 then rolls over to max size" -- Virtual On and — shares text with sega/model2_v.cpp:1747
- rtl/video/m2_geo_engine.sv:966 reuse P0(n-1) and P0(n) — shares text with sega/model2_v.cpp:543
- rtl/video/m2_geo_engine.sv:969 reuse P1(n-1) and P1(n) — shares text with sega/model2_v.cpp:551
- rtl/video/m2_geo_engine.sv:972 0 and 2: reuse P0(n) and P1(n) — shares text with sega/model2_v.cpp:533
- rtl/video/m2_geometry.sv:589 exponent = ((f >> 23) & 0xff) - ((z_adjust >> 23) & 0xff) — shares text with sega/model2_v.cpp:174
- rtl/video/m2_palette.sv:26 u8 r = m_colorxlat[(0x0080 >> 1) + (((palcolor >> 0) & 0x1f) << 8)]; — shares text with sega/model2.cpp:367
- rtl/video/m2_palette.sv:27 u8 g = m_colorxlat[(0x4080 >> 1) + (((palcolor >> 5) & 0x1f) << 8)]; — shares text with sega/model2.cpp:368
- rtl/video/m2_palette.sv:28 u8 b = m_colorxlat[(0x8080 >> 1) + (((palcolor >> 10) & 0x1f) << 8)]; — shares text with sega/model2.cpp:369
- rtl/video/m2_palette.sv:29 r = m_gamma_table[r]; g = ...; b = ...; — shares text with sega/model2.cpp:370
- rtl/video/m2_palette.sv:57 // convert color space; this works OK for most games — shares text with sega/model2_v.cpp:2387
- rtl/video/m2_palette.sv:58 // real cabinets probably have their monitors calibrated depending on the game — shares text with sega/model2_v.cpp:2388
- rtl/video/m2_texel_bl.sv:246 model2_v.cpp: "disable smooth wrapping if mirroring is enabled". — shares text with sega/model2_v.cpp:586
- rtl/video/m2_texel_bl.sv:912 model2_v.cpp: "disable smooth wrapping if mirroring is enabled". — shares text with sega/model2_v.cpp:586
- rtl/video/m2_tile_decode.sv:15 segaic24.cpp says why: "The tilemap chip has been reused for model1 and — shares text with sega/segaic24.cpp:12
- rtl/video/m2_tile_decode.sv:16 model2, probably because they had it handy and it handles medium res." So — shares text with sega/segaic24.cpp:12
- rtl/video/m2_tile_decode.sv:30 8, 8, SYS24_TILES, 4, {0,1,2,3}, {STEP8(0,4)}, {STEP8(0,32)}, 8*32 — shares text with sega/segaic24.cpp:43
- rtl/video/m2_tile_decode.sv:39 set_gfx(..., (uint8_t *)char_ram.get(), NATIVE_ENDIAN_VALUE_LE_BE(8,0), ...) — shares text with sega/segaic24.cpp:100
- rtl/video/m2_tile_decode.sv:111 MAME: tileinfo.set(gfx, val & tile_mask, (val >> 7) & 0xff, 0); — shares text with sega/segaic24.cpp:55
- rtl/video/m2_video.sv:46 hscr = tile_ram[0x5000 + (layer >> 1)] — shares text with sega/segaic24.cpp:342
- rtl/video/m2_video.sv:47 vscr = tile_ram[0x5004 + (layer >> 1)] — shares text with sega/segaic24.cpp:343
- rtl/video/m2_video.sv:1052 MAME reads tile_ram[0x5004 + ((layer >> 1) & 2)], which for our — shares text with sega/segaic24.cpp:344
- rtl/video/m2_video_timing.sv:42 Model 2: set_raw(32_MHz_XTAL/2, 656, 0, 496, 424, 0, 384) — shares text with sega/model2.cpp:2523