diff options
Diffstat (limited to 'src/mame/drivers/apple2e.cpp')
-rw-r--r-- | src/mame/drivers/apple2e.cpp | 274 |
1 files changed, 225 insertions, 49 deletions
diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index d485237893b..72e0a243d07 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -171,7 +171,7 @@ Address bus A0-A11 is Y0-Y11 #define A2_UPPERBANK_TAG "inhbank" #define IIC_ACIA1_TAG "acia1" #define IIC_ACIA2_TAG "acia2" -#define IICP_IWM_TAG "iwm" +#define IICP_IWM_TAG "fdc" #define LASER128_UDC_TAG "l128udc" #define PRINTER_PORT_TAG "printer" #define MODEM_PORT_TAG "modem" @@ -393,6 +393,9 @@ public: void r2000bank_map(address_map &map); void r4000bank_map(address_map &map); void spectred_keyb_map(address_map &map); + + bool m_35sel, m_hdsel, m_intdrive; + private: int m_speaker_state; int m_cassette_state, m_cassette_out; @@ -435,6 +438,9 @@ private: uint8_t m_migram[0x800]; uint16_t m_migpage; + bool m_zipunlocked; + int m_zipstage; + uint8_t *m_ram_ptr, *m_rom_ptr, *m_cec_ptr; int m_ram_size; @@ -486,21 +492,36 @@ private: uint8_t apple2e_state::mig_r(uint16_t offset) { + //printf("mig_r @ %x\n", offset + 0xc00); // MIG RAM window - if (offset < 0x20) + if ((offset >= 0x200) && (offset < 0x220)) { return m_migram[m_migpage + offset]; } - // increment MIG RAM window - if (offset == 0x20) + // increment MIG RAM window and return previous value + if ((offset >= 0x220) && (offset < 0x240)) { + uint8_t rv = m_migram[m_migpage + offset]; m_migpage += 0x20; - m_migpage &= 0x7ff; // make sure we wrap + m_migpage &= 0x7ff; + return rv; + } + + if ((offset >= 0x240) && (offset < 0x260)) + { + m_hdsel = false; + sony_set_sel_line(m_iicpiwm, 0); + } + + if ((offset >= 0x260) && (offset < 0x280)) + { + m_hdsel = true; + sony_set_sel_line(m_iicpiwm, 0x80); } // reset MIG RAM window - if (offset == 0xa0) + if (offset == 0x2a0) { m_migpage = 0; } @@ -510,22 +531,58 @@ uint8_t apple2e_state::mig_r(uint16_t offset) void apple2e_state::mig_w(uint16_t offset, uint8_t data) { + //printf("mig_w %x @ %x\n", data, offset + 0xc00); + + if (offset == 0x40) + { + m_iicpiwm->device_reset(); + return; + } + + if ((offset >= 0x80) && (offset < 0xa0)) + { + //printf("MIG: enable internal drive on d2\n"); + m_intdrive = true; + return; + } + + if ((offset >= 0xc0) && (offset < 0xe0)) + { + //printf("MIG: disable internal drive\n"); + m_intdrive = false; + return; + } + // MIG RAM window - if (offset < 0x20) + if ((offset >= 0x200) && (offset < 0x220)) { m_migram[m_migpage + offset] = data; return; } - // increment MIG RAM window - if (offset == 0x20) + // increment MIG RAM window, but write value at old location first + if ((offset >= 0x220) && (offset < 0x240)) { + m_migram[m_migpage + offset] = data; m_migpage += 0x20; m_migpage &= 0x7ff; // make sure we wrap + return; + } + + if ((offset >= 0x240) && (offset < 0x260)) + { + m_35sel = false; + return; + } + + if ((offset >= 0x260) && (offset < 0x280)) + { + m_35sel = true; + return; } // reset MIG RAM window - if (offset == 0xa0) + if (offset == 0x2a0) { m_migpage = 0; } @@ -853,6 +910,11 @@ void apple2e_state::machine_start() save_item(NAME(m_mockingboard4c)); save_item(NAME(m_intc8rom)); save_item(NAME(m_cec_bank)); + save_item(NAME(m_35sel)); + save_item(NAME(m_hdsel)); + save_item(NAME(m_intdrive)); + save_item(NAME(m_zipunlocked)); + save_item(NAME(m_zipstage)); } void apple2e_state::machine_reset() @@ -875,6 +937,8 @@ void apple2e_state::machine_reset() m_mockingboard4c = false; m_intc8rom = false; m_cec_bank = 0; + m_zipunlocked = false; + m_zipstage = 0; // IIe prefers INTCXROM default to off, IIc has it always on if (m_rom_ptr[0x3bc0] == 0x00) @@ -1391,6 +1455,14 @@ void apple2e_state::do_io(address_space &space, int offset, bool is_iic) m_romswitch = !m_romswitch; update_slotrom_banks(); + // MIG is reset when ROMSWITCH turns off + if ((m_isiicplus) && !(m_romswitch)) + { + m_migpage = 0; + m_intdrive = false; + m_35sel = false; + } + // if LC is not enabled if (!m_lcram) { @@ -1986,6 +2058,34 @@ WRITE8_MEMBER(apple2e_state::c000_iic_w) m_strobe = 0; break; + case 0x5a: // IIC+ accelerator unlock + if (m_isiicplus) + { + if (data == 0x5a) + { + m_zipstage++; + if (m_zipstage == 4) + { + m_zipunlocked = true; + } + } + else if (data == 0xa5) + { + // put settings into effect and lock + m_zipunlocked = false; + m_zipstage = 0; + } + else + { + // disable acceleration and lock + m_zipunlocked = false; + m_zipstage = 0; + } + } + break; + + case 0x5b: + case 0x78: case 0x79: m_vbl = false; @@ -2113,6 +2213,11 @@ READ8_MEMBER(apple2e_state::c080_r) } else { + if ((m_isiicplus) && (slot == 6)) + { + return m_iicpiwm->read(offset % 0x10); + } + if (m_slotdevice[slot] != nullptr) { return m_slotdevice[slot]->read_c0nx(offset % 0x10); @@ -2143,6 +2248,12 @@ WRITE8_MEMBER(apple2e_state::c080_w) } else { + if ((m_isiicplus) && (slot == 6)) + { + m_iicpiwm->write(offset % 0x10, data); + return; + } + if (m_slotdevice[slot] != nullptr) { m_slotdevice[slot]->write_c0nx(offset % 0x10, data); @@ -2291,11 +2402,6 @@ READ8_MEMBER(apple2e_state::c400_cec_bank_r) { return m_rom_ptr[0x4400 + offset READ8_MEMBER(apple2e_state::c800_r) { - if ((m_isiicplus) && (m_romswitch) && (offset >= 0x600) && (offset < 0x700)) - { - return mig_r(offset-0x600); - } - if ((offset == 0x7ff) && !machine().side_effects_disabled()) { m_cnxx_slot = CNXX_UNCLAIMED; @@ -2313,11 +2419,6 @@ READ8_MEMBER(apple2e_state::c800_r) READ8_MEMBER(apple2e_state::c800_int_r) { - if ((m_isiicplus) && (m_romswitch) && (offset >= 0x600) && (offset < 0x700)) - { - return mig_r(offset-0x600); - } - if ((offset == 0x7ff) && !machine().side_effects_disabled()) { m_cnxx_slot = CNXX_UNCLAIMED; @@ -2335,9 +2436,9 @@ READ8_MEMBER(apple2e_state::c800_int_r) READ8_MEMBER(apple2e_state::c800_b2_int_r) { - if ((m_isiicplus) && (m_romswitch) && (offset >= 0x600) && (offset < 0x700)) + if ((m_isiicplus) && (m_romswitch) && (((offset >= 0x400) && (offset < 0x500)) || ((offset >= 0x600) && (offset < 0x700)))) { - return mig_r(offset-0x600); + return mig_r(offset-0x400); } if ((offset == 0x7ff) && !machine().side_effects_disabled()) @@ -2352,9 +2453,9 @@ READ8_MEMBER(apple2e_state::c800_b2_int_r) WRITE8_MEMBER(apple2e_state::c800_w) { - if ((m_isiicplus) && (m_romswitch) && (offset >= 0x600) && (offset < 0x700)) + if ((m_isiicplus) && (m_romswitch) && (((offset >= 0x400) && (offset < 0x500)) || ((offset >= 0x600) && (offset < 0x700)))) { - mig_w(offset-0x600, data); + mig_w(offset-0x400, data); return; } @@ -2400,22 +2501,11 @@ WRITE8_MEMBER(apple2e_state::inh_w) READ8_MEMBER(apple2e_state::lc_romswitch_r) { - if ((offset >= 0xc00) && (offset < 0xd00)) - { - return mig_r(offset-0xc00); - } - return m_rom_ptr[0x5000 + offset]; } WRITE8_MEMBER(apple2e_state::lc_romswitch_w) { - if ((offset >= 0xc00) && (offset < 0xd00)) - { - mig_w(offset-0xc00, data); - return; - } - lc_w(space, offset, data); } @@ -4126,14 +4216,92 @@ MACHINE_CONFIG_START(apple2e_state::apple2c) MCFG_RAM_EXTRA_OPTIONS("128K") MACHINE_CONFIG_END +static void apple2cp_set_lines(device_t *device, uint8_t lines) +{ + apple2e_state *state = device->machine().driver_data<apple2e_state>(); + + if (state->m_35sel) + { + sony_set_lines(device, lines); + } + else + { + apple525_set_lines(device, lines); + } +} + +static void apple2cp_set_enable_lines(device_t *device,int enable_mask) +{ + apple2e_state *state = device->machine().driver_data<apple2e_state>(); + +// printf("set_enable_lines: 35sel %d int %d enable_mask %d\n", state->m_35sel, state->m_intdrive, enable_mask); + + if ((state->m_35sel) && (state->m_intdrive) && (enable_mask == 2)) + { + sony_set_enable_lines(device, 1); + } + else if (!state->m_35sel) + { + apple525_set_enable_lines(device, enable_mask); + } + else + { + sony_set_enable_lines(device, 0); + } +} + +static uint8_t apple2cp_read_data(device_t *device) +{ + apple2e_state *state = device->machine().driver_data<apple2e_state>(); + + if (state->m_35sel) + { + return sony_read_data(device); + } + else + { + return apple525_read_data(device); + } + + return 0; +} + +static void apple2cp_write_data(device_t *device, uint8_t data) +{ + apple2e_state *state = device->machine().driver_data<apple2e_state>(); + + if (state->m_35sel) + { + sony_write_data(device, data); + } + else + { + apple525_write_data(device, data); + } +} + +static int apple2cp_read_status(device_t *device) +{ + apple2e_state *state = device->machine().driver_data<apple2e_state>(); + + if (state->m_35sel) + { + return sony_read_status(device); + } + else + { + return apple525_read_status(device); + } +} + const applefdc_interface a2cp_interface = { - sony_set_lines, /* set_lines */ - sony_set_enable_lines, /* set_enable_lines */ + apple2cp_set_lines, /* set_lines */ + apple2cp_set_enable_lines, /* set_enable_lines */ - sony_read_data, /* read_data */ - sony_write_data, /* write_data */ - sony_read_status /* read_status */ + apple2cp_read_data, /* read_data */ + apple2cp_write_data, /* write_data */ + apple2cp_read_status /* read_status */ }; static const floppy_interface apple2cp_floppy35_floppy_interface = @@ -4143,12 +4311,27 @@ static const floppy_interface apple2cp_floppy35_floppy_interface = "floppy_3_5" }; +static const floppy_interface floppy_interface = +{ + FLOPPY_STANDARD_5_25_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(apple2), + "floppy_5_25" +}; + MACHINE_CONFIG_START(apple2e_state::apple2cp) apple2c(config); + MCFG_DEVICE_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_DEVICE_PROGRAM_MAP(apple2c_memexp_map) + MCFG_DEVICE_REMOVE("sl4") MCFG_DEVICE_REMOVE("sl6") MCFG_IWM_ADD(IICP_IWM_TAG, a2cp_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(apple2cp_floppy35_floppy_interface) + MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(floppy_interface,15,16) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(apple2cp_floppy35_floppy_interface) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("128K, 384K, 640K, 896K, 1152K") MACHINE_CONFIG_END MACHINE_CONFIG_START(apple2e_state::apple2c_iwm) @@ -4181,13 +4364,6 @@ const applefdc_interface fdc_interface = apple525_read_status /* read_status */ }; -static const floppy_interface floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(apple2), - "floppy_5_25" -}; - MACHINE_CONFIG_START(apple2e_state::laser128) apple2c(config); MCFG_DEVICE_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ @@ -4553,4 +4729,4 @@ COMP( 1985, apple2c0, apple2c, 0, apple2c_iwm, apple2c, apple2e_state, COMP( 1986, apple2c3, apple2c, 0, apple2c_mem, apple2c, apple2e_state, empty_init, "Apple Computer", "Apple //c (Original Memory Expansion)", MACHINE_SUPPORTS_SAVE ) COMP( 1986, apple2c4, apple2c, 0, apple2c_mem, apple2c, apple2e_state, empty_init, "Apple Computer", "Apple //c (rev 4)", MACHINE_SUPPORTS_SAVE ) COMP( 1987, ceci, 0, apple2, ceci, ceci, apple2e_state, empty_init, "Shaanxi Province Computer Factory", "China Education Computer I", MACHINE_SUPPORTS_SAVE ) -COMP( 1988, apple2cp, apple2c, 0, apple2cp, apple2c, apple2e_state, empty_init, "Apple Computer", "Apple //c Plus", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1988, apple2cp, apple2c, 0, apple2cp, apple2c, apple2e_state, empty_init, "Apple Computer", "Apple //c Plus", MACHINE_SUPPORTS_SAVE ) |