Previous 199869 Revisions Next

r31502 Sunday 3rd August, 2014 at 22:16:08 UTC by David Haywood
improve Funny Strip / Puck People protection simulation [iq_132]
[src/mame/drivers]splash.c
[src/mame/includes]splash.h

trunk/src/mame/drivers/splash.c
r31501r31502
438438   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
439439
440440   PORT_START("SYSTEM")
441   PORT_DIPNAME( 0xffff, 0xffff, "Clear EEPROM" )
441   PORT_DIPNAME( 0xffff, 0x0000, "Clear EEPROM" )
442442   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
443443   PORT_DIPSETTING(    0xffff, DEF_STR( On ) )
444444
r31501r31502
10161016
10171017
10181018
1019DRIVER_INIT_MEMBER(splash_state,funystrp)
1019
1020READ16_MEMBER(splash_state::funystrp_protection_r)
10201021{
1021   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
1022   int pc = space.device().safe_pc();
10221023
1023   m_bitmap_type = 0;
1024   m_sprite_attr2_shift = 0;
1024   int ofst = offset+(0x100000/2);
10251025
1026   // initial protection checks, just after boot
1026//   logerror ("PROTR: %5.5x, pc: %5.5x\n", ofst*2, pc);
10271027
1028   ROM[0x04770/2] = 0x4e71;
1029   ROM[0x04772/2] = 0x4e71;
1028   // don't interfere with ram check.
1029   if (pc == 0x04770) return 0x00;
1030   if (pc == 0x04788) return 0x55;
10301031
1031   // temporary solution - work in progress - will be turned into proper r/w handlers
1032   // protection write -> read -> compare tests
1033   // not all of them should always pass ( especially the ones that compares data read with ram variable )
1034   // side effect of the above is broken (sometimes) sound
1035   // there's stil problem with  (broken) gameplay = sometimes one (or more) dot is moved
1036   // out of playfield (and placed on right part of screen ) and there's no way to complete the level
1037   // game reads sprite coords directly from sprite ram and checks distance between player and each(!) dot or
1038   // game object every frame
1039   // most of the patched protection checks are very similar. when test fails, dot counter is altered.
1040   // sometimes it's increased = level is impossible to complete, sometimes - cleared (and level ends
1041   // immediately).
1032   switch (ofst)
1033   {
1034      //-----------------------------------------------------------------
1035      // sub $7ACC, $C7EE, subtractions, original value from 68k
10421036
1043   ROM[0x07b30/2] = 0x7001;
1044   ROM[0x07ec6/2] = 0x7001;
1045   ROM[0x07fbe/2] = 0x7001;
1046   ROM[0x08060/2] = 0x7001;
1047   ROM[0x08576/2] = 0x7001;
1048   ROM[0x08948/2] = 0x7001;
1049   ROM[0x09e16/2] = 0x7001;
1050   ROM[0x0a994/2] = 0x7001;
1051   ROM[0x0c648/2] = 0x7001;
1052   ROM[0x0c852/2] = 0x7001;
1053   ROM[0x0dc22/2] = 0x7001;
1054   ROM[0x0f780/2] = 0x7001;
1055   ROM[0x0f882/2] = 0x7001;
1056   ROM[0x11032/2] = 0x7001;
1057   ROM[0x11730/2] = 0x7001;
1058   ROM[0x11f80/2] = 0x7001;
1037      case ((0x107001 / 2) + 0x0030): // $7ACE
1038         funystrp_val = funystrp_ff3cc7_val & 0x7f;
1039         return 0;
10591040
1060   ROM = (UINT16 *)memregion("audiocpu")->base();
1041      case ((0x107001 / 2) + 0x013e): // $7AFC
1042         return (funystrp_val + 0x13) & 0xff;
10611043
1044      case ((0x107001 / 2) + 0x0279): // $7B38
1045         return (funystrp_val + 0x22) & 0xff;
1046
1047      case ((0x107001 / 2) + 0x0357): // $7B6E
1048         return (funystrp_val + 0x44) & 0xff;
1049
1050      case ((0x107001 / 2) + 0x03b1): // $7BA4
1051         return (funystrp_val + 0x6a) & 0xff;
1052
1053      //-----------------------------------------------------------------
1054      // sub $7E76, subtractions, original value from protection device
1055
1056      case ((0x110001 / 2) + 0x0013): // $7E80
1057         funystrp_val = 0;
1058         return 0;
1059
1060      case ((0x110001 / 2) + 0x0125): // $7E96
1061         return (funystrp_val + 0x03) & 0xff;
1062
1063      case ((0x110001 / 2) + 0x0261): // $7ECE
1064         return (funystrp_val + 0x08) & 0xff;
1065
1066      case ((0x110001 / 2) + 0x0322): // $7F00
1067         return (funystrp_val + 0x12) & 0xff;
1068
1069      case ((0x110001 / 2) + 0x039b): // $7F36
1070         return (funystrp_val + 0x70) & 0xff;
1071
1072      //-----------------------------------------------------------------
1073      // sub $7F70, $8038, $116E2, no subtractions, straight compare!, original value from 68k
1074      // increase ff3cc8 value in sub $116e2
1075   
1076      case ((0x100001 / 2) + 0x0010): // $7F72
1077         funystrp_val = funystrp_ff3cc8_val;
1078         return 0;
1079
1080      case ((0x100001 / 2) + 0x0123): // $7F9A
1081         return (funystrp_val + 0x00) & 0xff;
1082
1083      case ((0x100001 / 2) + 0x0257): // $7FC4
1084         return (funystrp_val + 0x00) & 0xff;
1085
1086      case ((0x100001 / 2) + 0x0312): // $7FEA
1087         return (funystrp_val + 0x00) & 0xff;
1088
1089      case ((0x100001 / 2) + 0x0395): // $8010
1090         // increment $ff3cc8 in $117A8
1091         return (funystrp_val + 0x00) & 0xff;
1092
1093      //-----------------------------------------------------------------
1094      // sub $8522, subtractions, original value from protection device, weird cases
1095
1096      case ((0x104801 / 2) + 0x013A): // $8524
1097         funystrp_val = 0;
1098         return 0;
1099
1100      // this and above usually swapped... fooling the lazy bootlegger?
1101      case ((0x104801 / 2) + 0x0017): // $8542
1102         return (funystrp_val + 0x12) & 0xff;
1103
1104      // first case... weird?
1105   //   case ((0x104801 / 2) + 0x013A): // $857E
1106   //      return (funystrp_val + 0x00) & 0xff;
1107
1108      case ((0x104801 / 2) + 0x0277): // $85A4
1109         return (funystrp_val + 0x04) & 0xff;
1110
1111      case ((0x104801 / 2) + 0x034b): // $85D6
1112         return (funystrp_val + 0x37) & 0xff;
1113
1114      case ((0x104801 / 2) + 0x03ac): // $860E
1115         return (funystrp_val + 0x77) & 0xff;
1116
1117      //-----------------------------------------------------------------
1118      // sub $88F8, subtractions, original value from protection device
1119      // verified as working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1120
1121      case ((0x127001 / 2) + 0x0045): // $88FA
1122         funystrp_val = 0;
1123         return 0;
1124
1125      case ((0x127001 / 2) + 0x0145): // $8918
1126         return (funystrp_val + 0x01) & 0xff;
1127
1128      case ((0x127001 / 2) + 0x028B): // $894A
1129         return (funystrp_val + 0x02) & 0xff;
1130
1131      case ((0x127001 / 2) + 0x0363): // $8982
1132         return (funystrp_val + 0x03) & 0xff;
1133
1134      case ((0x127001 / 2) + 0x03BA): // $89B4
1135         return (funystrp_val + 0x00) & 0xff;
1136
1137      //-----------------------------------------------------------------
1138      // sub $9DD2, subtractions, original value from protection device
1139   
1140      case ((0x170001 / 2) + 0x006B): // $9DD4
1141         funystrp_val = 0;
1142         return 0;
1143
1144      case ((0x170001 / 2) + 0x0162): // $9DF2
1145         return (funystrp_val + 0x00) & 0xff;
1146
1147      case ((0x170001 / 2) + 0x02A7): // $9E1E
1148         return (funystrp_val + 0x7c) & 0xff;
1149
1150      case ((0x170001 / 2) + 0x0381): // $9E54
1151         return (funystrp_val + 0x30) & 0xff;
1152
1153      case ((0x170001 / 2) + 0x03C7): // $9E8A
1154         return (funystrp_val + 0x28) & 0xff;
1155
1156      //-----------------------------------------------------------------
1157      // sub $A944, subtractions, original value from protection device
1158      // verified as working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1159
1160      case ((0x177001 / 2) + 0x0079): // $A946
1161         funystrp_val = 0;
1162         return 0;
1163
1164      case ((0x177001 / 2) + 0x01A0): // $A964
1165         return (funystrp_val + 0x02) & 0xff;
1166
1167      case ((0x177001 / 2) + 0x02B2): // $A99C
1168         return (funystrp_val + 0x04) & 0xff;
1169
1170      case ((0x177001 / 2) + 0x039A): // $A9CE
1171         return (funystrp_val + 0x25) & 0xff;
1172
1173      case ((0x177001 / 2) + 0x03D3): // $AA04
1174         return (funystrp_val + 0x16) & 0xff;
1175
1176      //-----------------------------------------------------------------
1177      // sub $C5E4, subtractions, original value from 68k
1178
1179   //   these cases are already in sub $7ACC, last one is new!!
1180   //   case ((0x107001 / 2) + 0x0030): // $7ACE
1181   //      funystrp_val = funystrp_ff3cc7_val & 0x7f;
1182   //      return 0;
1183
1184   //   case ((0x107001 / 2) + 0x013e): // $7AFC
1185   //      return (funystrp_val + 0x13) & 0xff;
1186
1187   //   case ((0x107001 / 2) + 0x0279): // $7B38
1188   //      return (funystrp_val + 0x22) & 0xff;
1189
1190   //   case ((0x107001 / 2) + 0x0357): // $7B6E
1191   //      return (funystrp_val + 0x44) & 0xff;
1192
1193      case ((0x107001 / 2) + 0x0381): // $7BA4
1194         return (funystrp_val + 0x6a) & 0xff;
1195
1196      //-----------------------------------------------------------------
1197      // sub $DBCE, subtractions, original value from protection device
1198
1199      case ((0x140001 / 2) + 0x0052): // $DBD0
1200         funystrp_val = 0;
1201         return 0;
1202
1203      case ((0x140001 / 2) + 0x015C): // $DBEE
1204         return (funystrp_val + 0x15) & 0xff;
1205
1206      case ((0x140001 / 2) + 0x0293): // $DC2A
1207         return (funystrp_val + 0x03) & 0xff;
1208
1209      case ((0x140001 / 2) + 0x0374): // $DC5C
1210         return (funystrp_val + 0x55) & 0xff;
1211
1212      case ((0x140001 / 2) + 0x03C0): // $DC92
1213         return (funystrp_val + 0x44) & 0xff;
1214
1215      //-----------------------------------------------------------------
1216      // sub $F72C, subtractions, original value from protection device,
1217      // routine verified working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1218   
1219      case ((0x100001 / 2) + 0x0017): // $F72E
1220         funystrp_val = 0;
1221         return 0;
1222
1223      case ((0x100001 / 2) + 0x0127): // $F74C
1224         return (funystrp_val + 0x17) & 0xff;
1225
1226      case ((0x110001 / 2) + 0x0263): // $F788
1227         return (funystrp_val + 0x0f) & 0xff;
1228
1229      case ((0x110001 / 2) + 0x0324): // $F7BE
1230         return (funystrp_val + 0x12) & 0xff;
1231
1232      case ((0x110001 / 2) + 0x0399): // $F7F4
1233         return (funystrp_val + 0x70) & 0xff;
1234
1235      //-----------------------------------------------------------------
1236      // sub $F82E, subtractions, original value from protection device,
1237   
1238      case ((0x100001 / 2) + 0x0013): // $F830
1239         funystrp_val = 0;
1240         return 0;
1241
1242      case ((0x100001 / 2) + 0x0125): // $F84E
1243         return (funystrp_val + 0x17) & 0xff;
1244
1245   //   used in sub $7E76
1246   //   case ((0x110001 / 2) + 0x0261): // $F88A
1247   //      return (funystrp_val + 0x0f) & 0xff;
1248
1249   //   case ((0x110001 / 2) + 0x0322): // $F8C0
1250   //      return (funystrp_val + 0x12) & 0xff;
1251
1252   //   case ((0x110001 / 2) + 0x039B): // $F8F6
1253   //      return (funystrp_val + 0x70) & 0xff;
1254
1255      //-----------------------------------------------------------------
1256      // sub $10FE2, subtractions, original value from protection device
1257      // routine is different from rest, unoptimized or just poorly coded?
1258      // examine later to verify this is right
1259   
1260      case ((0x105001 / 2) + 0x0021): // $10FF6
1261         funystrp_val = 0;
1262         return 0;
1263
1264      case ((0x105001 / 2) + 0x0131): // $1100C
1265         return (funystrp_val + 0x51) & 0xff;
1266
1267      case ((0x105001 / 2) + 0x026a): // $11038
1268         return (funystrp_val + 0x22) & 0xff;
1269
1270      case ((0x105001 / 2) + 0x0331): // $11060
1271         return (funystrp_val + 0x00) & 0xff;
1272
1273      case ((0x105001 / 2) + 0x03ab): // $11078
1274         return (funystrp_val + 0x03) & 0xff;
1275
1276      //-----------------------------------------------------------------
1277      // sub $11F2C, subtractions, original value from protection device,
1278      // routine is different from rest, unoptimized or just poorly coded?
1279      // examine later to verify this is right
1280   
1281      case ((0x183001 / 2) + 0x0088): // $11F3C
1282         funystrp_val = 0;
1283         return 0;
1284
1285      case ((0x183001 / 2) + 0x01A7): // $11F5A
1286         return (funystrp_val + 0x09) & 0xff;
1287
1288      case ((0x183001 / 2) + 0x02C4): // $11F86
1289         return (funystrp_val + 0x01) & 0xff;
1290
1291      case ((0x183001 / 2) + 0x03B3): // $11FAA
1292         return (funystrp_val + 0x63) & 0xff;
1293
1294      case ((0x183001 / 2) + 0x03E9): // $11FD2
1295         return (funystrp_val + 0x65) & 0xff;
1296   }
1297
1298   return 0;
1299}
1300
1301WRITE16_MEMBER(splash_state::funystrp_protection_w)
1302{
1303   int ofst = (0x100000/2)+offset;
1304
1305//   logerror ("PROTW: %5.5x, %4.4x, PC: %5.5x m: %4.4x\n", ofst*2, data, space.device().safe_pc(), mem_mask);
1306
1307//   if (ACCESSING_BITS_0_7) // ??
1308   {
1309      switch (ofst)
1310      {
1311         case (0x100000/2):
1312            // on boot?
1313         return;
1314
1315         case (0x1007e1/2):
1316         case (0x1007e3/2):
1317         // counters written here... ??
1318         return;
1319
1320         case (0x1007e5/2):
1321            funystrp_ff3cc8_val = data;
1322         return;
1323   
1324         case (0x1007e7/2):
1325            funystrp_ff3cc7_val = data;
1326         return;
1327      }
1328   }
1329}
1330
1331DRIVER_INIT_MEMBER(splash_state,funystrp)
1332{
1333   m_bitmap_type = 0;
1334   m_sprite_attr2_shift = 0;
1335
1336   UINT16 *ROM = (UINT16 *)memregion("audiocpu")->base();
1337
10621338   membank("sound_bank")->configure_entries(0, 16, &ROM[0x00000], 0x8000);
1339
1340   m_maincpu->space(AS_PROGRAM).install_write_handler(0x100000, 0x1fffff, write16_delegate(FUNC(splash_state::funystrp_protection_w), this));
1341   m_maincpu->space(AS_PROGRAM).install_read_handler(0x100000, 0x1fffff, read16_delegate(FUNC(splash_state::funystrp_protection_r),this));
10631342}
10641343
10651344GAME( 1992, splash,   0,        splash,   splash, splash_state,   splash,   ROT0, "Gaelco / OMK Software", "Splash! (Ver. 1.2 World)", 0 )
trunk/src/mame/includes/splash.h
r31501r31502
1717      m_msm1(*this, "msm1"),
1818      m_msm2(*this, "msm2"),
1919      m_gfxdecode(*this, "gfxdecode"),
20      m_palette(*this, "palette")  { }
20      m_palette(*this, "palette"),
21     
22      funystrp_val(0),
23      funystrp_ff3cc7_val(0),
24      funystrp_ff3cc8_val(0)
25      { }
2126
2227   required_shared_ptr<UINT16> m_pixelram;
2328   required_shared_ptr<UINT16> m_videoram;
r31501r31502
5459   DECLARE_READ8_MEMBER(roldfrog_unk_r);
5560   DECLARE_READ16_MEMBER(spr_read);
5661   DECLARE_WRITE16_MEMBER(spr_write);
57   DECLARE_WRITE16_MEMBER(funystrp_sh_irqtrigger_w);
5862   DECLARE_READ8_MEMBER(int_source_r);
5963   DECLARE_WRITE8_MEMBER(msm1_data_w);
6064   DECLARE_WRITE8_MEMBER(msm1_interrupt_w);
r31501r31502
6367   DECLARE_WRITE16_MEMBER(splash_vram_w);
6468   DECLARE_DRIVER_INIT(splash10);
6569   DECLARE_DRIVER_INIT(roldfrog);
66   DECLARE_DRIVER_INIT(funystrp);
6770   DECLARE_DRIVER_INIT(splash);
6871   DECLARE_DRIVER_INIT(rebus);
6972   TILE_GET_INFO_MEMBER(get_tile_info_splash_tilemap0);
7073   TILE_GET_INFO_MEMBER(get_tile_info_splash_tilemap1);
7174   virtual void video_start();
7275   DECLARE_MACHINE_RESET(splash);
73   DECLARE_MACHINE_RESET(funystrp);
7476   UINT32 screen_update_splash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
75   UINT32 screen_update_funystrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7677   INTERRUPT_GEN_MEMBER(roldfrog_interrupt);
7778   void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
7879   void splash_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
79   void funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
8080   void roldfrog_update_irq(  );
8181   DECLARE_WRITE_LINE_MEMBER(splash_msm5205_int);
8282   DECLARE_WRITE_LINE_MEMBER(ym_irq);
r31501r31502
8989   optional_device<msm5205_device> m_msm2;
9090   required_device<gfxdecode_device> m_gfxdecode;
9191   required_device<palette_device> m_palette;
92
93   // Funny Strip
94   DECLARE_MACHINE_RESET(funystrp);
95   DECLARE_WRITE16_MEMBER(funystrp_protection_w);
96   DECLARE_READ16_MEMBER(funystrp_protection_r);
97   DECLARE_WRITE16_MEMBER(funystrp_sh_irqtrigger_w);
98   DECLARE_DRIVER_INIT(funystrp);
99   UINT32 screen_update_funystrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
100   void funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
101   UINT8 funystrp_val;
102   UINT8 funystrp_ff3cc7_val;
103   UINT8 funystrp_ff3cc8_val;
104
92105};

Previous 199869 Revisions Next


© 1997-2024 The MAME Team