src/mess/machine/genesis.c
| r9277 | r9278 | |
| 8 | 8 | |
| 9 | 9 | game name | SDA_IN | SDA_OUT | SCL | SIZE_MASK | PAGE_MASK | |
| 10 | 10 | ----------------------------------|------------|------------|------------|----------------|-----------| |
| 11 | | NBA Jam | 0x200001-0 | 0x200001-0*| 0x200000-1*| 0x00ff (24C02) | 0x03 | x |
| 12 | | NBA Jam TE | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x00ff (24C02) | 0x03 | x |
| 11 | NBA Jam | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x00ff (24C02) | 0x03 | xx |
| 12 | NBA Jam TE | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x00ff (24C02) | 0x03 | xx |
| 13 | 13 | NBA Jam TE (32x) | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x00ff (24C02) | 0x03 | |
| 14 | | NFL Quarterback Club | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x00ff (24C02) | 0x03 | x |
| 15 | | NFL Quarterback Club 96 | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x07ff (24C16) | 0x07 | x |
| 16 | | College Slam | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x1fff (24C64) | 0x07 | |
| 17 | | Frank Thomas Big Hurt Baseball | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x1fff (24C64) | 0x07 | |
| 18 | | NHLPA Hockey 93 | 0x200001-7 | 0x200001-7 | 0x200001-6 | 0x007f (24C01) | 0x03 | |
| 19 | | Rings of Power | 0x200001-7 | 0x200001-7 | 0x200001-6 | 0x007f (24C01) | 0x03 | |
| 20 | | Evander Holyfield's Boxing | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x007f (24C01) | 0x03 | |
| 21 | | Greatest Heavyweights of the Ring | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x007f (24C01) | 0x03 | |
| 22 | | Wonder Boy V | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x007f (24C01) | 0x03 | |
| 23 | | Sports Talk Baseball | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x007f (24C01) | 0x03 | |
| 24 | | Megaman - the Wily Wars | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x007f (24C01) | 0x03 | ** |
| 25 | | Micro Machines 2 | 0x300000-0 | 0x380001-7 | 0x300000-1 | 0x03ff (24C08) | 0x0f | |
| 26 | | Micro Machines Military | 0x300000-0 | 0x380001-7 | 0x300000-1 | 0x03ff (24C08) | 0x0f | |
| 27 | | Micro Machines 96 | 0x300000-0 | 0x380001-7 | 0x300000-1 | 0x07ff (24C16) | 0x0f | |
| 28 | | Brian Lara Cricket 96 | 0x300000-0 | 0x380001-7 | 0x300000-1 | 0x1fff (24C64) | 0x??* | |
| 14 | NFL Quarterback Club | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x00ff (24C02) | 0x03 | xx |
| 15 | NFL Quarterback Club 96 | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x07ff (24C16) | 0x07 | xx |
| 16 | College Slam | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x1fff (24C64) | 0x07 | xx |
| 17 | Frank Thomas Big Hurt Baseball | 0x200001-0 | 0x200001-0 | 0x200000-0 | 0x1fff (24C64) | 0x07 | xx |
| 18 | NHLPA Hockey 93 | 0x200001-7 | 0x200001-7 | 0x200001-6 | 0x007f (24C01) | 0x03 | xx |
| 19 | Rings of Power | 0x200001-7 | 0x200001-7 | 0x200001-6 | 0x007f (24C01) | 0x03 | xx |
| 20 | Evander Holyfield's Boxing | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x007f (24C01) | 0x03 | xx |
| 21 | Greatest Heavyweights of the Ring | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x007f (24C01) | 0x03 | xx |
| 22 | Wonder Boy V | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x007f (24C01) | 0x03 | xx |
| 23 | Sports Talk Baseball | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x007f (24C01) | 0x03 | xx |
| 24 | Megaman - the Wily Wars | 0x200001-0 | 0x200001-0 | 0x200001-1 | 0x007f (24C01) | 0x03 | xx ** |
| 25 | Micro Machines 2 | 0x380001-7 | 0x300000-0*| 0x300000-1*| 0x03ff (24C08) | 0x0f | |
| 26 | Micro Machines Military | 0x380001-7 | 0x300000-0*| 0x300000-1*| 0x03ff (24C08) | 0x0f | |
| 27 | Micro Machines 96 | 0x380001-7 | 0x300000-0*| 0x300000-1*| 0x07ff (24C16) | 0x0f | |
| 28 | Brian Lara Cricket 96 | 0x380001-7 | 0x300000-0*| 0x300000-1*| 0x1fff (24C64) | 0x??* | |
| 29 | 29 | ----------------------------------|------------|------------|------------|----------------|-----------| |
| 30 | 30 | |
| 31 | 31 | * Notes: check these |
| r9277 | r9278 | |
| 60 | 60 | enum t_cart_type |
| 61 | 61 | { |
| 62 | 62 | STANDARD = 0, |
| 63 | | NBA_JAM, /* NBA Jam */ |
| 64 | | NBA_JAM_TE, /* NBA Jam TE / NFL Quarterback Club */ |
| 65 | | NFL_QB_96, /* NFL Quarterback Club '96 */ |
| 66 | | |
| 67 | 63 | SSF2, /* Super Street Fighter 2 */ |
| 68 | 64 | LIONK3, /* Lion King 3 */ |
| 69 | 65 | SKINGKONG, /* Super King Kong 99 */ |
| r9277 | r9278 | |
| 88 | 84 | KOF98, /* King of Fighters '98 */ |
| 89 | 85 | REALTEC, /* Whac a Critter/Mallet legend, Defend the Earth, Funnyworld/Ballonboy */ |
| 90 | 86 | SUP19IN1, /* Super 19 in 1 */ |
| 91 | | SUP15IN1 /* Super 15 in 1 */ |
| 87 | SUP15IN1, /* Super 15 in 1 */ |
| 88 | NBA_JAM, /* NBA Jam */ |
| 89 | NBA_JAM_TE, /* NBA Jam TE / NFL Quarterback Club */ |
| 90 | NFL_QB_96, /* NFL Quarterback Club '96 */ |
| 91 | C_SLAM, /* College Slam / Frank Thomas Big Hurt Baseball */ |
| 92 | EA_NHLPA, /* NHLPA Hockey 93 / Rings of Power */ |
| 93 | WBOY_V, /* Wonder Boy V / Evander Holyfield's Boxing / Greatest Heavyweights of the Ring / Sports Talk Baseball / Megaman */ |
| 94 | CODE_MASTERS /* Micro Machines 2 / Military / 96 / Brian Lara Cricket */ |
| 92 | 95 | }; |
| 93 | 96 | |
| 94 | 97 | |
| r9277 | r9278 | |
| 665 | 668 | install_sram_rw_handlers (space->machine); |
| 666 | 669 | } |
| 667 | 670 | |
| 671 | /* |
| 672 | I2c bare minimum handlings (TODO: supports proper device interfacing and parameter change!) |
| 673 | */ |
| 668 | 674 | |
| 675 | static UINT8 i2c_mem,i2c_clk; |
| 669 | 676 | |
| 677 | static READ16_HANDLER( nba_jam_eeprom_r ) |
| 678 | { |
| 679 | // i2c_mem = (i2cmem_sda_read(space->machine->device("i2cmem")) & 1); |
| 680 | |
| 681 | return i2c_mem & 1; |
| 682 | } |
| 683 | |
| 684 | static WRITE16_HANDLER( nba_jam_eeprom_w ) |
| 685 | { |
| 686 | i2c_clk = (data & 0x0002) >> 1; |
| 687 | i2c_mem = (data & 0x0001); |
| 688 | |
| 689 | // i2cmem_sda_write(space->machine->device("i2cmem"), i2c_clk); |
| 690 | // i2cmem_scl_write(space->machine->device("i2cmem"), i2c_mem); |
| 691 | } |
| 692 | |
| 693 | static READ16_HANDLER( nba_jam_te_eeprom_r ) |
| 694 | { |
| 695 | // i2c_mem = (i2cmem_sda_read(space->machine->device("i2cmem")) & 1); |
| 696 | |
| 697 | return (i2c_mem & 1); |
| 698 | } |
| 699 | |
| 700 | static WRITE16_HANDLER( nba_jam_te_eeprom_w ) |
| 701 | { |
| 702 | i2c_clk = ((data & 0x0100) >> 8); |
| 703 | i2c_mem = data & 0x0001; |
| 704 | |
| 705 | // i2cmem_sda_write(space->machine->device("i2cmem"), i2c_clk); |
| 706 | // i2cmem_scl_write(space->machine->device("i2cmem"), i2c_mem); |
| 707 | } |
| 708 | |
| 709 | static READ16_HANDLER( ea_nhlpa_eeprom_r ) |
| 710 | { |
| 711 | // i2c_mem = (i2cmem_sda_read(space->machine->device("i2cmem")) & 1); |
| 712 | |
| 713 | return (i2c_mem & 1) << 7; |
| 714 | } |
| 715 | |
| 716 | static WRITE16_HANDLER( ea_nhlpa_eeprom_w ) |
| 717 | { |
| 718 | i2c_clk = ((data & 0x0040) >> 6); |
| 719 | i2c_mem = ((data & 0x0080) >> 7); |
| 720 | |
| 721 | // i2cmem_sda_write(space->machine->device("i2cmem"), i2c_clk); |
| 722 | // i2cmem_scl_write(space->machine->device("i2cmem"), i2c_mem); |
| 723 | } |
| 724 | |
| 725 | /* TODO: identical as NBA Jam, used as kludge */ |
| 726 | static READ16_HANDLER( wboy_v_eeprom_r ) |
| 727 | { |
| 728 | // i2c_mem = (i2cmem_sda_read(space->machine->device("i2cmem")) & 1); |
| 729 | |
| 730 | return ~i2c_mem & 1; |
| 731 | } |
| 732 | |
| 733 | static WRITE16_HANDLER( wboy_v_eeprom_w ) |
| 734 | { |
| 735 | i2c_clk = (data & 0x0002) >> 1; |
| 736 | i2c_mem = (data & 0x0001); |
| 737 | |
| 738 | // i2cmem_sda_write(space->machine->device("i2cmem"), i2c_clk); |
| 739 | // i2cmem_scl_write(space->machine->device("i2cmem"), i2c_mem); |
| 740 | } |
| 741 | |
| 742 | static READ16_HANDLER( codemasters_eeprom_r ) |
| 743 | { |
| 744 | // i2c_mem = (i2cmem_sda_read(space->machine->device("i2cmem")) & 1); |
| 745 | |
| 746 | return (i2c_mem & 1) << 7; |
| 747 | } |
| 748 | |
| 749 | static WRITE16_HANDLER( codemasters_eeprom_w ) |
| 750 | { |
| 751 | i2c_clk = (data & 0x0200) >> 9; |
| 752 | i2c_mem = (data & 0x0100) >> 8; |
| 753 | |
| 754 | // i2cmem_sda_write(space->machine->device("i2cmem"), i2c_clk); |
| 755 | // i2cmem_scl_write(space->machine->device("i2cmem"), i2c_mem); |
| 756 | } |
| 757 | |
| 670 | 758 | /************************************* |
| 671 | 759 | * |
| 672 | 760 | * Machine driver reset |
| r9277 | r9278 | |
| 903 | 991 | install_sram_rw_handlers (machine); |
| 904 | 992 | } |
| 905 | 993 | |
| 994 | /* install i2c handlers */ |
| 995 | if(cart_type == NBA_JAM) |
| 996 | memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x200000, 0x200001, 0, 0, nba_jam_eeprom_r,nba_jam_eeprom_w); |
| 997 | |
| 998 | if(cart_type == WBOY_V) |
| 999 | memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x200000, 0x200001, 0, 0, wboy_v_eeprom_r,wboy_v_eeprom_w); |
| 1000 | |
| 1001 | if(cart_type == NBA_JAM_TE || cart_type == NFL_QB_96 || cart_type == C_SLAM) // same handling but different sizes |
| 1002 | memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x200000, 0x200001, 0, 0, nba_jam_te_eeprom_r,nba_jam_te_eeprom_w); |
| 1003 | |
| 1004 | if(cart_type == EA_NHLPA) |
| 1005 | memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x200000, 0x200001, 0, 0, ea_nhlpa_eeprom_r,ea_nhlpa_eeprom_w); |
| 1006 | |
| 1007 | if(cart_type == CODE_MASTERS) |
| 1008 | { |
| 1009 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x300000, 0x300001, 0, 0, codemasters_eeprom_w); |
| 1010 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x380000, 0x380001, 0, 0, codemasters_eeprom_r); |
| 1011 | |
| 1012 | // TODO: J-Cart device |
| 1013 | } |
| 1014 | |
| 906 | 1015 | /* install NOP handler for TMSS */ |
| 907 | 1016 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa14000, 0xa14003, 0, 0, genesis_TMSS_bank_w); |
| 908 | 1017 | } |
| r9277 | r9278 | |
| 1156 | 1265 | kof99_sig[] = { 0x20, 0x3c, 0x30, 0x00, 0x00, 0xa1 }, // move.l #$300000A1,d0 |
| 1157 | 1266 | radica_sig[] = { 0x4e, 0xd0, 0x30, 0x39, 0x00, 0xa1 }, // jmp (a0) move.w ($a130xx),d0 |
| 1158 | 1267 | soulb_sig[] = { 0x33, 0xfc, 0x00, 0x0c, 0x00, 0xff }, // move.w #$C,($FF020A).l (what happens if check fails) |
| 1159 | | s19in1_sig[] = { 0x13, 0xc0, 0x00, 0xa1, 0x30, 0x38 }; |
| 1268 | s19in1_sig[] = { 0x13, 0xc0, 0x00, 0xa1, 0x30, 0x38 }, |
| 1269 | rockman_sig[] = { 0xea, 0x80 }; |
| 1160 | 1270 | |
| 1161 | | //printf("%08x\n",genesis_last_loaded_image_length); |
| 1162 | | |
| 1163 | 1271 | switch (genesis_last_loaded_image_length) |
| 1164 | 1272 | { |
| 1165 | 1273 | case 0x80000: |
| r9277 | r9278 | |
| 1170 | 1278 | !allendianmemcmp((char *)&ROM[0x7e100], "SEGA", 4) || |
| 1171 | 1279 | !allendianmemcmp((char *)&ROM[0x7e1e6], "SEGA", 4)) |
| 1172 | 1280 | cart_type = REALTEC; |
| 1281 | |
| 1282 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-50396", 10)) // NHLPA Hockey 93 |
| 1283 | cart_type = EA_NHLPA; |
| 1284 | |
| 1285 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM MK-1215", 10)) // Evander Holyfield |
| 1286 | cart_type = WBOY_V; |
| 1287 | |
| 1173 | 1288 | break; |
| 1174 | 1289 | |
| 1290 | case 0xc0000: |
| 1291 | |
| 1292 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM G-4060 ", 8)) // Wonder Boy V |
| 1293 | cart_type = WBOY_V; |
| 1294 | |
| 1295 | break; |
| 1296 | |
| 1175 | 1297 | case 0x100000: |
| 1176 | 1298 | if (!allendianmemcmp(&ROM[0x01b24], &mjlover_sig[0], sizeof(mjlover_sig))) |
| 1177 | 1299 | cart_type = MJLOVER; |
| r9277 | r9278 | |
| 1187 | 1309 | |
| 1188 | 1310 | if (!allendianmemcmp(&ROM[0x123e4], &sbub_sig[0], sizeof(sbub_sig))) |
| 1189 | 1311 | cart_type = SBUBBOB; |
| 1312 | |
| 1313 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-50176", 10)) // Rings of Power |
| 1314 | cart_type = EA_NHLPA; |
| 1315 | |
| 1316 | if (!allendianmemcmp((char *)&ROM[0x0180], "MK 00001211-00", 14)) // Sports Talk Baseball |
| 1317 | cart_type = WBOY_V; |
| 1318 | |
| 1319 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-120096-", 12)) // Micro Machines 2 |
| 1320 | cart_type = CODE_MASTERS; |
| 1321 | |
| 1322 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-120146-", 12)) // Brian Lara Cricket 96 / Shane Wayne Cricket 96 |
| 1323 | cart_type = CODE_MASTERS; |
| 1324 | |
| 1325 | if (!allendianmemcmp((char *)&ROM[0x0190], "OJKRPTBVFCA ", 0x10)) // Micro Machines '96 / Military TODO: better way to recognize these? |
| 1326 | cart_type = CODE_MASTERS; |
| 1190 | 1327 | break; |
| 1191 | 1328 | |
| 1192 | 1329 | case 0x200000: |
| r9277 | r9278 | |
| 1223 | 1360 | if (!allendianmemcmp(&ROM[0x17bb2], &s15in1_sig[0], sizeof(s15in1_sig))) |
| 1224 | 1361 | cart_type = SUP15IN1; |
| 1225 | 1362 | |
| 1226 | | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-081326", 11)) // NBA Jam |
| 1363 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-081326 ", 12)) // NBA Jam |
| 1227 | 1364 | cart_type = NBA_JAM; |
| 1228 | 1365 | |
| 1366 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM MK-1228", 10)) // Greatest Heavyweight of the Ring |
| 1367 | cart_type = WBOY_V; |
| 1368 | |
| 1369 | if ((!allendianmemcmp((char *)&ROM[0x0180], "GM T-12046", 10)) || // Mega Man |
| 1370 | (!allendianmemcmp((char *)&ROM[0x0180], "GM T-12053", 10) && !allendianmemcmp(&ROM[0x18e], &rockman_sig[0], sizeof(rockman_sig)))) // / Rock Man (EEPROM version) |
| 1371 | cart_type = WBOY_V; |
| 1372 | |
| 1229 | 1373 | break; |
| 1230 | 1374 | |
| 1231 | 1375 | case 0x200005: |
| r9277 | r9278 | |
| 1243 | 1387 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-81406", 10)) // NBA Jam TE |
| 1244 | 1388 | cart_type = NBA_JAM_TE; |
| 1245 | 1389 | |
| 1246 | | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-81276", 10)) // NFL Quarterback Club |
| 1390 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-081276 ", 12)) // NFL Quarterback Club |
| 1247 | 1391 | cart_type = NBA_JAM_TE; |
| 1248 | 1392 | |
| 1249 | 1393 | break; |
| r9277 | r9278 | |
| 1259 | 1403 | if (!allendianmemcmp(&ROM[0x1e700], &s19in1_sig[0], sizeof(s19in1_sig))) |
| 1260 | 1404 | cart_type = SUP19IN1; |
| 1261 | 1405 | |
| 1262 | | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-81586", 10)) // NFL Quarterback Club 96 |
| 1406 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-081586-", 12)) // NFL Quarterback Club 96 |
| 1263 | 1407 | cart_type = NFL_QB_96; |
| 1408 | |
| 1409 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-081576 ", 12)) // College Slam |
| 1410 | cart_type = C_SLAM; |
| 1411 | |
| 1412 | if (!allendianmemcmp((char *)&ROM[0x0180], "GM T-81476", 10)) // Big Hurt Baseball |
| 1413 | cart_type = C_SLAM; |
| 1414 | |
| 1264 | 1415 | break; |
| 1265 | 1416 | |
| 1266 | 1417 | case 0x500000: |
| r9277 | r9278 | |
| 1322 | 1473 | backup RAM, but only if the value is 0xFFFF, to not break MLBPA Sports |
| 1323 | 1474 | Talk Baseball. With this hack some games at least run (NBA Jam, Evander |
| 1324 | 1475 | Holyfield's Real Deal Boxing, Greatest Heavyweights of the Ring) */ |
| 1325 | | if (has_serial_eeprom && megadriv_backupram[0] == 0xffff) |
| 1326 | | megadriv_backupram[0] = 0xff00; |
| 1476 | //if (has_serial_eeprom && megadriv_backupram[0] == 0xffff) |
| 1477 | // megadriv_backupram[0] = 0xff00; |
| 1327 | 1478 | |
| 1328 | 1479 | if (sram_detected) |
| 1329 | 1480 | logerror("SRAM detected from header: starting location %X - SRAM Length %X\n", genesis_sram_start, genesis_sram_end - genesis_sram_start + 1); |
| r9277 | r9278 | |
| 1385 | 1536 | |
| 1386 | 1537 | auto_free(image.device().machine, temp_copy); |
| 1387 | 1538 | |
| 1539 | cart_type = NBA_JAM_TE; |
| 1540 | |
| 1388 | 1541 | return IMAGE_INIT_PASS; |
| 1389 | 1542 | } |
| 1390 | 1543 | |