trunk/src/emu/cpu/psx/psx.c
| r18699 | r18700 | |
| 1539 | 1539 | AM_RANGE(0x1f801080, 0x1f8010ff) AM_DEVREADWRITE( "dma", psxdma_device, read, write ) |
| 1540 | 1540 | AM_RANGE(0x1f801100, 0x1f80112f) AM_DEVREADWRITE( "rcnt", psxrcnt_device, read, write ) |
| 1541 | 1541 | /* 1f801800-1f801803 cd */ |
| 1542 | | AM_RANGE(0x1f801810, 0x1f801817) AM_READWRITE_LEGACY( psx_gpu_r, psx_gpu_w ) |
| 1542 | AM_RANGE(0x1f801810, 0x1f801817) AM_READWRITE( gpu_r, gpu_w ) |
| 1543 | 1543 | AM_RANGE(0x1f801820, 0x1f801827) AM_DEVREADWRITE( "mdec", psxmdec_device, read, write ) |
| 1544 | 1544 | AM_RANGE(0x1f801c00, 0x1f801dff) AM_READWRITE16_LEGACY( spu_r, spu_w, 0xffffffff ) |
| 1545 | 1545 | AM_RANGE(0x1f802020, 0x1f802033) AM_RAM /* ?? */ |
| r18699 | r18700 | |
| 1565 | 1565 | AM_RANGE(0x1f801070, 0x1f801077) AM_DEVREADWRITE( "irq", psxirq_device, read, write ) |
| 1566 | 1566 | AM_RANGE(0x1f801080, 0x1f8010ff) AM_DEVREADWRITE( "dma", psxdma_device, read, write ) |
| 1567 | 1567 | AM_RANGE(0x1f801100, 0x1f80112f) AM_DEVREADWRITE( "rcnt", psxrcnt_device, read, write ) |
| 1568 | | AM_RANGE(0x1f801810, 0x1f801817) AM_READWRITE_LEGACY( psx_gpu_r, psx_gpu_w ) |
| 1568 | AM_RANGE(0x1f801810, 0x1f801817) AM_READWRITE( gpu_r, gpu_w ) |
| 1569 | 1569 | AM_RANGE(0x1f801820, 0x1f801827) AM_DEVREADWRITE( "mdec", psxmdec_device, read, write ) |
| 1570 | 1570 | AM_RANGE(0x1f801c00, 0x1f801dff) AM_READWRITE16_LEGACY( spu_r, spu_w, 0xffffffff ) |
| 1571 | 1571 | AM_RANGE(0x1f802020, 0x1f802033) AM_RAM /* ?? */ |
| r18699 | r18700 | |
| 1586 | 1586 | // psxcpu_device - constructor |
| 1587 | 1587 | //------------------------------------------------- |
| 1588 | 1588 | |
| 1589 | | psxcpu_device::psxcpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal_map) |
| 1590 | | : cpu_device(mconfig, type, name, tag, owner, clock), |
| 1591 | | m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0, internal_map) |
| 1589 | psxcpu_device::psxcpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, address_map_constructor internal_map) : |
| 1590 | cpu_device(mconfig, type, name, tag, owner, clock), |
| 1591 | m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0, internal_map), |
| 1592 | m_gpu_read_handler(*this), |
| 1593 | m_gpu_write_handler(*this) |
| 1592 | 1594 | { |
| 1593 | 1595 | } |
| 1594 | 1596 | |
| r18699 | r18700 | |
| 1772 | 1774 | |
| 1773 | 1775 | // set our instruction counter |
| 1774 | 1776 | m_icountptr = &m_icount; |
| 1777 | |
| 1778 | m_gpu_read_handler.resolve_safe(0); |
| 1779 | m_gpu_write_handler.resolve_safe(); |
| 1775 | 1780 | } |
| 1776 | 1781 | |
| 1777 | 1782 | |
| r18699 | r18700 | |
| 3178 | 3183 | sio->input( n_port, n_mask, n_data ); |
| 3179 | 3184 | } |
| 3180 | 3185 | |
| 3186 | READ32_HANDLER( psxcpu_device::gpu_r ) |
| 3187 | { |
| 3188 | return m_gpu_read_handler( space, offset, mem_mask ); |
| 3189 | } |
| 3190 | |
| 3191 | WRITE32_HANDLER( psxcpu_device::gpu_w ) |
| 3192 | { |
| 3193 | m_gpu_write_handler( space, offset, data, mem_mask ); |
| 3194 | } |
| 3195 | |
| 3181 | 3196 | static MACHINE_CONFIG_FRAGMENT( psx ) |
| 3182 | 3197 | MCFG_DEVICE_ADD("irq", PSX_IRQ, 0) |
| 3183 | 3198 | MCFG_DEVICE_ADD("dma", PSX_DMA, 0) |
trunk/src/emu/cpu/psx/psx.h
| r18699 | r18700 | |
| 110 | 110 | #define MCFG_PSX_DMA_CHANNEL_WRITE( cputag, channel, handler ) \ |
| 111 | 111 | psxcpu_device::getcpu( *owner, cputag )->subdevice<psxdma_device>("dma")->install_write_handler( channel, handler ); |
| 112 | 112 | |
| 113 | #define MCFG_PSX_GPU_READ_HANDLER(_devcb) \ |
| 114 | devcb = &psxcpu_device::set_gpu_read_handler(*device, DEVCB2_##_devcb); \ |
| 113 | 115 | |
| 116 | #define MCFG_PSX_GPU_WRITE_HANDLER(_devcb) \ |
| 117 | devcb = &psxcpu_device::set_gpu_write_handler(*device, DEVCB2_##_devcb); \ |
| 114 | 118 | |
| 119 | |
| 115 | 120 | //************************************************************************** |
| 116 | 121 | // TYPE DEFINITIONS |
| 117 | 122 | //************************************************************************** |
| r18699 | r18700 | |
| 124 | 129 | // construction/destruction |
| 125 | 130 | psxcpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 126 | 131 | |
| 132 | // static configuration helpers |
| 133 | template<class _Object> static devcb2_base &set_gpu_read_handler(device_t &device, _Object object) { return downcast<psxcpu_device &>(device).m_gpu_read_handler.set_callback(object); } |
| 134 | template<class _Object> static devcb2_base &set_gpu_write_handler(device_t &device, _Object object) { return downcast<psxcpu_device &>(device).m_gpu_write_handler.set_callback(object); } |
| 135 | |
| 127 | 136 | // public interfaces |
| 128 | 137 | DECLARE_WRITE32_MEMBER( biu_w ); |
| 129 | 138 | DECLARE_READ32_MEMBER( biu_r ); |
| 130 | 139 | DECLARE_WRITE32_MEMBER( berr_w ); |
| 131 | 140 | DECLARE_READ32_MEMBER( berr_r ); |
| 132 | 141 | |
| 142 | DECLARE_WRITE32_MEMBER( gpu_w ); |
| 143 | DECLARE_READ32_MEMBER( gpu_r ); |
| 144 | |
| 133 | 145 | static psxcpu_device *getcpu( device_t &device, const char *cputag ); |
| 134 | 146 | static void install_sio_handler( device_t &device, const char *cputag, int n_port, psx_sio_handler p_f_sio_handler ); |
| 135 | 147 | static void sio_input( device_t &device, const char *cputag, int n_port, int n_mask, int n_data ); |
| r18699 | r18700 | |
| 267 | 279 | void setcp3cr( int reg, UINT32 value ); |
| 268 | 280 | |
| 269 | 281 | gte m_gte; |
| 282 | |
| 283 | devcb2_read32 m_gpu_read_handler; |
| 284 | devcb2_write32 m_gpu_write_handler; |
| 270 | 285 | }; |
| 271 | 286 | |
| 272 | 287 | class cxd8530aq_device : public psxcpu_device |
trunk/src/emu/video/psx.h
| r18699 | r18700 | |
| 13 | 13 | #include "emu.h" |
| 14 | 14 | |
| 15 | 15 | #define MCFG_PSXGPU_ADD( cputag, tag, type, _vramSize, clock ) \ |
| 16 | MCFG_DEVICE_MODIFY( cputag ) \ |
| 17 | MCFG_PSX_GPU_READ_HANDLER(DEVREAD32(tag, psxgpu_device, read)) \ |
| 18 | MCFG_PSX_GPU_WRITE_HANDLER(DEVWRITE32(tag, psxgpu_device, write)) \ |
| 16 | 19 | MCFG_DEVICE_ADD( tag, type, clock ) \ |
| 17 | 20 | ((psxgpu_device *) device)->vramSize = _vramSize; \ |
| 18 | 21 | MCFG_PSX_DMA_CHANNEL_READ( cputag, 2, psx_dma_write_delegate( FUNC( psxgpu_device::dma_read ), (psxgpu_device *) device ) ) \ |
| 19 | 22 | MCFG_PSX_DMA_CHANNEL_WRITE( cputag, 2, psx_dma_read_delegate( FUNC( psxgpu_device::dma_write ), (psxgpu_device *) device ) ) |
| 20 | 23 | |
| 21 | 24 | #define MCFG_PSXGPU_REPLACE( cputag, tag, type, _vramSize, clock ) \ |
| 25 | MCFG_DEVICE_MODIFY( cputag ) \ |
| 26 | MCFG_PSX_GPU_READ_HANDLER(DEVREAD32(tag, psxgpu_device, read)) \ |
| 27 | MCFG_PSX_GPU_WRITE_HANDLER(DEVWRITE32(tag, psxgpu_device, write)) \ |
| 22 | 28 | MCFG_DEVICE_REPLACE( tag, type, clock ) \ |
| 23 | 29 | ((psxgpu_device *) device)->vramSize = _vramSize; \ |
| 24 | 30 | MCFG_PSX_DMA_CHANNEL_READ( cputag, 2, psx_dma_write_delegate( FUNC( psxgpu_device::dma_read ), (psxgpu_device *) device ) ) \ |