mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
fromance.cpp: Use gen_latch; add GGA clocks (nw)
This commit is contained in:
parent
940e721fcb
commit
fb9f98590f
@ -96,32 +96,12 @@ with the following code:
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ8_MEMBER(fromance_state::fromance_commanddata_r)
|
||||
{
|
||||
return m_commanddata;
|
||||
}
|
||||
|
||||
|
||||
TIMER_CALLBACK_MEMBER(fromance_state::deferred_commanddata_w)
|
||||
{
|
||||
m_commanddata = param;
|
||||
m_directionflag = 1;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(fromance_state::fromance_commanddata_w)
|
||||
{
|
||||
/* do this on a timer to let the slave CPU synchronize */
|
||||
machine().scheduler().synchronize(timer_expired_delegate(FUNC(fromance_state::deferred_commanddata_w),this), data);
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(fromance_state::fromance_busycheck_main_r)
|
||||
{
|
||||
/* set a timer to force synchronization after the read */
|
||||
machine().scheduler().synchronize();
|
||||
|
||||
if (!m_directionflag)
|
||||
if (!m_sublatch->pending_r())
|
||||
return 0x00; // standby
|
||||
else
|
||||
return 0xff; // busy
|
||||
@ -130,19 +110,13 @@ READ8_MEMBER(fromance_state::fromance_busycheck_main_r)
|
||||
|
||||
READ8_MEMBER(fromance_state::fromance_busycheck_sub_r)
|
||||
{
|
||||
if (m_directionflag)
|
||||
if (m_sublatch->pending_r())
|
||||
return 0xff; // standby
|
||||
else
|
||||
return 0x00; // busy
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(fromance_state::fromance_busycheck_sub_w)
|
||||
{
|
||||
m_directionflag = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
@ -257,7 +231,7 @@ static ADDRESS_MAP_START( nekkyoku_main_map, AS_PROGRAM, 8, fromance_state )
|
||||
AM_RANGE(0xf000, 0xf000) AM_READ_PORT("SERVICE") AM_WRITE(fromance_portselect_w)
|
||||
AM_RANGE(0xf001, 0xf001) AM_READ(fromance_keymatrix_r) AM_WRITENOP
|
||||
AM_RANGE(0xf002, 0xf002) AM_READ_PORT("COIN") AM_WRITE(fromance_coinctr_w)
|
||||
AM_RANGE(0xf003, 0xf003) AM_READWRITE(fromance_busycheck_main_r, fromance_commanddata_w)
|
||||
AM_RANGE(0xf003, 0xf003) AM_READ(fromance_busycheck_main_r) AM_DEVWRITE("sublatch", generic_latch_8_device, write)
|
||||
AM_RANGE(0xf004, 0xf004) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0xf005, 0xf005) AM_READ_PORT("DSW1")
|
||||
ADDRESS_MAP_END
|
||||
@ -269,7 +243,7 @@ static ADDRESS_MAP_START( fromance_main_map, AS_PROGRAM, 8, fromance_state )
|
||||
AM_RANGE(0xe000, 0xe000) AM_READ_PORT("SERVICE") AM_WRITE(fromance_portselect_w)
|
||||
AM_RANGE(0xe001, 0xe001) AM_READ(fromance_keymatrix_r)
|
||||
AM_RANGE(0xe002, 0xe002) AM_READ_PORT("COIN") AM_WRITE(fromance_coinctr_w)
|
||||
AM_RANGE(0xe003, 0xe003) AM_READWRITE(fromance_busycheck_main_r, fromance_commanddata_w)
|
||||
AM_RANGE(0xe003, 0xe003) AM_READ(fromance_busycheck_main_r) AM_DEVWRITE("sublatch", generic_latch_8_device, write)
|
||||
AM_RANGE(0xe004, 0xe004) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0xe005, 0xe005) AM_READ_PORT("DSW1")
|
||||
ADDRESS_MAP_END
|
||||
@ -313,7 +287,7 @@ static ADDRESS_MAP_START( nekkyoku_sub_io_map, AS_IO, 8, fromance_state )
|
||||
AM_RANGE(0xe0, 0xe0) AM_WRITE(fromance_rombank_w)
|
||||
AM_RANGE(0xe1, 0xe1) AM_READ(fromance_busycheck_sub_r) AM_WRITE(fromance_gfxreg_w)
|
||||
AM_RANGE(0xe2, 0xe5) AM_WRITE(fromance_scroll_w)
|
||||
AM_RANGE(0xe6, 0xe6) AM_READWRITE(fromance_commanddata_r, fromance_busycheck_sub_w)
|
||||
AM_RANGE(0xe6, 0xe6) AM_DEVREADWRITE("sublatch", generic_latch_8_device, read, acknowledge_w)
|
||||
AM_RANGE(0xe7, 0xe7) AM_WRITE(fromance_adpcm_reset_w)
|
||||
AM_RANGE(0xe8, 0xe8) AM_WRITE(fromance_adpcm_w)
|
||||
AM_RANGE(0xe9, 0xea) AM_DEVWRITE("aysnd", ay8910_device, data_address_w)
|
||||
@ -326,7 +300,7 @@ static ADDRESS_MAP_START( idolmj_sub_io_map, AS_IO, 8, fromance_state )
|
||||
AM_RANGE(0x20, 0x20) AM_WRITE(fromance_rombank_w)
|
||||
AM_RANGE(0x21, 0x21) AM_READ(fromance_busycheck_sub_r) AM_WRITE(fromance_gfxreg_w)
|
||||
AM_RANGE(0x22, 0x25) AM_WRITE(fromance_scroll_w)
|
||||
AM_RANGE(0x26, 0x26) AM_READWRITE(fromance_commanddata_r, fromance_busycheck_sub_w)
|
||||
AM_RANGE(0x26, 0x26) AM_DEVREADWRITE("sublatch", generic_latch_8_device, read, acknowledge_w)
|
||||
AM_RANGE(0x27, 0x27) AM_WRITE(fromance_adpcm_reset_w)
|
||||
AM_RANGE(0x28, 0x28) AM_WRITE(fromance_adpcm_w)
|
||||
AM_RANGE(0x29, 0x2a) AM_DEVWRITE("aysnd", ym2149_device, data_address_w)
|
||||
@ -339,7 +313,7 @@ static ADDRESS_MAP_START( fromance_sub_io_map, AS_IO, 8, fromance_state )
|
||||
AM_RANGE(0x20, 0x20) AM_WRITE(fromance_rombank_w)
|
||||
AM_RANGE(0x21, 0x21) AM_READ(fromance_busycheck_sub_r) AM_WRITE(fromance_gfxreg_w)
|
||||
AM_RANGE(0x22, 0x25) AM_WRITE(fromance_scroll_w)
|
||||
AM_RANGE(0x26, 0x26) AM_READWRITE(fromance_commanddata_r, fromance_busycheck_sub_w)
|
||||
AM_RANGE(0x26, 0x26) AM_DEVREADWRITE("sublatch", generic_latch_8_device, read, acknowledge_w)
|
||||
AM_RANGE(0x27, 0x27) AM_WRITE(fromance_adpcm_reset_w)
|
||||
AM_RANGE(0x28, 0x28) AM_WRITE(fromance_adpcm_w)
|
||||
AM_RANGE(0x2a, 0x2b) AM_DEVWRITE("ymsnd", ym2413_device, write)
|
||||
@ -889,8 +863,6 @@ MACHINE_START_MEMBER(fromance_state,fromance)
|
||||
|
||||
membank("bank1")->configure_entries(0, 0x100, &ROM[0x10000], 0x4000);
|
||||
|
||||
save_item(NAME(m_directionflag));
|
||||
save_item(NAME(m_commanddata));
|
||||
save_item(NAME(m_portselect));
|
||||
|
||||
save_item(NAME(m_adpcm_reset));
|
||||
@ -902,8 +874,6 @@ MACHINE_START_MEMBER(fromance_state,fromance)
|
||||
|
||||
MACHINE_RESET_MEMBER(fromance_state,fromance)
|
||||
{
|
||||
m_directionflag = 0;
|
||||
m_commanddata = 0;
|
||||
m_portselect = 0;
|
||||
|
||||
m_adpcm_reset = 0;
|
||||
@ -934,6 +904,9 @@ static MACHINE_CONFIG_START( nekkyoku )
|
||||
MCFG_CPU_PROGRAM_MAP(nekkyoku_sub_map)
|
||||
MCFG_CPU_IO_MAP(nekkyoku_sub_io_map)
|
||||
|
||||
MCFG_GENERIC_LATCH_8_ADD("sublatch")
|
||||
MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(fromance_state,fromance)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(fromance_state,fromance)
|
||||
|
||||
@ -948,7 +921,7 @@ static MACHINE_CONFIG_START( nekkyoku )
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", fromance)
|
||||
MCFG_PALETTE_ADD("palette", 1024)
|
||||
|
||||
MCFG_DEVICE_ADD("gga", VSYSTEM_GGA, 0)
|
||||
MCFG_DEVICE_ADD("gga", VSYSTEM_GGA, 14318180 / 2) // clock not verified
|
||||
MCFG_VSYSTEM_GGA_REGISTER_WRITE_CB(WRITE8(fromance_state, fromance_gga_data_w))
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(fromance_state,nekkyoku)
|
||||
@ -969,14 +942,17 @@ MACHINE_CONFIG_END
|
||||
static MACHINE_CONFIG_START( idolmj )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", Z80,12000000/2) /* 6.00 Mhz ? */
|
||||
MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 2) /* 6.00 Mhz ? */
|
||||
MCFG_CPU_PROGRAM_MAP(fromance_main_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", fromance_state, irq0_line_hold)
|
||||
|
||||
MCFG_CPU_ADD("sub", Z80,12000000/2) /* 6.00 Mhz ? */
|
||||
MCFG_CPU_ADD("sub", Z80, XTAL_12MHz / 2) /* 6.00 Mhz ? */
|
||||
MCFG_CPU_PROGRAM_MAP(fromance_sub_map)
|
||||
MCFG_CPU_IO_MAP(idolmj_sub_io_map)
|
||||
|
||||
MCFG_GENERIC_LATCH_8_ADD("sublatch")
|
||||
MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(fromance_state,fromance)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(fromance_state,fromance)
|
||||
|
||||
@ -991,7 +967,7 @@ static MACHINE_CONFIG_START( idolmj )
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", fromance)
|
||||
MCFG_PALETTE_ADD("palette", 2048)
|
||||
|
||||
MCFG_DEVICE_ADD("gga", VSYSTEM_GGA, 0)
|
||||
MCFG_DEVICE_ADD("gga", VSYSTEM_GGA, XTAL_14_31818MHz / 2) // divider not verified
|
||||
MCFG_VSYSTEM_GGA_REGISTER_WRITE_CB(WRITE8(fromance_state, fromance_gga_data_w))
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(fromance_state,fromance)
|
||||
@ -999,7 +975,7 @@ static MACHINE_CONFIG_START( idolmj )
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_SOUND_ADD("aysnd", YM2149, 12000000/6)
|
||||
MCFG_SOUND_ADD("aysnd", YM2149, XTAL_12MHz / 6)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
|
||||
|
||||
MCFG_SOUND_ADD("msm", MSM5205, 384000)
|
||||
@ -1012,14 +988,17 @@ MACHINE_CONFIG_END
|
||||
static MACHINE_CONFIG_START( fromance )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", Z80,12000000/2) /* 6.00 Mhz ? */
|
||||
MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 2) /* 6.00 Mhz ? */
|
||||
MCFG_CPU_PROGRAM_MAP(fromance_main_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", fromance_state, irq0_line_hold)
|
||||
|
||||
MCFG_CPU_ADD("sub", Z80,12000000/2) /* 6.00 Mhz ? */
|
||||
MCFG_CPU_ADD("sub", Z80, XTAL_12MHz / 2) /* 6.00 Mhz ? */
|
||||
MCFG_CPU_PROGRAM_MAP(fromance_sub_map)
|
||||
MCFG_CPU_IO_MAP(fromance_sub_io_map)
|
||||
|
||||
MCFG_GENERIC_LATCH_8_ADD("sublatch")
|
||||
MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(fromance_state,fromance)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(fromance_state,fromance)
|
||||
|
||||
@ -1034,7 +1013,7 @@ static MACHINE_CONFIG_START( fromance )
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", fromance)
|
||||
MCFG_PALETTE_ADD("palette", 2048)
|
||||
|
||||
MCFG_DEVICE_ADD("gga", VSYSTEM_GGA, 0)
|
||||
MCFG_DEVICE_ADD("gga", VSYSTEM_GGA, XTAL_14_31818MHz / 2) // divider not verified
|
||||
MCFG_VSYSTEM_GGA_REGISTER_WRITE_CB(WRITE8(fromance_state, fromance_gga_data_w))
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(fromance_state,fromance)
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "machine/gen_latch.h"
|
||||
#include "sound/msm5205.h"
|
||||
#include "video/vsystem_gga.h"
|
||||
#include "video/vsystem_spr2.h"
|
||||
@ -23,8 +24,9 @@ public:
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_gga(*this, "gga"),
|
||||
m_spr_old(*this, "vsystem_spr_old"),
|
||||
m_subcpu(*this, "sub"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_subcpu(*this, "sub"),
|
||||
m_sublatch(*this, "sublatch"),
|
||||
m_msm(*this, "msm"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
@ -55,22 +57,14 @@ public:
|
||||
emu_timer *m_crtc_timer;
|
||||
|
||||
/* misc */
|
||||
uint8_t m_directionflag;
|
||||
uint8_t m_commanddata;
|
||||
uint8_t m_portselect;
|
||||
uint8_t m_adpcm_reset;
|
||||
uint8_t m_adpcm_data;
|
||||
uint8_t m_vclk_left;
|
||||
uint8_t m_pending_command;
|
||||
uint8_t m_sound_command;
|
||||
|
||||
/* devices */
|
||||
required_device<cpu_device> m_subcpu;
|
||||
DECLARE_READ8_MEMBER(fromance_commanddata_r);
|
||||
DECLARE_WRITE8_MEMBER(fromance_commanddata_w);
|
||||
DECLARE_READ8_MEMBER(fromance_busycheck_main_r);
|
||||
DECLARE_READ8_MEMBER(fromance_busycheck_sub_r);
|
||||
DECLARE_WRITE8_MEMBER(fromance_busycheck_sub_w);
|
||||
DECLARE_WRITE8_MEMBER(fromance_rombank_w);
|
||||
DECLARE_WRITE8_MEMBER(fromance_adpcm_w);
|
||||
DECLARE_WRITE8_MEMBER(fromance_portselect_w);
|
||||
@ -96,7 +90,6 @@ public:
|
||||
DECLARE_VIDEO_START(hatris);
|
||||
uint32_t screen_update_fromance(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_pipedrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_CALLBACK_MEMBER(deferred_commanddata_w);
|
||||
TIMER_CALLBACK_MEMBER(crtc_interrupt_gen);
|
||||
inline void get_fromance_tile_info( tile_data &tileinfo, int tile_index, int layer );
|
||||
inline void get_nekkyoku_tile_info( tile_data &tileinfo, int tile_index, int layer );
|
||||
@ -104,6 +97,8 @@ public:
|
||||
void crtc_refresh();
|
||||
DECLARE_WRITE_LINE_MEMBER(fromance_adpcm_int);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
optional_device<generic_latch_8_device> m_sublatch;
|
||||
optional_device<msm5205_device> m_msm;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
|
Loading…
Reference in New Issue
Block a user