mirror of
https://github.com/holub/mame
synced 2025-04-23 17:00:53 +03:00
es5510: Preliminary hookup to es5505/5506. Samples are passed through unchanged for now. [Christian Brunschen]
This commit is contained in:
parent
3948617c42
commit
de9ec8e122
File diff suppressed because it is too large
Load Diff
@ -13,59 +13,59 @@
|
||||
#include "emu.h"
|
||||
|
||||
class es5510_device : public cpu_device {
|
||||
public:
|
||||
public:
|
||||
es5510_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
DECLARE_READ8_MEMBER(host_r);
|
||||
DECLARE_WRITE8_MEMBER(host_w);
|
||||
|
||||
DECLARE_READ16_MEMBER(ser_r);
|
||||
DECLARE_WRITE16_MEMBER(ser_w);
|
||||
INT16 ser_r(int offset);
|
||||
void ser_w(int offset, INT16 data);
|
||||
|
||||
enum line_t {
|
||||
ES5510_HALT = 0
|
||||
ES5510_HALT = 0
|
||||
};
|
||||
|
||||
enum state_t {
|
||||
STATE_RUNNING = 0,
|
||||
STATE_HALTED = 1
|
||||
STATE_RUNNING = 0,
|
||||
STATE_HALTED = 1
|
||||
};
|
||||
|
||||
struct alu_op_t {
|
||||
int operands;
|
||||
const char * const opcode;
|
||||
int operands;
|
||||
const char * const opcode;
|
||||
};
|
||||
|
||||
enum op_src_dst_t {
|
||||
SRC_DST_REG = 1 << 0,
|
||||
SRC_DST_DELAY = 1 << 1,
|
||||
SRC_DST_BOTH = (1 << 0) | (1 << 1)
|
||||
SRC_DST_REG = 1 << 0,
|
||||
SRC_DST_DELAY = 1 << 1,
|
||||
SRC_DST_BOTH = (1 << 0) | (1 << 1)
|
||||
};
|
||||
|
||||
struct op_select_t {
|
||||
const op_src_dst_t alu_src;
|
||||
const op_src_dst_t alu_dst;
|
||||
const op_src_dst_t mac_src;
|
||||
const op_src_dst_t mac_dst;
|
||||
const op_src_dst_t alu_src;
|
||||
const op_src_dst_t alu_dst;
|
||||
const op_src_dst_t mac_src;
|
||||
const op_src_dst_t mac_dst;
|
||||
};
|
||||
|
||||
enum ram_control_access_t {
|
||||
RAM_CONTROL_DELAY = 0,
|
||||
RAM_CONTROL_TABLE_A,
|
||||
RAM_CONTROL_TABLE_B,
|
||||
RAM_CONTROL_IO
|
||||
RAM_CONTROL_DELAY = 0,
|
||||
RAM_CONTROL_TABLE_A,
|
||||
RAM_CONTROL_TABLE_B,
|
||||
RAM_CONTROL_IO
|
||||
};
|
||||
|
||||
enum ram_cycle_t {
|
||||
RAM_CYCLE_READ = 0,
|
||||
RAM_CYCLE_WRITE = 1,
|
||||
RAM_CYCLE_DUMP_FIFO = 2
|
||||
RAM_CYCLE_READ = 0,
|
||||
RAM_CYCLE_WRITE = 1,
|
||||
RAM_CYCLE_DUMP_FIFO = 2
|
||||
};
|
||||
|
||||
struct ram_control_t {
|
||||
ram_cycle_t cycle;
|
||||
ram_control_access_t access;
|
||||
const char * const description;
|
||||
ram_cycle_t cycle;
|
||||
ram_control_access_t access;
|
||||
const char * const description;
|
||||
};
|
||||
|
||||
static const alu_op_t ALU_OPS[16];
|
||||
@ -73,38 +73,45 @@ class es5510_device : public cpu_device {
|
||||
static const ram_control_t RAM_CONTROL[8];
|
||||
|
||||
struct alu_t {
|
||||
UINT8 aReg;
|
||||
UINT8 bReg;
|
||||
op_src_dst_t src;
|
||||
op_src_dst_t dst;
|
||||
UINT8 op;
|
||||
INT32 aValue;
|
||||
INT32 bValue;
|
||||
INT32 result;
|
||||
bool update_ccr;
|
||||
bool write_result;
|
||||
UINT8 aReg;
|
||||
UINT8 bReg;
|
||||
op_src_dst_t src;
|
||||
op_src_dst_t dst;
|
||||
UINT8 op;
|
||||
INT32 aValue;
|
||||
INT32 bValue;
|
||||
INT32 result;
|
||||
bool update_ccr;
|
||||
bool write_result;
|
||||
};
|
||||
|
||||
struct mulacc_t {
|
||||
UINT8 cReg;
|
||||
UINT8 dReg;
|
||||
op_src_dst_t src;
|
||||
op_src_dst_t dst;
|
||||
bool accumulate;
|
||||
INT64 cValue;
|
||||
INT64 dValue;
|
||||
INT64 product;
|
||||
INT64 result;
|
||||
bool write_result;
|
||||
UINT8 cReg;
|
||||
UINT8 dReg;
|
||||
op_src_dst_t src;
|
||||
op_src_dst_t dst;
|
||||
bool accumulate;
|
||||
INT64 cValue;
|
||||
INT64 dValue;
|
||||
INT64 product;
|
||||
INT64 result;
|
||||
bool write_result;
|
||||
};
|
||||
|
||||
struct ram_t {
|
||||
INT32 address; // up to 20 bits, left-justified within the right 24 bits of the 32-bit word
|
||||
bool io; // I/O space, rather than delay line memory
|
||||
ram_cycle_t cycle; // cycle type
|
||||
INT32 address; // up to 20 bits, left-justified within the right 24 bits of the 32-bit word
|
||||
bool io; // I/O space, rather than delay line memory
|
||||
ram_cycle_t cycle; // cycle type
|
||||
};
|
||||
|
||||
protected:
|
||||
// direct access to the 'HALT' pin - not just through the
|
||||
void set_HALT(bool halt) { halt_asserted = halt; }
|
||||
bool get_HALT() { return halt_asserted; }
|
||||
|
||||
void run_once();
|
||||
void list_program(void(p)(const char *, ...));
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
|
||||
@ -117,15 +124,18 @@ class es5510_device : public cpu_device {
|
||||
virtual UINT32 disasm_min_opcode_bytes() const;
|
||||
virtual UINT32 disasm_max_opcode_bytes() const;
|
||||
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
|
||||
virtual void execute_set_input(int linenum, int state);
|
||||
|
||||
INT32 read_reg(UINT8 reg);
|
||||
void write_reg(UINT8 reg, INT32 value);
|
||||
void write_to_dol(INT32 value);
|
||||
|
||||
INT32 alu_operation(UINT8 op, INT32 aValue, INT32 bValue, UINT8 &flags);
|
||||
void alu_operation_end();
|
||||
|
||||
private:
|
||||
private:
|
||||
int icount;
|
||||
bool halt_asserted;
|
||||
UINT8 pc;
|
||||
state_t state;
|
||||
INT32 gpr[0xc0]; // 24 bits, right justified and sign extended
|
||||
|
@ -193,6 +193,8 @@ struct es5506_state
|
||||
UINT16 * volume_lookup;
|
||||
device_t *device;
|
||||
|
||||
int channels; /* the number of output stereo channels: 1..4 for 5505, 1..6 for 5506 */
|
||||
|
||||
#if MAKE_WAVS
|
||||
void * wavraw; /* raw waveform */
|
||||
#endif
|
||||
@ -783,7 +785,7 @@ alldone:
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
static void generate_samples(es5506_state *chip, INT32 *left, INT32 *right, int samples)
|
||||
static void generate_samples(es5506_state *chip, INT32 **outputs, int offset, int samples)
|
||||
{
|
||||
int v;
|
||||
|
||||
@ -791,9 +793,11 @@ static void generate_samples(es5506_state *chip, INT32 *left, INT32 *right, int
|
||||
if (!samples)
|
||||
return;
|
||||
|
||||
/* clear out the accumulator */
|
||||
memset(left, 0, samples * sizeof(left[0]));
|
||||
memset(right, 0, samples * sizeof(right[0]));
|
||||
/* clear out the accumulators */
|
||||
for (int i = 0; i < chip->channels << 1; i++)
|
||||
{
|
||||
memset(outputs[i] + offset, 0, sizeof(INT32) * samples);
|
||||
}
|
||||
|
||||
/* loop over voices */
|
||||
for (v = 0; v <= chip->active_voices; v++)
|
||||
@ -805,6 +809,13 @@ static void generate_samples(es5506_state *chip, INT32 *left, INT32 *right, int
|
||||
if (voice->start == voice->end)
|
||||
voice->control |= CONTROL_STOP0;
|
||||
|
||||
int voice_channel = (voice->control & CONTROL_CAMASK) >> 10;
|
||||
int channel = voice_channel % chip->channels;
|
||||
int l = channel << 1;
|
||||
int r = l + 1;
|
||||
INT32 *left = outputs[l] + offset;
|
||||
INT32 *right = outputs[r] + offset;
|
||||
|
||||
/* generate from the appropriate source */
|
||||
if (!base)
|
||||
{
|
||||
@ -845,12 +856,9 @@ static void generate_samples(es5506_state *chip, INT32 *left, INT32 *right, int
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
static STREAM_UPDATE( es5506_update )
|
||||
STREAM_UPDATE( es5506_update )
|
||||
{
|
||||
es5506_state *chip = (es5506_state *)param;
|
||||
INT32 *lsrc = NULL, *rsrc = NULL;
|
||||
stream_sample_t *ldest = outputs[0];
|
||||
stream_sample_t *rdest = outputs[1];
|
||||
|
||||
#if MAKE_WAVS
|
||||
/* start the logging once we have a sample rate */
|
||||
@ -862,30 +870,36 @@ static STREAM_UPDATE( es5506_update )
|
||||
#endif
|
||||
|
||||
/* loop until all samples are output */
|
||||
int offset = 0;
|
||||
while (samples)
|
||||
{
|
||||
int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples;
|
||||
int samp;
|
||||
|
||||
/* determine left/right source data */
|
||||
lsrc = chip->scratch;
|
||||
rsrc = chip->scratch + length;
|
||||
generate_samples(chip, lsrc, rsrc, length);
|
||||
|
||||
/* copy the data */
|
||||
for (samp = 0; samp < length; samp++)
|
||||
{
|
||||
*ldest++ = lsrc[samp] >> 4;
|
||||
*rdest++ = rsrc[samp] >> 4;
|
||||
}
|
||||
generate_samples(chip, outputs, offset, length);
|
||||
|
||||
#if MAKE_WAVS
|
||||
/* log the raw data */
|
||||
if (chip->wavraw)
|
||||
if (chip->wavraw) {
|
||||
/* determine left/right source data */
|
||||
INT32 *lsrc = chip->scratch, *rsrc = chip->scratch + length;
|
||||
int channel;
|
||||
memset(lsrc, 0, sizeof(INT32) * length * 2);
|
||||
/* loop over the output channels */
|
||||
for (channel = 0; channel < chip->channels; channel++) {
|
||||
INT32 *l = outputs[(channel << 1)] + offset;
|
||||
INT32 *r = outputs[(channel << 1) + 1] + offset;
|
||||
/* add the current channel's samples to the WAV data */
|
||||
for (samp = 0; samp < length; samp++) {
|
||||
lsrc[samp] += l[samp];
|
||||
rsrc[samp] += r[samp];
|
||||
}
|
||||
}
|
||||
wav_add_data_32lr(chip->wavraw, lsrc, rsrc, length, 4);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* account for these samples */
|
||||
offset += length;
|
||||
samples -= length;
|
||||
}
|
||||
}
|
||||
@ -903,13 +917,18 @@ static void es5506_start_common(device_t *device, const void *config, device_typ
|
||||
es5506_state *chip = get_safe_token(device);
|
||||
int j;
|
||||
UINT32 accum_mask;
|
||||
int channels = 1; /* 1 channel by default, for backward compatibility */
|
||||
|
||||
/* only override the number of channels if the value is in the valid range 1 .. 6 */
|
||||
if (1 <= intf->channels && intf->channels <= 6)
|
||||
channels = intf->channels;
|
||||
|
||||
/* debugging */
|
||||
if (LOG_COMMANDS && !eslog)
|
||||
eslog = fopen("es.log", "w");
|
||||
|
||||
/* create the stream */
|
||||
chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock() / (16*32), chip, es5506_update);
|
||||
chip->stream = device->machine().sound().stream_alloc(*device, 0, 2 * channels, device->clock() / (16*32), chip, es5506_update);
|
||||
|
||||
/* initialize the regions */
|
||||
chip->region_base[0] = intf->region0 ? (UINT16 *)device->machine().root_device().memregion(intf->region0)->base() : NULL;
|
||||
@ -923,6 +942,7 @@ static void es5506_start_common(device_t *device, const void *config, device_typ
|
||||
chip->irq_callback.resolve(intf->irq_callback,*device);
|
||||
chip->port_read.resolve(intf->read_port,*device);
|
||||
chip->irqv = 0x80;
|
||||
chip->channels = channels;
|
||||
|
||||
/* compute the tables */
|
||||
compute_tables(chip);
|
||||
@ -1556,11 +1576,17 @@ static DEVICE_START( es5505 )
|
||||
{
|
||||
const es5505_interface *intf = (const es5505_interface *)device->static_config();
|
||||
es5506_interface es5506intf;
|
||||
int channels = 1; /* 1 channel by default, for backward compatibility */
|
||||
|
||||
/* only override the number of channels if the value is in the valid range 1 .. 4 */
|
||||
if (1 <= intf->channels && intf->channels <= 4)
|
||||
channels = intf->channels;
|
||||
|
||||
memset(&es5506intf, 0, sizeof(es5506intf));
|
||||
|
||||
es5506intf.region0 = intf->region0;
|
||||
es5506intf.region1 = intf->region1;
|
||||
es5506intf.channels = channels;
|
||||
es5506intf.irq_callback = intf->irq_callback;
|
||||
es5506intf.read_port = intf->read_port;
|
||||
|
||||
@ -2194,7 +2220,6 @@ void es5506_device::sound_stream_update(sound_stream &stream, stream_sample_t **
|
||||
fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
|
||||
}
|
||||
|
||||
|
||||
const device_type ES5505 = &device_creator<es5505_device>;
|
||||
|
||||
es5505_device::es5505_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
|
@ -16,6 +16,7 @@ struct es5505_interface
|
||||
{
|
||||
const char * region0; /* memory region where the sample ROM lives */
|
||||
const char * region1; /* memory region where the sample ROM lives */
|
||||
int channels; /* number of output channels: 1 .. 4 */
|
||||
devcb_write_line irq_callback; /* irq callback */
|
||||
devcb_read16 read_port; /* input port read */
|
||||
};
|
||||
@ -58,6 +59,7 @@ struct es5506_interface
|
||||
const char * region1; /* memory region where the sample ROM lives */
|
||||
const char * region2; /* memory region where the sample ROM lives */
|
||||
const char * region3; /* memory region where the sample ROM lives */
|
||||
int channels; /* number of output channels: 1 .. 6 */
|
||||
devcb_write_line irq_callback; /* irq callback */
|
||||
devcb_read16 read_port; /* input port read */
|
||||
};
|
||||
@ -79,5 +81,6 @@ private:
|
||||
|
||||
extern const device_type ES5505;
|
||||
|
||||
extern STREAM_UPDATE( es5506_update );
|
||||
|
||||
#endif /* __ES5506_H__ */
|
||||
|
@ -315,6 +315,7 @@ static const es5505_interface es5505_taito_en_config =
|
||||
{
|
||||
"ensoniq.0", /* Bank 0: Unused by F3 games? */
|
||||
"ensoniq.0", /* Bank 1: All games seem to use this */
|
||||
1, /* channels */
|
||||
DEVCB_NULL /* IRQ */
|
||||
};
|
||||
|
||||
|
@ -1666,7 +1666,8 @@ static const es5506_interface es5506_config =
|
||||
"ensoniq.0",
|
||||
"ensoniq.1",
|
||||
"ensoniq.2",
|
||||
"ensoniq.3"
|
||||
"ensoniq.3",
|
||||
1 /* channels */
|
||||
};
|
||||
|
||||
|
||||
|
@ -587,6 +587,7 @@ static const es5506_interface es5506_config =
|
||||
"ensoniq.1",
|
||||
"ensoniq.2",
|
||||
"ensoniq.3",
|
||||
1, /* channels */
|
||||
DEVCB_DRIVER_LINE_MEMBER(macrossp_state,irqhandler)
|
||||
};
|
||||
|
||||
|
@ -2491,7 +2491,8 @@ static const es5506_interface es5506_config =
|
||||
"ensoniq.0",
|
||||
"ensoniq.1",
|
||||
"ensoniq.2",
|
||||
"ensoniq.3"
|
||||
"ensoniq.3",
|
||||
1 /* channels */
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -125,6 +125,221 @@
|
||||
static int shift = 32;
|
||||
#endif
|
||||
|
||||
void print_to_stderr(const char *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
vfprintf(stderr, format, arg);
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
#define PUMP_DETECT_SILENCE 1
|
||||
#define PUMP_TRACK_SAMPLES 0
|
||||
#define PUMP_FAKE_ESP_PROCESSING 1
|
||||
class esq_5505_5510_pump : public device_t,
|
||||
public device_sound_interface
|
||||
{
|
||||
public:
|
||||
esq_5505_5510_pump(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
void set_otis(es5505_device *otis) { m_otis = otis; }
|
||||
void set_esp(es5510_device *esp) { m_esp = esp; }
|
||||
void set_esp_halted(bool esp_halted) {
|
||||
m_esp_halted = esp_halted;
|
||||
logerror("ESP-halted -> %d\n", m_esp_halted);
|
||||
if (!esp_halted) {
|
||||
m_esp->list_program(print_to_stderr);
|
||||
}
|
||||
}
|
||||
bool get_esp_halted() {
|
||||
return m_esp_halted;
|
||||
}
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_stop();
|
||||
virtual void device_reset();
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
// timer callback overridea
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
private:
|
||||
// internal state:
|
||||
// sound stream
|
||||
sound_stream *m_stream;
|
||||
|
||||
// per-sample timer
|
||||
emu_timer *m_timer;
|
||||
|
||||
// OTIS sound generator
|
||||
es5505_device *m_otis;
|
||||
|
||||
// ESP signal processor
|
||||
es5510_device *m_esp;
|
||||
|
||||
// Is the ESP halted by the CPU?
|
||||
bool m_esp_halted;
|
||||
|
||||
#if !PUMP_FAKE_ESP_PROCESSING
|
||||
osd_ticks_t ticks_spent_processing;
|
||||
int samples_processed;
|
||||
#endif
|
||||
|
||||
#if PUMP_DETECT_SILENCE
|
||||
int silent_for;
|
||||
bool was_silence;
|
||||
#endif
|
||||
|
||||
#if PUMP_TRACK_SAMPLES
|
||||
int last_samples;
|
||||
osd_ticks_t last_ticks;
|
||||
osd_ticks_t next_report_ticks;
|
||||
#endif
|
||||
};
|
||||
|
||||
const device_type ESQ_5505_5510_PUMP = &device_creator<esq_5505_5510_pump>;
|
||||
|
||||
esq_5505_5510_pump::esq_5505_5510_pump(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, ESQ_5505_5510_PUMP, "ESQ_5505_5510_PUMP", tag, owner, clock),
|
||||
device_sound_interface(mconfig, *this),
|
||||
m_esp_halted(true)
|
||||
{
|
||||
}
|
||||
|
||||
void esq_5505_5510_pump::device_start()
|
||||
{
|
||||
INT64 nsec_per_sample = 100 * 16 * 21;
|
||||
attotime sample_time(0, 1000000000 * nsec_per_sample);
|
||||
attotime initial_delay(0, 0);
|
||||
logerror("Clock = %d\n", clock());
|
||||
m_stream = machine().sound().stream_alloc(*this, 8, 2, clock(), this);
|
||||
m_timer = timer_alloc(0);
|
||||
m_timer->adjust(initial_delay, 0, sample_time);
|
||||
m_timer->enable(true);
|
||||
|
||||
#if PUMP_DETECT_SILENCE
|
||||
silent_for = 500;
|
||||
was_silence = 1;
|
||||
#endif
|
||||
#if !PUMP_FAKE_ESP_PROCESSING
|
||||
ticks_spent_processing = 0;
|
||||
samples_processed = 0;
|
||||
#endif
|
||||
#if PUMP_TRACK_SAMPLES
|
||||
last_samples = 0;
|
||||
last_ticks = osd_ticks();
|
||||
next_report_ticks = last_ticks + osd_ticks_per_second();
|
||||
#endif
|
||||
}
|
||||
|
||||
void esq_5505_5510_pump::device_stop()
|
||||
{
|
||||
m_timer->enable(false);
|
||||
}
|
||||
|
||||
void esq_5505_5510_pump::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
{
|
||||
if (samples != 1) {
|
||||
logerror("Pump: request for %d samples\n", samples);
|
||||
}
|
||||
|
||||
stream_sample_t *left = outputs[0], *right = outputs[1];
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
// anything for the 'aux' output?
|
||||
INT32 l = inputs[0][i] >> 4;
|
||||
INT32 r = inputs[1][i] >> 4;
|
||||
|
||||
// push the samples into the ESP
|
||||
m_esp->ser_w(0, inputs[2][i] >> 4);
|
||||
m_esp->ser_w(1, inputs[3][i] >> 4);
|
||||
m_esp->ser_w(2, inputs[4][i] >> 4);
|
||||
m_esp->ser_w(3, inputs[5][i] >> 4);
|
||||
m_esp->ser_w(4, inputs[6][i] >> 4);
|
||||
m_esp->ser_w(5, inputs[7][i] >> 4);
|
||||
|
||||
m_esp->ser_w(6, 0);
|
||||
m_esp->ser_w(7, 0);
|
||||
|
||||
#if PUMP_FAKE_ESP_PROCESSING
|
||||
m_esp->ser_w(6, m_esp->ser_r(0) + m_esp->ser_r(2) + m_esp->ser_r(4));
|
||||
m_esp->ser_w(7, m_esp->ser_r(1) + m_esp->ser_r(3) + m_esp->ser_r(5));
|
||||
#else
|
||||
if (!m_esp_halted) {
|
||||
logerror("passing one sample through ESP\n");
|
||||
osd_ticks_t a = osd_ticks();
|
||||
m_esp->run_once();
|
||||
osd_ticks_t b = osd_ticks();
|
||||
ticks_spent_processing += (b - a);
|
||||
samples_processed++;
|
||||
}
|
||||
#endif
|
||||
|
||||
// read the processed result from the ESP and add to the saved AUX data
|
||||
l += m_esp->ser_r(6);
|
||||
r += m_esp->ser_r(7);
|
||||
|
||||
// write the combined data to the output
|
||||
*left++ = l;
|
||||
*right++ = r;
|
||||
}
|
||||
|
||||
#if PUMP_DETECT_SILENCE
|
||||
for (int i = 0; i < samples; i++) {
|
||||
if (outputs[0][i] == 0 && outputs[1][i] == 0) {
|
||||
silent_for++;
|
||||
} else {
|
||||
silent_for = 0;
|
||||
}
|
||||
}
|
||||
bool silence = silent_for >= 500;
|
||||
if (was_silence != silence) {
|
||||
if (!silence) {
|
||||
fprintf(stderr, ".-*\n");
|
||||
} else {
|
||||
fprintf(stderr, "*-.\n");
|
||||
}
|
||||
was_silence = silence;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PUMP_TRACK_SAMPLES
|
||||
last_samples += samples;
|
||||
osd_ticks_t now = osd_ticks();
|
||||
if (now >= next_report_ticks)
|
||||
{
|
||||
osd_ticks_t elapsed = now - last_ticks;
|
||||
osd_ticks_t tps = osd_ticks_per_second();
|
||||
fprintf(stderr, "Pump: %d samples in %" I64FMT "d ticks for %f Hz\n", last_samples, elapsed, last_samples * (double)tps / (double)elapsed);
|
||||
last_ticks = now;
|
||||
while (next_report_ticks <= now) {
|
||||
next_report_ticks += tps;
|
||||
}
|
||||
last_samples = 0;
|
||||
|
||||
#if !PUMP_FAKE_ESP_PROCESSING
|
||||
fprintf(stderr, " ESP spent %" I64FMT "d ticks on %d samples, %f ticks per sample\n", ticks_spent_processing, samples_processed, (double)ticks_spent_processing / (double)samples_processed);
|
||||
ticks_spent_processing = 0;
|
||||
samples_processed = 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void esq_5505_5510_pump::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) {
|
||||
// ecery time there's a new sample period, update the stream!
|
||||
m_stream->update();
|
||||
}
|
||||
|
||||
|
||||
class esq5505_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -132,7 +347,9 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_duart(*this, "duart"),
|
||||
m_otis(*this, "otis"),
|
||||
m_esp(*this, "esp"),
|
||||
m_pump(*this, "pump"),
|
||||
m_fdc(*this, "wd1772"),
|
||||
m_panel(*this, "panel"),
|
||||
m_dmac(*this, "mc68450"),
|
||||
@ -141,12 +358,15 @@ public:
|
||||
|
||||
required_device<m68000_device> m_maincpu;
|
||||
required_device<duartn68681_device> m_duart;
|
||||
required_device<es5505_device> m_otis;
|
||||
required_device<es5510_device> m_esp;
|
||||
required_device<esq_5505_5510_pump> m_pump;
|
||||
optional_device<wd1772_t> m_fdc;
|
||||
required_device<esqpanel_device> m_panel;
|
||||
optional_device<hd63450_device> m_dmac;
|
||||
required_device<serial_port_device> m_mdout;
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
|
||||
DECLARE_READ16_MEMBER(es5510_dsp_r);
|
||||
@ -200,25 +420,33 @@ IRQ_CALLBACK_MEMBER(esq5505_state::maincpu_irq_acknowledge_callback)
|
||||
int vector = 0;
|
||||
switch(irqline) {
|
||||
case 1:
|
||||
otis_irq_state = 0;
|
||||
vector = M68K_INT_ACK_AUTOVECTOR;
|
||||
break;
|
||||
otis_irq_state = 0;
|
||||
vector = M68K_INT_ACK_AUTOVECTOR;
|
||||
break;
|
||||
case 2:
|
||||
dmac_irq_state = 0;
|
||||
vector = dmac_irq_vector;
|
||||
break;
|
||||
dmac_irq_state = 0;
|
||||
vector = dmac_irq_vector;
|
||||
break;
|
||||
case 3:
|
||||
duart_irq_state = 0;
|
||||
vector = duart_irq_vector;
|
||||
break;
|
||||
duart_irq_state = 0;
|
||||
vector = duart_irq_vector;
|
||||
break;
|
||||
default:
|
||||
printf("\nUnexpected IRQ ACK Callback: IRQ %d\n", irqline);
|
||||
return 0;
|
||||
printf("\nUnexpected IRQ ACK Callback: IRQ %d\n", irqline);
|
||||
return 0;
|
||||
}
|
||||
update_irq_to_maincpu();
|
||||
return vector;
|
||||
}
|
||||
|
||||
void esq5505_state::machine_start()
|
||||
{
|
||||
driver_device::machine_start();
|
||||
// tell the pump about the OTIS & ESP chips
|
||||
m_pump->set_otis(m_otis);
|
||||
m_pump->set_esp(m_esp);
|
||||
}
|
||||
|
||||
void esq5505_state::machine_reset()
|
||||
{
|
||||
m_rom = (UINT16 *)(void *)memregion("osrom")->base();
|
||||
@ -229,21 +457,21 @@ void esq5505_state::machine_reset()
|
||||
void esq5505_state::update_irq_to_maincpu() {
|
||||
//printf("\nupdating IRQ state: have OTIS=%d, DMAC=%d, DUART=%d\n", otis_irq_state, dmac_irq_state, duart_irq_state);
|
||||
if (duart_irq_state) {
|
||||
m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
|
||||
m_maincpu->set_input_line_and_vector(M68K_IRQ_3, ASSERT_LINE, duart_irq_vector);
|
||||
m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
|
||||
m_maincpu->set_input_line_and_vector(M68K_IRQ_3, ASSERT_LINE, duart_irq_vector);
|
||||
} else if (dmac_irq_state) {
|
||||
m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
|
||||
m_maincpu->set_input_line_and_vector(M68K_IRQ_2, ASSERT_LINE, dmac_irq_vector);
|
||||
m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
|
||||
m_maincpu->set_input_line_and_vector(M68K_IRQ_2, ASSERT_LINE, dmac_irq_vector);
|
||||
} else if (otis_irq_state) {
|
||||
m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
|
||||
} else {
|
||||
m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,7 +519,7 @@ WRITE16_MEMBER(esq5505_state::lower_w)
|
||||
|
||||
static ADDRESS_MAP_START( vfx_map, AS_PROGRAM, 16, esq5505_state )
|
||||
AM_RANGE(0x000000, 0x007fff) AM_READWRITE(lower_r, lower_w)
|
||||
AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE_LEGACY("ensoniq", es5505_r, es5505_w)
|
||||
AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE_LEGACY("otis", es5505_r, es5505_w)
|
||||
AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", duartn68681_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x260000, 0x2601ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0x00ff)
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_ROM AM_REGION("osrom", 0)
|
||||
@ -300,7 +528,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( vfxsd_map, AS_PROGRAM, 16, esq5505_state )
|
||||
AM_RANGE(0x000000, 0x00ffff) AM_READWRITE(lower_r, lower_w)
|
||||
AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE_LEGACY("ensoniq", es5505_r, es5505_w)
|
||||
AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE_LEGACY("otis", es5505_r, es5505_w)
|
||||
AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", duartn68681_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x260000, 0x2601ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0x00ff)
|
||||
AM_RANGE(0x2c0000, 0x2c0007) AM_DEVREADWRITE8("wd1772", wd1772_t, read, write, 0x00ff)
|
||||
@ -311,7 +539,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( eps_map, AS_PROGRAM, 16, esq5505_state )
|
||||
AM_RANGE(0x000000, 0x007fff) AM_READWRITE(lower_r, lower_w)
|
||||
AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE_LEGACY("ensoniq", es5505_r, es5505_w)
|
||||
AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE_LEGACY("otis", es5505_r, es5505_w)
|
||||
AM_RANGE(0x240000, 0x2400ff) AM_DEVREADWRITE_LEGACY("mc68450", hd63450_r, hd63450_w)
|
||||
AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", duartn68681_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x2c0000, 0x2c0007) AM_DEVREADWRITE8("wd1772", wd1772_t, read, write, 0x00ff)
|
||||
@ -322,7 +550,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( sq1_map, AS_PROGRAM, 16, esq5505_state )
|
||||
AM_RANGE(0x000000, 0x03ffff) AM_READWRITE(lower_r, lower_w)
|
||||
AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE_LEGACY("ensoniq", es5505_r, es5505_w)
|
||||
AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE_LEGACY("otis", es5505_r, es5505_w)
|
||||
AM_RANGE(0x260000, 0x2601ff) AM_DEVREADWRITE8("esp", es5510_device, host_r, host_w, 0x0ff)
|
||||
AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart", duartn68681_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x2c0000, 0x2c0007) AM_DEVREADWRITE8("wd1772", wd1772_t, read, write, 0x00ff)
|
||||
@ -448,14 +676,14 @@ WRITE8_MEMBER(esq5505_state::duart_output)
|
||||
*/
|
||||
|
||||
if (data & 0x40) {
|
||||
if (!m_esp->input_state(es5510_device::ES5510_HALT)) {
|
||||
logerror("ESQ5505: Asserting ESPHALT\n");
|
||||
m_esp->set_input_line(es5510_device::ES5510_HALT, ASSERT_LINE);
|
||||
if (!m_pump->get_esp_halted()) {
|
||||
logerror("ESQ5505: Asserting ESPHALT\n");
|
||||
m_pump->set_esp_halted(true);
|
||||
}
|
||||
} else {
|
||||
if (m_esp->input_state(es5510_device::ES5510_HALT)) {
|
||||
logerror("ESQ5505: Clearing ESPHALT\n");
|
||||
m_esp->set_input_line(es5510_device::ES5510_HALT, CLEAR_LINE);
|
||||
if (m_pump->get_esp_halted()) {
|
||||
logerror("ESQ5505: Clearing ESPHALT\n");
|
||||
m_pump->set_esp_halted(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -611,6 +839,7 @@ static const es5505_interface es5505_config =
|
||||
{
|
||||
"waverom", /* Bank 0 */
|
||||
"waverom2", /* Bank 1 */
|
||||
4, /* channels */
|
||||
DEVCB_DRIVER_LINE_MEMBER(esq5505_state,esq5505_otis_irq), /* irq */
|
||||
DEVCB_DEVICE_HANDLER(DEVICE_SELF, esq5505_read_adc)
|
||||
};
|
||||
@ -643,6 +872,7 @@ static MACHINE_CONFIG_START( vfx, esq5505_state )
|
||||
MCFG_CPU_PROGRAM_MAP(vfx_map)
|
||||
|
||||
MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz)
|
||||
MCFG_DEVICE_DISABLE()
|
||||
|
||||
MCFG_ESQPANEL2x40_ADD("panel", esqpanel_config)
|
||||
|
||||
@ -652,10 +882,21 @@ static MACHINE_CONFIG_START( vfx, esq5505_state )
|
||||
MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, "midiout")
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
MCFG_SOUND_ADD("ensoniq", ES5505, XTAL_10MHz)
|
||||
MCFG_SOUND_CONFIG(es5505_config)
|
||||
|
||||
MCFG_SOUND_ADD("pump", ESQ_5505_5510_PUMP, XTAL_10MHz / (16 * 21))
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 2.0)
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 2.0)
|
||||
|
||||
MCFG_SOUND_ADD("otis", ES5505, XTAL_10MHz)
|
||||
MCFG_SOUND_CONFIG(es5505_config)
|
||||
MCFG_SOUND_ROUTE_EX(0, "pump", 1.0, 0)
|
||||
MCFG_SOUND_ROUTE_EX(1, "pump", 1.0, 1)
|
||||
MCFG_SOUND_ROUTE_EX(2, "pump", 1.0, 2)
|
||||
MCFG_SOUND_ROUTE_EX(3, "pump", 1.0, 3)
|
||||
MCFG_SOUND_ROUTE_EX(4, "pump", 1.0, 4)
|
||||
MCFG_SOUND_ROUTE_EX(5, "pump", 1.0, 5)
|
||||
MCFG_SOUND_ROUTE_EX(6, "pump", 1.0, 6)
|
||||
MCFG_SOUND_ROUTE_EX(7, "pump", 1.0, 7)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED(eps, vfx)
|
||||
@ -685,6 +926,7 @@ static MACHINE_CONFIG_START(vfx32, esq5505_state)
|
||||
MCFG_CPU_PROGRAM_MAP(vfxsd_map)
|
||||
|
||||
MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz)
|
||||
MCFG_DEVICE_DISABLE()
|
||||
|
||||
MCFG_ESQPANEL2x40_ADD("panel", esqpanel_config)
|
||||
|
||||
@ -694,11 +936,22 @@ static MACHINE_CONFIG_START(vfx32, esq5505_state)
|
||||
MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, "midiout")
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
MCFG_SOUND_ADD("ensoniq", ES5505, XTAL_30_4761MHz / 2)
|
||||
MCFG_SOUND_CONFIG(es5505_config)
|
||||
|
||||
MCFG_SOUND_ADD("pump", ESQ_5505_5510_PUMP, XTAL_30_4761MHz / (2 * 16 * 32))
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 2.0)
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 2.0)
|
||||
|
||||
MCFG_SOUND_ADD("otis", ES5505, XTAL_30_4761MHz / 2)
|
||||
MCFG_SOUND_CONFIG(es5505_config)
|
||||
MCFG_SOUND_ROUTE_EX(0, "pump", 1.0, 0)
|
||||
MCFG_SOUND_ROUTE_EX(1, "pump", 1.0, 1)
|
||||
MCFG_SOUND_ROUTE_EX(2, "pump", 1.0, 2)
|
||||
MCFG_SOUND_ROUTE_EX(3, "pump", 1.0, 3)
|
||||
MCFG_SOUND_ROUTE_EX(4, "pump", 1.0, 4)
|
||||
MCFG_SOUND_ROUTE_EX(5, "pump", 1.0, 5)
|
||||
MCFG_SOUND_ROUTE_EX(6, "pump", 1.0, 6)
|
||||
MCFG_SOUND_ROUTE_EX(7, "pump", 1.0, 7)
|
||||
|
||||
MCFG_WD1772x_ADD("wd1772", 8000000)
|
||||
MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats)
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -410,6 +410,7 @@ static const es5506_interface es5506_config =
|
||||
"waverom2", /* Bank 1 */
|
||||
"waverom3", /* Bank 0 */
|
||||
"waverom4", /* Bank 1 */
|
||||
1, /* channels */
|
||||
DEVCB_DRIVER_LINE_MEMBER(esqkt_state,esq5506_otto_irq), /* irq */
|
||||
DEVCB_DEVICE_HANDLER(DEVICE_SELF, esq5506_read_adc)
|
||||
};
|
||||
@ -420,6 +421,7 @@ static const es5506_interface es5506_2_config =
|
||||
"waverom2", /* Bank 1 */
|
||||
"waverom3", /* Bank 0 */
|
||||
"waverom4", /* Bank 1 */
|
||||
1, /* channels */
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL
|
||||
};
|
||||
|
@ -65,6 +65,7 @@ static const es5506_interface es5506_config =
|
||||
"waverom2", /* Bank 1 */
|
||||
"waverom3", /* Bank 0 */
|
||||
"waverom4", /* Bank 1 */
|
||||
1, /* channels */
|
||||
DEVCB_LINE(esq5506_otto_irq), /* irq */
|
||||
DEVCB_DEVICE_HANDLER(DEVICE_SELF, esq5506_read_adc)
|
||||
};
|
||||
@ -75,6 +76,7 @@ static const es5506_interface es5506_2_config =
|
||||
"waverom2", /* Bank 1 */
|
||||
"waverom3", /* Bank 0 */
|
||||
"waverom4", /* Bank 1 */
|
||||
1, /* channels */
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user