Page 1 of 1

1942b hit anywhere

Posted: Sun Feb 21, 2016 2:58 am
by einstein95
In 1942.xml, there's a hit anywhere code. I took a shot at porting it, but it fails (with quite amusing results)

Code: Select all

  <cheat desc="Hit Anywhere">
    <script state="on">
      <action>temp0 =maincpu.mb@3489</action> <!-- / -->
      <action>temp1 =maincpu.mb@34B4</action> <!-- / -->
      <action>temp2 =maincpu.mb@34EE</action> <!-- ? *DA* 3E 34 CD -->
      <action>temp3 =maincpu.mb@34FE</action> <!-- / -->
      <action>temp4 =maincpu.mb@3537</action> <!-- ? *DA* 3E 34 DD -->
      <action>temp5 =maincpu.mb@356F</action> <!-- ? *C6* CD 76 36 -->
      <action>temp6 =maincpu.mb@358B</action> <!-- ? *D6* 21 63 38 -->
    </script>
    <script state="run">
      <action>maincpu.mb@3489=00</action> <!-- This ROM cheat was made by nolberto82 -->
      <action>maincpu.mb@34B4=86</action>
      <action>maincpu.mb@34EE=3A</action>
      <action>maincpu.mb@34FE=86</action>
      <action>maincpu.mb@3537=3A</action>
      <action>maincpu.mb@356F=86</action>
      <action>maincpu.mb@358B=C6</action>
    </script>
    <script state="off">
      <action>maincpu.mb@3489=temp0 </action>
      <action>maincpu.mb@34B4=temp1 </action>
      <action>maincpu.mb@34EE=temp2 </action>
      <action>maincpu.mb@34FE=temp3 </action>
      <action>maincpu.mb@3537=temp4 </action>
      <action>maincpu.mb@356F=temp5 </action>
      <action>maincpu.mb@358B=temp6 </action>
    </script>
  </cheat>
The 3rd, 5th, 6th and 7th addresses are guesses based on the relative bytes, but they're quite obviously incorrect. I've left my meagre notes in the comments next to the addresses.

Re: 1942b hit anywhere

Posted: Sun Feb 21, 2016 11:30 am
by Pugsy
It's a pain in the arse to port ROM codes, if it's not a simple offset change you need to search for every address but ideally you shouldn't use any bytes in the search string which are relative to memory or direct jumps..

So for 1942b or the other clones to be sure you will need to do this in the debugger (during play generally to avoid any banking issues, doesn't matter for 1942 as the code is not banked but it's a useful tip):-

Addresses in order in cheat:-
f 0,ffff,b8,dd,34
f 0,ffff,c6,dd <--1st of 3
f 0,ffff,c6,dd <--2nd of 3 (take 9 off address, should be DA in location)
f 0,ffff,c6,dd <--2nd of 3
f 0,ffff,dd,0x34,0a <- 4th of 5 take 3 off address, should be DA in location
f 0,ffff,c6,cd <-- 1st of two
f 0,ffff,d6,21 <- 2nd of 4

It turns out that the 1942b addresses are just +4 offset of 1942

These cheats will work for all the other clones apart from 1942w which is just a +2 offset of 1942.

Code: Select all

  <cheat desc="Hit Anywhere">
    <script state="on">
      <action>temp0 =maincpu.mb@3489</action>
      <action>temp1 =maincpu.mb@34B4</action>
      <action>temp2 =maincpu.mb@34F5</action>
      <action>temp3 =maincpu.mb@34FE</action>
      <action>temp4 =maincpu.mb@3538</action>
      <action>temp5 =maincpu.mb@3570</action>
      <action>temp6 =maincpu.mb@358C</action>
    </script>
    <script state="run">
      <action>maincpu.mb@3489=00</action> <!-- This ROM cheat was made by nolberto82 -->
      <action>maincpu.mb@34B4=86</action>
      <action>maincpu.mb@34F5=3A</action>
      <action>maincpu.mb@34FE=86</action>
      <action>maincpu.mb@3538=3A</action>
      <action>maincpu.mb@3570=86</action>
      <action>maincpu.mb@358C=C6</action>
    </script>
    <script state="off">
      <action>maincpu.mb@3489=temp0 </action>
      <action>maincpu.mb@34B4=temp1 </action>
      <action>maincpu.mb@34F5=temp2 </action>
      <action>maincpu.mb@34FE=temp3 </action>
      <action>maincpu.mb@3538=temp4 </action>
      <action>maincpu.mb@3570=temp5 </action>
      <action>maincpu.mb@358C=temp6 </action>
    </script>
  </cheat>