Page 1 of 1

[mspacman+] Always have Banana on Random Fruit Levels

Posted: Sat Feb 25, 2023 4:10 am
by pac_man_fan2

Code: Select all

  
  <cheat desc="Banana for All Random Fruit Boards">
    <script state="run">
      <action>maincpu.mb@2B32=06</action>	<!-- 06=Banana, 05=Pear ... 00=Cherry -->
      <action>maincpu.md@8768=002B323A</action>
      <action>maincpu.md@876C=00000000</action>
    </script>
  </cheat>

Re: [mspacman+] Always have Banana on Random Fruit Levels

Posted: Sun Feb 26, 2023 3:10 am
by jman
This code doesn't work for me. Random fruit is always random even when I set this code.

Re: [mspacman+] Always have Banana on Random Fruit Levels

Posted: Sun Feb 26, 2023 1:20 pm
by pac_man_fan2
I missed that the encrypted versions of mspacman need an extra leading '1' bit to the memory address.
The above is perfect for the unencrypted/bootlegs (mspacmab, ...)

Updated for the encrypted sets and finished to restore original code when on/off is used.
<cheat desc="Banana for All Random Fruit Boards">
<script state="on">
<action>temp0 =maincpu.mb@12B32</action>
<action>temp1 =maincpu.md@18768</action>
<action>temp2 =maincpu.md@1876C</action>
</script>
<script state="run">
<action>maincpu.mb@12B32=06</action> <!-- 06=Banana, 05=Pear ... 00=Cherry -->
<action>maincpu.md@18768=002B323A</action>
<action>maincpu.md@1876C=00000000</action>
</script>
<script state="off">
<action>maincpu.mb@12B32=temp0</action>
<action>maincpu.md@18768=temp1</action>
<action>maincpu.md@1876C=temp2</action>
</script>
</cheat>

Re: [mspacman+] Always have Banana on Random Fruit Levels

Posted: Mon Feb 27, 2023 10:44 am
by jman
It works in mspacman. But I don't understand why do you read $2b32.

Code: Select all

8768 | ED 5F    : ld  a,r
876A | E6 1F    : and $1F
876C | 90       : sub b
876D | 30 FD    : jr  nc,$876C
876F | 80       : add a,b
8770 | 21 9D 87 : ld  hl,$879D
8773 | 47       : ld  b,a
8774 | 87       : add a,a
8775 | 80       : add a,b
8776 | D7       : rst $10
In $8768, read "r" register so that $2b32 seems to be unneeded.

Simplified code is the following.

Code: Select all

<cheat desc="banana for all random fruit boards">
    <script state="on">
        <action>maincpu.mw@18768 = 063e</action> <!-- 06=Banana, 05=Pear ... 00=Cherry -->
    </script>
    <script state="off">
        <action>maincpu.mw@18768 = 5fed</action>
    </script>
</cheat>

Re: [mspacman+] Always have Banana on Random Fruit Levels

Posted: Mon Feb 27, 2023 12:53 pm
by pac_man_fan2
2B32 is part of the score table for the 8th fruit, which is unused.
I'm putting the desired "random" fruit number (06=banana) in there, to then be read after the board level check of 1-7.

Basically, I dont know what i'm doing and came up with this! I'll check your simplified code out today.
thanks for sharing.