From 4dfad6d101564ea83ae122800e06d90cca2cf7ce Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Thu, 21 Aug 2014 02:05:14 +0000 Subject: [PATCH] (MESS) Apple II series changes: [R. Belmont] - Support 1 MB expansion for Laser 128ex2 - Give the IIc Plus the correct drive type, but it's still unhappy - Promote apple2c4 to working since it runs fine now --- src/mess/drivers/apple2.c | 24 +++++++++- src/mess/includes/apple2.h | 13 +++++- src/mess/machine/apple2.c | 94 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 3 deletions(-) diff --git a/src/mess/drivers/apple2.c b/src/mess/drivers/apple2.c index a3acf0f64ac..b2ae7540d01 100644 --- a/src/mess/drivers/apple2.c +++ b/src/mess/drivers/apple2.c @@ -192,8 +192,10 @@ Address bus A0-A11 is Y0-Y11 #include "imagedev/flopdrv.h" #include "imagedev/cassette.h" #include "formats/ap2_dsk.h" +#include "formats/ap_dsk35.h" #include "includes/apple2.h" #include "cpu/z80/z80.h" +#include "machine/sonydriv.h" #include "machine/appldriv.h" #include "bus/a2bus/a2bus.h" @@ -1246,11 +1248,29 @@ static MACHINE_CONFIG_DERIVED( apple2c, apple2ee ) MCFG_RAM_EXTRA_OPTIONS("128K") MACHINE_CONFIG_END +const applefdc_interface a2cp_interface = +{ + sony_set_lines, /* set_lines */ + sony_set_enable_lines, /* set_enable_lines */ + + sony_read_data, /* read_data */ + sony_write_data, /* write_data */ + sony_read_status /* read_status */ +}; + +static const floppy_interface apple2cp_floppy35_floppy_interface = +{ + FLOPPY_STANDARD_5_25_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(apple35_iigs), + "floppy_3_5" +}; + static MACHINE_CONFIG_DERIVED( apple2cp, apple2c ) MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2cp) MCFG_A2BUS_SLOT_REMOVE("sl6") - MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_IWM_FDC, NULL) + MCFG_IWM_ADD(IICP_IWM_TAG, a2cp_interface) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(apple2cp_floppy35_floppy_interface) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( apple2c_iwm, apple2c ) @@ -1766,7 +1786,7 @@ COMP( 1988, las128ex, apple2c, 0, laser128, apple2e, driver_device, COMP( 1988, las128e2, apple2c, 0, laser128ex2, apple2e, driver_device, 0, "Video Technology", "Laser 128ex2 (version 6.1)", GAME_SUPPORTS_SAVE ) COMP( 1985, apple2c0, apple2c, 0, apple2c_iwm, apple2e, driver_device, 0, "Apple Computer", "Apple //c (UniDisk 3.5)", GAME_SUPPORTS_SAVE ) COMP( 1986, apple2c3, apple2c, 0, apple2c_iwm, apple2e, driver_device, 0, "Apple Computer", "Apple //c (Original Memory Expansion)", GAME_SUPPORTS_SAVE ) -COMP( 1986, apple2c4, apple2c, 0, apple2c_iwm, apple2e, driver_device, 0, "Apple Computer", "Apple //c (rev 4)", GAME_NOT_WORKING ) +COMP( 1986, apple2c4, apple2c, 0, apple2c_iwm, apple2e, driver_device, 0, "Apple Computer", "Apple //c (rev 4)", GAME_SUPPORTS_SAVE ) COMP( 1988, apple2cp, apple2c, 0, apple2cp, apple2e, driver_device, 0, "Apple Computer", "Apple //c Plus", GAME_SUPPORTS_SAVE ) COMP( 1984, ivelultr, apple2, 0, apple2p, apple2p, driver_device, 0, "Ivasim", "Ivel Ultra", GAME_SUPPORTS_SAVE ) COMP( 1983, agat7, apple2, 0, apple2p, apple2p, driver_device, 0, "Agat", "Agat-7", GAME_NOT_WORKING) // disk controller ROM JSRs to $FCA8 which is a delay on apple II, illegal instruction crash here :( diff --git a/src/mess/includes/apple2.h b/src/mess/includes/apple2.h index 87d11c98b54..d294025ed9f 100644 --- a/src/mess/includes/apple2.h +++ b/src/mess/includes/apple2.h @@ -26,6 +26,7 @@ #define IIC_ACIA1_TAG "acia1" #define IIC_ACIA2_TAG "acia2" +#define IICP_IWM_TAG "iwm" #define LASER128_UDC_TAG "l128udc" @@ -142,7 +143,8 @@ public: m_cassette(*this, "cassette"), m_acia1(*this, IIC_ACIA1_TAG), m_acia2(*this, IIC_ACIA2_TAG), - m_laserudc(*this, LASER128_UDC_TAG) + m_laserudc(*this, LASER128_UDC_TAG), + m_iicpiwm(*this, IICP_IWM_TAG) { } required_device m_maincpu; @@ -161,6 +163,7 @@ public: optional_device m_acia1, m_acia2; optional_device m_laserudc; + optional_device m_iicpiwm; UINT32 m_flags, m_flags_mask; INT32 m_a2_cnxx_slot; @@ -360,6 +363,14 @@ public: void apple2eplus_init_common(void *apple2cp_ce00_ram); INT8 apple2_slotram_r(address_space &space, int slotnum, int offset); int a2_no_ctrl_reset(); + +private: + // Laser 128EX2 slot 5 Apple Memory Expansion emulation vars + UINT8 m_exp_bankhior; + int m_exp_addrmask; + UINT8 m_exp_regs[0x10]; + UINT8 *m_exp_ram; + int m_exp_wptr, m_exp_liveptr; }; /*----------- defined in drivers/apple2.c -----------*/ INPUT_PORTS_EXTERN( apple2ep ); diff --git a/src/mess/machine/apple2.c b/src/mess/machine/apple2.c index a0d3bab8ea8..92c6981c44b 100644 --- a/src/mess/machine/apple2.c +++ b/src/mess/machine/apple2.c @@ -366,6 +366,29 @@ READ8_MEMBER(apple2_state::apple2_c080_r) } } } + + if ((m_machinetype == APPLE_IICPLUS) && (slot == 6)) + { + offset &= 0xf; + return m_iicpiwm->read(offset); + } + + if ((m_machinetype == LASER128) && (slot == 5)) + { + offset &= 0xf; + UINT8 retval = m_exp_regs[offset]; + + if (offset == 3) + { + retval = m_exp_ram[m_exp_liveptr&m_exp_addrmask]; + m_exp_liveptr++; + m_exp_regs[0] = m_exp_liveptr & 0xff; + m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior; + } + + return retval; + } if ((m_machinetype == LASER128) && (slot == 6)) { @@ -417,6 +440,59 @@ WRITE8_MEMBER(apple2_state::apple2_c080_w) } } + if ((m_machinetype == APPLE_IICPLUS) && (slot == 6)) + { + offset &= 0xf; + m_iicpiwm->write(offset, data); + return; + } + + if ((m_machinetype == LASER128) && (slot == 5)) + { + switch (offset & 0xf) + { + case 0: + m_exp_wptr &= ~0xff; + m_exp_wptr |= data; + m_exp_regs[0] = m_exp_wptr & 0xff; + m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; + m_exp_liveptr = m_exp_wptr; + break; + + case 1: + m_exp_wptr &= ~0xff00; + m_exp_wptr |= (data<<8); + m_exp_regs[0] = m_exp_wptr & 0xff; + m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; + m_exp_liveptr = m_exp_wptr; + break; + + case 2: + m_exp_wptr &= ~0xff0000; + m_exp_wptr |= (data<<16); + m_exp_regs[0] = m_exp_wptr & 0xff; + m_exp_regs[1] = (m_exp_wptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior; + m_exp_liveptr = m_exp_wptr; + break; + + case 3: + // printf("Write %02x to RAM[%x]\n", data, m_liveptr); + m_exp_ram[(m_exp_liveptr&m_exp_addrmask)] = data; + m_exp_liveptr++; + m_exp_regs[0] = m_exp_liveptr & 0xff; + m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff; + m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior; + break; + + default: + m_exp_regs[offset] = data; + break; + } + } + if ((m_machinetype == LASER128) && (slot == 6)) { offset &= 0xf; @@ -1218,6 +1294,10 @@ void apple2_state::machine_reset() m_joystick_x1_time = m_joystick_y1_time = 0; m_joystick_x2_time = m_joystick_y2_time = 0; + + memset(m_exp_regs, 0, sizeof(UINT8) * 0x10); + m_exp_wptr = m_exp_liveptr = 0; + } int apple2_state::a2_no_ctrl_reset() @@ -2251,6 +2331,20 @@ MACHINE_START_MEMBER(apple2_state,laser128) apple2_init_common(); + // 1 MB of expansion RAM in slot 5 + m_exp_ram = auto_alloc_array(machine(), UINT8, 1024*1024); + memset(m_exp_ram, 0xff, 1024*1024); + + m_exp_bankhior = 0xf0; + m_exp_addrmask = 0xfffff; + + // save memory expansion vars + save_item(NAME(m_exp_regs)); + save_item(NAME(m_exp_wptr)); + save_item(NAME(m_exp_liveptr)); + save_item(NAME(m_exp_bankhior)); + save_item(NAME(m_exp_addrmask)); + /* setup memory */ memset(&mem_cfg, 0, sizeof(mem_cfg)); mem_cfg.first_bank = 1;