mirror of
https://github.com/holub/mame
synced 2025-07-05 18:08:04 +03:00
n68681: preliminary working diserial-based I/O [R. Belmont]
This commit is contained in:
parent
52bbb15193
commit
7bc847a37f
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -7023,6 +7023,8 @@ src/mess/machine/epson_sio.c svneol=native#text/plain
|
||||
src/mess/machine/epson_sio.h svneol=native#text/plain
|
||||
src/mess/machine/er59256.c svneol=native#text/plain
|
||||
src/mess/machine/er59256.h svneol=native#text/plain
|
||||
src/mess/machine/esqpanel.c svneol=native#text/plain
|
||||
src/mess/machine/esqpanel.h svneol=native#text/plain
|
||||
src/mess/machine/esqvfd.c svneol=native#text/plain
|
||||
src/mess/machine/esqvfd.h svneol=native#text/plain
|
||||
src/mess/machine/europc.c svneol=native#text/plain
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,14 +3,25 @@
|
||||
|
||||
#include "diserial.h"
|
||||
|
||||
#define MCFG_DUARTN68681_ADD(_tag, _clock, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, DUARTN68681, _clock) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
#define MCFG_DUARTN68681_REPLACE(_tag, _clock, _config) \
|
||||
MCFG_DEVICE_REPLACE(_tag, DUARTN68681, _clock) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
#define MCFG_DUART68681_CHANNEL_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, DUART68681CHANNEL, 0) \
|
||||
|
||||
// forward declaration
|
||||
class duartn68681_device;
|
||||
|
||||
struct duartn68681_config
|
||||
{
|
||||
devcb_write_line m_out_irq_cb;
|
||||
devcb_write8 m_out_a_tx_cb;
|
||||
devcb_write8 m_out_b_tx_cb;
|
||||
devcb_write_line m_out_a_tx_cb;
|
||||
devcb_write_line m_out_b_tx_cb;
|
||||
devcb_read8 m_in_port_cb;
|
||||
devcb_write8 m_out_port_cb;
|
||||
|
||||
@ -20,8 +31,32 @@ struct duartn68681_config
|
||||
|
||||
#define MC68681_RX_FIFO_SIZE 3
|
||||
|
||||
struct DUART68681_CHANNEL
|
||||
// forward declaration
|
||||
class duartn68681_device;
|
||||
|
||||
// n68681 channel class
|
||||
class duart68681_channel : public device_t, public device_serial_interface
|
||||
{
|
||||
public:
|
||||
duart68681_channel(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
// device_serial overrides
|
||||
virtual void rcv_complete(); // Rx completed receiving byte
|
||||
virtual void tra_complete(); // Tx completed sending byte
|
||||
virtual void tra_callback(); // Tx send bit
|
||||
void input_callback(UINT8 state);
|
||||
|
||||
UINT8 read_chan_reg(int reg);
|
||||
void write_chan_reg(int reg, UINT8 data);
|
||||
void update_interrupts();
|
||||
|
||||
UINT8 read_rx_fifo();
|
||||
|
||||
private:
|
||||
/* Registers */
|
||||
UINT8 CR; /* Command register */
|
||||
UINT8 CSR; /* Clock select register */
|
||||
@ -31,7 +66,7 @@ struct DUART68681_CHANNEL
|
||||
UINT8 SR; /* Status register */
|
||||
|
||||
/* State */
|
||||
int baud_rate;
|
||||
int tx_baud_rate, rx_baud_rate;
|
||||
|
||||
/* Receiver */
|
||||
UINT8 rx_enabled;
|
||||
@ -40,41 +75,49 @@ struct DUART68681_CHANNEL
|
||||
int rx_fifo_write_ptr;
|
||||
int rx_fifo_num;
|
||||
|
||||
int m_ch;
|
||||
|
||||
/* Transmitter */
|
||||
UINT8 tx_enabled;
|
||||
UINT8 tx_data;
|
||||
UINT8 tx_ready;
|
||||
emu_timer *tx_timer;
|
||||
|
||||
duartn68681_device *m_uart;
|
||||
|
||||
void write_MR(UINT8 data);
|
||||
void write_CR(UINT8 data);
|
||||
void write_TX(UINT8 data);
|
||||
void recalc_framing();
|
||||
};
|
||||
|
||||
class duartn68681_device : public device_t, public device_serial_interface, public duartn68681_config
|
||||
class duartn68681_device : public device_t, public duartn68681_config
|
||||
{
|
||||
friend class duart68681_channel;
|
||||
|
||||
public:
|
||||
duartn68681_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
required_device<duart68681_channel> m_chanA;
|
||||
required_device<duart68681_channel> m_chanB;
|
||||
|
||||
// API
|
||||
DECLARE_READ8_HANDLER(read);
|
||||
DECLARE_WRITE8_HANDLER(write);
|
||||
|
||||
void duart68681_rx_data(int ch, UINT8 data);
|
||||
|
||||
TIMER_CALLBACK_MEMBER( tx_timer_callback );
|
||||
TIMER_CALLBACK_MEMBER( duart_timer_callback );
|
||||
|
||||
UINT8 get_irq_vector() { return IVR; }
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_a_w ) { m_chanA->check_for_start((UINT8)state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_b_w ) { m_chanB->check_for_start((UINT8)state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
// device_serial overrides
|
||||
virtual void rcv_complete(); // Rx complete
|
||||
virtual void tra_complete(); // Tx complete
|
||||
virtual void tra_callback(); // Tx bit ready
|
||||
void input_callback(UINT8 state);
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
|
||||
private:
|
||||
TIMER_CALLBACK_MEMBER( duart_timer_callback );
|
||||
|
||||
/* registers */
|
||||
UINT8 ACR; /* Auxiliary Control Register */
|
||||
UINT8 IMR; /* Interrupt Mask Register */
|
||||
@ -91,32 +134,26 @@ private:
|
||||
UINT8 half_period;
|
||||
emu_timer *duart_timer;
|
||||
|
||||
/* UART channels */
|
||||
DUART68681_CHANNEL channel[2];
|
||||
|
||||
void update_interrupts();
|
||||
double duart68681_get_ct_rate();
|
||||
UINT16 duart68681_get_ct_count();
|
||||
void duart68681_start_ct(int count);
|
||||
void duart68681_write_MR(int ch, UINT8 data);
|
||||
void duart68681_write_CSR(int ch, UINT8 data, UINT8 ACR);
|
||||
void duart68681_write_CR(int ch, UINT8 data);
|
||||
UINT8 duart68681_read_rx_fifo(int ch);
|
||||
void duart68681_write_TX(int ch, UINT8 data);
|
||||
int calc_baud(int ch, UINT8 data);
|
||||
int get_ch(duart68681_channel *ch) { return (ch == m_chanA) ? 0 : 1; }
|
||||
void clear_ISR_bits(int mask);
|
||||
void set_ISR_bits(int mask);
|
||||
void update_interrupts();
|
||||
|
||||
duart68681_channel *get_channel(int chan);
|
||||
|
||||
devcb_resolved_write_line m_out_irq_func;
|
||||
devcb_resolved_write8 m_out_a_tx_func;
|
||||
devcb_resolved_write8 m_out_b_tx_func;
|
||||
devcb_resolved_write_line m_out_a_tx_func;
|
||||
devcb_resolved_write_line m_out_b_tx_func;
|
||||
devcb_resolved_read8 m_in_port_func;
|
||||
devcb_resolved_write8 m_out_port_func;
|
||||
|
||||
};
|
||||
|
||||
#define MCFG_DUARTN68681_ADD(_tag, _clock, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, DUARTN68681, _clock) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
extern const device_type DUARTN68681;
|
||||
extern const device_type DUART68681CHANNEL;
|
||||
|
||||
#endif //_N68681_H
|
||||
|
||||
|
@ -108,13 +108,14 @@
|
||||
#include "formats/esq16_dsk.h"
|
||||
|
||||
#include "machine/esqvfd.h"
|
||||
#include "machine/esqpanel.h"
|
||||
|
||||
#define GENERIC (0)
|
||||
#define EPS (1)
|
||||
#define SQ1 (2)
|
||||
|
||||
#define KEYBOARD_HACK (1) // turn on to play the SQ-1, SD-1, and SD-1 32-voice: Z and X are program up/down, A/S/D/F/G/H/J/K/L and Q/W/E/R/T/Y/U play notes
|
||||
#define HACK_VIA_MIDI (1)
|
||||
#define HACK_VIA_MIDI (0) // won't work right now
|
||||
|
||||
#if KEYBOARD_HACK
|
||||
#if HACK_VIA_MIDI
|
||||
@ -132,18 +133,18 @@ public:
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_duart(*this, "duart"),
|
||||
m_fdc(*this, "wd1772"),
|
||||
m_epsvfd(*this, "epsvfd"),
|
||||
m_sq1vfd(*this, "sq1vfd"),
|
||||
m_vfd(*this, "vfd"),
|
||||
m_epspanel(*this, "epspanel"),
|
||||
m_sq1panel(*this, "sq1panel"),
|
||||
m_panel(*this, "panel"),
|
||||
m_dmac(*this, "mc68450")
|
||||
{ }
|
||||
|
||||
required_device<m68000_device> m_maincpu;
|
||||
required_device<duartn68681_device> m_duart;
|
||||
optional_device<wd1772_t> m_fdc;
|
||||
optional_device<esq1x22_t> m_epsvfd;
|
||||
optional_device<esq2x40_sq1_t> m_sq1vfd;
|
||||
optional_device<esq2x40_t> m_vfd;
|
||||
optional_device<esqpanel1x22_device> m_epspanel;
|
||||
optional_device<esqpanel2x40_sq1_device> m_sq1panel;
|
||||
optional_device<esqpanel2x40_device> m_panel;
|
||||
optional_device<hd63450_device> m_dmac;
|
||||
|
||||
virtual void machine_reset();
|
||||
@ -156,14 +157,13 @@ public:
|
||||
DECLARE_WRITE16_MEMBER(lower_w);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(duart_irq_handler);
|
||||
DECLARE_WRITE8_MEMBER(duart_tx_a);
|
||||
DECLARE_WRITE8_MEMBER(duart_tx_b);
|
||||
DECLARE_WRITE_LINE_MEMBER(duart_tx_a);
|
||||
DECLARE_WRITE_LINE_MEMBER(duart_tx_b);
|
||||
DECLARE_READ8_MEMBER(duart_input);
|
||||
DECLARE_WRITE8_MEMBER(duart_output);
|
||||
|
||||
int m_system_type;
|
||||
UINT8 m_duart_io;
|
||||
bool m_bCalibSecondByte;
|
||||
|
||||
DECLARE_FLOPPY_FORMATS( floppy_formats );
|
||||
|
||||
@ -179,6 +179,10 @@ private:
|
||||
|
||||
UINT16 *m_rom, *m_ram;
|
||||
|
||||
#if KEYBOARD_HACK
|
||||
void send_through_panel(UINT8 data);
|
||||
#endif
|
||||
|
||||
public:
|
||||
DECLARE_DRIVER_INIT(eps);
|
||||
DECLARE_DRIVER_INIT(common);
|
||||
@ -199,8 +203,6 @@ void esq5505_state::machine_reset()
|
||||
{
|
||||
m_rom = (UINT16 *)machine().root_device().memregion("osrom")->base();
|
||||
m_ram = (UINT16 *)machine().root_device().memshare("osram")->ptr();
|
||||
|
||||
m_bCalibSecondByte = false;
|
||||
}
|
||||
|
||||
READ16_MEMBER(esq5505_state::es5510_dsp_r)
|
||||
@ -522,36 +524,29 @@ WRITE8_MEMBER(esq5505_state::duart_output)
|
||||
}
|
||||
|
||||
// MIDI send, we don't care yet
|
||||
WRITE8_MEMBER(esq5505_state::duart_tx_a)
|
||||
WRITE_LINE_MEMBER(esq5505_state::duart_tx_a)
|
||||
{
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(esq5505_state::duart_tx_b)
|
||||
WRITE_LINE_MEMBER(esq5505_state::duart_tx_b)
|
||||
{
|
||||
/* if (data >= 'A' && data <= 'z')
|
||||
{
|
||||
printf("ch 1: [%02x](%c) (PC=%x)\n", data, data, m_maincpu->pc());
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("ch 1: [%02x] (PC=%x)\n", data, m_maincpu->pc());
|
||||
}*/
|
||||
|
||||
// printf("Tx B: %d\n", state);
|
||||
switch (m_system_type)
|
||||
{
|
||||
case GENERIC:
|
||||
m_vfd->write_char(data);
|
||||
m_panel->rx_w(state);
|
||||
break;
|
||||
|
||||
case EPS:
|
||||
m_epsvfd->write_char(data);
|
||||
m_epspanel->rx_w(state);
|
||||
break;
|
||||
|
||||
case SQ1:
|
||||
m_sq1vfd->write_char(data);
|
||||
m_sq1panel->rx_w(state);
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (m_bCalibSecondByte)
|
||||
{
|
||||
if (data == 0xfd) // calibration request
|
||||
@ -584,13 +579,14 @@ WRITE8_MEMBER(esq5505_state::duart_tx_b)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static const duartn68681_config duart_config =
|
||||
{
|
||||
DEVCB_DRIVER_LINE_MEMBER(esq5505_state, duart_irq_handler),
|
||||
DEVCB_DRIVER_MEMBER(esq5505_state, duart_tx_a),
|
||||
DEVCB_DRIVER_MEMBER(esq5505_state, duart_tx_b),
|
||||
DEVCB_DRIVER_LINE_MEMBER(esq5505_state, duart_tx_a),
|
||||
DEVCB_DRIVER_LINE_MEMBER(esq5505_state, duart_tx_b),
|
||||
DEVCB_DRIVER_MEMBER(esq5505_state, duart_input),
|
||||
DEVCB_DRIVER_MEMBER(esq5505_state, duart_output),
|
||||
|
||||
@ -631,6 +627,24 @@ static void esq_fdc_write_byte(running_machine &machine, int addr, int data)
|
||||
}
|
||||
|
||||
#if KEYBOARD_HACK
|
||||
void esq5505_state::send_through_panel(UINT8 data)
|
||||
{
|
||||
switch (m_system_type)
|
||||
{
|
||||
case GENERIC:
|
||||
m_panel->xmit_char(data);
|
||||
break;
|
||||
|
||||
case EPS:
|
||||
m_epspanel->xmit_char(data);
|
||||
break;
|
||||
|
||||
case SQ1:
|
||||
m_sq1panel->xmit_char(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INPUT_CHANGED_MEMBER(esq5505_state::key_stroke)
|
||||
{
|
||||
#if HACK_VIA_MIDI
|
||||
@ -704,14 +718,14 @@ INPUT_CHANGED_MEMBER(esq5505_state::key_stroke)
|
||||
if (oldval == 0 && newval == 1)
|
||||
{
|
||||
printf("key pressed %d\n", val&0x7f);
|
||||
m_duart->duart68681_rx_data(1, val);
|
||||
m_duart->duart68681_rx_data(1, 0x00);
|
||||
send_through_panel(val);
|
||||
send_through_panel(0x00);
|
||||
}
|
||||
else if (oldval == 1 && newval == 0)
|
||||
{
|
||||
// printf("key off %x\n", (UINT8)(FPTR)param);
|
||||
m_duart->duart68681_rx_data(1, val&0x7f);
|
||||
m_duart->duart68681_rx_data(1, 0x00);
|
||||
send_through_panel(val&0x7f);
|
||||
send_through_panel(0x00);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -737,11 +751,16 @@ static const es5505_interface es5505_config =
|
||||
esq5505_read_adc
|
||||
};
|
||||
|
||||
static const esqpanel_interface esqpanel_config =
|
||||
{
|
||||
DEVCB_DEVICE_LINE_MEMBER("duart", duartn68681_device, rx_b_w)
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_START( vfx, esq5505_state )
|
||||
MCFG_CPU_ADD("maincpu", M68000, XTAL_10MHz)
|
||||
MCFG_CPU_PROGRAM_MAP(vfx_map)
|
||||
|
||||
MCFG_ESQ2x40_ADD("vfd")
|
||||
MCFG_ESQPANEL2x40_ADD("panel", esqpanel_config)
|
||||
|
||||
MCFG_DUARTN68681_ADD("duart", 4000000, duart_config)
|
||||
|
||||
@ -756,8 +775,8 @@ static MACHINE_CONFIG_DERIVED(eps, vfx)
|
||||
MCFG_CPU_MODIFY( "maincpu" )
|
||||
MCFG_CPU_PROGRAM_MAP(eps_map)
|
||||
|
||||
MCFG_ESQ2x40_REMOVE("vfd")
|
||||
MCFG_ESQ1x22_ADD("epsvfd")
|
||||
MCFG_ESQPANEL_2x40_REMOVE("panel")
|
||||
MCFG_ESQPANEL1x22_ADD("epspanel", esqpanel_config)
|
||||
|
||||
MCFG_WD1772x_ADD("wd1772", 8000000)
|
||||
MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", 0, esq5505_state::floppy_formats)
|
||||
@ -778,7 +797,7 @@ static MACHINE_CONFIG_START(vfx32, esq5505_state)
|
||||
MCFG_CPU_ADD("maincpu", M68000, XTAL_30_4761MHz / 2)
|
||||
MCFG_CPU_PROGRAM_MAP(vfxsd_map)
|
||||
|
||||
MCFG_ESQ2x40_ADD("vfd")
|
||||
MCFG_ESQPANEL2x40_ADD("panel", esqpanel_config)
|
||||
|
||||
MCFG_DUARTN68681_ADD("duart", 4000000, duart_config)
|
||||
|
||||
@ -796,8 +815,8 @@ static MACHINE_CONFIG_DERIVED(sq1, vfx32)
|
||||
MCFG_CPU_MODIFY( "maincpu" )
|
||||
MCFG_CPU_PROGRAM_MAP(sq1_map)
|
||||
|
||||
MCFG_ESQ2x40_REMOVE("vfd")
|
||||
MCFG_ESQ2x40_SQ1_ADD("sq1vfd")
|
||||
MCFG_ESQPANEL_2x40_REMOVE("panel")
|
||||
MCFG_ESQPANEL2x40_SQ1_ADD("sq1panel", esqpanel_config)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static INPUT_PORTS_START( vfx )
|
||||
|
223
src/mess/machine/esqpanel.c
Normal file
223
src/mess/machine/esqpanel.c
Normal file
@ -0,0 +1,223 @@
|
||||
/*
|
||||
Ensoniq panel/display device
|
||||
*/
|
||||
#include "emu.h"
|
||||
#include "esqpanel.h"
|
||||
|
||||
//**************************************************************************
|
||||
// MACROS / CONSTANTS
|
||||
//**************************************************************************
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
const device_type ESQPANEL1x22 = &device_creator<esqpanel1x22_device>;
|
||||
const device_type ESQPANEL2x40 = &device_creator<esqpanel2x40_device>;
|
||||
const device_type ESQPANEL2x40_SQ1 = &device_creator<esqpanel2x40_sq1_device>;
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// esqpanel_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
esqpanel_device::esqpanel_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, type, name, tag, owner, clock),
|
||||
device_serial_interface(mconfig, *this)
|
||||
{
|
||||
}
|
||||
|
||||
void esqpanel_device::device_config_complete()
|
||||
{
|
||||
m_shortname = "esqpanel";
|
||||
|
||||
// inherit a copy of the static data
|
||||
const esqpanel_interface *intf = reinterpret_cast<const esqpanel_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
{
|
||||
*static_cast<esqpanel_interface *>(this) = *intf;
|
||||
}
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_out_tx_cb, 0, sizeof(m_out_tx_cb));
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void esqpanel_device::device_start()
|
||||
{
|
||||
m_out_tx_func.resolve(m_out_tx_cb, *this);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void esqpanel_device::device_reset()
|
||||
{
|
||||
// panel comms is at 62500 baud (double the MIDI rate), 8N2
|
||||
set_rcv_rate(62500);
|
||||
set_tra_rate(62500);
|
||||
set_data_frame(8, 2, SERIAL_PARITY_NONE);
|
||||
|
||||
m_tx_busy = false;
|
||||
m_xmit_read = m_xmit_write = 0;
|
||||
m_bCalibSecondByte = false;
|
||||
}
|
||||
|
||||
void esqpanel_device::rcv_complete() // Rx completed receiving byte
|
||||
{
|
||||
receive_register_extract();
|
||||
UINT8 data = get_received_char();
|
||||
|
||||
// if (data >= 0xe0) printf("Got %02x from motherboard (second %s)\n", data, m_bCalibSecondByte ? "yes" : "no");
|
||||
|
||||
send_to_display(data);
|
||||
|
||||
if (m_bCalibSecondByte)
|
||||
{
|
||||
// printf("second byte is %02x\n", data);
|
||||
if (data == 0xfd) // calibration request
|
||||
{
|
||||
// printf("let's send reply!\n");
|
||||
xmit_char(0xff); // this is the correct response for "calibration OK"
|
||||
}
|
||||
m_bCalibSecondByte = false;
|
||||
}
|
||||
else if (data == 0xfb) // request calibration
|
||||
{
|
||||
m_bCalibSecondByte = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// EPS wants a throwaway reply byte for each byte sent to the KPC
|
||||
// VFX-SD and SD-1 definitely don't :)
|
||||
if (m_eps_mode)
|
||||
{
|
||||
if (data == 0xe7)
|
||||
{
|
||||
xmit_char(0x00); // actual value of response is never checked
|
||||
}
|
||||
else if (data == 0x71)
|
||||
{
|
||||
xmit_char(0x00); // actual value of response is never checked
|
||||
}
|
||||
else
|
||||
{
|
||||
xmit_char(data); // actual value of response is never checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void esqpanel_device::tra_complete() // Tx completed sending byte
|
||||
{
|
||||
// printf("panel Tx complete\n");
|
||||
// is there more waiting to send?
|
||||
if (m_xmit_read != m_xmit_write)
|
||||
{
|
||||
transmit_register_setup(m_xmitring[m_xmit_read++]);
|
||||
if (m_xmit_read >= XMIT_RING_SIZE)
|
||||
{
|
||||
m_xmit_read = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_tx_busy = false;
|
||||
}
|
||||
}
|
||||
|
||||
void esqpanel_device::tra_callback() // Tx send bit
|
||||
{
|
||||
int bit = transmit_register_get_data_bit();
|
||||
m_out_tx_func(bit);
|
||||
}
|
||||
|
||||
void esqpanel_device::input_callback(UINT8 state)
|
||||
{
|
||||
}
|
||||
|
||||
void esqpanel_device::xmit_char(UINT8 data)
|
||||
{
|
||||
// printf("Panel: xmit %02x\n", data);
|
||||
|
||||
// if tx is busy it'll pick this up automatically when it completes
|
||||
if (!m_tx_busy)
|
||||
{
|
||||
m_tx_busy = true;
|
||||
transmit_register_setup(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
// tx is busy, it'll pick this up next time
|
||||
m_xmitring[m_xmit_write++] = data;
|
||||
if (m_xmit_write >= XMIT_RING_SIZE)
|
||||
{
|
||||
m_xmit_write = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* panel with 1x22 VFD display used in the EPS-16 and EPS-16 Plus */
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT(esqpanel1x22)
|
||||
MCFG_ESQ1x22_ADD("vfd")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
machine_config_constructor esqpanel1x22_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( esqpanel1x22 );
|
||||
}
|
||||
|
||||
esqpanel1x22_device::esqpanel1x22_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
esqpanel_device(mconfig, ESQPANEL1x22, "Ensoniq front panel with 1x22 VFD", tag, owner, clock),
|
||||
m_vfd(*this, "vfd")
|
||||
{
|
||||
m_eps_mode = true;
|
||||
}
|
||||
|
||||
/* panel with 2x40 VFD display used in the ESQ-1, VFX-SD, SD-1, and others */
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT(esqpanel2x40)
|
||||
MCFG_ESQ2x40_ADD("vfd")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
machine_config_constructor esqpanel2x40_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( esqpanel2x40 );
|
||||
}
|
||||
|
||||
esqpanel2x40_device::esqpanel2x40_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
esqpanel_device(mconfig, ESQPANEL2x40, "Ensoniq front panel with 2x40 VFD", tag, owner, clock),
|
||||
m_vfd(*this, "vfd")
|
||||
{
|
||||
m_eps_mode = false;
|
||||
}
|
||||
|
||||
/* panel with 2x16? LCD display used in the SQ and MR series, plus probably more */
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT(esqpanel2x40_sq1)
|
||||
MCFG_ESQ2x40_SQ1_ADD("vfd")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
machine_config_constructor esqpanel2x40_sq1_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( esqpanel2x40_sq1 );
|
||||
}
|
||||
|
||||
esqpanel2x40_sq1_device::esqpanel2x40_sq1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
esqpanel_device(mconfig, ESQPANEL2x40, "Ensoniq front panel with 2x16 LCD", tag, owner, clock),
|
||||
m_vfd(*this, "vfd")
|
||||
{
|
||||
m_eps_mode = false;
|
||||
}
|
||||
|
140
src/mess/machine/esqpanel.h
Normal file
140
src/mess/machine/esqpanel.h
Normal file
@ -0,0 +1,140 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __ESQPANEL_H__
|
||||
#define __ESQPANEL_H__
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/esqvfd.h"
|
||||
|
||||
//**************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_ESQPANEL1x22_ADD(_tag, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, ESQPANEL1x22, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
#define MCFG_ESQPANEL1x22_REPLACE(_tag, _config) \
|
||||
MCFG_DEVICE_REPLACE(_tag, ESQPANEL1x22, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
#define MCFG_ESQPANEL1x22_REMOVE(_tag) \
|
||||
MCFG_DEVICE_REMOVE(_tag)
|
||||
|
||||
#define MCFG_ESQPANEL2x40_ADD(_tag, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, ESQPANEL2x40, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
#define MCFG_ESQPANEL2x40_REPLACE(_tag, _config) \
|
||||
MCFG_DEVICE_REPLACE(_tag, ESQPANEL2x40, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
#define MCFG_ESQPANEL_2x40_REMOVE(_tag) \
|
||||
MCFG_DEVICE_REMOVE(_tag)
|
||||
|
||||
#define MCFG_ESQPANEL2x40_SQ1_ADD(_tag, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, ESQPANEL2x40_SQ1, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
#define MCFG_ESQPANEL2x40_SQ1_REPLACE(_tag, _config) \
|
||||
MCFG_DEVICE_REPLACE(_tag, ESQPANEL2x40_SQ1, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
#define MCFG_ESQPANEL2x40_SQ1_REMOVE(_tag) \
|
||||
MCFG_DEVICE_REMOVE(_tag)
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
struct esqpanel_interface
|
||||
{
|
||||
devcb_write_line m_out_tx_cb;
|
||||
};
|
||||
|
||||
// ======================> esqpanel_device
|
||||
|
||||
class esqpanel_device : public device_t, public device_serial_interface, public esqpanel_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
esqpanel_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_w ) { check_for_start(state); }
|
||||
|
||||
virtual void send_to_display(UINT8 data) = 0;
|
||||
|
||||
void xmit_char(UINT8 data);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_config_complete();
|
||||
|
||||
// serial overrides
|
||||
virtual void rcv_complete(); // Rx completed receiving byte
|
||||
virtual void tra_complete(); // Tx completed sending byte
|
||||
virtual void tra_callback(); // Tx send bit
|
||||
void input_callback(UINT8 state);
|
||||
|
||||
bool m_eps_mode;
|
||||
|
||||
private:
|
||||
static const int XMIT_RING_SIZE = 16;
|
||||
|
||||
bool m_bCalibSecondByte;
|
||||
|
||||
devcb_resolved_write_line m_out_tx_func;
|
||||
UINT8 m_xmitring[XMIT_RING_SIZE];
|
||||
int m_xmit_read, m_xmit_write;
|
||||
bool m_tx_busy;
|
||||
};
|
||||
|
||||
class esqpanel1x22_device : public esqpanel_device {
|
||||
public:
|
||||
esqpanel1x22_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
required_device<esq1x22_t> m_vfd;
|
||||
|
||||
virtual void send_to_display(UINT8 data) { m_vfd->write_char(data); }
|
||||
|
||||
protected:
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class esqpanel2x40_device : public esqpanel_device {
|
||||
public:
|
||||
esqpanel2x40_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
required_device<esq2x40_t> m_vfd;
|
||||
|
||||
virtual void send_to_display(UINT8 data) { m_vfd->write_char(data); }
|
||||
|
||||
protected:
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class esqpanel2x40_sq1_device : public esqpanel_device {
|
||||
public:
|
||||
esqpanel2x40_sq1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
required_device<esq2x40_sq1_t> m_vfd;
|
||||
|
||||
virtual void send_to_display(UINT8 data) { m_vfd->write_char(data); }
|
||||
|
||||
protected:
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
extern const device_type ESQPANEL1x22;
|
||||
extern const device_type ESQPANEL2x40;
|
||||
extern const device_type ESQPANEL2x40_SQ1;
|
||||
|
||||
#endif
|
@ -1119,6 +1119,7 @@ $(MESSOBJ)/ensoniq.a: \
|
||||
$(MESS_DRIVERS)/esqkt.o \
|
||||
$(MESS_DRIVERS)/esqmr.o \
|
||||
$(MESS_MACHINE)/esqvfd.o \
|
||||
$(MESS_MACHINE)/esqpanel.o \
|
||||
|
||||
$(MESSOBJ)/entex.a: \
|
||||
$(MESS_VIDEO)/advision.o \
|
||||
|
Loading…
Reference in New Issue
Block a user