trunk/src/emu/bus/astrocde/exp.c
r0 | r241553 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:etabeta |
| 3 | /*********************************************************************************************************** |
| 4 | |
| 5 | Bally Astrocade Expansion port |
| 6 | |
| 7 | ***********************************************************************************************************/ |
| 8 | |
| 9 | |
| 10 | #include "emu.h" |
| 11 | #include "exp.h" |
| 12 | |
| 13 | //************************************************************************** |
| 14 | // GLOBAL VARIABLES |
| 15 | //************************************************************************** |
| 16 | |
| 17 | const device_type ASTROCADE_EXP_SLOT = &device_creator<astrocade_exp_device>; |
| 18 | |
| 19 | |
| 20 | device_astrocade_card_interface::device_astrocade_card_interface(const machine_config &mconfig, device_t &device) |
| 21 | : device_slot_card_interface(mconfig, device) |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | |
| 26 | device_astrocade_card_interface::~device_astrocade_card_interface() |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | |
| 31 | //************************************************************************** |
| 32 | // LIVE DEVICE |
| 33 | //************************************************************************** |
| 34 | |
| 35 | //------------------------------------------------- |
| 36 | // astrocade_exp_device - constructor |
| 37 | //------------------------------------------------- |
| 38 | astrocade_exp_device::astrocade_exp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 39 | device_t(mconfig, ASTROCADE_EXP_SLOT, "Bally Astrocade expansion", tag, owner, clock, "astrocde_exp", __FILE__), |
| 40 | device_slot_interface(mconfig, *this) |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | |
| 45 | //------------------------------------------------- |
| 46 | // astrocade_exp_device - destructor |
| 47 | //------------------------------------------------- |
| 48 | |
| 49 | astrocade_exp_device::~astrocade_exp_device() |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | //------------------------------------------------- |
| 54 | // device_start - device-specific startup |
| 55 | //------------------------------------------------- |
| 56 | |
| 57 | void astrocade_exp_device::device_start() |
| 58 | { |
| 59 | m_card = dynamic_cast<device_astrocade_card_interface *>(get_card_device()); |
| 60 | } |
| 61 | |
| 62 | /*------------------------------------------------- |
| 63 | read |
| 64 | -------------------------------------------------*/ |
| 65 | |
| 66 | READ8_MEMBER(astrocade_exp_device::read) |
| 67 | { |
| 68 | if (m_card) |
| 69 | return m_card->read(space, offset); |
| 70 | else |
| 71 | return 0xff; |
| 72 | } |
| 73 | |
| 74 | /*------------------------------------------------- |
| 75 | write |
| 76 | -------------------------------------------------*/ |
| 77 | |
| 78 | WRITE8_MEMBER(astrocade_exp_device::write) |
| 79 | { |
| 80 | if (m_card) |
| 81 | m_card->write(space, offset, data); |
| 82 | } |
trunk/src/emu/bus/astrocde/ram.c
r0 | r241553 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:etabeta |
| 3 | /*********************************************************************************************************** |
| 4 | |
| 5 | |
| 6 | Bally Astrocade RAM expansion emulation |
| 7 | |
| 8 | RAM Expansions (info below courtesy of Paul Thacker) |
| 9 | |
| 10 | Several third party RAM expansions have been made for the Astrocade. These |
| 11 | allow access to various ranges of the expansion memory ($5000 to $FFFF). |
| 12 | A RAM expansion is required to use extended BASIC programs like Blue RAM BASIC |
| 13 | and VIPERSoft BASIC. All of the expansions also have a RAM protect switch, which |
| 14 | can be flipped at any time to make the RAM act like ROM. Extended BASIC |
| 15 | programs need access to the RAM and won't work with RAM protect enabled, but |
| 16 | this can be useful with Bally and Astrocade BASIC. They also have a range switch |
| 17 | (not implemented). The default position is 6K, but it can be switched to |
| 18 | 2K. This means that the expanded memory starting at $6000 will instead be |
| 19 | mapped to the cartridge memory starting at $2000. So it would be possible to |
| 20 | load a cartridge program from tape into the expansion memory, then flip the range |
| 21 | switch and run it as a cartridge. This is useful for cartridge development. |
| 22 | |
| 23 | Blue RAM -- available in 4K, 16K, and 32K. These also use an INS8154 chip, |
| 24 | (not yet implemented) which has an additional $80 bytes of RAM mapped |
| 25 | immediately after the end of the expansion address space. This memory |
| 26 | can't be write protected. The INS8154 has I/O features needed for loading |
| 27 | tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart. |
| 28 | 4K: $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory |
| 29 | past this range) |
| 30 | 16K: $6000 to $9FFF |
| 31 | 32K: $6000 to $DFFF |
| 32 | |
| 33 | VIPER System 1 -- This is available in 16K only. It also includes a keyboard (not implemented). |
| 34 | 16K: $6000 to $9FFF |
| 35 | |
| 36 | Lil' WHITE RAM -- This is available in 32K only. Attempts to read and write |
| 37 | to memory outside of its address range ($D000 to $FFFF) are mapped to the expansion |
| 38 | memory $5000 to $7FFF. The current implementation won't allow the shadow RAM area |
| 39 | to be accessed when RAM protect is on, but there is no known software that will |
| 40 | access the upper range of the expansion RAM when RAM protect is enabled. |
| 41 | 32K: $5000 to $CFFF |
| 42 | |
| 43 | R&L 64K RAM Board -- This is a highly configurable kit. RAM can be installed in |
| 44 | 2K increments. So, the entire 44K expansion memory can be filled. It is also |
| 45 | possible to override the rest of the memory map with RAM (not implemented). |
| 46 | There are 32 switches allowing users to activate and deactivate each 2K block (not implemented). |
| 47 | RAM write protection can be implemented in three ranges through jumpers or by |
| 48 | installing switches. The ranges are $0000 to $0FFF (first 4K), $0000 to $3FFF (first 16K), |
| 49 | and $0000 to $FFFF (all 64K). The current implementation is for 44K expansion memory mapped from |
| 50 | $5000 to $FFFF, with only a single write protect covering this entire range. |
| 51 | |
| 52 | ***********************************************************************************************************/ |
| 53 | |
| 54 | |
| 55 | #include "emu.h" |
| 56 | #include "ram.h" |
| 57 | |
| 58 | |
| 59 | //------------------------------------------------- |
| 60 | // astrocade_rom_device - constructor |
| 61 | //------------------------------------------------- |
| 62 | |
| 63 | const device_type ASTROCADE_BLUERAM_4K = &device_creator<astrocade_blueram_4k_device>; |
| 64 | const device_type ASTROCADE_BLUERAM_16K = &device_creator<astrocade_blueram_16k_device>; |
| 65 | const device_type ASTROCADE_BLUERAM_32K = &device_creator<astrocade_blueram_32k_device>; |
| 66 | const device_type ASTROCADE_VIPER_SYS1 = &device_creator<astrocade_viper_sys1_device>; |
| 67 | const device_type ASTROCADE_WHITERAM = &device_creator<astrocade_whiteram_device>; |
| 68 | const device_type ASTROCADE_RL64RAM = &device_creator<astrocade_rl64ram_device>; |
| 69 | |
| 70 | |
| 71 | astrocade_blueram_4k_device::astrocade_blueram_4k_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 72 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 73 | device_astrocade_card_interface(mconfig, *this), |
| 74 | m_write_prot(*this, "RAM_PROTECT") |
| 75 | { |
| 76 | } |
| 77 | |
| 78 | astrocade_blueram_4k_device::astrocade_blueram_4k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 79 | : device_t(mconfig, ASTROCADE_BLUERAM_4K, "Bally Astrocade Blue RAM 4K", tag, owner, clock, "astrocade_br4", __FILE__), |
| 80 | device_astrocade_card_interface(mconfig, *this), |
| 81 | m_write_prot(*this, "RAM_PROTECT") |
| 82 | { |
| 83 | } |
| 84 | |
| 85 | astrocade_blueram_16k_device::astrocade_blueram_16k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 86 | : astrocade_blueram_4k_device(mconfig, ASTROCADE_BLUERAM_16K, "Bally Astrocade Blue RAM 16K", tag, owner, clock, "astrocade_br16", __FILE__) |
| 87 | { |
| 88 | } |
| 89 | |
| 90 | astrocade_blueram_32k_device::astrocade_blueram_32k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 91 | : astrocade_blueram_4k_device(mconfig, ASTROCADE_BLUERAM_32K, "Bally Astrocade Blue RAM 32K", tag, owner, clock, "astrocade_br32", __FILE__) |
| 92 | { |
| 93 | } |
| 94 | |
| 95 | astrocade_viper_sys1_device::astrocade_viper_sys1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 96 | : device_t(mconfig, ASTROCADE_VIPER_SYS1, "Bally Astrocade Viper System 1", tag, owner, clock, "astrocade_vs1", __FILE__), |
| 97 | device_astrocade_card_interface(mconfig, *this), |
| 98 | m_write_prot(*this, "RAM_PROTECT") |
| 99 | { |
| 100 | } |
| 101 | |
| 102 | astrocade_whiteram_device::astrocade_whiteram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 103 | : device_t(mconfig, ASTROCADE_WHITERAM, "Bally Astrocade Lil' White RAM 32K", tag, owner, clock, "astrocade_lwr", __FILE__), |
| 104 | device_astrocade_card_interface(mconfig, *this), |
| 105 | m_write_prot(*this, "RAM_PROTECT") |
| 106 | { |
| 107 | } |
| 108 | |
| 109 | astrocade_rl64ram_device::astrocade_rl64ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 110 | : device_t(mconfig, ASTROCADE_RL64RAM, "Bally Astrocade R&L RAM 64K", tag, owner, clock, "astrocade_rl64", __FILE__), |
| 111 | device_astrocade_card_interface(mconfig, *this), |
| 112 | m_write_prot(*this, "RAM_PROTECT") |
| 113 | { |
| 114 | } |
| 115 | |
| 116 | |
| 117 | //------------------------------------------------- |
| 118 | // RAM Write protect switch |
| 119 | //------------------------------------------------- |
| 120 | |
| 121 | static INPUT_PORTS_START( exp_switches ) |
| 122 | PORT_START("RAM_PROTECT") |
| 123 | PORT_CONFNAME( 0x01, 0x00, "Write Protect RAM") |
| 124 | PORT_CONFSETTING( 0x00, DEF_STR(Off)) |
| 125 | PORT_CONFSETTING( 0x01, DEF_STR(On)) |
| 126 | INPUT_PORTS_END |
| 127 | |
| 128 | |
| 129 | ioport_constructor astrocade_blueram_4k_device::device_input_ports() const |
| 130 | { |
| 131 | return INPUT_PORTS_NAME( exp_switches ); |
| 132 | } |
| 133 | |
| 134 | ioport_constructor astrocade_viper_sys1_device::device_input_ports() const |
| 135 | { |
| 136 | return INPUT_PORTS_NAME( exp_switches ); |
| 137 | } |
| 138 | |
| 139 | ioport_constructor astrocade_whiteram_device::device_input_ports() const |
| 140 | { |
| 141 | return INPUT_PORTS_NAME( exp_switches ); |
| 142 | } |
| 143 | |
| 144 | ioport_constructor astrocade_rl64ram_device::device_input_ports() const |
| 145 | { |
| 146 | return INPUT_PORTS_NAME( exp_switches ); |
| 147 | } |
| 148 | |
| 149 | /*------------------------------------------------- |
| 150 | specific handlers |
| 151 | -------------------------------------------------*/ |
| 152 | |
| 153 | // Blue RAM expansions have RAM starting at 0x6000, up to the RAM size |
| 154 | READ8_MEMBER(astrocade_blueram_4k_device::read) |
| 155 | { |
| 156 | if (offset >= 0x1000 && offset < 0x1000 + m_ram.bytes()) |
| 157 | return m_ram[offset - 0x1000]; |
| 158 | else |
| 159 | return 0; |
| 160 | } |
| 161 | |
| 162 | WRITE8_MEMBER(astrocade_blueram_4k_device::write) |
| 163 | { |
| 164 | if (offset >= 0x1000 && offset < 0x1000 + m_ram.bytes() && !m_write_prot->read()) |
| 165 | m_ram[offset - 0x1000] = data; |
| 166 | } |
| 167 | |
| 168 | |
| 169 | |
| 170 | // Viper System 1 expansion has RAM in 0x6000-0x9fff |
| 171 | READ8_MEMBER(astrocade_viper_sys1_device::read) |
| 172 | { |
| 173 | if (offset >= 0x1000 && offset < 0xa000) |
| 174 | return m_ram[offset - 0x1000]; |
| 175 | else |
| 176 | return 0; |
| 177 | } |
| 178 | |
| 179 | WRITE8_MEMBER(astrocade_viper_sys1_device::write) |
| 180 | { |
| 181 | if (offset >= 0x1000 && offset < 0xa000 && !m_write_prot->read()) |
| 182 | m_ram[offset - 0x1000] = data; |
| 183 | } |
| 184 | |
| 185 | |
| 186 | |
| 187 | // Lil' WHITE RAM expansion has RAM in 0x5000-0xcfff + a mirror of the first 0x3000 bytes up to 0xffff |
| 188 | READ8_MEMBER(astrocade_whiteram_device::read) |
| 189 | { |
| 190 | return m_ram[offset % 0x8000]; |
| 191 | } |
| 192 | |
| 193 | WRITE8_MEMBER(astrocade_whiteram_device::write) |
| 194 | { |
| 195 | if (!m_write_prot->read()) |
| 196 | m_ram[offset % 0x8000] = data; |
| 197 | } |
| 198 | |
| 199 | |
| 200 | |
| 201 | // R&L 64K RAM Board (44KB installed) has RAM in 0x5000-0xffff |
| 202 | READ8_MEMBER(astrocade_rl64ram_device::read) |
| 203 | { |
| 204 | return m_ram[offset]; |
| 205 | } |
| 206 | |
| 207 | WRITE8_MEMBER(astrocade_rl64ram_device::write) |
| 208 | { |
| 209 | if (!m_write_prot->read()) |
| 210 | m_ram[offset] = data; |
| 211 | } |
| 212 | |
| 213 | |
trunk/src/emu/bus/astrocde/ram.h
r0 | r241553 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:etabeta |
| 3 | #ifndef __ASTROCADE_RAM_H |
| 4 | #define __ASTROCADE_RAM_H |
| 5 | |
| 6 | #include "exp.h" |
| 7 | |
| 8 | |
| 9 | // ======================> astrocade_blueram_4k_device |
| 10 | |
| 11 | class astrocade_blueram_4k_device : public device_t, |
| 12 | public device_astrocade_card_interface |
| 13 | { |
| 14 | public: |
| 15 | // construction/destruction |
| 16 | astrocade_blueram_4k_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 17 | astrocade_blueram_4k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 18 | |
| 19 | // device-level overrides |
| 20 | virtual void device_start() { m_ram.resize(0x1000); save_item(NAME(m_ram)); } |
| 21 | virtual void device_reset() {} |
| 22 | virtual ioport_constructor device_input_ports() const; |
| 23 | |
| 24 | // reading and writing |
| 25 | virtual DECLARE_READ8_MEMBER(read); |
| 26 | virtual DECLARE_WRITE8_MEMBER(write); |
| 27 | |
| 28 | protected: |
| 29 | dynamic_buffer m_ram; |
| 30 | required_ioport m_write_prot; |
| 31 | }; |
| 32 | |
| 33 | // ======================> astrocade_blueram_16k_device |
| 34 | |
| 35 | class astrocade_blueram_16k_device : public astrocade_blueram_4k_device |
| 36 | { |
| 37 | public: |
| 38 | // construction/destruction |
| 39 | astrocade_blueram_16k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 40 | |
| 41 | virtual void device_start() { m_ram.resize(0x4000); save_item(NAME(m_ram)); } |
| 42 | }; |
| 43 | |
| 44 | // ======================> astrocade_blueram_32k_device |
| 45 | |
| 46 | class astrocade_blueram_32k_device : public astrocade_blueram_4k_device |
| 47 | { |
| 48 | public: |
| 49 | // construction/destruction |
| 50 | astrocade_blueram_32k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 51 | |
| 52 | virtual void device_start() { m_ram.resize(0x8000); save_item(NAME(m_ram)); } |
| 53 | }; |
| 54 | |
| 55 | // ======================> astrocade_viper_sys1_device |
| 56 | |
| 57 | class astrocade_viper_sys1_device : public device_t, |
| 58 | public device_astrocade_card_interface |
| 59 | { |
| 60 | public: |
| 61 | // construction/destruction |
| 62 | astrocade_viper_sys1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 63 | |
| 64 | // device-level overrides |
| 65 | virtual void device_start() { m_ram.resize(0x4000); save_item(NAME(m_ram)); } |
| 66 | virtual void device_reset() {} |
| 67 | virtual ioport_constructor device_input_ports() const; |
| 68 | |
| 69 | // reading and writing |
| 70 | virtual DECLARE_READ8_MEMBER(read); |
| 71 | virtual DECLARE_WRITE8_MEMBER(write); |
| 72 | |
| 73 | private: |
| 74 | dynamic_buffer m_ram; |
| 75 | required_ioport m_write_prot; |
| 76 | }; |
| 77 | |
| 78 | // ======================> astrocade_whiteram_device |
| 79 | |
| 80 | class astrocade_whiteram_device : public device_t, |
| 81 | public device_astrocade_card_interface |
| 82 | { |
| 83 | public: |
| 84 | // construction/destruction |
| 85 | astrocade_whiteram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 86 | |
| 87 | // device-level overrides |
| 88 | virtual void device_start() { m_ram.resize(0x8000); save_item(NAME(m_ram)); } |
| 89 | virtual void device_reset() {} |
| 90 | virtual ioport_constructor device_input_ports() const; |
| 91 | |
| 92 | // reading and writing |
| 93 | virtual DECLARE_READ8_MEMBER(read); |
| 94 | virtual DECLARE_WRITE8_MEMBER(write); |
| 95 | |
| 96 | private: |
| 97 | dynamic_buffer m_ram; |
| 98 | required_ioport m_write_prot; |
| 99 | }; |
| 100 | |
| 101 | // ======================> astrocade_rl64ram_device |
| 102 | |
| 103 | class astrocade_rl64ram_device : public device_t, |
| 104 | public device_astrocade_card_interface |
| 105 | { |
| 106 | public: |
| 107 | // construction/destruction |
| 108 | astrocade_rl64ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 109 | |
| 110 | // device-level overrides |
| 111 | virtual void device_start() { m_ram.resize(0xb000); save_item(NAME(m_ram)); } |
| 112 | virtual void device_reset() {} |
| 113 | virtual ioport_constructor device_input_ports() const; |
| 114 | |
| 115 | // reading and writing |
| 116 | virtual DECLARE_READ8_MEMBER(read); |
| 117 | virtual DECLARE_WRITE8_MEMBER(write); |
| 118 | |
| 119 | private: |
| 120 | dynamic_buffer m_ram; |
| 121 | required_ioport m_write_prot; |
| 122 | }; |
| 123 | |
| 124 | |
| 125 | |
| 126 | // device type definition |
| 127 | extern const device_type ASTROCADE_BLUERAM_4K; |
| 128 | extern const device_type ASTROCADE_BLUERAM_16K; |
| 129 | extern const device_type ASTROCADE_BLUERAM_32K; |
| 130 | extern const device_type ASTROCADE_VIPER_SYS1; |
| 131 | extern const device_type ASTROCADE_WHITERAM; |
| 132 | extern const device_type ASTROCADE_RL64RAM; |
| 133 | |
| 134 | |
| 135 | #endif |
trunk/src/mess/drivers/astrocde.c
r241552 | r241553 | |
14 | 14 | #include "sound/astrocde.h" |
15 | 15 | #include "bus/astrocde/slot.h" |
16 | 16 | #include "bus/astrocde/rom.h" |
| 17 | #include "bus/astrocde/exp.h" |
| 18 | #include "bus/astrocde/ram.h" |
17 | 19 | |
18 | 20 | class astrocde_mess_state : public astrocde_state |
19 | 21 | { |
r241552 | r241553 | |
24 | 26 | { } |
25 | 27 | |
26 | 28 | required_device<astrocade_cart_slot_device> m_cart; |
27 | | void get_ram_expansion_settings(int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end); |
28 | 29 | DECLARE_MACHINE_START(astrocde); |
29 | | DECLARE_MACHINE_RESET(astrocde); |
30 | | DECLARE_INPUT_CHANGED_MEMBER(set_write_protect); |
31 | 30 | }; |
32 | 31 | |
33 | | /************************************* |
| 32 | /********************************************************************************* |
34 | 33 | * |
35 | 34 | * Memory maps |
36 | 35 | * |
r241552 | r241553 | |
42 | 41 | * by an extended BASIC program. Bally and Astrocade BASIC can access from |
43 | 42 | * $5000 to $7FFF if available. |
44 | 43 | * |
45 | | * RAM Expansions |
46 | | * |
47 | | * Several third party RAM expansions have been made for the Astrocade. These |
48 | | * allow access to various ranges of the expansion memory ($5000 to $FFFF). |
49 | | * A RAM expansion is required to use extended BASIC programs like Blue RAM BASIC |
50 | | * and VIPERSoft BASIC. All of the expansions also have a RAM protect switch, which |
51 | | * can be flipped at any time to make the RAM act like ROM. Extended BASIC |
52 | | * programs need access to the RAM and won't work with RAM protect enabled, but |
53 | | * this can be useful with Bally and Astrocade BASIC. They also have a range switch |
54 | | * (not implemented). The default position is 6K, but it can be switched to |
55 | | * 2K. This means that the expanded memory starting at $6000 will instead be |
56 | | * mapped to the cartridge memory starting at $2000. So it would be possible to |
57 | | * load a cartridge program from tape into the expansion memory, then flip the range |
58 | | * switch and run it as a cartridge. This is useful for cartridge development. |
59 | | * |
60 | | * NOTE: If you have any trouble running cartridges with a RAM expansion installed, hit reset. |
61 | | * |
62 | | * Blue RAM -- available in 4K, 16K, and 32K. These also use an INS8154 chip, |
63 | | * (not yet implemented) which has an additional $80 bytes of RAM mapped |
64 | | * immediately after the end of the expansion address space. This memory |
65 | | * can't be write protected. The INS8154 has I/O features needed for loading |
66 | | * tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart. |
67 | | * 4K: $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory |
68 | | * past this range) |
69 | | * 16K: $6000 to $9FFF |
70 | | * 32K: $6000 to $DFFF |
71 | | * |
72 | | * VIPER System 1 -- This is available in 16K only. It also includes a keyboard (not implemented). |
73 | | * 16K: $6000 to $9FFF |
74 | | * |
75 | | * Lil' WHITE RAM -- This is available in 32K only. Attempts to read and write |
76 | | * to memory outside of its address range ($D000 to $FFFF) are mapped to the expansion |
77 | | * memory $5000 to $7FFF. The current implementation won't allow the shadow RAM area |
78 | | * to be accessed when RAM protect is on, but there is no known software that will |
79 | | * access the upper range of the expansion RAM when RAM protect is enabled. |
80 | | * 32K: $5000 to $CFFF |
81 | | * |
82 | | * R&L 64K RAM Board -- This is a highly configurable kit. RAM can be installed in |
83 | | * 2K increments. So, the entire 44K expansion memory can be filled. It is also |
84 | | * possible to override the rest of the memory map with RAM (not implemented). |
85 | | * There are 32 switches allowing users to activate and deactivate each 2K block (not implemented). |
86 | | * RAM write protection can be implemented in three ranges through jumpers or by |
87 | | * installing switches. The ranges are $0000 to $0FFF (first 4K), $0000 to $3FFF (first 16K), |
88 | | * and $0000 to $FFFF (all 64K). The current implementation is for 44K expansion memory mapped from |
89 | | * $5000 to $FFFF, with only a single write protect covering this entire range. |
90 | | * |
91 | | *************************************/ |
| 44 | *********************************************************************************/ |
92 | 45 | |
93 | 46 | static ADDRESS_MAP_START( astrocade_mem, AS_PROGRAM, 8, astrocde_mess_state ) |
94 | 47 | AM_RANGE(0x0000, 0x0fff) AM_ROM AM_WRITE(astrocade_funcgen_w) |
95 | 48 | AM_RANGE(0x1000, 0x3fff) AM_ROM /* Star Fortress writes in here?? */ |
96 | 49 | AM_RANGE(0x4000, 0x4fff) AM_RAM AM_SHARE("videoram") /* ASG */ |
| 50 | AM_RANGE(0x5000, 0xffff) AM_DEVREADWRITE("exp", astrocade_exp_device, read, write) |
97 | 51 | ADDRESS_MAP_END |
98 | 52 | |
99 | 53 | |
r241552 | r241553 | |
101 | 55 | AM_RANGE(0x00, 0x1f) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w) |
102 | 56 | ADDRESS_MAP_END |
103 | 57 | |
104 | | INPUT_CHANGED_MEMBER(astrocde_mess_state::set_write_protect) // run when RAM expansion write protect switch is changed |
105 | | { |
106 | | int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0; |
107 | | address_space &space = m_maincpu->space(AS_PROGRAM); |
108 | | UINT8 *expram = machine().device<ram_device>("ram_tag")->pointer(); |
109 | | |
110 | | get_ram_expansion_settings(ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end); // passing by reference |
111 | | |
112 | | if (ram_expansion_installed == 1) |
113 | | { |
114 | | if (write_protect_on == 0) // write protect off, so install memory normally |
115 | | { |
116 | | space.install_ram(expansion_ram_start, expansion_ram_end, expram); |
117 | | if (shadow_ram_end > expansion_ram_end) |
118 | | space.install_ram(expansion_ram_end + 1, shadow_ram_end, expram); |
119 | | } |
120 | | else // write protect on, so make memory read only |
121 | | { |
122 | | space.nop_write(expansion_ram_start, expansion_ram_end); |
123 | | } |
124 | | } |
125 | | } |
126 | | |
127 | 58 | /************************************* |
128 | 59 | * |
129 | 60 | * Input ports |
r241552 | r241553 | |
227 | 158 | |
228 | 159 | PORT_START("P4_KNOB") |
229 | 160 | PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Y) PORT_CODE_INC(KEYCODE_U) PORT_PLAYER(4) |
230 | | |
231 | | PORT_START("CFG") /* machine config */ |
232 | | PORT_DIPNAME( 0x3f, 0x00, "RAM Expansion") |
233 | | PORT_DIPSETTING( 0x00, "No RAM Expansion") |
234 | | PORT_DIPSETTING( 0x01, "16KB Viper System 1 RAM Expansion") |
235 | | PORT_DIPSETTING( 0x02, "32KB Lil' WHITE RAM Expansion") |
236 | | PORT_DIPSETTING( 0x04, "R&L 64K RAM Board (44K installed)") |
237 | | PORT_DIPSETTING( 0x08, "4KB Blue RAM Expansion") |
238 | | PORT_DIPSETTING( 0x10, "16KB Blue RAM Expansion") |
239 | | PORT_DIPSETTING( 0x20, "32KB Blue RAM Expansion") |
240 | | |
241 | | PORT_START("PROTECT") /* Write protect RAM */ |
242 | | PORT_DIPNAME( 0x01, 0x00, "Write Protect RAM") PORT_CHANGED_MEMBER(DEVICE_SELF, astrocde_mess_state, set_write_protect, 0) |
243 | | PORT_DIPSETTING( 0x00, "Write Protect Off") |
244 | | PORT_DIPSETTING( 0x01, "Write Protect On") |
245 | 161 | INPUT_PORTS_END |
246 | 162 | |
247 | 163 | |
r241552 | r241553 | |
257 | 173 | SLOT_INTERFACE_INTERNAL("rom_512k", ASTROCADE_ROM_512K) |
258 | 174 | SLOT_INTERFACE_END |
259 | 175 | |
| 176 | static SLOT_INTERFACE_START(astrocade_exp) |
| 177 | SLOT_INTERFACE("blue_ram_4k", ASTROCADE_BLUERAM_4K) |
| 178 | SLOT_INTERFACE("blue_ram_16k", ASTROCADE_BLUERAM_16K) |
| 179 | SLOT_INTERFACE("blue_ram_32k", ASTROCADE_BLUERAM_32K) |
| 180 | SLOT_INTERFACE("viper_sys1", ASTROCADE_VIPER_SYS1) |
| 181 | SLOT_INTERFACE("lil_white_ram", ASTROCADE_WHITERAM) |
| 182 | SLOT_INTERFACE("rl64_ram", ASTROCADE_RL64RAM) |
| 183 | SLOT_INTERFACE_END |
260 | 184 | |
| 185 | |
261 | 186 | static MACHINE_CONFIG_START( astrocde, astrocde_mess_state ) |
262 | 187 | /* basic machine hardware */ |
263 | 188 | MCFG_CPU_ADD("maincpu", Z80, ASTROCADE_CLOCK/4) /* 1.789 MHz */ |
r241552 | r241553 | |
265 | 190 | MCFG_CPU_IO_MAP(astrocade_io) |
266 | 191 | |
267 | 192 | MCFG_MACHINE_START_OVERRIDE(astrocde_mess_state, astrocde) |
268 | | MCFG_MACHINE_RESET_OVERRIDE(astrocde_mess_state, astrocde) |
269 | 193 | |
270 | 194 | /* video hardware */ |
271 | 195 | MCFG_SCREEN_ADD("screen", RASTER) |
r241552 | r241553 | |
281 | 205 | MCFG_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4) |
282 | 206 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
283 | 207 | |
284 | | /* optional expansion ram (installed in machine_reset)*/ |
285 | | MCFG_RAM_ADD("ram_tag") |
286 | | MCFG_RAM_DEFAULT_SIZE("32k") |
| 208 | /* expansion port */ |
| 209 | MCFG_ASTROCADE_EXPANSION_SLOT_ADD("exp", astrocade_exp, NULL) |
287 | 210 | |
288 | 211 | /* cartridge */ |
289 | 212 | MCFG_ASTROCADE_CARTRIDGE_ADD("cartslot", astrocade_cart, NULL) |
r241552 | r241553 | |
331 | 254 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x3fff, read8_delegate(FUNC(astrocade_cart_slot_device::read_rom),(astrocade_cart_slot_device*)m_cart)); |
332 | 255 | } |
333 | 256 | |
334 | | MACHINE_RESET_MEMBER(astrocde_mess_state, astrocde) |
335 | | { |
336 | | int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0; |
337 | | address_space &space = m_maincpu->space(AS_PROGRAM); |
338 | | UINT8 *expram = machine().device<ram_device>("ram_tag")->pointer(); |
339 | | space.unmap_readwrite(0x5000, 0xffff); // unmap any previously installed expansion RAM |
340 | | |
341 | | get_ram_expansion_settings(ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end); // passing by reference |
342 | | |
343 | | if (ram_expansion_installed == 1) |
344 | | { |
345 | | if (write_protect_on == 0) // write protect off, so install memory normally |
346 | | { |
347 | | space.install_ram(expansion_ram_start, expansion_ram_end, expram); |
348 | | if (shadow_ram_end > expansion_ram_end) |
349 | | space.install_ram(expansion_ram_end + 1, shadow_ram_end, expram); |
350 | | } |
351 | | else // write protect on, so make memory read only |
352 | | { |
353 | | space.nop_write(expansion_ram_start, expansion_ram_end); |
354 | | } |
355 | | } |
356 | | } |
357 | | |
358 | | void astrocde_mess_state::get_ram_expansion_settings(int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end) |
359 | | { |
360 | | if (ioport("PROTECT")->read() == 0x01) |
361 | | write_protect_on = 1; |
362 | | else |
363 | | write_protect_on = 0; |
364 | | |
365 | | ram_expansion_installed = 1; |
366 | | |
367 | | switch(ioport("CFG")->read()) // check RAM expansion configuration and set address ranges |
368 | | { |
369 | | case 0x00: // No RAM Expansion |
370 | | ram_expansion_installed = 0; |
371 | | break; |
372 | | case 0x01: // 16KB Viper System 1 RAM Expansion |
373 | | expansion_ram_start = 0x6000; |
374 | | expansion_ram_end = 0x9fff; |
375 | | shadow_ram_end = 0; |
376 | | break; |
377 | | case 0x02: // "32KB Lil' WHITE RAM Expansion |
378 | | expansion_ram_start = 0x5000; |
379 | | expansion_ram_end = 0xcfff; |
380 | | shadow_ram_end = 0xffff; |
381 | | break; |
382 | | case 0x04: // R&L 64K RAM Board (44KB installed) |
383 | | expansion_ram_start = 0x5000; |
384 | | expansion_ram_end = 0xffff; |
385 | | shadow_ram_end = 0; |
386 | | break; |
387 | | case 0x08: // 4KB Blue RAM Expansion |
388 | | expansion_ram_start = 0x6000; |
389 | | expansion_ram_end = 0x6fff; |
390 | | shadow_ram_end = 0; |
391 | | break; |
392 | | case 0x10: // 16KB Blue RAM Expansion |
393 | | expansion_ram_start = 0x6000; |
394 | | expansion_ram_end = 0x9fff; |
395 | | shadow_ram_end = 0; |
396 | | break; |
397 | | case 0x20: // 32KB Blue RAM Expansion |
398 | | expansion_ram_start = 0x6000; |
399 | | expansion_ram_end = 0xdfff; |
400 | | shadow_ram_end = 0; |
401 | | break; |
402 | | default: |
403 | | break; |
404 | | } |
405 | | } |
406 | | |
407 | | |
408 | 257 | /************************************* |
409 | 258 | * |
410 | 259 | * Driver definitions |