Quiet anonymous union errors. Used a couple different techniques, all compile to same code as before with -O3 (nw)

This commit is contained in:
Cowering 2015-07-04 15:55:18 -05:00
parent 674255fa0d
commit f1ea61c268
10 changed files with 190 additions and 184 deletions

View File

@ -353,47 +353,47 @@ UINT32 ssp1601_device::ptr1_read_(int ri, int isj2, int modi3)
// mod=0 (00) // mod=0 (00)
case 0x00: case 0x00:
case 0x01: case 0x01:
case 0x02: return m_RAM0[m_r0[t&3]]; case 0x02: return mem.m_RAM0[regs.m_r0[t&3]];
case 0x03: return m_RAM0[0]; case 0x03: return mem.m_RAM0[0];
case 0x04: case 0x04:
case 0x05: case 0x05:
case 0x06: return m_RAM1[m_r1[t&3]]; case 0x06: return mem.m_RAM1[regs.m_r1[t&3]];
case 0x07: return m_RAM1[0]; case 0x07: return mem.m_RAM1[0];
// mod=1 (01), "+!" // mod=1 (01), "+!"
case 0x08: case 0x08:
case 0x09: case 0x09:
case 0x0a: return m_RAM0[m_r0[t&3]++]; case 0x0a: return mem.m_RAM0[regs.m_r0[t&3]++];
case 0x0b: return m_RAM0[1]; case 0x0b: return mem.m_RAM0[1];
case 0x0c: case 0x0c:
case 0x0d: case 0x0d:
case 0x0e: return m_RAM1[m_r1[t&3]++]; case 0x0e: return mem.m_RAM1[regs.m_r1[t&3]++];
case 0x0f: return m_RAM1[1]; case 0x0f: return mem.m_RAM1[1];
// mod=2 (10), "-" // mod=2 (10), "-"
case 0x10: case 0x10:
case 0x11: case 0x11:
case 0x12: rp = &m_r0[t&3]; t = m_RAM0[*rp]; case 0x12: rp = &regs.m_r0[t&3]; t = mem.m_RAM0[*rp];
if (!(rST&7)) { (*rp)--; return t; } if (!(rST&7)) { (*rp)--; return t; }
add = -1; goto modulo; add = -1; goto modulo;
case 0x13: return m_RAM0[2]; case 0x13: return mem.m_RAM0[2];
case 0x14: case 0x14:
case 0x15: case 0x15:
case 0x16: rp = &m_r1[t&3]; t = m_RAM1[*rp]; case 0x16: rp = &regs.m_r1[t&3]; t = mem.m_RAM1[*rp];
if (!(rST&7)) { (*rp)--; return t; } if (!(rST&7)) { (*rp)--; return t; }
add = -1; goto modulo; add = -1; goto modulo;
case 0x17: return m_RAM1[2]; case 0x17: return mem.m_RAM1[2];
// mod=3 (11), "+" // mod=3 (11), "+"
case 0x18: case 0x18:
case 0x19: case 0x19:
case 0x1a: rp = &m_r0[t&3]; t = m_RAM0[*rp]; case 0x1a: rp = &regs.m_r0[t&3]; t = mem.m_RAM0[*rp];
if (!(rST&7)) { (*rp)++; return t; } if (!(rST&7)) { (*rp)++; return t; }
add = 1; goto modulo; add = 1; goto modulo;
case 0x1b: return m_RAM0[3]; case 0x1b: return mem.m_RAM0[3];
case 0x1c: case 0x1c:
case 0x1d: case 0x1d:
case 0x1e: rp = &m_r1[t&3]; t = m_RAM1[*rp]; case 0x1e: rp = &regs.m_r1[t&3]; t = mem.m_RAM1[*rp];
if (!(rST&7)) { (*rp)++; return t; } if (!(rST&7)) { (*rp)++; return t; }
add = 1; goto modulo; add = 1; goto modulo;
case 0x1f: return m_RAM1[3]; case 0x1f: return mem.m_RAM1[3];
} }
return 0; return 0;
@ -412,40 +412,40 @@ void ssp1601_device::ptr1_write(int op, UINT32 d)
// mod=0 (00) // mod=0 (00)
case 0x00: case 0x00:
case 0x01: case 0x01:
case 0x02: m_RAM0[m_r0[t&3]] = d; return; case 0x02: mem.m_RAM0[regs.m_r0[t&3]] = d; return;
case 0x03: m_RAM0[0] = d; return; case 0x03: mem.m_RAM0[0] = d; return;
case 0x04: case 0x04:
case 0x05: case 0x05:
case 0x06: m_RAM1[m_r1[t&3]] = d; return; case 0x06: mem.m_RAM1[regs.m_r1[t&3]] = d; return;
case 0x07: m_RAM1[0] = d; return; case 0x07: mem.m_RAM1[0] = d; return;
// mod=1 (01), "+!" // mod=1 (01), "+!"
// mod=3, "+" // mod=3, "+"
case 0x08: case 0x08:
case 0x09: case 0x09:
case 0x0a: m_RAM0[m_r0[t&3]++] = d; return; case 0x0a: mem.m_RAM0[regs.m_r0[t&3]++] = d; return;
case 0x0b: m_RAM0[1] = d; return; case 0x0b: mem.m_RAM0[1] = d; return;
case 0x0c: case 0x0c:
case 0x0d: case 0x0d:
case 0x0e: m_RAM1[m_r1[t&3]++] = d; return; case 0x0e: mem.m_RAM1[regs.m_r1[t&3]++] = d; return;
case 0x0f: m_RAM1[1] = d; return; case 0x0f: mem.m_RAM1[1] = d; return;
// mod=2 (10), "-" // mod=2 (10), "-"
case 0x10: case 0x10:
case 0x11: case 0x11:
case 0x12: m_RAM0[m_r0[t&3]--] = d; CHECK_RPL(); return; case 0x12: mem.m_RAM0[regs.m_r0[t&3]--] = d; CHECK_RPL(); return;
case 0x13: m_RAM0[2] = d; return; case 0x13: mem.m_RAM0[2] = d; return;
case 0x14: case 0x14:
case 0x15: case 0x15:
case 0x16: m_RAM1[m_r1[t&3]--] = d; CHECK_RPL(); return; case 0x16: mem.m_RAM1[regs.m_r1[t&3]--] = d; CHECK_RPL(); return;
case 0x17: m_RAM1[2] = d; return; case 0x17: mem.m_RAM1[2] = d; return;
// mod=3 (11), "+" // mod=3 (11), "+"
case 0x18: case 0x18:
case 0x19: case 0x19:
case 0x1a: m_RAM0[m_r0[t&3]++] = d; CHECK_RPL(); return; case 0x1a: mem.m_RAM0[regs.m_r0[t&3]++] = d; CHECK_RPL(); return;
case 0x1b: m_RAM0[3] = d; return; case 0x1b: mem.m_RAM0[3] = d; return;
case 0x1c: case 0x1c:
case 0x1d: case 0x1d:
case 0x1e: m_RAM1[m_r1[t&3]++] = d; CHECK_RPL(); return; case 0x1e: mem.m_RAM1[regs.m_r1[t&3]++] = d; CHECK_RPL(); return;
case 0x1f: m_RAM1[3] = d; return; case 0x1f: mem.m_RAM1[3] = d; return;
} }
} }
@ -457,21 +457,21 @@ UINT32 ssp1601_device::ptr2_read(int op)
// mod=0 (00) // mod=0 (00)
case 0x00: case 0x00:
case 0x01: case 0x01:
case 0x02: mv = m_RAM0[m_r0[t&3]]++; break; case 0x02: mv = mem.m_RAM0[regs.m_r0[t&3]]++; break;
case 0x03: mv = m_RAM0[0]++; break; case 0x03: mv = mem.m_RAM0[0]++; break;
case 0x04: case 0x04:
case 0x05: case 0x05:
case 0x06: mv = m_RAM1[m_r1[t&3]]++; break; case 0x06: mv = mem.m_RAM1[regs.m_r1[t&3]]++; break;
case 0x07: mv = m_RAM1[0]++; break; case 0x07: mv = mem.m_RAM1[0]++; break;
// mod=1 (01) // mod=1 (01)
case 0x0b: mv = m_RAM0[1]++; break; case 0x0b: mv = mem.m_RAM0[1]++; break;
case 0x0f: mv = m_RAM1[1]++; break; case 0x0f: mv = mem.m_RAM1[1]++; break;
// mod=2 (10) // mod=2 (10)
case 0x13: mv = m_RAM0[2]++; break; case 0x13: mv = mem.m_RAM0[2]++; break;
case 0x17: mv = m_RAM1[2]++; break; case 0x17: mv = mem.m_RAM1[2]++; break;
// mod=3 (11) // mod=3 (11)
case 0x1b: mv = m_RAM0[3]++; break; case 0x1b: mv = mem.m_RAM0[3]++; break;
case 0x1f: mv = m_RAM1[3]++; break; case 0x1f: mv = mem.m_RAM1[3]++; break;
default: logerror(__FILE__ " FIXME: unimplemented mod in ((rX)) @ %04x\n", GET_PPC_OFFS()); default: logerror(__FILE__ " FIXME: unimplemented mod in ((rX)) @ %04x\n", GET_PPC_OFFS());
return 0; return 0;
} }

View File

@ -57,14 +57,14 @@ private:
struct { struct {
unsigned char m_r0[4]; unsigned char m_r0[4];
unsigned char m_r1[4]; unsigned char m_r1[4];
}; } regs;
}; };
union { union {
unsigned short m_RAM[256*2]; /* 2 256-word internal RAM banks */ unsigned short m_RAM[256*2]; /* 2 256-word internal RAM banks */
struct { struct {
unsigned short m_RAM0[256]; unsigned short m_RAM0[256];
unsigned short m_RAM1[256]; unsigned short m_RAM1[256];
}; } mem;
}; };
UINT16 m_stack[6]; /* 6-level hardware stack */ UINT16 m_stack[6]; /* 6-level hardware stack */
PAIR m_ppc; PAIR m_ppc;

View File

@ -138,10 +138,10 @@ void ics2115_device::device_reset()
int ics2115_voice::update_volume_envelope() int ics2115_voice::update_volume_envelope()
{ {
int ret = 0; int ret = 0;
if(vol_ctrl.done || vol_ctrl.stop) if(vol_ctrl.bitflags.done || vol_ctrl.bitflags.stop)
return ret; return ret;
if(vol_ctrl.invert) { if(vol_ctrl.bitflags.invert) {
vol.acc -= vol.add; vol.acc -= vol.add;
vol.left = vol.acc - vol.start; vol.left = vol.acc - vol.start;
} else { } else {
@ -152,26 +152,26 @@ int ics2115_voice::update_volume_envelope()
if(vol.left > 0) if(vol.left > 0)
return ret; return ret;
if(vol_ctrl.irq) { if(vol_ctrl.bitflags.irq) {
vol_ctrl.irq_pending = true; vol_ctrl.bitflags.irq_pending = true;
ret = 1; ret = 1;
} }
if(osc_conf.eightbit) if(osc_conf.bitflags.eightbit)
return ret; return ret;
if(vol_ctrl.loop) { if(vol_ctrl.bitflags.loop) {
if(vol_ctrl.loop_bidir) if(vol_ctrl.bitflags.loop_bidir)
vol_ctrl.invert = !vol_ctrl.invert; vol_ctrl.bitflags.invert = !vol_ctrl.bitflags.invert;
if(vol_ctrl.invert) if(vol_ctrl.bitflags.invert)
vol.acc = vol.end + vol.left; vol.acc = vol.end + vol.left;
else else
vol.acc = vol.start - vol.left; vol.acc = vol.start - vol.left;
} else { } else {
state.on = false; state.bitflags.on = false;
vol_ctrl.done = true; vol_ctrl.bitflags.done = true;
if(vol_ctrl.invert) if(vol_ctrl.bitflags.invert)
vol.acc = vol.end; vol.acc = vol.end;
else else
vol.acc = vol.start; vol.acc = vol.start;
@ -198,9 +198,9 @@ int ics2115_voice::update_volume_envelope()
int ics2115_voice::update_oscillator() int ics2115_voice::update_oscillator()
{ {
int ret = 0; int ret = 0;
if(osc_conf.stop) if(osc_conf.bitflags.stop)
return ret; return ret;
if(osc_conf.invert) { if(osc_conf.bitflags.invert) {
osc.acc -= osc.fc << 2; osc.acc -= osc.fc << 2;
osc.left = osc.acc - osc.start; osc.left = osc.acc - osc.start;
} else { } else {
@ -210,17 +210,17 @@ int ics2115_voice::update_oscillator()
// > instead of >= to stop crackling? // > instead of >= to stop crackling?
if(osc.left > 0) if(osc.left > 0)
return ret; return ret;
if(osc_conf.irq) { if(osc_conf.bitflags.irq) {
osc_conf.irq_pending = true; osc_conf.bitflags.irq_pending = true;
ret = 1; ret = 1;
} }
if(osc_conf.loop) { if(osc_conf.bitflags.loop) {
if(osc_conf.loop_bidir) if(osc_conf.bitflags.loop_bidir)
osc_conf.invert = !osc_conf.invert; osc_conf.bitflags.invert = !osc_conf.bitflags.invert;
//else //else
// printf("click!\n"); // printf("click!\n");
if(osc_conf.invert) { if(osc_conf.bitflags.invert) {
osc.acc = osc.end + osc.left; osc.acc = osc.end + osc.left;
osc.left = osc.acc - osc.start; osc.left = osc.acc - osc.start;
} }
@ -229,9 +229,9 @@ int ics2115_voice::update_oscillator()
osc.left = osc.end - osc.acc; osc.left = osc.end - osc.acc;
} }
} else { } else {
state.on = false; state.bitflags.on = false;
osc_conf.stop = true; osc_conf.bitflags.stop = true;
if(!osc_conf.invert) if(!osc_conf.bitflags.invert)
osc.acc = osc.end; osc.acc = osc.end;
else else
osc.acc = osc.start; osc.acc = osc.start;
@ -245,7 +245,7 @@ stream_sample_t ics2115_device::get_sample(ics2115_voice& voice)
UINT32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12); UINT32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12);
UINT32 nextaddr; UINT32 nextaddr;
if (voice.state.on && voice.osc_conf.loop && !voice.osc_conf.loop_bidir && if (voice.state.bitflags.on && voice.osc_conf.bitflags.loop && !voice.osc_conf.bitflags.loop_bidir &&
(voice.osc.left < (voice.osc.fc <<2))) { (voice.osc.left < (voice.osc.fc <<2))) {
//printf("C?[%x:%x]", voice.osc.left, voice.osc.acc); //printf("C?[%x:%x]", voice.osc.left, voice.osc.acc);
nextaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.start >> 12); nextaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.start >> 12);
@ -255,7 +255,7 @@ stream_sample_t ics2115_device::get_sample(ics2115_voice& voice)
INT16 sample1, sample2; INT16 sample1, sample2;
if (voice.osc_conf.eightbit) { if (voice.osc_conf.bitflags.eightbit) {
sample1 = ((INT8)m_rom[curaddr]) << 8; sample1 = ((INT8)m_rom[curaddr]) << 8;
sample2 = ((INT8)m_rom[curaddr + 1]) << 8; sample2 = ((INT8)m_rom[curaddr + 1]) << 8;
} }
@ -283,21 +283,21 @@ stream_sample_t ics2115_device::get_sample(ics2115_voice& voice)
bool ics2115_voice::playing() bool ics2115_voice::playing()
{ {
return state.on && !((vol_ctrl.done || vol_ctrl.stop) && osc_conf.stop); return state.bitflags.on && !((vol_ctrl.bitflags.done || vol_ctrl.bitflags.stop) && osc_conf.bitflags.stop);
} }
void ics2115_voice::update_ramp() { void ics2115_voice::update_ramp() {
//slow attack //slow attack
if (state.on && !osc_conf.stop) { if (state.bitflags.on && !osc_conf.bitflags.stop) {
if (state.ramp < 0x40) if (state.bitflags.ramp < 0x40)
state.ramp += 0x1; state.bitflags.ramp += 0x1;
else else
state.ramp = 0x40; state.bitflags.ramp = 0x40;
} }
//slow release //slow release
else { else {
if (state.ramp) if (state.bitflags.ramp)
state.ramp -= 0x1; state.bitflags.ramp -= 0x1;
} }
} }
@ -309,7 +309,7 @@ int ics2115_device::fill_output(ics2115_voice& voice, stream_sample_t *outputs[2
for (int i = 0; i < samples; i++) { for (int i = 0; i < samples; i++) {
UINT32 volacc = (voice.vol.acc >> 10) & 0xffff; UINT32 volacc = (voice.vol.acc >> 10) & 0xffff;
UINT32 volume = (m_volume[volacc >> 4] * voice.state.ramp) >> 6; UINT32 volume = (m_volume[volacc >> 4] * voice.state.bitflags.ramp) >> 6;
UINT16 vleft = volume; //* (255 - voice.vol.pan) / 0x80]; UINT16 vleft = volume; //* (255 - voice.vol.pan) / 0x80];
UINT16 vright = volume; //* (voice.vol.pan + 1) / 0x80]; UINT16 vright = volume; //* (voice.vol.pan + 1) / 0x80];
@ -319,7 +319,7 @@ int ics2115_device::fill_output(ics2115_voice& voice, stream_sample_t *outputs[2
//that the voice is pointing at is contributing to the summation. //that the voice is pointing at is contributing to the summation.
//(austere note: this will of course fix some of the glitches due to multiple transition) //(austere note: this will of course fix some of the glitches due to multiple transition)
stream_sample_t sample; stream_sample_t sample;
if(voice.osc_conf.ulaw) { if(voice.osc_conf.bitflags.ulaw) {
UINT32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12); UINT32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12);
sample = m_ulaw[m_rom[curaddr]]; sample = m_ulaw[m_rom[curaddr]];
} }
@ -361,7 +361,7 @@ void ics2115_device::sound_stream_update(sound_stream &stream, stream_sample_t *
#ifdef ICS2115_DEBUG #ifdef ICS2115_DEBUG
UINT32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12); UINT32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12);
stream_sample_t sample; stream_sample_t sample;
if(voice.osc_conf.ulaw) if(voice.osc_conf.bitflags.ulaw)
sample = m_ulaw[m_rom[curaddr]]; sample = m_ulaw[m_rom[curaddr]];
else else
sample = get_sample(voice); sample = get_sample(voice);
@ -374,7 +374,7 @@ void ics2115_device::sound_stream_update(sound_stream &stream, stream_sample_t *
#ifdef ICS2115_DEBUG #ifdef ICS2115_DEBUG
if(voice.playing()) { if(voice.playing()) {
printf("%d", osc); printf("%d", osc);
if (voice.osc_conf.invert) if (voice.osc_conf.bitflags.invert)
printf("+"); printf("+");
else if ((voice.osc.fc >> 1) > 0x1ff) else if ((voice.osc.fc >> 1) > 0x1ff)
printf("*"); printf("*");
@ -488,10 +488,10 @@ UINT16 ics2115_device::reg_read() {
// may expect |8 on reg 0 on voice irq with &80 == 0 // may expect |8 on reg 0 on voice irq with &80 == 0
// ret = 0xFF; // ret = 0xFF;
if (!m_vmode) if (!m_vmode)
ret = voice.vol_ctrl.irq ? 0x81 : 0x01; ret = voice.vol_ctrl.bitflags.irq ? 0x81 : 0x01;
else else
ret = 0x01; ret = 0x01;
//ret = voice.vol_ctrl.value | 0x1; //ret = voice.vol_ctrl.bitflags.value | 0x1;
ret <<= 8; ret <<= 8;
break; break;
@ -503,17 +503,17 @@ UINT16 ics2115_device::reg_read() {
ret = 0xff; ret = 0xff;
for (int i = 0; i <= m_active_osc; i++) { for (int i = 0; i <= m_active_osc; i++) {
ics2115_voice& v = m_voice[i]; ics2115_voice& v = m_voice[i];
if (v.osc_conf.irq_pending || v.vol_ctrl.irq_pending) { if (v.osc_conf.bitflags.irq_pending || v.vol_ctrl.bitflags.irq_pending) {
ret = i | 0xe0; ret = i | 0xe0;
ret &= v.vol_ctrl.irq_pending ? (~0x40) : 0xff; ret &= v.vol_ctrl.bitflags.irq_pending ? (~0x40) : 0xff;
ret &= v.osc_conf.irq_pending ? (~0x80) : 0xff; ret &= v.osc_conf.bitflags.irq_pending ? (~0x80) : 0xff;
recalc_irq(); recalc_irq();
if (v.osc_conf.irq_pending) { if (v.osc_conf.bitflags.irq_pending) {
v.osc_conf.irq_pending = 0; v.osc_conf.bitflags.irq_pending = 0;
ret &= ~0x80; ret &= ~0x80;
} }
if (v.vol_ctrl.irq_pending) { if (v.vol_ctrl.bitflags.irq_pending) {
v.vol_ctrl.irq_pending = 0; v.vol_ctrl.bitflags.irq_pending = 0;
ret &= ~0x40; ret &= ~0x40;
} }
break; break;
@ -694,14 +694,14 @@ void ics2115_device::reg_write(UINT8 data, bool msb) {
#ifdef ICS2115_ISOLATE #ifdef ICS2115_ISOLATE
if (m_osc_select == ICS2115_ISOLATE) if (m_osc_select == ICS2115_ISOLATE)
#endif #endif
if (!voice.osc_conf.stop || !voice.vol_ctrl.stop) if (!voice.osc_conf.bitflags.stop || !voice.vol_ctrl.bitflags.stop)
printf("[%02d STOP]\n", m_osc_select); printf("[%02d STOP]\n", m_osc_select);
#endif #endif
if (!m_vmode) { if (!m_vmode) {
voice.osc_conf.stop = true; voice.osc_conf.bitflags.stop = true;
voice.vol_ctrl.stop = true; voice.vol_ctrl.bitflags.stop = true;
//try to key it off as well! //try to key it off as well!
voice.state.on = false; voice.state.bitflags.on = false;
} }
} }
#ifdef ICS2115_DEBUG #ifdef ICS2115_DEBUG
@ -769,8 +769,8 @@ READ8_MEMBER(ics2115_device::read)
if (m_irq_enabled && (m_irq_pending & 3)) if (m_irq_enabled && (m_irq_pending & 3))
ret |= 1; ret |= 1;
for (int i = 0; i <= m_active_osc; i++) { for (int i = 0; i <= m_active_osc; i++) {
if (//m_voice[i].vol_ctrl.irq_pending || if (//m_voice[i].vol_ctrl.bitflags.irq_pending ||
m_voice[i].osc_conf.irq_pending) { m_voice[i].osc_conf.bitflags.irq_pending) {
ret |= 2; ret |= 2;
break; break;
} }
@ -823,9 +823,9 @@ void ics2115_device::keyon()
return; return;
#endif #endif
//set initial condition (may need to invert?) -- does NOT work since these are set to zero even //set initial condition (may need to invert?) -- does NOT work since these are set to zero even
m_voice[m_osc_select].state.on = true; m_voice[m_osc_select].state.bitflags.on = true;
//no ramp up... //no ramp up...
m_voice[m_osc_select].state.ramp = 0x40; m_voice[m_osc_select].state.bitflags.ramp = 0x40;
#ifdef ICS2115_DEBUG #ifdef ICS2115_DEBUG
printf("[%02d vs:%04x ve:%04x va:%04x vi:%02x vc:%02x os:%06x oe:%06x oa:%06x of:%04x SA:%02x oc:%02x][%04x]\n", m_osc_select, printf("[%02d vs:%04x ve:%04x va:%04x vi:%02x vc:%02x os:%06x oe:%06x oa:%06x of:%04x SA:%02x oc:%02x][%04x]\n", m_osc_select,
@ -852,7 +852,7 @@ void ics2115_device::recalc_irq()
//Suspect //Suspect
bool irq = (m_irq_pending & m_irq_enabled); bool irq = (m_irq_pending & m_irq_enabled);
for(int i = 0; (!irq) && (i < 32); i++) for(int i = 0; (!irq) && (i < 32); i++)
irq |= m_voice[i].vol_ctrl.irq_pending && m_voice[i].osc_conf.irq_pending; irq |= m_voice[i].vol_ctrl.bitflags.irq_pending && m_voice[i].osc_conf.bitflags.irq_pending;
m_irq_on = irq; m_irq_on = irq;
if(!m_irq_cb.isnull()) if(!m_irq_cb.isnull())
m_irq_cb(irq ? ASSERT_LINE : CLEAR_LINE); m_irq_cb(irq ? ASSERT_LINE : CLEAR_LINE);

View File

@ -49,7 +49,7 @@ struct ics2115_voice {
UINT8 invert : 1; UINT8 invert : 1;
UINT8 irq_pending: 1; UINT8 irq_pending: 1;
//IRQ on variable? //IRQ on variable?
}; } bitflags;
UINT8 value; UINT8 value;
} osc_conf; } osc_conf;
@ -64,7 +64,7 @@ struct ics2115_voice {
UINT8 invert : 1; //invert direction UINT8 invert : 1; //invert direction
UINT8 irq_pending: 1; //(read only) IRQ pending UINT8 irq_pending: 1; //(read only) IRQ pending
//noenvelope == (done | disable) //noenvelope == (done | disable)
}; } bitflags;
UINT8 value; UINT8 value;
} vol_ctrl; } vol_ctrl;
@ -74,7 +74,7 @@ struct ics2115_voice {
struct { struct {
UINT8 on : 1; UINT8 on : 1;
UINT8 ramp : 7; // 100 0000 = 0x40 maximum UINT8 ramp : 7; // 100 0000 = 0x40 maximum
}; } bitflags;
UINT8 value; UINT8 value;
} state; } state;

View File

@ -22,20 +22,20 @@
*************************************/ *************************************/
/* Borrowed from segasnd.c */ /* Borrowed from segasnd.c */
INLINE void configure_filter(filter_state *state, double r, double c) INLINE void configure_filter(m3d_filter_state *state, double r, double c)
{ {
state->capval = 0; state->capval = 0;
state->exponent = 1.0 - exp(-1.0 / (r * c * 2000000/8)); state->exponent = 1.0 - exp(-1.0 / (r * c * 2000000/8));
} }
#if 0 #if 0
INLINE double step_rc_filter(filter_state *state, double input) INLINE double step_rc_filter(m3d_filter_state *state, double input)
{ {
state->capval += (input - state->capval) * state->exponent; state->capval += (input - state->capval) * state->exponent;
return state->capval; return state->capval;
} }
INLINE double step_cr_filter(filter_state *state, double input) INLINE double step_cr_filter(m3d_filter_state *state, double input)
{ {
double result = (input - state->capval); double result = (input - state->capval);
state->capval += (input - state->capval) * state->exponent; state->capval += (input - state->capval) * state->exponent;
@ -144,13 +144,13 @@ void micro3d_sound_device::noise_sh_w(UINT8 data)
m_dac[data & 3] = state->m_dac_data; m_dac[data & 3] = state->m_dac_data;
if (m_vca == 255) if (m_dac[VCA] == 255)
m_gain = 0; m_gain = 0;
else else
m_gain = expf(-(float)(m_vca) / 25.0f) * 10.0f; m_gain = expf(-(float)(m_dac[VCA]) / 25.0f) * 10.0f;
q = 0.75/255 * (255 - m_vcq) + 0.1; q = 0.75/255 * (255 - m_dac[VCQ]) + 0.1;
fc = 4500.0/255 * (255 - m_vcf) + 100; fc = 4500.0/255 * (255 - m_dac[VCF]) + 100;
recompute_filter(&m_filter, m_gain, q, fc); recompute_filter(&m_filter, m_gain, q, fc);
} }
@ -170,16 +170,14 @@ const device_type MICRO3D = &device_creator<micro3d_sound_device>;
micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MICRO3D, "Microprose Audio Custom", tag, owner, clock, "micro3d_sound", __FILE__), : device_t(mconfig, MICRO3D, "Microprose Audio Custom", tag, owner, clock, "micro3d_sound", __FILE__),
device_sound_interface(mconfig, *this), device_sound_interface(mconfig, *this),
m_vcf(0),
m_vcq(0),
m_vca(0),
m_pan(0),
m_gain(0), m_gain(0),
m_noise_shift(0), m_noise_shift(0),
m_noise_value(0), m_noise_value(0),
m_noise_subcount(0), m_noise_subcount(0),
m_stream(NULL) m_stream(NULL)
{ {
memset(m_dac, 0, sizeof(UINT8)*4);
} }
//------------------------------------------------- //-------------------------------------------------
@ -241,8 +239,8 @@ void micro3d_sound_device::sound_stream_update(sound_stream &stream, stream_samp
if (m_gain == 0) if (m_gain == 0)
return; return;
pan_l = (float)(255 - m_pan) / 255.0f; pan_l = (float)(255 - m_dac[PAN]) / 255.0f;
pan_r = (float)(m_pan) / 255.0f; pan_r = (float)(m_dac[PAN]) / 255.0f;
while (samples--) while (samples--)
{ {

View File

@ -132,12 +132,12 @@ WRITE8_MEMBER( tx1_sound_device::pit8253_w )
{ {
if (m_pit8253.idx[offset] == 0) if (m_pit8253.idx[offset] == 0)
{ {
m_pit8253.counts[offset].LSB = data; m_pit8253.counts[offset].as8bit.LSB = data;
m_pit8253.idx[offset] = 1; m_pit8253.idx[offset] = 1;
} }
else else
{ {
m_pit8253.counts[offset].MSB = data; m_pit8253.counts[offset].as8bit.MSB = data;
m_pit8253.idx[offset] = 0; m_pit8253.idx[offset] = 0;
} }
} }

View File

@ -102,11 +102,11 @@
union ADDR_REG union ADDR_REG
{ {
#ifdef LSB_FIRST #ifdef LSB_FIRST
struct { UINT16 loword, hiword ; } ; struct { UINT16 loword, hiword ; } as16bit;
struct { UINT8 addr0, addr1, addr2; }; struct { UINT8 addr0, addr1, addr2; } as8bit;
#else #else
struct { UINT16 hiword, loword ; } ; struct { UINT16 hiword, loword ; } as16bit;
struct { UINT8 addr2, addr1, addr0; }; struct { UINT8 addr2, addr1, addr0; } as8bit;
#endif #endif
UINT32 addr; UINT32 addr;
}; };
@ -490,12 +490,12 @@ void bfcobra_state::RunBlit(address_space &space)
UINT8 dstdata = 0; UINT8 dstdata = 0;
/* Read the blitter command */ /* Read the blitter command */
BLITPRG_READ(source.addr0); BLITPRG_READ(source.as8bit.addr0);
BLITPRG_READ(source.addr1); BLITPRG_READ(source.as8bit.addr1);
BLITPRG_READ(source.addr2); BLITPRG_READ(source.as8bit.addr2);
BLITPRG_READ(dest.addr0); BLITPRG_READ(dest.as8bit.addr0);
BLITPRG_READ(dest.addr1); BLITPRG_READ(dest.as8bit.addr1);
BLITPRG_READ(dest.addr2); BLITPRG_READ(dest.as8bit.addr2);
BLITPRG_READ(modectl); BLITPRG_READ(modectl);
BLITPRG_READ(compfunc); BLITPRG_READ(compfunc);
BLITPRG_READ(outercnt); BLITPRG_READ(outercnt);
@ -516,13 +516,13 @@ void bfcobra_state::RunBlit(address_space &space)
blitter.command & CMD_SRCUP ? "SRCUP" : " ", blitter.command & CMD_SRCUP ? "SRCUP" : " ",
blitter.command & CMD_DSTUP ? "DSTUP" : " "); blitter.command & CMD_DSTUP ? "DSTUP" : " ");
osd_printf_debug("Src Address Byte 0 %.2x\n", blitter.source.addr0); osd_printf_debug("Src Address Byte 0 %.2x\n", blitter.source.as8bit.addr0);
osd_printf_debug("Src Address Byte 1 %.2x\n", blitter.source.addr1); osd_printf_debug("Src Address Byte 1 %.2x\n", blitter.source.as8bit.addr1);
osd_printf_debug("Src Control %.2x\n", blitter.source.addr2); osd_printf_debug("Src Control %.2x\n", blitter.source.as8bit.addr2);
osd_printf_debug(" Src Address %.5x\n", blitter.source.addr & 0xfffff); osd_printf_debug(" Src Address %.5x\n", blitter.source.addr & 0xfffff);
osd_printf_debug("Dest Address Byte 0 %.2x\n", blitter.dest.addr0); osd_printf_debug("Dest Address Byte 0 %.2x\n", blitter.dest.as8bit.addr0);
osd_printf_debug("Dest Address Byte 1 %.2x\n", blitter.dest.addr1); osd_printf_debug("Dest Address Byte 1 %.2x\n", blitter.dest.as8bit.addr1);
osd_printf_debug("Dest Control %.2x\n", blitter.dest.addr2); osd_printf_debug("Dest Control %.2x\n", blitter.dest.as8bit.addr2);
osd_printf_debug(" Dst. Address %.5x\n", blitter.dest.addr & 0xfffff); osd_printf_debug(" Dst. Address %.5x\n", blitter.dest.addr & 0xfffff);
osd_printf_debug("Mode Control %.2x", blitter.modectl); osd_printf_debug("Mode Control %.2x", blitter.modectl);
osd_printf_debug(" %s\n", blitter.modectl & MODE_BITTOBYTE ? "BIT_TO_BYTE" : ""); osd_printf_debug(" %s\n", blitter.modectl & MODE_BITTOBYTE ? "BIT_TO_BYTE" : "");
@ -552,40 +552,40 @@ void bfcobra_state::RunBlit(address_space &space)
if (blitter.modectl & MODE_YFRAC) if (blitter.modectl & MODE_YFRAC)
{ {
if (blitter.modectl & MODE_SSIGN ) if (blitter.modectl & MODE_SSIGN )
blitter.dest.addr0--; blitter.dest.as8bit.addr0--;
else else
blitter.dest.addr0++; blitter.dest.as8bit.addr0++;
} }
else else
{ {
if (blitter.modectl & MODE_DSIGN ) if (blitter.modectl & MODE_DSIGN )
blitter.dest.addr1--; blitter.dest.as8bit.addr1--;
else else
blitter.dest.addr1++; blitter.dest.as8bit.addr1++;
} }
if( blitter.source.addr0 < blitter.step ) if( blitter.source.as8bit.addr0 < blitter.step )
{ {
blitter.source.addr0 -=blitter.step ; blitter.source.as8bit.addr0 -= blitter.step ;
blitter.source.addr0 +=blitter.source.addr1; blitter.source.as8bit.addr0 += blitter.source.as8bit.addr1;
if ( blitter.modectl & MODE_YFRAC ) if ( blitter.modectl & MODE_YFRAC )
{ {
if (blitter.modectl & MODE_DSIGN ) if (blitter.modectl & MODE_DSIGN )
blitter.dest.addr1--; blitter.dest.as8bit.addr1--;
else else
blitter.dest.addr1++; blitter.dest.as8bit.addr1++;
} }
else else
{ {
if (blitter.modectl & MODE_SSIGN ) if (blitter.modectl & MODE_SSIGN )
blitter.dest.addr0--; blitter.dest.as8bit.addr0--;
else else
blitter.dest.addr0++; blitter.dest.as8bit.addr0++;
} }
} }
else else
{ {
blitter.source.addr0 -=blitter.step; blitter.source.as8bit.addr0 -= blitter.step;
} }
*blitter_get_addr( blitter.dest.addr) = blitter.pattern; *blitter_get_addr( blitter.dest.addr) = blitter.pattern;
@ -603,7 +603,7 @@ void bfcobra_state::RunBlit(address_space &space)
if (LOOPTYPE == 3 && innercnt == blitter.innercnt) if (LOOPTYPE == 3 && innercnt == blitter.innercnt)
{ {
srcdata = *(blitter_get_addr( blitter.source.addr & 0xfffff)); srcdata = *(blitter_get_addr( blitter.source.addr & 0xfffff));
blitter.source.loword++; blitter.source.as16bit.loword++;
cycles_used++; cycles_used++;
} }
@ -616,9 +616,9 @@ void bfcobra_state::RunBlit(address_space &space)
cycles_used++; cycles_used++;
if (blitter.modectl & MODE_SSIGN) if (blitter.modectl & MODE_SSIGN)
blitter.source.loword-- ; blitter.source.as16bit.loword-- ;
else else
blitter.source.loword++; blitter.source.as16bit.loword++;
result = srcdata; result = srcdata;
} }
@ -725,9 +725,9 @@ void bfcobra_state::RunBlit(address_space &space)
/* Update destination address */ /* Update destination address */
if (blitter.modectl & MODE_DSIGN) if (blitter.modectl & MODE_DSIGN)
blitter.dest.loword--; blitter.dest.as16bit.loword--;
else else
blitter.dest.loword++; blitter.dest.as16bit.loword++;
} while (--innercnt); } while (--innercnt);
@ -738,10 +738,10 @@ void bfcobra_state::RunBlit(address_space &space)
else else
{ {
if (blitter.command & CMD_DSTUP) if (blitter.command & CMD_DSTUP)
blitter.dest.loword += blitter.step; blitter.dest.as16bit.loword += blitter.step;
if (blitter.command & CMD_SRCUP) if (blitter.command & CMD_SRCUP)
blitter.source.loword += blitter.step; blitter.source.as16bit.loword += blitter.step;
if (blitter.command & CMD_PARRD) if (blitter.command & CMD_PARRD)
{ {
@ -937,7 +937,7 @@ READ8_MEMBER(bfcobra_state::chipset_r)
case 0x20: case 0x20:
{ {
/* Seems correct - used during RLE pic decoding */ /* Seems correct - used during RLE pic decoding */
val = m_blitter.dest.addr0; val = m_blitter.dest.as8bit.addr0;
break; break;
} }
case 0x22: case 0x22:
@ -1006,17 +1006,17 @@ WRITE8_MEMBER(bfcobra_state::chipset_w)
} }
case 0x18: case 0x18:
{ {
m_blitter.program.addr0 = data; m_blitter.program.as8bit.addr0 = data;
break; break;
} }
case 0x19: case 0x19:
{ {
m_blitter.program.addr1 = data; m_blitter.program.as8bit.addr1 = data;
break; break;
} }
case 0x1A: case 0x1A:
{ {
m_blitter.program.addr2 = data; m_blitter.program.as8bit.addr2 = data;
break; break;
} }
case 0x20: case 0x20:
@ -1091,7 +1091,7 @@ enum fdc_phase
COMMAND, COMMAND,
EXECUTION_R, EXECUTION_R,
EXECUTION_W, EXECUTION_W,
RESULTS, RESULTS
}; };
enum command enum command

View File

@ -29,9 +29,17 @@ enum planes
CLIP_X_MIN, CLIP_X_MIN,
CLIP_X_MAX, CLIP_X_MAX,
CLIP_Y_MIN, CLIP_Y_MIN,
CLIP_Y_MAX, CLIP_Y_MAX
}; };
enum dac_registers {
VCF,
VCQ,
VCA,
PAN
};
class micro3d_state : public driver_device class micro3d_state : public driver_device
{ {
public: public:
@ -196,7 +204,7 @@ struct lp_filter
biquad ProtoCoef[2]; biquad ProtoCoef[2];
}; };
struct filter_state struct m3d_filter_state
{ {
double capval; double capval;
double exponent; double exponent;
@ -221,24 +229,24 @@ protected:
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
private: private:
// internal state // internal state
union // union
{ // {
struct // struct
{ // {
UINT8 m_vcf; // UINT8 m_vcf;
UINT8 m_vcq; // UINT8 m_vcq;
UINT8 m_vca; // UINT8 m_vca;
UINT8 m_pan; // UINT8 m_pan;
}; // };
UINT8 m_dac[4]; UINT8 m_dac[4];
}; // };
float m_gain; float m_gain;
UINT32 m_noise_shift; UINT32 m_noise_shift;
UINT8 m_noise_value; UINT8 m_noise_value;
UINT8 m_noise_subcount; UINT8 m_noise_subcount;
filter_state m_noise_filters[4]; m3d_filter_state m_noise_filters[4];
lp_filter m_filter; lp_filter m_filter;
sound_stream *m_stream; sound_stream *m_stream;
}; };

View File

@ -56,9 +56,9 @@ struct sn74s516_t
union union
{ {
#ifdef LSB_FIRST #ifdef LSB_FIRST
struct { UINT16 W; INT16 Z; }; struct { UINT16 W; INT16 Z; } as16bit;
#else #else
struct { INT16 Z; UINT16 W; }; struct { INT16 Z; UINT16 W; } as16bit;
#endif #endif
INT32 ZW32; INT32 ZW32;
} ZW; } ZW;
@ -241,9 +241,9 @@ struct pit8253_state
union union
{ {
#ifdef LSB_FIRST #ifdef LSB_FIRST
struct { UINT8 LSB; UINT8 MSB; }; struct { UINT8 LSB; UINT8 MSB; } as8bit;
#else #else
struct { UINT8 MSB; UINT8 LSB; }; struct { UINT8 MSB; UINT8 LSB; } as8bit;
#endif #endif
UINT16 val; UINT16 val;
} counts[3]; } counts[3];

View File

@ -138,8 +138,8 @@ static void sn_divide(running_machine &machine)
if (SN74S516.X == 0) if (SN74S516.X == 0)
{ {
osd_printf_debug("%s:SN74S516 tried to divide by zero\n", machine.describe_context()); osd_printf_debug("%s:SN74S516 tried to divide by zero\n", machine.describe_context());
SN74S516.ZW.Z = (INT16)0xffff; SN74S516.ZW.as16bit.Z = (INT16)0xffff;
SN74S516.ZW.W = 0xffff; SN74S516.ZW.as16bit.W = 0xffff;
SN74S516.ZWfl = 0; SN74S516.ZWfl = 0;
return; return;
} }
@ -160,8 +160,8 @@ static void sn_divide(running_machine &machine)
} }
case 0x6664: case 0x6664:
{ {
Z = SN74S516.ZW.W / SN74S516.X; Z = SN74S516.ZW.as16bit.W / SN74S516.X;
W = SN74S516.ZW.W % SN74S516.X; W = SN74S516.ZW.as16bit.W % SN74S516.X;
break; break;
} }
default: default:
@ -174,8 +174,8 @@ static void sn_divide(running_machine &machine)
if (Z > 0xffff) if (Z > 0xffff)
Z |= 0xff00; Z |= 0xff00;
SN74S516.ZW.Z = Z; SN74S516.ZW.as16bit.Z = Z;
SN74S516.ZW.W = W; SN74S516.ZW.as16bit.W = W;
SN74S516.ZWfl = 0; SN74S516.ZWfl = 0;
} }
@ -205,9 +205,9 @@ static void kick_sn74s516(running_machine &machine, UINT16 *data, const int ins)
#define LOAD_X (SN74S516.X = *data) #define LOAD_X (SN74S516.X = *data)
#define LOAD_Y (SN74S516.Y = *data) #define LOAD_Y (SN74S516.Y = *data)
#define LOAD_Z (SN74S516.ZW.Z = *data) #define LOAD_Z (SN74S516.ZW.as16bit.Z = *data)
#define LOAD_W (SN74S516.ZW.W = *data) #define LOAD_W (SN74S516.ZW.as16bit.W = *data)
#define READ_ZW *data = SN74S516.ZWfl ? SN74S516.ZW.W : SN74S516.ZW.Z; \ #define READ_ZW *data = SN74S516.ZWfl ? SN74S516.ZW.as16bit.W : SN74S516.ZW.as16bit.Z; \
SN74S516.ZWfl ^= 1; SN74S516.ZWfl ^= 1;
#define UPDATE_SEQUENCE (SN74S516.code = (SN74S516.code << 4) | ins) #define UPDATE_SEQUENCE (SN74S516.code = (SN74S516.code << 4) | ins)
@ -359,7 +359,7 @@ static void kick_sn74s516(running_machine &machine, UINT16 *data, const int ins)
else if (ins == 7) else if (ins == 7)
{ {
/* 6667 = Load X, Load Z, Load W, Clear Z */ /* 6667 = Load X, Load Z, Load W, Clear Z */
SN74S516.ZW.Z = 0; SN74S516.ZW.as16bit.Z = 0;
sn74s516_update(machine, ins); sn74s516_update(machine, ins);
} }
break; break;
@ -955,7 +955,7 @@ enum
BB_MUX_DPROE, BB_MUX_DPROE,
BB_MUX_PPOE, BB_MUX_PPOE,
BB_MUX_INSCL, BB_MUX_INSCL,
BB_MUX_ILDEN, BB_MUX_ILDEN
}; };
#define BB_SET_INS0_BIT do { if (!(ins & 0x4) && math.i0ff) ins |= math.i0ff;} while(0) #define BB_SET_INS0_BIT do { if (!(ins & 0x4) && math.i0ff) ins |= math.i0ff;} while(0)