trunk/src/emu/cpu/psx/dma.c
| r20061 | r20062 | |
| 7 | 7 | |
| 8 | 8 | #include "emu.h" |
| 9 | 9 | #include "dma.h" |
| 10 | | #include "includes/psx.h" |
| 11 | 10 | |
| 12 | 11 | #define VERBOSE_LEVEL ( 0 ) |
| 13 | 12 | |
| r20061 | r20062 | |
| 36 | 35 | { |
| 37 | 36 | int n; |
| 38 | 37 | |
| 39 | | n_dpcp = 0; |
| 40 | | n_dicr = 0; |
| 38 | m_dpcp = 0; |
| 39 | m_dicr = 0; |
| 41 | 40 | |
| 42 | 41 | for( n = 0; n < 7; n++ ) |
| 43 | 42 | { |
| r20061 | r20062 | |
| 61 | 60 | |
| 62 | 61 | for( int index = 0; index < 7; index++ ) |
| 63 | 62 | { |
| 64 | | psx_dma_channel *dma = &channel[ index ]; |
| 63 | psx_dma_channel *dma = &m_channel[ index ]; |
| 65 | 64 | |
| 66 | 65 | dma->timer = machine().scheduler().timer_alloc( timer_expired_delegate( FUNC( psxdma_device::dma_finished_callback ), this) ); |
| 67 | 66 | |
| r20061 | r20062 | |
| 72 | 71 | machine().save().save_item( "psxdma", tag(), index, NAME( dma->b_running ) ); |
| 73 | 72 | } |
| 74 | 73 | |
| 75 | | save_item( NAME(n_dpcp) ); |
| 76 | | save_item( NAME(n_dicr) ); |
| 74 | save_item( NAME(m_dpcp) ); |
| 75 | save_item( NAME(m_dicr) ); |
| 76 | |
| 77 | /// TODO: access ram through the memory map |
| 78 | memory_share *share = machine().root_device().memshare("share1"); |
| 79 | m_ram = (UINT32 *)share->ptr(); |
| 80 | m_ramsize = share->bytes(); |
| 77 | 81 | } |
| 78 | 82 | |
| 79 | 83 | void psxdma_device::dma_start_timer( int index, UINT32 n_ticks ) |
| 80 | 84 | { |
| 81 | | psx_dma_channel *dma = &channel[ index ]; |
| 85 | psx_dma_channel *dma = &m_channel[ index ]; |
| 82 | 86 | |
| 83 | 87 | dma->timer->adjust( attotime::from_hz(33868800) * n_ticks, index); |
| 84 | 88 | dma->n_ticks = n_ticks; |
| r20061 | r20062 | |
| 87 | 91 | |
| 88 | 92 | void psxdma_device::dma_stop_timer( int index ) |
| 89 | 93 | { |
| 90 | | psx_dma_channel *dma = &channel[ index ]; |
| 94 | psx_dma_channel *dma = &m_channel[ index ]; |
| 91 | 95 | |
| 92 | 96 | dma->timer->adjust( attotime::never); |
| 93 | 97 | dma->b_running = 0; |
| r20061 | r20062 | |
| 95 | 99 | |
| 96 | 100 | void psxdma_device::dma_timer_adjust( int index ) |
| 97 | 101 | { |
| 98 | | psx_dma_channel *dma = &channel[ index ]; |
| 102 | psx_dma_channel *dma = &m_channel[ index ]; |
| 99 | 103 | |
| 100 | 104 | if( dma->b_running ) |
| 101 | 105 | { |
| r20061 | r20062 | |
| 112 | 116 | int n_int; |
| 113 | 117 | int n_mask; |
| 114 | 118 | |
| 115 | | n_int = ( n_dicr >> 24 ) & 0x7f; |
| 116 | | n_mask = ( n_dicr >> 16 ) & 0xff; |
| 119 | n_int = ( m_dicr >> 24 ) & 0x7f; |
| 120 | n_mask = ( m_dicr >> 16 ) & 0xff; |
| 117 | 121 | |
| 118 | 122 | if( ( n_mask & 0x80 ) != 0 && ( n_int & n_mask ) != 0 ) |
| 119 | 123 | { |
| 120 | 124 | verboselog( machine(), 2, "dma_interrupt_update( %02x, %02x ) interrupt triggered\n", n_int, n_mask ); |
| 121 | | n_dicr |= 0x80000000; |
| 125 | m_dicr |= 0x80000000; |
| 122 | 126 | m_irq_handler(1); |
| 123 | 127 | } |
| 124 | 128 | else if( n_int != 0 ) |
| 125 | 129 | { |
| 126 | 130 | verboselog( machine(), 2, "dma_interrupt_update( %02x, %02x ) interrupt not enabled\n", n_int, n_mask ); |
| 127 | 131 | } |
| 128 | | n_dicr &= 0x00ffffff | ( n_dicr << 8 ); |
| 132 | m_dicr &= 0x00ffffff | ( m_dicr << 8 ); |
| 129 | 133 | } |
| 130 | 134 | |
| 131 | 135 | void psxdma_device::dma_finished( int index ) |
| 132 | 136 | { |
| 133 | | psx_state *p_psx = machine().driver_data<psx_state>(); |
| 134 | | UINT32 *p_n_psxram = p_psx->m_p_n_psxram; |
| 137 | psx_dma_channel *dma = &m_channel[ index ]; |
| 135 | 138 | |
| 136 | | psx_dma_channel *dma = &channel[ index ]; |
| 137 | | |
| 138 | 139 | if( dma->n_channelcontrol == 0x01000401 && index == 2 ) |
| 139 | 140 | { |
| 140 | 141 | UINT32 n_size; |
| 141 | 142 | UINT32 n_total; |
| 142 | 143 | UINT32 n_address = ( dma->n_base & 0xffffff ); |
| 143 | | UINT32 n_adrmask = p_psx->m_n_psxramsize - 1; |
| 144 | UINT32 n_adrmask = m_ramsize - 1; |
| 144 | 145 | UINT32 n_nextaddress; |
| 145 | 146 | |
| 146 | 147 | if( n_address != 0xffffff ) |
| r20061 | r20062 | |
| 165 | 166 | return; |
| 166 | 167 | } |
| 167 | 168 | n_address &= n_adrmask; |
| 168 | | n_nextaddress = p_n_psxram[ n_address / 4 ]; |
| 169 | n_nextaddress = m_ram[ n_address / 4 ]; |
| 169 | 170 | n_size = n_nextaddress >> 24; |
| 170 | | dma->fn_write( n_address + 4, n_size ); |
| 171 | dma->fn_write( m_ram, n_address + 4, n_size ); |
| 171 | 172 | //FIXME: |
| 172 | 173 | // The following conditions will cause an endless loop. |
| 173 | 174 | // If stopping the transfer is correct I cannot judge |
| r20061 | r20062 | |
| 175 | 176 | // the hardware. |
| 176 | 177 | // Mametesters.org: psyforce0105u5red, raystorm0111u1red |
| 177 | 178 | if ((n_nextaddress & 0xffffff) != 0xffffff) |
| 178 | | if (n_address == p_n_psxram[ (n_nextaddress & 0xffffff) / 4]) |
| 179 | if (n_address == m_ram[ (n_nextaddress & 0xffffff) / 4]) |
| 179 | 180 | break; |
| 180 | 181 | if (n_address == (n_nextaddress & 0xffffff) ) |
| 181 | 182 | break; |
| r20061 | r20062 | |
| 188 | 189 | |
| 189 | 190 | dma->n_channelcontrol &= ~( ( 1L << 0x18 ) | ( 1L << 0x1c ) ); |
| 190 | 191 | |
| 191 | | n_dicr |= 1 << ( 24 + index ); |
| 192 | m_dicr |= 1 << ( 24 + index ); |
| 192 | 193 | dma_interrupt_update(); |
| 193 | 194 | dma_stop_timer( index ); |
| 194 | 195 | } |
| r20061 | r20062 | |
| 200 | 201 | |
| 201 | 202 | void psxdma_device::install_read_handler( int index, psx_dma_read_delegate p_fn_dma_read ) |
| 202 | 203 | { |
| 203 | | channel[ index ].fn_read = p_fn_dma_read; |
| 204 | m_channel[ index ].fn_read = p_fn_dma_read; |
| 204 | 205 | } |
| 205 | 206 | |
| 206 | 207 | void psxdma_device::install_write_handler( int index, psx_dma_read_delegate p_fn_dma_write ) |
| 207 | 208 | { |
| 208 | | channel[ index ].fn_write = p_fn_dma_write; |
| 209 | m_channel[ index ].fn_write = p_fn_dma_write; |
| 209 | 210 | } |
| 210 | 211 | |
| 211 | 212 | WRITE32_MEMBER( psxdma_device::write ) |
| 212 | 213 | { |
| 213 | | psx_state *p_psx = machine().driver_data<psx_state>(); |
| 214 | | |
| 215 | | UINT32 *p_n_psxram = p_psx->m_p_n_psxram; |
| 216 | 214 | int index = offset / 4; |
| 217 | | psx_dma_channel *dma = &channel[ index ]; |
| 215 | psx_dma_channel *dma = &m_channel[ index ]; |
| 218 | 216 | |
| 219 | 217 | if( index < 7 ) |
| 220 | 218 | { |
| r20061 | r20062 | |
| 231 | 229 | case 2: |
| 232 | 230 | verboselog( machine(), 2, "dmachannelcontrol( %d ) = %08x\n", index, data ); |
| 233 | 231 | dma->n_channelcontrol = data; |
| 234 | | if( ( dma->n_channelcontrol & ( 1L << 0x18 ) ) != 0 && ( n_dpcp & ( 1 << ( 3 + ( index * 4 ) ) ) ) != 0 ) |
| 232 | if( ( dma->n_channelcontrol & ( 1L << 0x18 ) ) != 0 && ( m_dpcp & ( 1 << ( 3 + ( index * 4 ) ) ) ) != 0 ) |
| 235 | 233 | { |
| 236 | 234 | INT32 n_size; |
| 237 | 235 | UINT32 n_address; |
| 238 | 236 | UINT32 n_nextaddress; |
| 239 | 237 | UINT32 n_adrmask; |
| 240 | 238 | |
| 241 | | n_adrmask = p_psx->m_n_psxramsize - 1; |
| 239 | n_adrmask = m_ramsize - 1; |
| 242 | 240 | |
| 243 | 241 | n_address = ( dma->n_base & n_adrmask ); |
| 244 | 242 | n_size = dma->n_blockcontrol; |
| r20061 | r20062 | |
| 257 | 255 | !dma->fn_read.isnull() ) |
| 258 | 256 | { |
| 259 | 257 | verboselog( machine(), 1, "dma %d read block %08x %08x\n", index, n_address, n_size ); |
| 260 | | dma->fn_read( n_address, n_size ); |
| 258 | dma->fn_read( m_ram, n_address, n_size ); |
| 261 | 259 | dma_finished( index ); |
| 262 | 260 | } |
| 263 | 261 | else if (dma->n_channelcontrol == 0x11000000 && // CD DMA |
| r20061 | r20062 | |
| 270 | 268 | oursize = (oursize > 1) ? oursize : 1; |
| 271 | 269 | oursize *= (dma->n_blockcontrol&0xffff); |
| 272 | 270 | |
| 273 | | dma->fn_read( n_address, oursize ); |
| 271 | dma->fn_read( m_ram, n_address, oursize ); |
| 274 | 272 | dma_finished( index ); |
| 275 | 273 | } |
| 276 | 274 | else if( dma->n_channelcontrol == 0x01000200 && |
| 277 | 275 | !dma->fn_read.isnull() ) |
| 278 | 276 | { |
| 279 | 277 | verboselog( machine(), 1, "dma %d read block %08x %08x\n", index, n_address, n_size ); |
| 280 | | dma->fn_read( n_address, n_size ); |
| 278 | dma->fn_read( m_ram, n_address, n_size ); |
| 281 | 279 | if( index == 1 ) |
| 282 | 280 | { |
| 283 | 281 | dma_start_timer( index, 26000 ); |
| r20061 | r20062 | |
| 291 | 289 | !dma->fn_write.isnull() ) |
| 292 | 290 | { |
| 293 | 291 | verboselog( machine(), 1, "dma %d write block %08x %08x\n", index, n_address, n_size ); |
| 294 | | dma->fn_write( n_address, n_size ); |
| 292 | dma->fn_write( m_ram, n_address, n_size ); |
| 295 | 293 | dma_finished( index ); |
| 296 | 294 | } |
| 297 | 295 | else if( dma->n_channelcontrol == 0x11050100 && |
| r20061 | r20062 | |
| 299 | 297 | { |
| 300 | 298 | /* todo: check this is a write not a read... */ |
| 301 | 299 | verboselog( machine(), 1, "dma %d write block %08x %08x\n", index, n_address, n_size ); |
| 302 | | dma->fn_write( n_address, n_size ); |
| 300 | dma->fn_write( m_ram, n_address, n_size ); |
| 303 | 301 | dma_finished( index ); |
| 304 | 302 | } |
| 305 | 303 | else if( dma->n_channelcontrol == 0x11150100 && |
| r20061 | r20062 | |
| 307 | 305 | { |
| 308 | 306 | /* todo: check this is a write not a read... */ |
| 309 | 307 | verboselog( machine(), 1, "dma %d write block %08x %08x\n", index, n_address, n_size ); |
| 310 | | dma->fn_write( n_address, n_size ); |
| 308 | dma->fn_write( m_ram, n_address, n_size ); |
| 311 | 309 | dma_finished( index ); |
| 312 | 310 | } |
| 313 | 311 | else if( dma->n_channelcontrol == 0x01000401 && |
| r20061 | r20062 | |
| 330 | 328 | while( n_size > 0 ) |
| 331 | 329 | { |
| 332 | 330 | n_nextaddress = ( n_address - 4 ) & 0xffffff; |
| 333 | | p_n_psxram[ n_address / 4 ] = n_nextaddress; |
| 331 | m_ram[ n_address / 4 ] = n_nextaddress; |
| 334 | 332 | n_address = n_nextaddress; |
| 335 | 333 | n_size--; |
| 336 | 334 | } |
| 337 | | p_n_psxram[ n_address / 4 ] = 0xffffff; |
| 335 | m_ram[ n_address / 4 ] = 0xffffff; |
| 338 | 336 | } |
| 339 | 337 | dma_start_timer( index, 2150 ); |
| 340 | 338 | } |
| r20061 | r20062 | |
| 359 | 357 | { |
| 360 | 358 | case 0x0: |
| 361 | 359 | verboselog( machine(), 1, "psx_dma_w( %04x, %08x, %08x ) dpcp\n", offset, data, mem_mask ); |
| 362 | | n_dpcp = ( n_dpcp & ~mem_mask ) | data; |
| 360 | m_dpcp = ( m_dpcp & ~mem_mask ) | data; |
| 363 | 361 | break; |
| 364 | 362 | case 0x1: |
| 365 | 363 | |
| 366 | | n_dicr = ( n_dicr & ( 0x80000000 | ~mem_mask ) ) | |
| 367 | | ( n_dicr & ~data & 0x7f000000 & mem_mask ) | |
| 364 | m_dicr = ( m_dicr & ( 0x80000000 | ~mem_mask ) ) | |
| 365 | ( m_dicr & ~data & 0x7f000000 & mem_mask ) | |
| 368 | 366 | ( data & 0x00ffffff & mem_mask ); |
| 369 | 367 | |
| 370 | | if( ( n_dicr & 0x80000000 ) != 0 && ( n_dicr & 0x7f000000 ) == 0 ) |
| 368 | if( ( m_dicr & 0x80000000 ) != 0 && ( m_dicr & 0x7f000000 ) == 0 ) |
| 371 | 369 | { |
| 372 | 370 | verboselog( machine(), 2, "dma interrupt cleared\n" ); |
| 373 | | n_dicr &= ~0x80000000; |
| 371 | m_dicr &= ~0x80000000; |
| 374 | 372 | } |
| 375 | 373 | |
| 376 | | verboselog( machine(), 1, "psx_dma_w( %04x, %08x, %08x ) dicr -> %08x\n", offset, data, mem_mask, n_dicr ); |
| 374 | verboselog( machine(), 1, "psx_dma_w( %04x, %08x, %08x ) dicr -> %08x\n", offset, data, mem_mask, m_dicr ); |
| 377 | 375 | break; |
| 378 | 376 | default: |
| 379 | 377 | verboselog( machine(), 0, "psx_dma_w( %04x, %08x, %08x ) Unknown dma control register\n", offset, data, mem_mask ); |
| r20061 | r20062 | |
| 385 | 383 | READ32_MEMBER( psxdma_device::read ) |
| 386 | 384 | { |
| 387 | 385 | int index = offset / 4; |
| 388 | | psx_dma_channel *dma = &channel[ index ]; |
| 386 | psx_dma_channel *dma = &m_channel[ index ]; |
| 389 | 387 | |
| 390 | 388 | if( index < 7 ) |
| 391 | 389 | { |
| r20061 | r20062 | |
| 410 | 408 | switch( offset % 4 ) |
| 411 | 409 | { |
| 412 | 410 | case 0x0: |
| 413 | | verboselog( machine(), 1, "psx_dma_r dpcp ( %08x )\n", n_dpcp ); |
| 414 | | return n_dpcp; |
| 411 | verboselog( machine(), 1, "psx_dma_r dpcp ( %08x )\n", m_dpcp ); |
| 412 | return m_dpcp; |
| 415 | 413 | case 0x1: |
| 416 | | verboselog( machine(), 1, "psx_dma_r dicr ( %08x )\n", n_dicr ); |
| 417 | | return n_dicr; |
| 414 | verboselog( machine(), 1, "psx_dma_r dicr ( %08x )\n", m_dicr ); |
| 415 | return m_dicr; |
| 418 | 416 | default: |
| 419 | 417 | verboselog( machine(), 0, "psx_dma_r( %08x, %08x ) Unknown dma control register\n", offset, mem_mask ); |
| 420 | 418 | break; |
trunk/src/emu/cpu/psx/psx.c
| r20061 | r20062 | |
| 64 | 64 | #include "emu.h" |
| 65 | 65 | #include "debugger.h" |
| 66 | 66 | #include "psx.h" |
| 67 | | #include "dma.h" |
| 68 | | #include "irq.h" |
| 69 | 67 | #include "mdec.h" |
| 70 | 68 | #include "rcnt.h" |
| 71 | | #include "sio.h" |
| 72 | | #include "includes/psx.h" |
| 73 | 69 | #include "sound/spu.h" |
| 74 | 70 | |
| 75 | 71 | #define LOG_BIOSCALL ( 0 ) |
| r20061 | r20062 | |
| 1530 | 1526 | AM_RANGE(0x1f801000, 0x1f80101f) AM_RAM |
| 1531 | 1527 | /* 1f801014 spu delay */ |
| 1532 | 1528 | /* 1f801018 dv delay */ |
| 1533 | | AM_RANGE(0x1f801020, 0x1f801023) AM_READWRITE_LEGACY( psx_com_delay_r, psx_com_delay_w ) |
| 1529 | AM_RANGE(0x1f801020, 0x1f801023) AM_READWRITE( com_delay_r, com_delay_w ) |
| 1534 | 1530 | AM_RANGE(0x1f801024, 0x1f80102f) AM_RAM |
| 1535 | 1531 | AM_RANGE(0x1f801040, 0x1f80104f) AM_DEVREADWRITE( "sio0", psxsio_device, read, write ) |
| 1536 | 1532 | AM_RANGE(0x1f801050, 0x1f80105f) AM_DEVREADWRITE( "sio1", psxsio_device, read, write ) |
| r20061 | r20062 | |
| 1559 | 1555 | AM_RANGE(0x1f800000, 0x1f8003ff) AM_NOP /* scratchpad */ |
| 1560 | 1556 | AM_RANGE(0x1f800400, 0x1f800fff) AM_READWRITE( berr_r, berr_w ) |
| 1561 | 1557 | AM_RANGE(0x1f801000, 0x1f80101f) AM_RAM |
| 1562 | | AM_RANGE(0x1f801020, 0x1f801023) AM_READWRITE_LEGACY( psx_com_delay_r, psx_com_delay_w ) |
| 1558 | AM_RANGE(0x1f801020, 0x1f801023) AM_READWRITE( com_delay_r, com_delay_w ) |
| 1563 | 1559 | AM_RANGE(0x1f801024, 0x1f80102f) AM_RAM |
| 1564 | 1560 | AM_RANGE(0x1f801040, 0x1f80104f) AM_DEVREADWRITE( "sio0", psxsio_device, read, write ) |
| 1565 | 1561 | AM_RANGE(0x1f801050, 0x1f80105f) AM_DEVREADWRITE( "sio1", psxsio_device, read, write ) |
| r20061 | r20062 | |
| 3177 | 3173 | m_gpu_write_handler( space, offset, data, mem_mask ); |
| 3178 | 3174 | } |
| 3179 | 3175 | |
| 3176 | WRITE32_HANDLER( psxcpu_device::com_delay_w ) |
| 3177 | { |
| 3178 | COMBINE_DATA( &m_com_delay ); |
| 3179 | //verboselog( p_psx, 1, "psx_com_delay_w( %08x %08x )\n", data, mem_mask ); |
| 3180 | } |
| 3181 | |
| 3182 | READ32_HANDLER( psxcpu_device::com_delay_r ) |
| 3183 | { |
| 3184 | //verboselog( p_psx, 1, "psx_com_delay_r( %08x )\n", mem_mask ); |
| 3185 | return m_com_delay; |
| 3186 | } |
| 3187 | |
| 3180 | 3188 | static MACHINE_CONFIG_FRAGMENT( psx ) |
| 3181 | 3189 | MCFG_DEVICE_ADD("irq", PSX_IRQ, 0) |
| 3182 | 3190 | MCFG_PSX_IRQ_HANDLER(INPUTLINE(DEVICE_SELF, PSXCPU_IRQ0)) |
trunk/src/mess/drivers/psx.c
| r20061 | r20062 | |
| 12 | 12 | #include "video/psx.h" |
| 13 | 13 | #include "imagedev/snapquik.h" |
| 14 | 14 | #include "imagedev/chd_cd.h" |
| 15 | | #include "includes/psx.h" |
| 16 | 15 | #include "sound/spu.h" |
| 17 | 16 | #include "debugger.h" |
| 18 | 17 | #include "zlib.h" |
| r20061 | r20062 | |
| 20 | 19 | #include "machine/psxcard.h" |
| 21 | 20 | #include "machine/psxcport.h" |
| 22 | 21 | |
| 23 | | class psx1_state : public psx_state |
| 22 | class psx1_state : public driver_device |
| 24 | 23 | { |
| 25 | 24 | public: |
| 26 | 25 | psx1_state(const machine_config &mconfig, device_type type, const char *tag) |
| 27 | | : psx_state(mconfig, type, tag) { } |
| 26 | : driver_device(mconfig, type, tag) |
| 27 | { |
| 28 | } |
| 28 | 29 | |
| 29 | 30 | UINT8 *m_exe_buffer; |
| 30 | 31 | int m_exe_size; |
| r20061 | r20062 | |
| 76 | 77 | |
| 77 | 78 | static int load_psxexe( device_t *cpu, unsigned char *p_n_file, int n_len ) |
| 78 | 79 | { |
| 79 | | psx_state *state = cpu->machine().driver_data<psx_state>(); |
| 80 | 80 | struct PSXEXE_HEADER |
| 81 | 81 | { |
| 82 | 82 | UINT8 id[ 8 ]; |
| r20061 | r20062 | |
| 138 | 138 | logerror( "psx_exe_load: sp %08x\n", psxexe_header->s_addr ); |
| 139 | 139 | logerror( "psx_exe_load: len %08x\n", psxexe_header->s_size ); |
| 140 | 140 | |
| 141 | | p_ram = (UINT8 *)state->m_p_n_psxram; |
| 142 | | n_ram = state->m_n_psxramsize; |
| 141 | memory_share *share = cpu->machine().root_device().memshare("share1"); |
| 142 | p_ram = (UINT8 *)share->ptr(); |
| 143 | n_ram = share->bytes(); |
| 143 | 144 | |
| 144 | 145 | p_psxexe = p_n_file + sizeof( struct PSXEXE_HEADER ); |
| 145 | 146 | |
| r20061 | r20062 | |
| 212 | 213 | |
| 213 | 214 | static int load_cpe( device_t *cpu, unsigned char *p_n_file, int n_len ) |
| 214 | 215 | { |
| 215 | | psx_state *state = cpu->machine().driver_data<psx_state>(); |
| 216 | 216 | if( n_len >= 4 && |
| 217 | 217 | memcmp( p_n_file, "CPE\001", 4 ) == 0 ) |
| 218 | 218 | { |
| r20061 | r20062 | |
| 242 | 242 | ( (int)p_n_file[ n_offset + 6 ] << 16 ) | |
| 243 | 243 | ( (int)p_n_file[ n_offset + 7 ] << 24 ); |
| 244 | 244 | |
| 245 | | UINT8 *p_ram = (UINT8 *)state->m_p_n_psxram; |
| 246 | | UINT32 n_ram = state->m_n_psxramsize; |
| 245 | memory_share *share = cpu->machine().root_device().memshare("share1"); |
| 246 | UINT8 *p_ram = (UINT8 *)share->ptr(); |
| 247 | UINT32 n_ram = share->bytes(); |
| 247 | 248 | |
| 248 | 249 | n_offset += 8; |
| 249 | 250 | |
| r20061 | r20062 | |
| 465 | 466 | |
| 466 | 467 | /* ----------------------------------------------------------------------- */ |
| 467 | 468 | |
| 468 | | static void cd_dma_read( psxcd_device *psxcd, UINT32 n_address, INT32 n_size ) |
| 469 | static void cd_dma_read( psxcd_device *psxcd, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) |
| 469 | 470 | { |
| 470 | | UINT8 *psxram = (UINT8 *)psxcd->machine().root_device().memshare("share1")->ptr(); |
| 471 | UINT8 *psxram = (UINT8 *) p_n_psxram; |
| 471 | 472 | |
| 472 | 473 | psxcd->start_dma(psxram + n_address, n_size*4); |
| 473 | 474 | } |
| 474 | 475 | |
| 475 | | static void cd_dma_write( psxcd_device *psxcd, UINT32 n_address, INT32 n_size ) |
| 476 | static void cd_dma_write( psxcd_device *psxcd, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) |
| 476 | 477 | { |
| 477 | 478 | printf("cd_dma_write?!: addr %x, size %x\n", n_address, n_size); |
| 478 | 479 | } |
| r20061 | r20062 | |
| 500 | 501 | AM_RANGE(0x9fc00000, 0x9fc7ffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 501 | 502 | AM_RANGE(0xa0000000, 0xa01fffff) AM_RAM AM_SHARE("share1") /* ram mirror */ |
| 502 | 503 | AM_RANGE(0xbfc00000, 0xbfc7ffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 503 | | AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP |
| 504 | 504 | ADDRESS_MAP_END |
| 505 | 505 | |
| 506 | 506 | DRIVER_INIT_MEMBER(psx1_state,psx) |
| 507 | 507 | { |
| 508 | | psx_driver_init(machine()); |
| 509 | 508 | } |
| 510 | 509 | |
| 511 | 510 | static INPUT_PORTS_START( psx ) |
trunk/src/mame/drivers/twinkle.c
| r20061 | r20062 | |
| 230 | 230 | #include "cpu/psx/psx.h" |
| 231 | 231 | #include "cpu/m68000/m68000.h" |
| 232 | 232 | #include "video/psx.h" |
| 233 | | #include "includes/psx.h" |
| 234 | 233 | #include "machine/scsibus.h" |
| 235 | 234 | #include "machine/scsicd.h" |
| 236 | 235 | #include "machine/am53cf96.h" |
| r20061 | r20062 | |
| 241 | 240 | #include "sound/cdda.h" |
| 242 | 241 | #include "sound/rf5c400.h" |
| 243 | 242 | |
| 244 | | class twinkle_state : public psx_state |
| 243 | class twinkle_state : public driver_device |
| 245 | 244 | { |
| 246 | 245 | public: |
| 247 | 246 | twinkle_state(const machine_config &mconfig, device_type type, const char *tag) |
| 248 | | : psx_state(mconfig, type, tag), |
| 247 | : driver_device(mconfig, type, tag), |
| 249 | 248 | m_am53cf96(*this, "scsi:am53cf96"){ } |
| 250 | 249 | |
| 251 | 250 | required_device<am53cf96_device> m_am53cf96; |
| r20061 | r20062 | |
| 652 | 651 | AM_RANGE(0x9fc00000, 0x9fc7ffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 653 | 652 | AM_RANGE(0xa0000000, 0xa03fffff) AM_RAM AM_SHARE("share1") /* ram mirror */ |
| 654 | 653 | AM_RANGE(0xbfc00000, 0xbfc7ffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 655 | | AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP |
| 656 | 654 | ADDRESS_MAP_END |
| 657 | 655 | |
| 658 | 656 | /* SPU board */ |
| r20061 | r20062 | |
| 768 | 766 | |
| 769 | 767 | /* SCSI */ |
| 770 | 768 | |
| 771 | | static void scsi_dma_read( twinkle_state *state, UINT32 n_address, INT32 n_size ) |
| 769 | static void scsi_dma_read( twinkle_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) |
| 772 | 770 | { |
| 773 | | UINT32 *p_n_psxram = state->m_p_n_psxram; |
| 774 | | |
| 775 | 771 | int i; |
| 776 | 772 | int n_this; |
| 777 | 773 | |
| r20061 | r20062 | |
| 813 | 809 | } |
| 814 | 810 | } |
| 815 | 811 | |
| 816 | | static void scsi_dma_write( twinkle_state *state, UINT32 n_address, INT32 n_size ) |
| 812 | static void scsi_dma_write( twinkle_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) |
| 817 | 813 | { |
| 818 | | UINT32 *p_n_psxram = state->m_p_n_psxram; |
| 819 | | |
| 820 | 814 | int i; |
| 821 | 815 | int n_this; |
| 822 | 816 | |
| r20061 | r20062 | |
| 850 | 844 | |
| 851 | 845 | DRIVER_INIT_MEMBER(twinkle_state,twinkle) |
| 852 | 846 | { |
| 853 | | psx_driver_init(machine()); |
| 854 | | |
| 855 | 847 | device_t *i2cmem = machine().device("security"); |
| 856 | 848 | i2cmem_e0_write( i2cmem, 0 ); |
| 857 | 849 | i2cmem_e1_write( i2cmem, 0 ); |
trunk/src/mame/drivers/ksys573.c
| r20061 | r20062 | |
| 482 | 482 | #include "cdrom.h" |
| 483 | 483 | #include "cpu/psx/psx.h" |
| 484 | 484 | #include "video/psx.h" |
| 485 | | #include "includes/psx.h" |
| 486 | 485 | #include "machine/intelfsh.h" |
| 487 | 486 | #include "machine/cr589.h" |
| 488 | 487 | #include "machine/timekpr.h" |
| r20061 | r20062 | |
| 529 | 528 | #define MAX_TRANSFER_SIZE ( 63488 ) |
| 530 | 529 | |
| 531 | 530 | |
| 532 | | class ksys573_state : public psx_state |
| 531 | class ksys573_state : public driver_device |
| 533 | 532 | { |
| 534 | 533 | public: |
| 535 | 534 | ksys573_state(const machine_config &mconfig, device_type type, const char *tag) : |
| 536 | | psx_state(mconfig, type, tag), |
| 535 | driver_device(mconfig, type, tag), |
| 537 | 536 | m_psxirq(*this, ":maincpu:irq"), |
| 538 | 537 | m_cr589(*this, ":cdrom") |
| 539 | 538 | { |
| r20061 | r20062 | |
| 593 | 592 | int m_hyperbbc_lamp_strobe1; |
| 594 | 593 | int m_hyperbbc_lamp_strobe2; |
| 595 | 594 | |
| 595 | UINT32 *m_p_n_psxram; |
| 596 | |
| 596 | 597 | /* memory */ |
| 597 | 598 | UINT8 m_atapi_regs[ATAPI_REG_MAX]; |
| 598 | 599 | UINT8 m_atapi_data[ATAPI_DATA_SIZE]; |
| r20061 | r20062 | |
| 1233 | 1234 | } |
| 1234 | 1235 | } |
| 1235 | 1236 | |
| 1236 | | static void cdrom_dma_read( ksys573_state *state, UINT32 n_address, INT32 n_size ) |
| 1237 | static void cdrom_dma_read( ksys573_state *state, UINT32 *ram, UINT32 n_address, INT32 n_size ) |
| 1237 | 1238 | { |
| 1238 | 1239 | verboselog( state->machine(), 2, "cdrom_dma_read( %08x, %08x )\n", n_address, n_size ); |
| 1239 | 1240 | // mame_printf_debug("DMA read: address %08x size %08x\n", n_address, n_size); |
| 1240 | 1241 | } |
| 1241 | 1242 | |
| 1242 | | static void cdrom_dma_write( ksys573_state *state, UINT32 n_address, INT32 n_size ) |
| 1243 | static void cdrom_dma_write( ksys573_state *state, UINT32 *ram, UINT32 n_address, INT32 n_size ) |
| 1243 | 1244 | { |
| 1245 | state->m_p_n_psxram = ram; |
| 1246 | |
| 1244 | 1247 | verboselog( state->machine(), 2, "cdrom_dma_write( %08x, %08x )\n", n_address, n_size ); |
| 1245 | 1248 | // mame_printf_debug("DMA write: address %08x size %08x\n", n_address, n_size); |
| 1246 | 1249 | |
| r20061 | r20062 | |
| 1364 | 1367 | AM_RANGE(0x9fc00000, 0x9fc7ffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 1365 | 1368 | AM_RANGE(0xa0000000, 0xa03fffff) AM_RAM AM_SHARE("share1") /* ram mirror */ |
| 1366 | 1369 | AM_RANGE(0xbfc00000, 0xbfc7ffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 1367 | | AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP |
| 1368 | 1370 | ADDRESS_MAP_END |
| 1369 | 1371 | |
| 1370 | 1372 | |
| r20061 | r20062 | |
| 1424 | 1426 | |
| 1425 | 1427 | DRIVER_INIT_MEMBER(ksys573_state,konami573) |
| 1426 | 1428 | { |
| 1427 | | psx_driver_init(machine()); |
| 1428 | 1429 | atapi_init(machine()); |
| 1429 | 1430 | |
| 1430 | 1431 | save_item( NAME(m_n_security_control) ); |
| r20061 | r20062 | |
| 1441 | 1442 | |
| 1442 | 1443 | void sys573_vblank(ksys573_state *state, screen_device &screen, bool vblank_state) |
| 1443 | 1444 | { |
| 1444 | | UINT32 *p_n_psxram = state->m_p_n_psxram; |
| 1445 | | |
| 1446 | 1445 | update_mode(state->machine()); |
| 1447 | 1446 | |
| 1447 | /// TODO: emulate the memory controller board |
| 1448 | 1448 | if( strcmp( state->machine().system().name, "ddr2ml" ) == 0 ) |
| 1449 | 1449 | { |
| 1450 | 1450 | /* patch out security-plate error */ |
| 1451 | 1451 | |
| 1452 | UINT32 *p_n_psxram = (UINT32 *)state->machine().root_device().memshare("share1")->ptr(); |
| 1453 | |
| 1452 | 1454 | /* install cd */ |
| 1453 | 1455 | |
| 1454 | 1456 | /* 801e1540: jal $801e1f7c */ |
| r20061 | r20062 | |
| 1471 | 1473 | { |
| 1472 | 1474 | /* patch out security-plate error */ |
| 1473 | 1475 | |
| 1476 | UINT32 *p_n_psxram = (UINT32 *)state->machine().root_device().memshare("share1")->ptr(); |
| 1474 | 1477 | /* 8001f850: jal $8003221c */ |
| 1475 | 1478 | if( p_n_psxram[ 0x1f850 / 4 ] == 0x0c00c887 ) |
| 1476 | 1479 | { |
trunk/src/mame/drivers/namcos10.c
| r20061 | r20062 | |
| 267 | 267 | #include "emu.h" |
| 268 | 268 | #include "cpu/psx/psx.h" |
| 269 | 269 | #include "video/psx.h" |
| 270 | | #include "includes/psx.h" |
| 271 | 270 | |
| 272 | | class namcos10_state : public psx_state |
| 271 | class namcos10_state : public driver_device |
| 273 | 272 | { |
| 274 | 273 | public: |
| 275 | 274 | namcos10_state(const machine_config &mconfig, device_type type, const char *tag) |
| 276 | | : psx_state(mconfig, type, tag) { } |
| 275 | : driver_device(mconfig, type, tag) |
| 276 | { |
| 277 | } |
| 277 | 278 | |
| 278 | 279 | // memm variant interface |
| 279 | 280 | DECLARE_WRITE32_MEMBER(key_w); |
| r20061 | r20062 | |
| 325 | 326 | AM_RANGE(0x9fc00000, 0x9fffffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 326 | 327 | AM_RANGE(0xa0000000, 0xa0ffffff) AM_RAM AM_SHARE("share1") /* ram mirror */ |
| 327 | 328 | AM_RANGE(0xbfc00000, 0xbfffffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 328 | | AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP |
| 329 | 329 | ADDRESS_MAP_END |
| 330 | 330 | |
| 331 | 331 | |
| r20061 | r20062 | |
| 404 | 404 | ADDRESS_MAP_END |
| 405 | 405 | |
| 406 | 406 | |
| 407 | | static void memm_driver_init( running_machine &machine ) |
| 408 | | { |
| 409 | | psx_driver_init(machine); |
| 410 | | } |
| 411 | | |
| 412 | | |
| 413 | 407 | // memn variant interface |
| 414 | 408 | // |
| 415 | 409 | // Block access to the nand. Something strange is going on with the |
| r20061 | r20062 | |
| 512 | 506 | |
| 513 | 507 | state->nand_copy( (UINT32 *)( BIOS + 0x0000000 ), 0x08000, 0x001c000 ); |
| 514 | 508 | state->nand_copy( (UINT32 *)( BIOS + 0x0020000 ), 0x24000, 0x03e0000 ); |
| 515 | | |
| 516 | | psx_driver_init(machine); |
| 517 | 509 | } |
| 518 | 510 | |
| 519 | 511 | static void decrypt_bios( running_machine &machine, const char *regionName, int start, int b15, int b14, int b13, int b12, int b11, int b10, int b9, int b8, |
| r20061 | r20062 | |
| 533 | 525 | DRIVER_INIT_MEMBER(namcos10_state,mrdrilr2) |
| 534 | 526 | { |
| 535 | 527 | decrypt_bios( machine(), "user1", 0, 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3 ); |
| 536 | | memm_driver_init(machine()); |
| 537 | 528 | } |
| 538 | 529 | |
| 539 | 530 | DRIVER_INIT_MEMBER(namcos10_state,gjspace) |
trunk/src/mame/drivers/zn.c
| r20061 | r20062 | |
| 13 | 13 | #include "cpu/psx/psx.h" |
| 14 | 14 | #include "cpu/z80/z80.h" |
| 15 | 15 | #include "video/psx.h" |
| 16 | | #include "includes/psx.h" |
| 17 | 16 | #include "machine/at28c16.h" |
| 18 | 17 | #include "machine/nvram.h" |
| 19 | 18 | #include "machine/mb3773.h" |
| r20061 | r20062 | |
| 30 | 29 | |
| 31 | 30 | #define VERBOSE_LEVEL ( 0 ) |
| 32 | 31 | |
| 33 | | class zn_state : public psx_state |
| 32 | class zn_state : public driver_device |
| 34 | 33 | { |
| 35 | 34 | public: |
| 36 | 35 | zn_state(const machine_config &mconfig, device_type type, const char *tag) : |
| 37 | | psx_state(mconfig, type, tag), |
| 36 | driver_device(mconfig, type, tag), |
| 38 | 37 | m_gpu(*this, "gpu"), |
| 39 | 38 | m_znsec0(*this,"maincpu:sio0:znsec0"), |
| 40 | 39 | m_znsec1(*this,"maincpu:sio0:znsec1"), |
| r20061 | r20062 | |
| 402 | 401 | AM_RANGE(0x9fc00000, 0x9fc7ffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 403 | 402 | AM_RANGE(0xa0000000, 0xa03fffff) AM_RAM AM_SHARE("share1") /* ram mirror */ |
| 404 | 403 | AM_RANGE(0xbfc00000, 0xbfc7ffff) AM_WRITENOP AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 405 | | AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP |
| 406 | 404 | ADDRESS_MAP_END |
| 407 | 405 | |
| 408 | 406 | static ADDRESS_MAP_START( link_map, AS_PROGRAM, 8, zn_state ) |
| r20061 | r20062 | |
| 413 | 411 | zn_state *state = machine.driver_data<zn_state>(); |
| 414 | 412 | int n_game; |
| 415 | 413 | |
| 416 | | psx_driver_init(machine); |
| 417 | | |
| 418 | 414 | n_game = 0; |
| 419 | 415 | while( zn_config_table[ n_game ].s_name != NULL ) |
| 420 | 416 | { |
| r20061 | r20062 | |
| 1359 | 1355 | *2 - Unpopulated DIP28 socket |
| 1360 | 1356 | */ |
| 1361 | 1357 | |
| 1362 | | static void atpsx_dma_read( zn_state *state, UINT32 n_address, INT32 n_size ) |
| 1358 | static void atpsx_dma_read( zn_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) |
| 1363 | 1359 | { |
| 1364 | | UINT32 *p_n_psxram = state->m_p_n_psxram; |
| 1365 | 1360 | device_t *ide = state->machine().device("ide"); |
| 1366 | 1361 | |
| 1367 | 1362 | logerror("DMA read: %d bytes (%d words) to %08x\n", n_size<<2, n_size, n_address); |
| r20061 | r20062 | |
| 1384 | 1379 | } |
| 1385 | 1380 | } |
| 1386 | 1381 | |
| 1387 | | static void atpsx_dma_write( zn_state *state, UINT32 n_address, INT32 n_size ) |
| 1382 | static void atpsx_dma_write( zn_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) |
| 1388 | 1383 | { |
| 1389 | 1384 | logerror("DMA write from %08x for %d bytes\n", n_address, n_size<<2); |
| 1390 | 1385 | } |
trunk/src/mame/drivers/namcos12.c
| r20061 | r20062 | |
| 1033 | 1033 | #include "cpu/psx/psx.h" |
| 1034 | 1034 | #include "cpu/h83002/h8.h" |
| 1035 | 1035 | #include "video/psx.h" |
| 1036 | | #include "includes/psx.h" |
| 1037 | 1036 | #include "machine/at28c16.h" |
| 1038 | 1037 | #include "sound/c352.h" |
| 1039 | 1038 | #include "machine/rtc4543.h" |
| 1040 | 1039 | |
| 1041 | 1040 | #define VERBOSE_LEVEL ( 0 ) |
| 1042 | 1041 | |
| 1043 | | class namcos12_state : public psx_state |
| 1042 | class namcos12_state : public driver_device |
| 1044 | 1043 | { |
| 1045 | 1044 | public: |
| 1046 | 1045 | namcos12_state(const machine_config &mconfig, device_type type, const char *tag) |
| 1047 | | : psx_state(mconfig, type, tag), |
| 1046 | : driver_device(mconfig, type, tag), |
| 1048 | 1047 | m_rtc(*this, "rtc"), |
| 1049 | 1048 | m_sharedram(*this, "sharedram") { } |
| 1050 | 1049 | |
| r20061 | r20062 | |
| 1182 | 1181 | verboselog( machine(), 1, "dmaoffset_w( %08x, %08x, %08x ) %08x\n", offset, data, mem_mask, m_n_dmaoffset ); |
| 1183 | 1182 | } |
| 1184 | 1183 | |
| 1185 | | static void namcos12_rom_read( namcos12_state *state, UINT32 n_address, INT32 n_size ) |
| 1184 | static void namcos12_rom_read( namcos12_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) |
| 1186 | 1185 | { |
| 1187 | 1186 | const char *n_region; |
| 1188 | 1187 | int n_offset; |
| 1189 | 1188 | |
| 1190 | | INT32 n_ramleft; |
| 1191 | 1189 | INT32 n_romleft; |
| 1192 | 1190 | |
| 1193 | 1191 | UINT16 *source; |
| 1194 | 1192 | UINT16 *destination; |
| 1193 | INT32 n_ramleft; |
| 1195 | 1194 | |
| 1195 | // TODO: the check for going past the end of ram should be in dma.c |
| 1196 | UINT32 m_n_psxramsize = state->machine().root_device().memshare("share1")->bytes(); |
| 1197 | |
| 1196 | 1198 | if(state->m_has_tektagt_dma && !state->m_n_dmaoffset) |
| 1197 | 1199 | { |
| 1198 | 1200 | n_region = "user2"; |
| r20061 | r20062 | |
| 1220 | 1222 | n_size = n_romleft; |
| 1221 | 1223 | } |
| 1222 | 1224 | |
| 1223 | | destination = (UINT16 *)state->m_p_n_psxram; |
| 1224 | | n_ramleft = ( state->m_n_psxramsize - n_address ) / 4; |
| 1225 | destination = (UINT16 *)p_n_psxram; |
| 1226 | |
| 1227 | n_ramleft = ( m_n_psxramsize - n_address ) / 4; |
| 1225 | 1228 | if( n_size > n_ramleft ) |
| 1226 | 1229 | { |
| 1227 | 1230 | verboselog( state->machine(), 1, "namcos12_rom_read dma truncated %d to %d passed end of ram\n", n_size, n_ramleft ); |
| r20061 | r20062 | |
| 1248 | 1251 | |
| 1249 | 1252 | WRITE32_MEMBER(namcos12_state::s12_dma_bias_w) |
| 1250 | 1253 | { |
| 1251 | | |
| 1252 | 1254 | m_n_dmabias = data; |
| 1253 | 1255 | } |
| 1254 | 1256 | |
| r20061 | r20062 | |
| 1265 | 1267 | AM_RANGE(0x9fc00000, 0x9fffffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 1266 | 1268 | AM_RANGE(0xa0000000, 0xa03fffff) AM_RAM AM_SHARE("share1") /* ram mirror */ |
| 1267 | 1269 | AM_RANGE(0xbfc00000, 0xbfffffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 1268 | | AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP |
| 1269 | 1270 | ADDRESS_MAP_END |
| 1270 | 1271 | |
| 1271 | 1272 | WRITE32_MEMBER(namcos12_state::system11gun_w) |
| r20061 | r20062 | |
| 1591 | 1592 | |
| 1592 | 1593 | DRIVER_INIT_MEMBER(namcos12_state,namcos12) |
| 1593 | 1594 | { |
| 1594 | | |
| 1595 | | psx_driver_init(machine()); |
| 1596 | | |
| 1597 | 1595 | membank("bank1")->configure_entries(0, memregion( "user2" )->bytes() / 0x200000, memregion( "user2" )->base(), 0x200000 ); |
| 1598 | 1596 | |
| 1599 | 1597 | m_s12_porta = 0; |
trunk/src/mame/drivers/konamigq.c
| r20061 | r20062 | |
| 49 | 49 | #include "cpu/m68000/m68000.h" |
| 50 | 50 | #include "cpu/psx/psx.h" |
| 51 | 51 | #include "video/psx.h" |
| 52 | | #include "includes/psx.h" |
| 53 | | #include "includes/konamigx.h" |
| 54 | 52 | #include "machine/eeprom.h" |
| 55 | 53 | #include "machine/scsibus.h" |
| 56 | 54 | #include "machine/scsihd.h" |
| 57 | 55 | #include "machine/am53cf96.h" |
| 58 | 56 | #include "sound/k054539.h" |
| 59 | 57 | |
| 60 | | class konamigq_state : public psx_state |
| 58 | class konamigq_state : public driver_device |
| 61 | 59 | { |
| 62 | 60 | public: |
| 63 | 61 | konamigq_state(const machine_config &mconfig, device_type type, const char *tag) |
| 64 | | : psx_state(mconfig, type, tag), |
| 62 | : driver_device(mconfig, type, tag), |
| 65 | 63 | m_am53cf96(*this, "scsi:am53cf96"){ } |
| 66 | 64 | |
| 67 | 65 | required_device<am53cf96_device> m_am53cf96; |
| r20061 | r20062 | |
| 92 | 90 | |
| 93 | 91 | WRITE32_MEMBER(konamigq_state::soundr3k_w) |
| 94 | 92 | { |
| 95 | | |
| 96 | | |
| 97 | 93 | if( ACCESSING_BITS_16_31 ) |
| 98 | 94 | { |
| 99 | 95 | m_sndto000[ ( offset << 1 ) + 1 ] = data >> 16; |
| r20061 | r20062 | |
| 110 | 106 | |
| 111 | 107 | READ32_MEMBER(konamigq_state::soundr3k_r) |
| 112 | 108 | { |
| 113 | | |
| 114 | 109 | UINT32 data; |
| 115 | 110 | |
| 116 | 111 | data = ( m_sndtor3k[ ( offset << 1 ) + 1 ] << 16 ) | m_sndtor3k[ offset << 1 ]; |
| r20061 | r20062 | |
| 160 | 155 | |
| 161 | 156 | WRITE32_MEMBER(konamigq_state::pcmram_w) |
| 162 | 157 | { |
| 163 | | |
| 164 | | |
| 165 | 158 | if( ACCESSING_BITS_0_7 ) |
| 166 | 159 | { |
| 167 | 160 | m_p_n_pcmram[ offset << 1 ] = data; |
| r20061 | r20062 | |
| 174 | 167 | |
| 175 | 168 | READ32_MEMBER(konamigq_state::pcmram_r) |
| 176 | 169 | { |
| 177 | | |
| 178 | | |
| 179 | 170 | return ( m_p_n_pcmram[ ( offset << 1 ) + 1 ] << 16 ) | m_p_n_pcmram[ offset << 1 ]; |
| 180 | 171 | } |
| 181 | 172 | |
| r20061 | r20062 | |
| 206 | 197 | AM_RANGE(0x9fc00000, 0x9fc7ffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 207 | 198 | AM_RANGE(0xa0000000, 0xa03fffff) AM_RAM AM_SHARE("share1") /* ram mirror */ |
| 208 | 199 | AM_RANGE(0xbfc00000, 0xbfc7ffff) AM_ROM AM_SHARE("share2") /* bios mirror */ |
| 209 | | AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP |
| 210 | 200 | ADDRESS_MAP_END |
| 211 | 201 | |
| 212 | 202 | /* SOUND CPU */ |
| 213 | 203 | |
| 214 | 204 | READ16_MEMBER(konamigq_state::sndcomm68k_r) |
| 215 | 205 | { |
| 216 | | |
| 217 | | |
| 218 | 206 | return m_sndto000[ offset ]; |
| 219 | 207 | } |
| 220 | 208 | |
| 221 | 209 | WRITE16_MEMBER(konamigq_state::sndcomm68k_w) |
| 222 | 210 | { |
| 223 | | |
| 224 | | |
| 225 | 211 | m_sndtor3k[ offset ] = data; |
| 226 | 212 | } |
| 227 | 213 | |
| r20061 | r20062 | |
| 264 | 250 | |
| 265 | 251 | /* SCSI */ |
| 266 | 252 | |
| 267 | | static void scsi_dma_read( konamigq_state *state, UINT32 n_address, INT32 n_size ) |
| 253 | static void scsi_dma_read( konamigq_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) |
| 268 | 254 | { |
| 269 | | UINT32 *p_n_psxram = state->m_p_n_psxram; |
| 270 | 255 | UINT8 *sector_buffer = state->m_sector_buffer; |
| 271 | 256 | int i; |
| 272 | 257 | int n_this; |
| r20061 | r20062 | |
| 299 | 284 | } |
| 300 | 285 | } |
| 301 | 286 | |
| 302 | | static void scsi_dma_write( konamigq_state *state, UINT32 n_address, INT32 n_size ) |
| 287 | static void scsi_dma_write( konamigq_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ) |
| 303 | 288 | { |
| 304 | 289 | } |
| 305 | 290 | |
| 306 | 291 | DRIVER_INIT_MEMBER(konamigq_state,konamigq) |
| 307 | 292 | { |
| 308 | | psx_driver_init(machine()); |
| 309 | | |
| 310 | 293 | m_p_n_pcmram = memregion( "shared" )->base() + 0x80000; |
| 311 | 294 | } |
| 312 | 295 | |