added MCFG_PSXGPU_ADD for adding the gpu device and hooking up the dma to the cpu.
This commit is contained in:
parent
04490d67e9
commit
36f4054d6b
@ -2924,7 +2924,15 @@ void psxgpu_device::MoveImage( void )
|
||||
}
|
||||
}
|
||||
|
||||
void psxgpu_device::dma_write( UINT32 *p_ram, INT32 n_size )
|
||||
void psxgpu_device::dma_write( UINT32 n_address, INT32 n_size )
|
||||
{
|
||||
psx_state *p_psx = machine().driver_data<psx_state>();
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
|
||||
gpu_write( &p_n_psxram[ n_address / 4 ], n_size );
|
||||
}
|
||||
|
||||
void psxgpu_device::gpu_write( UINT32 *p_ram, INT32 n_size )
|
||||
{
|
||||
while( n_size > 0 )
|
||||
{
|
||||
@ -3418,7 +3426,7 @@ WRITE32_MEMBER( psxgpu_device::write )
|
||||
switch( offset )
|
||||
{
|
||||
case 0x00:
|
||||
dma_write( &data, 1 );
|
||||
gpu_write( &data, 1 );
|
||||
break;
|
||||
case 0x01:
|
||||
switch( data >> 24 )
|
||||
@ -3556,7 +3564,15 @@ WRITE32_MEMBER( psxgpu_device::write )
|
||||
}
|
||||
|
||||
|
||||
void psxgpu_device::dma_read( UINT32 *p_ram, INT32 n_size )
|
||||
void psxgpu_device::dma_read( UINT32 n_address, INT32 n_size )
|
||||
{
|
||||
psx_state *p_psx = machine().driver_data<psx_state>();
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
|
||||
gpu_read( &p_n_psxram[ n_address / 4 ], n_size );
|
||||
}
|
||||
|
||||
void psxgpu_device::gpu_read( UINT32 *p_ram, INT32 n_size )
|
||||
{
|
||||
while( n_size > 0 )
|
||||
{
|
||||
@ -3611,7 +3627,7 @@ READ32_MEMBER( psxgpu_device::read )
|
||||
switch( offset )
|
||||
{
|
||||
case 0x00:
|
||||
dma_read( &data, 1 );
|
||||
gpu_read( &data, 1 );
|
||||
break;
|
||||
case 0x01:
|
||||
data = n_gpustatus;
|
||||
|
@ -12,6 +12,11 @@
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#define MCFG_PSXGPU_ADD( cputag, tag, type, clock ) \
|
||||
MCFG_DEVICE_ADD( tag, type, clock ) \
|
||||
MCFG_PSX_DMA_CHANNEL_READ( cputag, 2, psx_dma_write_delegate( FUNC( psxgpu_device::dma_read ), (psxgpu_device *) device ) ) \
|
||||
MCFG_PSX_DMA_CHANNEL_WRITE( cputag, 2, psx_dma_read_delegate( FUNC( psxgpu_device::dma_write ), (psxgpu_device *) device ) )
|
||||
|
||||
extern const device_type CXD8514Q;
|
||||
extern const device_type CXD8538Q;
|
||||
extern const device_type CXD8561Q;
|
||||
@ -168,8 +173,8 @@ public:
|
||||
void update_screen(bitmap_t *bitmap, const rectangle *cliprect);
|
||||
WRITE32_MEMBER( write );
|
||||
READ32_MEMBER( read );
|
||||
void dma_read( UINT32 *p_ram, INT32 n_size );
|
||||
void dma_write( UINT32 *p_ram, INT32 n_size );
|
||||
void dma_read( UINT32 n_address, INT32 n_size );
|
||||
void dma_write( UINT32 n_address, INT32 n_size );
|
||||
void lightgun_set( int, int );
|
||||
void vblank( void );
|
||||
|
||||
@ -195,6 +200,8 @@ protected:
|
||||
void MoveImage( void );
|
||||
void psx_gpu_init( int n_gputype );
|
||||
void gpu_reset();
|
||||
void gpu_read( UINT32 *p_ram, INT32 n_size );
|
||||
void gpu_write( UINT32 *p_ram, INT32 n_size );
|
||||
|
||||
#if defined( MAME_DEBUG )
|
||||
void DebugMeshInit( void );
|
||||
|
@ -391,7 +391,7 @@ static MACHINE_CONFIG_START( konamigq, konamigq_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8538Q, 0 )
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8538Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -350,7 +350,7 @@ static MACHINE_CONFIG_START( konamigv, konamigv_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8514Q, 0 )
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8514Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -2988,7 +2988,7 @@ static MACHINE_CONFIG_START( konami573, ksys573_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8561Q, 0 )
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -491,7 +491,7 @@ static MACHINE_CONFIG_START( namcos10, namcos10_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8561CQ, 0 )
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561CQ, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -1006,7 +1006,7 @@ static MACHINE_CONFIG_START( coh100, namcos11_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8538Q, 0 )
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8538Q, 0 )
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
MCFG_SOUND_ADD("c352", C352, 16384000)
|
||||
|
@ -1670,7 +1670,7 @@ static MACHINE_CONFIG_START( coh700, namcos12_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8654Q, 0 )
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8654Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -975,7 +975,7 @@ static MACHINE_CONFIG_START( coh3002t, taitogn_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8654Q, 0 )
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8654Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -906,7 +906,7 @@ static MACHINE_CONFIG_START( twinkle, twinkle_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8561Q, 0 )
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("speakerleft", "speakerright")
|
||||
|
@ -502,7 +502,7 @@ static MACHINE_CONFIG_START( zn1_1mb_vram, zn_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8561Q, 0 )
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
@ -538,7 +538,7 @@ static MACHINE_CONFIG_START( zn2, zn_state )
|
||||
MCFG_PALETTE_LENGTH( 65536 )
|
||||
|
||||
MCFG_PALETTE_INIT( psx )
|
||||
MCFG_DEVICE_ADD( "gpu", CXD8654Q, 0 )
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8654Q, 0 )
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -32,8 +32,6 @@ VIDEO_START( psx_type2 );
|
||||
SCREEN_UPDATE( psx );
|
||||
INTERRUPT_GEN( psx_vblank );
|
||||
extern void psx_gpu_reset( running_machine &machine );
|
||||
extern void psx_gpu_read( running_machine &, UINT32 *p_ram, INT32 n_size );
|
||||
extern void psx_gpu_write( running_machine &, UINT32 *p_ram, INT32 n_size );
|
||||
READ32_HANDLER( psx_gpu_r );
|
||||
WRITE32_HANDLER( psx_gpu_w );
|
||||
extern void psx_lightgun_set( running_machine &, int, int );
|
||||
|
@ -84,22 +84,6 @@ void psx_sio_input( running_machine &machine, int n_port, int n_mask, int n_data
|
||||
psxcpu_device::sio_input( *machine.device("maincpu"), "maincpu", n_port, n_mask, n_data );
|
||||
}
|
||||
|
||||
static void gpu_read( psx_state *p_psx, UINT32 n_address, INT32 n_size )
|
||||
{
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( p_psx->machine().device("gpu") );
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
|
||||
gpu->dma_read( &p_n_psxram[ n_address / 4 ], n_size );
|
||||
}
|
||||
|
||||
static void gpu_write( psx_state *p_psx, UINT32 n_address, INT32 n_size )
|
||||
{
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( p_psx->machine().device("gpu") );
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
|
||||
gpu->dma_write( &p_n_psxram[ n_address / 4 ], n_size );
|
||||
}
|
||||
|
||||
void psx_driver_init( running_machine &machine )
|
||||
{
|
||||
psx_state *p_psx = machine.driver_data<psx_state>();
|
||||
@ -107,9 +91,6 @@ void psx_driver_init( running_machine &machine )
|
||||
p_psx->b_need_sianniv_vblank_hack = !strcmp(machine.system().name, "sianniv");
|
||||
|
||||
p_psx->m_p_n_psxram = (UINT32 *)memory_get_shared(machine, "share1", p_psx->m_n_psxramsize);
|
||||
|
||||
psx_dma_install_read_handler( machine, 2, psx_dma_read_delegate( FUNC( gpu_read ), p_psx ) );
|
||||
psx_dma_install_write_handler( machine, 2, psx_dma_write_delegate( FUNC( gpu_write ), p_psx ) );
|
||||
}
|
||||
|
||||
SCREEN_UPDATE( psx )
|
||||
|
Loading…
Reference in New Issue
Block a user