summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/ensoniq/esq5505.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/ensoniq/esq5505.cpp')
-rw-r--r--src/mame/ensoniq/esq5505.cpp303
1 files changed, 37 insertions, 266 deletions
diff --git a/src/mame/ensoniq/esq5505.cpp b/src/mame/ensoniq/esq5505.cpp
index 4fa94ff78bb..55ffb68347f 100644
--- a/src/mame/ensoniq/esq5505.cpp
+++ b/src/mame/ensoniq/esq5505.cpp
@@ -178,15 +178,14 @@
#include "sound/esqpump.h"
#include "emupal.h"
#include "speaker.h"
-#include "vfxcart.h"
#include <cstdarg>
#include <cstdio>
// #define VERBOSE 1
-#define VERBOSE 0
#include "logmacro.h"
+
namespace {
enum esq5505_system_type : int {
@@ -224,7 +223,6 @@ public:
, m_pump(*this, "pump")
, m_fdc(*this, "wd1772")
, m_floppy_connector(*this, "wd1772:0")
- , m_cartslot(*this, "cartslot")
, m_panel(*this, "panel")
, m_dmac(*this, "mc68450")
, m_mdout(*this, "mdout")
@@ -262,7 +260,6 @@ private:
required_device<esq_5505_5510_pump_device> m_pump;
optional_device<wd1772_device> m_fdc;
optional_device<floppy_connector> m_floppy_connector;
- optional_device<ensoniq_vfx_cartslot> m_cartslot;
required_device<esqpanel_device> m_panel;
optional_device<hd63450_device> m_dmac;
required_device<midi_port_device> m_mdout;
@@ -283,18 +280,7 @@ private:
int m_system_type = 0;
uint8_t m_duart_io = 0;
- bool m_otis_irq = false;
- bool m_floppy_dskchg = false;
- bool m_docirq = false;
- bool m_floppy_is_loaded = false;
- bool m_floppy_is_active = false;
- emu_timer *m_motor_on_timer;
- emu_timer *m_dskchg_reset_timer;
-
- TIMER_CALLBACK_MEMBER(floppy_motor_on);
- TIMER_CALLBACK_MEMBER(floppy_dskchg_reset);
-
- static void floppy_drives(device_slot_interface &device);
+
static void floppy_formats(format_registration &fr);
void eps_map(address_map &map) ATTR_COLD;
@@ -305,164 +291,15 @@ private:
void cpu_space_map(address_map &map) ATTR_COLD;
void eps_cpu_space_map(address_map &map) ATTR_COLD;
- void update_floppy_inputs();
- void floppy_loaded(bool loaded);
- void floppy_load(floppy_image_device *floppy);
- void floppy_unload(floppy_image_device *floppy);
- void cartridge_loaded(bool loaded);
- void cartridge_load(ensoniq_vfx_cartridge *cart);
- void cartridge_unload(ensoniq_vfx_cartridge *cart);
-
- void update_docirq_to_maincpu();
- void otis_irq(int irq);
-
uint16_t m_analog_values[8];
};
-void esq5505_state::cartridge_loaded(bool loaded)
-{
- if (m_cartslot)
- {
- LOG("Cartridge %s\n", loaded ? "Inserted" : "Ejected");
- int state = loaded ? CLEAR_LINE : ASSERT_LINE;
-
- // On VFX and later, DUART input bit 1 is 0 for cartridge present.
- LOG("ip1 -> %d\n", state);
- m_duart->ip1_w(state);
- }
- else
- {
- LOG("<No Cartridge slot for loaded=%d>\n", loaded);
- }
-}
-
-void esq5505_state::cartridge_load(ensoniq_vfx_cartridge *cart)
-{
- (void) cart;
- cartridge_loaded(true);
-}
-
-void esq5505_state::cartridge_unload(ensoniq_vfx_cartridge *cart)
-{
- (void) cart;
- cartridge_loaded(false);
-}
-
-void esq5505_state::floppy_drives(device_slot_interface &device)
-{
- device.option_add_internal("35dd", FLOPPY_35_DD);
-}
-
void esq5505_state::floppy_formats(format_registration &fr)
{
fr.add_mfm_containers();
fr.add(FLOPPY_ESQIMG_FORMAT);
}
-TIMER_CALLBACK_MEMBER(esq5505_state::floppy_motor_on)
-{
- bool motor_on = param;
- if (m_floppy_connector)
- {
- floppy_image_device *floppy = m_floppy_connector->get_device();
- if (floppy)
- floppy->mon_w(motor_on ? CLEAR_LINE : ASSERT_LINE); // active low
- }
-}
-
-TIMER_CALLBACK_MEMBER(esq5505_state::floppy_dskchg_reset)
-{
- m_floppy_dskchg = !m_floppy_is_loaded;
- LOG("Resetting floppy_dskchg -> %s\n", m_floppy_dskchg ? "true" : "false");
- update_docirq_to_maincpu();
-}
-
-void esq5505_state::update_floppy_inputs()
-{
- // update the "Disk Ready" input
- int state = (m_floppy_is_active && m_floppy_is_loaded) ? ASSERT_LINE : CLEAR_LINE;
-#if VERBOSE
- static int prev_state = 0;
- if (prev_state != state) LOG("ip0 -> %d\n", state);
- prev_state = state;
-#endif
- m_duart->ip0_w(state);
-
- // Also update the DOC IRQ in case there's a pending disk change to handle.
- update_docirq_to_maincpu();
-}
-
-void esq5505_state::floppy_loaded(bool loaded)
-{
- if (m_floppy_connector)
- {
- m_floppy_is_loaded = loaded;
- if (!loaded)
- {
- // Only set m_floppy_dskchg; it will be reset a short time after
- // the disk has been enabled while m_floppy_dskchg is true.
- m_floppy_dskchg = true;
- }
-
- LOG("Floppy %s\n", loaded ? "Inserted" : "Ejected");
- update_floppy_inputs();
- }
- else
- {
- LOG("<No Floppy connector for loaded=%d>\n", loaded);
- }
-}
-
-void esq5505_state::floppy_load(floppy_image_device *floppy)
-{
- (void) floppy;
- floppy_loaded(true);
-}
-
-void esq5505_state::floppy_unload(floppy_image_device *floppy)
-{
- (void) floppy;
- floppy_loaded(false);
-}
-
-void esq5505_state::update_docirq_to_maincpu()
-{
- bool floppy_dskchg_irq = m_floppy_is_active && m_floppy_dskchg;
- if (floppy_dskchg_irq) LOG("docirq (m68k_irq1) due to disk change = %d\n", floppy_dskchg_irq);
- if (floppy_dskchg_irq && m_floppy_is_loaded)
- {
- // The drives that Ensoniq use only _pulse_ DSKCHG for a brief time, when a disk is in the drive.
- // schedule a reset.
- LOG("Scheduling DSKCHG reset\n");
- m_dskchg_reset_timer->adjust(attotime::from_nsec(500));
- }
- bool v = m_otis_irq || floppy_dskchg_irq;
- if (v != m_docirq)
- {
- LOG("docirq (m68k_irq1) -> %d\n", v);
- m_maincpu->set_input_line(M68K_IRQ_1, v);
- m_docirq = v;
- }
- else
- {
- // LOG("m68k irq1 -- %d\n", v);
- }
-}
-
-void esq5505_state::otis_irq(int irq)
-{
- if (irq != m_otis_irq)
- {
- // LOG("otis_irq -> %d\n", irq);
- m_otis_irq = irq;
- update_docirq_to_maincpu();
- }
- else
- {
- // LOG("otis_irq -- %d\n", irq);
- }
-}
-
void esq5505_state::cpu_space_map(address_map &map)
{
map(0xfffff0, 0xffffff).m(m_maincpu, FUNC(m68000_base_device::autovectors_map));
@@ -477,73 +314,11 @@ void esq5505_state::eps_cpu_space_map(address_map &map)
void esq5505_state::machine_start()
{
- LOG("machine_start()\n");
- if (m_floppy_connector) {
- floppy_image_device *floppy = m_floppy_connector->get_device();
- if (floppy) {
- floppy->setup_load_cb(floppy_image_device::load_cb(&esq5505_state::floppy_load, this));
- floppy->setup_unload_cb(floppy_image_device::unload_cb(&esq5505_state::floppy_unload, this));
-
- m_motor_on_timer = timer_alloc(FUNC(esq5505_state::floppy_motor_on), this);
- m_dskchg_reset_timer = timer_alloc(FUNC(esq5505_state::floppy_dskchg_reset), this);
-
- // Set DSKCHG according to whether there is a floppy in the drive.
- if (floppy->exists()) {
- LOG("\nFloppy Drive has Floppy '%s'\n", floppy->filename());
- m_floppy_dskchg = false;
- } else {
- LOG("\nFloppy Drive has No Floppy\n");
- m_floppy_dskchg = true;
- }
- } else {
- LOG("\nFloppy Drive has No Image Device!\n");
- }
- } else {
- LOG("\nNo Floppy Drive\n");
- }
-
- if (m_cartslot) {
- ensoniq_vfx_cartridge *cart = m_cartslot->get_card_device();
-
- if (cart) {
- cart->setup_load_cb(ensoniq_vfx_cartridge::load_cb(&esq5505_state::cartridge_load, this));
- cart->setup_unload_cb(ensoniq_vfx_cartridge::unload_cb(&esq5505_state::cartridge_unload, this));
-
- if (cart->exists()) {
- LOG("\nCartridge Slot has Cartridge '%s'\n", cart->filename());
- } else {
- LOG("\nCartridge Slot has No Cartridge\n");
- }
- } else {
- LOG("\nCartridge Slot has No Image Device!\n");
- }
- } else {
- LOG("\nNo Cartridge Slot\n");
- }
-
- // Set up the load / unload callbacks for floppy and cartridge here
}
void esq5505_state::machine_reset()
{
- // Check our image devices for load status.
- if (m_floppy_connector) {
- floppy_image_device *floppy = m_floppy_connector->get_device();
- if (floppy && floppy->exists()) {
- floppy_load(floppy);
- } else {
- floppy_unload(floppy);
- }
- }
-
- if (m_cartslot) {
- ensoniq_vfx_cartridge *cart = m_cartslot->get_card_device();
- if (cart && cart->exists()) {
- cartridge_load(cart);
- } else {
- cartridge_unload(cart);
- }
- }
+ floppy_image_device *floppy = m_floppy_connector ? m_floppy_connector->get_device() : nullptr;
// Default analog values: all values are 10 bits, left-justified within 16 bits.
m_analog_values[0] = 0x7fc0; // pitch mod: start in the center
@@ -554,6 +329,27 @@ void esq5505_state::machine_reset()
m_analog_values[5] = 0xffc0; // Volume control: full on.
m_analog_values[6] = 0x7fc0; // Battery voltage: something reasonable.
m_analog_values[7] = 0x5540; // vRef to check battery.
+
+ // on VFX, bit 0 is 1 for 'cartridge present'.
+ // on VFX-SD and later, bit 0 is2 1 for floppy present, bit 1 is 1 for cartridge present
+ if (strcmp(machine().system().name, "vfx") == 0)
+ {
+ // todo: handle VFX cart-in when we support cartridges
+ m_duart->ip0_w(ASSERT_LINE);
+ }
+ else
+ {
+ m_duart->ip1_w(CLEAR_LINE);
+
+ if (floppy)
+ {
+ m_duart->ip0_w(CLEAR_LINE);
+ }
+ else
+ {
+ m_duart->ip0_w(ASSERT_LINE);
+ }
+ }
}
uint16_t esq5505_state::lower_r(offs_t offset)
@@ -597,7 +393,6 @@ void esq5505_state::vfx_map(address_map &map)
map(0x200000, 0x20001f).rw("otis", FUNC(es5505_device::read), FUNC(es5505_device::write));
map(0x280000, 0x28001f).rw(m_duart, FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0x00ff);
map(0x260000, 0x2601ff).rw(m_esp, FUNC(es5510_device::host_r), FUNC(es5510_device::host_w)).umask16(0x00ff);
- map(0x2e0000, 0x2fffff).rw(m_cartslot, FUNC(ensoniq_vfx_cartslot::read), FUNC(ensoniq_vfx_cartslot::write)).umask16(0x00ff);
map(0xc00000, 0xc1ffff).rom().region("osrom", 0);
map(0xff0000, 0xffffff).ram().share("osram");
}
@@ -609,7 +404,6 @@ void esq5505_state::vfxsd_map(address_map &map)
map(0x280000, 0x28001f).rw(m_duart, FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0x00ff);
map(0x260000, 0x2601ff).rw(m_esp, FUNC(es5510_device::host_r), FUNC(es5510_device::host_w)).umask16(0x00ff);
map(0x2c0000, 0x2c0007).rw(m_fdc, FUNC(wd1772_device::read), FUNC(wd1772_device::write)).umask16(0x00ff);
- map(0x2e0000, 0x2fffff).rw(m_cartslot, FUNC(ensoniq_vfx_cartslot::read), FUNC(ensoniq_vfx_cartslot::write)).umask16(0x00ff);
map(0x330000, 0x37ffff).ram().share("seqram");
map(0xc00000, 0xc3ffff).rom().region("osrom", 0);
map(0xff0000, 0xffffff).ram().share("osram");
@@ -672,7 +466,7 @@ void esq5505_state::duart_output(uint8_t data)
VFX-SD & SD-1 (32):
bits 0/1/2 = analog sel
bit 3 = SSEL (disk side)
- bit 4 = DSEL (Drive Delect and floppy Motor On)
+ bit 4 = DSEL (drive select?)
bit 6 = ESPHALT
bit 7 = SACK (?)
*/
@@ -702,23 +496,7 @@ void esq5505_state::duart_output(uint8_t data)
}
else
{
- floppy->ss_w(((data & 8) >> 3) ^ 1); // bit 3, inverted -> floppy
- m_floppy_is_active = (data & 16) != 0; // bit 4 is used to activate the floppy:
- if (m_floppy_is_active)
- {
- // immediately assert DISK SELECT (active low)
- floppy->ds_w(CLEAR_LINE);
- // but schedule a delayed MOTOR ON, since the keyboard constantly pulses this after a file has been read.
- m_motor_on_timer->adjust(attotime::from_usec(100), 1);
- }
- else
- {
- // immediately deassert DISK SELECT (active low)
- floppy->ds_w(ASSERT_LINE);
- // but schedule a slightly delayed MOTOR OFF, since the keyboard sometimes seems to pulse this.
- m_motor_on_timer->adjust(attotime::from_usec(50), 0);
- }
- update_floppy_inputs();
+ floppy->ss_w(((data & 8)>>3)^1);
}
}
@@ -813,7 +591,7 @@ void esq5505_state::common(machine_config &config)
m_otis->set_region0("waverom"); /* Bank 0 */
m_otis->set_region1("waverom2"); /* Bank 1 */
m_otis->set_channels(4); /* channels */
- m_otis->irq_cb().set(FUNC(esq5505_state::otis_irq));
+ m_otis->irq_cb().set_inputline(m_maincpu, M68K_IRQ_1);
m_otis->read_port_cb().set(FUNC(esq5505_state::analog_r)); /* ADC */
m_otis->add_route(0, "pump", 1.0, 0);
m_otis->add_route(1, "pump", 1.0, 1);
@@ -833,11 +611,6 @@ void esq5505_state::vfx(machine_config &config, int panel_type)
m_panel->write_tx().set(m_duart, FUNC(mc68681_device::rx_b_w));
m_panel->write_analog().set(FUNC(esq5505_state::analog_w));
- ENSONIQ_VFX_CARTRIDGE_SLOT(config, m_cartslot);
- m_cartslot->option_add_internal("cart", ENSONIQ_VFX_CARTRIDGE);
- m_cartslot->set_default_option("cart");
- m_cartslot->set_fixed(true);
-
NVRAM(config, m_osram_nvram, nvram_device::DEFAULT_NONE);
}
@@ -854,7 +627,10 @@ void esq5505_state::eps(machine_config &config)
m_panel->write_analog().set(FUNC(esq5505_state::analog_w));
WD1772(config, m_fdc, 8_MHz_XTAL);
- FLOPPY_CONNECTOR(config, m_floppy_connector, esq5505_state::floppy_drives, "35dd", esq5505_state::floppy_formats, true);//.enable_sound(true);
+ FLOPPY_CONNECTOR(config, m_floppy_connector);
+ m_floppy_connector->option_add("35dd", FLOPPY_35_DD);
+ m_floppy_connector->set_default_option("35dd");
+ m_floppy_connector->set_formats(esq5505_state::floppy_formats);
HD63450(config, m_dmac, 10_MHz_XTAL); // MC68450 compatible
m_dmac->set_cpu_tag(m_maincpu);
@@ -867,9 +643,7 @@ void esq5505_state::eps(machine_config &config)
void esq5505_state::vfxsd(machine_config &config, int panel_type)
{
- // Like the VFX, but passing through the panel type
vfx(config, panel_type);
- // but with an updated memory map that includes FDC and sequence RAM
m_maincpu->set_addrmap(AS_PROGRAM, &esq5505_state::vfxsd_map);
// and nvram for the sequencer RAM as well
NVRAM(config, m_seqram_nvram, nvram_device::DEFAULT_NONE);
@@ -878,9 +652,11 @@ void esq5505_state::vfxsd(machine_config &config, int panel_type)
m_pump->add_route(2, "aux", 1.0, 0);
m_pump->add_route(3, "aux", 1.0, 1);
- // On the VFX-SD, the floppy connector always has exactly one 3.5inch DD floppy drive.
WD1772(config, m_fdc, 8000000);
- FLOPPY_CONNECTOR(config, m_floppy_connector, esq5505_state::floppy_drives, "35dd", esq5505_state::floppy_formats, true).enable_sound(true);
+ FLOPPY_CONNECTOR(config, m_floppy_connector);
+ m_floppy_connector->option_add("35dd", FLOPPY_35_DD);
+ m_floppy_connector->set_default_option("35dd");
+ m_floppy_connector->set_formats(esq5505_state::floppy_formats);
}
void esq5505_state::sd1(machine_config &config, int panel_type)
@@ -912,11 +688,6 @@ void esq5505_state::common32(machine_config &config)
ES5510(config, m_esp, 10_MHz_XTAL);
m_esp->set_disable();
- ENSONIQ_VFX_CARTRIDGE_SLOT(config, m_cartslot);
- m_cartslot->option_add_internal("cart", ENSONIQ_VFX_CARTRIDGE);
- m_cartslot->set_default_option("cart");
- m_cartslot->set_fixed(true);
-
ESQPANEL2X40_VFX(config, m_panel);
m_panel->write_tx().set(m_duart, FUNC(mc68681_device::rx_b_w));
m_panel->write_analog().set(FUNC(esq5505_state::analog_w));
@@ -950,7 +721,7 @@ void esq5505_state::common32(machine_config &config)
m_otis->set_region0("waverom"); /* Bank 0 */
m_otis->set_region1("waverom2"); /* Bank 1 */
m_otis->set_channels(4); /* channels */
- m_otis->irq_cb().set(FUNC(esq5505_state::otis_irq));
+ m_otis->irq_cb().set_inputline(m_maincpu, M68K_IRQ_1);
m_otis->read_port_cb().set(FUNC(esq5505_state::analog_r)); /* ADC */
m_otis->add_route(0, "pump", 1.0, 0);
m_otis->add_route(1, "pump", 1.0, 1);
@@ -962,7 +733,7 @@ void esq5505_state::common32(machine_config &config)
m_otis->add_route(7, "pump", 1.0, 7);
WD1772(config, m_fdc, 8000000);
- FLOPPY_CONNECTOR(config, m_floppy_connector, esq5505_state::floppy_drives, "35dd", esq5505_state::floppy_formats, true).enable_sound(true);
+ FLOPPY_CONNECTOR(config, m_floppy_connector, "35dd", FLOPPY_35_DD, true, floppy_formats);
}
void esq5505_state::sq1(machine_config &config)