diff options
Diffstat (limited to 'src/devices/bus/oricext/jasmin.cpp')
-rw-r--r-- | src/devices/bus/oricext/jasmin.cpp | 127 |
1 files changed, 61 insertions, 66 deletions
diff --git a/src/devices/bus/oricext/jasmin.cpp b/src/devices/bus/oricext/jasmin.cpp index bff09d06026..811a1c4d9e8 100644 --- a/src/devices/bus/oricext/jasmin.cpp +++ b/src/devices/bus/oricext/jasmin.cpp @@ -3,17 +3,23 @@ #include "emu.h" #include "jasmin.h" #include "formats/oric_dsk.h" +#include "formats/fs_oric_jasmin.h" -DEFINE_DEVICE_TYPE(JASMIN, jasmin_device, "jasmin", "Jasmin floppy drive interface") +DEFINE_DEVICE_TYPE(ORIC_JASMIN, oric_jasmin_device, "oric_jasmin", "Jasmin floppy drive interface") ROM_START( jasmin ) ROM_REGION( 0x800, "jasmin", 0 ) ROM_LOAD("jasmin.rom", 0, 0x800, CRC(37220e89) SHA1(70e59b8abd67092f050462abc6cb5271e4c15f01) ) ROM_END -FLOPPY_FORMATS_MEMBER( jasmin_device::floppy_formats ) - FLOPPY_ORIC_DSK_FORMAT -FLOPPY_FORMATS_END +void oric_jasmin_device::floppy_formats(format_registration &fr) +{ + fr.add_mfm_containers(); + fr.add(FLOPPY_ORIC_DSK_FORMAT); + fr.add(FLOPPY_ORIC_JASMIN_FORMAT); + + fr.add(fs::ORIC_JASMIN); +} static void jasmin_floppies(device_slot_interface &device) { @@ -22,17 +28,29 @@ static void jasmin_floppies(device_slot_interface &device) INPUT_PORTS_START( jasmin ) PORT_START("JASMIN") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Boot") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHANGED_MEMBER(DEVICE_SELF, jasmin_device, boot_pressed, 0) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Boot") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(oric_jasmin_device::boot_pressed), 0) INPUT_PORTS_END -void jasmin_device::map(address_map &map) +void oric_jasmin_device::map_io(address_space_installer &space) +{ + space.install_read_handler(0x3f4, 0x3f7, read8sm_delegate(m_fdc, FUNC(wd1770_device::read))); + space.install_write_handler(0x3f4, 0x3f7, write8sm_delegate(m_fdc, FUNC(wd1770_device::write))); + + space.install_write_handler(0x3f8, 0x3ff, write8sm_delegate(m_fdlatch, FUNC(ls259_device::write_d0))); +} + +void oric_jasmin_device::map_rom() { - map(0x3f4, 0x3f7).rw("fdc", FUNC(wd1770_device::read), FUNC(wd1770_device::write)); - map(0x3f8, 0x3ff).w(m_fdlatch, FUNC(ls259_device::write_d0)); + (*view)[2].unmap_write(0xf800, 0xffff); + (*view)[2].install_rom(0xf800, 0xffff, m_jasmin_rom); + + (*view)[3].unmap_readwrite(0xc000, 0xffff); + (*view)[3].install_rom(0xf800, 0xffff, m_jasmin_rom); } -jasmin_device::jasmin_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - oricext_device(mconfig, JASMIN, tag, owner, clock), +oric_jasmin_device::oric_jasmin_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, ORIC_JASMIN, tag, owner, clock), + device_oricext_interface(mconfig, *this), m_fdc(*this, "fdc"), m_fdlatch(*this, "fdlatch"), m_floppies(*this, "fdc:%u", 0U), @@ -41,109 +59,86 @@ jasmin_device::jasmin_device(const machine_config &mconfig, const char *tag, dev { } -jasmin_device::~jasmin_device() +oric_jasmin_device::~oric_jasmin_device() { } -void jasmin_device::device_start() +void oric_jasmin_device::device_start() { - oricext_device::device_start(); - cpu->space(AS_PROGRAM).install_device(0x0000, 0xffff, *this, &jasmin_device::map); } -const tiny_rom_entry *jasmin_device::device_rom_region() const +const tiny_rom_entry *oric_jasmin_device::device_rom_region() const { return ROM_NAME( jasmin ); } -void jasmin_device::device_add_mconfig(machine_config &config) +void oric_jasmin_device::device_add_mconfig(machine_config &config) { WD1770(config, m_fdc, 8_MHz_XTAL); - m_fdc->drq_wr_callback().set(FUNC(oricext_device::irq_w)); + m_fdc->drq_wr_callback().set(FUNC(oric_jasmin_device::irq_w)); - FLOPPY_CONNECTOR(config, "fdc:0", jasmin_floppies, "3dsdd", jasmin_device::floppy_formats); - FLOPPY_CONNECTOR(config, "fdc:1", jasmin_floppies, nullptr, jasmin_device::floppy_formats); - FLOPPY_CONNECTOR(config, "fdc:2", jasmin_floppies, nullptr, jasmin_device::floppy_formats); - FLOPPY_CONNECTOR(config, "fdc:3", jasmin_floppies, nullptr, jasmin_device::floppy_formats); + FLOPPY_CONNECTOR(config, "fdc:0", jasmin_floppies, "3dsdd", oric_jasmin_device::floppy_formats); + FLOPPY_CONNECTOR(config, "fdc:1", jasmin_floppies, nullptr, oric_jasmin_device::floppy_formats); + FLOPPY_CONNECTOR(config, "fdc:2", jasmin_floppies, nullptr, oric_jasmin_device::floppy_formats); + FLOPPY_CONNECTOR(config, "fdc:3", jasmin_floppies, nullptr, oric_jasmin_device::floppy_formats); LS259(config, m_fdlatch); // U14 - m_fdlatch->q_out_cb<0>().set(FUNC(jasmin_device::side_sel_w)); + m_fdlatch->q_out_cb<0>().set(FUNC(oric_jasmin_device::side_sel_w)); m_fdlatch->q_out_cb<1>().set(m_fdc, FUNC(wd1770_device::mr_w)); - m_fdlatch->q_out_cb<2>().set(FUNC(jasmin_device::ram_access_w)); - m_fdlatch->q_out_cb<3>().set(FUNC(jasmin_device::rom_access_w)); - m_fdlatch->q_out_cb<4>().set(FUNC(jasmin_device::select_w)); - m_fdlatch->q_out_cb<5>().set(FUNC(jasmin_device::select_w)); - m_fdlatch->q_out_cb<6>().set(FUNC(jasmin_device::select_w)); - m_fdlatch->q_out_cb<7>().set(FUNC(jasmin_device::select_w)); + m_fdlatch->q_out_cb<2>().set(FUNC(oric_jasmin_device::ram_access_w)); + m_fdlatch->q_out_cb<3>().set(FUNC(oric_jasmin_device::rom_access_w)); + m_fdlatch->q_out_cb<4>().set(FUNC(oric_jasmin_device::select_w)); + m_fdlatch->q_out_cb<5>().set(FUNC(oric_jasmin_device::select_w)); + m_fdlatch->q_out_cb<6>().set(FUNC(oric_jasmin_device::select_w)); + m_fdlatch->q_out_cb<7>().set(FUNC(oric_jasmin_device::select_w)); } -ioport_constructor jasmin_device::device_input_ports() const +ioport_constructor oric_jasmin_device::device_input_ports() const { return INPUT_PORTS_NAME( jasmin ); } -void jasmin_device::remap() +void oric_jasmin_device::remap() { if(m_fdlatch->q3_r()) { - if(m_fdlatch->q2_r()) { - bank_c000_r->set_base(ram+0xc000); - bank_e000_r->set_base(ram+0xe000); - bank_f800_r->set_base(m_jasmin_rom.target()); - bank_c000_w->set_base(ram+0xc000); - bank_e000_w->set_base(ram+0xe000); - bank_f800_w->set_base(junk_write); - } else { - bank_c000_r->set_base(junk_read); - bank_e000_r->set_base(junk_read); - bank_f800_r->set_base(m_jasmin_rom.target()); - bank_c000_w->set_base(junk_write); - bank_e000_w->set_base(junk_write); - bank_f800_w->set_base(junk_write); - } + if(m_fdlatch->q2_r()) + view->select(3); + else + view->select(2); } else { - if(m_fdlatch->q2_r()) { - bank_c000_r->set_base(ram+0xc000); - bank_e000_r->set_base(ram+0xe000); - bank_f800_r->set_base(ram+0xf800); - bank_c000_w->set_base(ram+0xc000); - bank_e000_w->set_base(ram+0xe000); - bank_f800_w->set_base(ram+0xf800); - } else { - bank_c000_r->set_base(rom+0x0000); - bank_e000_r->set_base(rom+0x2000); - bank_f800_r->set_base(rom+0x3800); - bank_c000_w->set_base(junk_write); - bank_e000_w->set_base(junk_write); - bank_f800_w->set_base(junk_write); - } + if(m_fdlatch->q2_r()) + view->select(1); + else + view->select(0); } } -INPUT_CHANGED_MEMBER(jasmin_device::boot_pressed) +INPUT_CHANGED_MEMBER(oric_jasmin_device::boot_pressed) { if(newval) { m_fdlatch->write_bit(3, 1); - cpu->reset(); + reset_w(1); + reset_w(0); } } -WRITE_LINE_MEMBER(jasmin_device::side_sel_w) +void oric_jasmin_device::side_sel_w(int state) { if(m_cur_floppy) m_cur_floppy->ss_w(state); } -WRITE_LINE_MEMBER(jasmin_device::ram_access_w) +void oric_jasmin_device::ram_access_w(int state) { remap(); } -WRITE_LINE_MEMBER(jasmin_device::rom_access_w) +void oric_jasmin_device::rom_access_w(int state) { remap(); } -WRITE_LINE_MEMBER(jasmin_device::select_w) +void oric_jasmin_device::select_w(int state) { m_cur_floppy = nullptr; for(int i=0; i != 4; i++) |