diff options
author | smf- <smf-@users.noreply.github.com> | 2013-01-20 20:43:34 +0000 |
---|---|---|
committer | smf- <smf-@users.noreply.github.com> | 2013-01-20 20:43:34 +0000 |
commit | bf8f29e6fe0ac319e31bc1688a5ae5742cdf25b2 (patch) | |
tree | 388bfe79716c7fd61013fcc19736fe7da442ff2f /src/emu/sound | |
parent | e0b0d2cf8b3fcfeff3f366e331aaa539c12cbef6 (diff) |
Use devcb2 for cpu to spu hookup as it's on it's own 16 bit bus. Removed the spu hookup in taitogn at 0x1fa51c00 as it doesn't make sense, will wait for bug reports before investigating further. [smf]
Diffstat (limited to 'src/emu/sound')
-rw-r--r-- | src/emu/sound/spu.c | 79 | ||||
-rw-r--r-- | src/emu/sound/spu.h | 15 |
2 files changed, 15 insertions, 79 deletions
diff --git a/src/emu/sound/spu.c b/src/emu/sound/spu.c index b8886f148dc..238d85159e0 100644 --- a/src/emu/sound/spu.c +++ b/src/emu/sound/spu.c @@ -1152,9 +1152,9 @@ void spu_device::kill_sound() // // -unsigned short spu_device::read_word(const unsigned int addr) +READ16_MEMBER( spu_device::read ) { - unsigned short ret=0, *rp=(unsigned short *)(reg+(addr&0x1ff)); + unsigned short ret=0, *rp=(unsigned short *)(reg+((offset*2)&0x1ff)); assert((addr&1)==0); @@ -1164,9 +1164,9 @@ unsigned short spu_device::read_word(const unsigned int addr) #ifdef debug_spu_registers printf("spu: read word %08x = %04x [%s]\n", - addr, + offset*2, ret, - get_register_name(addr)); + get_register_name(offset*2)); #endif return ret; @@ -1176,38 +1176,18 @@ unsigned short spu_device::read_word(const unsigned int addr) // // -unsigned char spu_device::read_byte(const unsigned int addr) -{ - unsigned char ret=0, - *rp=reg+(addr&0x1ff); - - ret=*rp; - - #ifdef debug_spu_registers - printf("spu: read byte %08x\n",addr); - #endif - - return ret; -} - -// -// -// - -void spu_device::write_word(const unsigned int addr, const unsigned short data) +WRITE16_MEMBER( spu_device::write ) { #ifdef debug_spu_registers printf("spu: write %08x = %04x [%s]\n", - addr, + offset*2, data, - get_register_name(addr)); + get_register_name(offset*2)); #endif - assert((addr&1)==0); - m_stream->update(); - const unsigned int a=addr&0x1ff; + const unsigned int a=(offset*2)&0x1ff; switch (a) { case spureg_trans_addr: @@ -1222,7 +1202,7 @@ void spu_device::write_word(const unsigned int addr, const unsigned short data) default: { - unsigned short *rp=(unsigned short *)(reg+(addr&0x1ff)); + unsigned short *rp=(unsigned short *)(reg+a); if ((a==spureg_irq_addr) || ((a==spureg_ctrl) && ((rp[0]^data)&spuctrl_irq_enable))) @@ -1257,23 +1237,6 @@ void spu_device::write_word(const unsigned int addr, const unsigned short data) // // -void spu_device::write_byte(const unsigned int addr, const unsigned char data) -{ - #ifdef debug_spu_registers - printf("spu: write %08x = %02x\n",addr,data); - #endif - - const unsigned int a=addr&0x1ff; - reg[a]=data; - if ((a>spureg_reverb_config) && (a<=spureg_last)) - dirty_flags|=dirtyflag_reverb; - update_key(); -} - -// -// -// - void spu_device::update_vol(const unsigned int addr) { if (addr<0x180) @@ -3104,27 +3067,3 @@ void spu_device::dma_write( UINT32 *p_n_ram, UINT32 n_address, INT32 n_size ) start_dma(psxram + n_address, true, n_size*4); } - -READ16_HANDLER( spu_r ) -{ - spu_device *spu = space.machine().device<spu_device>("spu"); - - if (spu == NULL ) - { - return 0; - } - - return spu->read_word(offset*2); -} - -WRITE16_HANDLER( spu_w ) -{ - spu_device *spu = space.machine().device<spu_device>("spu"); - - if (spu == NULL) - { - return; - } - - spu->write_word(offset*2, data); -} diff --git a/src/emu/sound/spu.h b/src/emu/sound/spu.h index 900eb1144db..b1fa4f4dc67 100644 --- a/src/emu/sound/spu.h +++ b/src/emu/sound/spu.h @@ -13,6 +13,9 @@ devcb = &spu_device::set_irq_handler(*device, DEVCB2_##_devcb); #define MCFG_SPU_ADD(_tag, _clock) \ + MCFG_DEVICE_MODIFY( "maincpu" ) \ + MCFG_PSX_SPU_READ_HANDLER(DEVREAD16(_tag, spu_device, read)) \ + MCFG_PSX_SPU_WRITE_HANDLER(DEVWRITE16(_tag, spu_device, write)) \ MCFG_DEVICE_ADD(_tag, SPU, _clock) \ MCFG_SPU_IRQ_HANDLER(DEVWRITELINE("maincpu:irq", psxirq_device, intin9)) \ MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 4, psx_dma_read_delegate( FUNC( spu_device::dma_read ), (spu_device *) device ) ) \ @@ -234,12 +237,10 @@ public: void flush_xa(const unsigned int sector=0); void flush_cdda(const unsigned int sector=0); - unsigned char read_byte(const unsigned int addr); - unsigned short read_word(const unsigned int addr); - void write_byte(const unsigned int addr, const unsigned char byte); - void write_word(const unsigned int addr, const unsigned short word); - sound_stream *m_stream; + + DECLARE_READ16_MEMBER( read ); + DECLARE_WRITE16_MEMBER( write ); }; extern reverb_params *spu_reverb_cfg; @@ -247,8 +248,4 @@ extern reverb_params *spu_reverb_cfg; // device type definition extern const device_type SPU; -// MAME old-style interface -DECLARE_READ16_HANDLER( spu_r ); -DECLARE_WRITE16_HANDLER( spu_w ); - #endif |