mirror of
https://github.com/holub/mame
synced 2025-05-07 23:02:33 +03:00
some more cleanup (nw)
This commit is contained in:
parent
3bdc0ee891
commit
c20b12eea3
@ -980,7 +980,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( slikz80_io_map, AS_IO, 8, itech8_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x00) AM_READWRITE_LEGACY(slikz80_port_r, slikz80_port_w)
|
||||
AM_RANGE(0x00, 0x00) AM_READWRITE(slikz80_port_r, slikz80_port_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -2636,17 +2636,17 @@ DRIVER_INIT_MEMBER(itech8_state,grmatch)
|
||||
|
||||
DRIVER_INIT_MEMBER(itech8_state,slikshot)
|
||||
{
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x0180, 0x0180, FUNC(slikshot_z80_r));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x01cf, 0x01cf, FUNC(slikshot_z80_control_r));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x01cf, 0x01cf, FUNC(slikshot_z80_control_w));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0x0180, 0x0180, read8_delegate(FUNC(itech8_state::slikshot_z80_r),this));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0x01cf, 0x01cf, read8_delegate(FUNC(itech8_state::slikshot_z80_control_r),this));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01cf, 0x01cf, write8_delegate(FUNC(itech8_state::slikshot_z80_control_w),this));
|
||||
}
|
||||
|
||||
|
||||
DRIVER_INIT_MEMBER(itech8_state,sstrike)
|
||||
{
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x1180, 0x1180, FUNC(slikshot_z80_r));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x11cf, 0x11cf, FUNC(slikshot_z80_control_r));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x11cf, 0x11cf, FUNC(slikshot_z80_control_w));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0x1180, 0x1180, read8_delegate(FUNC(itech8_state::slikshot_z80_r),this));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0x11cf, 0x11cf, read8_delegate(FUNC(itech8_state::slikshot_z80_control_r),this));
|
||||
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x11cf, 0x11cf, write8_delegate(FUNC(itech8_state::slikshot_z80_control_w),this));
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,8 +93,8 @@ static ADDRESS_MAP_START( maniach_map, AS_PROGRAM, 8, matmania_state )
|
||||
AM_RANGE(0x3010, 0x3010) AM_READ_PORT("IN1") AM_WRITE(maniach_sh_command_w)
|
||||
AM_RANGE(0x3020, 0x3020) AM_READ_PORT("DSW2") AM_WRITEONLY AM_SHARE("scroll")
|
||||
AM_RANGE(0x3030, 0x3030) AM_READ_PORT("DSW1") AM_WRITENOP /* ?? */
|
||||
AM_RANGE(0x3040, 0x3040) AM_READWRITE_LEGACY(maniach_mcu_r,maniach_mcu_w)
|
||||
AM_RANGE(0x3041, 0x3041) AM_READ_LEGACY(maniach_mcu_status_r)
|
||||
AM_RANGE(0x3040, 0x3040) AM_READWRITE(maniach_mcu_r,maniach_mcu_w)
|
||||
AM_RANGE(0x3041, 0x3041) AM_READ(maniach_mcu_status_r)
|
||||
AM_RANGE(0x3050, 0x307f) AM_WRITE(matmania_paletteram_w) AM_SHARE("paletteram")
|
||||
AM_RANGE(0x4000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -120,12 +120,12 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( maniach_mcu_map, AS_PROGRAM, 8, matmania_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x7ff)
|
||||
AM_RANGE(0x0000, 0x0000) AM_READWRITE_LEGACY(maniach_68705_port_a_r,maniach_68705_port_a_w)
|
||||
AM_RANGE(0x0001, 0x0001) AM_READWRITE_LEGACY(maniach_68705_port_b_r,maniach_68705_port_b_w)
|
||||
AM_RANGE(0x0002, 0x0002) AM_READWRITE_LEGACY(maniach_68705_port_c_r,maniach_68705_port_c_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_WRITE_LEGACY(maniach_68705_ddr_a_w)
|
||||
AM_RANGE(0x0005, 0x0005) AM_WRITE_LEGACY(maniach_68705_ddr_b_w)
|
||||
AM_RANGE(0x0006, 0x0006) AM_WRITE_LEGACY(maniach_68705_ddr_c_w)
|
||||
AM_RANGE(0x0000, 0x0000) AM_READWRITE(maniach_68705_port_a_r,maniach_68705_port_a_w)
|
||||
AM_RANGE(0x0001, 0x0001) AM_READWRITE(maniach_68705_port_b_r,maniach_68705_port_b_w)
|
||||
AM_RANGE(0x0002, 0x0002) AM_READWRITE(maniach_68705_port_c_r,maniach_68705_port_c_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_WRITE(maniach_68705_ddr_a_w)
|
||||
AM_RANGE(0x0005, 0x0005) AM_WRITE(maniach_68705_ddr_b_w)
|
||||
AM_RANGE(0x0006, 0x0006) AM_WRITE(maniach_68705_ddr_c_w)
|
||||
AM_RANGE(0x0010, 0x007f) AM_RAM
|
||||
AM_RANGE(0x0080, 0x07ff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
@ -15,7 +15,22 @@
|
||||
#include "machine/nvram.h"
|
||||
#include "machine/amigafdc.h"
|
||||
|
||||
class mquake_state : public amiga_state
|
||||
{
|
||||
public:
|
||||
mquake_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: amiga_state(mconfig, type, tag) { }
|
||||
|
||||
DECLARE_DRIVER_INIT(mquake);
|
||||
DECLARE_MACHINE_RESET(mquake);
|
||||
DECLARE_WRITE8_MEMBER( mquake_cia_0_porta_w );
|
||||
DECLARE_READ8_MEMBER( mquake_cia_0_portb_r );
|
||||
DECLARE_WRITE8_MEMBER( mquake_cia_0_portb_w );
|
||||
DECLARE_READ8_MEMBER( es5503_sample_r );
|
||||
DECLARE_WRITE16_MEMBER( output_w );
|
||||
DECLARE_READ16_MEMBER( coin_chip_r );
|
||||
DECLARE_WRITE16_MEMBER( coin_chip_w );
|
||||
};
|
||||
|
||||
/*************************************
|
||||
*
|
||||
@ -32,21 +47,19 @@
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( mquake_cia_0_porta_w )
|
||||
WRITE8_MEMBER(mquake_state::mquake_cia_0_porta_w)
|
||||
{
|
||||
amiga_state *sta = device->machine().driver_data<amiga_state>();
|
||||
|
||||
/* switch banks as appropriate */
|
||||
sta->m_bank1->set_entry(data & 1);
|
||||
m_bank1->set_entry(data & 1);
|
||||
|
||||
/* swap the write handlers between ROM and bank 1 based on the bit */
|
||||
if ((data & 1) == 0)
|
||||
/* overlay disabled, map RAM on 0x000000 */
|
||||
sta->m_maincpu->space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1");
|
||||
m_maincpu->space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1");
|
||||
|
||||
else
|
||||
/* overlay enabled, map Amiga system ROM on 0x000000 */
|
||||
sta->m_maincpu->space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff);
|
||||
m_maincpu->space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff);
|
||||
}
|
||||
|
||||
|
||||
@ -66,17 +79,17 @@ static WRITE8_DEVICE_HANDLER( mquake_cia_0_porta_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static READ8_DEVICE_HANDLER( mquake_cia_0_portb_r )
|
||||
READ8_MEMBER(mquake_state::mquake_cia_0_portb_r)
|
||||
{
|
||||
/* parallel port */
|
||||
logerror("%s:CIA0_portb_r\n", space.machine().describe_context());
|
||||
logerror("%s:CIA0_portb_r\n", machine().describe_context());
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( mquake_cia_0_portb_w )
|
||||
WRITE8_MEMBER(mquake_state::mquake_cia_0_portb_w)
|
||||
{
|
||||
/* parallel port */
|
||||
logerror("%s:CIA0_portb_w(%02x)\n", space.machine().describe_context(), data);
|
||||
logerror("%s:CIA0_portb_w(%02x)\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
|
||||
@ -87,34 +100,34 @@ static WRITE8_DEVICE_HANDLER( mquake_cia_0_portb_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static READ8_HANDLER( es5503_sample_r )
|
||||
READ8_MEMBER(mquake_state::es5503_sample_r)
|
||||
{
|
||||
UINT8 *rom = space.machine().root_device().memregion("es5503")->base();
|
||||
es5503_device *es5503 = space.machine().device<es5503_device>("es5503");
|
||||
UINT8 *rom = memregion("es5503")->base();
|
||||
es5503_device *es5503 = machine().device<es5503_device>("es5503");
|
||||
|
||||
return rom[offset + (es5503->get_channel_strobe() * 0x10000)];
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( mquake_es5503_map, AS_0, 8, amiga_state )
|
||||
AM_RANGE(0x000000, 0x1ffff) AM_READ_LEGACY(es5503_sample_r)
|
||||
static ADDRESS_MAP_START( mquake_es5503_map, AS_0, 8, mquake_state )
|
||||
AM_RANGE(0x000000, 0x1ffff) AM_READ(es5503_sample_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static WRITE16_HANDLER( output_w )
|
||||
WRITE16_MEMBER(mquake_state::output_w)
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
logerror("%06x:output_w(%x) = %02x\n", space.device().safe_pc(), offset, data);
|
||||
}
|
||||
|
||||
|
||||
static READ16_HANDLER( coin_chip_r )
|
||||
READ16_MEMBER(mquake_state::coin_chip_r)
|
||||
{
|
||||
if (offset == 1)
|
||||
return space.machine().root_device().ioport("COINCHIP")->read();
|
||||
return ioport("COINCHIP")->read();
|
||||
logerror("%06x:coin_chip_r(%02x) & %04x\n", space.device().safe_pc(), offset, mem_mask);
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( coin_chip_w )
|
||||
WRITE16_MEMBER(mquake_state::coin_chip_w)
|
||||
{
|
||||
logerror("%06x:coin_chip_w(%02x) = %04x & %04x\n", space.device().safe_pc(), offset, data, mem_mask);
|
||||
}
|
||||
@ -133,7 +146,7 @@ static WRITE16_HANDLER( coin_chip_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, amiga_state )
|
||||
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, mquake_state )
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram")
|
||||
AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE_LEGACY(amiga_cia_r, amiga_cia_w)
|
||||
@ -145,8 +158,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, amiga_state )
|
||||
AM_RANGE(0x204000, 0x2041ff) AM_DEVREADWRITE8("es5503", es5503_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x282000, 0x282001) AM_READ_PORT("SW.LO")
|
||||
AM_RANGE(0x282002, 0x282003) AM_READ_PORT("SW.HI")
|
||||
AM_RANGE(0x284000, 0x28400f) AM_WRITE_LEGACY(output_w)
|
||||
AM_RANGE(0x286000, 0x28600f) AM_READWRITE_LEGACY(coin_chip_r, coin_chip_w)
|
||||
AM_RANGE(0x284000, 0x28400f) AM_WRITE(output_w)
|
||||
AM_RANGE(0x286000, 0x28600f) AM_READWRITE(coin_chip_r, coin_chip_w)
|
||||
AM_RANGE(0x300000, 0x3bffff) AM_ROM AM_REGION("user2", 0)
|
||||
AM_RANGE(0xf00000, 0xfbffff) AM_ROM AM_REGION("user2", 0) /* Custom ROM */
|
||||
ADDRESS_MAP_END
|
||||
@ -166,11 +179,11 @@ static INPUT_PORTS_START( mquake )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* JS1SW */
|
||||
|
||||
PORT_START("JOY0DAT")
|
||||
PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state,amiga_joystick_convert, 0)
|
||||
PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mquake_state,amiga_joystick_convert, 0)
|
||||
PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("JOY1DAT")
|
||||
PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state,amiga_joystick_convert, 1)
|
||||
PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mquake_state,amiga_joystick_convert, 1)
|
||||
PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("P1JOY")
|
||||
@ -304,7 +317,7 @@ INPUT_PORTS_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
MACHINE_RESET_MEMBER(amiga_state,mquake)
|
||||
MACHINE_RESET_MEMBER(mquake_state,mquake)
|
||||
{
|
||||
MACHINE_RESET_CALL_MEMBER(amiga);
|
||||
}
|
||||
@ -322,9 +335,9 @@ static const legacy_mos6526_interface cia_0_intf =
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
DEVCB_INPUT_PORT("CIA0PORTA"),
|
||||
DEVCB_HANDLER(mquake_cia_0_porta_w), /* port A */
|
||||
DEVCB_HANDLER(mquake_cia_0_portb_r),
|
||||
DEVCB_HANDLER(mquake_cia_0_portb_w) /* port B */
|
||||
DEVCB_DRIVER_MEMBER(mquake_state,mquake_cia_0_porta_w), /* port A */
|
||||
DEVCB_DRIVER_MEMBER(mquake_state,mquake_cia_0_portb_r),
|
||||
DEVCB_DRIVER_MEMBER(mquake_state,mquake_cia_0_portb_w) /* port B */
|
||||
};
|
||||
|
||||
static const legacy_mos6526_interface cia_1_intf =
|
||||
@ -339,13 +352,13 @@ static const legacy_mos6526_interface cia_1_intf =
|
||||
DEVCB_NULL
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_START( mquake, amiga_state )
|
||||
static MACHINE_CONFIG_START( mquake, mquake_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, AMIGA_68000_NTSC_CLOCK)
|
||||
MCFG_CPU_PROGRAM_MAP(main_map)
|
||||
|
||||
MCFG_MACHINE_RESET_OVERRIDE(amiga_state,mquake)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(mquake_state,mquake)
|
||||
MCFG_NVRAM_ADD_0FILL("nvram")
|
||||
|
||||
/* video hardware */
|
||||
@ -356,12 +369,12 @@ static MACHINE_CONFIG_START( mquake, amiga_state )
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MCFG_SCREEN_SIZE(512*2, 262)
|
||||
MCFG_SCREEN_VISIBLE_AREA((129-8)*2, (449+8-1)*2, 44-8, 244+8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(mquake_state, screen_update_amiga)
|
||||
|
||||
MCFG_PALETTE_LENGTH(4096)
|
||||
MCFG_PALETTE_INIT_OVERRIDE(amiga_state,amiga)
|
||||
MCFG_PALETTE_INIT_OVERRIDE(mquake_state,amiga)
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(amiga_state,amiga)
|
||||
MCFG_VIDEO_START_OVERRIDE(mquake_state,amiga)
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
@ -427,7 +440,7 @@ ROM_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
DRIVER_INIT_MEMBER(amiga_state,mquake)
|
||||
DRIVER_INIT_MEMBER(mquake_state,mquake)
|
||||
{
|
||||
static const amiga_machine_interface mquake_intf =
|
||||
{
|
||||
@ -453,4 +466,4 @@ DRIVER_INIT_MEMBER(amiga_state,mquake)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1987, mquake, 0, mquake, mquake, amiga_state, mquake, 0, "Sente", "Moonquake", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1987, mquake, 0, mquake, mquake, mquake_state, mquake, 0, "Sente", "Moonquake", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
|
@ -459,11 +459,9 @@ public:
|
||||
int m_aga_sprite_dma_used_words[8];
|
||||
|
||||
DECLARE_CUSTOM_INPUT_MEMBER( amiga_joystick_convert );
|
||||
DECLARE_DRIVER_INIT(mquake);
|
||||
DECLARE_DRIVER_INIT(amiga);
|
||||
DECLARE_DRIVER_INIT(cdtv);
|
||||
DECLARE_DRIVER_INIT(a3000);
|
||||
DECLARE_MACHINE_RESET(mquake);
|
||||
DECLARE_MACHINE_RESET(amiga);
|
||||
DECLARE_VIDEO_START(amiga);
|
||||
DECLARE_PALETTE_INIT(amiga);
|
||||
|
@ -110,13 +110,26 @@ public:
|
||||
inline void consume_rle(int count);
|
||||
void perform_blit(address_space &space);
|
||||
void itech8_update_interrupts(int periodic, int tms34061, int blitter);
|
||||
|
||||
/*----------- defined in machine/slikshot.c -----------*/
|
||||
|
||||
DECLARE_READ8_MEMBER( slikz80_port_r );
|
||||
DECLARE_WRITE8_MEMBER( slikz80_port_w );
|
||||
|
||||
DECLARE_READ8_MEMBER( slikshot_z80_r );
|
||||
DECLARE_READ8_MEMBER( slikshot_z80_control_r );
|
||||
DECLARE_WRITE8_MEMBER( slikshot_z80_control_w );
|
||||
|
||||
void inters_to_vels(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 beams,
|
||||
UINT8 *xres, UINT8 *vxres, UINT8 *vyres);
|
||||
void vels_to_inters(UINT8 x, UINT8 vx, UINT8 vy,
|
||||
UINT16 *inter1, UINT16 *inter2, UINT16 *inter3, UINT8 *beams);
|
||||
void inters_to_words(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 *beams,
|
||||
UINT16 *word1, UINT16 *word2, UINT16 *word3);
|
||||
|
||||
void words_to_sensors(UINT16 word1, UINT16 word2, UINT16 word3, UINT8 beams,
|
||||
UINT16 *sens0, UINT16 *sens1, UINT16 *sens2, UINT16 *sens3);
|
||||
void compute_sensors();
|
||||
TIMER_CALLBACK_MEMBER( delayed_z80_control_w );
|
||||
};
|
||||
|
||||
/*----------- defined in machine/slikshot.c -----------*/
|
||||
|
||||
DECLARE_READ8_HANDLER( slikz80_port_r );
|
||||
DECLARE_WRITE8_HANDLER( slikz80_port_w );
|
||||
|
||||
DECLARE_READ8_HANDLER( slikshot_z80_r );
|
||||
DECLARE_READ8_HANDLER( slikshot_z80_control_r );
|
||||
DECLARE_WRITE8_HANDLER( slikshot_z80_control_w );
|
||||
|
@ -61,19 +61,17 @@ public:
|
||||
DECLARE_MACHINE_RESET(maniach);
|
||||
UINT32 screen_update_matmania(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_maniach(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
/*----------- defined in machine/maniach.c -----------*/
|
||||
DECLARE_READ8_MEMBER( maniach_68705_port_a_r );
|
||||
DECLARE_WRITE8_MEMBER( maniach_68705_port_a_w );
|
||||
DECLARE_READ8_MEMBER( maniach_68705_port_b_r );
|
||||
DECLARE_WRITE8_MEMBER( maniach_68705_port_b_w );
|
||||
DECLARE_READ8_MEMBER( maniach_68705_port_c_r );
|
||||
DECLARE_WRITE8_MEMBER( maniach_68705_port_c_w );
|
||||
DECLARE_WRITE8_MEMBER( maniach_68705_ddr_a_w );
|
||||
DECLARE_WRITE8_MEMBER( maniach_68705_ddr_b_w );
|
||||
DECLARE_WRITE8_MEMBER( maniach_68705_ddr_c_w );
|
||||
DECLARE_WRITE8_MEMBER( maniach_mcu_w );
|
||||
DECLARE_READ8_MEMBER( maniach_mcu_r );
|
||||
DECLARE_READ8_MEMBER( maniach_mcu_status_r );
|
||||
};
|
||||
|
||||
/*----------- defined in machine/maniach.c -----------*/
|
||||
|
||||
DECLARE_READ8_HANDLER( maniach_68705_port_a_r );
|
||||
DECLARE_WRITE8_HANDLER( maniach_68705_port_a_w );
|
||||
DECLARE_READ8_HANDLER( maniach_68705_port_b_r );
|
||||
DECLARE_WRITE8_HANDLER( maniach_68705_port_b_w );
|
||||
DECLARE_READ8_HANDLER( maniach_68705_port_c_r );
|
||||
DECLARE_WRITE8_HANDLER( maniach_68705_port_c_w );
|
||||
DECLARE_WRITE8_HANDLER( maniach_68705_ddr_a_w );
|
||||
DECLARE_WRITE8_HANDLER( maniach_68705_ddr_b_w );
|
||||
DECLARE_WRITE8_HANDLER( maniach_68705_ddr_c_w );
|
||||
DECLARE_WRITE8_HANDLER( maniach_mcu_w );
|
||||
DECLARE_READ8_HANDLER( maniach_mcu_r );
|
||||
DECLARE_READ8_HANDLER( maniach_mcu_status_r );
|
||||
|
@ -19,26 +19,21 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
READ8_HANDLER( maniach_68705_port_a_r )
|
||||
READ8_MEMBER(matmania_state::maniach_68705_port_a_r )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
|
||||
//logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), state->m_port_a_in);
|
||||
return (state->m_port_a_out & state->m_ddr_a) | (state->m_port_a_in & ~state->m_ddr_a);
|
||||
//logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in);
|
||||
return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( maniach_68705_port_a_w )
|
||||
WRITE8_MEMBER(matmania_state::maniach_68705_port_a_w )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
|
||||
//logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data);
|
||||
state->m_port_a_out = data;
|
||||
m_port_a_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( maniach_68705_ddr_a_w )
|
||||
WRITE8_MEMBER(matmania_state::maniach_68705_ddr_a_w )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
state->m_ddr_a = data;
|
||||
m_ddr_a = data;
|
||||
}
|
||||
|
||||
|
||||
@ -52,102 +47,88 @@ WRITE8_HANDLER( maniach_68705_ddr_a_w )
|
||||
* 2 W when 0->1, copies port A to the latch for the main CPU
|
||||
*/
|
||||
|
||||
READ8_HANDLER( maniach_68705_port_b_r )
|
||||
READ8_MEMBER(matmania_state::maniach_68705_port_b_r )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
return (state->m_port_b_out & state->m_ddr_b) | (state->m_port_b_in & ~state->m_ddr_b);
|
||||
return (m_port_b_out & m_ddr_b) | (m_port_b_in & ~m_ddr_b);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( maniach_68705_port_b_w )
|
||||
WRITE8_MEMBER(matmania_state::maniach_68705_port_b_w )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
|
||||
//logerror("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data);
|
||||
|
||||
if (BIT(state->m_ddr_b, 1) && BIT(~data, 1) && BIT(state->m_port_b_out, 1))
|
||||
if (BIT(m_ddr_b, 1) && BIT(~data, 1) && BIT(m_port_b_out, 1))
|
||||
{
|
||||
state->m_port_a_in = state->m_from_main;
|
||||
state->m_main_sent = 0;
|
||||
//logerror("read command %02x from main cpu\n", state->m_port_a_in);
|
||||
m_port_a_in = m_from_main;
|
||||
m_main_sent = 0;
|
||||
//logerror("read command %02x from main cpu\n", m_port_a_in);
|
||||
}
|
||||
if (BIT(state->m_ddr_b, 2) && BIT(data, 2) && BIT(~state->m_port_b_out, 2))
|
||||
if (BIT(m_ddr_b, 2) && BIT(data, 2) && BIT(~m_port_b_out, 2))
|
||||
{
|
||||
//logerror("send command %02x to main cpu\n", state->m_port_a_out);
|
||||
state->m_from_mcu = state->m_port_a_out;
|
||||
state->m_mcu_sent = 1;
|
||||
//logerror("send command %02x to main cpu\n", m_port_a_out);
|
||||
m_from_mcu = m_port_a_out;
|
||||
m_mcu_sent = 1;
|
||||
}
|
||||
|
||||
state->m_port_b_out = data;
|
||||
m_port_b_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( maniach_68705_ddr_b_w )
|
||||
WRITE8_MEMBER(matmania_state::maniach_68705_ddr_b_w )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
state->m_ddr_b = data;
|
||||
m_ddr_b = data;
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( maniach_68705_port_c_r )
|
||||
READ8_MEMBER(matmania_state::maniach_68705_port_c_r )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
m_port_c_in = 0;
|
||||
|
||||
state->m_port_c_in = 0;
|
||||
if (m_main_sent)
|
||||
m_port_c_in |= 0x01;
|
||||
|
||||
if (state->m_main_sent)
|
||||
state->m_port_c_in |= 0x01;
|
||||
if (!m_mcu_sent)
|
||||
m_port_c_in |= 0x02;
|
||||
|
||||
if (!state->m_mcu_sent)
|
||||
state->m_port_c_in |= 0x02;
|
||||
//logerror("%04x: 68705 port C read %02x\n",m_space->device().safe_pc(), m_port_c_in);
|
||||
|
||||
//logerror("%04x: 68705 port C read %02x\n",state->m_space->device().safe_pc(), state->m_port_c_in);
|
||||
|
||||
return (state->m_port_c_out & state->m_ddr_c) | (state->m_port_c_in & ~state->m_ddr_c);
|
||||
return (m_port_c_out & m_ddr_c) | (m_port_c_in & ~m_ddr_c);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( maniach_68705_port_c_w )
|
||||
WRITE8_MEMBER(matmania_state::maniach_68705_port_c_w )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
|
||||
//logerror("%04x: 68705 port C write %02x\n", space.device().safe_pc(), data);
|
||||
state->m_port_c_out = data;
|
||||
m_port_c_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( maniach_68705_ddr_c_w )
|
||||
WRITE8_MEMBER(matmania_state::maniach_68705_ddr_c_w )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
state->m_ddr_c = data;
|
||||
m_ddr_c = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( maniach_mcu_w )
|
||||
WRITE8_MEMBER(matmania_state::maniach_mcu_w )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
|
||||
//logerror("%04x: 3040_w %02x\n", space.device().safe_pc(), data);
|
||||
state->m_from_main = data;
|
||||
state->m_main_sent = 1;
|
||||
m_from_main = data;
|
||||
m_main_sent = 1;
|
||||
}
|
||||
|
||||
READ8_HANDLER( maniach_mcu_r )
|
||||
READ8_MEMBER(matmania_state::maniach_mcu_r )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
|
||||
//logerror("%04x: 3040_r %02x\n", space.device().safe_pc(), state->m_from_mcu);
|
||||
state->m_mcu_sent = 0;
|
||||
return state->m_from_mcu;
|
||||
//logerror("%04x: 3040_r %02x\n", space.device().safe_pc(), m_from_mcu);
|
||||
m_mcu_sent = 0;
|
||||
return m_from_mcu;
|
||||
}
|
||||
|
||||
READ8_HANDLER( maniach_mcu_status_r )
|
||||
READ8_MEMBER(matmania_state::maniach_mcu_status_r )
|
||||
{
|
||||
matmania_state *state = space.machine().driver_data<matmania_state>();
|
||||
int res = 0;
|
||||
|
||||
/* bit 0 = when 0, mcu has sent data to the main cpu */
|
||||
/* bit 1 = when 1, mcu is ready to receive data from main cpu */
|
||||
//logerror("%04x: 3041_r\n", space.device().safe_pc());
|
||||
if (!state->m_mcu_sent)
|
||||
if (!m_mcu_sent)
|
||||
res |= 0x01;
|
||||
if (!state->m_main_sent)
|
||||
if (!m_main_sent)
|
||||
res |= 0x02;
|
||||
|
||||
return res;
|
||||
|
@ -170,7 +170,7 @@ static void words_to_inters(UINT16 word1, UINT16 word2, UINT16 word3, UINT8 beam
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void inters_to_vels(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 beams,
|
||||
void itech8_state::inters_to_vels(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 beams,
|
||||
UINT8 *xres, UINT8 *vxres, UINT8 *vyres)
|
||||
{
|
||||
UINT32 _27d8, _27c2;
|
||||
@ -243,7 +243,7 @@ static void inters_to_vels(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 be
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void vels_to_inters(UINT8 x, UINT8 vx, UINT8 vy,
|
||||
void itech8_state::vels_to_inters(UINT8 x, UINT8 vx, UINT8 vy,
|
||||
UINT16 *inter1, UINT16 *inter2, UINT16 *inter3, UINT8 *beams)
|
||||
{
|
||||
UINT32 _27d8;
|
||||
@ -296,7 +296,7 @@ static void vels_to_inters(UINT8 x, UINT8 vx, UINT8 vy,
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void inters_to_words(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 *beams,
|
||||
void itech8_state::inters_to_words(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 *beams,
|
||||
UINT16 *word1, UINT16 *word2, UINT16 *word3)
|
||||
{
|
||||
UINT16 word2mod;
|
||||
@ -358,7 +358,7 @@ static void inters_to_words(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 *
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void words_to_sensors(UINT16 word1, UINT16 word2, UINT16 word3, UINT8 beams,
|
||||
void itech8_state::words_to_sensors(UINT16 word1, UINT16 word2, UINT16 word3, UINT8 beams,
|
||||
UINT16 *sens0, UINT16 *sens1, UINT16 *sens2, UINT16 *sens3)
|
||||
{
|
||||
/* if bit 0 of the beams is set, sensor 1 fired first; otherwise sensor 0 fired */
|
||||
@ -382,23 +382,22 @@ static void words_to_sensors(UINT16 word1, UINT16 word2, UINT16 word3, UINT8 bea
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void compute_sensors(running_machine &machine)
|
||||
{
|
||||
itech8_state *state = machine.driver_data<itech8_state>();
|
||||
void itech8_state::compute_sensors()
|
||||
{
|
||||
UINT16 inter1, inter2, inter3;
|
||||
UINT16 word1 = 0, word2 = 0, word3 = 0;
|
||||
UINT8 beams;
|
||||
|
||||
/* skip if we're not ready */
|
||||
if (state->m_sensor0 != 0 || state->m_sensor1 != 0 || state->m_sensor2 != 0 || state->m_sensor3 != 0)
|
||||
if (m_sensor0 != 0 || m_sensor1 != 0 || m_sensor2 != 0 || m_sensor3 != 0)
|
||||
return;
|
||||
|
||||
/* reverse map the inputs */
|
||||
vels_to_inters(state->m_curx, state->m_curvx, state->m_curvy, &inter1, &inter2, &inter3, &beams);
|
||||
vels_to_inters(m_curx, m_curvx, m_curvy, &inter1, &inter2, &inter3, &beams);
|
||||
inters_to_words(inter1, inter2, inter3, &beams, &word1, &word2, &word3);
|
||||
words_to_sensors(word1, word2, word3, beams, &state->m_sensor0, &state->m_sensor1, &state->m_sensor2, &state->m_sensor3);
|
||||
words_to_sensors(word1, word2, word3, beams, &m_sensor0, &m_sensor1, &m_sensor2, &m_sensor3);
|
||||
|
||||
logerror("%15f: Sensor values: %04x %04x %04x %04x\n", machine.time().as_double(), state->m_sensor0, state->m_sensor1, state->m_sensor2, state->m_sensor3);
|
||||
logerror("%15f: Sensor values: %04x %04x %04x %04x\n", machine().time().as_double(), m_sensor0, m_sensor1, m_sensor2, m_sensor3);
|
||||
}
|
||||
|
||||
|
||||
@ -409,25 +408,24 @@ static void compute_sensors(running_machine &machine)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ8_HANDLER( slikz80_port_r )
|
||||
READ8_MEMBER(itech8_state::slikz80_port_r )
|
||||
{
|
||||
itech8_state *state = space.machine().driver_data<itech8_state>();
|
||||
int result = 0;
|
||||
|
||||
/* if we have nothing, return 0x03 */
|
||||
if (!state->m_sensor0 && !state->m_sensor1 && !state->m_sensor2 && !state->m_sensor3)
|
||||
return 0x03 | (state->m_z80_clear_to_send << 7);
|
||||
if (!m_sensor0 && !m_sensor1 && !m_sensor2 && !m_sensor3)
|
||||
return 0x03 | (m_z80_clear_to_send << 7);
|
||||
|
||||
/* 1 bit for each sensor */
|
||||
if (state->m_sensor0)
|
||||
result |= 1, state->m_sensor0--;
|
||||
if (state->m_sensor1)
|
||||
result |= 2, state->m_sensor1--;
|
||||
if (state->m_sensor2)
|
||||
result |= 4, state->m_sensor2--;
|
||||
if (state->m_sensor3)
|
||||
result |= 8, state->m_sensor3--;
|
||||
result |= state->m_z80_clear_to_send << 7;
|
||||
if (m_sensor0)
|
||||
result |= 1, m_sensor0--;
|
||||
if (m_sensor1)
|
||||
result |= 2, m_sensor1--;
|
||||
if (m_sensor2)
|
||||
result |= 4, m_sensor2--;
|
||||
if (m_sensor3)
|
||||
result |= 8, m_sensor3--;
|
||||
result |= m_z80_clear_to_send << 7;
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -440,11 +438,10 @@ READ8_HANDLER( slikz80_port_r )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE8_HANDLER( slikz80_port_w )
|
||||
WRITE8_MEMBER(itech8_state::slikz80_port_w )
|
||||
{
|
||||
itech8_state *state = space.machine().driver_data<itech8_state>();
|
||||
state->m_z80_port_val = data;
|
||||
state->m_z80_clear_to_send = 0;
|
||||
m_z80_port_val = data;
|
||||
m_z80_clear_to_send = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -455,12 +452,11 @@ WRITE8_HANDLER( slikz80_port_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ8_HANDLER( slikshot_z80_r )
|
||||
READ8_MEMBER(itech8_state::slikshot_z80_r )
|
||||
{
|
||||
itech8_state *state = space.machine().driver_data<itech8_state>();
|
||||
/* allow the Z80 to send us stuff now */
|
||||
state->m_z80_clear_to_send = 1;
|
||||
return state->m_z80_port_val;
|
||||
m_z80_clear_to_send = 1;
|
||||
return m_z80_port_val;
|
||||
}
|
||||
|
||||
|
||||
@ -471,10 +467,9 @@ READ8_HANDLER( slikshot_z80_r )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ8_HANDLER( slikshot_z80_control_r )
|
||||
READ8_MEMBER(itech8_state::slikshot_z80_control_r )
|
||||
{
|
||||
itech8_state *state = space.machine().driver_data<itech8_state>();
|
||||
return state->m_z80_ctrl;
|
||||
return m_z80_ctrl;
|
||||
}
|
||||
|
||||
|
||||
@ -485,35 +480,34 @@ READ8_HANDLER( slikshot_z80_control_r )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static TIMER_CALLBACK( delayed_z80_control_w )
|
||||
TIMER_CALLBACK_MEMBER( itech8_state::delayed_z80_control_w )
|
||||
{
|
||||
itech8_state *state = machine.driver_data<itech8_state>();
|
||||
int data = param;
|
||||
|
||||
/* bit 4 controls the reset line on the Z80 */
|
||||
|
||||
/* this is a big kludge: only allow a reset if the Z80 is stopped */
|
||||
/* at its endpoint; otherwise, we never get a result from the Z80 */
|
||||
if ((data & 0x10) || machine.device("sub")->state().state_int(Z80_PC) == 0x13a)
|
||||
if ((data & 0x10) || machine().device("sub")->state().state_int(Z80_PC) == 0x13a)
|
||||
{
|
||||
machine.device("sub")->execute().set_input_line(INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
|
||||
machine().device("sub")->execute().set_input_line(INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
|
||||
|
||||
/* on the rising edge, make the crosshair visible again */
|
||||
if ((data & 0x10) && !(state->m_z80_ctrl & 0x10))
|
||||
state->m_crosshair_vis = 1;
|
||||
if ((data & 0x10) && !(m_z80_ctrl & 0x10))
|
||||
m_crosshair_vis = 1;
|
||||
}
|
||||
|
||||
/* boost the interleave whenever this is written to */
|
||||
machine.scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
|
||||
machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
|
||||
|
||||
/* stash the new value */
|
||||
state->m_z80_ctrl = data;
|
||||
m_z80_ctrl = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( slikshot_z80_control_w )
|
||||
WRITE8_MEMBER(itech8_state::slikshot_z80_control_w )
|
||||
{
|
||||
space.machine().scheduler().synchronize(FUNC(delayed_z80_control_w), data);
|
||||
machine().scheduler().synchronize(timer_expired_delegate(FUNC(itech8_state::delayed_z80_control_w),this), data);
|
||||
}
|
||||
|
||||
|
||||
@ -593,7 +587,7 @@ UINT32 itech8_state::screen_update_slikshot(screen_device &screen, bitmap_rgb32
|
||||
if (temp >= 0x90) temp = 0x90;
|
||||
m_curx = temp;
|
||||
|
||||
compute_sensors(machine());
|
||||
compute_sensors();
|
||||
// popmessage("V=%02x,%02x X=%02x", m_curvx, m_curvy, m_curx);
|
||||
m_crosshair_vis = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user