src/mess/machine/msx_slot.c
| r2823 | r2824 | |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | #include "driver.h" |
| 21 | | #include "deprecat.h" |
| 22 | 21 | #include "machine/8255ppi.h" |
| 23 | 22 | #include "includes/msx_slot.h" |
| 24 | 23 | #include "includes/msx.h" |
| r2823 | r2824 | |
| 76 | 75 | |
| 77 | 76 | MSX_SLOT_MAP(empty) |
| 78 | 77 | { |
| 79 | | running_machine *machine = Machine; |
| 80 | 78 | msx_cpu_setbank (machine, page * 2 + 1, msx1.empty); |
| 81 | 79 | msx_cpu_setbank (machine, page * 2 + 2, msx1.empty); |
| 82 | 80 | } |
| r2823 | r2824 | |
| 98 | 96 | |
| 99 | 97 | MSX_SLOT_MAP(rom) |
| 100 | 98 | { |
| 101 | | running_machine *machine = Machine; |
| 102 | 99 | UINT8 *mem = state->mem + (page - state->start_page) * 0x4000; |
| 103 | 100 | |
| 104 | 101 | msx_cpu_setbank (machine, page * 2 + 1, mem); |
| r2823 | r2824 | |
| 118 | 115 | |
| 119 | 116 | MSX_SLOT_MAP(ram) |
| 120 | 117 | { |
| 121 | | running_machine *machine = Machine; |
| 122 | 118 | UINT8 *mem = state->mem + (page - state->start_page) * 0x4000; |
| 123 | 119 | |
| 124 | 120 | msx1.ram_pages[page] = mem; |
| r2823 | r2824 | |
| 182 | 178 | |
| 183 | 179 | MSX_SLOT_MAP(rammm) |
| 184 | 180 | { |
| 185 | | running_machine *machine = Machine; |
| 186 | 181 | UINT8 *mem = state->mem + |
| 187 | 182 | 0x4000 * (msx1.ram_mapper[page] & state->bank_mask); |
| 188 | 183 | |
| r2823 | r2824 | |
| 211 | 206 | |
| 212 | 207 | MSX_SLOT_MAP(msxdos2) |
| 213 | 208 | { |
| 214 | | running_machine *machine = Machine; |
| 215 | 209 | if (page != 1) { |
| 216 | 210 | msx_cpu_setbank (machine, page * 2 + 1, msx1.empty); |
| 217 | 211 | msx_cpu_setbank (machine, page * 2 + 2, msx1.empty); |
| r2823 | r2824 | |
| 225 | 219 | { |
| 226 | 220 | if (addr == 0x6000) { |
| 227 | 221 | state->banks[0] = val & 3; |
| 228 | | slot_msxdos2_map (state, 1); |
| 222 | slot_msxdos2_map (machine, state, 1); |
| 229 | 223 | } |
| 230 | 224 | } |
| 231 | 225 | |
| r2823 | r2824 | |
| 260 | 254 | |
| 261 | 255 | MSX_SLOT_MAP(konami) |
| 262 | 256 | { |
| 263 | | running_machine *machine = Machine; |
| 264 | 257 | switch (page) { |
| 265 | 258 | case 0: |
| 266 | 259 | msx_cpu_setbank (machine, 1, state->mem); |
| r2823 | r2824 | |
| 285 | 278 | switch (addr) { |
| 286 | 279 | case 0x6000: |
| 287 | 280 | state->banks[1] = val & state->bank_mask; |
| 288 | | slot_konami_map (state, 1); |
| 281 | slot_konami_map (machine, state, 1); |
| 289 | 282 | if (msx1.state[0] == state) { |
| 290 | | slot_konami_map (state, 0); |
| 283 | slot_konami_map (machine, state, 0); |
| 291 | 284 | } |
| 292 | 285 | break; |
| 293 | 286 | case 0x8000: |
| 294 | 287 | state->banks[2] = val & state->bank_mask; |
| 295 | | slot_konami_map (state, 2); |
| 288 | slot_konami_map (machine, state, 2); |
| 296 | 289 | if (msx1.state[3] == state) { |
| 297 | | slot_konami_map (state, 3); |
| 290 | slot_konami_map (machine, state, 3); |
| 298 | 291 | } |
| 299 | 292 | break; |
| 300 | 293 | case 0xa000: |
| 301 | 294 | state->banks[3] = val & state->bank_mask; |
| 302 | | slot_konami_map (state, 2); |
| 295 | slot_konami_map (machine, state, 2); |
| 303 | 296 | if (msx1.state[3] == state) { |
| 304 | | slot_konami_map (state, 3); |
| 297 | slot_konami_map (machine, state, 3); |
| 305 | 298 | } |
| 306 | 299 | } |
| 307 | 300 | } |
| r2823 | r2824 | |
| 354 | 347 | |
| 355 | 348 | MSX_SLOT_MAP(konami_scc) |
| 356 | 349 | { |
| 357 | | running_machine *machine = Machine; |
| 358 | 350 | switch (page) { |
| 359 | 351 | case 0: |
| 360 | 352 | msx_cpu_setbank (machine, 1, state->mem + state->banks[2] * 0x2000); |
| r2823 | r2824 | |
| 378 | 370 | |
| 379 | 371 | MSX_SLOT_WRITE(konami_scc) |
| 380 | 372 | { |
| 381 | | running_machine *machine = Machine; |
| 382 | | |
| 383 | 373 | if (addr >= 0x5000 && addr < 0x5800) { |
| 384 | 374 | state->banks[0] = val & state->bank_mask; |
| 385 | | slot_konami_scc_map (state, 1); |
| 375 | slot_konami_scc_map (machine, state, 1); |
| 386 | 376 | if (msx1.state[3] == state) { |
| 387 | | slot_konami_scc_map (state, 3); |
| 377 | slot_konami_scc_map (machine, state, 3); |
| 388 | 378 | } |
| 389 | 379 | } |
| 390 | 380 | else if (addr >= 0x7000 && addr < 0x7800) { |
| 391 | 381 | state->banks[1] = val & state->bank_mask; |
| 392 | | slot_konami_scc_map (state, 1); |
| 382 | slot_konami_scc_map (machine, state, 1); |
| 393 | 383 | if (msx1.state[3] == state) { |
| 394 | | slot_konami_scc_map (state, 3); |
| 384 | slot_konami_scc_map (machine, state, 3); |
| 395 | 385 | } |
| 396 | 386 | } |
| 397 | 387 | else if (addr >= 0x9000 && addr < 0x9800) { |
| 398 | 388 | state->banks[2] = val & state->bank_mask; |
| 399 | 389 | state->cart.scc.active = ((val & 0x3f) == 0x3f); |
| 400 | | slot_konami_scc_map (state, 2); |
| 390 | slot_konami_scc_map (machine, state, 2); |
| 401 | 391 | if (msx1.state[0] == state) { |
| 402 | | slot_konami_scc_map (state, 0); |
| 392 | slot_konami_scc_map (machine, state, 0); |
| 403 | 393 | } |
| 404 | 394 | } |
| 405 | 395 | else if (state->cart.scc.active && addr >= 0x9800 && addr < 0xa000) { |
| r2823 | r2824 | |
| 428 | 418 | } |
| 429 | 419 | else if (addr >= 0xb000 && addr < 0xb800) { |
| 430 | 420 | state->banks[3] = val & state->bank_mask; |
| 431 | | slot_konami_scc_map (state, 2); |
| 421 | slot_konami_scc_map (machine, state, 2); |
| 432 | 422 | if (msx1.state[0] == state) { |
| 433 | | slot_konami_scc_map (state, 0); |
| 423 | slot_konami_scc_map (machine, state, 0); |
| 434 | 424 | } |
| 435 | 425 | } |
| 436 | 426 | } |
| r2823 | r2824 | |
| 466 | 456 | |
| 467 | 457 | MSX_SLOT_MAP(ascii8) |
| 468 | 458 | { |
| 469 | | running_machine *machine = Machine; |
| 470 | 459 | switch (page) { |
| 471 | 460 | case 0: |
| 472 | 461 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r2823 | r2824 | |
| 495 | 484 | |
| 496 | 485 | state->banks[bank] = val & state->bank_mask; |
| 497 | 486 | if (bank <= 1) { |
| 498 | | slot_ascii8_map (state, 1); |
| 487 | slot_ascii8_map (machine, state, 1); |
| 499 | 488 | } |
| 500 | 489 | else if (msx1.state[2] == state) { |
| 501 | | slot_ascii8_map (state, 2); |
| 490 | slot_ascii8_map (machine, state, 2); |
| 502 | 491 | } |
| 503 | 492 | } |
| 504 | 493 | } |
| r2823 | r2824 | |
| 534 | 523 | |
| 535 | 524 | MSX_SLOT_MAP(ascii16) |
| 536 | 525 | { |
| 537 | | running_machine *machine = Machine; |
| 538 | 526 | UINT8 *mem; |
| 539 | 527 | |
| 540 | 528 | switch (page) { |
| r2823 | r2824 | |
| 562 | 550 | { |
| 563 | 551 | if (addr >= 0x6000 && addr < 0x6800) { |
| 564 | 552 | state->banks[0] = val & state->bank_mask; |
| 565 | | slot_ascii16_map (state, 1); |
| 553 | slot_ascii16_map (machine, state, 1); |
| 566 | 554 | } |
| 567 | 555 | else if (addr >= 0x7000 && addr < 0x7800) { |
| 568 | 556 | state->banks[1] = val & state->bank_mask; |
| 569 | 557 | if (msx1.state[2] == state) { |
| 570 | | slot_ascii16_map (state, 2); |
| 558 | slot_ascii16_map (machine, state, 2); |
| 571 | 559 | } |
| 572 | 560 | } |
| 573 | 561 | } |
| r2823 | r2824 | |
| 626 | 614 | |
| 627 | 615 | MSX_SLOT_MAP(ascii8_sram) |
| 628 | 616 | { |
| 629 | | running_machine *machine = Machine; |
| 630 | 617 | switch (page) { |
| 631 | 618 | case 0: |
| 632 | 619 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r2823 | r2824 | |
| 655 | 642 | |
| 656 | 643 | state->banks[bank] = val; |
| 657 | 644 | if (bank <= 1) { |
| 658 | | slot_ascii8_sram_map (state, 1); |
| 645 | slot_ascii8_sram_map (machine, state, 1); |
| 659 | 646 | } |
| 660 | 647 | else if (msx1.state[2] == state) { |
| 661 | | slot_ascii8_sram_map (state, 2); |
| 648 | slot_ascii8_sram_map (machine, state, 2); |
| 662 | 649 | } |
| 663 | 650 | } |
| 664 | 651 | if (addr >= 0x8000 && addr < 0xc000) { |
| r2823 | r2824 | |
| 778 | 765 | |
| 779 | 766 | MSX_SLOT_MAP(ascii16_sram) |
| 780 | 767 | { |
| 781 | | running_machine *machine = Machine; |
| 782 | 768 | UINT8 *mem; |
| 783 | 769 | |
| 784 | 770 | switch (page) { |
| r2823 | r2824 | |
| 806 | 792 | { |
| 807 | 793 | if (addr >= 0x6000 && addr < 0x6800) { |
| 808 | 794 | state->banks[0] = val; |
| 809 | | slot_ascii16_sram_map (state, 1); |
| 795 | slot_ascii16_sram_map (machine, state, 1); |
| 810 | 796 | } |
| 811 | 797 | else if (addr >= 0x7000 && addr < 0x7800) { |
| 812 | 798 | state->banks[1] = val; |
| 813 | 799 | if (msx1.state[2] == state) { |
| 814 | | slot_ascii16_sram_map (state, 2); |
| 800 | slot_ascii16_sram_map (machine, state, 2); |
| 815 | 801 | } |
| 816 | 802 | } |
| 817 | 803 | else if (addr >= 0x8000 && addr < 0xc000) { |
| r2823 | r2824 | |
| 914 | 900 | |
| 915 | 901 | MSX_SLOT_MAP(rtype) |
| 916 | 902 | { |
| 917 | | running_machine *machine = Machine; |
| 918 | 903 | UINT8 *mem; |
| 919 | 904 | |
| 920 | 905 | switch (page) { |
| r2823 | r2824 | |
| 951 | 936 | } |
| 952 | 937 | state->banks[0] = data; |
| 953 | 938 | if (msx1.state[2] == state) { |
| 954 | | slot_rtype_map (state, 2); |
| 939 | slot_rtype_map (machine, state, 2); |
| 955 | 940 | } |
| 956 | 941 | } |
| 957 | 942 | } |
| r2823 | r2824 | |
| 990 | 975 | |
| 991 | 976 | MSX_SLOT_MAP(gmaster2) |
| 992 | 977 | { |
| 993 | | running_machine *machine = Machine; |
| 994 | 978 | switch (page) { |
| 995 | 979 | case 0: |
| 996 | 980 | case 1: |
| r2823 | r2824 | |
| 1033 | 1017 | val = val & 15; |
| 1034 | 1018 | } |
| 1035 | 1019 | state->banks[1] = val; |
| 1036 | | slot_gmaster2_map (state, 1); |
| 1020 | slot_gmaster2_map (machine, state, 1); |
| 1037 | 1021 | if (msx1.state[0] == state) { |
| 1038 | | slot_gmaster2_map (state, 0); |
| 1022 | slot_gmaster2_map (machine, state, 0); |
| 1039 | 1023 | } |
| 1040 | 1024 | } |
| 1041 | 1025 | else if (addr >= 0x8000 && addr < 0x9000) { |
| r2823 | r2824 | |
| 1046 | 1030 | val = val & 15; |
| 1047 | 1031 | } |
| 1048 | 1032 | state->banks[2] = val; |
| 1049 | | slot_gmaster2_map (state, 2); |
| 1033 | slot_gmaster2_map (machine, state, 2); |
| 1050 | 1034 | if (msx1.state[3] == state) { |
| 1051 | | slot_gmaster2_map (state, 3); |
| 1035 | slot_gmaster2_map (machine, state, 3); |
| 1052 | 1036 | } |
| 1053 | 1037 | } |
| 1054 | 1038 | else if (addr >= 0xa000 && addr < 0xb000) { |
| r2823 | r2824 | |
| 1059 | 1043 | val = val & 15; |
| 1060 | 1044 | } |
| 1061 | 1045 | state->banks[3] = val; |
| 1062 | | slot_gmaster2_map (state, 2); |
| 1046 | slot_gmaster2_map (machine, state, 2); |
| 1063 | 1047 | if (msx1.state[3] == state) { |
| 1064 | | slot_gmaster2_map (state, 3); |
| 1048 | slot_gmaster2_map (machine, state, 3); |
| 1065 | 1049 | } |
| 1066 | 1050 | } |
| 1067 | 1051 | else if (addr >= 0xb000 && addr < 0xc000) { |
| r2823 | r2824 | |
| 1184 | 1168 | |
| 1185 | 1169 | MSX_SLOT_MAP(diskrom) |
| 1186 | 1170 | { |
| 1187 | | running_machine *machine = Machine; |
| 1188 | 1171 | switch (page) { |
| 1189 | 1172 | case 0: |
| 1190 | 1173 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r2823 | r2824 | |
| 1209 | 1192 | |
| 1210 | 1193 | MSX_SLOT_WRITE(diskrom) |
| 1211 | 1194 | { |
| 1212 | | running_machine *machine = Machine; |
| 1213 | | |
| 1214 | 1195 | if (addr >= 0xa000 && addr < 0xc000) { |
| 1215 | 1196 | addr -= 0x4000; |
| 1216 | 1197 | } |
| r2823 | r2824 | |
| 1298 | 1279 | |
| 1299 | 1280 | MSX_SLOT_MAP(diskrom2) |
| 1300 | 1281 | { |
| 1301 | | running_machine *machine = Machine; |
| 1302 | 1282 | switch (page) { |
| 1303 | 1283 | case 0: |
| 1304 | 1284 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r2823 | r2824 | |
| 1322 | 1302 | |
| 1323 | 1303 | MSX_SLOT_WRITE(diskrom2) |
| 1324 | 1304 | { |
| 1325 | | running_machine *machine = Machine; |
| 1326 | | |
| 1327 | 1305 | if (addr >= 0xa000 && addr < 0xc000) { |
| 1328 | 1306 | addr -= 0x4000; |
| 1329 | 1307 | } |
| r2823 | r2824 | |
| 1372 | 1350 | |
| 1373 | 1351 | MSX_SLOT_MAP(synthesizer) |
| 1374 | 1352 | { |
| 1375 | | running_machine *machine = Machine; |
| 1376 | 1353 | switch (page) { |
| 1377 | 1354 | case 0: |
| 1378 | 1355 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r2823 | r2824 | |
| 1424 | 1401 | |
| 1425 | 1402 | MSX_SLOT_MAP(majutsushi) |
| 1426 | 1403 | { |
| 1427 | | running_machine *machine = Machine; |
| 1428 | 1404 | switch (page) { |
| 1429 | 1405 | case 0: |
| 1430 | 1406 | msx_cpu_setbank (machine, 1, state->mem + state->banks[0] * 0x2000); |
| r2823 | r2824 | |
| 1452 | 1428 | } |
| 1453 | 1429 | else if (addr >= 0x6000 && addr < 0x8000) { |
| 1454 | 1430 | state->banks[1] = val & 0x0f; |
| 1455 | | slot_majutsushi_map (state, 1); |
| 1431 | slot_majutsushi_map (machine, state, 1); |
| 1456 | 1432 | if (msx1.state[0] == state) { |
| 1457 | | slot_konami_map (state, 0); |
| 1433 | slot_konami_map (machine, state, 0); |
| 1458 | 1434 | } |
| 1459 | 1435 | } |
| 1460 | 1436 | else if (addr >= 0x8000 && addr < 0xc000) { |
| 1461 | 1437 | state->banks[addr < 0xa000 ? 2 : 3] = val & 0x0f; |
| 1462 | | slot_majutsushi_map (state, 2); |
| 1438 | slot_majutsushi_map (machine, state, 2); |
| 1463 | 1439 | if (msx1.state[3] == state) { |
| 1464 | | slot_konami_map (state, 3); |
| 1440 | slot_konami_map (machine, state, 3); |
| 1465 | 1441 | } |
| 1466 | 1442 | } |
| 1467 | 1443 | } |
| r2823 | r2824 | |
| 1529 | 1505 | |
| 1530 | 1506 | MSX_SLOT_MAP(fmpac) |
| 1531 | 1507 | { |
| 1532 | | running_machine *machine = Machine; |
| 1533 | 1508 | if (page == 1) { |
| 1534 | 1509 | if (state->cart.fmpac.sram_active) { |
| 1535 | 1510 | msx_cpu_setbank (machine, 3, state->cart.fmpac.mem); |
| r2823 | r2824 | |
| 1548 | 1523 | |
| 1549 | 1524 | MSX_SLOT_WRITE(fmpac) |
| 1550 | 1525 | { |
| 1551 | | running_machine *machine = Machine; |
| 1552 | 1526 | int i, data; |
| 1553 | 1527 | |
| 1554 | 1528 | if (addr >= 0x4000 && addr < 0x6000 && state->cart.fmpac.sram_support) { |
| r2823 | r2824 | |
| 1587 | 1561 | case 0x7ff7: |
| 1588 | 1562 | state->banks[0] = val & state->bank_mask; |
| 1589 | 1563 | state->cart.fmpac.mem[0x3ff7] = val & state->bank_mask; |
| 1590 | | slot_fmpac_map (state, 1); |
| 1564 | slot_fmpac_map (machine, state, 1); |
| 1591 | 1565 | break; |
| 1592 | 1566 | } |
| 1593 | 1567 | } |
| r2823 | r2824 | |
| 1685 | 1659 | |
| 1686 | 1660 | MSX_SLOT_MAP(superloadrunner) |
| 1687 | 1661 | { |
| 1688 | | running_machine *machine = Machine; |
| 1689 | 1662 | if (page == 2) { |
| 1690 | 1663 | UINT8 *mem = state->mem + |
| 1691 | 1664 | (msx1.superloadrunner_bank & state->bank_mask) * 0x4000; |
| r2823 | r2824 | |
| 1719 | 1692 | |
| 1720 | 1693 | MSX_SLOT_MAP(crossblaim) |
| 1721 | 1694 | { |
| 1722 | | running_machine *machine = Machine; |
| 1723 | 1695 | UINT8 *mem; |
| 1724 | 1696 | |
| 1725 | 1697 | /* This might look odd, but it's what happens on the real cartridge */ |
| r2823 | r2824 | |
| 1764 | 1736 | state->banks[0] = block; |
| 1765 | 1737 | |
| 1766 | 1738 | if (msx1.state[0] == state) { |
| 1767 | | slot_crossblaim_map (state, 0); |
| 1739 | slot_crossblaim_map (machine, state, 0); |
| 1768 | 1740 | } |
| 1769 | 1741 | if (msx1.state[2] == state) { |
| 1770 | | slot_crossblaim_map (state, 2); |
| 1742 | slot_crossblaim_map (machine, state, 2); |
| 1771 | 1743 | } |
| 1772 | 1744 | if (msx1.state[3] == state) { |
| 1773 | | slot_crossblaim_map (state, 3); |
| 1745 | slot_crossblaim_map (machine, state, 3); |
| 1774 | 1746 | } |
| 1775 | 1747 | } |
| 1776 | 1748 | |
| r2823 | r2824 | |
| 1806 | 1778 | |
| 1807 | 1779 | MSX_SLOT_MAP(korean80in1) |
| 1808 | 1780 | { |
| 1809 | | running_machine *machine = Machine; |
| 1810 | 1781 | switch (page) { |
| 1811 | 1782 | case 0: |
| 1812 | 1783 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r2823 | r2824 | |
| 1835 | 1806 | |
| 1836 | 1807 | state->banks[bank] = val & state->bank_mask; |
| 1837 | 1808 | if (bank <= 1) { |
| 1838 | | slot_korean80in1_map (state, 1); |
| 1809 | slot_korean80in1_map (machine, state, 1); |
| 1839 | 1810 | } |
| 1840 | 1811 | else if (msx1.state[2] == state) { |
| 1841 | | slot_korean80in1_map (state, 2); |
| 1812 | slot_korean80in1_map (machine, state, 2); |
| 1842 | 1813 | } |
| 1843 | 1814 | } |
| 1844 | 1815 | } |
| r2823 | r2824 | |
| 1871 | 1842 | |
| 1872 | 1843 | MSX_SLOT_MAP(korean90in1) |
| 1873 | 1844 | { |
| 1874 | | running_machine *machine = Machine; |
| 1875 | 1845 | UINT8 *mem; |
| 1876 | 1846 | UINT8 mask = (msx1.korean90in1_bank & 0xc0) == 0x80 ? 0x3e : 0x3f; |
| 1877 | 1847 | mem = state->mem + |
| r2823 | r2824 | |
| 1937 | 1907 | |
| 1938 | 1908 | MSX_SLOT_MAP(korean126in1) |
| 1939 | 1909 | { |
| 1940 | | running_machine *machine = Machine; |
| 1941 | 1910 | UINT8 *mem; |
| 1942 | 1911 | |
| 1943 | 1912 | switch (page) { |
| r2823 | r2824 | |
| 1967 | 1936 | int bank = addr & 1; |
| 1968 | 1937 | state->banks[bank] = val & state->bank_mask; |
| 1969 | 1938 | if (bank == 0) { |
| 1970 | | slot_korean126in1_map (state, 1); |
| 1939 | slot_korean126in1_map (machine, state, 1); |
| 1971 | 1940 | } |
| 1972 | 1941 | else if (msx1.state[2] == state) { |
| 1973 | | slot_korean126in1_map (state, 2); |
| 1942 | slot_korean126in1_map (machine, state, 2); |
| 1974 | 1943 | } |
| 1975 | 1944 | } |
| 1976 | 1945 | } |
| r2823 | r2824 | |
| 2060 | 2029 | |
| 2061 | 2030 | MSX_SLOT_MAP(soundcartridge) |
| 2062 | 2031 | { |
| 2063 | | running_machine *machine = Machine; |
| 2064 | 2032 | switch (page) { |
| 2065 | 2033 | case 0: |
| 2066 | 2034 | msx_cpu_setbank (machine, 1, state->mem + state->banks[2] * 0x2000); |
| r2823 | r2824 | |
| 2088 | 2056 | MSX_SLOT_WRITE(soundcartridge) |
| 2089 | 2057 | { |
| 2090 | 2058 | int i; |
| 2091 | | running_machine *machine = Machine; |
| 2092 | 2059 | |
| 2093 | 2060 | if (addr < 0x4000) { |
| 2094 | 2061 | return; |
| r2823 | r2824 | |
| 2100 | 2067 | else if (addr >= 0x5000 && addr < 0x5800) { |
| 2101 | 2068 | state->banks[0] = val & state->bank_mask; |
| 2102 | 2069 | state->cart.sccp.banks_saved[0] = val; |
| 2103 | | slot_soundcartridge_map (state, 1); |
| 2070 | slot_soundcartridge_map (machine, state, 1); |
| 2104 | 2071 | if (msx1.state[3] == state) { |
| 2105 | | slot_soundcartridge_map (state, 3); |
| 2072 | slot_soundcartridge_map (machine, state, 3); |
| 2106 | 2073 | } |
| 2107 | 2074 | } |
| 2108 | 2075 | } |
| r2823 | r2824 | |
| 2114 | 2081 | state->banks[1] = val & state->bank_mask; |
| 2115 | 2082 | state->cart.sccp.banks_saved[1] = val; |
| 2116 | 2083 | if (msx1.state[3] == state) { |
| 2117 | | slot_soundcartridge_map (state, 3); |
| 2084 | slot_soundcartridge_map (machine, state, 3); |
| 2118 | 2085 | } |
| 2119 | | slot_soundcartridge_map (state, 1); |
| 2086 | slot_soundcartridge_map (machine, state, 1); |
| 2120 | 2087 | } |
| 2121 | 2088 | } |
| 2122 | 2089 | else if (addr < 0xa000) { |
| r2823 | r2824 | |
| 2129 | 2096 | state->cart.sccp.scc_active = |
| 2130 | 2097 | (((val & 0x3f) == 0x3f) && !(state->cart.sccp.mode & 0x20)); |
| 2131 | 2098 | |
| 2132 | | slot_soundcartridge_map (state, 2); |
| 2099 | slot_soundcartridge_map (machine, state, 2); |
| 2133 | 2100 | if (msx1.state[0] == state) { |
| 2134 | | slot_soundcartridge_map (state, 0); |
| 2101 | slot_soundcartridge_map (machine, state, 0); |
| 2135 | 2102 | } |
| 2136 | 2103 | } |
| 2137 | 2104 | else if (addr >= 0x9800 && state->cart.sccp.scc_active) { |
| r2823 | r2824 | |
| 2169 | 2136 | state->banks[3] = val & state->bank_mask; |
| 2170 | 2137 | state->cart.sccp.sccp_active = |
| 2171 | 2138 | (val & 0x80) && (state->cart.sccp.mode & 0x20); |
| 2172 | | slot_soundcartridge_map (state, 2); |
| 2139 | slot_soundcartridge_map (machine, state, 2); |
| 2173 | 2140 | if (msx1.state[0] == state) { |
| 2174 | | slot_soundcartridge_map (state, 0); |
| 2141 | slot_soundcartridge_map (machine, state, 0); |
| 2175 | 2142 | } |
| 2176 | 2143 | } |
| 2177 | 2144 | else if (addr >= 0xb800 && state->cart.sccp.sccp_active) { |
| r2823 | r2824 | |
| 2228 | 2195 | state->cart.sccp.sccp_active = |
| 2229 | 2196 | ((state->cart.sccp.banks_saved[3] & 0x80) && (val & 0x20)); |
| 2230 | 2197 | |
| 2231 | | slot_soundcartridge_map (state, 2); |
| 2198 | slot_soundcartridge_map (machine, state, 2); |
| 2232 | 2199 | } |
| 2233 | 2200 | } |
| 2234 | 2201 | |
src/mess/machine/msx.c
| r2823 | r2824 | |
| 284 | 284 | static void msx_ch_reset_core (running_machine *machine) |
| 285 | 285 | { |
| 286 | 286 | msx_memory_reset (machine); |
| 287 | | msx_memory_map_all (); |
| 287 | msx_memory_map_all (machine); |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | static const TMS9928a_interface tms9928a_interface = |
| r2823 | r2824 | |
| 699 | 699 | |
| 700 | 700 | if (VERBOSE) |
| 701 | 701 | logerror ("write to primary slot select: %02x\n", msx1.primary_slot); |
| 702 | | msx_memory_map_all (); |
| 702 | msx_memory_map_all (machine); |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | static WRITE8_HANDLER ( msx_ppi_port_c_w ) |
| r2823 | r2824 | |
| 932 | 932 | } |
| 933 | 933 | } |
| 934 | 934 | |
| 935 | | void msx_memory_map_page (int page) |
| 935 | void msx_memory_map_page (running_machine *machine, int page) |
| 936 | 936 | { |
| 937 | 937 | int slot_primary; |
| 938 | 938 | int slot_secondary; |
| r2823 | r2824 | |
| 952 | 952 | logerror ("mapping %s in %d/%d/%d\n", slot->name, slot_primary, |
| 953 | 953 | slot_secondary, page); |
| 954 | 954 | } |
| 955 | | slot->map (state, page); |
| 955 | slot->map (machine, state, page); |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | | void msx_memory_map_all (void) |
| 958 | void msx_memory_map_all (running_machine *machine) |
| 959 | 959 | { |
| 960 | 960 | int i; |
| 961 | 961 | |
| 962 | 962 | for (i=0; i<4; i++) { |
| 963 | | msx_memory_map_page (i); |
| 963 | msx_memory_map_page (machine, i); |
| 964 | 964 | } |
| 965 | 965 | } |
| 966 | 966 | |
| r2823 | r2824 | |
| 968 | 968 | { |
| 969 | 969 | msx1.superloadrunner_bank = data; |
| 970 | 970 | if (msx1.slot[2]->slot_type == SLOT_SUPERLOADRUNNER) { |
| 971 | | msx1.slot[2]->map (msx1.state[2], 2); |
| 971 | msx1.slot[2]->map (machine, msx1.state[2], 2); |
| 972 | 972 | } |
| 973 | 973 | msx_page0_w(machine, -1, data); |
| 974 | 974 | } |
| r2823 | r2824 | |
| 982 | 982 | msx1.ram_pages[0][offset] = data; |
| 983 | 983 | break; |
| 984 | 984 | case MSX_MEM_HANDLER: |
| 985 | | msx1.slot[0]->write (msx1.state[0], offset, data); |
| 985 | msx1.slot[0]->write (machine, msx1.state[0], offset, data); |
| 986 | 986 | } |
| 987 | 987 | } |
| 988 | 988 | |
| r2823 | r2824 | |
| 993 | 993 | msx1.ram_pages[1][offset] = data; |
| 994 | 994 | break; |
| 995 | 995 | case MSX_MEM_HANDLER: |
| 996 | | msx1.slot[1]->write (msx1.state[1], 0x4000 + offset, data); |
| 996 | msx1.slot[1]->write (machine, msx1.state[1], 0x4000 + offset, data); |
| 997 | 997 | } |
| 998 | 998 | } |
| 999 | 999 | |
| r2823 | r2824 | |
| 1004 | 1004 | msx1.ram_pages[2][offset] = data; |
| 1005 | 1005 | break; |
| 1006 | 1006 | case MSX_MEM_HANDLER: |
| 1007 | | msx1.slot[2]->write (msx1.state[2], 0x8000 + offset, data); |
| 1007 | msx1.slot[2]->write (machine, msx1.state[2], 0x8000 + offset, data); |
| 1008 | 1008 | } |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| r2823 | r2824 | |
| 1015 | 1015 | msx1.ram_pages[3][offset] = data; |
| 1016 | 1016 | break; |
| 1017 | 1017 | case MSX_MEM_HANDLER: |
| 1018 | | msx1.slot[3]->write (msx1.state[3], 0xc000 + offset, data); |
| 1018 | msx1.slot[3]->write (machine, msx1.state[3], 0xc000 + offset, data); |
| 1019 | 1019 | } |
| 1020 | 1020 | } |
| 1021 | 1021 | |
| r2823 | r2824 | |
| 1028 | 1028 | logerror ("write to secondary slot %d select: %02x\n", slot, data); |
| 1029 | 1029 | |
| 1030 | 1030 | msx1.secondary_slot[slot] = data; |
| 1031 | | msx_memory_map_all (); |
| 1031 | msx_memory_map_all (machine); |
| 1032 | 1032 | } |
| 1033 | 1033 | else { |
| 1034 | 1034 | msx_page3_w(machine, 0x3fff, data); |
| r2823 | r2824 | |
| 1052 | 1052 | { |
| 1053 | 1053 | msx1.ram_mapper[offset] = data; |
| 1054 | 1054 | if (msx1.slot[offset]->slot_type == SLOT_RAM_MM) { |
| 1055 | | msx1.slot[offset]->map (msx1.state[offset], offset); |
| 1055 | msx1.slot[offset]->map (machine, msx1.state[offset], offset); |
| 1056 | 1056 | } |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| r2823 | r2824 | |
| 1066 | 1066 | msx1.korean90in1_bank = data; |
| 1067 | 1067 | if (msx1.slot[1]->slot_type == SLOT_KOREAN_90IN1) |
| 1068 | 1068 | { |
| 1069 | | msx1.slot[1]->map (msx1.state[1], 1); |
| 1069 | msx1.slot[1]->map (machine, msx1.state[1], 1); |
| 1070 | 1070 | } |
| 1071 | 1071 | if (msx1.slot[2]->slot_type == SLOT_KOREAN_90IN1) |
| 1072 | 1072 | { |
| 1073 | | msx1.slot[2]->map (msx1.state[2], 2); |
| 1073 | msx1.slot[2]->map (machine, msx1.state[2], 2); |
| 1074 | 1074 | } |
| 1075 | 1075 | } |
| 1076 | 1076 | |