Page 1 of 1

[chameleo] Chameleon

Posted: Mon Dec 13, 2021 10:03 am
by jman

Code: Select all

<cheat desc="no hit">
    <script state="on">
        <action>maincpu.mb@696d = 60</action> <!-- chiken/egg -->
        <action>maincpu.mb@7854 = 60</action> <!-- ball -->
    </script>
    <script state="off">
        <action>maincpu.mb@696d = a9</action>
        <action>maincpu.mb@7854 = a9</action>
    </script>
</cheat>

<cheat desc="player speed">
    <parameter min="0x01" max="0x05" step="0x01" />
    <script state="on">
        <action>maincpu.mw@52b9 =             41b0</action>
        <action>maincpu.mq@41b0 = 02d001a904108ea5</action>
        <action>maincpu.mq@41b8 = aa685af5204800a9</action>
        <action>maincpu.mq@41c0 = ffffff60f6d08aca</action>
        <!--
        41b0 | a5 8e    : lda $8e
        41b2 | 10 04    : bpl $41b8
        41b4 | a9 01    : lda #$01
        41b6 | d0 02    : bne $41ba
        41b8 | a9 xx    : lda #$xx
        41ba | 48       : pha
        41bb | 20 f5 5a : jsr $5af5
        41be | 68       : pla
        41bf | aa       : tax
        41c0 | ca       : dex
        41c1 | 8a       : txa
        41c2 | d0 f6    : bne $41ba
        41c4 | 60       : rts
        -->
    </script>
    <script state="change">
        <action>maincpu.mb@41b9 = param</action>
    </script>
    <script state="off">
        <action>maincpu.mw@52b9 =             5af5</action>
        <action>maincpu.mq@41b0 = ffffffffffffffff</action>
        <action>maincpu.mq@41b8 = ffffffffffffffff</action>
        <action>maincpu.mq@41c0 = ffffffffffffffff</action>
    </script>
</cheat>

<cheat desc="sound test mode">
    <script state="on">
        <action>maincpu.mw@4090 =             b1e0</action>
        <action>maincpu.mq@b1e0 = 8184808600a000a2</action>
        <action>maincpu.mq@b1e8 = f4f081c5a81804ad</action>
        <action>maincpu.mq@b1f0 = d001c9ca01d002c9</action>
        <action>maincpu.mq@b1f8 = 4c8a04d010c9e801</action>
        <action>maincpu.mq@b200 = 40a905d004c9b208</action>
        <action>maincpu.mq@b208 = ffffb1e44c18008d</action>
        <!--
        b1e0 | a2 00    : ldx #$00   // initialize sound value
        b1e2 | a0 00    : ldy #$00   // initialize input value
        b1e4 | 86 80    : stx $80
        b1e6 | 84 81    : sty $81
        b1e8 | ad 04 18 : lda $1804  // read input
        b1eb | a8       : tay
        b1ec | c5 81    : cmp $81
        b1ee | f0 f4    : beq $b1e4
        b1f0 | c9 02    : cmp #$02
        b1f2 | d0 01    : bne $b1f5
        b1f4 | ca       : dex        // decrease code
        b1f5 | c9 01    : cmp #$01
        b1f7 | d0 01    : bne $b1fa
        b1f9 | e8       : inx        // increase code
        b1fa | c9 10    : cmp #$10
        b1fc | d0 04    : bne $b202
        b1fe | 8a       : txa        // play sound
        b1ff | 4c 08 b2 : jmp $b208
        b202 | c9 04    : cmp #$04
        b204 | d0 05    : bne $b20b
        b206 | a9 40    : lda #$40   // stop sound
        b208 | 8d 00 18 : sta $1800
        b20b | 4c e4 b1 : jmp $b1e4
        -->
    </script>
    <script state="run">
        <output format="----- chameleon sound test mode -----" line="10" align="center" />
        <output format="left : decrease code"                  line="11" align="center" />
        <output format="right : increase code"                 line="12" align="center" />
        <output format="button 1 : play sound"                 line="13" align="center" />
        <output format="up : stop sound"                       line="14" align="center" />
        <output format="----------------------------"          line="15" align="center" />
        <output format="&lt;&lt; sound code %2.2X &gt;&gt;"    line="17" align="center">
            <argument>maincpu.pb@0080</argument>
        </output>
    </script>
    <script state="off">
        <action>maincpu.mw@4090 =             4054</action>
        <action>maincpu.mq@b1e0 = ffffffffffffffff</action>
        <action>maincpu.mq@b1e8 = ffffffffffffffff</action>
        <action>maincpu.mq@b1f0 = ffffffffffffffff</action>
        <action>maincpu.mq@b1f8 = ffffffffffffffff</action>
        <action>maincpu.mq@b200 = ffffffffffffffff</action>
        <action>maincpu.mq@b208 = ffffffffffffffff</action>
    </script>
</cheat>
The following code is test. Some problems occur.

Code: Select all

<cheat desc="walk free (test)">
    <script state="on">
        <action>maincpu.mb@5e99 = 00</action>
        <action>maincpu.mb@5ac1 = 00</action>
        <action>maincpu.mb@5f63 = c8</action>
        <action>maincpu.mb@5f2b = 00</action>
    </script>
    <script state="off">
        <action>maincpu.mb@5e99 = 20</action>
        <action>maincpu.mb@5ac1 = 03</action>
        <action>maincpu.mb@5f63 = 00</action>
        <action>maincpu.mb@5f2b = 21</action>
    </script>
</cheat>

[chameleo] Chameleon

Posted: Wed Dec 06, 2023 10:15 am
by jman

Code: Select all

<!-- Chameleon -->
<mamecheat version="1">

    <cheat desc="no hit">
        <script state="on">
            <action>maincpu.mb@696D = 60</action> <!-- chiken/egg -->
            <action>maincpu.mb@7854 = 60</action> <!-- ball -->
        </script>
        <script state="off">
            <action>maincpu.mb@696D = A9</action>
            <action>maincpu.mb@7854 = A9</action>
        </script>
    </cheat>

    <cheat desc="player speed">
        <parameter min="0x01" max="0x05" step="0x01" />
        <script state="on">
            <action>maincpu.mw@52B9 = 41B0            </action>
            <action>maincpu.mq@41B0 = 02D001A904108EA5</action>
            <action>maincpu.mq@41B8 = AA685AF5204800A9</action>
            <action>maincpu.mq@41C0 = FFFFFF60F6D08ACA</action>
            <!--
            41B0 | A5 8E    : lda $8e   // check auto move flag
            41B2 | 10 04    : bpl $41b8
            41B4 | A9 01    : lda #$01
            41B6 | D0 02    : bne $41ba
            41B8 | A9 xx    : lda #$xx
            41BA | 48       : pha
            41BB | 20 F5 5A : jsr $5af5 // call move routine
            41BE | 68       : pla
            41BF | AA       : tax
            41C0 | CA       : dex
            41C1 | 8A       : txa
            41C2 | D0 F6    : bne $41ba
            41C4 | 60       : rts
            -->
        </script>
        <script state="change">
            <action>maincpu.mb@41B9 = param</action>
        </script>
        <script state="off">
            <action>maincpu.mw@52B9 = 5AF5            </action>
            <action>maincpu.mq@41B0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@41B8 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@41C0 = FFFFFFFFFFFFFFFF</action>
        </script>
    </cheat>

    <cheat desc="walk free (buggy)">
        <script state="on">
            <action>maincpu.mb@5AC1 = 00</action>
            <action>maincpu.mb@5E99 = 00</action>
            <action>maincpu.mb@5F63 = C8</action>
            <action>maincpu.mb@5F2B = 00</action>
        </script>
        <script state="off">
            <action>maincpu.mb@5E99 = 20</action>
            <action>maincpu.mb@5AC1 = 03</action>
            <action>maincpu.mb@5F63 = 00</action>
            <action>maincpu.mb@5F2B = 21</action>
        </script>
    </cheat>

    <cheat desc="sound test mode">
        <comment>reset the game (F3) to enter sound test mode</comment>
        <script state="on">
            <action>maincpu.mw@4090 = B1E0            </action>
            <action>maincpu.mq@B1E0 = 8580291807AD8184</action>
            <action>maincpu.mq@B1E8 = C4A882051804AD82</action>
            <action>maincpu.mq@B1F0 = D002C080A6EDF081</action>
            <action>maincpu.mq@B1F8 = C0E801D001C0CA01</action>
            <action>maincpu.mq@B200 = AA10E9388A05D008</action>
            <action>maincpu.mq@B208 = 1069188A05D004C0</action>
            <action>maincpu.mq@B210 = C006F010C08086AA</action>
            <action>maincpu.mq@B218 = 18008E40A205D080</action>
            <action>maincpu.mq@B220 = FFFFFFFFFFB1E04C</action>
            <!--
            B1E0 | 84 81    : sty $81
            B1E2 | AD 07 18 : lda $1807 // read start button
            B1E5 | 29 80    : and #$80
            B1E7 | 85 82    : sta $82
            B1E9 | AD 04 18 : lda $1804 // read other inputs
            B1EC | 05 82    : ora $82
            B1EE | A8       : tay
            B1EF | C4 81    : cpy $81
            B1F1 | F0 ED    : beq $b1e0
            B1F3 | A6 80    : ldx $80
            B1F5 | C0 02    : cpy #$02
            B1F7 | D0 01    : bne $b1fa
            B1F9 | CA       : dex       // decrease code -01
            B1FA | C0 01    : cpy #$01
            B1FC | D0 01    : bne $b1ff
            B1FE | E8       : inx       // increase code +01
            B1FF | C0 08    : cpy #$08
            B201 | D0 05    : bne $b208
            B203 | 8A       : txa       // decrease code -10
            B204 | 38       : sec
            B205 | E9 10    : sbc #$10
            B207 | AA       : tax
            B208 | C0 04    : cpy #$04
            B20A | D0 05    : bne $b211
            B20C | 8A       : txa       // increase code +10
            B20D | 18       : clc
            B20E | 69 10    : adc #$10
            B210 | AA       : tax
            B211 | 86 80    : stx $80
            B213 | C0 10    : cpy #$10
            B215 | F0 06    : beq $b21d // play sound
            B217 | C0 80    : cpy #$80
            B219 | D0 05    : bne $b220
            B21B | A2 40    : ldx #$40  // stop sound
            B21D | 8E 00 18 : stx $1800 // send sound code
            B220 | 4C E0 B1 : jmp $b1e0
            -->
            <!-- stop sfx and music at the same time -->
            <action>audiocpu.md@7E09 = 857F2020        </action>
            <action>audiocpu.mq@7F20 = 03D040C9AAB005AD</action>
            <action>audiocpu.mq@7F28 = FFFFFF608A788420</action>
            <!--
            7F20 | AD 05 B0 : lda $b005
            7F23 | AA       : tax
            7F24 | C9 40    : cmp #$40
            7F26 | D0 03    : bne $7f2b
            7F28 | 20 84 78 : jsr $7884
            7F2B | 8A       : txa
            7F2C | 60       : rts
            -->
        </script>
        <script state="run">
            <output format="----- chameleon 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="1P start : 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@0080</argument>
            </output>
        </script>
        <script state="off">
            <action> maincpu.mw@4090 = 4054            </action>
            <action> maincpu.mq@B1E0 = FFFFFFFFFFFFFFFF</action>
            <action> maincpu.mq@B1E8 = FFFFFFFFFFFFFFFF</action>
            <action> maincpu.mq@B1F0 = FFFFFFFFFFFFFFFF</action>
            <action> maincpu.mq@B1F8 = FFFFFFFFFFFFFFFF</action>
            <action> maincpu.mq@B200 = FFFFFFFFFFFFFFFF</action>
            <action> maincpu.mq@B208 = FFFFFFFFFFFFFFFF</action>
            <action> maincpu.mq@B210 = FFFFFFFFFFFFFFFF</action>
            <action> maincpu.mq@B218 = FFFFFFFFFFFFFFFF</action>
            <action> maincpu.mq@B220 = FFFFFFFFFFFFFFFF</action>
            <action>audiocpu.md@7E09 = 85B005AD        </action>
            <action>audiocpu.mq@7F20 = FFFFFFFFFFFFFFFF</action>
            <action>audiocpu.mq@7F28 = FFFFFFFFFFFFFFFF</action>
        </script>
    </cheat>

</mamecheat>
"sound test mode" : Rewritten routine. Added up/down key to select sound code ±10. Changed sound stop button from up to start. Fixed sound stop problem.