diff --git a/src/emu/sound/l7a1045_l6028_dsp_a.c b/src/emu/sound/l7a1045_l6028_dsp_a.c index 1aabb4dc474..f7ebbe36959 100644 --- a/src/emu/sound/l7a1045_l6028_dsp_a.c +++ b/src/emu/sound/l7a1045_l6028_dsp_a.c @@ -77,6 +77,7 @@ #include "emu.h" #include "l7a1045_l6028_dsp_a.h" +#include "debugger.h" // device type definition @@ -133,7 +134,7 @@ void l7a1045_sound_device::sound_stream_update(sound_stream &stream, stream_samp l7a1045_voice *vptr = &m_voice[i]; UINT32 start = vptr->start; - UINT32 end = vptr->start+0x002000; + UINT32 end = vptr->end; UINT32 step = 0x0400; UINT32 pos = vptr->pos; @@ -183,17 +184,12 @@ READ16_MEMBER( l7a1045_sound_device::l7a1045_sound_r ) { m_stream->update(); - switch (offset) - { - case 0x00: - case 0x01: - printf("%08x: l7a1045_sound_r unknown offset %02x\n", space.device().safe_pc(), offset * 2); - return 0x0000; - - case 0x02: return l7a1045_sound_port_0004_r(space, offset, mem_mask); - case 0x03: return l7a1045_sound_port_0006_r(space, offset, mem_mask); - } - return 0x000; + if(offset == 0) + printf("sound_select_r?\n"); + else + return sound_data_r(space,offset -1,mem_mask); + + return 0xffff; } @@ -224,8 +220,9 @@ WRITE16_MEMBER(l7a1045_sound_device::sound_data_w) { l7a1045_voice *vptr = &m_voice[m_audiochannel]; - if(m_audioregister != 0) - printf("%04x %04x (%04x %04x)\n",offset,data,m_audioregister,m_audiochannel); + //if(m_audioregister != 0 && m_audioregister != 7) + //if(m_audioregister == 6) + // printf("%04x %04x (%04x %04x)\n",offset,data,m_audioregister,m_audiochannel); m_audiodat[m_audioregister][m_audiochannel].dat[offset] = data; @@ -233,15 +230,38 @@ WRITE16_MEMBER(l7a1045_sound_device::sound_data_w) { case 0x00: - vptr->start = (m_audiodat[0][m_audiochannel].dat[2] & 0x000f) << (16 + 4); - vptr->start |= (m_audiodat[0][m_audiochannel].dat[1] & 0xffff) << (4); - vptr->start |= (m_audiodat[0][m_audiochannel].dat[0] & 0xf000) >> (12); + vptr->start = (m_audiodat[m_audioregister][m_audiochannel].dat[2] & 0x000f) << (16 + 4); + vptr->start |= (m_audiodat[m_audioregister][m_audiochannel].dat[1] & 0xffff) << (4); + vptr->start |= (m_audiodat[m_audioregister][m_audiochannel].dat[0] & 0xf000) >> (12); vptr->start &= m_rom_size - 1; - //printf("%08x: REGISTER 00 write port 0x0002 chansel %02x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audiochannel, data, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); break; + case 0x01: + // relative to start + //printf("%04x\n",m_audiodat[m_audioregister][m_audiochannel].dat[0]); + //printf("%04x\n",m_audiodat[m_audioregister][m_audiochannel].dat[1]); + //printf("%04x\n",m_audiodat[m_audioregister][m_audiochannel].dat[2]); + if(m_audiodat[m_audioregister][m_audiochannel].dat[2] & 0x100) + { + vptr->end = (m_audiodat[m_audioregister][m_audiochannel].dat[0] & 0xffff) << 2; + vptr->end += vptr->start; + // hopefully it'll never happen? Maybe assert here? + vptr->end &= m_rom_size - 1; + + } + else // absolute + { + vptr->end = (m_audiodat[m_audioregister][m_audiochannel].dat[2] & 0x000f) << (16 + 4); + vptr->end |= (m_audiodat[m_audioregister][m_audiochannel].dat[1] & 0xffff) << (4); + vptr->end |= (m_audiodat[m_audioregister][m_audiochannel].dat[0] & 0xf000) >> (12); + + vptr->end &= m_rom_size - 1; + } + + break; + case 0x07: vptr->r_volume = (m_audiodat[m_audioregister][m_audiochannel].dat[0] & 0xff); @@ -255,77 +275,56 @@ WRITE16_MEMBER(l7a1045_sound_device::sound_data_w) } } + +READ16_MEMBER(l7a1045_sound_device::sound_data_r) +{ + //printf("%04x (%04x %04x)\n",offset,m_audioregister,m_audiochannel); + //debugger_break(machine()); + l7a1045_voice *vptr = &m_voice[m_audiochannel]; + + switch(m_audioregister) + { + case 0x00: + { + UINT32 current_addr; + UINT16 res; + + current_addr = vptr->start + vptr->pos; + if(offset == 0) + res = (current_addr & 0xf) << 12; // TODO: frac + else if(offset == 1) + res = (current_addr & 0xffff0) >> 4; + else + res = (current_addr & 0xf00000) >> 20; + + return res; + } + } + + return 0; +} + WRITE16_MEMBER(l7a1045_sound_device::sound_status_w) { if(data & 0x100) // keyin { l7a1045_voice *vptr = &m_voice[m_audiochannel]; + #if 0 + if(vptr->start != 0) + { + printf("%08x START\n",vptr->start); + printf("%08x END\n",vptr->end); + + for(int i=0;i<0x10;i++) + printf("%02x (%02x) = %04x%04x%04x\n",m_audiochannel,i,m_audiodat[i][m_audiochannel].dat[2],m_audiodat[i][m_audiochannel].dat[1],m_audiodat[i][m_audiochannel].dat[0]); + } + #endif + vptr->frac = 0; vptr->pos = 0; m_key |= 1 << m_audiochannel; } } -READ16_MEMBER(l7a1045_sound_device::l7a1045_sound_port_0004_r) -{ - // it writes the channel select before reading this.. so either it works on channels, or the command.. - // buriki reads registers 03/05/00 these at the moment, others don't - // also reads 06 - - switch (m_audioregister) - { - default: - - case 0x01: - case 0x02: - case 0x04: - case 0x07: - case 0x08: - case 0x09: - case 0x0a: - printf("%08x: unexpected read port 0x0004 register %02x chansel %02x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); - break; - - case 0x03: - case 0x05: - case 0x00: - case 0x06: - //printf("%08x: read port 0x0004 register %02x chansel %02x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); - break; - - - } - return 0; -} - -READ16_MEMBER(l7a1045_sound_device::l7a1045_sound_port_0006_r) -{ - // it writes the channel select before reading this.. so either it works on channels, or the command.. - - // buriki reads register 00 - - switch (m_audioregister) - { - default: - - case 0x01: - case 0x02: - case 0x03: - case 0x04: - case 0x05: - case 0x06: - case 0x07: - case 0x08: - case 0x09: - case 0x0a: - printf("%08x: unexpected read port 0x0006 register %02x chansel %02x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); - break; - - case 0x00: - //printf("%08x: read port 0x0006 register %02x chansel %02x (%04x%04x%04x)\n", space.device().safe_pc(), m_audioregister, m_audiochannel, m_audiodat[m_audioregister][m_audiochannel].dat[0], m_audiodat[m_audioregister][m_audiochannel].dat[1], m_audiodat[m_audioregister][m_audiochannel].dat[2]); - break; - } - return rand(); -} diff --git a/src/emu/sound/l7a1045_l6028_dsp_a.h b/src/emu/sound/l7a1045_l6028_dsp_a.h index 5237a029703..7524d56778b 100644 --- a/src/emu/sound/l7a1045_l6028_dsp_a.h +++ b/src/emu/sound/l7a1045_l6028_dsp_a.h @@ -13,6 +13,7 @@ struct l7a1045_voice } UINT32 start; + UINT32 end; UINT32 pos; UINT32 frac; UINT16 l_volume; @@ -58,12 +59,8 @@ private: DECLARE_WRITE16_MEMBER(sound_select_w); DECLARE_WRITE16_MEMBER(sound_data_w); + DECLARE_READ16_MEMBER(sound_data_r); DECLARE_WRITE16_MEMBER(sound_status_w); - - DECLARE_READ16_MEMBER(l7a1045_sound_port_0004_r); - DECLARE_READ16_MEMBER(l7a1045_sound_port_0006_r); - - }; extern const device_type L7A1045; diff --git a/src/mame/audio/hng64.c b/src/mame/audio/hng64.c index 5321fb2c38d..023882aa895 100644 --- a/src/mame/audio/hng64.c +++ b/src/mame/audio/hng64.c @@ -66,7 +66,7 @@ WRITE32_MEMBER(hng64_state::hng64_soundram_w) UINT32 mem_mask32 = mem_mask; UINT32 data32 = data; - /* swap data around.. keep the v55 happy */ + /* swap data around.. keep the v53 happy */ data = data32 >> 16; data = FLIPENDIAN_INT16(data); mem_mask = mem_mask32 >> 16; @@ -195,7 +195,7 @@ WRITE16_MEMBER(hng64_state::hng64_sound_port_0008_w) // seems to one or more of the DMARQ on the V53, writes here when it expects DMA channel 3 to transfer ~0x20 bytes just after startup /* TODO: huh? */ - m_audiocpu->dreq3_w(data&1); + m_audiocpu->dreq3_w(data&0x1); m_dsp->l7a1045_sound_w(space,8/2,data,mem_mask); // m_audiocpu->hack_w(1); @@ -205,7 +205,7 @@ WRITE16_MEMBER(hng64_state::hng64_sound_port_0008_w) READ16_MEMBER(hng64_state::hng64_sound_port_0008_r) { // read in irq5 - logerror("%08x: hng64_sound_port_0008_r mask (%04x)\n", space.device().safe_pc(), mem_mask); + printf("%08x: hng64_sound_port_0008_r mask (%04x)\n", space.device().safe_pc(), mem_mask); return 0; } @@ -326,6 +326,7 @@ WRITE8_MEMBER(hng64_state::dma_iow3_cb) // currently it reads a block of 0x20 '0x00' values from a very specific block of RAM where there is a 0x20 space in the data and transfers them repeatedly, I assume // this is some kind of buffer for the audio or DSP and eventually will be populated with other values... // if this comes to life maybe something interesting is happening! + if (data!=0x00) logerror("dma_iow3_cb %02x\n", data); } @@ -378,7 +379,7 @@ WRITE_LINE_MEMBER(hng64_state::tcu_tm2_cb) MACHINE_CONFIG_FRAGMENT( hng64_audio ) - MCFG_CPU_ADD("audiocpu", V53A, 16000000) // V53A, 16? mhz! + MCFG_CPU_ADD("audiocpu", V53A, 32000000*2) // V53A, 16? mhz! MCFG_CPU_PROGRAM_MAP(hng_sound_map) MCFG_CPU_IO_MAP(hng_sound_io) MCFG_V53_DMAU_OUT_HREQ_CB(WRITELINE(hng64_state, dma_hreq_cb)) @@ -391,7 +392,7 @@ MACHINE_CONFIG_FRAGMENT( hng64_audio ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("l7a1045", L7A1045, 16000000 ) // ?? + MCFG_SOUND_ADD("l7a1045", L7A1045, 32000000/2 ) // ?? MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) diff --git a/src/mess/drivers/pc9801.c b/src/mess/drivers/pc9801.c index c645533a0e7..3f2c3ee3a64 100644 --- a/src/mess/drivers/pc9801.c +++ b/src/mess/drivers/pc9801.c @@ -429,6 +429,7 @@ Keyboard TX commands: #include "machine/idectrl.h" #include "machine/idehd.h" +#include "debugger.h" #define UPD1990A_TAG "upd1990a" #define UPD8251_TAG "upd8251" @@ -1666,7 +1667,6 @@ WRITE_LINE_MEMBER( pc9801_state::write_sasi_req ) m_dmac->dreq0_w(!(state && !(m_sasi_ctrl_in->read() & 8) && (m_sasi_ctrl & 2))); } -#include "debugger.h" READ8_MEMBER( pc9801_state::sasi_status_r ) {