src/mame/machine/psx.c
| r11777 | r11778 | |
| 66 | 66 | |
| 67 | 67 | void psx_dma_install_read_handler( running_machine &machine, int n_channel, psx_dma_read_delegate p_fn_dma_read ) |
| 68 | 68 | { |
| 69 | | psxcpu_device::install_dma_read_handler( *machine.device("maincpu"), "maincpu", n_channel, p_fn_dma_read ); |
| 69 | downcast<psxdma_device *>( machine.device("maincpu")->subdevice("dma") )->install_read_handler( n_channel, p_fn_dma_read ); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | void psx_dma_install_write_handler( running_machine &machine, int n_channel, psx_dma_read_delegate p_fn_dma_write ) |
| 73 | 73 | { |
| 74 | | psxcpu_device::install_dma_write_handler( *machine.device("maincpu"), "maincpu", n_channel, p_fn_dma_write ); |
| 74 | downcast<psxdma_device *>( machine.device("maincpu")->subdevice("dma") )->install_write_handler( n_channel, p_fn_dma_write ); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | void psx_sio_install_handler( running_machine &machine, int n_port, psx_sio_handler p_f_sio_handler ) |
| r11777 | r11778 | |
| 84 | 84 | psxcpu_device::sio_input( *machine.device("maincpu"), "maincpu", n_port, n_mask, n_data ); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | | static void gpu_read( psx_state *p_psx, UINT32 n_address, INT32 n_size ) |
| 88 | | { |
| 89 | | psxgpu_device *gpu = downcast<psxgpu_device *>( p_psx->machine().device("gpu") ); |
| 90 | | UINT32 *p_n_psxram = p_psx->m_p_n_psxram; |
| 91 | | |
| 92 | | gpu->dma_read( &p_n_psxram[ n_address / 4 ], n_size ); |
| 93 | | } |
| 94 | | |
| 95 | | static void gpu_write( psx_state *p_psx, UINT32 n_address, INT32 n_size ) |
| 96 | | { |
| 97 | | psxgpu_device *gpu = downcast<psxgpu_device *>( p_psx->machine().device("gpu") ); |
| 98 | | UINT32 *p_n_psxram = p_psx->m_p_n_psxram; |
| 99 | | |
| 100 | | gpu->dma_write( &p_n_psxram[ n_address / 4 ], n_size ); |
| 101 | | } |
| 102 | | |
| 103 | 87 | void psx_driver_init( running_machine &machine ) |
| 104 | 88 | { |
| 105 | 89 | psx_state *p_psx = machine.driver_data<psx_state>(); |
| r11777 | r11778 | |
| 107 | 91 | p_psx->b_need_sianniv_vblank_hack = !strcmp(machine.system().name, "sianniv"); |
| 108 | 92 | |
| 109 | 93 | p_psx->m_p_n_psxram = (UINT32 *)memory_get_shared(machine, "share1", p_psx->m_n_psxramsize); |
| 110 | | |
| 111 | | psx_dma_install_read_handler( machine, 2, psx_dma_read_delegate( FUNC( gpu_read ), p_psx ) ); |
| 112 | | psx_dma_install_write_handler( machine, 2, psx_dma_write_delegate( FUNC( gpu_write ), p_psx ) ); |
| 113 | 94 | } |
| 114 | 95 | |
| 115 | 96 | SCREEN_UPDATE( psx ) |
src/mame/includes/psx.h
| r11777 | r11778 | |
| 32 | 32 | SCREEN_UPDATE( psx ); |
| 33 | 33 | INTERRUPT_GEN( psx_vblank ); |
| 34 | 34 | extern void psx_gpu_reset( running_machine &machine ); |
| 35 | | extern void psx_gpu_read( running_machine &, UINT32 *p_ram, INT32 n_size ); |
| 36 | | extern void psx_gpu_write( running_machine &, UINT32 *p_ram, INT32 n_size ); |
| 37 | 35 | READ32_HANDLER( psx_gpu_r ); |
| 38 | 36 | WRITE32_HANDLER( psx_gpu_w ); |
| 39 | 37 | extern void psx_lightgun_set( running_machine &, int, int ); |
src/mame/drivers/zn.c
| r11777 | r11778 | |
| 502 | 502 | MCFG_PALETTE_LENGTH( 65536 ) |
| 503 | 503 | |
| 504 | 504 | MCFG_PALETTE_INIT( psx ) |
| 505 | | MCFG_DEVICE_ADD( "gpu", CXD8561Q, 0 ) |
| 505 | MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0 ) |
| 506 | 506 | |
| 507 | 507 | /* sound hardware */ |
| 508 | 508 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| r11777 | r11778 | |
| 538 | 538 | MCFG_PALETTE_LENGTH( 65536 ) |
| 539 | 539 | |
| 540 | 540 | MCFG_PALETTE_INIT( psx ) |
| 541 | | MCFG_DEVICE_ADD( "gpu", CXD8654Q, 0 ) |
| 541 | MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8654Q, 0 ) |
| 542 | 542 | |
| 543 | 543 | /* sound hardware */ |
| 544 | 544 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
src/mame/drivers/namcos11.c
| r11777 | r11778 | |
| 1006 | 1006 | MCFG_PALETTE_LENGTH( 65536 ) |
| 1007 | 1007 | |
| 1008 | 1008 | MCFG_PALETTE_INIT( psx ) |
| 1009 | | MCFG_DEVICE_ADD( "gpu", CXD8538Q, 0 ) |
| 1009 | MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8538Q, 0 ) |
| 1010 | 1010 | |
| 1011 | 1011 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 1012 | 1012 | MCFG_SOUND_ADD("c352", C352, 16384000) |
src/emu/cpu/psx/psx.c
| r11777 | r11778 | |
| 3156 | 3156 | { |
| 3157 | 3157 | } |
| 3158 | 3158 | |
| 3159 | | static psxcpu_device *getcpu( device_t &device, const char *cputag ) |
| 3159 | psxcpu_device *psxcpu_device::getcpu( device_t &device, const char *cputag ) |
| 3160 | 3160 | { |
| 3161 | 3161 | if( strcmp( cputag, DEVICE_SELF ) == 0 ) |
| 3162 | 3162 | { |
| r11777 | r11778 | |
| 3172 | 3172 | irq->set( bitmask ); |
| 3173 | 3173 | } |
| 3174 | 3174 | |
| 3175 | | void psxcpu_device::install_dma_read_handler( device_t &device, const char *cputag, int channel, psx_dma_read_delegate handler ) |
| 3176 | | { |
| 3177 | | psxdma_device *dma = downcast<psxdma_device *>( getcpu( device, cputag )->subdevice("dma") ); |
| 3178 | | dma->install_read_handler( channel, handler ); |
| 3179 | | } |
| 3180 | | |
| 3181 | | void psxcpu_device::install_dma_write_handler( device_t &device, const char *cputag, int channel, psx_dma_write_delegate handler ) |
| 3182 | | { |
| 3183 | | psxdma_device *dma = downcast<psxdma_device *>( getcpu( device, cputag )->subdevice("dma") ); |
| 3184 | | dma->install_write_handler( channel, handler ); |
| 3185 | | } |
| 3186 | | |
| 3187 | 3175 | void psxcpu_device::install_sio_handler( device_t &device, const char *cputag, int n_port, psx_sio_handler p_f_sio_handler ) |
| 3188 | 3176 | { |
| 3189 | 3177 | psxsio_device *sio = downcast<psxsio_device *>( getcpu( device, cputag )->subdevice("sio") ); |
src/emu/cpu/psx/psx.h
| r11777 | r11778 | |
| 105 | 105 | //************************************************************************** |
| 106 | 106 | |
| 107 | 107 | #define MCFG_PSX_DMA_CHANNEL_READ( cputag, channel, handler ) \ |
| 108 | | psxcpu_device::install_dma_read_handler( *owner, cputag, channel, handler ); \ |
| 108 | downcast<psxdma_device *>( psxcpu_device::getcpu( *owner, cputag )->subdevice("dma") )->install_read_handler( channel, handler ); |
| 109 | 109 | |
| 110 | 110 | #define MCFG_PSX_DMA_CHANNEL_WRITE( cputag, channel, handler ) \ |
| 111 | | psxcpu_device::install_dma_write_handler( *owner, cputag, channel, handler ); \ |
| 111 | downcast<psxdma_device *>( psxcpu_device::getcpu( *owner, cputag )->subdevice("dma") )->install_write_handler( channel, handler ); |
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | |
| r11777 | r11778 | |
| 130 | 130 | WRITE32_MEMBER( berr_w ); |
| 131 | 131 | READ32_MEMBER( berr_r ); |
| 132 | 132 | |
| 133 | | static void install_dma_read_handler( device_t &device, const char *cputag, int channel, psx_dma_read_delegate handler ); |
| 134 | | static void install_dma_write_handler( device_t &device, const char *cputag, int channel, psx_dma_write_delegate handler ); |
| 133 | static psxcpu_device *getcpu( device_t &device, const char *cputag ); |
| 135 | 134 | static void install_sio_handler( device_t &device, const char *cputag, int n_port, psx_sio_handler p_f_sio_handler ); |
| 136 | 135 | static void sio_input( device_t &device, const char *cputag, int n_port, int n_mask, int n_data ); |
| 137 | 136 | static void irq_set( device_t &device, const char *cputag, UINT32 bitmask ); |
src/emu/video/psx.c
| r11777 | r11778 | |
| 2924 | 2924 | } |
| 2925 | 2925 | } |
| 2926 | 2926 | |
| 2927 | | void psxgpu_device::dma_write( UINT32 *p_ram, INT32 n_size ) |
| 2927 | void psxgpu_device::dma_write( UINT32 n_address, INT32 n_size ) |
| 2928 | 2928 | { |
| 2929 | psx_state *p_psx = machine().driver_data<psx_state>(); |
| 2930 | UINT32 *p_n_psxram = p_psx->m_p_n_psxram; |
| 2931 | |
| 2932 | gpu_write( &p_n_psxram[ n_address / 4 ], n_size ); |
| 2933 | } |
| 2934 | |
| 2935 | void psxgpu_device::gpu_write( UINT32 *p_ram, INT32 n_size ) |
| 2936 | { |
| 2929 | 2937 | while( n_size > 0 ) |
| 2930 | 2938 | { |
| 2931 | 2939 | UINT32 data = *( p_ram ); |
| r11777 | r11778 | |
| 3418 | 3426 | switch( offset ) |
| 3419 | 3427 | { |
| 3420 | 3428 | case 0x00: |
| 3421 | | dma_write( &data, 1 ); |
| 3429 | gpu_write( &data, 1 ); |
| 3422 | 3430 | break; |
| 3423 | 3431 | case 0x01: |
| 3424 | 3432 | switch( data >> 24 ) |
| r11777 | r11778 | |
| 3556 | 3564 | } |
| 3557 | 3565 | |
| 3558 | 3566 | |
| 3559 | | void psxgpu_device::dma_read( UINT32 *p_ram, INT32 n_size ) |
| 3567 | void psxgpu_device::dma_read( UINT32 n_address, INT32 n_size ) |
| 3560 | 3568 | { |
| 3569 | psx_state *p_psx = machine().driver_data<psx_state>(); |
| 3570 | UINT32 *p_n_psxram = p_psx->m_p_n_psxram; |
| 3571 | |
| 3572 | gpu_read( &p_n_psxram[ n_address / 4 ], n_size ); |
| 3573 | } |
| 3574 | |
| 3575 | void psxgpu_device::gpu_read( UINT32 *p_ram, INT32 n_size ) |
| 3576 | { |
| 3561 | 3577 | while( n_size > 0 ) |
| 3562 | 3578 | { |
| 3563 | 3579 | if( ( n_gpustatus & ( 1L << 0x1b ) ) != 0 ) |
| r11777 | r11778 | |
| 3611 | 3627 | switch( offset ) |
| 3612 | 3628 | { |
| 3613 | 3629 | case 0x00: |
| 3614 | | dma_read( &data, 1 ); |
| 3630 | gpu_read( &data, 1 ); |
| 3615 | 3631 | break; |
| 3616 | 3632 | case 0x01: |
| 3617 | 3633 | data = n_gpustatus; |
src/emu/video/psx.h
| r11777 | r11778 | |
| 12 | 12 | |
| 13 | 13 | #include "emu.h"
|
| 14 | 14 | |
| 15 | #define MCFG_PSXGPU_ADD( cputag, tag, type, clock ) \
|
| 16 | MCFG_DEVICE_ADD( tag, type, clock ) \
|
| 17 | MCFG_PSX_DMA_CHANNEL_READ( cputag, 2, psx_dma_write_delegate( FUNC( psxgpu_device::dma_read ), (psxgpu_device *) device ) ) \
|
| 18 | MCFG_PSX_DMA_CHANNEL_WRITE( cputag, 2, psx_dma_read_delegate( FUNC( psxgpu_device::dma_write ), (psxgpu_device *) device ) )
|
| 19 | |
| 15 | 20 | extern const device_type CXD8514Q;
|
| 16 | 21 | extern const device_type CXD8538Q;
|
| 17 | 22 | extern const device_type CXD8561Q;
|
| r11777 | r11778 | |
| 168 | 173 | void update_screen(bitmap_t *bitmap, const rectangle *cliprect);
|
| 169 | 174 | WRITE32_MEMBER( write );
|
| 170 | 175 | READ32_MEMBER( read );
|
| 171 | | void dma_read( UINT32 *p_ram, INT32 n_size );
|
| 172 | | void dma_write( UINT32 *p_ram, INT32 n_size );
|
| 176 | void dma_read( UINT32 n_address, INT32 n_size );
|
| 177 | void dma_write( UINT32 n_address, INT32 n_size );
|
| 173 | 178 | void lightgun_set( int, int );
|
| 174 | 179 | void vblank( void );
|
| 175 | 180 | |
| r11777 | r11778 | |
| 195 | 200 | void MoveImage( void );
|
| 196 | 201 | void psx_gpu_init( int n_gputype );
|
| 197 | 202 | void gpu_reset();
|
| 203 | void gpu_read( UINT32 *p_ram, INT32 n_size );
|
| 204 | void gpu_write( UINT32 *p_ram, INT32 n_size );
|
| 198 | 205 | |
| 199 | 206 | #if defined( MAME_DEBUG )
|
| 200 | 207 | void DebugMeshInit( void );
|
src/mess/drivers/psx.c
| r11777 | r11778 | |
| 781 | 781 | MCFG_PALETTE_LENGTH( 65536 ) |
| 782 | 782 | |
| 783 | 783 | MCFG_PALETTE_INIT( psx ) |
| 784 | | MCFG_DEVICE_ADD( "gpu", CXD8561Q, 0 ) |
| 784 | MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0 ) |
| 785 | 785 | |
| 786 | 786 | /* sound hardware */ |
| 787 | 787 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| r11777 | r11778 | |
| 818 | 818 | MCFG_PALETTE_LENGTH( 65536 ) |
| 819 | 819 | |
| 820 | 820 | MCFG_PALETTE_INIT( psx ) |
| 821 | | MCFG_DEVICE_ADD( "gpu", CXD8561Q, 0 ) |
| 821 | MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0 ) |
| 822 | 822 | |
| 823 | 823 | /* sound hardware */ |
| 824 | 824 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |