Page 1 of 1

[opaopa] Opa Opa

Posted: Tue Jan 03, 2023 1:16 pm
by jman

Code: Select all

<cheat desc="no hit">
    <script state="on">
        <action>maincpu.od@3755 =         4fffffcd</action>
        <action>maincpu.md@3755 =         ff148dff</action>
        <action>maincpu.oq@148d = ff3ed0fffeff7edd</action>
        <action>maincpu.mq@148d = 14ffff0aff05ffff</action>
        <action>maincpu.oq@1495 = 37cd3e0e000000c9</action>
        <action>maincpu.mq@1495 = b0d79314ffffffff</action>
        <!--
        148d | dd 7e 05 : ld  a,(ix+$05)
        1490 | fe 0a    : cp  $0A
        1492 | d0       : ret nc
        1493 | 3e 14    : ld  a,$14
        1495 | c9       : ret
        1496 | 00       : nop
        1497 | 00       : nop
        1498 | 00       : nop
        -->
    </script>
    <script state="off">
        <action>maincpu.od@3755 =         4f097edd</action>
        <action>maincpu.md@3755 =         b6059592</action>
        <action>maincpu.oq@148d = c524cbfd0ad736fd</action>
        <action>maincpu.mq@148d = ce010ced0300b8c4</action>
        <action>maincpu.oq@1495 = 37cd3e0ebaeacbfd</action>
        <action>maincpu.mq@1495 = b0d79314be015536</action>
    </script>
</cheat>

<cheat desc="auto fire">
    <script state="on">
        <action>maincpu.mb@360a = 00</action>
    </script>
    <script state="off">
        <action>maincpu.mb@360a = 1e</action>
    </script>
</cheat>

<cheat desc="player speed">
    <parameter>
        <item value="0x0040">01 (slow)</item>
        <item value="0x00c0">02       </item>
        <item value="0x01c0">03       </item>
        <item value="0x02c0">04       </item>
        <item value="0x03c0">05 (fast)</item>
    </parameter>
    <script state="on">
        <action>maincpu.ob@1873 = 21</action>
        <action>maincpu.ob@18a1 = 21</action>
    </script>
    <script state="change">
        <action>maincpu.mw@1874 = param</action>
        <action>maincpu.mw@18a2 = param</action>
    </script>
    <script state="off">
        <action>maincpu.ob@1873 =   fd</action>
        <action>maincpu.mw@1874 = 317d</action>
        <action>maincpu.ob@18a1 =   fd</action>
        <action>maincpu.mw@18a2 = 31d9</action>
    </script>
</cheat>

<cheat desc="free price">
    <script state="on">
        <action>maincpu.oq@1d40 = e7a93a005f574faf</action> <!-- calculate price (xor a / ld c,a / ld d,a / ld e,a / nop -->
        <action>maincpu.oq@2055 = e1843a005f574faf</action> <!-- calculate price (xor a / ld c,a / ld d,a / ld e,a / nop -->
        <action>maincpu.oq@207a = 23083a005f574faf</action> <!-- calculate price (xor a / ld c,a / ld d,a / ld e,a / nop -->
        <action>maincpu.oq@209f = a1143a005f574faf</action> <!-- calculate price (xor a / ld c,a / ld d,a / ld e,a / nop -->
        <action>maincpu.ob@59bc =               18</action> <!-- display item -->
        <action>maincpu.od@79d5 =         6f675faf</action> <!-- display price at round start (xor a / ld e,a / ld h,a / ld l,a) -->
    </script>
    <script state="off">
        <action>maincpu.oq@1d40 = e7a93a5e2356234e</action>
        <action>maincpu.oq@2055 = e1843a5e2356234e</action>
        <action>maincpu.oq@207a = 23083a5e2356234e</action>
        <action>maincpu.oq@209f = a1143a5e2356234e</action>
        <action>maincpu.ob@59bc =               30</action>
        <action>maincpu.od@79d5 =         b7799c06</action>
    </script>
</cheat>

<cheat desc="sound test mode">
    <comment>reset the game (F3) to enter sound test mode</comment>
    <script state="on">
        <action>maincpu.ib@000f7 =               01</action> <!-- set bank -->
        <action>maincpu.oq@00117 = c3ffff32ffd3ff3e</action>
        <action>maincpu.mq@00117 = ffc248fff7ff01ff</action>
        <action>maincpu.oq@0011f = e61b5d3a0000ffff</action>
        <action>maincpu.mq@0011f = 19c1f68cffffbf90</action>
        <action>maincpu.oq@0bf90 = 2847b8ffdbffff21</action>
        <action>maincpu.mq@17f90 = ffffffe1ffc100ff</action>
        <action>maincpu.oq@0bf98 = fffe35ff20fffeff</action>
        <action>maincpu.mq@17f98 = f7ffff01fffbfffa</action>
        <action>maincpu.oq@0bfa0 = 3eff20fffe34ff20</action>
        <action>maincpu.mq@17fa0 = ff04fffdffff01ff</action>
        <action>maincpu.oq@0bfa8 = 3eff20fffeff18ff</action>
        <action>maincpu.mq@17fa8 = ff05fffeff06fff0</action>
        <action>maincpu.oq@0bfb0 = ff20fffe787786ff</action>
        <action>maincpu.mq@17fb0 = 05ffefffffffff10</action>
        <action>maincpu.oq@0bfb8 = 20fffeff18fff67e</action>
        <action>maincpu.mq@17fb8 = ffdfff05ff80ffff</action>
        <action>maincpu.oq@0bfc0 = 1eff18ffff32afff</action>
        <action>maincpu.mq@17fc0 = ffccffc000ffff04</action>
        <action>maincpu.ib@000f7 =  maincpu.pb@c248</action> <!-- restore bank -->
        <!--
        0117 | 3e 01    : ld  a,$01
        0119 | d3 f7    : out ($F7),a   // set bank
        011b | 32 48 c2 : ld  ($C248),a
        011e | c3 90 bf : jp  $BF90
        0121 | 00       : nop
        0122 | 00       : nop
        ================================
        bf90 | 21 00 c1 : ld  hl,$C100
        bf93 | db e1    : in  a,($E1)   // read input
        bf95 | b8       : cp  b
        bf96 | 47       : ld  b,a
        bf97 | 28 fa    : jr  z,$BF93
        bf99 | fe fb    : cp  $FB
        bf9b | 20 01    : jr  nz,$BF9E
        bf9d | 35       : dec (hl)      // decrease code -01
        bf9e | fe f7    : cp  $F7
        bfa0 | 20 01    : jr  nz,$BFA3
        bfa2 | 34       : inc (hl)      // increase code +01
        bfa3 | fe fd    : cp  $FD
        bfa5 | 20 04    : jr  nz,$BFAB
        bfa7 | 3e f0    : ld  a,$F0     // decrease code -10
        bfa9 | 18 06    : jr  $BFB1
        bfab | fe fe    : cp  $FE
        bfad | 20 05    : jr  nz,$BFB4
        bfaf | 3e 10    : ld  a,$10     // increase code +10
        bfb1 | 86       : add a,(hl)
        bfb2 | 77       : ld  (hl),a
        bfb3 | 78       : ld  a,b
        bfb4 | fe ef    : cp  $EF
        bfb6 | 20 05    : jr  nz,$BFBD
        bfb8 | 7e       : ld  a,(hl)    // play sound
        bfb9 | f6 80    : or  $80
        bfbb | 18 05    : jr  $BFC2
        bfbd | fe df    : cp  $DF
        bfbf | 20 04    : jr  nz,$BFC5
        bfc1 | af       : xor a         // stop sound
        bfc2 | 32 00 c0 : ld  ($C000),a // send sound code
        bfc5 | 18 cc    : jr  $BF93
        -->
    </script>
    <script state="run">
        <output format="----- opa opa sound test mode -----" line="10" align="center" />
        <output format="left : decrease code -01"            line="11" align="center" />
        <output format="right : increase code +01"           line="12" align="center" />
        <output format="down : decrease code -10"            line="13" align="center" />
        <output format="up : increase code +10"              line="14" align="center" />
        <output format="button 1 : play sound"               line="15" align="center" />
        <output format="button 2 : stop sound"               line="16" align="center" />
        <output format="----------------------------"        line="17" align="center" />
        <output format="&lt;&lt; sound code %2.2X &gt;&gt;"  line="19" align="center"  >
            <argument>maincpu.pb@c100</argument>
        </output>
    </script>
    <script state="off">
        <action>maincpu.ib@000f7 =               01</action>
        <action>maincpu.oq@00117 = 28cde720b7bcf33a</action>
        <action>maincpu.mq@00117 = af5b5b3262c2378e</action>
        <action>maincpu.oq@0011f = e61b5d3a4330c331</action>
        <action>maincpu.mq@0011f = 19c1f68c00f91b73</action>
        <action>maincpu.oq@0bf90 = 8c613b56cdd8dbca</action>
        <action>maincpu.mq@17f90 = ffffffffffffffff</action>
        <action>maincpu.oq@0bf98 = 8c613b56cdd8dbca</action>
        <action>maincpu.mq@17f98 = ffffffffffffffff</action>
        <action>maincpu.oq@0bfa0 = bbeed0913a2338e9</action>
        <action>maincpu.mq@17fa0 = ffffffffffffffff</action>
        <action>maincpu.oq@0bfa8 = bbeed0913a2338e9</action>
        <action>maincpu.mq@17fa8 = ffffffffffffffff</action>
        <action>maincpu.oq@0bfb0 = 8c613b56cdd8dbca</action>
        <action>maincpu.mq@17fb0 = ffffffffffffffff</action>
        <action>maincpu.oq@0bfb8 = 8c613b56cdd8dbca</action>
        <action>maincpu.mq@17fb8 = ffffffffffffffff</action>
        <action>maincpu.oq@0bfc0 = 1e70b98092571899</action>
        <action>maincpu.mq@17fc0 = ffffffffffffffff</action>
        <action>maincpu.ib@000f7 =  maincpu.pb@c248</action>
    </script>
</cheat>
I don't know direct memory read/write for "banked opcode" space via expression. Did anyone know it?

"free price" works when you set BEFORE start round. It will be better to set in title screen.
Image

[opaopa]+ Opa Opa

Posted: Sun Feb 11, 2024 9:23 am
by jman
opaopa.xml

Code: Select all

<!-- Opa Opa (MC-8123, 317-0042) -->
<mamecheat version="1">

    <cheat desc="no hit">
        <script state="on">
            <action>maincpu.od@3755 = 4FFFFFCD        </action>
            <action>maincpu.md@3755 = FFF000FF        </action>
            <action>maincpu.pq@F000 = 143ED00AFE057EDD</action>
            <action>maincpu.pq@F008 = 00000000000000C9</action>
            <!--
            F000 | DD 7E 05 : ld   a,(ix+$05)
            F003 | FE 0A    : cp   $0A
            F005 | D0       : ret  nc
            F006 | 3E 14    : ld   a,$14
            F008 | C9       : ret
            -->
        </script>
        <script state="off">
            <action>maincpu.od@3755 = 4F097EDD        </action>
            <action>maincpu.md@3755 = B6059592        </action>
            <action>maincpu.pq@F000 = 143ED00AFE057EDD</action>
            <action>maincpu.pq@F008 = 00000000000000C9</action>
        </script>
    </cheat>

    <cheat desc="auto fire">
        <script state="on">
            <action>maincpu.mb@360A = 00</action>
        </script>
        <script state="off">
            <action>maincpu.mb@360A = 1E</action>
        </script>
    </cheat>

    <cheat desc="player speed">
        <parameter>
            <item value="0x0040">01 (slow)</item>
            <item value="0x00c0">02       </item>
            <item value="0x01c0">03       </item>
            <item value="0x02c0">04       </item>
            <item value="0x03c0">05 (fast)</item>
        </parameter>
        <script state="on">
            <action>maincpu.ob@1873 = 21</action>
            <action>maincpu.ob@18A1 = 21</action>
        </script>
        <script state="change">
            <action>maincpu.mw@1874 = param</action>
            <action>maincpu.mw@18A2 = param</action>
        </script>
        <script state="off">
            <action>maincpu.ob@1873 = FD  </action>
            <action>maincpu.mw@1874 = 317D</action>
            <action>maincpu.ob@18A1 = FD  </action>
            <action>maincpu.mw@18A2 = 31D9</action>
        </script>
    </cheat>

    <cheat desc="free price">
        <script state="on">
            <!-- calculate price (xor a / ld c,a / ld d,a / ld e,a / nop) -->
            <action>maincpu.oq@1D40 = E7A93A005F574FAF</action>
            <action>maincpu.oq@2055 = E1843A005F574FAF</action>
            <action>maincpu.oq@207A = 23083A005F574FAF</action>
            <action>maincpu.oq@209F = A1143A005F574FAF</action>
            <!-- display item -->
            <action>maincpu.ob@59BC = 18</action>
            <!-- display price at round start (xor a / ld e,a / ld h,a / ld l,a) -->
            <action>maincpu.od@79D5 = 6F675FAF</action>
        </script>
        <script state="off">
            <action>maincpu.oq@1D40 = E7A93A5E2356234E</action>
            <action>maincpu.oq@2055 = E1843A5E2356234E</action>
            <action>maincpu.oq@207A = 23083A5E2356234E</action>
            <action>maincpu.oq@209F = A1143A5E2356234E</action>
            <action>maincpu.ob@59BC = 30              </action>
            <action>maincpu.od@79D5 = B7799C06        </action>
        </script>
    </cheat>

    <cheat desc="sound test mode">
        <comment>reset the game (F3) to enter sound test mode</comment>
        <script state="on">
            <action>maincpu.oq@0117 = C3              </action>
            <action>maincpu.mw@0118 = F010            </action>
            <action>maincpu.pq@F010 = 2847B8E1DBC10021</action>
            <action>maincpu.pq@F018 = F7FE350120FBFEFA</action>
            <action>maincpu.pq@F020 = 3E0420FDFE340120</action>
            <action>maincpu.pq@F028 = 3E0520FEFE0618F0</action>
            <action>maincpu.pq@F030 = 0520EFFE78778610</action>
            <action>maincpu.pq@F038 = 20DFFE051880F67E</action>
            <action>maincpu.pq@F040 = 00CC18C00032AF04</action>
            <!--
            F010 | 21 00 C1 : ld   hl,$C100  // sound code address
            F013 | DB E1    : in   a,($E1)   // read input
            F015 | B8       : cp   b
            F016 | 47       : ld   b,a
            F017 | 28 FA    : jr   z,$F013
            F019 | FE FB    : cp   $FB
            F01B | 20 01    : jr   nz,$F01E
            F01D | 35       : dec  (hl)      // decrease code -01
            F01E | FE F7    : cp   $F7
            F020 | 20 01    : jr   nz,$F023
            F022 | 34       : inc  (hl)      // increase code +01
            F023 | FE FD    : cp   $FD
            F025 | 20 04    : jr   nz,$F02B
            F027 | 3E F0    : ld   a,$F0     // decrease code -10
            F029 | 18 06    : jr   $F031
            F02B | FE FE    : cp   $FE
            F02D | 20 05    : jr   nz,$F034
            F02F | 3E 10    : ld   a,$10     // increase code +10
            F031 | 86       : add  a,(hl)
            F032 | 77       : ld   (hl),a
            F033 | 78       : ld   a,b
            F034 | FE EF    : cp   $EF
            F036 | 20 05    : jr   nz,$F03D
            F038 | 7E       : ld   a,(hl)    // play sound
            F039 | F6 80    : or   $80
            F03B | 18 05    : jr   $F042
            F03D | FE DF    : cp   $DF
            F03F | 20 04    : jr   nz,$F045
            F041 | AF       : xor  a         // stop sound
            F042 | 32 00 C0 : ld   ($C000),a // send sound code
            F045 | 18 CC    : jr   $F013
            -->
        </script>
        <script state="run">
            <output format="----- opa opa sound test mode -----" line="10" align="center" />
            <output format="left : decrease code -01"            line="11" align="center" />
            <output format="right : increase code +01"           line="12" align="center" />
            <output format="down : decrease code -10"            line="13" align="center" />
            <output format="up : increase code +10"              line="14" align="center" />
            <output format="button 1 : play sound"               line="15" align="center" />
            <output format="button 2 : stop sound"               line="16" align="center" />
            <output format="----------------------------"        line="17" align="center" />
            <output format="&lt;&lt; sound code %02X &gt;&gt;"   line="19" align="center"  >
                <argument>maincpu.pb@C100</argument>
            </output>
        </script>
        <script state="off">
            <action>maincpu.oq@0117 = 3A              </action>
            <action>maincpu.mw@0118 = C237            </action>
            <action>maincpu.pq@F010 = 0000000000000000</action>
            <action>maincpu.pq@F018 = 0000000000000000</action>
            <action>maincpu.pq@F020 = 0000000000000000</action>
            <action>maincpu.pq@F028 = 0000000000000000</action>
            <action>maincpu.pq@F030 = 0000000000000000</action>
            <action>maincpu.pq@F038 = 0000000000000000</action>
            <action>maincpu.pq@F040 = 0000000000000000</action>
        </script>
    </cheat>

</mamecheat>
opaopan.xml

Code: Select all

<!-- Opa Opa (Rev A, unprotected) -->
<mamecheat version="1">

    <cheat desc="no hit">
        <script state="on">
            <action>maincpu.md@3755 = 4FF000CD        </action>
            <action>maincpu.pq@F000 = 143ED00AFE057EDD</action>
            <action>maincpu.pq@F008 = 00000000000000C9</action>
            <!--
            F000 | DD 7E 05 : ld   a,(ix+$05)
            F003 | FE 0A    : cp   $0A
            F005 | D0       : ret  nc
            F006 | 3E 14    : ld   a,$14
            F008 | C9       : ret
            -->
        </script>
        <script state="off">
            <action>maincpu.md@3755 = 4F057EDD        </action>
            <action>maincpu.pq@F000 = 143ED00AFE057EDD</action>
            <action>maincpu.pq@F008 = 00000000000000C9</action>
        </script>
    </cheat>

    <cheat desc="auto fire">
        <script state="on">
            <action>maincpu.mb@360A = 00</action>
        </script>
        <script state="off">
            <action>maincpu.mb@360A = 1E</action>
        </script>
    </cheat>

    <cheat desc="player speed">
        <parameter>
            <item value="0x0040">01 (slow)</item>
            <item value="0x00c0">02       </item>
            <item value="0x01c0">03       </item>
            <item value="0x02c0">04       </item>
            <item value="0x03c0">05 (fast)</item>
        </parameter>
        <script state="on">
            <action>maincpu.mb@1873 = 21</action>
            <action>maincpu.mb@18A1 = 21</action>
        </script>
        <script state="change">
            <action>maincpu.mw@1874 = param</action>
            <action>maincpu.mw@18A2 = param</action>
        </script>
        <script state="off">
            <action>maincpu.md@1873 = 5D3166FD</action>
            <action>maincpu.md@18A1 = 7D3166FD</action>
        </script>
    </cheat>

    <cheat desc="free price">
        <script state="on">
            <!-- calculate price (xor a / ld c,a / ld d,a / ld e,a / nop) -->
            <action>maincpu.mq@1D40 = C3B33A005F574FAF</action>
            <action>maincpu.mq@2055 = C3B73A005F574FAF</action>
            <action>maincpu.mq@207A = C3BB3A005F574FAF</action>
            <action>maincpu.mq@209F = C3BF3A005F574FAF</action>
            <!-- display item -->
            <action>maincpu.mb@59BC = 18</action>
            <!-- display price at round start (xor a / ld e,a / ld h,a / ld l,a) -->
            <action>maincpu.md@79D5 = 6F675FAF</action>
        </script>
        <script state="off">
            <action>maincpu.mq@1D40 = C3B33A5E2356234E</action>
            <action>maincpu.mq@2055 = C3B73A5E2356234E</action>
            <action>maincpu.mq@207A = C3BB3A5E2356234E</action>
            <action>maincpu.mq@209F = C3BF3A5E2356234E</action>
            <action>maincpu.mb@59BC = 30              </action>
            <action>maincpu.md@79D5 = B7791406        </action>
        </script>
    </cheat>

    <cheat desc="sound test mode">
        <comment>reset the game (F3) to enter sound test mode</comment>
        <script state="on">
            <action>maincpu.md@0117 = B7F010C3        </action>
            <action>maincpu.pq@F010 = 2847B8E1DBC10021</action>
            <action>maincpu.pq@F018 = F7FE350120FBFEFA</action>
            <action>maincpu.pq@F020 = 3E0420FDFE340120</action>
            <action>maincpu.pq@F028 = 3E0520FEFE0618F0</action>
            <action>maincpu.pq@F030 = 0520EFFE78778610</action>
            <action>maincpu.pq@F038 = 20DFFE051880F67E</action>
            <action>maincpu.pq@F040 = 00CC18C00032AF04</action>
            <!--
            F010 | 21 00 C1 : ld   hl,$C100  // sound code address
            F013 | DB E1    : in   a,($E1)   // read input
            F015 | B8       : cp   b
            F016 | 47       : ld   b,a
            F017 | 28 FA    : jr   z,$F013
            F019 | FE FB    : cp   $FB
            F01B | 20 01    : jr   nz,$F01E
            F01D | 35       : dec  (hl)      // decrease code -01
            F01E | FE F7    : cp   $F7
            F020 | 20 01    : jr   nz,$F023
            F022 | 34       : inc  (hl)      // increase code +01
            F023 | FE FD    : cp   $FD
            F025 | 20 04    : jr   nz,$F02B
            F027 | 3E F0    : ld   a,$F0     // decrease code -10
            F029 | 18 06    : jr   $F031
            F02B | FE FE    : cp   $FE
            F02D | 20 05    : jr   nz,$F034
            F02F | 3E 10    : ld   a,$10     // increase code +10
            F031 | 86       : add  a,(hl)
            F032 | 77       : ld   (hl),a
            F033 | 78       : ld   a,b
            F034 | FE EF    : cp   $EF
            F036 | 20 05    : jr   nz,$F03D
            F038 | 7E       : ld   a,(hl)    // play sound
            F039 | F6 80    : or   $80
            F03B | 18 05    : jr   $F042
            F03D | FE DF    : cp   $DF
            F03F | 20 04    : jr   nz,$F045
            F041 | AF       : xor  a         // stop sound
            F042 | 32 00 C0 : ld   ($C000),a // send sound code
            F045 | 18 CC    : jr   $F013
            -->
        </script>
        <script state="run">
            <output format="----- opa opa sound test mode -----" line="10" align="center" />
            <output format="left : decrease code -01"            line="11" align="center" />
            <output format="right : increase code +01"           line="12" align="center" />
            <output format="down : decrease code -10"            line="13" align="center" />
            <output format="up : increase code +10"              line="14" align="center" />
            <output format="button 1 : play sound"               line="15" align="center" />
            <output format="button 2 : stop sound"               line="16" align="center" />
            <output format="----------------------------"        line="17" align="center" />
            <output format="&lt;&lt; sound code %02X &gt;&gt;"   line="19" align="center"  >
                <argument>maincpu.pb@C100</argument>
            </output>
        </script>
        <script state="off">
            <action>maincpu.md@0117 = B7C2373A        </action>
            <action>maincpu.pq@F010 = 0000000000000000</action>
            <action>maincpu.pq@F018 = 0000000000000000</action>
            <action>maincpu.pq@F020 = 0000000000000000</action>
            <action>maincpu.pq@F028 = 0000000000000000</action>
            <action>maincpu.pq@F030 = 0000000000000000</action>
            <action>maincpu.pq@F038 = 0000000000000000</action>
            <action>maincpu.pq@F040 = 0000000000000000</action>
        </script>
    </cheat>

</mamecheat>
"no hit", "sound test mode" : Changed ROM region for custome routine to (unused and uninitialized) RAM. It is not need to take care of switching bank in opcodes spaces.