summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2015-08-19 21:39:45 +0300
committer Curt Coder <curtcoder@mail.com>2015-08-19 21:39:45 +0300
commit70ce9a1742b8134d1b4686469a0df81f3ccb0507 (patch)
treec4127a51970fca07c12d472d36e5407e50b7165e /src
parent42c32445f10fd69f790a12d85874a98f74229ac0 (diff)
c128: Emulated the PARTNER 128 cartridge. [Curt Coder]
Diffstat (limited to 'src')
-rw-r--r--src/emu/bus/c64/c128_partner.c56
-rw-r--r--src/emu/bus/c64/c128_partner.h4
2 files changed, 37 insertions, 23 deletions
diff --git a/src/emu/bus/c64/c128_partner.c b/src/emu/bus/c64/c128_partner.c
index 2a46b90cd3e..e9a0e922007 100644
--- a/src/emu/bus/c64/c128_partner.c
+++ b/src/emu/bus/c64/c128_partner.c
@@ -45,12 +45,15 @@ const device_type C128_PARTNER = &device_creator<partner128_t>;
WRITE_LINE_MEMBER( partner128_t::nmi_w )
{
- m_ls74_d1 = state;
+ if (state)
+ {
+ m_ls74_q1 = 1;
+ }
}
static INPUT_PORTS_START( c128_partner )
PORT_START("NMI")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Menu") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, partner128_t, nmi_w)
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Menu") PORT_CODE(KEYCODE_END) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, partner128_t, nmi_w)
INPUT_PORTS_END
@@ -80,7 +83,6 @@ partner128_t::partner128_t(const machine_config &mconfig, const char *tag, devic
m_ram(*this, "ram"),
m_ram_a12_a7(0),
m_ls74_cd(0),
- m_ls74_d1(0),
m_ls74_q1(0),
m_ls74_q2(0),
m_joyb2(0)
@@ -97,10 +99,13 @@ void partner128_t::device_start()
// allocate memory
m_ram.allocate(0x2000);
+ // simulate the 16.7ms pulse from CIA1 PB2 that would arrive thru the joystick port dongle
+ t_joyb2 = timer_alloc();
+ t_joyb2->adjust(attotime::from_msec(16), 0, attotime::from_msec(16));
+
// state saving
save_item(NAME(m_ram_a12_a7));
save_item(NAME(m_ls74_cd));
- save_item(NAME(m_ls74_d1));
save_item(NAME(m_ls74_q1));
save_item(NAME(m_ls74_q2));
save_item(NAME(m_joyb2));
@@ -124,6 +129,21 @@ void partner128_t::device_reset()
//-------------------------------------------------
+// device_timer -
+//-------------------------------------------------
+
+void partner128_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ if (m_ls74_cd)
+ {
+ m_ls74_q2 = m_ls74_q1;
+
+ nmi_w(m_ls74_q2 ? ASSERT_LINE : CLEAR_LINE);
+ }
+}
+
+
+//-------------------------------------------------
// c64_cd_r - cartridge data read
//-------------------------------------------------
@@ -140,7 +160,10 @@ UINT8 partner128_t::c64_cd_r(address_space &space, offs_t offset, UINT8 data, in
{
data = m_roml[offset & 0x3fff];
- m_ls74_q1 = m_ls74_d1;
+ if (m_ls74_cd)
+ {
+ m_ls74_q1 = 0;
+ }
}
else
{
@@ -148,9 +171,10 @@ UINT8 partner128_t::c64_cd_r(address_space &space, offs_t offset, UINT8 data, in
}
}
- if (m_ls74_q2 && ((offset & 0xff3a) == 0xff3a))
+ if (m_ls74_q2 && ((offset & 0xfffa) == 0xfffa))
{
- data = 0x21;
+ // override the 8502 NMI/IRQ vectors with 0xdede
+ data = 0xde;
}
return data;
@@ -208,29 +232,19 @@ void partner128_t::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int
//-------------------------------------------------
-// c64_game_r - GAME read
-//-------------------------------------------------
-
-int partner128_t::c64_game_r(offs_t offset, int sphi2, int ba, int rw)
-{
- return 1;
-}
-
-
-//-------------------------------------------------
// vcs_joy_w - joystick write
//-------------------------------------------------
void partner128_t::vcs_joy_w(UINT8 data)
{
- int joya2 = BIT(data, 2);
+ int joyb2 = BIT(data, 2);
- if (!m_joyb2 && joya2)
+ if (!m_joyb2 && joyb2 && m_ls74_cd)
{
m_ls74_q2 = m_ls74_q1;
nmi_w(m_ls74_q2 ? ASSERT_LINE : CLEAR_LINE);
-
- m_joyb2 = joya2;
}
+
+ m_joyb2 = joyb2;
}
diff --git a/src/emu/bus/c64/c128_partner.h b/src/emu/bus/c64/c128_partner.h
index 35b1d3ea0a4..d459af4124d 100644
--- a/src/emu/bus/c64/c128_partner.h
+++ b/src/emu/bus/c64/c128_partner.h
@@ -40,11 +40,11 @@ protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
// device_c64_expansion_card_interface overrides
virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
- virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw);
// device_vcs_control_port_interface overrides
virtual void vcs_joy_w(UINT8 data);
@@ -52,9 +52,9 @@ protected:
private:
optional_shared_ptr<UINT8> m_ram;
+ emu_timer *t_joyb2;
int m_ram_a12_a7;
int m_ls74_cd;
- int m_ls74_d1;
int m_ls74_q1;
int m_ls74_q2;
int m_joyb2;