Previous 15994 Revisions Next

r14223 Friday 27th January, 2012 at 07:42:15 UTC by Curt Coder
[VIC20] Emulated the VIC-1110 8K RAM Expansion cartridge. [Curt Coder]
[src/mess]mess.mak
[src/mess/drivers]vic20.c
[src/mess/includes]vic20.h
[src/mess/machine]cbmipt.c cbmipt.h vic1110.c* vic1110.h* vic1112.h

src/mess/machine/cbmipt.c
r14222r14223
11241124   SLOT_INTERFACE("softbox", SOFTBOX)
11251125SLOT_INTERFACE_END
11261126
1127SLOT_INTERFACE_START( vic20_expansion_cards )
1128   SLOT_INTERFACE("8k", VIC1110)
1129   SLOT_INTERFACE("ieee488", VIC1112)
1130SLOT_INTERFACE_END
1131
11271132SLOT_INTERFACE_START( c64_expansion_cards )
11281133   SLOT_INTERFACE("standard", C64_STD)
11291134   SLOT_INTERFACE("xl80", C64_XL80)
src/mess/machine/cbmipt.h
r14222r14223
1313#include "machine/interpod.h"
1414#include "machine/serialbox.h"
1515#include "machine/softbox.h"
16#include "machine/vic1110.h"
17#include "machine/vic1112.h"
1618
1719
1820#define MCFG_CBM_IEC_ADD(_intf, _default_drive) \
r14222r14223
7981
8082extern const slot_interface slot_interface_cbm_iec_devices[];
8183extern const slot_interface slot_interface_cbm_ieee488_devices[];
84extern const slot_interface slot_interface_vic20_expansion_cards[];
8285extern const slot_interface slot_interface_c64_expansion_cards[];
8386
8487
src/mess/machine/vic1110.c
r0r14223
1/**********************************************************************
2
3    Commodore VIC-1110 8K RAM Expansion Cartridge emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "vic1110.h"
11
12
13//**************************************************************************
14//  MACROS / CONSTANTS
15//**************************************************************************
16
17enum
18{
19   BLK1 = 0x07,
20   BLK2 = 0x0b,
21   BLK3 = 0x0d,
22   BLK5 = 0x0e
23};
24
25
26
27//**************************************************************************
28//  DEVICE DEFINITIONS
29//**************************************************************************
30
31const device_type VIC1110 = &device_creator<vic1110_device>;
32
33
34
35//-------------------------------------------------
36//  INPUT_PORTS( vic1110 )
37//-------------------------------------------------
38
39INPUT_PORTS_START( vic1110 )
40   PORT_START("SW")
41   PORT_DIPNAME( 0x0f, BLK1, "Memory Location" ) PORT_DIPLOCATION("SW:1,2,3,4")
42   PORT_DIPSETTING(    BLK1, "$2000-$3FFF" )
43   PORT_DIPSETTING(    BLK2, "$4000-$5FFF" )
44   PORT_DIPSETTING(    BLK3, "$6000-$7FFF" )
45   PORT_DIPSETTING(    BLK5, "$A000-B3FFF" )
46INPUT_PORTS_END
47
48   
49//-------------------------------------------------
50//  input_ports - device-specific input ports
51//-------------------------------------------------
52
53ioport_constructor vic1110_device::device_input_ports() const
54{
55   return INPUT_PORTS_NAME( vic1110 );
56}
57
58
59
60
61//**************************************************************************
62//  LIVE DEVICE
63//**************************************************************************
64
65//-------------------------------------------------
66//  vic1110_device - constructor
67//-------------------------------------------------
68
69vic1110_device::vic1110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
70    : device_t(mconfig, VIC1110, "VIC1110", tag, owner, clock),
71     device_vic20_expansion_card_interface(mconfig, *this)
72{
73}
74
75
76//-------------------------------------------------
77//  device_start - device-specific startup
78//-------------------------------------------------
79
80void vic1110_device::device_start()
81{
82   // allocate memory
83   m_ram = auto_alloc_array(machine(), UINT8, 0x2000);
84}
85
86
87//-------------------------------------------------
88//  vic20_blk1_r - block 1 read
89//-------------------------------------------------
90
91UINT8 vic1110_device::vic20_blk1_r(address_space &space, offs_t offset)
92{
93   UINT8 data = 0;
94   
95   if (input_port_read(*this, "SW") == BLK1)
96   {
97      data = m_ram[offset & 0x1fff];
98   }
99   
100   return data;
101}
102
103
104//-------------------------------------------------
105//  vic20_blk1_w - block 1 write
106//-------------------------------------------------
107
108void vic1110_device::vic20_blk1_w(address_space &space, offs_t offset, UINT8 data)
109{
110   if (input_port_read(*this, "SW") == BLK1)
111   {
112      m_ram[offset & 0x1fff] = data;
113   }
114}
115
116
117//-------------------------------------------------
118//  vic20_blk2_r - block 2 read
119//-------------------------------------------------
120
121UINT8 vic1110_device::vic20_blk2_r(address_space &space, offs_t offset)
122{
123   UINT8 data = 0;
124   
125   if (input_port_read(*this, "SW") == BLK2)
126   {
127      data = m_ram[offset & 0x1fff];
128   }
129   
130   return data;
131}
132
133
134//-------------------------------------------------
135//  vic20_blk2_w - block 2 write
136//-------------------------------------------------
137
138void vic1110_device::vic20_blk2_w(address_space &space, offs_t offset, UINT8 data)
139{
140   if (input_port_read(*this, "SW") == BLK2)
141   {
142      m_ram[offset & 0x1fff] = data;
143   }
144}
145
146
147//-------------------------------------------------
148//  vic20_blk3_r - block 3 read
149//-------------------------------------------------
150
151UINT8 vic1110_device::vic20_blk3_r(address_space &space, offs_t offset)
152{
153   UINT8 data = 0;
154   
155   if (input_port_read(*this, "SW") == BLK3)
156   {
157      data = m_ram[offset & 0x1fff];
158   }
159   
160   return data;
161}
162
163
164//-------------------------------------------------
165//  vic20_blk3_w - block 3 write
166//-------------------------------------------------
167
168void vic1110_device::vic20_blk3_w(address_space &space, offs_t offset, UINT8 data)
169{
170   if (input_port_read(*this, "SW") == BLK3)
171   {
172      m_ram[offset & 0x1fff] = data;
173   }
174}
175
176
177//-------------------------------------------------
178//  vic20_blk5_r - block 5 read
179//-------------------------------------------------
180
181UINT8 vic1110_device::vic20_blk5_r(address_space &space, offs_t offset)
182{
183   UINT8 data = 0;
184   
185   if (input_port_read(*this, "SW") == BLK5)
186   {
187      data = m_ram[offset & 0x1fff];
188   }
189   
190   return data;
191}
192
193
194//-------------------------------------------------
195//  vic20_blk5_w - block 5 write
196//-------------------------------------------------
197
198void vic1110_device::vic20_blk5_w(address_space &space, offs_t offset, UINT8 data)
199{
200   if (input_port_read(*this, "SW") == BLK5)
201   {
202      m_ram[offset & 0x1fff] = data;
203   }
204}
src/mess/machine/vic1110.h
r0r14223
1/**********************************************************************
2
3    Commodore VIC-1110 8K RAM Expansion 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 __VIC1110__
13#define __VIC1110__
14
15#define ADDRESS_MAP_MODERN
16
17#include "emu.h"
18#include "machine/vic20exp.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> vic1110_device
27
28class vic1110_device :  public device_t,
29                  public device_vic20_expansion_card_interface
30{
31public:
32    // construction/destruction
33    vic1110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual ioport_constructor device_input_ports() const;
37   
38protected:
39    // device-level overrides
40    virtual void device_start();
41   
42   // device_vic20_expansion_card_interface overrides
43   virtual UINT8 vic20_blk1_r(address_space &space, offs_t offset);
44   virtual void vic20_blk1_w(address_space &space, offs_t offset, UINT8 data);
45   virtual UINT8 vic20_blk2_r(address_space &space, offs_t offset);
46   virtual void vic20_blk2_w(address_space &space, offs_t offset, UINT8 data);
47   virtual UINT8 vic20_blk3_r(address_space &space, offs_t offset);
48   virtual void vic20_blk3_w(address_space &space, offs_t offset, UINT8 data);
49   virtual UINT8 vic20_blk5_r(address_space &space, offs_t offset);
50   virtual void vic20_blk5_w(address_space &space, offs_t offset, UINT8 data);
51
52private:
53   UINT8 *m_ram;
54};
55
56
57// device type definition
58extern const device_type VIC1110;
59
60
61
62#endif
src/mess/machine/vic1112.h
r14222r14223
2626
2727
2828//**************************************************************************
29//  MACROS / CONSTANTS
30//**************************************************************************
31
32#define VIC1112_TAG   "vic1112"
33
34
35
36//**************************************************************************
37//  INTERFACE CONFIGURATION MACROS
38//**************************************************************************
39
40#define MCFG_VIC1112_ADD() \
41    MCFG_DEVICE_ADD(VIC1112_TAG, VIC1112, 0)
42
43
44
45//**************************************************************************
4629//  TYPE DEFINITIONS
4730//**************************************************************************
4831
src/mess/includes/vic20.h
r14222r14223
1616#include "machine/ieee488.h"
1717#include "machine/ram.h"
1818#include "machine/vic20exp.h"
19#include "machine/vic1112.h"
2019#include "sound/dac.h"
2120#include "sound/mos6560.h"
2221
r14222r14223
4039        m_vic(*this, M6560_TAG),
4140        m_iec(*this, CBM_IEC_TAG),
4241        m_cassette(*this, CASSETTE_TAG),
43        m_ram(*this, RAM_TAG)
42        m_ram(*this, RAM_TAG),
43        m_cassette_timer(*this, TIMER_C1530_TAG)
4444   { }
4545
4646   required_device<cpu_device> m_maincpu;
r14222r14223
5050   required_device<cbm_iec_device> m_iec;
5151   required_device<cassette_image_device> m_cassette;
5252   required_device<ram_device> m_ram;
53   required_device<timer_device> m_cassette_timer;
5354   
5455   virtual void machine_start();
5556
r14222r14223
6667
6768   // keyboard state
6869   int m_key_col;
69
70   // timers
71   timer_device *m_cassette_timer;
7270};
7371
7472#endif
src/mess/mess.mak
r14222r14223
753753   $(MESS_MACHINE)/interpod.o   \
754754   $(MESS_DRIVERS)/vic20.o      \
755755   $(MESS_MACHINE)/vic20exp.o   \
756   $(MESS_MACHINE)/vic1110.o   \
756757   $(MESS_MACHINE)/vic1112.o   \
757758   $(MESS_AUDIO)/ted7360.o      \
758759   $(MESS_AUDIO)/t6721.o      \
src/mess/drivers/vic20.c
r14222r14223
5757    TODO:
5858
5959   - load cartridges with expansion port device
60   - implement RAM expansion with expansion port device
6160    - C1540 is not working currently
6261    - access violation in mos6560.c
6362        * In the Chips (Japan, USA).60
r14222r14223
683682//  VIC20_EXPANSION_INTERFACE( expansion_intf )
684683//-------------------------------------------------
685684
686static SLOT_INTERFACE_START( vic20_expansion_cards )
687   SLOT_INTERFACE("ieee488", VIC1112)
688SLOT_INTERFACE_END
689
690685static VIC20_EXPANSION_INTERFACE( expansion_intf )
691686{
692687   DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0),
r14222r14223
695690};
696691
697692
693
698694//**************************************************************************
699695//  MACHINE INITIALIZATION
700696//**************************************************************************
r14222r14223
705701
706702void vic20_state::machine_start()
707703{
708   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
709
710   // find devices
711   m_cassette_timer = machine().device<timer_device>(TIMER_C1530_TAG);
712
713   // memory expansions
714   switch (m_ram->size())
715   {
716   case 32*1024:
717      program->install_ram(0x6000, 0x7fff, NULL);
718      // fall through
719   case 24*1024:
720      program->install_ram(0x4000, 0x5fff, NULL);
721      // fall through
722   case 16*1024:
723      program->install_ram(0x2000, 0x3fff, NULL);
724      // fall through
725   case 8*1024:
726      program->install_ram(0x0400, 0x0fff, NULL);
727   }
728
729704   // register for state saving
730705   save_item(NAME(m_key_col));
731706}
r14222r14223
767742   // internal ram
768743   MCFG_RAM_ADD(RAM_TAG)
769744   MCFG_RAM_DEFAULT_SIZE("5K")
770   MCFG_RAM_EXTRA_OPTIONS("8K,16K,24K,32K")
771745MACHINE_CONFIG_END
772746
773747

Previous 15994 Revisions Next


© 1998-2018 The MESS Team