src/mame/machine/smpc.c
| r12681 | r12682 | |
| 271 | 271 | state->m_vdp2.dotsel = param ^ 1; |
| 272 | 272 | stv_vdp2_dynamic_res_change(machine); |
| 273 | 273 | |
| 274 | | if(state->m_NMI_reset) |
| 274 | if(!state->m_NMI_reset) |
| 275 | 275 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, PULSE_LINE); |
| 276 | 276 | device_set_input_line(state->m_slave, INPUT_LINE_RESET, ASSERT_LINE); |
| 277 | 277 | |
| r12681 | r12682 | |
| 616 | 616 | { |
| 617 | 617 | saturn_state *state = machine.driver_data<saturn_state>(); |
| 618 | 618 | |
| 619 | | state->m_NMI_reset = cmd ^ 1; |
| 620 | | state->m_smpc.OREG[0] = (0x80) | ((state->m_NMI_reset & 1) << 6); |
| 619 | state->m_NMI_reset = cmd; |
| 620 | //state->m_smpc.OREG[0] = (0x80) | ((state->m_NMI_reset & 1) << 6); |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | |
| r12681 | r12682 | |
| 670 | 670 | break; |
| 671 | 671 | /*"Interrupt Back"*/ |
| 672 | 672 | case 0x10: |
| 673 | | if(LOG_SMPC) |
| 673 | if(0) |
| 674 | 674 | { |
| 675 | 675 | saturn_state *state = space->machine().driver_data<saturn_state>(); |
| 676 | 676 | printf ("SMPC: Status Acquire %02x %02x %02x %d\n",state->m_smpc.IREG[0],state->m_smpc.IREG[1],state->m_smpc.IREG[2],space->machine().primary_screen->vpos()); |
src/mame/machine/stvcd.c
| r12681 | r12682 | |
| 159 | 159 | static UINT8 cd_speed; |
| 160 | 160 | static UINT8 cdda_maxrepeat; |
| 161 | 161 | static UINT8 cdda_repeat_count; |
| 162 | static UINT8 tray_is_closed; |
| 162 | 163 | |
| 163 | 164 | // iso9660 utilities |
| 164 | 165 | static void read_new_dir(running_machine &machine, UINT32 fileno); |
| r12681 | r12682 | |
| 238 | 239 | { |
| 239 | 240 | UINT32 temp; |
| 240 | 241 | |
| 241 | | if (!cdrom) |
| 242 | | { |
| 243 | | cd_stat = CD_STAT_OPEN; |
| 244 | | cr1 = cd_stat | 0xff; |
| 245 | | cr2 = 0xffff; |
| 246 | | cr3 = 0xffff; |
| 247 | | cr4 = 0xffff; |
| 248 | | hirqreg |= CMOK; |
| 249 | | return; |
| 250 | | } |
| 251 | | |
| 252 | 242 | if(cr1 != 0 && ((cr1 & 0xff00) != 0x5100) && 1) |
| 253 | 243 | printf("CD: command exec %04x %04x %04x %04x %04x (stat %04x)\n", hirqreg, cr1, cr2, cr3, cr4, cd_stat); |
| 254 | 244 | |
| r12681 | r12682 | |
| 329 | 319 | CDROM_LOG(("%s:CD: Initialize CD system\n", machine.describe_context())) |
| 330 | 320 | if((cr1 & 0x81) == 0x00) //guess |
| 331 | 321 | { |
| 332 | | //int i; |
| 333 | | cd_stat = CD_STAT_PAUSE; |
| 334 | | cd_curfad = 150; |
| 335 | | //cur_track = 1; |
| 336 | | fadstoplay = 0; |
| 322 | if(cd_stat != CD_STAT_NODISC && cd_stat != CD_STAT_OPEN) |
| 323 | { |
| 324 | cd_stat = CD_STAT_PAUSE; |
| 325 | cd_curfad = 150; |
| 326 | //cur_track = 1; |
| 327 | fadstoplay = 0; |
| 328 | } |
| 337 | 329 | in_buffer = 0; |
| 338 | 330 | buffull = 0; |
| 339 | 331 | hirqreg &= 0xffe5; |
| r12681 | r12682 | |
| 1353 | 1345 | sectorstore = 0; |
| 1354 | 1346 | xfertype32 = XFERTYPE32_INVALID; |
| 1355 | 1347 | xferdnum = 0; |
| 1356 | | cd_stat = CD_STAT_PAUSE; // force to pause |
| 1348 | if(cd_stat != CD_STAT_NODISC && cd_stat != CD_STAT_OPEN) |
| 1349 | cd_stat = CD_STAT_PAUSE; // force to pause |
| 1357 | 1350 | cr_standard_return(cd_stat); |
| 1358 | 1351 | break; |
| 1359 | 1352 | |
| 1360 | 1353 | case 0xe000: // appears to be copy protection check. needs only to return OK. |
| 1361 | 1354 | CDROM_LOG(("%s:CD: Verify copy protection\n", machine.describe_context())) |
| 1362 | | cd_stat = CD_STAT_PAUSE; |
| 1355 | if(cd_stat != CD_STAT_NODISC && cd_stat != CD_STAT_OPEN) |
| 1356 | cd_stat = CD_STAT_PAUSE; |
| 1363 | 1357 | cr1 = cd_stat; // necessary to pass |
| 1364 | 1358 | cr2 = 0x4; |
| 1365 | 1359 | // hirqreg |= (CMOK|EFLS|CSCT); |
| r12681 | r12682 | |
| 1369 | 1363 | |
| 1370 | 1364 | case 0xe100: // get disc region |
| 1371 | 1365 | CDROM_LOG(("%s:CD: Get disc region\n", machine.describe_context())) |
| 1372 | | cd_stat = CD_STAT_PAUSE; |
| 1366 | if(cd_stat != CD_STAT_NODISC && cd_stat != CD_STAT_OPEN) |
| 1367 | cd_stat = CD_STAT_PAUSE; |
| 1373 | 1368 | cr1 = cd_stat; // necessary to pass |
| 1374 | 1369 | cr2 = 0x4; // (must return this value to pass bios checks) |
| 1375 | 1370 | hirqreg |= (CMOK); |
| r12681 | r12682 | |
| 1393 | 1388 | } |
| 1394 | 1389 | |
| 1395 | 1390 | cd_stat |= CD_STAT_PERI; |
| 1391 | |
| 1392 | if(cd_stat != CD_STAT_NODISC && cd_stat != CD_STAT_OPEN) |
| 1393 | hirqreg |= SCDQ; |
| 1394 | |
| 1396 | 1395 | cr_standard_return(cd_stat); |
| 1397 | | hirqreg |= SCDQ; |
| 1398 | 1396 | } |
| 1399 | 1397 | |
| 1400 | 1398 | TIMER_DEVICE_CALLBACK( stv_sector_cb ) |
| r12681 | r12682 | |
| 1483 | 1481 | } |
| 1484 | 1482 | else |
| 1485 | 1483 | { |
| 1486 | | cd_stat = CD_STAT_OPEN; |
| 1484 | cd_stat = CD_STAT_NODISC; |
| 1487 | 1485 | } |
| 1488 | 1486 | |
| 1489 | 1487 | cd_speed = 2; |
| 1490 | 1488 | cdda_repeat_count = 0; |
| 1489 | tray_is_closed = 1; |
| 1491 | 1490 | |
| 1492 | 1491 | sector_timer = machine.device<timer_device>("sector_timer"); |
| 1493 | 1492 | sector_timer->adjust(attotime::from_hz(150)); // 150 sectors / second = 300kBytes/second |
| r12681 | r12682 | |
| 2505 | 2504 | } |
| 2506 | 2505 | } |
| 2507 | 2506 | |
| 2507 | void stvcd_set_tray_open(running_machine &machine) |
| 2508 | { |
| 2509 | if(!tray_is_closed) |
| 2510 | return; |
| 2508 | 2511 | |
| 2512 | hirqreg |= DCHG; |
| 2513 | cd_stat = CD_STAT_OPEN; |
| 2514 | |
| 2515 | cdrom = (cdrom_file *)NULL; |
| 2516 | tray_is_closed = 0; |
| 2517 | |
| 2518 | popmessage("Tray Open"); |
| 2519 | } |
| 2520 | |
| 2521 | void stvcd_set_tray_close(running_machine &machine) |
| 2522 | { |
| 2523 | /* avoid user attempts to load a CD-ROM without opening the tray first (emulation asserts anyway with current framework) */ |
| 2524 | if(tray_is_closed) |
| 2525 | return; |
| 2526 | |
| 2527 | hirqreg |= DCHG; |
| 2528 | |
| 2529 | #ifdef MESS |
| 2530 | cdrom = machine.device<cdrom_image_device>("cdrom")->get_cdrom_file(); |
| 2531 | #else |
| 2532 | cdrom = cdrom_open(get_disk_handle(machine, "cdrom")); |
| 2533 | #endif |
| 2534 | |
| 2535 | cdda_set_cdrom( machine.device("cdda"), cdrom ); |
| 2536 | |
| 2537 | if (cdrom) |
| 2538 | { |
| 2539 | CDROM_LOG(("Opened CD-ROM successfully, reading root directory\n")) |
| 2540 | //read_new_dir(machine, 0xffffff); // read root directory |
| 2541 | cd_stat = CD_STAT_PAUSE; |
| 2542 | } |
| 2543 | else |
| 2544 | { |
| 2545 | cd_stat = CD_STAT_NODISC; |
| 2546 | } |
| 2547 | |
| 2548 | cd_speed = 2; |
| 2549 | cdda_repeat_count = 0; |
| 2550 | tray_is_closed = 1; |
| 2551 | |
| 2552 | popmessage("Tray Close"); |
| 2553 | } |
src/mame/drivers/saturn.c
| r12681 | r12682 | |
| 896 | 896 | |
| 897 | 897 | #define SATURN_KEYBOARD PORT_CONDITION("INPUT_TYPE", 0x0f, PORTCOND_EQUALS, 0x05) |
| 898 | 898 | |
| 899 | static INPUT_CHANGED( nmi_reset ) |
| 900 | { |
| 901 | saturn_state *state = field.machine().driver_data<saturn_state>(); |
| 902 | |
| 903 | /* TODO: correct? */ |
| 904 | if(!state->m_NMI_reset) |
| 905 | return; |
| 906 | |
| 907 | /* TODO: NMI doesn't stay held on SH-2 core so we can't use ASSERT_LINE/CLEAR_LINE with that yet */ |
| 908 | if(newval) |
| 909 | device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, PULSE_LINE); |
| 910 | } |
| 911 | |
| 912 | static INPUT_CHANGED( tray_open ) |
| 913 | { |
| 914 | if(newval) |
| 915 | stvcd_set_tray_open(field.machine()); |
| 916 | } |
| 917 | |
| 918 | static INPUT_CHANGED( tray_close ) |
| 919 | { |
| 920 | if(newval) |
| 921 | stvcd_set_tray_close(field.machine()); |
| 922 | } |
| 923 | |
| 899 | 924 | static INPUT_PORTS_START( saturn ) |
| 925 | PORT_START("RESET") /* hardwired buttons */ |
| 926 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED(nmi_reset,0) PORT_NAME("Reset Button") |
| 927 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED(tray_open,0) PORT_NAME("Tray Open Button") |
| 928 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CHANGED(tray_close,0) PORT_NAME("Tray Close") |
| 929 | |
| 900 | 930 | PORT_START("JOY1") |
| 901 | 931 | SATURN_PAD_P1(0x0f, 0) |
| 902 | 932 | |