diff options
Diffstat (limited to 'src/mame/drivers/astrohome.cpp')
-rw-r--r-- | src/mame/drivers/astrohome.cpp | 79 |
1 files changed, 29 insertions, 50 deletions
diff --git a/src/mame/drivers/astrohome.cpp b/src/mame/drivers/astrohome.cpp index ceceb0c6dc5..b4e49c93224 100644 --- a/src/mame/drivers/astrohome.cpp +++ b/src/mame/drivers/astrohome.cpp @@ -17,6 +17,8 @@ #include "bus/astrocde/rom.h" #include "bus/astrocde/exp.h" #include "bus/astrocde/ram.h" +#include "bus/astrocde/ctrl.h" +#include "bus/astrocde/accessory.h" #include "softlist.h" #include "speaker.h" @@ -29,6 +31,8 @@ public: : astrocde_state(mconfig, type, tag) , m_cart(*this, "cartslot") , m_exp(*this, "exp") + , m_ctrl(*this, "ctrl%u", 1U) + , m_accessory(*this, "accessory") , m_keypad(*this, "KEYPAD%u", 0U) { } @@ -42,6 +46,8 @@ private: required_device<astrocade_cart_slot_device> m_cart; required_device<astrocade_exp_device> m_exp; + required_device_array<astrocade_ctrl_port_device, 4> m_ctrl; + required_device<astrocade_accessory_port_device> m_accessory; required_ioport_array<4> m_keypad; }; @@ -104,42 +110,10 @@ READ8_MEMBER(astrocde_home_state::inputs_r) if (BIT(offset, 2)) return m_keypad[offset & 3]->read(); else - return m_handle[offset & 3]->read(); + return m_ctrl[offset & 3]->read_handle(); } static INPUT_PORTS_START( astrocde ) - PORT_START("P1HANDLE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("P2HANDLE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("P3HANDLE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(3) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(3) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(3) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(3) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(3) - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("P4HANDLE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(4) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(4) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(4) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(4) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(4) - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("KEYPAD0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("% \xC3\xB7 [ ] LIST") PORT_CODE(KEYCODE_O) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("/ x J K L NEXT") PORT_CODE(KEYCODE_SLASH_PAD) @@ -175,18 +149,6 @@ static INPUT_PORTS_START( astrocde ) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("1 SPACE $ , ?") PORT_CODE(KEYCODE_1) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE GREEN Shift") PORT_CODE(KEYCODE_E) PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("P1_KNOB") - PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1) - - PORT_START("P2_KNOB") - PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2) - - PORT_START("P3_KNOB") - PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W) PORT_PLAYER(3) - - PORT_START("P4_KNOB") - PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Y) PORT_CODE_INC(KEYCODE_U) PORT_PLAYER(4) INPUT_PORTS_END @@ -201,6 +163,7 @@ static void astrocade_cart(device_slot_interface &device) device.option_add_internal("rom", ASTROCADE_ROM_STD); device.option_add_internal("rom_256k", ASTROCADE_ROM_256K); device.option_add_internal("rom_512k", ASTROCADE_ROM_512K); + device.option_add_internal("rom_cass", ASTROCADE_ROM_CASS); } static void astrocade_exp(device_slot_interface &device) @@ -221,6 +184,8 @@ void astrocde_home_state::astrocde(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &astrocde_home_state::astrocade_mem); m_maincpu->set_addrmap(AS_IO, &astrocde_home_state::astrocade_io); + config.m_perfect_cpu_quantum = subtag("maincpu"); + MCFG_MACHINE_START_OVERRIDE(astrocde_home_state, astrocde) /* video hardware */ @@ -231,14 +196,21 @@ void astrocde_home_state::astrocde(machine_config &config) PALETTE(config, "palette", FUNC(astrocde_home_state::astrocade_palette), 512); + /* control ports */ + for (uint32_t port = 0; port < 4; port++) + { + ASTROCADE_CTRL_PORT(config, m_ctrl[port], astrocade_controllers, port == 0 ? "joy" : nullptr); + m_ctrl[port]->ltpen_handler().set(FUNC(astrocde_home_state::lightpen_trigger_w)); + } + /* sound hardware */ SPEAKER(config, "mono").front_center(); ASTROCADE_IO(config, m_astrocade_sound1, ASTROCADE_CLOCK/4); m_astrocade_sound1->si_cb().set(FUNC(astrocde_home_state::inputs_r)); - m_astrocade_sound1->set_pot_tag<0>("P1_KNOB"); - m_astrocade_sound1->set_pot_tag<1>("P2_KNOB"); - m_astrocade_sound1->set_pot_tag<2>("P3_KNOB"); - m_astrocade_sound1->set_pot_tag<3>("P4_KNOB"); + m_astrocade_sound1->pot_cb<0>().set(m_ctrl[0], FUNC(astrocade_ctrl_port_device::read_knob)); + m_astrocade_sound1->pot_cb<1>().set(m_ctrl[1], FUNC(astrocade_ctrl_port_device::read_knob)); + m_astrocade_sound1->pot_cb<2>().set(m_ctrl[2], FUNC(astrocade_ctrl_port_device::read_knob)); + m_astrocade_sound1->pot_cb<3>().set(m_ctrl[3], FUNC(astrocade_ctrl_port_device::read_knob)); m_astrocade_sound1->add_route(ALL_OUTPUTS, "mono", 1.0); /* expansion port */ @@ -247,6 +219,10 @@ void astrocde_home_state::astrocde(machine_config &config) /* cartridge */ ASTROCADE_CART_SLOT(config, m_cart, astrocade_cart, nullptr); + /* cartridge */ + ASTROCADE_ACCESSORY_PORT(config, m_accessory, m_screen, astrocade_accessories, nullptr); + m_accessory->ltpen_handler().set(FUNC(astrocde_home_state::lightpen_trigger_w)); + /* Software lists */ SOFTWARE_LIST(config, "cart_list").set_original("astrocde"); } @@ -281,7 +257,7 @@ ROM_END void astrocde_state::init_astrocde() { - m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS; + m_video_config = AC_SOUND_PRESENT; } MACHINE_START_MEMBER(astrocde_home_state, astrocde) @@ -292,7 +268,10 @@ MACHINE_START_MEMBER(astrocde_home_state, astrocde) // if no RAM is mounted and the handlers are installed, the system starts with garbage on screen and a RESET is necessary // thus, install RAM only if an expansion is mounted if (m_exp->get_card_mounted()) + { m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x5000, 0xffff, read8_delegate(FUNC(astrocade_exp_device::read),(astrocade_exp_device*)m_exp), write8_delegate(FUNC(astrocade_exp_device::write),(astrocade_exp_device*)m_exp)); + m_maincpu->space(AS_IO).install_readwrite_handler(0x0080, 0x00ff, 0x0000, 0x0000, 0xff00, read8_delegate(FUNC(astrocade_exp_device::read_io),(astrocade_exp_device*)m_exp), write8_delegate(FUNC(astrocade_exp_device::write_io),(astrocade_exp_device*)m_exp)); + } } /************************************* |