diff --git a/src/mame/jaleco/megasys1.cpp b/src/mame/jaleco/megasys1.cpp index 670ce1bd191..3484911c808 100644 --- a/src/mame/jaleco/megasys1.cpp +++ b/src/mame/jaleco/megasys1.cpp @@ -130,23 +130,24 @@ RAM RW 0e0000-0effff* < < #include "emu.h" #include "megasys1.h" +#include "jalcrpt.h" + #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "sound/ymopm.h" #include "sound/ymopn.h" -#include "jalcrpt.h" #include "speaker.h" -#define SYS_A_CPU_CLOCK (XTAL(12'000'000) / 2) /* clock for main 68000 */ -#define SYS_B_CPU_CLOCK XTAL(8'000'000) /* clock for main 68000 */ -#define SYS_C_CPU_CLOCK (XTAL(24'000'000) / 2) /* clock for main 68000 */ -#define SYS_D_CPU_CLOCK XTAL(8'000'000) /* clock for main 68000 */ -#define SOUND_CPU_CLOCK XTAL(7'000'000) /* clock for sound 68000 */ -#define OKI4_SOUND_CLOCK XTAL(4'000'000) - #define VERBOSE 0 #include "logmacro.h" +#define SYS_A_CPU_CLOCK (XTAL(12'000'000) / 2) /* clock for main 68000 */ +#define SYS_B_CPU_CLOCK XTAL(8'000'000) /* clock for main 68000 */ +#define SYS_C_CPU_CLOCK (XTAL(24'000'000) / 2) /* clock for main 68000 */ +#define SYS_D_CPU_CLOCK XTAL(8'000'000) /* clock for main 68000 */ +#define SOUND_CPU_CLOCK XTAL(7'000'000) /* clock for sound 68000 */ +#define OKI4_SOUND_CLOCK XTAL(4'000'000) + void megasys1_state::machine_reset() { m_ignore_oki_status = 1; /* ignore oki status due 'protection' */ @@ -253,6 +254,17 @@ void megasys1_typez_state::megasys1Z_map(address_map &map) map(0x084308, 0x084309).w(FUNC(megasys1_typez_state::soundlatch_z_w)); } +void megasys1_state::ram_w(offs_t offset, u16 data) +{ + // DON'T use COMBINE_DATA + // byte writes end up mirroring in both bytes of the word like nmk16.cpp + // 64th Street and Chimera Beast rely on this for attract inputs + + m_ram[offset] = data; +// if (mem_mask != 0xffff) printf("byte write to RAM %04x %04x %04x\n", offset, data, mem_mask); + +} + void megasys1_state::megasys_base_map(address_map &map) { map.global_mask(0xfffff); @@ -274,8 +286,8 @@ void megasys1_state::megasys_base_map(address_map &map) void megasys1_typea_state::megasys1A_map(address_map &map) { - map.global_mask(0xfffff); megasys_base_map(map); + map(0x000000, 0x07ffff).rom(); map(0x080008, 0x080009).r(m_soundlatch[1], FUNC(generic_latch_16_device::read)); /* from sound cpu */ map(0x084000, 0x084001).w(FUNC(megasys1_typea_state::active_layers_w)); @@ -286,23 +298,51 @@ void megasys1_typea_state::megasys1A_map(address_map &map) } /*************************************************************************** - [ Main CPU - System B ] + [ Interrupts - System B & C ] ***************************************************************************/ -TIMER_DEVICE_CALLBACK_MEMBER(megasys1_state::megasys1B_scanline) +void megasys1_state::megasys1bc_handle_scanline_irq(int scanline) { - int scanline = param; - - if(scanline == 240) // vblank-out irq + if(scanline == 224+16) // vblank-out irq m_maincpu->set_input_line(4, HOLD_LINE); - if(scanline == 0) - m_maincpu->set_input_line(2, HOLD_LINE); - - if(scanline == 128) + if(scanline == 80+16) m_maincpu->set_input_line(1, HOLD_LINE); } +TIMER_DEVICE_CALLBACK_MEMBER(megasys1_state::megasys1BC_scanline) +{ + int scanline = param; + + megasys1bc_handle_scanline_irq(scanline); + + if(scanline == 0+16) + m_maincpu->set_input_line(2, HOLD_LINE); + +} + +TIMER_DEVICE_CALLBACK_MEMBER(megasys1_bc_iomcu_state::megasys1BC_iomcu_scanline) +{ + int scanline = param; + + megasys1bc_handle_scanline_irq(scanline); + + if(scanline == 0+16) // end of vblank (rising edge) + { + LOG("%s: megasys1BC_iomcu_scanline: Send INT1 to MCU: (scanline %03d)\n", machine().describe_context(), scanline); + m_iomcu->set_input_line(INPUT_LINE_IRQ1, ASSERT_LINE); + } + + if(scanline == 224+16) // start of vblank (falling edge) + { + LOG("%s: megasys1BC_iomcu_scanline: Clear INT1 to MCU: (scanline %03d)\n", machine().describe_context(), scanline); + m_iomcu->set_input_line(INPUT_LINE_IRQ1, CLEAR_LINE); + } +} + +/*************************************************************************** + [ IO Simulation - System B & C ] +***************************************************************************/ /* Read the input ports, through a protection device: @@ -325,11 +365,11 @@ void megasys1_bc_iosim_state::ip_select_w(u16 data) // TO MCU int i; // Coins P1 P2 DSW1 DSW2 -// 57 53 54 55 56 < 64street +// 57 53 54 55 56 < 64street (not used any more - MCU code dumped) // 37 35 36 33 34 < avspirit -// 58 54 55 56 57 < bigstrik -// 56 52 53 54 55 < cybattlr -// 20 21 22 23 24 < edf +// 58 54 55 56 57 < bigstrik (not used any more - MCU code dumped) +// 56 52 53 54 55 < cybattlr (not used any more - MCU code dumped) +// 20 21 22 23 24 < edf (not used any more - MCU code dumped) // 51 52 53 54 55 < hayaosi1 /* f(x) = ((x*x)>>4)&0xFF ; f(f($D)) == 6 */ @@ -350,149 +390,14 @@ void megasys1_bc_iosim_state::ip_select_w(u16 data) // TO MCU default: return; // get out if it wasn't a valid request } - // if the command is valid, generate an IRQ from the MCU m_maincpu->set_input_line(2, HOLD_LINE); } -void megasys1_state::megasys1B_map(address_map &map) -{ - map.global_mask(0xfffff); - map(0x000000, 0x03ffff).rom(); - map(0x044000, 0x044001).w(FUNC(megasys1_state::active_layers_w)); - map(0x044008, 0x04400d).rw("scroll2", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); - map(0x044100, 0x044101).rw(FUNC(megasys1_state::sprite_flag_r), FUNC(megasys1_state::sprite_flag_w)); - map(0x044200, 0x044205).rw("scroll0", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); - map(0x044208, 0x04420d).rw("scroll1", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); - map(0x044300, 0x044301).w(FUNC(megasys1_state::screen_flag_w)); - map(0x044308, 0x044309).w(FUNC(megasys1_state::soundlatch_w)); - map(0x048000, 0x0487ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); - map(0x04e000, 0x04ffff).ram().share("objectram"); - map(0x050000, 0x053fff).ram().w("scroll0", FUNC(megasys1_tilemap_device::write)).share("scroll0"); - map(0x054000, 0x057fff).ram().w("scroll1", FUNC(megasys1_tilemap_device::write)).share("scroll1"); - map(0x058000, 0x05bfff).ram().w("scroll2", FUNC(megasys1_tilemap_device::write)).share("scroll2"); - map(0x060000, 0x06ffff).mirror(0x10000).ram().w(FUNC(megasys1_state::ram_w)).share("ram"); - map(0x080000, 0x0bffff).rom(); -} - -void megasys1_bc_iosim_state::megasys1B_iosim_map(address_map &map) -{ - megasys1B_map(map); - map(0x0e0000, 0x0e0001).rw(FUNC(megasys1_bc_iosim_state::ip_select_r), FUNC(megasys1_bc_iosim_state::ip_select_w)); -} - -void megasys1_state::megasys1B_edfbl_map(address_map &map) -{ - map.global_mask(0xfffff); - megasys1B_map(map); - map(0x0e0002, 0x0e0003).portr("SYSTEM"); - map(0x0e0004, 0x0e0005).portr("P1"); - map(0x0e0006, 0x0e0007).portr("P2"); - map(0x0e0008, 0x0e0009).portr("DSW1"); - map(0x0e000a, 0x0e000b).portr("DSW2"); - //map(0x0e000e, 0x0e000f).w(FUNC(megasys1_state::soundlatch_w)); -} - -void megasys1_state::megasys1B_monkelf_map(address_map &map) -{ - map.global_mask(0xfffff); - megasys1B_map(map); - map(0x044200, 0x044205).w(FUNC(megasys1_state::monkelf_scroll0_w)); - map(0x044208, 0x04420d).w(FUNC(megasys1_state::monkelf_scroll1_w)); - map(0x0e0002, 0x0e0003).portr("P1"); - map(0x0e0004, 0x0e0005).portr("P2"); - map(0x0e0006, 0x0e0007).portr("DSW1"); - map(0x0e0008, 0x0e0009).portr("DSW2"); - map(0x0e000a, 0x0e000b).portr("SYSTEM"); -} - - - - /*************************************************************************** - [ Main CPU - System C ] + [ IO MCU Emulation - System B & C ] ***************************************************************************/ - -#define INTERRUPT_NUM_C INTERRUPT_NUM_B -#define interrupt_C interrupt_B - -void megasys1_state::megasys1c_handle_scanline_irq(int scanline) -{ - if(scanline == 224+16) // vblank-out irq - m_maincpu->set_input_line(4, HOLD_LINE); - - if(scanline == 80+16) - m_maincpu->set_input_line(1, HOLD_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(megasys1_state::megasys1C_scanline) -{ - int scanline = param; - - megasys1c_handle_scanline_irq(scanline); - - if(scanline == 0+16) - m_maincpu->set_input_line(2, HOLD_LINE); - -} -TIMER_DEVICE_CALLBACK_MEMBER(megasys1_bc_iomcu_state::megasys1C_iomcu_scanline) -{ - int scanline = param; - - megasys1c_handle_scanline_irq(scanline); - - if(scanline == 0+16) // end of vblank (rising edge) - { - LOG("%s: megasys1C_iomcu_scanline: Send INT1 to MCU: (scanline %03d)\n", machine().describe_context(), scanline); - m_iomcu->set_input_line(INPUT_LINE_IRQ1, ASSERT_LINE); - } - - if(scanline == 224+16) // start of vblank (falling edge) - { - LOG("%s: megasys1C_iomcu_scanline: Clear INT1 to MCU: (scanline %03d)\n", machine().describe_context(), scanline); - m_iomcu->set_input_line(INPUT_LINE_IRQ1, CLEAR_LINE); - } -} - -void megasys1_state::ram_w(offs_t offset, u16 data) -{ - // DON'T use COMBINE_DATA - // byte writes end up mirroring in both bytes of the word like nmk16.cpp - // 64th Street and Chimera Beast rely on this for attract inputs - - m_ram[offset] = data; -// if (mem_mask != 0xffff) printf("byte write to RAM %04x %04x %04x\n", offset, data, mem_mask); - -} - -void megasys1_state::megasys1C_map(address_map &map) -{ - map.global_mask(0x1fffff); - map(0x000000, 0x07ffff).rom(); - map(0x0c2000, 0x0c2005).rw("scroll0", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); - map(0x0c2008, 0x0c200d).rw("scroll1", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); - map(0x0c2100, 0x0c2105).rw("scroll2", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); - map(0x0c2108, 0x0c2109).w(FUNC(megasys1_state::sprite_bank_w)); - map(0x0c2200, 0x0c2201).rw(FUNC(megasys1_state::sprite_flag_r), FUNC(megasys1_state::sprite_flag_w)); - map(0x0c2208, 0x0c2209).w(FUNC(megasys1_state::active_layers_w)); - map(0x0c2308, 0x0c2309).w(FUNC(megasys1_state::screen_flag_w)); - map(0x0c8000, 0x0c8001).r(m_soundlatch[1], FUNC(generic_latch_16_device::read)).w(FUNC(megasys1_state::soundlatch_c_w)); - map(0x0d2000, 0x0d3fff).ram().share("objectram"); - // 64th Street actively uses 0xe4*** for breakable objects. - map(0x0e0000, 0x0e3fff).mirror(0x4000).ram().w("scroll0", FUNC(megasys1_tilemap_device::write)).share("scroll0"); - map(0x0e8000, 0x0ebfff).mirror(0x4000).ram().w("scroll1", FUNC(megasys1_tilemap_device::write)).share("scroll1"); - map(0x0f0000, 0x0f3fff).mirror(0x4000).ram().w("scroll2", FUNC(megasys1_tilemap_device::write)).share("scroll2"); - map(0x0f8000, 0x0f87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); - map(0x1c0000, 0x1cffff).mirror(0x30000).ram().w(FUNC(megasys1_state::ram_w)).share("ram"); //0x1f****, Cybattler reads attract mode inputs at 0x1d**** -} - -void megasys1_bc_iosim_state::megasys1C_iosim_map(address_map &map) -{ - megasys1C_map(map); - map(0x0d8000, 0x0d8001).rw(FUNC(megasys1_bc_iosim_state::ip_select_r), FUNC(megasys1_bc_iosim_state::ip_select_w)); -} - /* Used by IO MCU to read data from different inputs (DSW1, DSW2, P1, P2, COIN) depending on which one was previously selected by the MCU itself using the offset. @@ -578,6 +483,112 @@ void megasys1_bc_iomcu_state::iomcu_map(address_map &map) map(0x000000, 0x0fffff).r(FUNC(megasys1_bc_iomcu_state::mcu_capture_inputs_r)); } +/*************************************************************************** + [ Main CPU - System B ] +***************************************************************************/ + +TIMER_DEVICE_CALLBACK_MEMBER(megasys1_state::megasys1Bbl_scanline) +{ + int scanline = param; + + if(scanline == 240) // vblank-out irq + m_maincpu->set_input_line(4, HOLD_LINE); + + if(scanline == 0) + m_maincpu->set_input_line(2, HOLD_LINE); + + if(scanline == 128) + m_maincpu->set_input_line(1, HOLD_LINE); +} + +void megasys1_state::megasys1B_map(address_map &map) +{ + map.global_mask(0xfffff); + map(0x000000, 0x03ffff).rom(); + map(0x044000, 0x044001).w(FUNC(megasys1_state::active_layers_w)); + map(0x044008, 0x04400d).rw("scroll2", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); + map(0x044100, 0x044101).rw(FUNC(megasys1_state::sprite_flag_r), FUNC(megasys1_state::sprite_flag_w)); + map(0x044200, 0x044205).rw("scroll0", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); + map(0x044208, 0x04420d).rw("scroll1", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); + map(0x044300, 0x044301).w(FUNC(megasys1_state::screen_flag_w)); + map(0x044308, 0x044309).w(FUNC(megasys1_state::soundlatch_w)); + map(0x048000, 0x0487ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); + map(0x04e000, 0x04ffff).ram().share("objectram"); + map(0x050000, 0x053fff).ram().w("scroll0", FUNC(megasys1_tilemap_device::write)).share("scroll0"); + map(0x054000, 0x057fff).ram().w("scroll1", FUNC(megasys1_tilemap_device::write)).share("scroll1"); + map(0x058000, 0x05bfff).ram().w("scroll2", FUNC(megasys1_tilemap_device::write)).share("scroll2"); + map(0x060000, 0x06ffff).mirror(0x10000).ram().w(FUNC(megasys1_state::ram_w)).share("ram"); + map(0x080000, 0x0bffff).rom(); +} + +void megasys1_bc_iosim_state::megasys1B_iosim_map(address_map &map) +{ + megasys1B_map(map); + map(0x0e0000, 0x0e0001).rw(FUNC(megasys1_bc_iosim_state::ip_select_r), FUNC(megasys1_bc_iosim_state::ip_select_w)); +} + +void megasys1_bc_iomcu_state::megasys1B_iomcu_map(address_map &map) +{ + megasys1B_map(map); + map(0x0e0000, 0x0e0001).rw(FUNC(megasys1_bc_iomcu_state::ip_select_iomcu_r), FUNC(megasys1_bc_iomcu_state::ip_select_iomcu_w)); +} + +void megasys1_state::megasys1B_edfbl_map(address_map &map) +{ + megasys1B_map(map); + + map(0x0e0002, 0x0e0003).portr("SYSTEM"); + map(0x0e0004, 0x0e0005).portr("P1"); + map(0x0e0006, 0x0e0007).portr("P2"); + map(0x0e0008, 0x0e0009).portr("DSW1"); + map(0x0e000a, 0x0e000b).portr("DSW2"); + //map(0x0e000e, 0x0e000f).w(FUNC(megasys1_state::soundlatch_w)); +} + +void megasys1_state::megasys1B_monkelf_map(address_map &map) +{ + megasys1B_map(map); + + map(0x044200, 0x044205).w(FUNC(megasys1_state::monkelf_scroll0_w)); + map(0x044208, 0x04420d).w(FUNC(megasys1_state::monkelf_scroll1_w)); + map(0x0e0002, 0x0e0003).portr("P1"); + map(0x0e0004, 0x0e0005).portr("P2"); + map(0x0e0006, 0x0e0007).portr("DSW1"); + map(0x0e0008, 0x0e0009).portr("DSW2"); + map(0x0e000a, 0x0e000b).portr("SYSTEM"); +} + +/*************************************************************************** + [ Main CPU - System C ] +***************************************************************************/ + +void megasys1_state::megasys1C_map(address_map &map) +{ + map.global_mask(0x1fffff); + map(0x000000, 0x07ffff).rom(); + map(0x0c2000, 0x0c2005).rw("scroll0", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); + map(0x0c2008, 0x0c200d).rw("scroll1", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); + map(0x0c2100, 0x0c2105).rw("scroll2", FUNC(megasys1_tilemap_device::scroll_r), FUNC(megasys1_tilemap_device::scroll_w)); + map(0x0c2108, 0x0c2109).w(FUNC(megasys1_state::sprite_bank_w)); + map(0x0c2200, 0x0c2201).rw(FUNC(megasys1_state::sprite_flag_r), FUNC(megasys1_state::sprite_flag_w)); + map(0x0c2208, 0x0c2209).w(FUNC(megasys1_state::active_layers_w)); + map(0x0c2308, 0x0c2309).w(FUNC(megasys1_state::screen_flag_w)); + map(0x0c8000, 0x0c8001).r(m_soundlatch[1], FUNC(generic_latch_16_device::read)).w(FUNC(megasys1_state::soundlatch_c_w)); + map(0x0d2000, 0x0d3fff).ram().share("objectram"); + // 64th Street actively uses 0xe4*** for breakable objects. + map(0x0e0000, 0x0e3fff).mirror(0x4000).ram().w("scroll0", FUNC(megasys1_tilemap_device::write)).share("scroll0"); + map(0x0e8000, 0x0ebfff).mirror(0x4000).ram().w("scroll1", FUNC(megasys1_tilemap_device::write)).share("scroll1"); + map(0x0f0000, 0x0f3fff).mirror(0x4000).ram().w("scroll2", FUNC(megasys1_tilemap_device::write)).share("scroll2"); + map(0x0f8000, 0x0f87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); + map(0x1c0000, 0x1cffff).mirror(0x30000).ram().w(FUNC(megasys1_state::ram_w)).share("ram"); //0x1f****, Cybattler reads attract mode inputs at 0x1d**** +} + +void megasys1_bc_iosim_state::megasys1C_iosim_map(address_map &map) +{ + megasys1C_map(map); + map(0x0d8000, 0x0d8001).rw(FUNC(megasys1_bc_iosim_state::ip_select_r), FUNC(megasys1_bc_iosim_state::ip_select_w)); +} + void megasys1_bc_iomcu_state::megasys1C_iomcu_map(address_map &map) { megasys1C_map(map); @@ -2025,17 +2036,41 @@ void megasys1_typea_state::system_A_p47bl(machine_config &config) m_p47bl_adpcm[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0); } -void megasys1_bc_iosim_state::system_B(machine_config &config) +void megasys1_state::system_B(machine_config &config) { system_base(config); /* basic machine hardware */ m_maincpu->set_clock(SYS_B_CPU_CLOCK); /* 8MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &megasys1_bc_iosim_state::megasys1B_iosim_map); - m_scantimer->set_callback(FUNC(megasys1_bc_iosim_state::megasys1B_scanline)); + m_maincpu->set_addrmap(AS_PROGRAM, &megasys1_state::megasys1B_map); + m_scantimer->set_callback(FUNC(megasys1_state::megasys1BC_scanline)); - m_audiocpu->set_addrmap(AS_PROGRAM, &megasys1_bc_iosim_state::megasys1B_sound_map); + /* video hardware */ + m_screen->set_raw(SYS_A_CPU_CLOCK, 384, 0, 256, 278, 16, 240); +// m_screen->set_raw(SYS_A_CPU_CLOCK, 406, 0, 256, 263, 16, 240); + + m_audiocpu->set_addrmap(AS_PROGRAM, &megasys1_state::megasys1B_sound_map); +} + +void megasys1_bc_iosim_state::system_B_iosim(machine_config &config) +{ + system_B(config); + m_maincpu->set_addrmap(AS_PROGRAM, &megasys1_bc_iosim_state::megasys1B_iosim_map); +} + +void megasys1_bc_iomcu_state::system_B_iomcu(machine_config &config) +{ + system_B(config); + + m_maincpu->set_addrmap(AS_PROGRAM, &megasys1_bc_iomcu_state::megasys1B_iomcu_map); + m_scantimer->set_callback(FUNC(megasys1_bc_iomcu_state::megasys1BC_iomcu_scanline)); + + TMP91640(config, m_iomcu, SYS_C_CPU_CLOCK); // Toshiba TMP91640, with 16Kbyte internal ROM, 512bytes internal RAM + m_iomcu->set_addrmap(AS_PROGRAM, &megasys1_bc_iomcu_state::iomcu_map); + m_iomcu->port_read<1>().set(FUNC(megasys1_bc_iomcu_state::mcu_port1_r)); + m_iomcu->port_write<2>().set(FUNC(megasys1_bc_iomcu_state::mcu_port2_w)); + m_iomcu->port_write<6>().set(FUNC(megasys1_bc_iomcu_state::mcu_port6_w)); } void megasys1_state::system_B_monkelf(machine_config &config) @@ -2046,7 +2081,7 @@ void megasys1_state::system_B_monkelf(machine_config &config) m_maincpu->set_clock(SYS_B_CPU_CLOCK); /* 8MHz */ m_maincpu->set_addrmap(AS_PROGRAM, &megasys1_state::megasys1B_monkelf_map); - m_scantimer->set_callback(FUNC(megasys1_state::megasys1B_scanline)); + m_scantimer->set_callback(FUNC(megasys1_state::megasys1Bbl_scanline)); m_audiocpu->set_addrmap(AS_PROGRAM, &megasys1_state::megasys1B_sound_map); } @@ -2056,7 +2091,7 @@ void megasys1_state::system_Bbl(machine_config &config) /* basic machine hardware */ M68000(config, m_maincpu, 12_MHz_XTAL / 2); // edfbl has lower clock, verified on PCB m_maincpu->set_addrmap(AS_PROGRAM, &megasys1_state::megasys1B_edfbl_map); - TIMER(config, m_scantimer).configure_scanline(FUNC(megasys1_state::megasys1B_scanline), m_screen, 0, 1); + TIMER(config, m_scantimer).configure_scanline(FUNC(megasys1_state::megasys1Bbl_scanline), m_screen, 0, 1); /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); @@ -2091,7 +2126,7 @@ void megasys1_state::system_Bbl(machine_config &config) void megasys1_bc_iosim_state::system_B_hayaosi1(machine_config &config) { - system_B(config); + system_B_iosim(config); /* basic machine hardware */ @@ -2111,7 +2146,7 @@ void megasys1_state::system_C(machine_config &config) /* basic machine hardware */ m_maincpu->set_clock(SYS_C_CPU_CLOCK); /* 12MHz */ m_maincpu->set_addrmap(AS_PROGRAM, &megasys1_state::megasys1C_map); - m_scantimer->set_callback(FUNC(megasys1_state::megasys1C_scanline)); + m_scantimer->set_callback(FUNC(megasys1_state::megasys1BC_scanline)); /* video hardware */ m_screen->set_raw(SYS_A_CPU_CLOCK, 384, 0, 256, 278, 16, 240); @@ -2133,14 +2168,13 @@ void megasys1_bc_iomcu_state::system_C_iomcu(machine_config &config) system_C(config); m_maincpu->set_addrmap(AS_PROGRAM, &megasys1_bc_iomcu_state::megasys1C_iomcu_map); - m_scantimer->set_callback(FUNC(megasys1_bc_iomcu_state::megasys1C_iomcu_scanline)); + m_scantimer->set_callback(FUNC(megasys1_bc_iomcu_state::megasys1BC_iomcu_scanline)); TMP91640(config, m_iomcu, SYS_C_CPU_CLOCK); // Toshiba TMP91640, with 16Kbyte internal ROM, 512bytes internal RAM m_iomcu->set_addrmap(AS_PROGRAM, &megasys1_bc_iomcu_state::iomcu_map); m_iomcu->port_read<1>().set(FUNC(megasys1_bc_iomcu_state::mcu_port1_r)); m_iomcu->port_write<2>().set(FUNC(megasys1_bc_iomcu_state::mcu_port2_w)); m_iomcu->port_write<6>().set(FUNC(megasys1_bc_iomcu_state::mcu_port6_w)); - } /*************************************************************************** @@ -3108,7 +3142,7 @@ ROM_START( edf ) ROM_LOAD16_BYTE( "edf2.f3", 0x000001, 0x020000, CRC(ce93643e) SHA1(686bf0ec104af8c97624a782e0d60afe170fd945) ) ROM_REGION( 0x4000, "iomcu", 0 ) /* TMP91640 Internal Code */ - ROM_LOAD( "edf.mcu", 0x00000, 0x04000, NO_DUMP ) + ROM_LOAD( "edf.mcu", 0x00000, 0x04000, CRC(1503026d) SHA1(5ff63cc5aa58b7a805c019612ddd6d5191a92333) ) ROM_REGION( 0x080000, "scroll0", 0 ) /* Scroll 0 */ ROM_LOAD( "edf_m04.rom", 0x000000, 0x080000, CRC(6744f406) SHA1(3b8f13ca968456186d9ad61f34611b7eab62ea86) ) @@ -3147,7 +3181,7 @@ ROM_START( edfa ) ROM_LOAD16_BYTE( "edf2.f3", 0x000001, 0x020000, CRC(ce93643e) SHA1(686bf0ec104af8c97624a782e0d60afe170fd945) ) ROM_REGION( 0x4000, "iomcu", 0 ) /* TMP91640 Internal Code */ - ROM_LOAD( "edf.mcu", 0x00000, 0x04000, NO_DUMP ) + ROM_LOAD( "edf.mcu", 0x00000, 0x04000, CRC(1503026d) SHA1(5ff63cc5aa58b7a805c019612ddd6d5191a92333) ) ROM_REGION( 0x080000, "scroll0", 0 ) /* Scroll 0 */ ROM_LOAD( "edf_m04.rom", 0x000000, 0x080000, CRC(6744f406) SHA1(3b8f13ca968456186d9ad61f34611b7eab62ea86) ) @@ -3186,7 +3220,7 @@ ROM_START( edfu ) ROM_LOAD16_BYTE( "edf2.f3", 0x000001, 0x020000, CRC(ce93643e) SHA1(686bf0ec104af8c97624a782e0d60afe170fd945) ) ROM_REGION( 0x4000, "iomcu", 0 ) /* TMP91640 Internal Code */ - ROM_LOAD( "edf.mcu", 0x00000, 0x04000, NO_DUMP ) + ROM_LOAD( "edf.mcu", 0x00000, 0x04000, CRC(1503026d) SHA1(5ff63cc5aa58b7a805c019612ddd6d5191a92333) ) ROM_REGION( 0x080000, "scroll0", 0 ) /* Scroll 0 */ ROM_LOAD( "edf_m04.rom", 0x000000, 0x080000, CRC(6744f406) SHA1(3b8f13ca968456186d9ad61f34611b7eab62ea86) ) @@ -5201,11 +5235,6 @@ void megasys1_bc_iosim_state::init_avspirit() // Type B m_ip_select_values = avspirit_seq; } -void megasys1_bc_iosim_state::init_edf() // Type B -{ - m_ip_select_values = edf_seq; -} - void megasys1_bc_iosim_state::init_hayaosi1() // Type B { m_ip_select_values = hayaosi1_seq; @@ -5254,8 +5283,8 @@ void megasys1_state::init_monkelf() *************************************/ // Type Z -GAME( 1988, lomakai, 0, system_Z, lomakai, megasys1_typez_state, empty_init, ROT0, "Jaleco", "Legend of Makai (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, makaiden, lomakai, system_Z, lomakai, megasys1_typez_state, empty_init, ROT0, "Jaleco", "Makai Densetsu (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, lomakai, 0, system_Z, lomakai, megasys1_typez_state, empty_init, ROT0, "Jaleco", "Legend of Makai (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, makaiden, lomakai, system_Z, lomakai, megasys1_typez_state, empty_init, ROT0, "Jaleco", "Makai Densetsu (Japan)", MACHINE_SUPPORTS_SAVE ) // Type A GAME( 1988, p47, 0, system_A, p47, megasys1_typea_state, empty_init, ROT0, "Jaleco", "P-47 - The Phantom Fighter (World)", MACHINE_SUPPORTS_SAVE ) @@ -5296,23 +5325,23 @@ GAME( 1992, soldam, 0, system_A_d65006_soldam, soldam, megasys1_t GAME( 1992, soldamj, soldam, system_A_gs88000_soldam, soldam, megasys1_typea_state, empty_init, ROT0, "Jaleco", "Soldam (Japan)", MACHINE_SUPPORTS_SAVE ) // Type B -GAME( 1991, avspirit, 0, system_B, avspirit, megasys1_bc_iosim_state, init_avspirit, ROT0, "Jaleco", "Avenging Spirit", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, monkelf, avspirit, system_B_monkelf, avspirit, megasys1_state, init_monkelf, ROT0, "bootleg","Monky Elf (Korean bootleg of Avenging Spirit)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, edf, 0, system_B, edf, megasys1_bc_iosim_state, init_edf, ROT0, "Jaleco", "E.D.F. : Earth Defense Force (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, edfa, edf, system_B, edf, megasys1_bc_iosim_state, init_edf, ROT0, "Jaleco", "E.D.F. : Earth Defense Force (set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, edfu, edf, system_B, edf, megasys1_bc_iosim_state, init_edf, ROT0, "Jaleco", "E.D.F. : Earth Defense Force (North America)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, edfbl, edf, system_Bbl, edf, megasys1_state, empty_init, ROT0, "bootleg","E.D.F. : Earth Defense Force (bootleg)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1993, hayaosi1, 0, system_B_hayaosi1, hayaosi1, megasys1_bc_iosim_state, init_hayaosi1, ROT0, "Jaleco", "Hayaoshi Quiz Ouza Ketteisen - The King Of Quiz", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1991, avspirit, 0, system_B_iosim, avspirit, megasys1_bc_iosim_state, init_avspirit, ROT0, "Jaleco", "Avenging Spirit", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, monkelf, avspirit, system_B_monkelf, avspirit, megasys1_state, init_monkelf, ROT0, "bootleg","Monky Elf (Korean bootleg of Avenging Spirit)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, edf, 0, system_B_iomcu, edf, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "E.D.F. : Earth Defense Force (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, edfa, edf, system_B_iomcu, edf, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "E.D.F. : Earth Defense Force (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, edfu, edf, system_B_iomcu, edf, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "E.D.F. : Earth Defense Force (North America)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, edfbl, edf, system_Bbl, edf, megasys1_state, empty_init, ROT0, "bootleg","E.D.F. : Earth Defense Force (bootleg)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1993, hayaosi1, 0, system_B_hayaosi1, hayaosi1, megasys1_bc_iosim_state, init_hayaosi1, ROT0, "Jaleco", "Hayaoshi Quiz Ouza Ketteisen - The King Of Quiz", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // Type C -GAME( 1991, 64street, 0, system_C_iomcu, 64street, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "64th. Street - A Detective Story (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, 64streetj, 64street, system_C_iomcu, 64street, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "64th. Street - A Detective Story (Japan, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, 64streetja, 64street, system_C_iomcu, 64street, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "64th. Street - A Detective Story (Japan, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, bigstrik, 0, system_C_iomcu, bigstrik, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "Big Striker", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, chimerab, 0, system_C_iomcu, chimerab, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "Chimera Beast (Japan, prototype, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, chimeraba, chimerab, system_C_iosim, chimerab, megasys1_bc_iosim_state, init_chimeraba,ROT0, "Jaleco", "Chimera Beast (Japan, prototype, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, cybattlr, 0, system_C_iomcu, cybattlr, megasys1_bc_iomcu_state, empty_init, ROT90, "Jaleco", "Cybattler", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, 64street, 0, system_C_iomcu, 64street, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "64th. Street - A Detective Story (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, 64streetj, 64street, system_C_iomcu, 64street, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "64th. Street - A Detective Story (Japan, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, 64streetja, 64street, system_C_iomcu, 64street, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "64th. Street - A Detective Story (Japan, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, bigstrik, 0, system_C_iomcu, bigstrik, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "Big Striker", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, chimerab, 0, system_C_iomcu, chimerab, megasys1_bc_iomcu_state, empty_init, ROT0, "Jaleco", "Chimera Beast (Japan, prototype, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, chimeraba, chimerab, system_C_iosim, chimerab, megasys1_bc_iosim_state, init_chimeraba, ROT0, "Jaleco", "Chimera Beast (Japan, prototype, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, cybattlr, 0, system_C_iomcu, cybattlr, megasys1_bc_iomcu_state, empty_init, ROT90, "Jaleco", "Cybattler", MACHINE_SUPPORTS_SAVE ) // Type D -GAME( 1993, peekaboo, 0, system_D, peekaboo, megasys1_typed_state, init_peekaboo, ROT0, "Jaleco", "Peek-a-Boo! (Japan, ver. 1.1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, peekaboou, peekaboo, system_D, peekaboo, megasys1_typed_state, init_peekaboo, ROT0, "Jaleco", "Peek-a-Boo! (North America, ver 1.0)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, peekaboo, 0, system_D, peekaboo, megasys1_typed_state, init_peekaboo, ROT0, "Jaleco", "Peek-a-Boo! (Japan, ver. 1.1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, peekaboou, peekaboo, system_D, peekaboo, megasys1_typed_state, init_peekaboo, ROT0, "Jaleco", "Peek-a-Boo! (North America, ver 1.0)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/jaleco/megasys1.h b/src/mame/jaleco/megasys1.h index 3941eb911d3..5c8393e8bdf 100644 --- a/src/mame/jaleco/megasys1.h +++ b/src/mame/jaleco/megasys1.h @@ -51,11 +51,9 @@ public: m_hardware_type_z = 0; } - void system_B_monkelf(machine_config &config); - void system_C(machine_config &config); - void system_Bbl(machine_config &config); - void system_base(machine_config &config); + void system_B_monkelf(machine_config &config) ATTR_COLD; + void system_Bbl(machine_config &config) ATTR_COLD; void init_monkelf(); @@ -84,13 +82,17 @@ protected: void megasys1B_map(address_map &map) ATTR_COLD; void megasys1C_map(address_map &map) ATTR_COLD; - void megasys1c_handle_scanline_irq(int scanline); + void megasys1bc_handle_scanline_irq(int scanline); TIMER_DEVICE_CALLBACK_MEMBER(megasys_base_scanline); - TIMER_DEVICE_CALLBACK_MEMBER(megasys1B_scanline); + TIMER_DEVICE_CALLBACK_MEMBER(megasys1Bbl_scanline); void megasys_base_map(address_map &map) ATTR_COLD; void megasys1B_sound_map(address_map &map) ATTR_COLD; + void system_base(machine_config &config) ATTR_COLD; + void system_B(machine_config &config) ATTR_COLD; + void system_C(machine_config &config) ATTR_COLD; + void megasys1_palette(palette_device &palette); virtual void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect); @@ -142,7 +144,7 @@ private: void ram_w(offs_t offset, u16 data); - TIMER_DEVICE_CALLBACK_MEMBER(megasys1C_scanline); + TIMER_DEVICE_CALLBACK_MEMBER(megasys1BC_scanline); void priority_create(); @@ -159,16 +161,16 @@ public: m_gatearray(*this, "gatearray") { } - void system_A(machine_config &config); - void system_A_d65006_soldam(machine_config &config); - void system_A_gs88000_soldam(machine_config &config); - void system_A_iganinju(machine_config &config); - void system_A_kickoffb(machine_config &config); - void system_A_p47bl(machine_config &config); - void system_A_d65006(machine_config &config); - void system_A_d65006_iganinju(machine_config &config); - void system_A_gs88000(machine_config &config); - void system_A_unkarray(machine_config &config); + void system_A(machine_config &config) ATTR_COLD; + void system_A_d65006_soldam(machine_config &config) ATTR_COLD; + void system_A_gs88000_soldam(machine_config &config) ATTR_COLD; + void system_A_iganinju(machine_config &config) ATTR_COLD; + void system_A_kickoffb(machine_config &config) ATTR_COLD; + void system_A_p47bl(machine_config &config) ATTR_COLD; + void system_A_d65006(machine_config &config) ATTR_COLD; + void system_A_d65006_iganinju(machine_config &config) ATTR_COLD; + void system_A_gs88000(machine_config &config) ATTR_COLD; + void system_A_unkarray(machine_config &config) ATTR_COLD; void init_jitsupro_gfx(); void init_rodland_gfx(); @@ -219,7 +221,7 @@ public: m_okibank(*this, "okibank") { } - void system_D(machine_config &config); + void system_D(machine_config &config) ATTR_COLD; void init_peekaboo(); @@ -272,11 +274,10 @@ public: void init_avspirit(); void init_chimeraba(); void init_hayaosi1(); - void init_edf(); - void system_B(machine_config &config); - void system_B_hayaosi1(machine_config &config); - void system_C_iosim(machine_config &config); + void system_B_iosim(machine_config &config) ATTR_COLD; + void system_B_hayaosi1(machine_config &config) ATTR_COLD; + void system_C_iosim(machine_config &config) ATTR_COLD; protected: virtual void machine_start() override ATTR_COLD; @@ -287,7 +288,6 @@ protected: u16 m_ip_latched = 0; static constexpr u8 avspirit_seq[7] = { 0x37,0x35,0x36,0x33,0x34, 0xff,0x06 }; - static constexpr u8 edf_seq[7] = { 0x20,0x21,0x22,0x23,0x24, 0xf0,0x06 }; static constexpr u8 hayaosi1_seq[7] = { 0x51,0x52,0x53,0x54,0x55, 0xfc,0x06 }; static constexpr u8 chimeraba_seq[7] = { 0x56,0x52,0x53,0x55,0x54, 0xfa,0x06 }; @@ -306,7 +306,8 @@ public: m_iomcu(*this, "iomcu") { } - void system_C_iomcu(machine_config &config); + void system_B_iomcu(machine_config &config) ATTR_COLD; + void system_C_iomcu(machine_config &config) ATTR_COLD; protected: virtual void machine_start() override ATTR_COLD; @@ -325,10 +326,11 @@ private: u8 m_mcu_input_data; u8 m_mcu_io_data; + void megasys1B_iomcu_map(address_map &map) ATTR_COLD; void megasys1C_iomcu_map(address_map &map) ATTR_COLD; void iomcu_map(address_map &map) ATTR_COLD; - TIMER_DEVICE_CALLBACK_MEMBER(megasys1C_iomcu_scanline); + TIMER_DEVICE_CALLBACK_MEMBER(megasys1BC_iomcu_scanline); }; #endif // MAME_JALECO_MEGASYS1_H