From 28183799396f59449d82c7a1299426cd140d85f8 Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Sat, 9 Feb 2013 01:55:38 +0000 Subject: (MESS) Apple II: Support 8 meg AE RamWorks III card for IIe. [R. Belmont] --- .gitattributes | 2 + src/mess/drivers/apple2.c | 4 +- src/mess/includes/apple2.h | 4 +- src/mess/machine/a2eramworks3.c | 93 +++++++++++++++++++++++++++++++++++++++++ src/mess/machine/a2eramworks3.h | 47 +++++++++++++++++++++ src/mess/machine/ay3600.c | 32 +++++++------- src/mess/mess.mak | 1 + 7 files changed, 165 insertions(+), 18 deletions(-) create mode 100644 src/mess/machine/a2eramworks3.c create mode 100644 src/mess/machine/a2eramworks3.h diff --git a/.gitattributes b/.gitattributes index 2e017fc7f67..d4851283aa6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6721,6 +6721,8 @@ src/mess/machine/a2echoii.c svneol=native#text/plain src/mess/machine/a2echoii.h svneol=native#text/plain src/mess/machine/a2eext80col.c svneol=native#text/plain src/mess/machine/a2eext80col.h svneol=native#text/plain +src/mess/machine/a2eramworks3.c svneol=native#text/plain +src/mess/machine/a2eramworks3.h svneol=native#text/plain src/mess/machine/a2estd80col.c svneol=native#text/plain src/mess/machine/a2estd80col.h svneol=native#text/plain src/mess/machine/a2lang.c svneol=native#text/plain diff --git a/src/mess/drivers/apple2.c b/src/mess/drivers/apple2.c index 5cece56fa98..7c6c40fbce7 100644 --- a/src/mess/drivers/apple2.c +++ b/src/mess/drivers/apple2.c @@ -214,6 +214,7 @@ Apple 3.5 and Apple 5.25 drives - up to three devices #include "machine/a2midi.h" #include "machine/a2estd80col.h" #include "machine/a2eext80col.h" +#include "machine/a2eramworks3.h" /*************************************************************************** PARAMETERS @@ -639,6 +640,7 @@ SLOT_INTERFACE_END static SLOT_INTERFACE_START(apple2eaux_cards) SLOT_INTERFACE("std80", A2EAUX_STD80COL) /* Apple IIe Standard 80 Column Card */ SLOT_INTERFACE("ext80", A2EAUX_EXT80COL) /* Apple IIe Extended 80 Column Card */ + SLOT_INTERFACE("rw3", A2EAUX_RAMWORKS3) /* Applied Engineering RamWorks III */ SLOT_INTERFACE_END static MACHINE_CONFIG_START( apple2_common, apple2_state ) @@ -731,7 +733,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( tk2000, apple2_common ) MCFG_MACHINE_START_OVERRIDE(apple2_state,tk2000) - MCFG_VIDEO_START_OVERRIDE(apple2_state,apple2e) + MCFG_VIDEO_START_OVERRIDE(apple2_state,apple2c) /* internal ram */ MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("64K") diff --git a/src/mess/includes/apple2.h b/src/mess/includes/apple2.h index 89a6cb8e696..4c629fce510 100644 --- a/src/mess/includes/apple2.h +++ b/src/mess/includes/apple2.h @@ -138,7 +138,8 @@ public: m_kbrepeat(*this, "keyb_repeat"), m_resetdip(*this, "reset_dip"), m_kpad1(*this, "keypad_1"), - m_kpad2(*this, "keypad_2") + m_kpad2(*this, "keypad_2"), + m_kbprepeat(*this, "keyb_repeat") { } required_device m_maincpu; @@ -151,6 +152,7 @@ public: optional_ioport m_kbrepeat; optional_ioport m_resetdip; optional_ioport m_kpad1, m_kpad2; + optional_ioport m_kbprepeat; UINT32 m_flags, m_flags_mask; INT32 m_a2_cnxx_slot; diff --git a/src/mess/machine/a2eramworks3.c b/src/mess/machine/a2eramworks3.c new file mode 100644 index 00000000000..a065e348726 --- /dev/null +++ b/src/mess/machine/a2eramworks3.c @@ -0,0 +1,93 @@ +/********************************************************************* + + a2eramworks3.c + + Applied Engineering RamWorks III + + +*********************************************************************/ + +#include "emu.h" +#include "includes/apple2.h" +#include "machine/a2eramworks3.h" + + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type A2EAUX_RAMWORKS3 = &device_creator; + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +a2eaux_ramworks3_device::a2eaux_ramworks3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, A2EAUX_RAMWORKS3, "Applied Engineering RamWorks III", tag, owner, clock), + device_a2eauxslot_card_interface(mconfig, *this) +{ + m_shortname = "a2erwks3"; +} + +a2eaux_ramworks3_device::a2eaux_ramworks3_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, type, name, tag, owner, clock), + device_a2eauxslot_card_interface(mconfig, *this) +{ + m_shortname = "a2erwks3"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void a2eaux_ramworks3_device::device_start() +{ + set_a2eauxslot_device(); +} + +void a2eaux_ramworks3_device::device_reset() +{ + m_bank = 0; +} + +UINT8 a2eaux_ramworks3_device::read_auxram(UINT16 offset) +{ + return m_ram[offset+m_bank]; +} + +void a2eaux_ramworks3_device::write_auxram(UINT16 offset, UINT8 data) +{ + m_ram[offset+m_bank] = data; +} + +UINT8 *a2eaux_ramworks3_device::get_vram_ptr() +{ + return &m_ram[0]; +} + +/* + These cards are split into 64k logical banks. + + On a RW3: + Banks 00-0F is the first MB + Banks 10-17 are the next 512K + Banks 30-37 are the next 512K + Banks 50-57 are the next 512K + Banks 70-77 are the next 512K + + However, the software will recognize and correctly use a configuration in which + all of banks 00-7F are populated for a total of 8 megabytes. So that's what we do. +*/ +void a2eaux_ramworks3_device::write_c07x(address_space &space, UINT8 offset, UINT8 data) +{ + // write to C073? + if (offset == 3) + { + m_bank = 0x10000 * (data & 0x7f); + } +} + diff --git a/src/mess/machine/a2eramworks3.h b/src/mess/machine/a2eramworks3.h new file mode 100644 index 00000000000..ef5c0857743 --- /dev/null +++ b/src/mess/machine/a2eramworks3.h @@ -0,0 +1,47 @@ +/********************************************************************* + + a2eramworks3.c + + Applied Engineering RamWorks III + +*********************************************************************/ + +#ifndef __A2EAUX_RAMWORKS3__ +#define __A2EAUX_RAMWORKS3__ + +#include "emu.h" +#include "machine/a2eauxslot.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class a2eaux_ramworks3_device: + public device_t, + public device_a2eauxslot_card_interface +{ +public: + // construction/destruction + a2eaux_ramworks3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + a2eaux_ramworks3_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + +protected: + virtual void device_start(); + virtual void device_reset(); + + virtual UINT8 read_auxram(UINT16 offset); + virtual void write_auxram(UINT16 offset, UINT8 data); + virtual UINT8 *get_vram_ptr(); + virtual bool allow_dhr() { return true; } + virtual void write_c07x(address_space &space, UINT8 offset, UINT8 data); + +private: + UINT8 m_ram[8*1024*1024]; + int m_bank; +}; + +// device type definition +extern const device_type A2EAUX_RAMWORKS3; + +#endif /* __A2EAUX_RAMWORKS3__ */ + diff --git a/src/mess/machine/ay3600.c b/src/mess/machine/ay3600.c index 17f290d4d68..24eab6de999 100644 --- a/src/mess/machine/ay3600.c +++ b/src/mess/machine/ay3600.c @@ -280,30 +280,30 @@ static const unsigned char ay3600_key_remap_2e[2][9*8][4] = HELPER FUNCTIONS ***************************************************************************/ -INLINE int a2_has_keypad(running_machine &machine) +INLINE int a2_has_keypad(apple2_state *state) { - return machine.root_device().ioport("keypad_1") != NULL; + return (state->m_kpad1 != NULL); } -INLINE int a2_has_reset_dip(running_machine &machine) +INLINE int a2_has_reset_dip(apple2_state *state) { - return machine.root_device().ioport("reset_dip") != NULL; + return (state->m_resetdip != NULL); } -INLINE int a2_has_repeat(running_machine &machine) +INLINE int a2_has_repeat(apple2_state *state) { - return machine.root_device().ioport("keyb_repeat") != NULL; + return (state->m_kbprepeat != NULL); } -INLINE int a2_has_capslock(running_machine &machine) +INLINE int a2_has_capslock(apple2_state *state) { - return !a2_has_repeat(machine); /* BUG: Doesn't work with Ace */ + return !a2_has_repeat(state); /* BUG: Doesn't work with Ace */ } -INLINE int a2_no_ctrl_reset(running_machine &machine) +INLINE int a2_no_ctrl_reset(apple2_state *state) { - return ((a2_has_repeat(machine) && !a2_has_reset_dip(machine)) || - (a2_has_reset_dip(machine) && !machine.root_device().ioport("reset_dip")->read())); + return ((a2_has_repeat(state) && !a2_has_reset_dip(state)) || + (a2_has_reset_dip(state) && !state->m_resetdip->read())); } @@ -362,8 +362,8 @@ static TIMER_CALLBACK(AY3600_poll) /* check for these special cases because they affect the emulated key codes */ /* only repeat keys on a 2/2+ if special REPT key is pressed */ - if (a2_has_repeat(machine)) - state->m_time_until_repeat = machine.root_device().ioport("keyb_repeat")->read() & 0x01 ? 0 : ~0; + if (a2_has_repeat(state)) + state->m_time_until_repeat = state->m_kbprepeat->read() & 0x01 ? 0 : ~0; /* check caps lock and set LED here */ if (state->apple2_pressed_specialkey(SPECIALKEY_CAPSLOCK)) @@ -425,7 +425,7 @@ static TIMER_CALLBACK(AY3600_poll) /* reset key check */ if (state->apple2_pressed_specialkey(SPECIALKEY_RESET) && - (a2_no_ctrl_reset(machine) || switchkey & A2_KEY_CONTROL)) + (a2_no_ctrl_reset(state) || switchkey & A2_KEY_CONTROL)) { if (!state->m_reset_flag) { @@ -443,7 +443,7 @@ static TIMER_CALLBACK(AY3600_poll) } /* run through real keys and see what's being pressed */ - num_ports = a2_has_keypad(machine) ? 9 : 7; + num_ports = a2_has_keypad(state) ? 9 : 7; state->m_keymodreg &= ~A2_KEYMOD_KEYPAD; @@ -453,7 +453,7 @@ static TIMER_CALLBACK(AY3600_poll) for (bit = 0; bit < 8; bit++) { - if (a2_has_capslock(machine)) + if (a2_has_capslock(state)) { curkey = ay3600_key_remap_2e[caps_lock][port*8+bit][switchkey]; curkey_unmodified = ay3600_key_remap_2e[caps_lock][port*8+bit][0]; diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 5b44038470f..fa3f2eb3a9d 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -697,6 +697,7 @@ $(MESSOBJ)/apple.a: \ $(MESS_MACHINE)/a2midi.o \ $(MESS_MACHINE)/a2estd80col.o \ $(MESS_MACHINE)/a2eext80col.o \ + $(MESS_MACHINE)/a2eramworks3.o \ $(MESS_MACHINE)/lisa.o \ $(MESS_DRIVERS)/lisa.o \ $(MESS_MACHINE)/nubus.o \ -- cgit v1.2.3