← All cores
Arcade-Atari-G42 (Gm0rk)
Cites hardware documentation that MAME's driver does not — 2
- rtl/asic65/g42_asic65.sv:7 rom_based = 1 (Road Riot 4WD, ASIC65_ROMBASED): a TMS32010-family DSP (tms32010.sv) runs the 136089-1012 program from a 2K x 16 block RAM that the ROM loader fills (words 0x800-0xFFF of the 4K program space read 0, as MAME's zero-filled reg
- rtl/jsa3/g42_jsa3.sv:6 Follows MAME's atari_jsa_iii_device (atarijsa.cpp, "full map verified from schematics and Batman GALs") and is derived from the Atari G1 JSA II (g1_jsa2.sv), whose hardware-verified bus timing, JT51/JT6295 hookup and comm latches it keeps.
Cites hardware references or measurements that MAME's driver also gives — 1
Notes where it differs from MAME — 3
- rtl/board/g42_top.sv:792 synthesis translate_off Unmapped accesses are legal (MAME ignores them) but worth seeing in a simulation log.
- rtl/jsa3/g42_jsa3.sv:39 As on the G1 JSA II, whose schematic shows the 6502 reading the test line through an inverting buffer, the 6502 here reads test-on as 1: at reset all three programs test bit 7 of $280C and run their RAM/ROM diagnostics (bank walk $45/$85/$C
- README.md:61 Where the core differs from MAME, it follows the board: the sound CPU sees the test switch, and the ASIC65's data RAM is the real TMS320C15's 256 words.
Cites MAME source — 152
- rtl/asic65/g42_asic65.sv:5 Follows MAME asic65.cpp in its two G42 flavours, selected at runtime:
- rtl/asic65/g42_asic65.sv:7 rom_based = 1 (Road Riot 4WD, ASIC65_ROMBASED): a TMS32010-family DSP (tms32010.sv) runs the 136089-1012 program from a 2K x 16 block RAM that the ROM loader fills (words 0x800-0xFFF of the 4K program space read 0, as MAME's zero-filled reg
- rtl/asic65/g42_asic65.sv:13 Host latches, as MAME's synced_write / read / io_r / m68k_r/w / stat_r/w: 68000 write $F80000/2 : TDATA = data, CMD = offset, TFULL = 1, and a DSP interrupt request (pending until taken)
- rtl/asic65/g42_asic65.sv:21 (bit 12 is a jumper; MAME and the program's normal path want it set) DSP OUT port 1 : XFLG = data & 1 BIO : asserted while TFULL == 0 asic_reset holds the DSP in reset and does not touch the latches: the game writ
- rtl/asic65/g42_asic65.sv:30 rom_based = 0 (Guardians of the 'Hood, Danger Express, ASIC65_GUARDIANS): the DSP is held in reset and the answers come from MAME's C++ (command_map row 2): REFLECT, CHECKSUM (0x0027), VERSION (0x0013), RAMTEST (0), RESET, INITBANKS, SETBAN
- rtl/asic65/g42_asic65.sv:34 Parameters go to a 32-word array, a command write resets both indices, and read() applies its side effects in MAME's order.
- rtl/asic65/g42_asic65.sv:37 Undefined behaviour in the C++ is replaced by its sane equivalent: m_command == -1 decodes as OP_UNKNOWN (result 0); parameters past the 32nd are dropped (MAME writes past the array into m_yorigin, unused in this mode); SETBANK with m_param
- rtl/asic65/g42_asic65.sv:52 DSP data RAM: 256 = TMS320C15 (real part), 144 = MAME
- rtl/asic65/g42_asic65.sv:73 DSP program counter (16 bits, as MAME)
- rtl/asic65/g42_asic65.sv:124 MAME's io map mirrors ports 0/1 at 2/4/6 and 3/5/7: bits 2-1 are not decoded
- rtl/asic65/tms32010.sv:5 Instruction-exact model of MAME's tms320c1x.cpp (0.264: tms32010.cpp, functionally identical): same architectural results for every opcode, including MAME's quirks, and the same cycle count per execute_run() iteration.
- rtl/asic65/tms32010.sv:8 Quirks reproduced on purpose: * the PC is 16 bits and never masked (branch operands are loaded whole); program addresses (fetch, TBLR/TBLW, CALA) and the stack use 12 bits * ST bits 12-9 and 7-1 read as 1; LST keeps INTM and ignores next-AR
- rtl/asic65/tms32010.sv:23 An iteration of MAME's loop (optional interrupt entry + one instruction) runs in four clocks, S_IDLE -> S_DEC -> S_OPR -> S_EXE, and all its effects (register writes, the data RAM write, the I/O strobe, the BIO sample) land in S_EXE.
- rtl/asic65/tms32010.sv:27 A signed budget counts ce pulses minus the cycles MAME charges: an iteration starts whenever the budget is positive, exactly like MAME's do { } while (icount > 0), so a 0-cycle illegal opcode is followed at once by the next instruction and
- rtl/asic65/tms32010.sv:35 TBLW writes are dropped (MAME maps the space as ROM).
- rtl/asic65/tms32010.sv:37 DRAM_WORDS selects the map: 144 = TMS320C10 (0x00-0x8F, what MAME instantiates), 256 = TMS320C15 (the part Road Riot actually uses).
- rtl/asic65/tms32010.sv:42 rst_n: power-on, every register as MAME's device_start() followed by device_reset().
- rtl/asic65/tms32010.sv:43 reset: the RS pin (MAME INPUT_LINE_RESET), held while 1: PC, ACC, the pending interrupt and ST (= 0x7EFE) are reset, the other registers keep their values, nothing runs.
- rtl/asic65/tms32010.sv:45 Like MAME, which acts on the line between loop iterations, an iteration already in flight completes first (at most four clocks).
- rtl/asic65/tms32010.sv:76 program counter (16 bits, as MAME)
- rtl/asic65/tms32010.sv:93 ce pulses not yet spent (MAME's icount)
- rtl/asic65/tms32010.sv:100 stk3 is the top (MAME m_STACK[3])
- rtl/asic65/tms32010.sv:195 7Fxx group: MAME dispatches on the low five bits only
- rtl/asic65/tms32010.sv:214 Instructions that address data memory (getdata/putdata in MAME); their indirect forms update AR[ARP] and, unless noted, ARP.
- rtl/asic65/tms32010.sv:248 Add/subtract with MAME's CALCULATE_ADD/SUB_OVERFLOW
- rtl/asic65/tms32010.sv:269 SACH: high word of ACC shifted left by 0-7 (MAME allows all eight)
- rtl/asic65/tms32010.sv:321 Iteration start: interrupt check (MAME Ext_IRQ) and budget
- rtl/asic65/tms32010.sv:388 an interrupt stays pending until taken (MAME: cannot be cleared)
- rtl/asic65/tms32010.sv:559 RS pin: MAME device_reset(), applied while held and idle
- rtl/board/g42_adc0809.sv:5 68000 $E00020-$E0002F, one byte per word on D15:8 (MAME umask16 $FF00).
- rtl/board/g42_adc0809.sv:6 MAME a2d_select_w / a2d_data_r: a write starts a conversion of channel (word offset & 7); a read returns the result register and also starts a new conversion of the channel it addresses.
- rtl/board/g42_adc0809.sv:11 channels 2-7 not connected: MAME's default input reads $FF
- rtl/board/g42_adc0809.sv:13 Timing follows MAME adc0808.cpp with the ADC clock at 14.318181 MHz / 16 (894.9 kHz = 64 clk_sys): from the start, +2 ADC clocks the input is sampled into the result register and EOC drops; +66 it is sampled again and EOC rises.
- rtl/board/g42_adc0809.sv:16 The result powers up as $FF and EOC as 1, as in MAME.
- rtl/board/g42_adc0809.sv:17 Danger Express and Guardians have no ADC: the core does not start conversions there and the 68000 reads $FF (MAME a2d_data_r).
- rtl/board/g42_adc0809.sv:65 EOC keeps its state until the sample point, as in MAME
- rtl/board/g42_controls.sv:5 The cabinet's wheel and pedal are potentiometers read through the ADC0809 (g42_adc0809): channel 0 wheel (MAME A2D0, AD_STICK_X, centre $80), channel 1 pedal (A2D1, PEDAL, rest $00).
- rtl/board/g42_controls.sv:11 Wheel, in order of precedence: - the left analog stick X, outside its dead zone, scaled by the OSD sensitivity; - the d-pad, ramping out 10 per frame and back to centre 20 per frame (MAME KEYDELTA 10), the way a keyboard steers in MAME; - a
- rtl/board/g42_controls.sv:19 Pedal: the largest of the Pedal button (ramps up 16 per frame while held, MAME KEYDELTA 16, down 32 after release) and the right stick pushed up.
- rtl/board/g42_eeprom.sv:5 68000 $FA0000-$FA0FFF, low byte only (MAME umask16 $00FF).
- rtl/board/g42_eeprom.sv:7 MAME: EEPROM_2816 with lock_after_write(true): a write is ignored unless the 68000 has written to $E00060 since the last accepted one, which guards the settings against a runaway program.
- rtl/board/g42_eeprom.sv:12 the factory image in the ROM set (*-eeprom.5c), snooped from the ROM download (def_*), as MAME loads it when there is no .nv file; 2.
- rtl/board/g42_top.sv:9 Follows MAME atarig42.cpp.
- rtl/board/g42_top.sv:18 D13:11 MO control {FRAME,ERASE,MOGO} D3, D0 coin counters (not used) So after reset the sound board and the ASIC65 stay in reset until the game releases them (Guardians within its first frames; Road Riot keeps the sound board in reset throu
- rtl/board/g42_top.sv:286 The SLOOP sees every cycle in $000000-$07FFFF, reads (including opcode fetches) and writes, as MAME's handler does.
- rtl/board/g42_top.sv:310 Banked window $078000-$07FFFF -> ROM $078000 + bank x $2000, the 8 KB bank mirrored four times (MAME: 0x78000/2 + bank * 0x1000 + (offset & 0xfff)).
- rtl/board/g42_top.sv:482 The word at $080000: MAME's region is $80004 bytes, zero past the program, and Guardians' init patches an RTS in (the game calls $080000).
- rtl/board/g42_top.sv:505 $FF7000 (word $3800) is the MO command: ordinary RAM that the MO hardware reacts to (MAME mo_command_w: 0 = CHECKSUM, else DRAW).
- rtl/board/g42_top.sv:530 Plain RAM in MAME.
- rtl/board/g42_top.sv:580 Written per byte lane (MAME io_latch_w with mem_mask).
- rtl/board/g42_top.sv:580 The MO control bits are passed on every upper-byte write; g42_rle ignores a write that does not change them, as MAME's control_write does.
- rtl/board/g42_top.sv:667 A read or a write of $E00020-$E0002F starts a conversion of the channel it addresses (MAME a2d_data_r / a2d_select_w).
- rtl/board/g42_top.sv:701 Unmapped reads return $0000 (MAME).
- rtl/board/g42_top.sv:799 With +iolog: every access to the sound board, the ASIC65 and the I/O latch, with the frame number, for comparison with a MAME tap log.
- rtl/board/g42_watchdog.sv:5 MAME's WATCHDOG_TIMER with the default period: the game is reset if no write reaches $E03800 for 3 seconds.
- rtl/cpu/g42_addr_decode.sv:6 This is the only module that knows the memory map, which is MAME atarig42.cpp main_map, address for address (no mirrors: the board's decode PALs are read-protected and MAME is the only reference).
- rtl/cpu/g42_addr_decode.sv:10 $000000-$07FFFF R program ROM; $078000-$07FFFF is the SLOOP window W (no memory: the SLOOP sees the cycle) $080000-$080001 R ROM word past the program: $4E75 (RTS) on Guardians, where the game calls it, $0000 otherwise (MAME) $E0000
- rtl/cpu/g42_addr_decode.sv:22 $E00050-$E00051 W I/O latch: ASIC65 reset, MO control, sound reset $E00060-$E00061 W EEPROM unlock $E03000-$E03001 W VBLANK interrupt acknowledge $E03800-$E03801 W watchdog $E80000-$E80FFF RW 4 KB RAM $F40000-$F40001 R ASIC
- rtl/cpu/g42_sloop.sv:10 Follows MAME atarig42.cpp roadriot_sloop_tweak / guardians_sloop_tweak.
- rtl/cpu/g42_sloop.sv:31 MAME applies the change before it returns the data of the cycle that made it, so the ROM fetch must use the bank one clock after acc_strobe (see g42_top).
- rtl/cpu/g42_sloop.sv:33 The state survives a watchdog reset, as in MAME (only its machine_start clears it): it is cleared by rst_n alone.
- rtl/cpu/g42_sloop.sv:54 byte address, for comparison with MAME
- rtl/cpu/g42_sloop.sv:69 One history entry per bus cycle at or above $07F7C0: bit 5 set means the cycle was outside the pattern area $07F7C0-$07F7FF (MAME keeps the whole offset; any value outside the area only has to fail the compare), bits 4:0 are the word within
- rtl/g42_core.sv:108 rst_n: the game itself and the video, also held until that prescan has finished, so the game boots with its objects ready, as the MAME driver does (its prescan runs at start-up).
- rtl/g42_core.sv:367 MAME port layouts (atarig42.cpp).
- rtl/g42_core.sv:415 Road Riot: IN0 10 left trigger (MAME Button 2), 9 right trigger (Button 3), 8 start.
- rtl/g42_core.sv:607 The test switch reaches the JSA III too (MAME main_test_read_line).
- rtl/g42_core.sv:944 One line per frame: the 68000's bus address at VBLANK, for comparison with a MAME PC trace
- rtl/g42_pkg.sv:19 MAME set_raw(14.318181 MHz / 2, 456, 0, 336, 262, 0, 240): 7.159 MHz dot clock (139.7 ns), 15.700 kHz line, 59.923 Hz frame.
- rtl/g42_pkg.sv:106 MAME's lookup tables reduce to bit slices (g42_rle_decode).
- rtl/g42_pkg.sv:147 [1] ASIC65 is ROM-based: run the TMS32010 (Road Riot); else high-level (Guardians) [2] RTS at $080000 (Guardians, as MAME) [3] 32768 playfield tiles (else 16384)
- rtl/g42_pkg.sv:154 RLE objects in the ROM (MAME
- rtl/jsa3/g42_jsa3.sv:6 Follows MAME's atari_jsa_iii_device (atarijsa.cpp, "full map verified from schematics and Batman GALs") and is derived from the Atari G1 JSA II (g1_jsa2.sv), whose hardware-verified bus timing, JT51/JT6295 hookup and comm latches it keeps.
- rtl/jsa3/g42_jsa3.sv:10 MAME 0.264 and current MAME behave the same for everything here.
- rtl/jsa3/g42_jsa3.sv:12 6502 memory map (MAME atarijsa3_map).
- rtl/jsa3/g42_jsa3.sv:30 Reads of the write block and of $2806 return 0, as MAME's unmapped/ack reads.
- rtl/jsa3/g42_jsa3.sv:33 RDIO ($2804) and the 68000's raw port $E00012 (jsaiii_port): 0x80 self test, 1 = on 0x08 service (coin door), active high 0x40 command latch empty 0x04 tilt, active high 0x20 response latch full 0x02 coin L, active hi
- rtl/jsa3/g42_jsa3.sv:46 WRIO ($2A04, MAME wrio_w): 0xC0 program ROM bank 0x04 OKI6295 reset, active low 0x30 coin counters (unused) 0x02 OKI bank bit 0 0x08 OKI6295 PIN7: 1 = /132 0x01 YM2151 reset, active low
- rtl/jsa3/g42_jsa3.sv:51 MIX ($2A06, MAME mix_w): 0x20 low-pass filter enable (not emulated, nor by MAME) 0x10 OKI bank bit 1 0x0E YM2151 volume, 0-7 0x01 OKI6295 volume, 0 = half, 1 = full Overall volume ($2800 write): gain = data / 127 on YM and OKI.
- rtl/jsa3/g42_jsa3.sv:65 6502 IRQ = periodic timer (249.7 Hz) OR YM2151 IRQ, as MAME's update_sound_irq(); $2806 read or write acknowledges the timer.
- rtl/jsa3/g42_jsa3.sv:127 mono, half of MAME's level (see Mixer)
- rtl/jsa3/g42_jsa3.sv:261 YM2151 CT1 output pin; gates the OKI as in MAME (see Mixer).
- rtl/jsa3/g42_jsa3.sv:264 Reset values: WRIO as cleared (YM and OKI held in reset until the 6502 releases them, bank 0), PIN7 high and the volumes at MAME's reset values (1.0), which Guardians depends on.
- rtl/jsa3/g42_jsa3.sv:301 The count restarts when the board leaves reset, as MAME re-arms its periodic timer when the 6502 is reset.
- rtl/jsa3/g42_jsa3.sv:334 The image is the ROM file as-is for all three games (MAME's dangerex region moves the file's first 16 KB to $10000, which its 6502 never reads).
- rtl/jsa3/g42_jsa3.sv:479 The programs poll busy before every write ($511F in Road Riot), so this keeps their write timing to the chip's (and MAME's).
- rtl/jsa3/g42_jsa3.sv:552 Banking: the OKI's 18-bit address becomes a 19-bit address in the 512 KB sample ROM (MAME atari_jsa_oki_base_device::device_start).
- rtl/jsa3/g42_jsa3.sv:607 The raw port as MAME builds it (jsa_iii_ioports).
- rtl/jsa3/g42_jsa3.sv:607 The 6502 reads the same value: bits 4 and 7 are the test switch as the 68000 sees it, without MAME's 0x90 XOR (see header).
- rtl/jsa3/g42_jsa3.sv:641 MAME (atarijsa.cpp JSA III + atarig42.cpp), mono, full scale = 1.0: out = 0.8 * ov * ( 0.60 * (L + R) * vol/7 + 0.75 * g * ct1 * oki ) ov = overall volume / 127, vol = MIX bits 3:1, g = 1.0 or 0.5 from MIX bit 0, ct1 = YM2151 CT1; L, R =
- rtl/jsa3/g42_jsa3.sv:653 MAME peaks at 29089 in the Road Riot attract (overall $63) and would reach ~37300 at the top setting $7F; here that is ~18650.
- rtl/jsa3/g42_jsa3.sv:655 Four loud OKI voices can still clip, as in MAME.
- rtl/jsa3/g42_jsa3.sv:658 OKI gated by YM2151 CT1, as MAME's update_all_volumes().
- rtl/jsa3/g42_sound_comm.sv:18 MAME instead clears them once per io_latch write with bit 4 low (m_jsa->reset()), so a command written while the board is held in reset survives there and is lost here.
- rtl/jsa3/g42_sound_comm.sv:23 main_dout is captured when the 68000 read starts: a response written by the 6502 later in the same 68000 bus cycle then stays in the latch for the next read instead of being returned with its flag already cleared (MAME's read handler takes
- rtl/mem/g42_rom_loader.sv:10 While the image goes by, two regions are also copied on chip: SDR_EEP 2 KB the factory EEPROM image -> g42_eeprom (eep_*), one byte at a time, so a game with no saved NVRAM starts from it as in MAME SDR_DSP 8 KB the ASIC65 TMS32010 prog
- rtl/video/g42_alpha.sv:5 Follows MAME atarig42_v.cpp get_alpha_tile_info; line buffers as the G1 core's g1_alpha.sv.
- rtl/video/g42_alpha.sv:15 Columns 48-63 of every row also hold the playfield control words (g42_scroll); like MAME, this layer does not special-case them (only 42 columns are ever on screen).
- rtl/video/g42_mixer.sv:5 MAME atarig42_state::screen_update, with the palette address as the colour-MUX PALs build it (equations in the comments of init_roadriot / init_guardian in atarig42.cpp; CRAn = colour RAM address bit n):
- rtl/video/g42_mixer.sv:22 MAME computes the playfield index as 32 * colour + pen: blend_gfx keeps the 5bpp element's granularity (32) although pens are 6 bits, so pen bit 5 adds into the tile colour and a sum can carry into bit 10 and beyond.
- rtl/video/g42_mixer.sv:30 PF_MAME_FORM = 1 selects MAME's sum, truncated to 11 bits.
- rtl/video/g42_mixer.sv:38 0: colour-MUX PAL form, 1: MAME's 32 * colour + pen
- rtl/video/g42_palette.sv:5 CPU $FC0000-$FC0FFF: 2048 16-bit entries in MAME's IRGB_1555 format (PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 2048)).
- rtl/video/g42_palette.sv:12 Decode (MAME raw_to_rgb_converter::IRRRRRGGGGGBBBBB_decoder): the intensity bit is the shared LSB of three 6-bit channels, not a brightness flag; pal6bit expands 6 to 8 bits by repeating the top two:
- rtl/video/g42_playfield.sv:5 Follows MAME atarig42_v.cpp (get_playfield_tile_info, the playfield scan mapper) and the gfx layouts of atarig42.cpp; line buffers and fetch order as the G1 core's g1_playfield.sv.
- rtl/video/g42_playfield.sv:18 Pixels: 6 bits from the three thirds of MAME's "tiles" region, A (first), B, C, one 16-bit big-endian word per tile row each at SDRAM SDR_PFx + code * 16 + row * 2.
- rtl/video/g42_playfield.sv:255 MAME code % elements: 14 or 15 bits
- rtl/video/g42_scroll.sv:6 MAME atarig42_state::scanline_update:
- rtl/video/g42_video.sv:15 MAME latches the control words of lines 0..255 (lines 240-255 are in VBLANK but still latch, and what they latch carries into the next frame's line 0), so the sequencer runs one job per line:
- rtl/video/g42_video.sv:24 Every line's words are latched once a frame, in MAME's order, each just before its own fetch (so line 0 only after lines 240-255).
- rtl/video/g42_video.sv:29 MAME reads the words of lines 8k..8k+7 at line 8k; this reads line L's at the start of line L-1.
- rtl/video/g42_video.sv:60 playfield colour: 0 PAL form, 1 MAME form (g42_mixer)
- rtl/video/g42_video_timing.sv:5 456 x 262 raster, 336 x 240 visible, from a 7.159090 MHz dot enable (MAME set_raw(14.318181 MHz / 2, 456, 0, 336, 262, 0, 240)); the counters and strobes are those of the hardware-proven G1 timing generator.
- rtl/video/g42_video_timing.sv:27 MAME's totals come from published specs; the split is not documented (the board's SOS chip), so it is a parameter.
- rtl/video/mob/g42_rle.sv:18 Command: every write to $FF7000 latches CHECKSUM if the value is 0, else DRAW (MAME mo_command_w; a byte write puts the byte on both halves, so "0" means the written byte is 0); NOP until the first write.
- rtl/video/mob/g42_rle.sv:32 Pixel colour: MAME master aligns the pen base to the object's depth, pen = (palette base + (color << 4)) & ~((1 << bpp) - 1), pixel = pen + value (MAME 0.264 does not; see sim/rle/README.md).
- rtl/video/mob/g42_rle.sv:318 Pen base bits 8:0: {color[4:0], 0000} with the object's low bpp bits cleared (MAME master's alignment); the packet value fills them.
- rtl/video/mob/g42_rle.sv:462 MAME: scale > 0 && code < count
- rtl/video/mob/g42_rle_checksum.sv:7 MAME atarirle.cpp:
- rtl/video/mob/g42_rle_checksum.sv:17 Road Riot's ROM is 2 MB (16 chunks), Guardians' 6 MB (48), Danger Express' 8 MB (64); entries past the ROM stay 0, as in MAME.
- rtl/video/mob/g42_rle_checksum.sv:21 The same snoop measures the ROM: rom_words is one past the highest RLE word written, which is MAME's m_rombase.length() for g42_rle_prescan (the RLE ROM is the last SDRAM region, so the download ends with it).
- rtl/video/mob/g42_rle_fb.sv:6 MAME calls control_write((data >> 11) & 7) on every write that includes the upper byte; ctrl_wr pulses for each, and the "nothing changed" early return is made here:
- rtl/video/mob/g42_rle_fb.sv:25 MAME's erases are instant; here each request latches its buffer and line range when made and waits in a 4-deep FIFO for the engine, which clears 4 pixels per clock (a full buffer in 20,160 clocks).
- rtl/video/mob/g42_rle_fb.sv:27 rnd_hold is high while any erase of the render target is queued or running; g42_rle waits for it before drawing, so the erase lands first, as in MAME.
- rtl/video/mob/g42_rle_fb.sv:101 MAME m_control_bits
- rtl/video/mob/g42_rle_fb.sv:111 Both use the current FRAME (the write erases with the old bits), so they merge into one range; the VBLANK request is evaluated first, as in MAME.
- rtl/video/mob/g42_rle_fb.sv:182 MAME device_reset: partial = -1
- rtl/video/mob/g42_rle_objram.sv:6 MAME reads them in sort_and_render(), instantly at the MOGO; here a DRAW copies them into BRAM and releases the work RAM video port, which would otherwise be contended with the tile fetchers for a whole frame.
- rtl/video/mob/g42_rle_objram.sv:10 The games start rewriting object RAM soon after the MOGO (earliest seen in MAME: Danger Express 3.8 lines, Guardians 7.5, Road Riot 13.2), so the copy has to be quick.
- rtl/video/mob/g42_rle_objram.sv:16 Descriptor (modesc_0x200 / modesc_0x400 in atarig42.cpp), 8 words: word 0 [14:0] code, [15] hflip word 1 [9:4] color ($1F mask on Road Riot, $3F on the others; bit 9 is also priority bit 0), [11:9] priority word 2 [15:6] X position, 10-b
- rtl/video/mob/g42_rle_pkg.sv:5 MAME build_rle_tables() fills one 256-entry table per encoding mode with (run << 8) | value, but every entry is a bit slice of its index, e.g. for 4bpp: table[i] = ((i & 0xF0) + 0x10) << 4 | (i & 0x0F), so value = i[3:0] and run = i[7:4] +
- rtl/video/mob/g42_rle_pkg.sv:22 MAME's prescan_rle() rewrites any count with bit 15 set as its complement ("inverted"), and the renderer only ever reads counts the prescan has visited, so undoing it on the fly is exact.
- rtl/video/mob/g42_rle_pkg.sv:56 Row count word as MAME's renderer sees it after prescan_rle()
- rtl/video/mob/g42_rle_prescan.sv:5 After the ROM download this walks every object once (MAME prescan_rle()) and fills a table the render engine reads in one clock per object:
- rtl/video/mob/g42_rle_prescan.sv:22 An object MAME treats as invalid (data offset below its own header entry or past the ROM) is stored as width 0, as is a valid object with no rows: MAME draws nothing for either, so width 0 simply means "skip".
- rtl/video/mob/g42_rle_prescan.sv:28 Codes at or above obj_count are never looked up (MAME: code < m_objectcount).
- rtl/video/mob/g42_rle_prescan.sv:53 ROM length in words (MAME length())
- rtl/video/mob/g42_rle_prescan.sv:123 MAME stops a walk at 1024 rows
- rtl/video/mob/g42_rle_prescan.sv:136 The 24-bit data offset of the header being read, and MAME's validity test: offset >= which * 4 && offset < length.
- rtl/video/mob/g42_rle_prescan.sv:207 MAME: "base < end" ends the object at the ROM end after counting this row; its packets are cut off.
- rtl/video/mob/g42_rle_prescan.sv:229 MAME's 1024-row cap
- rtl/video/mob/g42_rle_render.sv:5 Port of the row loop of MAME draw_rle_zoom[_hflip]():
- rtl/video/mob/g42_rle_render.sv:29 It does not fetch the tail of a row that lies past the far clip edge (src_limit), where MAME's clipped loop stops.
- rtl/video/mob/g42_rle_render.sv:41 Pixels leave as {priority[2:0], index[8:0]}: pix_base holds the priority and the pen base (low bpp bits zero, MAME's alignment), the packet value fills the low bits.
- rtl/video/mob/g42_rle_render.sv:442 synthesis translate_off The packet decode against MAME build_rle_tables(), every mode and byte (the ROM sets use only modes 0, 2 and 5).
- rtl/video/mob/g42_rle_scaler.sv:5 The setup half of MAME draw_rle() and draw_rle_zoom[_hflip](), once per object:
- rtl/video/mob/g42_rle_scaler.sv:25 MAME's clipped loops skip the pixels left of the screen (right of it when flipped) and stop at the other clip edge; its unclipped loops stop only when the row's runs end, which can be one or two pixels past the scaled width.
- rtl/video/mob/g42_rle_scaler.sv:35 fetch src_limit = (dx/2 + k_last * dx) >> 16 is the last source pixel the far edge can reach; the renderer does not fetch the rest of a row (MAME's clipped loop stops there too).
- README.md:13 working from MAME's source and the games' own test screens.
- README.md:15 run in a full-system simulation against MAME, and it was then tested on a
- README.md:140 **[MAME](https://www.mamedev.org/)**, the reference for the hardware's behaviour: `atarig42.cpp`, `atarig42_v.cpp` (Aaron Giles), `atarirle.cpp`, `asic65.cpp`,
- README.md:142 No MAME code is compiled into the core.
Says it matches, follows or was checked against MAME — 3
- rtl/jsa3/g42_jsa3.sv:43 Verified against MAME with that bit forced on (sim/jsa3/README.md).
- rtl/video/g42_playfield.sv:20 pflayout + pftoplayout + blend_gfx(0, 2, $0F, $30) give, for pixel x (derived from the layouts' MSB-first bit offsets and checked against a generic MAME decode of every tile of every game, sim/video/py/check_pf_permutation.py):
- README.md:14 checked in simulation against a MAME-derived reference, the whole core was
Says it was translated, ported or taken from MAME — 3
- rtl/jsa3/g42_sound_comm.sv:5 Port of MAME's atari_sound_comm_device (atariscom.cpp): two single-byte latches, each with a full flag that drives an interrupt line as a level.
- rtl/video/mob/g42_rle.sv:5 Port of MAME atarirle.cpp as configured by atarig42.cpp (modesc_0x200 for Road Riot, modesc_0x400 for Guardians and Danger Express), derived from the Atari G1 engine:
- rtl/video/mob/g42_rle_sort.sv:5 Port of MAME sort_and_render():
Shares text with the MAME driver without saying so — 6