Page 1 of 1

[hamaway] Hammer Away

Posted: Mon Dec 06, 2021 9:59 am
by jman

Code: Select all

<cheat desc="no hit">
    <script state="on">
        <action>maincpu.md@4eac = 60000006</action>
    </script>
    <script state="off">
        <action>maincpu.md@4eac = 08d10003</action>
    </script>
</cheat>

<cheat desc="auto fire">
    <script state="on">
        <action>maincpu.mq@0587e = 4eb9000147604e71</action>
        <action>maincpu.mq@14760 = 266c0000202b0000</action>
        <action>maincpu.mq@14768 = 806b00004e75ffff</action>
        <!--
        14760 | 266c 0000 : movea.l ($0,A4),A3
        14764 | 202b 0000 : move.l  ($0,A3),D0
        14768 | 806b 0000 : or.w    ($0,A3),D0
        1476c | 4e75      : rts
        -->
    </script>
    <script state="off">
        <action>maincpu.mq@0587e = 266c0000202b0000</action>
        <action>maincpu.mq@14760 = ffffffffffffffff</action>
        <action>maincpu.mq@14768 = ffffffffffffffff</action>
    </script>
</cheat>

<cheat desc="player speed">
    <parameter min="0x01" max="0x05" step="0x01" />
    <script state="on">
        <action>maincpu.mq@05b16 = 4eb900014790d080</action>
        <action>maincpu.mq@14790 = 2818610c24042810</action>
        <action>maincpu.mq@14798 = 6106260478004e75</action>
        <action>maincpu.mq@147a0 = 7c0048464a846706</action>
        <action>maincpu.mq@147a8 = 6a02448628064e75</action>
        <!--
        14790 | 2818 : move.l (A0)+,D4
        14792 | 610c : bsr    $147a0
        14794 | 2404 : move.l D4,D2
        14796 | 2810 : move.l (A0),D4
        14798 | 6106 : bsr    $147a0
        1479a | 2604 : move.l D4,D3
        1479c | 7800 : moveq  #$0,D4
        1479e | 4e75 : rts
        147a0 | 7cxx : moveq  #$xx,D6
        147a2 | 4846 : swap   D6
        147a4 | 4a84 : tst.l  D4
        147a6 | 6706 : beq    $147ae
        147a8 | 6a02 : bpl    $147ac
        147aa | 4486 : neg.l  D6
        147ac | 2806 : move.l D6,D4
        147ae | 4e75 : rts
        -->
    </script>
    <script state="change">
        <action>maincpu.mb@147a1 = param</action>
    </script>
    <script state="off">
        <action>maincpu.mq@05b16 = 241826107804d080</action>
        <action>maincpu.mq@14790 = ffffffffffffffff</action>
        <action>maincpu.mq@14798 = ffffffffffffffff</action>
        <action>maincpu.mq@147a0 = ffffffffffffffff</action>
        <action>maincpu.mq@147a8 = ffffffffffffffff</action>
    </script>
</cheat>

<cheat desc="bullet speed - antiair">
    <parameter>
        <item value="0x01">01 (slow)</item>
        <item value="0x04">02       </item>
        <item value="0x08">03       </item>
        <item value="0x0c">04       </item>
        <item value="0x10">05 (fast)</item>
    </parameter>
    <script state="on">
        <action>maincpu.mq@059f8 = 4eb9000147b0317c</action>
        <action>maincpu.mq@147b0 = 317c00000022317c</action>
        <action>maincpu.mq@147b8 = 0002000a4e75ffff</action>
        <!--
        147b0 | 317c 00xx 0022 : move.w #$xx,($22,A0)
        147b6 | 317c 0002 000a : move.w #$2,($a,A0)
        147bc | 4e75           : rts
        -->
    </script>
    <script state="change">
        <action>maincpu.mb@147b3 = param</action>
    </script>
    <script state="off">
        <action>maincpu.mq@059f8 = 317c0002000a317c</action>
        <action>maincpu.mq@147b0 = ffffffffffffffff</action>
        <action>maincpu.mq@147b8 = ffffffffffffffff</action>
    </script>
</cheat>
<cheat desc="fast antisurface shot">
    <script state="on">
        <action>maincpu.mq@05a1c = 4eb900014770222d</action>
        <action>maincpu.mq@14770 = b1fc00ffc9326508</action>
        <action>maincpu.mq@14778 = 064100305e680002</action>
        <action>maincpu.mq@14780 = 4841214100064e75</action>
        <!--
        05a1c | 4eb9 0001 4770 : jsr    $14770.l
        14770 | b1fc 00ff c932 : cmpa.l #$ffc932,A0
        14776 | 6508           : bcs    $14780
        14778 | 0641 0030      : addi.w #$30,D1
        1477c | 5e68 0002      : addq.w #7,($2,A0)
        14780 | 4841           : swap   D1
        14782 | 2141 0006      : move.l D1,($6,A0)
        14786 | 4e75           : rts
        -->
    </script>
    <script state="off">
        <action>maincpu.mq@05a1c = 484121410006222d</action>
        <action>maincpu.mq@14770 = ffffffffffffffff</action>
        <action>maincpu.mq@14778 = ffffffffffffffff</action>
        <action>maincpu.mq@14780 = ffffffffffffffff</action>
    </script>
</cheat>

<cheat desc="sound test mode">
    <comment>reset the game (F3) to enter sound test mode</comment>
    <script state="on">
        <action>maincpu.mq@00540 = 4ef9000147604eb9</action>
        <action>maincpu.mq@14760 = 41f900ff10001401</action>
        <action>maincpu.mq@14768 = 123900a00001b401</action>
        <action>maincpu.mq@14770 = 67f40c01007f6602</action>
        <action>maincpu.mq@14778 = 53100c0100bf6602</action>
        <action>maincpu.mq@14780 = 52100c0100ef6604</action>
        <action>maincpu.mq@14788 = 041000100c0100df</action>
        <action>maincpu.mq@14790 = 6604061000100c01</action>
        <action>maincpu.mq@14798 = 00fe66041010600a</action>
        <action>maincpu.mq@147a0 = 0c0100fd660a103c</action>
        <action>maincpu.mq@147a8 = 00ff13c000fe0007</action>
        <action>maincpu.mq@147b0 = 60b4ffffffffffff</action>
        <!--
        14760 | 41f9 00ff 1000 : lea    $ff1000.l,A0 // sound code address
        14766 | 1401           : move.b D1,D2
        14768 | 1239 00a0 0001 : move.b $a00001.l,D1 // read input
        1476e | b401           : cmp.b  D1,D2
        14770 | 67f4           : beq    $14766
        14772 | 0c01 007f      : cmpi.b #$7f,D1
        14776 | 6602           : bne    $1477a
        14778 | 5310           : subq.b #1,(A0)      // decrease code -01
        1477a | 0c01 00bf      : cmpi.b #-$41,D1
        1477e | 6602           : bne    $14782
        14780 | 5210           : addq.b #1,(A0)      // increase code +01
        14782 | 0c01 00ef      : cmpi.b #-$11,D1
        14786 | 6604           : bne    $1478c
        14788 | 0410 0010      : subi.b #$10,(A0)    // decrease code -10
        1478c | 0c01 00df      : cmpi.b #-$21,D1
        14790 | 6604           : bne    $14796
        14792 | 0610 0010      : addi.b #$10,(A0)    // increase code +10
        14796 | 0c01 00fe      : cmpi.b #-$2,D1
        1479a | 6604           : bne    $147a0
        1479c | 1010           : move.b (A0),D0      // play sound
        1479e | 600a           : bra    $147aa
        147a0 | 0c01 00fd      : cmpi.b #-$3,D1
        147a4 | 660a           : bne    $147b0
        147a6 | 103c 00ff      : move.b #$ff,D0      // stop sound
        147aa | 13c0 00fe 0007 : move.b D0,$fe0007.l // send sound code
        147b0 | 60b4           : bra    $14766
        -->
    </script>
    <script state="run">
        <output format="----- hammer away 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="up : increase code +10"                  line="13" align="center" />
        <output format="down : decrease 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@ff1000</argument>
        </output>
    </script>
    <script state="off">
        <action>maincpu.mq@00540 = 4eb90000086c4eb9</action>
        <action>maincpu.mq@14760 = ffffffffffffffff</action>
        <action>maincpu.mq@14768 = ffffffffffffffff</action>
        <action>maincpu.mq@14770 = ffffffffffffffff</action>
        <action>maincpu.mq@14778 = ffffffffffffffff</action>
        <action>maincpu.mq@14780 = ffffffffffffffff</action>
        <action>maincpu.mq@14788 = ffffffffffffffff</action>
        <action>maincpu.mq@14790 = ffffffffffffffff</action>
        <action>maincpu.mq@14798 = ffffffffffffffff</action>
        <action>maincpu.mq@147a0 = ffffffffffffffff</action>
        <action>maincpu.mq@147a8 = ffffffffffffffff</action>
        <action>maincpu.mq@147b0 = ffffffffffffffff</action>
    </script>
</cheat>

[hamaway] Hammer Away

Posted: Sun Jan 14, 2024 3:50 am
by jman

Code: Select all

<!-- Hammer Away (Japan, prototype) -->
<mamecheat version="1">

    <cheat desc="no hit">
        <script state="on">
            <action>maincpu.md@4EAC = 70004E75</action>
        </script>
        <script state="off">
            <action>maincpu.md@4EAC = 08D10003</action>
        </script>
    </cheat>

    <cheat desc="auto fire">
        <script state="on">
            <action>maincpu.mq@0587E = 4EB9000147604E71</action>
            <action>maincpu.mq@14760 = 266C000020132200</action>
            <action>maincpu.mq@14768 = 0281030000006704</action>
            <action>maincpu.mq@14770 = 484180414E75FFFF</action>
            <!--
            14760 | 266C 0000      : movea.l ($0,A4), A3
            14764 | 2013           : move.l  (A3), D0
            14766 | 2200           : move.l  D0, D1
            14768 | 0281 0300 0000 : andi.l  #$3000000, D1
            1476E | 6704           : beq     $14774
            14770 | 4841           : swap    D1
            14772 | 8041           : or.w    D1, D0
            14774 | 4E75           : rts
            -->
        </script>
        <script state="off">
            <action>maincpu.mq@0587E = 266C0000202B0000</action>
            <action>maincpu.mq@14760 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14768 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14770 = FFFFFFFFFFFFFFFF</action>
        </script>
    </cheat>

    <cheat desc="player speed">
        <parameter>
            <item value="0x00008000">01 (slow)</item>
            <item value="0x00018000">02       </item>
            <item value="0x00028000">03       </item>
            <item value="0x00038000">04       </item>
            <item value="0x00048000">05 (fast)</item>
        </parameter>
        <script state="on">
            <action>maincpu.mq@05B1A = 78004EB900014780</action>
            <action>maincpu.mq@05B22 = 4EB90001479251CC</action>
            <action>maincpu.mq@14780 = 2A3C000000004A82</action>
            <action>maincpu.mq@14788 = 67066A0244852005</action>
            <action>maincpu.mq@14790 = 4E752A3C00000000</action>
            <action>maincpu.mq@14798 = 4A8367066A024485</action>
            <action>maincpu.mq@147A0 = 22054E75FFFFFFFF</action>
            <!--
            14780 | 2A3C xxxx xxxx : move.l  #$xxxx, D5
            14786 | 4A82           : tst.l   D2
            14788 | 6706           : beq     $14790
            1478A | 6A02           : bpl     $1478e
            1478C | 4485           : neg.l   D5
            1478E | 2005           : move.l  D5, D0
            14790 | 4E75           : rts
            14792 | 2A3C xxxx xxxx : move.l  #$xxxx, D5
            14798 | 4A83           : tst.l   D3
            1479A | 6706           : beq     $147a2
            1479C | 6A02           : bpl     $147a0
            1479E | 4485           : neg.l   D5
            147A0 | 2205           : move.l  D5, D1
            147A2 | 4E75           : rts
            -->
        </script>
        <script state="change">
            <action>maincpu.md@14782 = param</action>
            <action>maincpu.md@14794 = param</action>
        </script>
        <script state="off">
            <action>maincpu.mq@05B1A = 7804D080D281DA05</action>
            <action>maincpu.mq@05B22 = 6404D082D28351CC</action>
            <action>maincpu.mq@14780 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14788 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14790 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14798 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@147A0 = FFFFFFFFFFFFFFFF</action>
        </script>
    </cheat>

    <cheat desc="bullet speed - antiair shot">
        <parameter>
            <item value="0x0001">01 (slow)</item>
            <item value="0x0004">02       </item>
            <item value="0x0008">03       </item>
            <item value="0x000c">04       </item>
            <item value="0x0010">05 (fast)</item>
        </parameter>
        <script state="on">
            <action>maincpu.mq@059F8 = 4EB9000147B0317C</action>
            <action>maincpu.mq@147B0 = 317C00000022317C</action>
            <action>maincpu.mq@147B8 = 0002000A4E75FFFF</action>
            <!--
            147B0 | 317C xxxx 0022 : move.w  #$xx, ($22,A0)
            147B6 | 317C 0002 000A : move.w  #$2, ($a,A0)
            147BC | 4E75           : rts
            -->
        </script>
        <script state="change">
            <action>maincpu.mw@147B2 = param</action>
        </script>
        <script state="off">
            <action>maincpu.mq@059F8 = 317C0002000A317C</action>
            <action>maincpu.mq@147B0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@147B8 = FFFFFFFFFFFFFFFF</action>
        </script>
    </cheat>

    <cheat desc="fast antisurface shot">
        <script state="on">
            <action>maincpu.mq@05A1C = 4EB9000147C0222D</action>
            <action>maincpu.mq@147C0 = B1FC00FFC9326508</action>
            <action>maincpu.mq@147C8 = 064100305E680002</action>
            <action>maincpu.mq@147D0 = 4841214100064E75</action>
            <!--
            147C0 | B1FC 00FF C932 : cmpa.l  #$ffc932, A0
            147C6 | 6508           : bcs     $147d0
            147C8 | 0641 0030      : addi.w  #$30, D1
            147CC | 5E68 0002      : addq.w  #7, ($2,A0)
            147D0 | 4841           : swap    D1
            147D2 | 2141 0006      : move.l  D1, ($6,A0)
            147D6 | 4E75           : rts
            -->
        </script>
        <script state="off">
            <action>maincpu.mq@05A1C = 484121410006222D</action>
            <action>maincpu.mq@147C0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@147C8 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@147D0 = FFFFFFFFFFFFFFFF</action>
        </script>
    </cheat>

    <cheat desc="no inertia (test)">
        <script state="on">
            <action>maincpu.mq@05AE6 = 4EB9000147E06B3E</action>
            <action>maincpu.mq@147E0 = 700072001413E85A</action>
            <action>maincpu.mq@147E8 = 0242000F143B2004</action>
            <action>maincpu.mq@147F0 = 4E75FF2000FF1018</action>
            <action>maincpu.mq@147F8 = 08FF302838FFFFFF</action>
            <!--
            147E0 | 7000      : moveq   #$0, D0
            147E2 | 7200      : moveq   #$0, D1
            147E4 | 1413      : move.b  (A3), D2
            147E6 | E85A      : ror.w   #4, D2
            147E8 | 0242 000F : andi.w  #$f, D2
            147EC | 143B 2004 : move.b  ($4,PC,D2.w), D2
            147F0 | 4E75      : rts
            147F2 - 147FC     : input/direction conversion table
             input value
               00   ff   stop
               10   20   down
               20   00   up
               40   10   right
               50   18   lower-right
               60   08   upper-right
               80   30   left
               90   28   lower-left
               a0   38   upper-left
            -->
        </script>
        <script state="off">
            <action>maincpu.mq@05AE6 = 7000720014116B3E</action>
            <action>maincpu.mq@147E0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@147E8 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@147F0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@147F8 = FFFFFFFFFFFFFFFF</action>
        </script>
    </cheat>

    <cheat desc="sound test mode">
        <!-- you can't stop sample by sound stop button -->
        <comment>reset the game (F3) to enter sound test mode</comment>
        <script state="on">
            <action>maincpu.mq@00540 = 4EF9000148004EB9</action>
            <action>maincpu.mq@14800 = 41F900FF000043F9</action>
            <action>maincpu.mq@14808 = 00FE000712001039</action>
            <action>maincpu.mq@14810 = 00A00001B20067F4</action>
            <action>maincpu.mq@14818 = 0C00007F66025310</action>
            <action>maincpu.mq@14820 = 0C0000BF66025210</action>
            <action>maincpu.mq@14828 = 0C0000EF66040410</action>
            <action>maincpu.mq@14830 = 00100C0000DF6604</action>
            <action>maincpu.mq@14838 = 061000100C0000FE</action>
            <action>maincpu.mq@14840 = 660212900C0000FD</action>
            <action>maincpu.mq@14848 = 660412BC00FF60BC</action>
            <!--
            14800 | 41F9 00FF 0000 : lea     $ff0000.l, A0 // sound code address
            14806 | 43F9 00FE 0007 : lea     $fe0007.l, A1 // sound latch address
            1480C | 1200           : move.b  D0, D1
            1480E | 1039 00A0 0001 : move.b  $a00001.l, D0 // read input
            14814 | B200           : cmp.b   D0, D1
            14816 | 67F4           : beq     $1480c
            14818 | 0C00 007F      : cmpi.b  #$7f, D0
            1481C | 6602           : bne     $14820
            1481E | 5310           : subq.b  #1, (A0)      // decrease code -01
            14820 | 0C00 00BF      : cmpi.b  #-$41, D0
            14824 | 6602           : bne     $14828
            14826 | 5210           : addq.b  #1, (A0)      // increase code +01
            14828 | 0C00 00EF      : cmpi.b  #-$11, D0
            1482C | 6604           : bne     $14832
            1482E | 0410 0010      : subi.b  #$10, (A0)    // decrease code -10
            14832 | 0C00 00DF      : cmpi.b  #-$21, D0
            14836 | 6604           : bne     $1483c
            14838 | 0610 0010      : addi.b  #$10, (A0)    // increase code +10
            1483C | 0C00 00FE      : cmpi.b  #-$2, D0
            14840 | 6602           : bne     $14844
            14842 | 1290           : move.b  (A0), (A1)    // play sound
            14844 | 0C00 00FD      : cmpi.b  #-$3, D0
            14848 | 6604           : bne     $1484e
            1484A | 12BC 00FF      : move.b  #$ff, (A1)    // stop sound
            1484E | 60BC           : bra     $1480c
            -->
        </script>
        <script state="run">
            <output format="----- hammer away 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@FF0000</argument>
            </output>
        </script>
        <script state="off">
            <action>maincpu.mq@00540 = 4EB90000086C4EB9</action>
            <action>maincpu.mq@14800 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14808 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14810 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14818 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14820 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14828 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14830 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14838 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14840 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@14848 = FFFFFFFFFFFFFFFF</action>
        </script>
    </cheat>

</mamecheat>
  • "no hit", "auto fire" : Rewritten routine.
  • "player speed" : Rewritten routine. Converted parameter from value to item.
  • "no inertia" : Added new as test.
  • "sound test mode" : Rewritten routine. But you can't stop sample by sound stop button.