Previous 199869 Revisions Next

r20776 Wednesday 6th February, 2013 at 19:19:17 UTC by Curt Coder
(MESS) c64: Added CMD Turbo232 cartridge emulation. [Curt Coder]
[hash]c64_flop.xml
[src/mess]mess.mak
[src/mess/machine]c64_turbo232.c* c64_turbo232.h* cbmipt.c cbmipt.h

trunk/hash/c64_flop.xml
r20775r20776
873873      </part>
874874   </software>
875875
876   <software name="turbo232">
877      <description>CMD Turbo232</description>
878      <year>1997</year>
879      <publisher>CMD</publisher>
880
881      <part name="flop1" interface="floppy_5_25">
882         <dataarea name="flop" size="174848">
883            <rom name="turbo232.d64" size="174848" crc="48874d98" sha1="28b6d25bb0b62df81c4b17d9205c059c6736e817" offset="0" />
884         </dataarea>
885      </part>
886   </software>
887
876888</softwarelist>
trunk/src/mess/machine/cbmipt.c
r20775r20776
11291129   SLOT_INTERFACE("sfxse", C64_SFX_SOUND_EXPANDER)
11301130   SLOT_INTERFACE("supercpu", C64_SUPERCPU)
11311131   SLOT_INTERFACE("swiftlink", C64_SWIFTLINK)
1132   SLOT_INTERFACE("turbo232", C64_TURBO232)
11321133
11331134   // the following need ROMs from the software list
11341135   SLOT_INTERFACE_INTERNAL("standard", C64_STD)
trunk/src/mess/machine/cbmipt.h
r20775r20776
5858#include "machine/c64_swiftlink.h"
5959#include "machine/c64_system3.h"
6060#include "machine/c64_tdos.h"
61#include "machine/c64_turbo232.h"
6162#include "machine/c64_vw64.h"
6263#include "machine/c64_warp_speed.h"
6364#include "machine/c64_westermann.h"
trunk/src/mess/machine/c64_turbo232.c
r0r20776
1/**********************************************************************
2
3    CMD Turbo232 RS-232 cartridge emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10/*
11
12   http://ar.c64.org/wiki/Turbo232_Programming.txt
13
14*/
15
16#include "c64_turbo232.h"
17
18
19
20//**************************************************************************
21//  MACROS/CONSTANTS
22//**************************************************************************
23
24#define MOS6551_TAG       "mos6551"
25
26
27
28//**************************************************************************
29//  DEVICE DEFINITIONS
30//**************************************************************************
31
32const device_type C64_TURBO232 = &device_creator<c64_turbo232_cartridge_device>;
33
34
35//-------------------------------------------------
36//  MACHINE_CONFIG_FRAGMENT( c64_turbo232 )
37//-------------------------------------------------
38
39static MACHINE_CONFIG_FRAGMENT( c64_turbo232 )
40   MCFG_MOS6551_ADD(MOS6551_TAG, XTAL_3_6864MHz, DEVWRITELINE(DEVICE_SELF, c64_turbo232_cartridge_device, acia_irq_w))
41MACHINE_CONFIG_END
42
43
44//-------------------------------------------------
45//  machine_config_additions - device-specific
46//  machine configurations
47//-------------------------------------------------
48
49machine_config_constructor c64_turbo232_cartridge_device::device_mconfig_additions() const
50{
51   return MACHINE_CONFIG_NAME( c64_turbo232 );
52}
53
54
55//-------------------------------------------------
56//  INPUT_PORTS( c64_turbo232 )
57//-------------------------------------------------
58
59static INPUT_PORTS_START( c64_turbo232 )
60   PORT_START("CS")
61   PORT_DIPNAME( 0x03, 0x01, "Base Address" )
62   PORT_DIPSETTING(    0x00, "$D700 (C128)" )
63   PORT_DIPSETTING(    0x01, "$DE00" )
64   PORT_DIPSETTING(    0x02, "$DF00" )
65
66   PORT_START("IRQ")
67   PORT_DIPNAME( 0x01, 0x01, "Interrupt" )
68   PORT_DIPSETTING(    0x00, "IRQ (C128)" )
69   PORT_DIPSETTING(    0x01, "NMI" )
70INPUT_PORTS_END
71
72
73//-------------------------------------------------
74//  input_ports - device-specific input ports
75//-------------------------------------------------
76
77ioport_constructor c64_turbo232_cartridge_device::device_input_ports() const
78{
79   return INPUT_PORTS_NAME( c64_turbo232 );
80}
81
82
83
84//**************************************************************************
85//  LIVE DEVICE
86//**************************************************************************
87
88//-------------------------------------------------
89//  c64_turbo232_cartridge_device - constructor
90//-------------------------------------------------
91
92c64_turbo232_cartridge_device::c64_turbo232_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
93   device_t(mconfig, C64_TURBO232, "C64 Turbo232 cartridge", tag, owner, clock),
94   device_c64_expansion_card_interface(mconfig, *this),
95   m_acia(*this, MOS6551_TAG),
96   m_io_cs(*this, "CS"),
97   m_io_irq(*this, "IRQ")
98{
99}
100
101
102//-------------------------------------------------
103//  device_start - device-specific startup
104//-------------------------------------------------
105
106void c64_turbo232_cartridge_device::device_start()
107{
108}
109
110
111//-------------------------------------------------
112//  device_reset - device-specific reset
113//-------------------------------------------------
114
115void c64_turbo232_cartridge_device::device_reset()
116{
117   m_acia->reset();
118
119   m_cs = m_io_cs->read();
120   m_irq = m_io_irq->read();
121
122   m_es = 0;
123}
124
125
126//-------------------------------------------------
127//  c64_cd_r - cartridge data read
128//-------------------------------------------------
129
130UINT8 c64_turbo232_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)
131{
132   if (((m_cs == DE00) && !io1) || ((m_cs == DF00) && !io2) ||
133      ((m_cs == D700) && ((offset & 0xff00) == 0xd700)))
134   {
135      if (!(offset & 0xe0))
136      {
137         switch (offset & 0x07)
138         {
139         case 0: case 1: case 2: case 3:
140            data = m_acia->read(space, offset & 0x03);
141            break;
142
143         case 7:
144            data = m_es;
145         }
146      }
147   }
148
149   return data;
150}
151
152
153//-------------------------------------------------
154//  c64_cd_w - cartridge data write
155//-------------------------------------------------
156
157void c64_turbo232_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)
158{
159   if (((m_cs == DE00) && !io1) || ((m_cs == DF00) && !io2) ||
160      ((m_cs == D700) && ((offset & 0xff00) == 0xd700)))
161   {
162      if (!(offset & 0xe0))
163      {
164         switch (offset & 0x07)
165         {
166         case 0: case 1: case 2:
167            m_acia->write(space, offset & 0x03, data);
168            break;
169
170         case 3:
171            m_acia->write(space, offset & 0x03, data);
172
173            if (data & 0x0f)
174               m_es &= ~ES_M;
175            else
176               m_es |= ES_M;
177            break;
178
179         case 7:
180            if (m_es & ES_M)
181            {
182               data = m_es;
183
184               switch (m_es & ES_S_MASK)
185               {
186               case ES_S_230400: m_acia->set_rxc(230400*16); break;
187               case ES_S_115200: m_acia->set_rxc(115200*16); break;
188               case ES_S_57600: m_acia->set_rxc(57600*16); break;
189               case ES_S_UNDEFINED: m_acia->set_rxc(0); break;
190               }
191            }
192         }
193      }
194   }
195}
196
197
198//-------------------------------------------------
199//  acia_irq_w -
200//-------------------------------------------------
201
202WRITE_LINE_MEMBER( c64_turbo232_cartridge_device::acia_irq_w )
203{
204   switch (m_irq)
205   {
206   case IRQ: m_slot->irq_w(state); break;
207   case NMI: m_slot->nmi_w(state); break;
208   }
209}
Property changes on: trunk/src/mess/machine/c64_turbo232.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/machine/c64_turbo232.h
r0r20776
1/**********************************************************************
2
3    CMD Turbo232 RS-232 cartridge emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __TURBO232__
13#define __TURBO232__
14
15
16#include "emu.h"
17#include "machine/c64exp.h"
18#include "machine/mos6551.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> c64_turbo232_cartridge_device
27
28class c64_turbo232_cartridge_device : public device_t,
29                           public device_c64_expansion_card_interface
30{
31public:
32   // construction/destruction
33   c64_turbo232_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual machine_config_constructor device_mconfig_additions() const;
37   virtual ioport_constructor device_input_ports() const;
38
39   DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
40
41protected:
42   // device-level overrides
43   virtual void device_config_complete() { m_shortname = "c64_turbo232"; }
44   virtual void device_start();
45   virtual void device_reset();
46
47   // device_c64_expansion_card_interface overrides
48   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);
49   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);
50
51private:
52   required_device<mos6551_device> m_acia;
53   required_ioport m_io_cs;
54   required_ioport m_io_irq;
55
56   enum
57   {
58      D700 = 0,
59      DE00,
60      DF00
61   };
62
63   enum
64   {
65      IRQ = 0,
66      NMI
67   };
68
69   enum
70   {
71      ES_S_230400 = 0x00,
72      ES_S_115200 = 0x01,
73      ES_S_57600 = 0x02,
74      ES_S_UNDEFINED = 0x03,
75      ES_S_MASK = 0x03,
76      ES_M = 0x04
77   };
78
79   int m_cs;
80   int m_irq;
81
82   UINT8 m_es;
83};
84
85
86// device type definition
87extern const device_type C64_TURBO232;
88
89
90#endif
Property changes on: trunk/src/mess/machine/c64_turbo232.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mess/mess.mak
r20775r20776
889889   $(MESS_MACHINE)/c64_swiftlink.o   \
890890   $(MESS_MACHINE)/c64_system3.o   \
891891   $(MESS_MACHINE)/c64_tdos.o  \
892   $(MESS_MACHINE)/c64_turbo232.o  \
892893   $(MESS_MACHINE)/c64_vw64.o  \
893894   $(MESS_MACHINE)/c64_warp_speed.o    \
894895   $(MESS_MACHINE)/c64_westermann.o    \

Previous 199869 Revisions Next


© 1997-2024 The MAME Team