trunk/src/mess/drivers/segapico.c
| r24854 | r24855 | |
| 2 | 2 | /****************************************** PICO emulation ****************************************/ |
| 3 | 3 | |
| 4 | 4 | /* todo, make this more independent of the Genesis emulation, it's really only the same CPU + VDP |
| 5 | | and doesn't need to be connected to the Genesis at all. */ |
| 5 | and doesn't need to be connected to the Genesis at all. |
| 6 | 6 | |
| 7 | sound is the 315-5641 / D77591, should be compatible with the 7759? but probably wants us to maintain |
| 8 | an external buffer of at least 0x40 bytes and feed it on a timer in sync with the timer in the chip? |
| 9 | |
| 10 | currently no way to select (or display) the story book area of the games? (will require layout and |
| 11 | external artwork) |
| 12 | |
| 13 | */ |
| 14 | |
| 15 | |
| 7 | 16 | /* |
| 8 | 17 | |
| 9 | 18 | Pico mainboard (PAL version) |
| r24854 | r24855 | |
| 229 | 238 | retdata = m_page_register; |
| 230 | 239 | break; |
| 231 | 240 | } |
| 232 | | case 7: |
| 241 | |
| 242 | |
| 243 | |
| 244 | case 8: // toy story 2 checks this for 0x3f (is that 'empty'?) |
| 233 | 245 | /* Returns free bytes left in the PCM FIFO buffer */ |
| 234 | | retdata = 0x00; |
| 246 | retdata = 0x3f; |
| 235 | 247 | break; |
| 236 | | case 8: |
| 248 | case 9: |
| 237 | 249 | /* |
| 238 | 250 | For reads, if bit 15 is cleared, it means PCM is 'busy' or |
| 239 | 251 | something like that, as games sometimes wait for it to become 1. |
| 240 | 252 | */ |
| 241 | | retdata = 0x00; |
| 253 | return (m_upd7759->busy_r()^1) << 15; |
| 254 | |
| 255 | |
| 256 | case 7: |
| 257 | case 10: |
| 258 | case 11: |
| 259 | case 12: |
| 260 | case 13: |
| 261 | case 14: |
| 262 | case 15: |
| 263 | logerror("pico_68k_io_read %d\n", offset); |
| 264 | |
| 242 | 265 | } |
| 243 | 266 | |
| 244 | 267 | return retdata | retdata << 8; |
| r24854 | r24855 | |
| 247 | 270 | |
| 248 | 271 | static void sound_cause_irq( device_t *device, int chip ) |
| 249 | 272 | { |
| 250 | | // pico_base_state *state = device->machine().driver_data<pico_base_state>(); |
| 251 | | printf("sound irq\n"); |
| 273 | pico_base_state *state = device->machine().driver_data<pico_base_state>(); |
| 274 | // printf("sound irq\n"); |
| 252 | 275 | /* upd7759 callback */ |
| 253 | | // state->m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 276 | state->m_maincpu->set_input_line(3, HOLD_LINE); |
| 254 | 277 | } |
| 255 | 278 | |
| 256 | 279 | |
| r24854 | r24855 | |
| 262 | 285 | |
| 263 | 286 | WRITE16_MEMBER(pico_base_state::pico_68k_io_write ) |
| 264 | 287 | { |
| 265 | | printf("pico_68k_io_write %04x %04x %04x\n", offset*2, data, mem_mask); |
| 288 | // printf("pico_68k_io_write %04x %04x %04x\n", offset*2, data, mem_mask); |
| 266 | 289 | |
| 267 | 290 | switch (offset) |
| 268 | 291 | { |
| 292 | |
| 269 | 293 | case 0x12/2: // guess |
| 294 | m_upd7759->reset_w(0); |
| 295 | m_upd7759->start_w(0); |
| 296 | m_upd7759->reset_w(1); |
| 297 | m_upd7759->start_w(1); |
| 298 | |
| 270 | 299 | if (mem_mask&0x00ff) m_upd7759->port_w(space,0,data&0xff); |
| 271 | 300 | if (mem_mask&0xff00) m_upd7759->port_w(space,0,(data>>8)&0xff); |
| 272 | 301 | |
| r24854 | r24855 | |
| 323 | 352 | m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)m_picocart)); |
| 324 | 353 | m_maincpu->space(AS_PROGRAM).install_write_handler(0xa14000, 0xa14003, write16_delegate(FUNC(base_md_cart_slot_device::write_tmss_bank),(base_md_cart_slot_device*)m_picocart)); |
| 325 | 354 | |
| 326 | | m_upd7759->reset_w(0); |
| 327 | | m_upd7759->start_w(0); |
| 328 | | m_upd7759->reset_w(1); |
| 329 | | m_upd7759->start_w(1); |
| 355 | |
| 330 | 356 | } |
| 331 | 357 | |
| 332 | 358 | static MACHINE_CONFIG_START( pico, pico_state ) |