trunk/src/mess/machine/c64_reu.c
| r0 | r18453 | |
| 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 | |
| 26 | const device_type C64_REU1700 = &device_creator<c64_reu1700_cartridge_device>; |
| 27 | const device_type C64_REU1750 = &device_creator<c64_reu1750_cartridge_device>; |
| 28 | const device_type C64_REU1764 = &device_creator<c64_reu1764_cartridge_device>; |
| 29 | |
| 30 | |
| 31 | //------------------------------------------------- |
| 32 | // ROM( c64_reu ) |
| 33 | //------------------------------------------------- |
| 34 | |
| 35 | ROM_START( c64_reu ) |
| 36 | ROM_REGION( 0x8000, "roml", 0 ) |
| 37 | ROM_CART_LOAD( "rom", 0x0000, 0x8000, ROM_MIRROR ) |
| 38 | ROM_END |
| 39 | |
| 40 | |
| 41 | //------------------------------------------------- |
| 42 | // rom_region - device-specific ROM region |
| 43 | //------------------------------------------------- |
| 44 | |
| 45 | const 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 | |
| 55 | static MACHINE_CONFIG_FRAGMENT( c64_reu ) |
| 56 | MCFG_MOS8726_ADD(MOS8726R1_TAG) |
| 57 | |
| 58 | MCFG_CARTSLOT_ADD("rom") |
| 59 | MCFG_CARTSLOT_EXTENSION_LIST("rom,bin") |
| 60 | MACHINE_CONFIG_END |
| 61 | |
| 62 | |
| 63 | //------------------------------------------------- |
| 64 | // machine_config_additions - device-specific |
| 65 | // machine configurations |
| 66 | //------------------------------------------------- |
| 67 | |
| 68 | machine_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 | |
| 83 | c64_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 | |
| 93 | c64_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 | |
| 96 | c64_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 | |
| 99 | c64_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 | |
| 107 | void 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 | |
| 125 | void c64_reu_cartridge_device::device_reset() |
| 126 | { |
| 127 | m_dmac->reset(); |
| 128 | } |
| 129 | |
| 130 | |
| 131 | //------------------------------------------------- |
| 132 | // c64_cd_r - cartridge data read |
| 133 | //------------------------------------------------- |
| 134 | |
| 135 | UINT8 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 | |
| 154 | void 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
| r0 | r18453 | |
| 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 | |
| 29 | class c64_reu_cartridge_device : public device_t, |
| 30 | public device_c64_expansion_card_interface |
| 31 | { |
| 32 | public: |
| 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 | |
| 40 | protected: |
| 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 | |
| 67 | class c64_reu1700_cartridge_device : public c64_reu_cartridge_device |
| 68 | { |
| 69 | public: |
| 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 | |
| 77 | class c64_reu1750_cartridge_device : public c64_reu_cartridge_device |
| 78 | { |
| 79 | public: |
| 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 | |
| 86 | class c64_reu1764_cartridge_device : public c64_reu_cartridge_device |
| 87 | { |
| 88 | public: |
| 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 |
| 95 | extern const device_type C64_REU1700; |
| 96 | extern const device_type C64_REU1750; |
| 97 | extern const device_type C64_REU1764; |
| 98 | |
| 99 | |
| 100 | |
| 101 | #endif |
trunk/src/mess/machine/cbmipt.c
| r18452 | r18453 | |
| 1127 | 1127 | SLOT_INTERFACE("georam", C64_GEORAM) |
| 1128 | 1128 | SLOT_INTERFACE("ide64", C64_IDE64) |
| 1129 | 1129 | SLOT_INTERFACE("neoram", C64_NEORAM) |
| 1130 | SLOT_INTERFACE("reu1700", C64_REU1700) |
| 1131 | SLOT_INTERFACE("reu1750", C64_REU1750) |
| 1132 | SLOT_INTERFACE("reu1764", C64_REU1764) |
| 1130 | 1133 | SLOT_INTERFACE("sfxse", C64_SFX_SOUND_EXPANDER) |
| 1131 | 1134 | |
| 1132 | 1135 | // the following need ROMs from the software list |
| 1133 | 1136 | SLOT_INTERFACE_INTERNAL("standard", C64_STD) |
| 1134 | 1137 | SLOT_INTERFACE_INTERNAL("comal80", C64_COMAL80) |
| 1138 | SLOT_INTERFACE_INTERNAL("c128_comal80", C128_COMAL80) |
| 1135 | 1139 | SLOT_INTERFACE_INTERNAL("cs64", C64_CURRAH_SPEECH) |
| 1136 | 1140 | SLOT_INTERFACE_INTERNAL("dela_ep256", C64_DELA_EP256) |
| 1137 | 1141 | SLOT_INTERFACE_INTERNAL("ep64", C64_DELA_EP64) |
| r18452 | r18453 | |
| 1182 | 1186 | SLOT_INTERFACE("geocable", C64_GEOCABLE) |
| 1183 | 1187 | SLOT_INTERFACE_END |
| 1184 | 1188 | |
| 1185 | | SLOT_INTERFACE_START( c128_expansion_cards ) |
| 1186 | | // the following need ROMs from the software list |
| 1187 | | SLOT_INTERFACE_INTERNAL("c128_comal80", C128_COMAL80) |
| 1188 | | SLOT_INTERFACE_END |
| 1189 | | |
| 1190 | 1189 | SLOT_INTERFACE_START( plus4_datassette_devices ) |
| 1191 | 1190 | SLOT_INTERFACE("c1531", C1531) |
| 1192 | 1191 | SLOT_INTERFACE("diag264", DIAG264_CASSETTE_LOOPBACK) |
trunk/src/mess/machine/mos8726.c
| r0 | r18453 | |
| 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 | |
| 32 | const device_type MOS8726 = &device_creator<mos8726_device>; |
| 33 | |
| 34 | |
| 35 | |
| 36 | //************************************************************************** |
| 37 | // LIVE DEVICE |
| 38 | //************************************************************************** |
| 39 | |
| 40 | //------------------------------------------------- |
| 41 | // mos8726_device - constructor |
| 42 | //------------------------------------------------- |
| 43 | |
| 44 | mos8726_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 | |
| 56 | void 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 | |
| 70 | void mos8726_device::device_reset() |
| 71 | { |
| 72 | } |
| 73 | |
| 74 | |
| 75 | //------------------------------------------------- |
| 76 | // execute_run - |
| 77 | //------------------------------------------------- |
| 78 | |
| 79 | void mos8726_device::execute_run() |
| 80 | { |
| 81 | do |
| 82 | { |
| 83 | m_icount--; |
| 84 | } while (m_icount > 0); |
| 85 | } |
| 86 | |
| 87 | |
| 88 | //------------------------------------------------- |
| 89 | // read - |
| 90 | //------------------------------------------------- |
| 91 | |
| 92 | READ8_MEMBER( mos8726_device::read ) |
| 93 | { |
| 94 | UINT8 data = 0; |
| 95 | |
| 96 | return data; |
| 97 | } |
| 98 | |
| 99 | |
| 100 | //------------------------------------------------- |
| 101 | // write - |
| 102 | //------------------------------------------------- |
| 103 | |
| 104 | WRITE8_MEMBER( mos8726_device::write ) |
| 105 | { |
| 106 | } |
| 107 | |
| 108 | |
| 109 | //------------------------------------------------- |
| 110 | // bs_w - bank select write |
| 111 | //------------------------------------------------- |
| 112 | |
| 113 | WRITE_LINE_MEMBER( mos8726_device::bs_w ) |
| 114 | { |
| 115 | m_bs = state; |
| 116 | } |
| 117 | |
| 118 | |
| 119 | //------------------------------------------------- |
| 120 | // romsel_r - ROM select read |
| 121 | //------------------------------------------------- |
| 122 | |
| 123 | int mos8726_device::romsel_r(int roml, int romh) |
| 124 | { |
| 125 | return roml && romh; |
| 126 | } |
trunk/src/mess/machine/mos8726.h
| r0 | r18453 | |
| 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 | |
| 69 | class mos8726_device : public device_t, |
| 70 | public device_execute_interface |
| 71 | { |
| 72 | public: |
| 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 | |
| 83 | protected: |
| 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 |
| 95 | extern const device_type MOS8726; |
| 96 | |
| 97 | |
| 98 | |
| 99 | #endif |