mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
XaviX - sound related notes + logging (#4267)
* audio notes (nw) * memory system bypass to stop annoying logging when tilemaps are enabled before regs get set etc. (nw) * some logging (nw) * more notes (nw) * note changes (nw) * note changes (nw) * device for later (nw)
This commit is contained in:
parent
b82160abbe
commit
adf14aa585
@ -4,153 +4,255 @@
|
||||
#include "emu.h"
|
||||
#include "includes/xavix.h"
|
||||
|
||||
// #define VERBOSE 1
|
||||
#define VERBOSE 1
|
||||
#include "logmacro.h"
|
||||
|
||||
// 16 channel sound?
|
||||
// 16 stereo channels?
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75f0_r)
|
||||
// xavix_sound_device
|
||||
|
||||
DEFINE_DEVICE_TYPE(XAVIX_SOUND, xavix_sound_device, "xavix_sound", "XaviX Sound")
|
||||
|
||||
xavix_sound_device::xavix_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, XAVIX_SOUND, tag, owner, clock)
|
||||
, device_sound_interface(mconfig, *this)
|
||||
, m_stream(nullptr)
|
||||
{
|
||||
// something? (same as 75f1) 1 bit per channel, 8 channels
|
||||
LOG("%s: sound_75f0_r\n", machine().describe_context());
|
||||
return m_soundregs[0];
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75f1_r)
|
||||
void xavix_sound_device::device_start()
|
||||
{
|
||||
// something? (same as 75f0) 1 bit per channel, 8 channels
|
||||
LOG("%s: sound_75f1_r\n", machine().describe_context());
|
||||
return m_soundregs[1];
|
||||
m_stream = stream_alloc(0, 1, 8000);
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75f6_r)
|
||||
void xavix_sound_device::device_reset()
|
||||
{
|
||||
LOG("%s: sound_75f6_r\n", machine().describe_context());
|
||||
}
|
||||
|
||||
void xavix_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
{
|
||||
// reset the output stream
|
||||
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
|
||||
|
||||
// loop while we still have samples to generate
|
||||
while (samples-- != 0)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
// xavix_state support
|
||||
|
||||
/* 75f0, 75f1 - 2x8 bits (16 channels?) */
|
||||
READ8_MEMBER(xavix_state::sound_reg16_0_r)
|
||||
{
|
||||
LOG("%s: sound_reg16_0_r %02x\n", machine().describe_context(), offset);
|
||||
return m_soundreg16_0[offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_reg16_0_w)
|
||||
{
|
||||
/* looks like the sound triggers
|
||||
|
||||
offset 0
|
||||
data & 0x01 - channel 0 (registers at regbase + 0x00) eg 0x3b00 - 0x3b0f in monster truck
|
||||
data & 0x02 - channel 1 (registers at regbase + 0x10) eg 0x3b10 - 0x3b1f in monster truck
|
||||
data & 0x04 - channel 2
|
||||
data & 0x08 - channel 3
|
||||
data & 0x10 - channel 4
|
||||
data & 0x20 - channel 5
|
||||
data & 0x40 - channel 6
|
||||
data & 0x80 - channel 7
|
||||
|
||||
offset 1
|
||||
data & 0x01 - channel 8
|
||||
data & 0x02 - channel 9
|
||||
data & 0x04 - channel 10
|
||||
data & 0x08 - channel 11
|
||||
data & 0x10 - channel 12
|
||||
data & 0x20 - channel 13
|
||||
data & 0x40 - channel 14 (registers at regbase + 0xf0) eg 0x3be0 - 0x3bef in monster truck
|
||||
data & 0x80 - channel 15 (registers at regbase + 0xf0) eg 0x3bf0 - 0x3bff in monster truck
|
||||
*/
|
||||
if (offset == 0)
|
||||
LOG("%s: sound_reg16_0_w %02x, %02x (%d %d %d %d %d %d %d %d - - - - - - - -)\n", machine().describe_context(), offset, data, (data & 0x01) ? 1 : 0, (data & 0x02) ? 1 : 0, (data & 0x04) ? 1 : 0, (data & 0x08) ? 1 : 0, (data & 0x10) ? 1 : 0, (data & 0x20) ? 1 : 0, (data & 0x40) ? 1 : 0, (data & 0x80) ? 1 : 0);
|
||||
else
|
||||
LOG("%s: sound_reg16_0_w %02x, %02x (- - - - - - - - %d %d %d %d %d %d %d %d)\n", machine().describe_context(), offset, data, (data & 0x01) ? 1 : 0, (data & 0x02) ? 1 : 0, (data & 0x04) ? 1 : 0, (data & 0x08) ? 1 : 0, (data & 0x10) ? 1 : 0, (data & 0x20) ? 1 : 0, (data & 0x40) ? 1 : 0, (data & 0x80) ? 1 : 0);
|
||||
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
int channel_state = (data & (1 << i));
|
||||
int old_channel_state = (m_soundreg16_0[offset] & (1 << i));
|
||||
if (channel_state != old_channel_state)
|
||||
{
|
||||
if (channel_state)
|
||||
{
|
||||
int channel = (offset * 8 + i);
|
||||
|
||||
LOG("channel %d 0->1 ", channel);
|
||||
|
||||
uint16_t memorybase = ((m_sound_regbase & 0x3f) << 8) | (channel * 0x10);
|
||||
|
||||
uint16_t param1 = (m_mainram[memorybase + 0x1] << 8) | (m_mainram[memorybase + 0x0]); // sample rate maybe?
|
||||
uint16_t param2 = (m_mainram[memorybase + 0x3] << 8) | (m_mainram[memorybase + 0x2]); // seems to be a start position
|
||||
uint16_t param3 = (m_mainram[memorybase + 0x5] << 8) | (m_mainram[memorybase + 0x4]); // another start position? sometimes same as param6
|
||||
uint8_t param4a = (m_mainram[memorybase + 0x7]);
|
||||
uint8_t param4b = (m_mainram[memorybase + 0x6]); // upper 8 bits of memory address? 8 bits unused?
|
||||
|
||||
// these don't seem to be populated as often, maybe some kind of effect / envelope filter?
|
||||
uint8_t param5a = (m_mainram[memorybase + 0x9]);
|
||||
uint8_t param5b = (m_mainram[memorybase + 0x8]);
|
||||
uint16_t param6 = (m_mainram[memorybase + 0xb] << 8) | (m_mainram[memorybase + 0xa]); // seems to be a start position
|
||||
uint16_t param7 = (m_mainram[memorybase + 0xd] << 8) | (m_mainram[memorybase + 0xc]); // another start position? sometimes same as param6
|
||||
uint8_t param8a = (m_mainram[memorybase + 0xf]);
|
||||
uint8_t param8b = (m_mainram[memorybase + 0xe]); // upper 8 bits of memory address? 8 bits unused (or not unused?, get populated with increasing values sometimes?)
|
||||
LOG(" (params %04x %04x %04x %02x %02x %02x %02x %04x %04x %02x %02x)\n", param1, param2, param3, param4a, param4b, param5a, param5b, param6, param7, param8a, param8b);
|
||||
|
||||
uint32_t address1 = (param2 | param4b << 16) & 0x00ffffff; // definitely addresses based on rad_snow
|
||||
uint32_t address2 = (param3 | param4b << 16) & 0x00ffffff;
|
||||
|
||||
uint32_t address3 = (param6 | param8b << 16) & 0x00ffffff; // still looks like addresses, sometimes pointing at RAM
|
||||
uint32_t address4 = (param7 | param8b << 16) & 0x00ffffff;
|
||||
|
||||
|
||||
LOG(" (possible meanings mode %01x rate %04x address1 %08x address2 %08x address3 %08x address4 %08x)\n", param1 & 0x3, param1 >> 2, address1, address2, address3, address4);
|
||||
|
||||
// samples appear to be PCM, 0x80 terminated
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_soundreg16_0[offset] = data;
|
||||
|
||||
}
|
||||
|
||||
/* 75f0, 75f1 - 2x8 bits (16 channels?) */
|
||||
READ8_MEMBER(xavix_state::sound_reg16_1_r)
|
||||
{
|
||||
LOG("%s: sound_reg16_1_r %02x\n", machine().describe_context(), offset);
|
||||
return m_soundreg16_1[offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_reg16_1_w)
|
||||
{
|
||||
m_soundreg16_1[offset] = data;
|
||||
|
||||
if (offset == 0)
|
||||
LOG("%s: sound_reg16_1_w %02x, %02x (%d %d %d %d %d %d %d %d - - - - - - - -)\n", machine().describe_context(), offset, data, (data & 0x01) ? 1 : 0, (data & 0x02) ? 1 : 0, (data & 0x04) ? 1 : 0, (data & 0x08) ? 1 : 0, (data & 0x10) ? 1 : 0, (data & 0x20) ? 1 : 0, (data & 0x40) ? 1 : 0, (data & 0x80) ? 1 : 0);
|
||||
else
|
||||
LOG("%s: sound_reg16_1_w %02x, %02x (- - - - - - - - %d %d %d %d %d %d %d %d)\n", machine().describe_context(), offset, data, (data & 0x01) ? 1 : 0, (data & 0x02) ? 1 : 0, (data & 0x04) ? 1 : 0, (data & 0x08) ? 1 : 0, (data & 0x10) ? 1 : 0, (data & 0x20) ? 1 : 0, (data & 0x40) ? 1 : 0, (data & 0x80) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
/* 75f4, 75f5 - 2x8 bits (16 channels?) status? */
|
||||
READ8_MEMBER(xavix_state::sound_sta16_r)
|
||||
{
|
||||
// used with 75f0/75f1
|
||||
return machine().rand();
|
||||
}
|
||||
|
||||
/* 75f6 - master volume control? */
|
||||
READ8_MEMBER(xavix_state::sound_volume_r)
|
||||
{
|
||||
LOG("%s: sound_volume_r\n", machine().describe_context());
|
||||
return m_soundregs[6];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_volume_w)
|
||||
{
|
||||
m_soundregs[6] = data;
|
||||
LOG("%s: sound_volume_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
/* 75f7 - main register base*/
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_regbase_w)
|
||||
{
|
||||
// this is the upper 6 bits of the RAM address where the actual sound register sets are
|
||||
// (16x16 regs, so complete 0x100 bytes of RAM eg 0x3b means the complete 0x3b00 - 0x3bff range with 0x3b00 - 0x3b0f being channel 1 etc)
|
||||
m_sound_regbase = data;
|
||||
LOG("%s: sound_regbase_w %02x (sound regs are at 0x%02x00 to 0x%02xff)\n", machine().describe_context(), data, m_sound_regbase & 0x3f, m_sound_regbase & 0x3f);
|
||||
}
|
||||
|
||||
/* 75f8, 75f9 - misc unknown sound regs*/
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75f8_r)
|
||||
{
|
||||
LOG("%s: sound_75f8_r\n", machine().describe_context());
|
||||
return m_soundregs[8];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75f8_w)
|
||||
{
|
||||
m_soundregs[8] = data;
|
||||
LOG("%s: sound_75f8_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75f9_r)
|
||||
{
|
||||
LOG("%s: sound_75f9_r\n", machine().describe_context());
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75fa_r)
|
||||
{
|
||||
LOG("%s: sound_75fa_r\n", machine().describe_context());
|
||||
return m_soundregs[10];
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75fb_r)
|
||||
{
|
||||
LOG("%s: sound_75fb_r\n", machine().describe_context());
|
||||
return m_soundregs[11];
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75fc_r)
|
||||
{
|
||||
LOG("%s: sound_75fc_r\n", machine().describe_context());
|
||||
return m_soundregs[12];
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75fd_r)
|
||||
{
|
||||
LOG("%s: sound_75fd_r\n", machine().describe_context());
|
||||
return m_soundregs[13];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75f0_w)
|
||||
{
|
||||
// something? (same as 75f1) 1 bit per channel, 8 channels
|
||||
|
||||
// expected to return data written
|
||||
m_soundregs[0] = data;
|
||||
LOG("%s: sound_75f0_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75f1_w)
|
||||
{
|
||||
// something? (same as 75f0) 1 bit per channel, 8 channels
|
||||
|
||||
// expected to return data written
|
||||
m_soundregs[1] = data;
|
||||
LOG("%s: sound_75f1_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75f6_w)
|
||||
{
|
||||
// expected to return data written
|
||||
m_soundregs[6] = data;
|
||||
LOG("%s: sound_75f6_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75f7_w)
|
||||
{
|
||||
m_soundregs[7] = data;
|
||||
LOG("%s: sound_75f7_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75f8_w)
|
||||
{
|
||||
// expected to return data written
|
||||
m_soundregs[8] = data;
|
||||
LOG("%s: sound_75f8_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75f9_w)
|
||||
{
|
||||
m_soundregs[9] = data;
|
||||
LOG("%s: sound_75f9_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75fa_w)
|
||||
{
|
||||
// timer? frequency? reg 0
|
||||
/* 75fa, 75fb, 75fc, 75fd - timers?? generate interrupts?? */
|
||||
|
||||
// expected to return data written
|
||||
READ8_MEMBER(xavix_state::sound_timer0_r)
|
||||
{
|
||||
LOG("%s: sound_timer0_r\n", machine().describe_context());
|
||||
return m_soundregs[10];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_timer0_w)
|
||||
{
|
||||
m_soundregs[10] = data;
|
||||
LOG("%s: sound_75fa_w %02x\n", machine().describe_context(), data);
|
||||
LOG("%s: sound_timer0_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75fb_w)
|
||||
READ8_MEMBER(xavix_state::sound_timer1_r)
|
||||
{
|
||||
// timer? frequency? reg 1
|
||||
LOG("%s: sound_timer1_r\n", machine().describe_context());
|
||||
return m_soundregs[11];
|
||||
}
|
||||
|
||||
// expected to return data written
|
||||
WRITE8_MEMBER(xavix_state::sound_timer1_w)
|
||||
{
|
||||
m_soundregs[11] = data;
|
||||
LOG("%s: sound_75fb_w %02x\n", machine().describe_context(), data);
|
||||
LOG("%s: sound_timer1_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75fc_w)
|
||||
READ8_MEMBER(xavix_state::sound_timer2_r)
|
||||
{
|
||||
// timer? frequency? reg 2
|
||||
LOG("%s: sound_timer2_r\n", machine().describe_context());
|
||||
return m_soundregs[12];
|
||||
}
|
||||
|
||||
// expected to return data written
|
||||
WRITE8_MEMBER(xavix_state::sound_timer2_w)
|
||||
{
|
||||
m_soundregs[12] = data;
|
||||
LOG("%s: sound_75fc_w %02x\n", machine().describe_context(), data);
|
||||
LOG("%s: sound_timer2_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75fd_w)
|
||||
READ8_MEMBER(xavix_state::sound_timer3_r)
|
||||
{
|
||||
// timer? frequency? reg 3
|
||||
|
||||
// expected to return data written
|
||||
m_soundregs[13] = data;
|
||||
LOG("%s: sound_75fd_w %02x\n", machine().describe_context(), data);
|
||||
LOG("%s: sound_timer3_r\n", machine().describe_context());
|
||||
return m_soundregs[13];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_timer3_w)
|
||||
{
|
||||
m_soundregs[13] = data;
|
||||
LOG("%s: sound_timer3_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
/* 75fe - some kind of IRQ status / Timer Status? */
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_irqstatus_r)
|
||||
{
|
||||
// rad_rh checks this after doing something that looks like an irq ack
|
||||
@ -164,7 +266,7 @@ READ8_MEMBER(xavix_state::sound_irqstatus_r)
|
||||
WRITE8_MEMBER(xavix_state::sound_irqstatus_w)
|
||||
{
|
||||
// these look like irq ack bits, 4 sources?
|
||||
// related to sound_75fa_w , sound_75fb_w, sound_75fc_w, sound_75fd_w ?
|
||||
// related to sound_timer0_w , sound_timer1_w, sound_timer2_w, sound_timer3_w ?
|
||||
if (data & 0xf0)
|
||||
{
|
||||
m_sound_irqstatus &= ~data & 0xf0;
|
||||
@ -175,24 +277,11 @@ WRITE8_MEMBER(xavix_state::sound_irqstatus_w)
|
||||
LOG("%s: sound_irqstatus_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
WRITE8_MEMBER(xavix_state::sound_75ff_w)
|
||||
{
|
||||
m_soundregs[15] = data;
|
||||
LOG("%s: sound_75ff_w %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75f4_r)
|
||||
{
|
||||
// status? 1 bit per channel, 8 channels?
|
||||
|
||||
// used with 75f0
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
READ8_MEMBER(xavix_state::sound_75f5_r)
|
||||
{
|
||||
// status? 1 bit per channel, 8 channels?
|
||||
|
||||
// used with 75f1
|
||||
return 0xff;
|
||||
}
|
||||
|
@ -267,7 +267,6 @@ void xavix_state::xavix_extbus_map(address_map &map)
|
||||
map(0x000000, 0xffffff).rw(FUNC(xavix_state::extbus_r), FUNC(xavix_state::extbus_w));
|
||||
}
|
||||
|
||||
|
||||
void xavix_state::xavix_lowbus_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x3fff).ram().share("mainram");
|
||||
@ -319,26 +318,24 @@ void xavix_state::xavix_lowbus_map(address_map &map)
|
||||
// map(0x6ffc, 0x6fff)
|
||||
|
||||
// Sound RAM
|
||||
// map(0x7400, 0x75ff)
|
||||
// map(0x7400, 0x757f)
|
||||
|
||||
// Sound Control
|
||||
map(0x75f0, 0x75f0).rw(FUNC(xavix_state::sound_75f0_r), FUNC(xavix_state::sound_75f0_w)); // r/w tested read/written 8 times in a row
|
||||
map(0x75f1, 0x75f1).rw(FUNC(xavix_state::sound_75f1_r), FUNC(xavix_state::sound_75f1_w)); // r/w tested read/written 8 times in a row
|
||||
map(0x75f2, 0x75f3).ram();
|
||||
map(0x75f4, 0x75f4).r(FUNC(xavix_state::sound_75f4_r)); // related to 75f0 (read after writing there - rad_mtrk)
|
||||
map(0x75f5, 0x75f5).r(FUNC(xavix_state::sound_75f5_r)); // related to 75f1 (read after writing there - rad_mtrk)
|
||||
map(0x75f0, 0x75f1).rw(FUNC(xavix_state::sound_reg16_0_r), FUNC(xavix_state::sound_reg16_0_w)); // r/w tested read/written 8 times in a row
|
||||
map(0x75f2, 0x75f3).rw(FUNC(xavix_state::sound_reg16_1_r), FUNC(xavix_state::sound_reg16_1_w));
|
||||
map(0x75f4, 0x75f5).r(FUNC(xavix_state::sound_sta16_r)); // related to 75f0 / 75f1 (read after writing there - rad_mtrk)
|
||||
// taitons1 after 75f7/75f8
|
||||
map(0x75f6, 0x75f6).rw(FUNC(xavix_state::sound_75f6_r), FUNC(xavix_state::sound_75f6_w)); // r/w tested
|
||||
map(0x75f6, 0x75f6).rw(FUNC(xavix_state::sound_volume_r), FUNC(xavix_state::sound_volume_w)); // r/w tested
|
||||
// taitons1 written as a pair
|
||||
map(0x75f7, 0x75f7).w(FUNC(xavix_state::sound_75f7_w));
|
||||
map(0x75f7, 0x75f7).w(FUNC(xavix_state::sound_regbase_w));
|
||||
map(0x75f8, 0x75f8).rw(FUNC(xavix_state::sound_75f8_r), FUNC(xavix_state::sound_75f8_w)); // r/w tested
|
||||
// taitons1 written after 75f6, then read
|
||||
map(0x75f9, 0x75f9).rw(FUNC(xavix_state::sound_75f9_r), FUNC(xavix_state::sound_75f9_w));
|
||||
// at another time
|
||||
map(0x75fa, 0x75fa).rw(FUNC(xavix_state::sound_75fa_r), FUNC(xavix_state::sound_75fa_w)); // r/w tested
|
||||
map(0x75fb, 0x75fb).rw(FUNC(xavix_state::sound_75fb_r), FUNC(xavix_state::sound_75fb_w)); // r/w tested
|
||||
map(0x75fc, 0x75fc).rw(FUNC(xavix_state::sound_75fc_r), FUNC(xavix_state::sound_75fc_w)); // r/w tested
|
||||
map(0x75fd, 0x75fd).rw(FUNC(xavix_state::sound_75fd_r), FUNC(xavix_state::sound_75fd_w)); // r/w tested
|
||||
map(0x75fa, 0x75fa).rw(FUNC(xavix_state::sound_timer0_r), FUNC(xavix_state::sound_timer0_w)); // r/w tested
|
||||
map(0x75fb, 0x75fb).rw(FUNC(xavix_state::sound_timer1_r), FUNC(xavix_state::sound_timer1_w)); // r/w tested
|
||||
map(0x75fc, 0x75fc).rw(FUNC(xavix_state::sound_timer2_r), FUNC(xavix_state::sound_timer2_w)); // r/w tested
|
||||
map(0x75fd, 0x75fd).rw(FUNC(xavix_state::sound_timer3_r), FUNC(xavix_state::sound_timer3_w)); // r/w tested
|
||||
map(0x75fe, 0x75fe).rw(FUNC(xavix_state::sound_irqstatus_r), FUNC(xavix_state::sound_irqstatus_w));
|
||||
// taitons1 written other 75xx operations
|
||||
map(0x75ff, 0x75ff).w(FUNC(xavix_state::sound_75ff_w));
|
||||
@ -414,7 +411,6 @@ void xavix_state::superxavix_lowbus_map(address_map &map)
|
||||
map(0x6fb0, 0x6fc7).ram().share("bmp_base");
|
||||
}
|
||||
|
||||
|
||||
static INPUT_PORTS_START( xavix )
|
||||
PORT_START("IN0")
|
||||
PORT_DIPNAME( 0x01, 0x00, "IN0" )
|
||||
@ -821,6 +817,8 @@ MACHINE_CONFIG_START(xavix_state::xavix)
|
||||
MCFG_PALETTE_ADD("palette", 256)
|
||||
|
||||
/* sound hardware */
|
||||
XAVIX_SOUND(config, "xavix_sound", MAIN_CLOCK);
|
||||
|
||||
SPEAKER(config, "mono").front_center();
|
||||
// sound is PCM
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -17,6 +17,27 @@
|
||||
#include "machine/xavix_mtrk_wheel.h"
|
||||
#include "machine/xavix_madfb_ball.h"
|
||||
|
||||
|
||||
class xavix_sound_device : public device_t, public device_sound_interface
|
||||
{
|
||||
public:
|
||||
xavix_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
|
||||
|
||||
private:
|
||||
sound_stream *m_stream;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(XAVIX_SOUND, xavix_sound_device)
|
||||
|
||||
|
||||
class xavix_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -24,6 +45,7 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_in0(*this, "IN0"),
|
||||
m_in1(*this, "IN1"),
|
||||
m_sound(*this, "xavix_sound"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_screen(*this, "screen"),
|
||||
m_mainram(*this, "mainram"),
|
||||
@ -48,7 +70,7 @@ public:
|
||||
m_lowbus(*this, "lowbus"),
|
||||
m_hack_timer_disable(false)
|
||||
{ }
|
||||
|
||||
|
||||
void xavix(machine_config &config);
|
||||
void xavixp(machine_config &config);
|
||||
void xavix2000(machine_config &config);
|
||||
@ -71,6 +93,8 @@ protected:
|
||||
required_ioport m_in1;
|
||||
|
||||
private:
|
||||
required_device<xavix_sound_device> m_sound;
|
||||
|
||||
// screen updates
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
@ -95,6 +119,74 @@ private:
|
||||
DECLARE_READ8_MEMBER(extbus_r) { return m_rgn[(offset) & (m_rgnlen - 1)]; }
|
||||
DECLARE_WRITE8_MEMBER(extbus_w) { logerror("write to external bus %06x %02x\n", offset, data); }
|
||||
|
||||
|
||||
/* this is just a quick memory system bypass for video reads etc. because going through the
|
||||
memory system is slow and also pollutes logs significantly with unmapped reads if the games
|
||||
enable the video before actually setting up the source registers!
|
||||
|
||||
this will need modifying if any games have RAM instead of ROM (which I think is possible
|
||||
with SuperXaviX at least)
|
||||
*/
|
||||
inline uint8_t read_full_data_sp_lowbus_bypass(uint16_t adr)
|
||||
{
|
||||
adr &= 0x7fff;
|
||||
|
||||
if (adr < 0x4000)
|
||||
{
|
||||
adr &= 0x3fff;
|
||||
return m_mainram[adr];
|
||||
}
|
||||
else if (adr < 0x5000)
|
||||
{
|
||||
adr &= 0xfff;
|
||||
return txarray_r(adr);
|
||||
}
|
||||
else if ((adr >= 0x6000) && (adr < 0x6800))
|
||||
{
|
||||
adr &= 0x7ff;
|
||||
return m_fragment_sprite[adr];
|
||||
}
|
||||
else if ((adr >= 0x6800) && (adr < 0x6900))
|
||||
{
|
||||
adr &= 0xff;
|
||||
return m_palram_sh[adr];
|
||||
}
|
||||
else if ((adr >= 0x6900) && (adr < 0x6a00))
|
||||
{
|
||||
adr &= 0xff;
|
||||
return m_palram_l[adr];
|
||||
}
|
||||
else if ((adr >= 0x6a00) && (adr < 0x6a20))
|
||||
{
|
||||
adr &= 0x1f;
|
||||
return m_segment_regs[adr];
|
||||
}
|
||||
// superxavix bitmap palette?
|
||||
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
inline uint8_t read_full_data_sp_bypass(uint32_t adr)
|
||||
{
|
||||
uint8_t databank = adr >> 16;
|
||||
|
||||
if (databank >= 0x80)
|
||||
{
|
||||
return m_rgn[adr & (m_rgnlen - 1)];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((adr&0xffff) >= 0x8000)
|
||||
{
|
||||
return m_rgn[adr & (m_rgnlen - 1)];
|
||||
}
|
||||
else
|
||||
{
|
||||
return read_full_data_sp_lowbus_bypass(adr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DECLARE_WRITE8_MEMBER(extintrf_7900_w);
|
||||
DECLARE_WRITE8_MEMBER(extintrf_7901_w);
|
||||
DECLARE_WRITE8_MEMBER(extintrf_7902_w);
|
||||
@ -168,18 +260,17 @@ private:
|
||||
DECLARE_READ8_MEMBER(dispctrl_6ff8_r);
|
||||
DECLARE_WRITE8_MEMBER(dispctrl_6ff8_w);
|
||||
|
||||
DECLARE_READ8_MEMBER(sound_75f0_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_75f0_w);
|
||||
DECLARE_READ8_MEMBER(sound_reg16_0_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_reg16_0_w);
|
||||
DECLARE_READ8_MEMBER(sound_reg16_1_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_reg16_1_w);
|
||||
|
||||
DECLARE_READ8_MEMBER(sound_75f1_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_75f1_w);
|
||||
|
||||
DECLARE_READ8_MEMBER(sound_75f4_r);
|
||||
DECLARE_READ8_MEMBER(sound_sta16_r);
|
||||
DECLARE_READ8_MEMBER(sound_75f5_r);
|
||||
DECLARE_READ8_MEMBER(sound_75f6_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_75f6_w);
|
||||
DECLARE_READ8_MEMBER(sound_volume_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_volume_w);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(sound_75f7_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_regbase_w);
|
||||
|
||||
DECLARE_READ8_MEMBER(sound_75f8_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_75f8_w);
|
||||
@ -187,19 +278,22 @@ private:
|
||||
DECLARE_READ8_MEMBER(sound_75f9_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_75f9_w);
|
||||
|
||||
DECLARE_READ8_MEMBER(sound_75fa_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_75fa_w);
|
||||
DECLARE_READ8_MEMBER(sound_75fb_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_75fb_w);
|
||||
DECLARE_READ8_MEMBER(sound_75fc_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_75fc_w);
|
||||
DECLARE_READ8_MEMBER(sound_75fd_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_75fd_w);
|
||||
DECLARE_READ8_MEMBER(sound_timer0_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_timer0_w);
|
||||
DECLARE_READ8_MEMBER(sound_timer1_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_timer1_w);
|
||||
DECLARE_READ8_MEMBER(sound_timer2_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_timer2_w);
|
||||
DECLARE_READ8_MEMBER(sound_timer3_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_timer3_w);
|
||||
|
||||
DECLARE_READ8_MEMBER(sound_irqstatus_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_irqstatus_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_75ff_w);
|
||||
uint8_t m_sound_irqstatus;
|
||||
uint8_t m_soundreg16_0[2];
|
||||
uint8_t m_soundreg16_1[2];
|
||||
uint8_t m_sound_regbase;
|
||||
|
||||
DECLARE_READ8_MEMBER(timer_status_r);
|
||||
DECLARE_WRITE8_MEMBER(timer_control_w);
|
||||
@ -234,6 +328,44 @@ private:
|
||||
DECLARE_WRITE8_MEMBER(xavix_memoryemu_txarray_w);
|
||||
uint8_t m_txarray[3];
|
||||
|
||||
inline uint8_t txarray_r(uint16_t offset)
|
||||
{
|
||||
if (offset < 0x100)
|
||||
{
|
||||
offset &= 0xff;
|
||||
return ((offset >> 4) | (offset << 4));
|
||||
}
|
||||
else if (offset < 0x200)
|
||||
{
|
||||
offset &= 0xff;
|
||||
return ((offset >> 4) | (~offset << 4));
|
||||
}
|
||||
else if (offset < 0x300)
|
||||
{
|
||||
offset &= 0xff;
|
||||
return ((~offset >> 4) | (offset << 4));
|
||||
}
|
||||
else if (offset < 0x400)
|
||||
{
|
||||
offset &= 0xff;
|
||||
return ((~offset >> 4) | (~offset << 4));
|
||||
}
|
||||
else if (offset < 0x800)
|
||||
{
|
||||
return m_txarray[0];
|
||||
}
|
||||
else if (offset < 0xc00)
|
||||
{
|
||||
return m_txarray[1];
|
||||
}
|
||||
else if (offset < 0x1000)
|
||||
{
|
||||
return m_txarray[2];
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
DECLARE_READ8_MEMBER(mult_r);
|
||||
DECLARE_WRITE8_MEMBER(mult_w);
|
||||
DECLARE_READ8_MEMBER(mult_param_r);
|
||||
|
@ -37,7 +37,8 @@ WRITE8_MEMBER(xavix_state::rom_dmatrg_w)
|
||||
// many games explicitly want to access with the high bank bit set, so probably the same logic as when grabbing tile data
|
||||
// we have to be careful here or we get the zero page memory read, hence not just using read8 on the whole space
|
||||
// this again probably indicates there is 'data space' where those don't appear
|
||||
uint8_t dat = m_maincpu->read_full_data_sp(m_tmpaddress);
|
||||
//uint8_t dat = m_maincpu->read_full_data_sp(m_tmpaddress);
|
||||
uint8_t dat = read_full_data_sp_bypass(m_tmpaddress);
|
||||
m_maincpu->write_full_data(dest+i, dat);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,8 @@ inline uint8_t xavix_state::get_next_bit()
|
||||
// going through memory is slow, try not to do it too often!
|
||||
if (m_tmp_databit == 0)
|
||||
{
|
||||
m_bit = m_maincpu->read_full_data_sp(m_tmp_dataaddress);
|
||||
//m_bit = m_maincpu->read_full_data_sp(m_tmp_dataaddress);
|
||||
m_bit = read_full_data_sp_bypass(m_tmp_dataaddress);
|
||||
}
|
||||
|
||||
uint8_t ret = m_bit >> m_tmp_databit;
|
||||
@ -245,15 +246,25 @@ void xavix_state::draw_tilemap_line(screen_device &screen, bitmap_ind16 &bitmap,
|
||||
int tile = 0;
|
||||
|
||||
// the register being 0 probably isn't the condition here
|
||||
if (tileregs[0x0] != 0x00) tile |= m_maincpu->read_full_data_sp((tileregs[0x0] << 8) + count);
|
||||
if (tileregs[0x0] != 0x00)
|
||||
{
|
||||
//tile |= m_maincpu->read_full_data_sp((tileregs[0x0] << 8) + count);
|
||||
tile |= read_full_data_sp_bypass((tileregs[0x0] << 8) + count);
|
||||
}
|
||||
|
||||
// only read the next byte if we're not in an 8-bit mode
|
||||
if (((tileregs[0x7] & 0x7f) != 0x00) && ((tileregs[0x7] & 0x7f) != 0x08))
|
||||
tile |= m_maincpu->read_full_data_sp((tileregs[0x1] << 8) + count) << 8;
|
||||
{
|
||||
//tile |= m_maincpu->read_full_data_sp((tileregs[0x1] << 8) + count) << 8;
|
||||
tile |= read_full_data_sp_bypass((tileregs[0x1] << 8) + count) << 8;
|
||||
}
|
||||
|
||||
// 24 bit modes can use reg 0x2, otherwise it gets used as extra attribute in other modes
|
||||
if (alt_tileaddressing2 == 2)
|
||||
tile |= m_maincpu->read_full_data_sp((tileregs[0x2] << 8) + count) << 16;
|
||||
{
|
||||
//tile |= m_maincpu->read_full_data_sp((tileregs[0x2] << 8) + count) << 16;
|
||||
tile |= read_full_data_sp_bypass((tileregs[0x2] << 8) + count) << 16;
|
||||
}
|
||||
|
||||
|
||||
int bpp = (tileregs[0x3] & 0x0e) >> 1;
|
||||
@ -309,7 +320,9 @@ void xavix_state::draw_tilemap_line(screen_device &screen, bitmap_ind16 &bitmap,
|
||||
// Tilemap specific mode extension with an 8-bit per tile attribute, works in all modes except 24-bit (no room for attribute) and header (not needed?)
|
||||
if (tileregs[0x7] & 0x08)
|
||||
{
|
||||
uint8_t extraattr = m_maincpu->read_full_data_sp((tileregs[0x2] << 8) + count);
|
||||
//uint8_t extraattr = m_maincpu->read_full_data_sp((tileregs[0x2] << 8) + count);
|
||||
uint8_t extraattr = read_full_data_sp_bypass((tileregs[0x2] << 8) + count);
|
||||
|
||||
// make use of the extraattr stuff?
|
||||
pal = (extraattr & 0xf0) >> 4;
|
||||
zval = (extraattr & 0x0f) >> 0;
|
||||
@ -819,7 +832,8 @@ WRITE8_MEMBER(xavix_state::spritefragment_dma_trg_w)
|
||||
{
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
uint8_t dat = m_maincpu->read_full_data_sp(src + i);
|
||||
//uint8_t dat = m_maincpu->read_full_data_sp(src + i);
|
||||
uint8_t dat = read_full_data_sp_bypass(src + i);
|
||||
m_fragment_sprite[(dst + i) & 0x7ff] = dat;
|
||||
}
|
||||
}
|
||||
@ -951,38 +965,5 @@ WRITE8_MEMBER(xavix_state::xavix_memoryemu_txarray_w)
|
||||
|
||||
READ8_MEMBER(xavix_state::xavix_memoryemu_txarray_r)
|
||||
{
|
||||
if (offset < 0x100)
|
||||
{
|
||||
offset &= 0xff;
|
||||
return ((offset >> 4) | (offset << 4));
|
||||
}
|
||||
else if (offset < 0x200)
|
||||
{
|
||||
offset &= 0xff;
|
||||
return ((offset >> 4) | (~offset << 4));
|
||||
}
|
||||
else if (offset < 0x300)
|
||||
{
|
||||
offset &= 0xff;
|
||||
return ((~offset >> 4) | (offset << 4));
|
||||
}
|
||||
else if (offset < 0x400)
|
||||
{
|
||||
offset &= 0xff;
|
||||
return ((~offset >> 4) | (~offset << 4));
|
||||
}
|
||||
else if (offset < 0x800)
|
||||
{
|
||||
return m_txarray[0];
|
||||
}
|
||||
else if (offset < 0xc00)
|
||||
{
|
||||
return m_txarray[1];
|
||||
}
|
||||
else if (offset < 0x1000)
|
||||
{
|
||||
return m_txarray[2];
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
return txarray_r(offset);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user