mac128: start new IWM hookup, not working properly yet [R. Belmont]

This commit is contained in:
arbee 2021-01-22 22:26:52 -05:00
parent e2d4ad3a82
commit 47359c7285

View File

@ -99,6 +99,8 @@ part number 338-6523 (later Macs use a PLCC version which Apple numbered
****************************************************************************/
#define NEW_IWM 0
#include "emu.h"
#include "machine/macrtc.h"
@ -111,9 +113,14 @@ part number 338-6523 (later Macs use a PLCC version which Apple numbered
#include "cpu/m68000/m68000.h"
#include "machine/6522via.h"
#include "machine/applefdc.h"
#include "machine/iwm.h"
#include "machine/ncr5380.h"
#include "machine/ram.h"
#if NEW_IWM
#include "machine/applefdintf.h"
#else
#include "machine/sonydriv.h"
#endif
#include "machine/swim.h"
#include "machine/timer.h"
#include "machine/z80scc.h"
@ -175,6 +182,9 @@ public:
m_ram(*this, RAM_TAG),
m_ncr5380(*this, "ncr5380"),
m_iwm(*this, "fdc"),
#if NEW_IWM
m_floppy(*this, "fdc:%d", 0U),
#endif
m_mackbd(*this, "kbd"),
m_rtc(*this,"rtc"),
m_mouse0(*this, "MOUSE0"),
@ -184,6 +194,8 @@ public:
m_dac(*this, DAC_TAG),
m_scc(*this, SCC_TAG)
{
m_cur_floppy = nullptr;
m_hdsel = 0;
}
void mac512ke(machine_config &config);
@ -204,7 +216,12 @@ private:
optional_device<macadb_device> m_macadb;
required_device<ram_device> m_ram;
optional_device<ncr5380_device> m_ncr5380;
#if NEW_IWM
required_device<applefdintf_device> m_iwm;
required_device_array<floppy_connector, 2> m_floppy;
#else
required_device<applefdc_base_device> m_iwm;
#endif
optional_device<mac_keyboard_port_device> m_mackbd;
optional_device<rtc3430042_device> m_rtc;
@ -256,6 +273,14 @@ private:
void macplus_map(address_map &map);
void macse_map(address_map &map);
floppy_image_device *m_cur_floppy;
int m_hdsel;
void phases_w(uint8_t phases);
void sel35_w(int sel35);
void devsel_w(uint8_t devsel);
void hdsel_w(int hdsel);
mac128model_t m_model;
uint32_t m_overlay;
@ -560,17 +585,9 @@ void mac128_state::scc_mouse_irq(int x, int y)
uint16_t mac128_state::mac_iwm_r(offs_t offset, uint16_t mem_mask)
{
/* The first time this is called is in a floppy test, which goes from
* $400104 to $400126. After that, all access to the floppy goes through
* the disk driver in the MacOS
*
* I just thought this would be on interest to someone trying to further
* this driver along
*/
uint16_t result = 0;
result = m_iwm->read(offset >> 8);
result = m_iwm->read((offset >> 8) & 0xf);
if (LOG_MAC_IWM)
printf("mac_iwm_r: offset=0x%08x mem_mask %04x = %02x (PC %x)\n", offset, mem_mask, result, m_maincpu->pc());
@ -584,9 +601,9 @@ void mac128_state::mac_iwm_w(offs_t offset, uint16_t data, uint16_t mem_mask)
printf("mac_iwm_w: offset=0x%08x data=0x%04x mask %04x (PC=%x)\n", offset, data, mem_mask, m_maincpu->pc());
if (ACCESSING_BITS_0_7)
m_iwm->write((offset >> 8), data & 0xff);
m_iwm->write((offset >> 8) & 0xf, data & 0xff);
else
m_iwm->write((offset >> 8), data>>8);
m_iwm->write((offset >> 8) & 0xf, data>>8);
}
WRITE_LINE_MEMBER(mac128_state::mac_via_irq)
@ -687,7 +704,19 @@ void mac128_state::mac_via_out_a(uint8_t data)
//set_scc_waitrequest((data & 0x80) >> 7);
m_screen_buffer = (data & 0x40) >> 6;
#if !NEW_IWM
sony_set_sel_line(m_iwm, (data & 0x20) >> 5);
#else
int hdsel = BIT(data, 5);
if (hdsel != m_hdsel)
{
if (m_cur_floppy)
{
m_cur_floppy->ss_w(hdsel);
}
m_hdsel = hdsel;
}
#endif
m_main_buffer = ((data & 0x08) == 0x08) ? true : false;
m_snd_vol = data & 0x07;
@ -708,7 +737,19 @@ void mac128_state::mac_via_out_a_se(uint8_t data)
//set_scc_waitrequest((data & 0x80) >> 7);
m_screen_buffer = (data & 0x40) >> 6;
#if !NEW_IWM
sony_set_sel_line(m_iwm, (data & 0x20) >> 5);
#else
int hdsel = BIT(data, 5);
if (hdsel != m_hdsel)
{
if (m_cur_floppy)
{
m_cur_floppy->ss_w(hdsel);
}
m_hdsel = hdsel;
}
#endif
m_snd_vol = data & 0x07;
update_volume();
@ -847,6 +888,34 @@ uint32_t mac128_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bi
return 0;
}
#if NEW_IWM
void mac128_state::phases_w(uint8_t phases)
{
if (m_cur_floppy)
m_cur_floppy->seek_phase_w(phases);
}
void mac128_state::sel35_w(int sel35)
{
}
void mac128_state::devsel_w(uint8_t devsel)
{
if (devsel == 1)
m_cur_floppy = m_floppy[0]->get_device();
else if (devsel == 2)
m_cur_floppy = m_floppy[1]->get_device();
m_iwm->set_floppy(m_cur_floppy);
if (m_cur_floppy)
m_cur_floppy->ss_w(m_hdsel);
}
void mac128_state::hdsel_w(int hdsel)
{
}
#endif
#define MAC_DRIVER_INIT(label, model) \
void mac128_state::init_##label() \
{ \
@ -902,7 +971,7 @@ void mac128_state::macse_map(address_map &map)
/***************************************************************************
DEVICE CONFIG
***************************************************************************/
#if !NEW_IWM
static const applefdc_interface mac_iwm_interface =
{
sony_set_lines,
@ -912,17 +981,19 @@ static const applefdc_interface mac_iwm_interface =
sony_write_data,
sony_read_status
};
#endif
/***************************************************************************
MACHINE DRIVERS
***************************************************************************/
#if !NEW_IWM
static const floppy_interface mac_floppy_interface =
{
FLOPPY_STANDARD_3_5_DSHD,
LEGACY_FLOPPY_OPTIONS_NAME(apple35_mac),
"floppy_3_5"
};
#endif
static void mac_pds_cards(device_slot_interface &device)
{
@ -950,8 +1021,18 @@ void mac128_state::mac512ke(machine_config &config)
/* devices */
RTC3430042(config, m_rtc, 32.768_kHz_XTAL);
#if NEW_IWM
IWM(config, m_iwm, C7M, 1021800*2, true);
m_iwm->phases_cb().set(FUNC(mac128_state::phases_w));
m_iwm->sel35_cb().set(FUNC(mac128_state::sel35_w));
m_iwm->devsel_cb().set(FUNC(mac128_state::devsel_w));
applefdintf_device::add_35(config, m_floppy[0]);
applefdintf_device::add_35(config, m_floppy[1]);
#else
LEGACY_IWM(config, m_iwm, 0).set_config(&mac_iwm_interface);
sonydriv_floppy_image_device::legacy_2_drives_add(config, &mac_floppy_interface);
#endif
SCC85C30(config, m_scc, C7M);
m_scc->configure_channels(C3_7M, 0, C3_7M, 0);