Previous 199869 Revisions Next

r18453 Thursday 11th October, 2012 at 16:44:50 UTC by Curt Coder
(MESS) c64: Added skeleton for REU cartridge. (nw)
[src/mess]mess.mak
[src/mess/machine]c128_comal80.c c64_reu.c* c64_reu.h* cbmipt.c cbmipt.h mos8726.c* mos8726.h*

trunk/src/mess/mess.mak
r18452r18453
842842   $(MESS_MACHINE)/c64_pagefox.o   \
843843   $(MESS_MACHINE)/c64_prophet64.o   \
844844   $(MESS_MACHINE)/c64_ps64.o   \
845   $(MESS_MACHINE)/c64_reu.o   \
845846   $(MESS_MACHINE)/c64_rex.o   \
846847   $(MESS_MACHINE)/c64_rex_ep256.o   \
847848   $(MESS_MACHINE)/c64_ross.o   \
r18452r18453
914915   $(MESS_MACHINE)/64h156.o   \
915916   $(MESS_MACHINE)/petcass.o   \
916917   $(MESS_MACHINE)/mos8722.o   \
918   $(MESS_MACHINE)/mos8726.o   \
917919   $(MESS_MACHINE)/c2n.o      \
918920   $(MESS_VIDEO)/vdc8563.o      \
919921   $(MESS_VIDEO)/vic6567.o      \
trunk/src/mess/machine/c64_reu.c
r0r18453
1/**********************************************************************
2
3    Commodore 1700/1750/1764 RAM Expansion Unit emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "c64_reu.h"
11
12
13
14//**************************************************************************
15//  MACROS / CONSTANTS
16//**************************************************************************
17
18#define MOS8726R1_TAG   "u1"
19
20
21
22//**************************************************************************
23//  DEVICE DEFINITIONS
24//**************************************************************************
25
26const device_type C64_REU1700 = &device_creator<c64_reu1700_cartridge_device>;
27const device_type C64_REU1750 = &device_creator<c64_reu1750_cartridge_device>;
28const device_type C64_REU1764 = &device_creator<c64_reu1764_cartridge_device>;
29
30
31//-------------------------------------------------
32//  ROM( c64_reu )
33//-------------------------------------------------
34
35ROM_START( c64_reu )
36   ROM_REGION( 0x8000, "roml", 0 )
37   ROM_CART_LOAD( "rom", 0x0000, 0x8000, ROM_MIRROR )
38ROM_END
39
40
41//-------------------------------------------------
42//  rom_region - device-specific ROM region
43//-------------------------------------------------
44
45const rom_entry *c64_reu_cartridge_device::device_rom_region() const
46{
47   return ROM_NAME( c64_reu );
48}
49
50
51//-------------------------------------------------
52//  MACHINE_CONFIG_FRAGMENT( c64_reu )
53//-------------------------------------------------
54
55static MACHINE_CONFIG_FRAGMENT( c64_reu )
56   MCFG_MOS8726_ADD(MOS8726R1_TAG)
57
58   MCFG_CARTSLOT_ADD("rom")
59   MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
60MACHINE_CONFIG_END
61
62
63//-------------------------------------------------
64//  machine_config_additions - device-specific
65//  machine configurations
66//-------------------------------------------------
67
68machine_config_constructor c64_reu_cartridge_device::device_mconfig_additions() const
69{
70   return MACHINE_CONFIG_NAME( c64_reu );
71}
72
73
74
75//**************************************************************************
76//  LIVE DEVICE
77//**************************************************************************
78
79//-------------------------------------------------
80//  c64_reu_cartridge_device - constructor
81//-------------------------------------------------
82
83c64_reu_cartridge_device::c64_reu_cartridge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, int jp1, size_t ram_size) :
84   device_t(mconfig, type, name, tag, owner, clock),
85   device_c64_expansion_card_interface(mconfig, *this),
86   m_dmac(*this, MOS8726R1_TAG),
87   m_variant(variant),
88   m_jp1(jp1),
89   m_ram_size(ram_size)
90{
91}
92
93c64_reu1700_cartridge_device::c64_reu1700_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
94   : c64_reu_cartridge_device(mconfig, C64_REU1700, "1700 REU", tag, owner, clock, TYPE_1700, 0, 128 * 1024) { }
95
96c64_reu1750_cartridge_device::c64_reu1750_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
97   : c64_reu_cartridge_device(mconfig, C64_REU1750, "1750 REU", tag, owner, clock, TYPE_1750, 1, 256 * 1024) { }
98
99c64_reu1764_cartridge_device::c64_reu1764_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
100   : c64_reu_cartridge_device(mconfig, C64_REU1764, "1764 REU", tag, owner, clock, TYPE_1764, 1, 512 * 1024) { }
101
102
103//-------------------------------------------------
104//  device_start - device-specific startup
105//-------------------------------------------------
106
107void c64_reu_cartridge_device::device_start()
108{
109   // find memory region
110   m_roml = memregion("roml")->base();
111
112   // allocate memory
113   c64_ram_pointer(machine(), m_ram_size);
114
115   // setup DMA controller
116   m_dmac->set_unscaled_clock(m_slot->phi2());
117   m_dmac->bs_w(m_jp1);
118}
119
120
121//-------------------------------------------------
122//  device_reset - device-specific reset
123//-------------------------------------------------
124
125void c64_reu_cartridge_device::device_reset()
126{
127   m_dmac->reset();
128}
129
130
131//-------------------------------------------------
132//  c64_cd_r - cartridge data read
133//-------------------------------------------------
134
135UINT8 c64_reu_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int ba, int roml, int romh, int io1, int io2)
136{
137   if (!m_dmac->romsel_r(roml, romh))
138   {
139      data = m_roml[offset & 0x7fff];
140   }
141   else if (!io2)
142   {
143      data = m_dmac->read(space, offset);
144   }
145
146   return data;
147}
148
149
150//-------------------------------------------------
151//  c64_cd_w - cartridge data write
152//-------------------------------------------------
153
154void c64_reu_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int ba, int roml, int romh, int io1, int io2)
155{
156   if (!io2)
157   {
158      m_dmac->write(space, offset, data);
159   }
160}
trunk/src/mess/machine/c64_reu.h
r0r18453
1/**********************************************************************
2
3    Commodore 1700/1750/1764 RAM Expansion Unit 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 __REU__
13#define __REU__
14
15
16#include "emu.h"
17#include "imagedev/cartslot.h"
18#include "machine/c64exp.h"
19#include "machine/mos8726.h"
20
21
22
23//**************************************************************************
24//  TYPE DEFINITIONS
25//**************************************************************************
26
27// ======================> c64_reu_cartridge_device
28
29class c64_reu_cartridge_device : public device_t,
30                         public device_c64_expansion_card_interface
31{
32public:
33   // construction/destruction
34   c64_reu_cartridge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, int jp1, size_t ram_size);
35
36   // optional information overrides
37   virtual const rom_entry *device_rom_region() const;
38   virtual machine_config_constructor device_mconfig_additions() const;
39
40protected:
41   enum
42   {
43      TYPE_1700,
44      TYPE_1750,
45      TYPE_1764
46   };
47
48   // device-level overrides
49   virtual void device_config_complete() { m_shortname = "c64_reu"; }
50   virtual void device_start();
51   virtual void device_reset();
52
53   // device_c64_expansion_card_interface overrides
54   virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int ba, int roml, int romh, int io1, int io2);
55   virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int ba, int roml, int romh, int io1, int io2);
56
57   required_device<mos8726_device> m_dmac;
58
59   int m_variant;
60   int m_jp1;
61   size_t m_ram_size;
62};
63
64
65// ======================> c64_reu1700_cartridge_device
66
67class c64_reu1700_cartridge_device :  public c64_reu_cartridge_device
68{
69public:
70   // construction/destruction
71   c64_reu1700_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
72};
73
74
75// ======================> c64_reu1750_cartridge_device
76
77class c64_reu1750_cartridge_device :  public c64_reu_cartridge_device
78{
79public:
80   // construction/destruction
81   c64_reu1750_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
82};
83
84// ======================> c64_reu1700_cartridge_device
85
86class c64_reu1764_cartridge_device :  public c64_reu_cartridge_device
87{
88public:
89   // construction/destruction
90   c64_reu1764_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
91};
92
93
94// device type definition
95extern const device_type C64_REU1700;
96extern const device_type C64_REU1750;
97extern const device_type C64_REU1764;
98
99
100
101#endif
trunk/src/mess/machine/cbmipt.c
r18452r18453
11271127   SLOT_INTERFACE("georam", C64_GEORAM)
11281128   SLOT_INTERFACE("ide64", C64_IDE64)
11291129   SLOT_INTERFACE("neoram", C64_NEORAM)
1130   SLOT_INTERFACE("reu1700", C64_REU1700)
1131   SLOT_INTERFACE("reu1750", C64_REU1750)
1132   SLOT_INTERFACE("reu1764", C64_REU1764)
11301133   SLOT_INTERFACE("sfxse", C64_SFX_SOUND_EXPANDER)
11311134
11321135   // the following need ROMs from the software list
11331136   SLOT_INTERFACE_INTERNAL("standard", C64_STD)
11341137   SLOT_INTERFACE_INTERNAL("comal80", C64_COMAL80)
1138   SLOT_INTERFACE_INTERNAL("c128_comal80", C128_COMAL80)
11351139   SLOT_INTERFACE_INTERNAL("cs64", C64_CURRAH_SPEECH)
11361140   SLOT_INTERFACE_INTERNAL("dela_ep256", C64_DELA_EP256)
11371141   SLOT_INTERFACE_INTERNAL("ep64", C64_DELA_EP64)
r18452r18453
11821186   SLOT_INTERFACE("geocable", C64_GEOCABLE)
11831187SLOT_INTERFACE_END
11841188
1185SLOT_INTERFACE_START( c128_expansion_cards )
1186   // the following need ROMs from the software list
1187   SLOT_INTERFACE_INTERNAL("c128_comal80", C128_COMAL80)
1188SLOT_INTERFACE_END
1189
11901189SLOT_INTERFACE_START( plus4_datassette_devices )
11911190   SLOT_INTERFACE("c1531", C1531)
11921191   SLOT_INTERFACE("diag264", DIAG264_CASSETTE_LOOPBACK)
trunk/src/mess/machine/cbmipt.h
r18452r18453
4040#include "machine/c64_pagefox.h"
4141#include "machine/c64_prophet64.h"
4242#include "machine/c64_ps64.h"
43#include "machine/c64_reu.h"
4344#include "machine/c64_rex.h"
4445#include "machine/c64_rex_ep256.h"
4546#include "machine/c64_ross.h"
r18452r18453
164165SLOT_INTERFACE_EXTERN( vic10_expansion_cards );
165166SLOT_INTERFACE_EXTERN( c64_expansion_cards );
166167SLOT_INTERFACE_EXTERN( c64_user_port_cards );
167SLOT_INTERFACE_EXTERN( c128_expansion_cards );
168168SLOT_INTERFACE_EXTERN( plus4_datassette_devices );
169169SLOT_INTERFACE_EXTERN( plus4_expansion_cards );
170170SLOT_INTERFACE_EXTERN( plus4_user_port_cards );
trunk/src/mess/machine/c128_comal80.c
r18452r18453
6464   if (!romh)
6565   {
6666      offs_t addr = (m_bank << 14) | (offset & 0x3fff);
67      data = m_roml[addr];
67      data = m_romh[addr];
6868   }
6969
7070   return data;
trunk/src/mess/machine/mos8726.c
r0r18453
1/**********************************************************************
2
3    MOS 8726R1 DMA Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10/*
11
12    TODO:
13
14    - all
15
16*/
17
18#include "mos8726.h"
19
20
21
22//**************************************************************************
23//  MACROS / CONSTANTS
24//**************************************************************************
25
26
27
28//**************************************************************************
29//  DEVICE TYPE DEFINITIONS
30//**************************************************************************
31
32const device_type MOS8726 = &device_creator<mos8726_device>;
33
34
35
36//**************************************************************************
37//  LIVE DEVICE
38//**************************************************************************
39
40//-------------------------------------------------
41//  mos8726_device - constructor
42//-------------------------------------------------
43
44mos8726_device::mos8726_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
45    : device_t(mconfig, MOS8726, "MOS8726", tag, owner, clock),
46     device_execute_interface(mconfig, *this),
47     m_icount(0),
48     m_bs(1)
49{ }
50
51
52//-------------------------------------------------
53//  device_start - device-specific startup
54//-------------------------------------------------
55
56void mos8726_device::device_start()
57{
58   // set our instruction counter
59   m_icountptr = &m_icount;
60
61   // save state
62   save_item(NAME(m_bs));
63}
64
65
66//-------------------------------------------------
67//  device_reset - device-specific reset
68//-------------------------------------------------
69
70void mos8726_device::device_reset()
71{
72}
73
74
75//-------------------------------------------------
76//  execute_run -
77//-------------------------------------------------
78
79void mos8726_device::execute_run()
80{
81   do
82   {
83      m_icount--;
84   } while (m_icount > 0);
85}
86
87
88//-------------------------------------------------
89//  read -
90//-------------------------------------------------
91
92READ8_MEMBER( mos8726_device::read )
93{
94   UINT8 data = 0;
95
96   return data;
97}
98
99
100//-------------------------------------------------
101//  write -
102//-------------------------------------------------
103
104WRITE8_MEMBER( mos8726_device::write )
105{
106}
107
108
109//-------------------------------------------------
110//  bs_w - bank select write
111//-------------------------------------------------
112
113WRITE_LINE_MEMBER( mos8726_device::bs_w )
114{
115   m_bs = state;
116}
117
118
119//-------------------------------------------------
120//  romsel_r - ROM select read
121//-------------------------------------------------
122
123int mos8726_device::romsel_r(int roml, int romh)
124{
125   return roml && romh;
126}
trunk/src/mess/machine/mos8726.h
r0r18453
1/**********************************************************************
2
3    MOS 8726R1 DMA Controller emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                            _____   _____
10                /RESET   1 |*    \_/     | 64  Vcc
11                  /IRQ   2 |             | 63  BS
12                DOTCLK   3 |             | 62  CAS1
13                   R/W   4 |             | 61  CAS0
14                 1 MHz   5 |             | 60  RAS1
15                   /CS   6 |             | 59  RAS0
16                   /BA   7 |             | 58  /DWE
17                  /DMA   8 |             | 57  DD0
18                    D7   9 |             | 56  DD1
19                    D6  10 |             | 55  DD2
20                    D5  11 |             | 54  DD3
21                    D4  12 |             | 53  DD4
22                    D3  13 |             | 52  DD5
23                    D2  14 |             | 51  DD6
24                    D1  15 |   MOS8726   | 50  DD7
25                    D0  16 |  MOS8726R1  | 49  Vss
26                   Vss  17 |             | 48  MA8
27                   A15  18 |             | 47  MA7
28                   A14  19 |             | 46  MA6
29                   A13  20 |             | 45  MA5
30                   A12  21 |             | 44  MA4
31                   A11  22 |             | 43  MA3
32                   A10  23 |             | 42  MA2
33                    A9  24 |             | 41  MA1
34                    A8  25 |             | 40  MA0
35                    A7  26 |             | 39  TEST
36                    A6  27 |             | 38  Vss
37                    A5  28 |             | 37  Vcc
38                    A4  29 |             | 36  /ROMSEL
39                    A3  30 |             | 35  /ROML
40                    A2  31 |             | 34  /ROMH
41                    A1  32 |_____________| 33  A0
42
43**********************************************************************/
44
45#pragma once
46
47#ifndef __MOS8726__
48#define __MOS8726__
49
50#include "emu.h"
51
52
53
54//**************************************************************************
55//  INTERFACE CONFIGURATION MACROS
56//**************************************************************************
57
58#define MCFG_MOS8726_ADD(_tag) \
59   MCFG_DEVICE_ADD(_tag, MOS8726, 1000000) // dummy clock
60
61
62
63//**************************************************************************
64//  TYPE DEFINITIONS
65//**************************************************************************
66
67// ======================> mos8726_device
68
69class mos8726_device :  public device_t,
70                  public device_execute_interface
71{
72public:
73   // construction/destruction
74   mos8726_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
75
76   DECLARE_READ8_MEMBER( read );
77   DECLARE_WRITE8_MEMBER( write );
78
79   DECLARE_WRITE_LINE_MEMBER( bs_w );
80
81   int romsel_r(int roml, int romh);
82
83protected:
84   // device-level overrides
85   virtual void device_start();
86   virtual void device_reset();
87   virtual void execute_run();
88
89    int m_icount;
90    int m_bs;
91};
92
93
94// device type definition
95extern const device_type MOS8726;
96
97
98
99#endif

Previous 199869 Revisions Next


© 1997-2024 The MAME Team