Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 37 additions & 17 deletions src/mame/ensoniq/esq5505.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@
#include "speaker.h"
#include "vfxcart.h"

#include "vfx.lh"
#include "vfxsd.lh"
#include "sd1.lh"

#include <cstdarg>
#include <cstdio>

Expand Down Expand Up @@ -235,10 +239,10 @@ class esq5505_state : public driver_device
{ }

void common(machine_config &config);
void vfx(machine_config &config, int vfx_panel_type = esqpanel2x40_vfx_device::VFX);
void vfxsd(machine_config &config, int vfx_panel_type = esqpanel2x40_vfx_device::VFX_SD);
void sd1(machine_config &config, int vfx_panel_type = esqpanel2x40_vfx_device::SD_1);
void sd132(machine_config &config, int vfx_panel_type = esqpanel2x40_vfx_device::SD_1_32);
void vfx(machine_config &config);
void vfxsd(machine_config &config);
void sd1(machine_config &config);
void sd132(machine_config &config);
void eps(machine_config &config);
void common32(machine_config &config);
void sq1(machine_config &config);
Expand Down Expand Up @@ -478,6 +482,13 @@ void esq5505_state::eps_cpu_space_map(address_map &map)
void esq5505_state::machine_start()
{
LOG("machine_start()\n");

esqpanel2x40_vfx_device *vfx_panel = downcast<esqpanel2x40_vfx_device *>(static_cast<esqpanel_device *>(m_panel));
if (vfx_panel != nullptr)
{
vfx_panel->connect_io_ports(*this);
}

if (m_floppy_connector) {
floppy_image_device *floppy = m_floppy_connector->get_device();
if (floppy) {
Expand Down Expand Up @@ -825,14 +836,16 @@ void esq5505_state::common(machine_config &config)
m_otis->add_route(7, "pump", 1.0, 7);
}

void esq5505_state::vfx(machine_config &config, int panel_type)
void esq5505_state::vfx(machine_config &config)
{
common(config);

ESQPANEL2X40_VFX(config, m_panel, panel_type);
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));

config.set_default_layout(layout_vfx);

ENSONIQ_VFX_CARTRIDGE_SLOT(config, m_cartslot);
m_cartslot->option_add_internal("cart", ENSONIQ_VFX_CARTRIDGE);
m_cartslot->set_default_option("cart");
Expand Down Expand Up @@ -865,14 +878,16 @@ void esq5505_state::eps(machine_config &config)
m_dmac->dma_write<0>().set(m_fdc, FUNC(wd1772_device::data_w));
}

void esq5505_state::vfxsd(machine_config &config, int panel_type)
void esq5505_state::vfxsd(machine_config &config)
{
// Like the VFX, but passing through the panel type
vfx(config, panel_type);
// Like the VFX
vfx(config);
// 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);
// and its own layout
config.set_default_layout(layout_vfxsd);

SPEAKER(config, "aux", 2).front();
m_pump->add_route(2, "aux", 1.0, 0);
Expand All @@ -883,19 +898,20 @@ void esq5505_state::vfxsd(machine_config &config, int panel_type)
FLOPPY_CONNECTOR(config, m_floppy_connector, esq5505_state::floppy_drives, "35dd", esq5505_state::floppy_formats, true).enable_sound(true);
}

void esq5505_state::sd1(machine_config &config, int panel_type)
void esq5505_state::sd1(machine_config &config)
{
// Like the VFX-SD but with its own panel type
vfxsd(config, panel_type);
// Like the VFX-SD
vfxsd(config);
// but with its own layout
config.set_default_layout(layout_sd1);
}

// Like the sd1, but with some clock speeds faster.
void esq5505_state::sd132(machine_config &config, int panel_type)
void esq5505_state::sd132(machine_config &config)
{
auto clock = 30.47618_MHz_XTAL / 2;

// Like the SD-1 but with its own panel type
sd1(config, panel_type);
sd1(config);

m_maincpu->set_clock(clock);
m_otis->set_clock(clock);
Expand Down Expand Up @@ -986,6 +1002,10 @@ void esq5505_state::ks32(machine_config &config)
}

static INPUT_PORTS_START( vfx )
esqpanel2x40_vfx_device::add_io_ports(owner, configurer, "panel");
INPUT_PORTS_END

static INPUT_PORTS_START( eps )
#if KEYBOARD_HACK
PORT_START("KEY0")
PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(esq5505_state::key_stroke), 0x80)
Expand Down Expand Up @@ -1285,10 +1305,10 @@ void esq5505_state::init_denib()
} // Anonymous namespace


CONS( 1988, eps, 0, 0, eps, vfx, esq5505_state, init_eps, "Ensoniq", "EPS", MACHINE_NOT_WORKING ) // custom VFD: one alphanumeric 22-char row, one graphics-capable row (alpha row can also do bar graphs)
CONS( 1988, eps, 0, 0, eps, eps, esq5505_state, init_eps, "Ensoniq", "EPS", MACHINE_NOT_WORKING ) // custom VFD: one alphanumeric 22-char row, one graphics-capable row (alpha row can also do bar graphs)
CONS( 1989, vfx, 0, 0, vfx, vfx, esq5505_state, init_denib, "Ensoniq", "VFX", MACHINE_NOT_WORKING ) // 2x40 VFD
CONS( 1989, vfxsd, 0, 0, vfxsd, vfx, esq5505_state, init_denib, "Ensoniq", "VFX-SD", MACHINE_NOT_WORKING ) // 2x40 VFD
CONS( 1990, eps16p, eps, 0, eps, vfx, esq5505_state, init_eps, "Ensoniq", "EPS-16 Plus", MACHINE_NOT_WORKING ) // custom VFD: one alphanumeric 22-char row, one graphics-capable row (alpha row can also do bar graphs)
CONS( 1990, eps16p, eps, 0, eps, eps, esq5505_state, init_eps, "Ensoniq", "EPS-16 Plus", MACHINE_NOT_WORKING ) // custom VFD: one alphanumeric 22-char row, one graphics-capable row (alpha row can also do bar graphs)
CONS( 1990, sd1, 0, 0, sd1, vfx, esq5505_state, init_denib, "Ensoniq", "SD-1 (21 voice)", MACHINE_NOT_WORKING ) // 2x40 VFD
CONS( 1990, sq1, 0, 0, sq1, sq1, esq5505_state, init_sq1, "Ensoniq", "SQ-1", MACHINE_NOT_WORKING ) // 2x16 LCD
CONS( 1990, sqrack, sq1, 0, sq1, sq1, esq5505_state, init_sq1, "Ensoniq", "SQ-Rack", MACHINE_NOT_WORKING ) // 2x16 LCD
Expand Down
108 changes: 51 additions & 57 deletions src/mame/ensoniq/esqpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#include "main.h"

#include "esq2by40_vfx.lh"
#include "vfx.lh"
#include "vfxsd.lh"
#include "sd1.lh"

#include <algorithm>

Expand Down Expand Up @@ -714,32 +711,61 @@ esqpanel2x40_device::esqpanel2x40_device(const machine_config &mconfig, const ch
void esqpanel2x40_vfx_device::device_add_mconfig(machine_config &config)
{
ESQ2X40_VFX(config, m_vfd, 60);

if (m_panel_type == VFX)
config.set_default_layout(layout_vfx);
else if (m_panel_type == VFX_SD)
config.set_default_layout(layout_vfxsd);
else if (m_panel_type == SD_1 || m_panel_type == SD_1_32)
config.set_default_layout(layout_sd1);
else // lowest common demonimator as the default: just the VFD.
config.set_default_layout(layout_esq2by40_vfx);
config.set_default_layout(layout_esq2by40_vfx);
}

esqpanel2x40_vfx_device::esqpanel2x40_vfx_device(const machine_config &mconfig, const char *tag, device_t *owner, int panel_type, uint32_t clock) :
esqpanel2x40_vfx_device::esqpanel2x40_vfx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
esqpanel_device(mconfig, ESQPANEL2X40_VFX, tag, owner, clock),
m_panel_type(panel_type),
m_vfd(*this, "vfd"),
m_lights(*this, "lights"),
m_buttons_0(*this, "buttons_0"),
m_buttons_32(*this, "buttons_32"),
m_analog_data_entry(*this, "analog_data_entry"),
m_analog_volume(*this, "analog_volume")
m_lights(*this, "lights")
{
m_eps_mode = false;
// The VFX family have 16 lights on the panel.
m_light_states.resize(16);
}

// Adds these input ports to the owning device, so that it can load the layout and the layout
// still find the io ports; but with callbacks going to the esqpanel2x40_vfx_device instance
// with the specified tag.
void esqpanel2x40_vfx_device::add_io_ports(device_t &owner, ioport_configurer &configurer, const char *tag) {
PORT_START("panel_buttons_0")
for (int i = 0; i < 32; i++)
{
PORT_BIT((1 << i), IP_ACTIVE_HIGH, IPT_KEYBOARD);
PORT_CHANGED_MEMBER(tag, FUNC(esqpanel2x40_vfx_device::button_change), i)
}

PORT_START("panel_buttons_32")
for (int i = 0; i < 32; i++)
{
PORT_BIT((1 << i), IP_ACTIVE_HIGH, IPT_KEYBOARD);
PORT_CHANGED_MEMBER(tag, FUNC(esqpanel2x40_vfx_device::button_change), 32 + i)
}

PORT_START("panel_analog_data_entry")
// An adjuster, but with range 0 .. 1023, to match the 10 bit resolution of the OTIS ADC
configurer.field_alloc(IPT_ADJUSTER, 0x200, 0x3ff, "Data Entry");
configurer.field_set_min_max(0, 0x3ff);
PORT_CHANGED_MEMBER(tag, FUNC(esqpanel2x40_vfx_device::analog_value_change), 3)

PORT_START("panel_analog_volume")
// An adjuster, but with range 0 .. 1023, to match the 10 bit resolution of the OTIS ADC
configurer.field_alloc(IPT_ADJUSTER, 0x3ff, 0x3ff, "Volume");
configurer.field_set_min_max(0, 0x3ff);
PORT_CHANGED_MEMBER(tag, FUNC(esqpanel2x40_vfx_device::analog_value_change), 5)
}

// Because the io ports now belong to another device, it needs to tell us where to find them,
// so that we can read and write them if we need to. This allows the owner of the io ports to do just that.
void esqpanel2x40_vfx_device::connect_io_ports(device_t &device)
{
LOG("Connecting IO ports\n");
m_buttons_0 = device.ioport("panel_buttons_0");
m_buttons_32 = device.ioport("panel_buttons_32");
m_analog_data_entry = device.ioport("panel_analog_data_entry");
m_analog_volume = device.ioport("panel_analog_volume");
}

bool esqpanel2x40_vfx_device::write_contents(std::ostream &o)
{
m_vfd->write_contents(o);
Expand Down Expand Up @@ -795,40 +821,6 @@ void esqpanel2x40_vfx_device::device_reset()
}
}

static INPUT_PORTS_START(esqpanel2x40_vfx_device)
PORT_START("buttons_0")
for (int i = 0; i < 32; i++)
{
PORT_BIT((1 << i), IP_ACTIVE_HIGH, IPT_KEYBOARD);
PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(esqpanel2x40_vfx_device::button_change), i)
}

PORT_START("buttons_32")
for (int i = 0; i < 32; i++)
{
PORT_BIT((1 << i), IP_ACTIVE_HIGH, IPT_KEYBOARD);
PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(esqpanel2x40_vfx_device::button_change), 32 + i)
}

PORT_START("analog_data_entry")
// An adjuster, but with range 0 .. 1023, to match the 10 bit resolution of the OTIS ADC
configurer.field_alloc(IPT_ADJUSTER, 0x200, 0x3ff, "Data Entry");
configurer.field_set_min_max(0, 0x3ff);
PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(esqpanel2x40_vfx_device::analog_value_change), 3)

PORT_START("analog_volume")
// An adjuster, but with range 0 .. 1023, to match the 10 bit resolution of the OTIS ADC
configurer.field_alloc(IPT_ADJUSTER, 0x3ff, 0x3ff, "Volume");
configurer.field_set_min_max(0, 0x3ff);
PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(esqpanel2x40_vfx_device::analog_value_change), 5)

INPUT_PORTS_END

ioport_constructor esqpanel2x40_vfx_device::device_input_ports() const
{
return INPUT_PORTS_NAME(esqpanel2x40_vfx_device);
}

// A button is pressed on the internal panel
INPUT_CHANGED_MEMBER(esqpanel2x40_vfx_device::button_change)
{
Expand All @@ -845,17 +837,19 @@ INPUT_CHANGED_MEMBER(esqpanel2x40_vfx_device::analog_value_change)
esqpanel_device::set_analog_value(channel, value);
}

ioport_value esqpanel2x40_vfx_device::get_adjuster_value(required_ioport &ioport)
ioport_value esqpanel2x40_vfx_device::get_adjuster_value(ioport_port *port)
{
auto field = ioport->fields().first();
if (!port) return 0;
auto field = port->fields().first();
ioport_field::user_settings user_settings;
field->get_user_settings(user_settings);
return user_settings.value;
}

void esqpanel2x40_vfx_device::set_adjuster_value(required_ioport &ioport, const ioport_value & value)
void esqpanel2x40_vfx_device::set_adjuster_value(ioport_port *port, const ioport_value &value)
{
auto field = ioport->fields().first();
if (!port) return;
auto field = port->fields().first();
ioport_field::user_settings user_settings;
field->get_user_settings(user_settings);
user_settings.value = value;
Expand Down
28 changes: 9 additions & 19 deletions src/mame/ensoniq/esqpanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,18 @@ class esqpanel2x40_device : public esqpanel_device {

class esqpanel2x40_vfx_device : public esqpanel_device {
public:
esqpanel2x40_vfx_device(const machine_config &mconfig, const char *tag, device_t *owner, int panel_type = UNKNOWN, uint32_t clock = 0);
esqpanel2x40_vfx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);

DECLARE_INPUT_CHANGED_MEMBER(button_change);
DECLARE_INPUT_CHANGED_MEMBER(analog_value_change);

void set_family_member(int family_member);

enum panel_types : int {
UNKNOWN = 0,
VFX,
VFX_SD,
SD_1,
SD_1_32
};
static void add_io_ports(device_t &owner, ioport_configurer &configurer, const char *tag);
void connect_io_ports(device_t &device);

protected:
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;
virtual ioport_constructor device_input_ports() const override;
virtual void send_to_display(uint8_t data) override { m_vfd->write_char(data); }

virtual const std::string get_front_panel_html_file() const override { return "/esqpanel/vfx/FrontPanel.html"; }
Expand All @@ -136,25 +128,23 @@ class esqpanel2x40_vfx_device : public esqpanel_device {
static constexpr uint8_t AT_BLINK = 0x02;

private:
int m_panel_type;

emu_timer *m_blink_timer = nullptr;
uint8_t m_blink_phase;

required_device<esq2x40_vfx_device> m_vfd;

output_finder<> m_lights;

required_ioport m_buttons_0;
required_ioport m_buttons_32;
required_ioport m_analog_data_entry;
required_ioport m_analog_volume;
ioport_port *m_buttons_0 = nullptr;
ioport_port *m_buttons_32 = nullptr;
ioport_port *m_analog_data_entry = nullptr;
ioport_port *m_analog_volume = nullptr;

TIMER_CALLBACK_MEMBER(update_blink);
void update_lights();

ioport_value get_adjuster_value(required_ioport &ioport);
void set_adjuster_value(required_ioport &ioport, const ioport_value & value);
ioport_value get_adjuster_value(ioport_port *port);
void set_adjuster_value(ioport_port *port, const ioport_value &value);
};

class esqpanel2x40_sq1_device : public esqpanel_device {
Expand Down
Loading
Loading