Page 1 of 1

[ninjakun] Ninjakun

Posted: Sun Jul 18, 2021 3:43 pm
by jman

Code: Select all

<cheat desc="no hit">
    <script state="on">
        <action>maincpu.mb@25cc = c9</action> <!-- enemy (body) -->
        <action>maincpu.mb@3206 = 18</action> <!-- bullet -->
        <action>maincpu.mb@38a3 = 18</action> <!-- enemy (flame) -->
        <action>maincpu.mb@3945 = 18</action> <!-- fire -->
        <action>maincpu.mb@3aca = c9</action> <!-- skull in bonus stage -->
    </script>
    <script state="off">
        <action>maincpu.mb@25cc = 06</action>
        <action>maincpu.mb@3206 = 38</action>
        <action>maincpu.mb@38a3 = 38</action>
        <action>maincpu.mb@3945 = 38</action>
        <action>maincpu.mb@3aca = 32</action>
    </script>
</cheat>

<cheat desc="auto fire">
    <script state="on">
        <action>maincpu.mb@2837 = 0c</action>
    </script>
    <script state="off">
        <action>maincpu.mb@2837 = 3a</action>
    </script>
</cheat>

<cheat desc="walk speed">
    <parameter min="0x01" max="0x05" step="0x01" />
    <script state="change">
        <action>maincpu.mb@265b = -param</action> <!-- left -->
        <action>maincpu.mb@2664 =  param</action> <!-- right -->
    </script>
    <script state="off">
        <action>maincpu.mb@265b = ff</action>
        <action>maincpu.mb@2664 = 01</action>
    </script>
</cheat>

<cheat desc="bullet speed">
    <parameter min="0x01" max="0x05" step="0x01" />
    <script state="change">
        <action>maincpu.mb@29a3 =  param</action> <!-- right -->
        <action>maincpu.mb@29ad = -param</action> <!-- left -->
    </script>
    <script state="off">
        <action>maincpu.mb@29a3 = 02</action>
        <action>maincpu.mb@29ad = fe</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@3c00 =             7f00</action>
        <action>maincpu.mq@7f00 = 003ae20022000021</action>
        <action>maincpu.mq@7f08 = 203efef6286fbda0</action>
        <action>maincpu.mq@7f10 = fe2401203dfe2501</action>
        <action>maincpu.mq@7f18 = 187f2ccd7c062037</action>
        <action>maincpu.mq@7f20 = cd003e05203bfe09</action>
        <action>maincpu.mq@7f28 = 043020fed7187f2c</action>
        <action>maincpu.mq@7f30 = 003220d6c9e40132</action>
        <action>maincpu.mq@7f38 = 000000000000c9e4</action>
        <!--
        7f00 | 21 00 00 : ld   hl,$0000   // initialize sound and input values
        7f03 | 22 00 e2 : ld   ($e200),hl
        7f06 | 3a 00 a0 : ld   a,($a000)  // read input
        7f09 | bd       : cp   l
        7f0a | 6f       : ld   l,a
        7f0b | 28 f6    : jr   z,$7f03
        7f0d | fe 3e    : cp   $3e
        7f0f | 20 01    : jr   nz,$7f12
        7f11 | 25       : dec  h          // decrease code
        7f12 | fe 3d    : cp   $3d
        7f14 | 20 01    : jr   nz,$7f17
        7f16 | 24       : inc  h          // increase code
        7f17 | fe 37    : cp   $37
        7f19 | 20 06    : jr   nz,$7f21
        7f1b | 7c       : ld   a,h        // play sound
        7f1c | cd 2c 7f : call $7f2c
        7f1f | 18 09    : jr   $7f2a
        7f21 | fe 3b    : cp   $3b
        7f23 | 20 05    : jr   nz,$7f2a
        7f25 | 3e 00    : ld   a,$00      // stop sound
        7f27 | cd 2c 7f : call $7f2c
        7f2a | 18 d7    : jr   $7f03
        7f2c | fe 20    : cp   $20
        7f2e | 30 04    : jr   nc,$7f34
        7f30 | 32 01 e4 : ld   ($e401),a  // in case of music, write sound code to $e401
        7f33 | c9       : ret
        7f34 | d6 20    : sub  $20
        7f36 | 32 00 e4 : ld   ($e400),a  // in case of sfx, write sound code to $e400
        7f39 | c9       : ret
        -->
        <action>sub.mb@0493 = 00</action> <!-- sound enable -->
    </script>
    <script state="run">
        <output format="----- ninjakun 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="button 2 : 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@e201</argument>
        </output>
    </script>
    <script state="off">
        <action>maincpu.mw@3c00 =             1660</action>
        <action>maincpu.mq@7f00 = 0000000000000000</action>
        <action>maincpu.mq@7f08 = 0000000000000000</action>
        <action>maincpu.mq@7f10 = 0000000000000000</action>
        <action>maincpu.mq@7f18 = 0000000000000000</action>
        <action>maincpu.mq@7f20 = 0000000000000000</action>
        <action>maincpu.mq@7f28 = 0000000000000000</action>
        <action>maincpu.mq@7f30 = 0000000000000000</action>
        <action>maincpu.mq@7f38 = 0000000000000000</action>
        <action>    sub.mb@0493 =               c0</action>
    </script>
</cheat>
<cheat desc="skip ram/rom check">
    <script state="on">
        <action>maincpu.mb@0009 = c3</action>
        <action>    sub.mb@000e = c3</action>
    </script>
    <script state="off">
        <action>maincpu.mb@0009 = c2</action>
        <action>    sub.mb@000e = c2</action>
    </script>
</cheat>

[ninjakun] Ninjakun (update)

Posted: Sun Nov 20, 2022 1:12 pm
by jman

Code: Select all

<cheat desc="timer speed">
    <parameter>
        <item value="0xff">01 (slow)</item>
        <item value="0x80">02       </item>
        <item value="0x40">03       </item>
        <item value="0x1e">04       </item>
        <item value="0x01">05 (fast)</item>
    </parameter>
    <script state="change">
        <action>maincpu.mb@377e = param</action>
    </script>
    <script state="off">
        <action>maincpu.mb@377e = 1e</action>
    </script>
</cheat>
"timer speed" : add new

Code: Select all

<cheat desc="sound test mode">
    <comment>set &quot;skip ram/rom check&quot; then reset the game (F3)</comment>
    <script state="on">
        <action>maincpu.mb@00f6 =               15</action> <!-- disable score display -->
        <action>maincpu.mw@3c00 =             7f00</action>
        <action>maincpu.mq@7f00 = 47b8a0003ae20021</action>
        <action>maincpu.mq@7f08 = fe3501203efef928</action>
        <action>maincpu.mq@7f10 = 04201efe3401203d</action>
        <action>maincpu.mq@7f18 = 05201dfe0618f03e</action>
        <action>maincpu.mq@7f20 = 2037fe787786103e</action>
        <action>maincpu.mq@7f28 = 0c203bfe05187e03</action>
        <action>maincpu.mq@7f30 = 033820fee40111af</action>
        <action>maincpu.mq@7f38 = 0000c518121b20d6</action>
        <!--
        7f00 | 21 00 e2 : ld  hl,$E200  // sound code address
        7f03 | 3a 00 a0 : ld  a,($A000) // read input
        7f06 | b8       : cp  b
        7f07 | 47       : ld  b,a
        7f08 | 28 f9    : jr  z,$7F03
        7f0a | fe 3e    : cp  $3E
        7f0c | 20 01    : jr  nz,$7F0F
        7f0e | 35       : dec (hl)      // decrease code -01
        7f0f | fe 3d    : cp  $3D
        7f11 | 20 01    : jr  nz,$7F14
        7f13 | 34       : inc (hl)      // increase code +01
        7f14 | fe 1e    : cp  $1E
        7f16 | 20 04    : jr  nz,$7F1C
        7f18 | 3e f0    : ld  a,$F0     // decrease code -10
        7f1a | 18 06    : jr  $7F22
        7f1c | fe 1d    : cp  $1D
        7f1e | 20 05    : jr  nz,$7F25
        7f20 | 3e 10    : ld  a,$10     // increase code +10
        7f22 | 86       : add a,(hl)
        7f23 | 77       : ld  (hl),a
        7f24 | 78       : ld  a,b
        7f25 | fe 37    : cp  $37
        7f27 | 20 03    : jr  nz,$7F2C
        7f29 | 7e       : ld  a,(hl)    // play sound
        7f2a | 18 05    : jr  $7F31
        7f2c | fe 3b    : cp  $3B
        7f2e | 20 0c    : jr  nz,$7F3C
        7f30 | af       : xor a         // stop sound
        7f31 | 11 01 e4 : ld  de,$E401
        7f34 | fe 20    : cp  $20
        7f36 | 38 03    : jr  c,$7F3B
        7f38 | d6 20    : sub $20
        7f3a | 1b       : dec de
        7f3b | 12       : ld  (de),a    // music = $e401, sfx = $e400
        7f3c | 18 c5    : jr  $7F03
        -->
        <action>sub.mb@0493 = 00</action> <!-- enable sound -->
    </script>
    <script state="run">
        <output format="----- ninjakun 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="start + left : decrease code -10"     line="13" align="center" />
        <output format="start + right : 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@e200</argument>
        </output>
    </script>
    <script state="off">
        <action>maincpu.mb@00f6 =               16</action>
        <action>maincpu.mw@3c00 =             1660</action>
        <action>maincpu.mq@7f00 = 0000000000000000</action>
        <action>maincpu.mq@7f08 = 0000000000000000</action>
        <action>maincpu.mq@7f10 = 0000000000000000</action>
        <action>maincpu.mq@7f18 = 0000000000000000</action>
        <action>maincpu.mq@7f20 = 0000000000000000</action>
        <action>maincpu.mq@7f28 = 0000000000000000</action>
        <action>maincpu.mq@7f30 = 0000000000000000</action>
        <action>maincpu.mq@7f38 = 0000000000000000</action>
        <action>    sub.mb@0493 =               c0</action>
    </script>
</cheat>
"sound test mode" : rewrite routine. add "start + left/right" combination input (code ±10) because this game doesn't have up/down key.