Previous 199869 Revisions Next

r20943 Monday 11th February, 2013 at 15:10:22 UTC by Curt Coder
(MESS) c64: Fixed MACH 5 cartridge C128 mode. [Curt Coder]
[src/mess/machine]c64_mach5.c c64_mach5.h

trunk/src/mess/machine/c64_mach5.c
r20942r20943
1818const device_type C64_MACH5 = &device_creator<c64_mach5_cartridge_device>;
1919
2020
21//-------------------------------------------------
22//  INPUT_PORTS( c64_mach5 )
23//-------------------------------------------------
2124
25INPUT_CHANGED_MEMBER( c64_mach5_cartridge_device::reset )
26{
27   if (!newval)
28   {
29      device_reset();
30   }
31
32   m_slot->reset_w(newval ? CLEAR_LINE : ASSERT_LINE);
33}
34
35static INPUT_PORTS_START( c64_mach5 )
36   PORT_START("S1")
37   PORT_DIPNAME( 0x01, 0x00, "Mode" )
38   PORT_DIPSETTING(    0x00, "C64" )
39   PORT_DIPSETTING(    0x01, "C128" )
40
41   PORT_START("S2")
42   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("Reset") PORT_CHANGED_MEMBER(DEVICE_SELF, c64_mach5_cartridge_device, reset, 0)
43INPUT_PORTS_END
44
45
46//-------------------------------------------------
47//  input_ports - device-specific input ports
48//-------------------------------------------------
49
50ioport_constructor c64_mach5_cartridge_device::device_input_ports() const
51{
52   return INPUT_PORTS_NAME( c64_mach5 );
53}
54
55
56
2257//**************************************************************************
2358//  LIVE DEVICE
2459//**************************************************************************
r20942r20943
2964
3065c64_mach5_cartridge_device::c64_mach5_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
3166   device_t(mconfig, C64_MACH5, "C64 MACH5 cartridge", tag, owner, clock),
32   device_c64_expansion_card_interface(mconfig, *this)
67   device_c64_expansion_card_interface(mconfig, *this),
68   m_s1(*this, "S1")
3369{
3470}
3571
r20942r20943
4985
5086void c64_mach5_cartridge_device::device_reset()
5187{
52   m_exrom = 0;
88   m_c128 = m_s1->read();
89
90   if (!m_c128)
91   {
92      m_exrom = 0;
93   }
5394}
5495
5596
r20942r20943
59100
60101UINT8 c64_mach5_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
61102{
62   if (!roml || !io1 || !io2)
103   if (!roml || !romh || !io1 || !io2)
63104   {
64105      data = m_roml[offset & 0x1fff];
65106   }
r20942r20943
74115
75116void c64_mach5_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
76117{
77   if (!io1)
118   if (!m_c128)
78119   {
79      m_exrom = 0;
120      if (!io1)
121      {
122         m_exrom = 0;
123      }
124      else if (!io2)
125      {
126         m_exrom = 1;
127      }
80128   }
81   else if (!io2)
82   {
83      m_exrom = 1;
84   }
85129}
trunk/src/mess/machine/c64_mach5.h
r20942r20943
11/**********************************************************************
22
3    Cinemaware Warp Speed cartridge emulation
3    Access Software MACH 5 cartridge emulation
44
55    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
r20942r20943
1212#ifndef __MACH5__
1313#define __MACH5__
1414
15
1615#include "emu.h"
1716#include "machine/c64exp.h"
1817
r20942r20943
3130   // construction/destruction
3231   c64_mach5_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3332
33   // optional information overrides
34   virtual ioport_constructor device_input_ports() const;
35
36   DECLARE_INPUT_CHANGED_MEMBER( reset );
37
3438protected:
3539   // device-level overrides
3640   virtual void device_config_complete() { m_shortname = "c64_mach5"; }
r20942r20943
4044   // device_c64_expansion_card_interface overrides
4145   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);
4246   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);
47
48private:
49   required_ioport m_s1;
50
51   bool m_c128;
4352};
4453
4554

Previous 199869 Revisions Next


© 1997-2024 The MAME Team