src/mame/machine/snes.c
| r3354 | r3355 | |
| 15 | 15 | #include "driver.h" |
| 16 | 16 | #include "includes/snes.h" |
| 17 | 17 | #include "cpu/g65816/g65816.h" |
| 18 | | #ifdef MESS |
| 19 | | #include "image.h" |
| 20 | | #endif |
| 21 | 18 | |
| 22 | 19 | // add-on chip emulators |
| 23 | 20 | #include "machine/snesdsp1.c" |
| r3354 | r3355 | |
| 60 | 57 | UINT8 oldrol; |
| 61 | 58 | } joypad[4]; |
| 62 | 59 | |
| 60 | |
| 61 | /************************************* |
| 62 | |
| 63 | Timers |
| 64 | |
| 65 | *************************************/ |
| 66 | |
| 63 | 67 | // utility function - latches the H/V counters. Used by IRQ, writes to WRIO, etc. |
| 64 | 68 | static void snes_latch_counters(running_machine *machine) |
| 65 | 69 | { |
| r3354 | r3355 | |
| 270 | 274 | timer_adjust_oneshot(snes_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, nextscan, 0), 0); |
| 271 | 275 | } |
| 272 | 276 | |
| 273 | | static void snes_init_ram(running_machine *machine) |
| 274 | | { |
| 275 | | int i; |
| 276 | 277 | |
| 277 | | /* Init DSP1 */ |
| 278 | | DSP1_reset(machine); |
| 279 | 278 | |
| 280 | | /* Init VRAM */ |
| 281 | | memset( snes_vram, 0, SNES_VRAM_SIZE ); |
| 279 | /************************************* |
| 282 | 280 | |
| 283 | | /* Init Colour RAM */ |
| 284 | | memset( (UINT8 *)snes_cgram, 0, SNES_CGRAM_SIZE); |
| 281 | Input Handlers |
| 285 | 282 | |
| 286 | | /* Init oam RAM */ |
| 287 | | memset( snes_oam, 0xff, SNES_OAM_SIZE ); |
| 283 | *************************************/ |
| 288 | 284 | |
| 289 | | /* Init work RAM - 0x55 isn't exactly right but it's close */ |
| 290 | | /* make sure it happens to the 65816 (CPU 0) */ |
| 291 | | cpuintrf_push_context(0); |
| 292 | | for (i = 0; i < (128*1024); i++) |
| 293 | | { |
| 294 | | program_write_byte(0x7e0000 + i, 0x55); |
| 295 | | } |
| 296 | | cpuintrf_pop_context(); |
| 297 | | |
| 298 | | /* Inititialize registers/variables */ |
| 299 | | snes_ppu.update_windows = 1; |
| 300 | | snes_ppu.beam.latch_vert = 0; |
| 301 | | snes_ppu.beam.latch_horz = 0; |
| 302 | | snes_ppu.beam.current_vert = 0; |
| 303 | | snes_ppu.beam.current_horz = 0; |
| 304 | | snes_ppu.beam.last_visible_line = 240; |
| 305 | | snes_ppu.mode = 0; |
| 306 | | cgram_address = 0; |
| 307 | | vram_read_offset = 2; |
| 308 | | joy1l = joy1h = joy2l = joy2h = joy3l = joy3h = 0; |
| 309 | | |
| 310 | | // set up some known register power-up defaults |
| 311 | | snes_ram[WRIO] = 0xff; |
| 312 | | snes_ram[VMAIN] = 0x80; |
| 313 | | |
| 314 | | /* init timers and stop them */ |
| 315 | | snes_scanline_timer = timer_alloc(snes_scanline_tick, NULL); |
| 316 | | timer_adjust_oneshot(snes_scanline_timer, attotime_never, 0); |
| 317 | | snes_hblank_timer = timer_alloc(snes_hblank_tick, NULL); |
| 318 | | timer_adjust_oneshot(snes_hblank_timer, attotime_never, 0); |
| 319 | | snes_nmi_timer = timer_alloc(snes_nmi_tick, NULL); |
| 320 | | timer_adjust_oneshot(snes_nmi_timer, attotime_never, 0); |
| 321 | | snes_hirq_timer = timer_alloc(snes_hirq_tick_callback, NULL); |
| 322 | | timer_adjust_oneshot(snes_hirq_timer, attotime_never, 0); |
| 323 | | |
| 324 | | // SNES hcounter has a 0-339 range. hblank starts at counter 260. |
| 325 | | // clayfighter sets an HIRQ at 260, apparently it wants it to be before hdma kicks off, so we'll delay 2 pixels. |
| 326 | | hblank_offset = 268; |
| 327 | | timer_adjust_oneshot(snes_hblank_timer, video_screen_get_time_until_pos(machine->primary_screen, ((snes_ram[STAT78] & 0x10) == SNES_NTSC) ? SNES_VTOTAL_NTSC-1 : SNES_VTOTAL_PAL-1, hblank_offset), 0); |
| 328 | | |
| 329 | | // check if DSP1 is present (maybe not 100%?) |
| 330 | | has_dsp1 = ((snes_r_bank1(machine,0xffd6) >= 3) && (snes_r_bank1(machine,0xffd6) <= 5)) ? 1 : 0; |
| 331 | | |
| 332 | | // init frame counter so first line is 0 |
| 333 | | if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds) >= 59 ) |
| 334 | | { |
| 335 | | snes_ppu.beam.current_vert = SNES_VTOTAL_NTSC; |
| 336 | | } |
| 337 | | else |
| 338 | | { |
| 339 | | snes_ppu.beam.current_vert = SNES_VTOTAL_PAL; |
| 340 | | } |
| 341 | | } |
| 342 | | |
| 343 | | /* should we treat this as nvram in MAME? */ |
| 344 | | static OPBASE_HANDLER(spc_opbase) |
| 345 | | { |
| 346 | | opbase->rom = opbase->ram = spc_ram; |
| 347 | | return ~0; |
| 348 | | } |
| 349 | | |
| 350 | | static OPBASE_HANDLER(snes_opbase) |
| 351 | | { |
| 352 | | opbase->rom = opbase->ram = snes_ram; |
| 353 | | return ~0; |
| 354 | | } |
| 355 | | |
| 356 | | MACHINE_START( snes ) |
| 357 | | { |
| 358 | | snes_vram = auto_malloc(SNES_VRAM_SIZE); |
| 359 | | snes_cgram = auto_malloc(SNES_CGRAM_SIZE); |
| 360 | | snes_oam = auto_malloc(SNES_OAM_SIZE); |
| 361 | | memory_set_opbase_handler(0, snes_opbase); |
| 362 | | memory_set_opbase_handler(1, spc_opbase); |
| 363 | | |
| 364 | | // power-on sets these registers like this |
| 365 | | snes_ram[WRIO] = 0xff; |
| 366 | | snes_ram[WRMPYA] = 0xff; |
| 367 | | snes_ram[WRDIVL] = 0xff; |
| 368 | | snes_ram[WRDIVH] = 0xff; |
| 369 | | } |
| 370 | | |
| 371 | | MACHINE_RESET( snes ) |
| 372 | | { |
| 373 | | snes_init_ram(machine); |
| 374 | | |
| 375 | | /* Set STAT78 to NTSC or PAL */ |
| 376 | | if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds) >= 59.0f ) |
| 377 | | snes_ram[STAT78] = SNES_NTSC; |
| 378 | | else /* if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds) == 50.0f ) */ |
| 379 | | snes_ram[STAT78] = SNES_PAL; |
| 380 | | |
| 381 | | // reset does this to these registers |
| 382 | | snes_ram[NMITIMEN] = 0; |
| 383 | | snes_ram[HTIMEL] = 0xff; |
| 384 | | snes_ram[HTIMEH] = 0x1; |
| 385 | | snes_ram[VTIMEL] = 0xff; |
| 386 | | snes_ram[VTIMEH] = 0x1; |
| 387 | | |
| 388 | | snes_htmult = 1; |
| 389 | | } |
| 390 | | |
| 391 | | /* Handle reading of Mode 20 SRAM */ |
| 392 | | /* 0x700000 - 0x77ffff */ |
| 393 | | READ8_HANDLER( snes_r_sram ) |
| 394 | | { |
| 395 | | UINT8 value = 0xff; |
| 396 | | int mask; |
| 397 | | |
| 398 | | // limit SRAM size to what's actually present |
| 399 | | mask = (snes_cart.sram * 1024) - 1; |
| 400 | | offset &= mask; |
| 401 | | |
| 402 | | if( snes_cart.sram > 0 ) |
| 403 | | { |
| 404 | | value = snes_ram[0x700000 + offset]; |
| 405 | | } |
| 406 | | |
| 407 | | return value; |
| 408 | | } |
| 409 | | |
| 410 | | WRITE8_HANDLER( snes_w_sram ) |
| 411 | | { |
| 412 | | int mask; |
| 413 | | |
| 414 | | // limit SRAM size to what's actually present |
| 415 | | mask = (snes_cart.sram * 1024) - 1; |
| 416 | | offset &= mask; |
| 417 | | |
| 418 | | if( snes_cart.sram > 0 ) |
| 419 | | { |
| 420 | | snes_ram[0x700000 + offset] = data; |
| 421 | | } |
| 422 | | } |
| 423 | | |
| 424 | | /* 0x000000 - 0x2fffff */ |
| 425 | | READ8_HANDLER( snes_r_bank1 ) |
| 426 | | { |
| 427 | | UINT16 address = offset & 0xffff; |
| 428 | | |
| 429 | | if ((snes_cart.mode == SNES_MODE_20) && (has_dsp1)) |
| 430 | | { |
| 431 | | if ((address >= 0x8000) && (offset >= 0x200000)) |
| 432 | | { |
| 433 | | if (address >= 0xc000) |
| 434 | | return DSP1_getSr(); |
| 435 | | else |
| 436 | | return DSP1_getDr(); |
| 437 | | } |
| 438 | | } |
| 439 | | |
| 440 | | if( address <= 0x1fff ) /* Mirror of Low RAM */ |
| 441 | | { |
| 442 | | return program_read_byte(0x7e0000 + address ); |
| 443 | | } |
| 444 | | else if( address >= 0x2000 && address <= 0x5fff ) /* I/O */ |
| 445 | | { |
| 446 | | return snes_r_io( machine, address ); |
| 447 | | } |
| 448 | | else if( address >= 0x6000 && address <= 0x7fff ) /* Reserved */ |
| 449 | | { |
| 450 | | if( snes_cart.mode == SNES_MODE_20 ) |
| 451 | | { |
| 452 | | return 0xff; |
| 453 | | } |
| 454 | | else |
| 455 | | { |
| 456 | | if (address >= 0x7000) |
| 457 | | return DSP1_getSr(); |
| 458 | | else |
| 459 | | return DSP1_getDr(); |
| 460 | | } |
| 461 | | } |
| 462 | | else |
| 463 | | return snes_ram[offset]; |
| 464 | | |
| 465 | | return 0xff; |
| 466 | | } |
| 467 | | |
| 468 | | /* 0x300000 - 0x3fffff */ |
| 469 | | READ8_HANDLER( snes_r_bank2 ) |
| 470 | | { |
| 471 | | UINT16 address = offset & 0xffff; |
| 472 | | |
| 473 | | if ((snes_cart.mode == SNES_MODE_20) && (has_dsp1)) |
| 474 | | { |
| 475 | | if (address >= 0x8000) |
| 476 | | { |
| 477 | | if (address >= 0xc000) |
| 478 | | return DSP1_getSr(); |
| 479 | | else |
| 480 | | return DSP1_getDr(); |
| 481 | | } |
| 482 | | } |
| 483 | | |
| 484 | | if( address <= 0x1fff ) /* Mirror of Low RAM */ |
| 485 | | return program_read_byte(0x7e0000 + address ); |
| 486 | | else if( address >= 0x2000 && address <= 0x5fff ) /* I/O */ |
| 487 | | return snes_r_io( machine, address ); |
| 488 | | else if( address >= 0x6000 && address <= 0x7fff ) |
| 489 | | { |
| 490 | | if( snes_cart.mode == SNES_MODE_20 ) |
| 491 | | { |
| 492 | | return 0xff; /* Reserved */ |
| 493 | | } |
| 494 | | else /* MODE_21 */ |
| 495 | | { |
| 496 | | int mask; |
| 497 | | |
| 498 | | offset -= 0x6000; |
| 499 | | |
| 500 | | // limit SRAM size to what's actually present |
| 501 | | mask = (snes_cart.sram * 1024) - 1; |
| 502 | | offset &= mask; |
| 503 | | return snes_ram[0x306000 + offset]; /* sram */ |
| 504 | | } |
| 505 | | } |
| 506 | | else |
| 507 | | return snes_ram[0x300000 + offset]; |
| 508 | | |
| 509 | | return 0xff; |
| 510 | | } |
| 511 | | |
| 512 | | /* 0x400000 - 0x5fffff */ |
| 513 | | READ8_HANDLER( snes_r_bank3 ) |
| 514 | | { |
| 515 | | UINT16 address = offset & 0xffff; |
| 516 | | |
| 517 | | if( snes_cart.mode == SNES_MODE_20 && address <= 0x7fff ) |
| 518 | | return 0xff; /* Reserved */ |
| 519 | | else |
| 520 | | return snes_ram[0x400000 + offset]; |
| 521 | | |
| 522 | | return 0xff; |
| 523 | | } |
| 524 | | |
| 525 | | /* 0x600000 - 0x6fffff */ |
| 526 | | READ8_HANDLER( snes_r_bank6 ) |
| 527 | | { |
| 528 | | UINT16 address = offset & 0xffff; |
| 529 | | |
| 530 | | if (address < 0x8000) |
| 531 | | { |
| 532 | | if (address >= 0x4000) |
| 533 | | return DSP1_getSr(); |
| 534 | | else |
| 535 | | return DSP1_getDr(); |
| 536 | | } |
| 537 | | else |
| 538 | | return snes_ram[0x600000 + offset]; |
| 539 | | |
| 540 | | return 0xff; |
| 541 | | } |
| 542 | | |
| 543 | | /* 0x800000 - 0xffffff */ |
| 544 | | READ8_HANDLER( snes_r_bank4 ) |
| 545 | | { |
| 546 | | if (offset <= 0x3fffff) |
| 547 | | { |
| 548 | | if ((offset & 0xffff) < 0x8000) |
| 549 | | return program_read_byte( offset ); |
| 550 | | else |
| 551 | | return snes_ram[0x800000 + offset]; |
| 552 | | } |
| 553 | | else if ( offset <= 0x5fffff ) |
| 554 | | { |
| 555 | | if( snes_cart.mode == SNES_MODE_20 && (offset & 0xffff) < 0x8000) |
| 556 | | return program_read_byte( offset ); |
| 557 | | else |
| 558 | | return snes_ram[0x800000 + offset]; |
| 559 | | } |
| 560 | | else |
| 561 | | { |
| 562 | | if( snes_cart.mode == SNES_MODE_20 ) |
| 563 | | return 0xff; |
| 564 | | else |
| 565 | | return snes_ram[offset + 0x800000]; |
| 566 | | } |
| 567 | | |
| 568 | | return 0xff; |
| 569 | | } |
| 570 | | |
| 571 | | /* 0x000000 - 0x2fffff */ |
| 572 | | WRITE8_HANDLER( snes_w_bank1 ) |
| 573 | | { |
| 574 | | UINT16 address = offset & 0xffff; |
| 575 | | |
| 576 | | if ((address >= 0x8000) && (offset >= 0x200000)) |
| 577 | | { |
| 578 | | DSP1_setDr(data); |
| 579 | | return; |
| 580 | | } |
| 581 | | |
| 582 | | if( address <= 0x1fff ) /* Mirror of Low RAM */ |
| 583 | | program_write_byte(0x7e0000 + address, data ); |
| 584 | | else if( address >= 0x2000 && address <= 0x5fff ) /* I/O */ |
| 585 | | snes_w_io( machine, address, data ); |
| 586 | | else if( address >= 0x6000 && address <= 0x7fff ) /* Reserved */ |
| 587 | | if( snes_cart.mode == SNES_MODE_20 ) |
| 588 | | logerror( "Attempt to write to reserved address: %X\n", offset ); |
| 589 | | else |
| 590 | | { |
| 591 | | DSP1_setDr(data); |
| 592 | | return; |
| 593 | | } |
| 594 | | else |
| 595 | | logerror( "Attempt to write to ROM address: %X\n", offset ); |
| 596 | | } |
| 597 | | |
| 598 | | /* 0x300000 - 0x3fffff */ |
| 599 | | WRITE8_HANDLER( snes_w_bank2 ) |
| 600 | | { |
| 601 | | UINT16 address = offset & 0xffff; |
| 602 | | |
| 603 | | if (address >= 0x8000) |
| 604 | | { |
| 605 | | DSP1_setDr(data); |
| 606 | | return; |
| 607 | | } |
| 608 | | |
| 609 | | if( address <= 0x1fff ) /* Mirror of Low RAM */ |
| 610 | | program_write_byte(0x7e0000 + address, data ); |
| 611 | | else if( address >= 0x2000 && address <= 0x5fff ) /* I/O */ |
| 612 | | snes_w_io( machine, address, data ); |
| 613 | | else if( address >= 0x6000 && address <= 0x7fff ) |
| 614 | | { |
| 615 | | if( snes_cart.mode == SNES_MODE_20 ) /* Reserved */ |
| 616 | | logerror( "Attempt to write to reserved address: %X\n", offset ); |
| 617 | | else /* MODE_21 */ |
| 618 | | { |
| 619 | | int mask; |
| 620 | | |
| 621 | | offset -= 0x6000; |
| 622 | | |
| 623 | | // limit SRAM size to what's actually present |
| 624 | | mask = (snes_cart.sram * 1024) - 1; |
| 625 | | offset &= mask; |
| 626 | | snes_ram[0x306000 + offset] = data; /* sram */ |
| 627 | | } |
| 628 | | } |
| 629 | | else |
| 630 | | logerror( "Attempt to write to ROM address: %X\n", offset ); |
| 631 | | } |
| 632 | | |
| 633 | | /* 0x600000 - 0x6fffff */ |
| 634 | | WRITE8_HANDLER( snes_w_bank6 ) |
| 635 | | { |
| 636 | | UINT16 address = offset & 0xffff; |
| 637 | | |
| 638 | | if (address < 0x8000) |
| 639 | | { |
| 640 | | DSP1_setDr(data); |
| 641 | | return; |
| 642 | | } |
| 643 | | } |
| 644 | | |
| 645 | | /* 0x800000 - 0xffffff */ |
| 646 | | WRITE8_HANDLER( snes_w_bank4 ) |
| 647 | | { |
| 648 | | if( snes_cart.mode == SNES_MODE_20 ) |
| 649 | | { |
| 650 | | if( offset <= 0x2fffff ) |
| 651 | | snes_w_bank1( machine, offset, data ); |
| 652 | | else if( offset >= 0x300000 && offset <= 0x3fffff ) |
| 653 | | snes_w_bank2( machine, offset - 0x300000, data ); |
| 654 | | } |
| 655 | | else /* MODE_21 */ |
| 656 | | { |
| 657 | | if( offset <= 0x2fffff ) |
| 658 | | snes_w_bank1( machine, offset, data ); |
| 659 | | else if( offset >= 0x300000 && offset <= 0x3fffff ) |
| 660 | | snes_w_bank2( machine, offset - 0x300000, data ); |
| 661 | | else |
| 662 | | logerror( "Attempt to write to ROM address: %X\n", offset ); |
| 663 | | } |
| 664 | | } |
| 665 | | |
| 666 | 285 | /* |
| 667 | 286 | * DR - Double read : address is read twice to return a 16bit value. |
| 668 | 287 | * low - This is the low byte of a 16 or 24 bit value |
| r3354 | r3355 | |
| 1469 | 1088 | snes_ram[offset] = data; |
| 1470 | 1089 | } |
| 1471 | 1090 | |
| 1091 | /************************************* |
| 1092 | |
| 1093 | Memory Handlers |
| 1094 | |
| 1095 | *************************************/ |
| 1096 | |
| 1097 | /* |
| 1098 | There are at least 4 different kind of boards for SNES carts, which we denote with |
| 1099 | mode_20, mode_21, mode_22 and mode_25. Below is a layout of the memory for each of |
| 1100 | them, as described on the SNES dev manual. Notice we mirror ROM at loading time |
| 1101 | where necessary (e.g. banks 0x80 to 0xff at address 0x8000 for mode_20). |
| 1102 | |
| 1103 | MODE_20 |
| 1104 | banks 0x00 0x20 0x40 0x60 0x70 0x7e 0x80 0xc0 0xff |
| 1105 | address | | | | | | | | |
| 1106 | 0xffff ------------------------------------------------------------------------------| |
| 1107 | ROM | ROM / | ROM | ROM | ROM / | | 0x00 | 0x40 | |
| 1108 | | DSP | | | SRAM? | | to | to | |
| 1109 | 0x8000 ----------------------------------------------------------| | 0x3f | 0x7f | |
| 1110 | Reserv | | | | W | | | |
| 1111 | | | | S | R | m | m | |
| 1112 | 0x6000 ----------------------------| | DSP / | R | A | i | i | |
| 1113 | I/O | Reserv | | A | M | r | r | |
| 1114 | 0x2000 ----------------------------| | Reserv | M | | r | r | |
| 1115 | Low RAM (from 0x7e) | | | | | o | o | |
| 1116 | | | | | | r | r | |
| 1117 | 0x0000 ------------------------------------------------------------------------------- |
| 1118 | |
| 1119 | MODE_22 is the same, but banks 0x40 to 0x7e at address 0x000 to 0x7fff contain ROM (of |
| 1120 | course mirrored also at 0xc0 to 0xff). Mode 22 is quite similar to the board SHVC-2P3B |
| 1121 | shown on SNES Dev manual. It is used also in SDD-1 games (only for the first blocks of |
| 1122 | data). DSP data & status can be either at banks 0x20 to 0x40 at address 0x8000 or at |
| 1123 | banks 0x60 to 0x6f at address 0x0000. |
| 1124 | |
| 1125 | |
| 1126 | MODE_21 |
| 1127 | banks 0x00 0x10 0x30 0x40 0x7e 0x80 0xc0 0xff |
| 1128 | address | | | | | | | |
| 1129 | 0xffff --------------------------------------------------------------------| |
| 1130 | mirror | 0xc0 | | mirror | | |
| 1131 | upper half ROM | to | | up half | | |
| 1132 | from 0xc0 to 0xff | 0xff | | ROM | | |
| 1133 | 0x8000 --------------------------------------| | |---------| | |
| 1134 | DSP / | Reserv | SRAM | | W | | | |
| 1135 | Reserv | | | m | R | 0x00 | R | |
| 1136 | 0x6000 --------------------------------------| i | A | to | O | |
| 1137 | I/O | r | M | 0x3f | M | |
| 1138 | 0x2000 --------------------------------------| r | | mirror | | |
| 1139 | Low RAM (from 0x7e) | o | | | | |
| 1140 | | r | | | | |
| 1141 | 0x0000 --------------------------------------------------------------------- |
| 1142 | |
| 1143 | |
| 1144 | MODE_25 is very similar to MODE_21, but it is tought for images whose roms is larger than |
| 1145 | the available banks at 0xc0 to 0xff. |
| 1146 | |
| 1147 | banks 0x00 0x20 0x3e 0x40 0x7e 0x80 0xb0 0xc0 0xff |
| 1148 | address | | | | | | | | |
| 1149 | 0xffff ----------------------------------------------------------------------------| |
| 1150 | mirror | Last | | | ROM | | |
| 1151 | upper half ROM | 0.5Mbits | | | mirror | | |
| 1152 | from 0x40 to 0x7e | ROM | ROM | | up half | ROM | |
| 1153 | 0x8000 -----------------------------------| | |------------------| | |
| 1154 | DSP / | Reserv | next | W | Reserv | SRAM | first | |
| 1155 | Reserv | | | R | | | | |
| 1156 | 0x6000 -----------------------------------| 31 | A |------------------| 32 | |
| 1157 | I/O | Mbits | M | 0x00 | Mbits | |
| 1158 | 0x2000 -----------------------------------| | | to | | |
| 1159 | Low RAM (from 0x7e) | | | 0x3f | | |
| 1160 | | | | mirror | | |
| 1161 | 0x0000 ----------------------------------------------------------------------------- |
| 1162 | |
| 1163 | |
| 1164 | */ |
| 1165 | |
| 1166 | |
| 1167 | /* 0x000000 - 0x2fffff */ |
| 1168 | READ8_HANDLER( snes_r_bank1 ) |
| 1169 | { |
| 1170 | UINT8 value; |
| 1171 | UINT16 address = offset & 0xffff; |
| 1172 | |
| 1173 | if (address < 0x2000) /* Mirror of Low RAM */ |
| 1174 | value = program_read_byte(0x7e0000 + address); |
| 1175 | else if (address < 0x6000) /* I/O */ |
| 1176 | value = snes_r_io(machine, address); |
| 1177 | else if (address < 0x8000) |
| 1178 | { |
| 1179 | if ((snes_cart.mode == SNES_MODE_21) && has_dsp1 && (offset < 0x100000)) |
| 1180 | value = (address < 0x7000) ? DSP1_getDr() : DSP1_getSr(); |
| 1181 | else |
| 1182 | value = 0xff; /* Reserved */ |
| 1183 | } |
| 1184 | else if ((snes_cart.mode == SNES_MODE_20) && has_dsp1 && (offset >= 0x200000)) |
| 1185 | value = (address < 0xc000) ? DSP1_getDr() : DSP1_getSr(); /* This is not mentioned in the SNES dev manual, fwiw */ |
| 1186 | else |
| 1187 | value = snes_ram[offset]; |
| 1188 | |
| 1189 | return value; |
| 1190 | } |
| 1191 | |
| 1192 | /* 0x300000 - 0x3fffff */ |
| 1193 | READ8_HANDLER( snes_r_bank2 ) |
| 1194 | { |
| 1195 | UINT8 value; |
| 1196 | UINT16 address = offset & 0xffff; |
| 1197 | |
| 1198 | if (address < 0x2000) /* Mirror of Low RAM */ |
| 1199 | value = program_read_byte(0x7e0000 + address); |
| 1200 | else if (address < 0x6000) /* I/O */ |
| 1201 | value = snes_r_io(machine, address); |
| 1202 | else if (address < 0x8000) /* SRAM for mode_21, Reserved othewise */ |
| 1203 | { |
| 1204 | if ((snes_cart.mode == SNES_MODE_21) && (snes_cart.sram > 0)) |
| 1205 | { |
| 1206 | int mask = ((snes_cart.sram * 1024) - 1); /* Limit SRAM size to what's actually present */ |
| 1207 | offset -= 0x6000; |
| 1208 | value = snes_ram[0x306000 + (offset & mask)]; |
| 1209 | } |
| 1210 | else |
| 1211 | value = 0xff; |
| 1212 | } |
| 1213 | /* some dsp1 games use these banks 0x30 to 0x3f at address 0x8000 */ |
| 1214 | else if ((snes_cart.mode == SNES_MODE_20) && has_dsp1) |
| 1215 | value = (address < 0xc000) ? DSP1_getDr() : DSP1_getSr(); |
| 1216 | else |
| 1217 | value = snes_ram[0x300000 + offset]; |
| 1218 | |
| 1219 | return value; |
| 1220 | } |
| 1221 | |
| 1222 | /* 0x400000 - 0x5fffff */ |
| 1223 | READ8_HANDLER( snes_r_bank3 ) |
| 1224 | { |
| 1225 | UINT8 value; |
| 1226 | UINT16 address = offset & 0xffff; |
| 1227 | |
| 1228 | if (snes_cart.mode & 5) /* Mode 20 & 22 */ |
| 1229 | { |
| 1230 | if ((address < 0x8000) && (snes_cart.mode == SNES_MODE_20)) |
| 1231 | value = 0xff; /* Reserved */ |
| 1232 | else |
| 1233 | value = snes_ram[0x400000 + offset]; |
| 1234 | } |
| 1235 | else /* Mode 21 & 25 */ |
| 1236 | value = snes_ram[0x400000 + offset]; |
| 1237 | |
| 1238 | return value; |
| 1239 | } |
| 1240 | |
| 1241 | /* 0x600000 - 0x6fffff */ |
| 1242 | READ8_HANDLER( snes_r_bank4 ) |
| 1243 | { |
| 1244 | UINT8 value; |
| 1245 | UINT16 address = offset & 0xffff; |
| 1246 | |
| 1247 | if (snes_cart.mode & 5) /* Mode 20 & 22 */ |
| 1248 | { |
| 1249 | if (address >= 0x8000) |
| 1250 | value = snes_ram[0x600000 + offset]; |
| 1251 | /* some other dsp1 games use these banks 0x60 to 0x6f at address 0x0000 */ |
| 1252 | else if (has_dsp1) |
| 1253 | value = (address >= 0x4000) ? DSP1_getSr() : DSP1_getDr(); |
| 1254 | else |
| 1255 | value = 0xff; /* Reserved */ |
| 1256 | } |
| 1257 | else if (snes_cart.mode & 0x0a) /* Mode 21 & 25 */ |
| 1258 | value = snes_ram[0x600000 + offset]; |
| 1259 | |
| 1260 | return value; |
| 1261 | } |
| 1262 | |
| 1263 | /* 0x700000 - 0x7dffff */ |
| 1264 | READ8_HANDLER( snes_r_bank5 ) |
| 1265 | { |
| 1266 | UINT8 value; |
| 1267 | UINT16 address = offset & 0xffff; |
| 1268 | |
| 1269 | if ((snes_cart.mode & 5) &&(address < 0x8000)) /* Mode 20 & 22 */ |
| 1270 | { |
| 1271 | if (snes_cart.sram > 0) |
| 1272 | { |
| 1273 | int mask = ((snes_cart.sram * 1024) - 1) | 0xff0000; /* Limit SRAM size to what's actually present */ |
| 1274 | value = snes_ram[0x700000 + (offset & mask)]; |
| 1275 | } |
| 1276 | else |
| 1277 | value = 0xff; /* Reserved */ |
| 1278 | } |
| 1279 | else |
| 1280 | value = snes_ram[0x700000 + offset]; |
| 1281 | |
| 1282 | return value; |
| 1283 | } |
| 1284 | |
| 1285 | /* 0x800000 - 0xbfffff */ |
| 1286 | READ8_HANDLER( snes_r_bank6 ) |
| 1287 | { |
| 1288 | UINT8 value; |
| 1289 | UINT16 address = offset & 0xffff; |
| 1290 | |
| 1291 | if (address < 0x8000) |
| 1292 | { |
| 1293 | if (snes_cart.mode != SNES_MODE_25) |
| 1294 | value = program_read_byte(offset); |
| 1295 | else /* Mode 25 has SRAM not mirrored from lower banks */ |
| 1296 | { |
| 1297 | if (address < 0x6000) |
| 1298 | value = program_read_byte(offset); |
| 1299 | else if ((offset >= 0x300000) && (snes_cart.sram > 0)) |
| 1300 | { |
| 1301 | int mask = ((snes_cart.sram * 1024) - 1); /* Limit SRAM size to what's actually present */ |
| 1302 | offset -= 0x6000; |
| 1303 | value = snes_ram[0x806000 + (offset & mask)]; /* SRAM */ |
| 1304 | } |
| 1305 | else /* Area 0x6000-0x8000 with offset < 0x300000 is reserved */ |
| 1306 | value = 0xff; |
| 1307 | } |
| 1308 | } |
| 1309 | else |
| 1310 | value = snes_ram[0x800000 + offset]; |
| 1311 | |
| 1312 | return value; |
| 1313 | } |
| 1314 | |
| 1315 | /* 0xc00000 - 0xffffff */ |
| 1316 | READ8_HANDLER( snes_r_bank7 ) |
| 1317 | { |
| 1318 | UINT8 value; |
| 1319 | UINT16 address = offset & 0xffff; |
| 1320 | |
| 1321 | if (snes_cart.mode & 5) /* Mode 20 & 22 */ |
| 1322 | { |
| 1323 | if (address < 0x8000) |
| 1324 | value = program_read_byte(0x400000 + offset); |
| 1325 | else |
| 1326 | value = snes_ram[0xc00000 + offset]; |
| 1327 | } |
| 1328 | else /* Mode 21 & 25 */ |
| 1329 | value = snes_ram[0xc00000 + offset]; |
| 1330 | |
| 1331 | return value; |
| 1332 | } |
| 1333 | |
| 1334 | |
| 1335 | /* 0x000000 - 0x2fffff */ |
| 1336 | WRITE8_HANDLER( snes_w_bank1 ) |
| 1337 | { |
| 1338 | UINT16 address = offset & 0xffff; |
| 1339 | |
| 1340 | if (address < 0x2000) /* Mirror of Low RAM */ |
| 1341 | program_write_byte(0x7e0000 + address, data); |
| 1342 | else if (address < 0x6000) /* I/O */ |
| 1343 | snes_w_io(machine, address, data); |
| 1344 | else if (address < 0x8000) |
| 1345 | { |
| 1346 | if ((snes_cart.mode == SNES_MODE_21) && has_dsp1 && (offset < 0x100000)) |
| 1347 | DSP1_setDr(data); |
| 1348 | else |
| 1349 | logerror( "Attempt to write to reserved address: %X\n", offset ); |
| 1350 | } |
| 1351 | else if ((snes_cart.mode == SNES_MODE_20) && has_dsp1 && (offset >= 0x200000)) |
| 1352 | DSP1_setDr(data); /* This is not mentioned in the SNES dev manual, fwiw */ |
| 1353 | else |
| 1354 | logerror( "Attempt to write to ROM address: %X\n", offset ); |
| 1355 | } |
| 1356 | |
| 1357 | /* 0x300000 - 0x3fffff */ |
| 1358 | WRITE8_HANDLER( snes_w_bank2 ) |
| 1359 | { |
| 1360 | UINT16 address = offset & 0xffff; |
| 1361 | |
| 1362 | if (address < 0x2000) /* Mirror of Low RAM */ |
| 1363 | program_write_byte(0x7e0000 + address, data); |
| 1364 | else if (address < 0x6000) /* I/O */ |
| 1365 | snes_w_io(machine, address, data); |
| 1366 | else if (address < 0x8000) /* SRAM for mode_21, Reserved othewise */ |
| 1367 | { |
| 1368 | if ((snes_cart.mode == SNES_MODE_21) && (snes_cart.sram > 0)) |
| 1369 | { |
| 1370 | int mask = ((snes_cart.sram * 1024) - 1); /* Limit SRAM size to what's actually present */ |
| 1371 | offset -= 0x6000; |
| 1372 | snes_ram[0x306000 + (offset & mask)] = data; |
| 1373 | } |
| 1374 | else |
| 1375 | logerror("Attempt to write to reserved address: %X\n", offset + 0x300000); |
| 1376 | } |
| 1377 | /* some dsp1 games use these banks 0x30 to 0x3f at address 0x8000 */ |
| 1378 | else if ((snes_cart.mode == SNES_MODE_20) && has_dsp1) |
| 1379 | DSP1_setDr(data); |
| 1380 | else |
| 1381 | logerror("Attempt to write to ROM address: %X\n", offset + 0x300000); |
| 1382 | } |
| 1383 | |
| 1384 | /* 0x600000 - 0x6fffff */ |
| 1385 | WRITE8_HANDLER( snes_w_bank4 ) |
| 1386 | { |
| 1387 | UINT16 address = offset & 0xffff; |
| 1388 | |
| 1389 | if (snes_cart.mode & 5) /* Mode 20 & 22 */ |
| 1390 | { |
| 1391 | if (address >= 0x8000) |
| 1392 | logerror("Attempt to write to ROM address: %X\n", offset + 0x600000); |
| 1393 | else if (has_dsp1) |
| 1394 | DSP1_setDr(data); |
| 1395 | else |
| 1396 | logerror("Attempt to write to reserved address: %X\n", offset + 0x600000); |
| 1397 | } |
| 1398 | else if (snes_cart.mode & 0x0a) |
| 1399 | logerror("Attempt to write to ROM address: %X\n", offset + 0x600000); |
| 1400 | } |
| 1401 | |
| 1402 | /* 0x700000 - 0x7dffff */ |
| 1403 | WRITE8_HANDLER( snes_w_bank5 ) |
| 1404 | { |
| 1405 | UINT16 address = offset & 0xffff; |
| 1406 | |
| 1407 | if ((snes_cart.mode & 5) && (address < 0x8000)) /* Mode 20 & 22 */ |
| 1408 | { |
| 1409 | if (snes_cart.sram > 0) |
| 1410 | { |
| 1411 | int mask = ((snes_cart.sram * 1024) - 1) | 0xff0000; /* Limit SRAM size to what's actually present */ |
| 1412 | snes_ram[0x700000 + (offset & mask)] = data; |
| 1413 | } |
| 1414 | else |
| 1415 | logerror("Attempt to write to reserved address: %X\n", offset + 0x600000); |
| 1416 | } |
| 1417 | else if (snes_cart.mode & 0x0a) |
| 1418 | logerror("Attempt to write to ROM address: %X\n", offset + 0x700000); |
| 1419 | } |
| 1420 | |
| 1421 | |
| 1422 | /* 0x800000 - 0xbfffff */ |
| 1423 | WRITE8_HANDLER( snes_w_bank6 ) |
| 1424 | { |
| 1425 | UINT16 address = offset & 0xffff; |
| 1426 | |
| 1427 | if (address < 0x8000) |
| 1428 | { |
| 1429 | if (snes_cart.mode != SNES_MODE_25) |
| 1430 | { |
| 1431 | if (offset < 0x300000) |
| 1432 | snes_w_bank1(machine, offset, data); |
| 1433 | else |
| 1434 | snes_w_bank2(machine, offset - 0x300000, data); |
| 1435 | } |
| 1436 | else /* Mode 25 has SRAM not mirrored from lower banks */ |
| 1437 | { |
| 1438 | if (address < 0x6000) |
| 1439 | { |
| 1440 | if (offset < 0x300000) |
| 1441 | snes_w_bank1(machine, offset, data); |
| 1442 | else |
| 1443 | snes_w_bank2(machine, offset - 0x300000, data); |
| 1444 | } |
| 1445 | else if ((offset >= 0x300000) && (snes_cart.sram > 0)) |
| 1446 | { |
| 1447 | int mask = ((snes_cart.sram * 1024) - 1); /* Limit SRAM size to what's actually present */ |
| 1448 | offset -= 0x6000; |
| 1449 | snes_ram[0xb06000 + (offset & mask)] = data; |
| 1450 | } |
| 1451 | else /* Area in 0x6000-0x8000 && offset < 0x300000 is Reserved! */ |
| 1452 | logerror("Attempt to write to reserved address: %X\n", offset + 0x800000); |
| 1453 | } |
| 1454 | } |
| 1455 | else |
| 1456 | logerror("Attempt to write to ROM address: %X\n", offset + 0x800000); |
| 1457 | } |
| 1458 | |
| 1459 | |
| 1460 | /* 0xc00000 - 0xffffff */ |
| 1461 | WRITE8_HANDLER( snes_w_bank7 ) |
| 1462 | { |
| 1463 | UINT16 address = offset & 0xffff; |
| 1464 | |
| 1465 | if (snes_cart.mode & 5) /* Mode 20 & 22 */ |
| 1466 | { |
| 1467 | if (address < 0x8000) |
| 1468 | { |
| 1469 | if (offset >= 0x3e0000) |
| 1470 | logerror("Attempt to write to banks 0xfe - 0xff address: %X\n", offset); |
| 1471 | else if (offset >= 0x300000) |
| 1472 | snes_w_bank5(machine, offset - 0x300000, data); |
| 1473 | else if (offset >= 0x200000) |
| 1474 | snes_w_bank4(machine, offset - 0x200000, data); |
| 1475 | } |
| 1476 | else |
| 1477 | logerror("Attempt to write to ROM address: %X\n", offset + 0xc00000); |
| 1478 | } |
| 1479 | else if (snes_cart.mode & 0x0a) |
| 1480 | logerror("Attempt to write to ROM address: %X\n", offset + 0xc00000); |
| 1481 | } |
| 1482 | |
| 1483 | |
| 1484 | /************************************* |
| 1485 | |
| 1486 | Driver Init |
| 1487 | |
| 1488 | *************************************/ |
| 1489 | |
| 1490 | static void snes_init_ram(running_machine *machine) |
| 1491 | { |
| 1492 | int i; |
| 1493 | |
| 1494 | /* Init DSP1 */ |
| 1495 | DSP1_reset(machine); |
| 1496 | |
| 1497 | /* Init VRAM */ |
| 1498 | memset( snes_vram, 0, SNES_VRAM_SIZE ); |
| 1499 | |
| 1500 | /* Init Colour RAM */ |
| 1501 | memset( (UINT8 *)snes_cgram, 0, SNES_CGRAM_SIZE); |
| 1502 | |
| 1503 | /* Init oam RAM */ |
| 1504 | memset( snes_oam, 0xff, SNES_OAM_SIZE ); |
| 1505 | |
| 1506 | /* Init work RAM - 0x55 isn't exactly right but it's close */ |
| 1507 | /* make sure it happens to the 65816 (CPU 0) */ |
| 1508 | cpuintrf_push_context(0); |
| 1509 | for (i = 0; i < (128*1024); i++) |
| 1510 | { |
| 1511 | program_write_byte(0x7e0000 + i, 0x55); |
| 1512 | } |
| 1513 | cpuintrf_pop_context(); |
| 1514 | |
| 1515 | /* Inititialize registers/variables */ |
| 1516 | snes_ppu.update_windows = 1; |
| 1517 | snes_ppu.beam.latch_vert = 0; |
| 1518 | snes_ppu.beam.latch_horz = 0; |
| 1519 | snes_ppu.beam.current_vert = 0; |
| 1520 | snes_ppu.beam.current_horz = 0; |
| 1521 | snes_ppu.beam.last_visible_line = 240; |
| 1522 | snes_ppu.mode = 0; |
| 1523 | cgram_address = 0; |
| 1524 | vram_read_offset = 2; |
| 1525 | joy1l = joy1h = joy2l = joy2h = joy3l = joy3h = 0; |
| 1526 | |
| 1527 | // set up some known register power-up defaults |
| 1528 | snes_ram[WRIO] = 0xff; |
| 1529 | snes_ram[VMAIN] = 0x80; |
| 1530 | |
| 1531 | /* init timers and stop them */ |
| 1532 | snes_scanline_timer = timer_alloc(snes_scanline_tick, NULL); |
| 1533 | timer_adjust_oneshot(snes_scanline_timer, attotime_never, 0); |
| 1534 | snes_hblank_timer = timer_alloc(snes_hblank_tick, NULL); |
| 1535 | timer_adjust_oneshot(snes_hblank_timer, attotime_never, 0); |
| 1536 | snes_nmi_timer = timer_alloc(snes_nmi_tick, NULL); |
| 1537 | timer_adjust_oneshot(snes_nmi_timer, attotime_never, 0); |
| 1538 | snes_hirq_timer = timer_alloc(snes_hirq_tick_callback, NULL); |
| 1539 | timer_adjust_oneshot(snes_hirq_timer, attotime_never, 0); |
| 1540 | |
| 1541 | // SNES hcounter has a 0-339 range. hblank starts at counter 260. |
| 1542 | // clayfighter sets an HIRQ at 260, apparently it wants it to be before hdma kicks off, so we'll delay 2 pixels. |
| 1543 | hblank_offset = 268; |
| 1544 | timer_adjust_oneshot(snes_hblank_timer, video_screen_get_time_until_pos(machine->primary_screen, ((snes_ram[STAT78] & 0x10) == SNES_NTSC) ? SNES_VTOTAL_NTSC-1 : SNES_VTOTAL_PAL-1, hblank_offset), 0); |
| 1545 | |
| 1546 | // check if DSP1 is present (maybe not 100%?) |
| 1547 | has_dsp1 = ((snes_r_bank1(machine,0xffd6) >= 3) && (snes_r_bank1(machine,0xffd6) <= 5)) ? 1 : 0; |
| 1548 | |
| 1549 | // init frame counter so first line is 0 |
| 1550 | if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds) >= 59 ) |
| 1551 | { |
| 1552 | snes_ppu.beam.current_vert = SNES_VTOTAL_NTSC; |
| 1553 | } |
| 1554 | else |
| 1555 | { |
| 1556 | snes_ppu.beam.current_vert = SNES_VTOTAL_PAL; |
| 1557 | } |
| 1558 | } |
| 1559 | |
| 1560 | void snes_hdma_init() |
| 1561 | { |
| 1562 | UINT8 mask = 1, dma = 0, i; |
| 1563 | |
| 1564 | snes_hdma_chnl = snes_ram[HDMAEN]; |
| 1565 | for( i = 0; i < 8; i++ ) |
| 1566 | { |
| 1567 | if( snes_ram[HDMAEN] & mask ) |
| 1568 | { |
| 1569 | snes_ram[SNES_DMA_BASE + dma + 8] = snes_ram[SNES_DMA_BASE + dma + 2]; |
| 1570 | snes_ram[SNES_DMA_BASE + dma + 9] = snes_ram[SNES_DMA_BASE + dma + 3]; |
| 1571 | snes_ram[SNES_DMA_BASE + dma + 0xa] = 0; |
| 1572 | } |
| 1573 | dma += 0x10; |
| 1574 | mask <<= 1; |
| 1575 | } |
| 1576 | } |
| 1577 | |
| 1578 | |
| 1579 | /* should we treat this as nvram in MAME? */ |
| 1580 | static OPBASE_HANDLER(spc_opbase) |
| 1581 | { |
| 1582 | opbase->rom = opbase->ram = spc_ram; |
| 1583 | return ~0; |
| 1584 | } |
| 1585 | |
| 1586 | static OPBASE_HANDLER(snes_opbase) |
| 1587 | { |
| 1588 | opbase->rom = opbase->ram = snes_ram; |
| 1589 | return ~0; |
| 1590 | } |
| 1591 | |
| 1592 | MACHINE_START( snes ) |
| 1593 | { |
| 1594 | snes_vram = auto_malloc(SNES_VRAM_SIZE); |
| 1595 | snes_cgram = auto_malloc(SNES_CGRAM_SIZE); |
| 1596 | snes_oam = auto_malloc(SNES_OAM_SIZE); |
| 1597 | memory_set_opbase_handler(0, snes_opbase); |
| 1598 | memory_set_opbase_handler(1, spc_opbase); |
| 1599 | |
| 1600 | // power-on sets these registers like this |
| 1601 | snes_ram[WRIO] = 0xff; |
| 1602 | snes_ram[WRMPYA] = 0xff; |
| 1603 | snes_ram[WRDIVL] = 0xff; |
| 1604 | snes_ram[WRDIVH] = 0xff; |
| 1605 | } |
| 1606 | |
| 1607 | MACHINE_RESET( snes ) |
| 1608 | { |
| 1609 | snes_init_ram(machine); |
| 1610 | |
| 1611 | /* Set STAT78 to NTSC or PAL */ |
| 1612 | if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds) >= 59.0f ) |
| 1613 | snes_ram[STAT78] = SNES_NTSC; |
| 1614 | else /* if( ATTOSECONDS_TO_HZ(video_screen_get_frame_period(machine->primary_screen).attoseconds) == 50.0f ) */ |
| 1615 | snes_ram[STAT78] = SNES_PAL; |
| 1616 | |
| 1617 | // reset does this to these registers |
| 1618 | snes_ram[NMITIMEN] = 0; |
| 1619 | snes_ram[HTIMEL] = 0xff; |
| 1620 | snes_ram[HTIMEH] = 0x1; |
| 1621 | snes_ram[VTIMEL] = 0xff; |
| 1622 | snes_ram[VTIMEH] = 0x1; |
| 1623 | |
| 1624 | snes_htmult = 1; |
| 1625 | } |
| 1626 | |
| 1627 | |
| 1472 | 1628 | /* for mame we use an init, maybe we will need more for the different games */ |
| 1473 | 1629 | DRIVER_INIT( snes ) |
| 1474 | 1630 | { |
| r3354 | r3355 | |
| 1591 | 1747 | } |
| 1592 | 1748 | } |
| 1593 | 1749 | |
| 1594 | | void snes_hdma_init() |
| 1595 | | { |
| 1596 | | UINT8 mask = 1, dma = 0, i; |
| 1597 | 1750 | |
| 1598 | | snes_hdma_chnl = snes_ram[HDMAEN]; |
| 1599 | | for( i = 0; i < 8; i++ ) |
| 1600 | | { |
| 1601 | | if( snes_ram[HDMAEN] & mask ) |
| 1602 | | { |
| 1603 | | snes_ram[SNES_DMA_BASE + dma + 8] = snes_ram[SNES_DMA_BASE + dma + 2]; |
| 1604 | | snes_ram[SNES_DMA_BASE + dma + 9] = snes_ram[SNES_DMA_BASE + dma + 3]; |
| 1605 | | snes_ram[SNES_DMA_BASE + dma + 0xa] = 0; |
| 1606 | | } |
| 1607 | | dma += 0x10; |
| 1608 | | mask <<= 1; |
| 1609 | | } |
| 1610 | | } |
| 1751 | /************************************* |
| 1611 | 1752 | |
| 1753 | HDMA |
| 1754 | |
| 1755 | *************************************/ |
| 1756 | |
| 1757 | |
| 1612 | 1758 | void snes_hdma() |
| 1613 | 1759 | { |
| 1614 | 1760 | UINT8 mask = 1, dma = 0, i, contmode; |