trunk/src/mess/machine/a2eramworks3.c
| r0 | r20853 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | a2eramworks3.c |
| 4 | |
| 5 | Applied Engineering RamWorks III |
| 6 | |
| 7 | |
| 8 | *********************************************************************/ |
| 9 | |
| 10 | #include "emu.h" |
| 11 | #include "includes/apple2.h" |
| 12 | #include "machine/a2eramworks3.h" |
| 13 | |
| 14 | |
| 15 | /*************************************************************************** |
| 16 | PARAMETERS |
| 17 | ***************************************************************************/ |
| 18 | |
| 19 | //************************************************************************** |
| 20 | // GLOBAL VARIABLES |
| 21 | //************************************************************************** |
| 22 | |
| 23 | const device_type A2EAUX_RAMWORKS3 = &device_creator<a2eaux_ramworks3_device>; |
| 24 | |
| 25 | //************************************************************************** |
| 26 | // LIVE DEVICE |
| 27 | //************************************************************************** |
| 28 | |
| 29 | a2eaux_ramworks3_device::a2eaux_ramworks3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 30 | device_t(mconfig, A2EAUX_RAMWORKS3, "Applied Engineering RamWorks III", tag, owner, clock), |
| 31 | device_a2eauxslot_card_interface(mconfig, *this) |
| 32 | { |
| 33 | m_shortname = "a2erwks3"; |
| 34 | } |
| 35 | |
| 36 | a2eaux_ramworks3_device::a2eaux_ramworks3_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| 37 | device_t(mconfig, type, name, tag, owner, clock), |
| 38 | device_a2eauxslot_card_interface(mconfig, *this) |
| 39 | { |
| 40 | m_shortname = "a2erwks3"; |
| 41 | } |
| 42 | |
| 43 | //------------------------------------------------- |
| 44 | // device_start - device-specific startup |
| 45 | //------------------------------------------------- |
| 46 | |
| 47 | void a2eaux_ramworks3_device::device_start() |
| 48 | { |
| 49 | set_a2eauxslot_device(); |
| 50 | } |
| 51 | |
| 52 | void a2eaux_ramworks3_device::device_reset() |
| 53 | { |
| 54 | m_bank = 0; |
| 55 | } |
| 56 | |
| 57 | UINT8 a2eaux_ramworks3_device::read_auxram(UINT16 offset) |
| 58 | { |
| 59 | return m_ram[offset+m_bank]; |
| 60 | } |
| 61 | |
| 62 | void a2eaux_ramworks3_device::write_auxram(UINT16 offset, UINT8 data) |
| 63 | { |
| 64 | m_ram[offset+m_bank] = data; |
| 65 | } |
| 66 | |
| 67 | UINT8 *a2eaux_ramworks3_device::get_vram_ptr() |
| 68 | { |
| 69 | return &m_ram[0]; |
| 70 | } |
| 71 | |
| 72 | /* |
| 73 | These cards are split into 64k logical banks. |
| 74 | |
| 75 | On a RW3: |
| 76 | Banks 00-0F is the first MB |
| 77 | Banks 10-17 are the next 512K |
| 78 | Banks 30-37 are the next 512K |
| 79 | Banks 50-57 are the next 512K |
| 80 | Banks 70-77 are the next 512K |
| 81 | |
| 82 | However, the software will recognize and correctly use a configuration in which |
| 83 | all of banks 00-7F are populated for a total of 8 megabytes. So that's what we do. |
| 84 | */ |
| 85 | void a2eaux_ramworks3_device::write_c07x(address_space &space, UINT8 offset, UINT8 data) |
| 86 | { |
| 87 | // write to C073? |
| 88 | if (offset == 3) |
| 89 | { |
| 90 | m_bank = 0x10000 * (data & 0x7f); |
| 91 | } |
| 92 | } |
| 93 | |
trunk/src/mess/machine/a2eramworks3.h
| r0 | r20853 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | a2eramworks3.c |
| 4 | |
| 5 | Applied Engineering RamWorks III |
| 6 | |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #ifndef __A2EAUX_RAMWORKS3__ |
| 10 | #define __A2EAUX_RAMWORKS3__ |
| 11 | |
| 12 | #include "emu.h" |
| 13 | #include "machine/a2eauxslot.h" |
| 14 | |
| 15 | //************************************************************************** |
| 16 | // TYPE DEFINITIONS |
| 17 | //************************************************************************** |
| 18 | |
| 19 | class a2eaux_ramworks3_device: |
| 20 | public device_t, |
| 21 | public device_a2eauxslot_card_interface |
| 22 | { |
| 23 | public: |
| 24 | // construction/destruction |
| 25 | a2eaux_ramworks3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 26 | a2eaux_ramworks3_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); |
| 27 | |
| 28 | protected: |
| 29 | virtual void device_start(); |
| 30 | virtual void device_reset(); |
| 31 | |
| 32 | virtual UINT8 read_auxram(UINT16 offset); |
| 33 | virtual void write_auxram(UINT16 offset, UINT8 data); |
| 34 | virtual UINT8 *get_vram_ptr(); |
| 35 | virtual bool allow_dhr() { return true; } |
| 36 | virtual void write_c07x(address_space &space, UINT8 offset, UINT8 data); |
| 37 | |
| 38 | private: |
| 39 | UINT8 m_ram[8*1024*1024]; |
| 40 | int m_bank; |
| 41 | }; |
| 42 | |
| 43 | // device type definition |
| 44 | extern const device_type A2EAUX_RAMWORKS3; |
| 45 | |
| 46 | #endif /* __A2EAUX_RAMWORKS3__ */ |
| 47 | |
trunk/src/mess/machine/ay3600.c
| r20852 | r20853 | |
| 280 | 280 | HELPER FUNCTIONS |
| 281 | 281 | ***************************************************************************/ |
| 282 | 282 | |
| 283 | | INLINE int a2_has_keypad(running_machine &machine) |
| 283 | INLINE int a2_has_keypad(apple2_state *state) |
| 284 | 284 | { |
| 285 | | return machine.root_device().ioport("keypad_1") != NULL; |
| 285 | return (state->m_kpad1 != NULL); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | | INLINE int a2_has_reset_dip(running_machine &machine) |
| 288 | INLINE int a2_has_reset_dip(apple2_state *state) |
| 289 | 289 | { |
| 290 | | return machine.root_device().ioport("reset_dip") != NULL; |
| 290 | return (state->m_resetdip != NULL); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | | INLINE int a2_has_repeat(running_machine &machine) |
| 293 | INLINE int a2_has_repeat(apple2_state *state) |
| 294 | 294 | { |
| 295 | | return machine.root_device().ioport("keyb_repeat") != NULL; |
| 295 | return (state->m_kbprepeat != NULL); |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | | INLINE int a2_has_capslock(running_machine &machine) |
| 298 | INLINE int a2_has_capslock(apple2_state *state) |
| 299 | 299 | { |
| 300 | | return !a2_has_repeat(machine); /* BUG: Doesn't work with Ace */ |
| 300 | return !a2_has_repeat(state); /* BUG: Doesn't work with Ace */ |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | | INLINE int a2_no_ctrl_reset(running_machine &machine) |
| 303 | INLINE int a2_no_ctrl_reset(apple2_state *state) |
| 304 | 304 | { |
| 305 | | return ((a2_has_repeat(machine) && !a2_has_reset_dip(machine)) || |
| 306 | | (a2_has_reset_dip(machine) && !machine.root_device().ioport("reset_dip")->read())); |
| 305 | return ((a2_has_repeat(state) && !a2_has_reset_dip(state)) || |
| 306 | (a2_has_reset_dip(state) && !state->m_resetdip->read())); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | |
| r20852 | r20853 | |
| 362 | 362 | /* check for these special cases because they affect the emulated key codes */ |
| 363 | 363 | |
| 364 | 364 | /* only repeat keys on a 2/2+ if special REPT key is pressed */ |
| 365 | | if (a2_has_repeat(machine)) |
| 366 | | state->m_time_until_repeat = machine.root_device().ioport("keyb_repeat")->read() & 0x01 ? 0 : ~0; |
| 365 | if (a2_has_repeat(state)) |
| 366 | state->m_time_until_repeat = state->m_kbprepeat->read() & 0x01 ? 0 : ~0; |
| 367 | 367 | |
| 368 | 368 | /* check caps lock and set LED here */ |
| 369 | 369 | if (state->apple2_pressed_specialkey(SPECIALKEY_CAPSLOCK)) |
| r20852 | r20853 | |
| 425 | 425 | |
| 426 | 426 | /* reset key check */ |
| 427 | 427 | if (state->apple2_pressed_specialkey(SPECIALKEY_RESET) && |
| 428 | | (a2_no_ctrl_reset(machine) || switchkey & A2_KEY_CONTROL)) |
| 428 | (a2_no_ctrl_reset(state) || switchkey & A2_KEY_CONTROL)) |
| 429 | 429 | { |
| 430 | 430 | if (!state->m_reset_flag) |
| 431 | 431 | { |
| r20852 | r20853 | |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | /* run through real keys and see what's being pressed */ |
| 446 | | num_ports = a2_has_keypad(machine) ? 9 : 7; |
| 446 | num_ports = a2_has_keypad(state) ? 9 : 7; |
| 447 | 447 | |
| 448 | 448 | state->m_keymodreg &= ~A2_KEYMOD_KEYPAD; |
| 449 | 449 | |
| r20852 | r20853 | |
| 453 | 453 | |
| 454 | 454 | for (bit = 0; bit < 8; bit++) |
| 455 | 455 | { |
| 456 | | if (a2_has_capslock(machine)) |
| 456 | if (a2_has_capslock(state)) |
| 457 | 457 | { |
| 458 | 458 | curkey = ay3600_key_remap_2e[caps_lock][port*8+bit][switchkey]; |
| 459 | 459 | curkey_unmodified = ay3600_key_remap_2e[caps_lock][port*8+bit][0]; |
trunk/src/mess/includes/apple2.h
| r20852 | r20853 | |
| 138 | 138 | m_kbrepeat(*this, "keyb_repeat"), |
| 139 | 139 | m_resetdip(*this, "reset_dip"), |
| 140 | 140 | m_kpad1(*this, "keypad_1"), |
| 141 | | m_kpad2(*this, "keypad_2") |
| 141 | m_kpad2(*this, "keypad_2"), |
| 142 | m_kbprepeat(*this, "keyb_repeat") |
| 142 | 143 | { } |
| 143 | 144 | |
| 144 | 145 | required_device<cpu_device> m_maincpu; |
| r20852 | r20853 | |
| 151 | 152 | optional_ioport m_kbrepeat; |
| 152 | 153 | optional_ioport m_resetdip; |
| 153 | 154 | optional_ioport m_kpad1, m_kpad2; |
| 155 | optional_ioport m_kbprepeat; |
| 154 | 156 | |
| 155 | 157 | UINT32 m_flags, m_flags_mask; |
| 156 | 158 | INT32 m_a2_cnxx_slot; |
trunk/src/mess/drivers/apple2.c
| r20852 | r20853 | |
| 214 | 214 | #include "machine/a2midi.h" |
| 215 | 215 | #include "machine/a2estd80col.h" |
| 216 | 216 | #include "machine/a2eext80col.h" |
| 217 | #include "machine/a2eramworks3.h" |
| 217 | 218 | |
| 218 | 219 | /*************************************************************************** |
| 219 | 220 | PARAMETERS |
| r20852 | r20853 | |
| 639 | 640 | static SLOT_INTERFACE_START(apple2eaux_cards) |
| 640 | 641 | SLOT_INTERFACE("std80", A2EAUX_STD80COL) /* Apple IIe Standard 80 Column Card */ |
| 641 | 642 | SLOT_INTERFACE("ext80", A2EAUX_EXT80COL) /* Apple IIe Extended 80 Column Card */ |
| 643 | SLOT_INTERFACE("rw3", A2EAUX_RAMWORKS3) /* Applied Engineering RamWorks III */ |
| 642 | 644 | SLOT_INTERFACE_END |
| 643 | 645 | |
| 644 | 646 | static MACHINE_CONFIG_START( apple2_common, apple2_state ) |
| r20852 | r20853 | |
| 731 | 733 | |
| 732 | 734 | static MACHINE_CONFIG_DERIVED( tk2000, apple2_common ) |
| 733 | 735 | MCFG_MACHINE_START_OVERRIDE(apple2_state,tk2000) |
| 734 | | MCFG_VIDEO_START_OVERRIDE(apple2_state,apple2e) |
| 736 | MCFG_VIDEO_START_OVERRIDE(apple2_state,apple2c) |
| 735 | 737 | /* internal ram */ |
| 736 | 738 | MCFG_RAM_ADD(RAM_TAG) |
| 737 | 739 | MCFG_RAM_DEFAULT_SIZE("64K") |