Page 1 of 1

[battlex] Battle Cross

Posted: Mon Jun 30, 2025 9:42 am
by jman
battlex.xml

Code: Select all

<!-- Battle Cross -->
<mamecheat version="1">

    <cheat desc="no hit">
        <script state="on">
            <action>maincpu.mb@129E = 18</action> <!-- objects -->
            <action>maincpu.mb@24CC = C9</action> <!-- laser ship (scene 4) -->
            <action>maincpu.mb@2DB0 = 18</action> <!-- asteroid (scene 2) -->
            <action>maincpu.mb@2F77 = 18</action> <!-- planet (scene 3) -->
        </script>
        <script state="off">
            <action>maincpu.mb@129E = 28</action>
            <action>maincpu.mb@24CC = C8</action>
            <action>maincpu.mb@2DB0 = 28</action>
            <action>maincpu.mb@2F77 = 28</action>
        </script>
    </cheat>

    <cheat desc="rapid fire">
        <!-- upright 1P and 2P : 1P start button -->
        <!-- cocktail 1P : 1P start button -->
        <!-- cocktail 2P : 2P start button -->
        <comment>hold 1P or 2P start button</comment>
        <script state="on">
            <action>maincpu.mw@07A1 = 4A50            </action>
            <action>maincpu.mq@4A50 = 6FCB00DBF51508CD</action>
            <action>maincpu.mq@4A58 = A7A08C3A08201006</action>
            <action>maincpu.mq@4A60 = 20A001DB20060228</action>
            <action>maincpu.mq@4A68 = FFFFC9AFF1C9F102</action>
            <!--
            4A50 | CD 08 15 : call $1508
            4A53 | F5       : push af
            4A54 | DB 00    : in   a,($00)   // check cabinet type
            4A56 | CB 6F    : bit  5,a
            4A58 | 06 10    : ld   b,$10
            4A5A | 20 08    : jr   nz,$4A64
            4A5C | 3A 8C A0 : ld   a,($A08C) // cocktail
            4A5F | A7       : and  a
            4A60 | 28 02    : jr   z,$4A64
            4A62 | 06 20    : ld   b,$20
            4A64 | DB 01    : in   a,($01)   // read start button
            4A66 | A0       : and  b
            4A67 | 20 02    : jr   nz,$4A6B
            4A69 | F1       : pop  af
            4A6A | C9       : ret
            4A6B | F1       : pop  af
            4A6C | AF       : xor  a
            4A6D | C9       : ret
            -->
        </script>
        <script state="off">
            <action>maincpu.mw@07A1 = 1508            </action>
            <action>maincpu.mq@4A50 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4A58 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4A60 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4A68 = FFFFFFFFFFFFFFFF</action>
        </script>
    </cheat>

    <cheat desc="player speed">
        <parameter>
            <item value="0x01">01 (slow)</item>
            <item value="0x02">02       </item>
            <item value="0x04">03       </item>
            <item value="0x06">04       </item>
            <item value="0x08">05 (fast)</item>
        </parameter>
        <script state="on">
            <action>maincpu.mw@076E = 4A70</action>
            <action>maincpu.mq@4A70 = 267CCB0828A77C4F</action>
            <action>maincpu.mq@4A78 = 28A77D0026022800</action>
            <action>maincpu.mq@4A80 = 2E0228002E7DCB08</action>
            <action>maincpu.mq@4A88 = FFFFFF07F7C37900</action>
            <!--
            4A70 | 4F       : ld   c,a
            4A71 | 7C       : ld   a,h
            4A72 | A7       : and  a
            4A73 | 28 08    : jr   z,$4A7D
            4A75 | CB 7C    : bit  7,h     // y axis
            4A77 | 26 xx    : ld   h,$xx
            4A79 | 28 02    : jr   z,$4A7D
            4A7B | 26 xx    : ld   h,$xx
            4A7D | 7D       : ld   a,l
            4A7E | A7       : and  a
            4A7F | 28 08    : jr   z,$4A89
            4A81 | CB 7D    : bit  7,l     // x axis
            4A83 | 2E xx    : ld   l,$xx
            4A85 | 28 02    : jr   z,$4A89
            4A87 | 2E xx    : ld   l,$xx
            4A89 | 79       : ld   a,c
            4A8A | C3 F7 07 : jp   $07F7
            -->
        </script>
        <script state="change">
            <action>maincpu.mb@4A78 =  param</action>
            <action>maincpu.mb@4A7C = -param</action>
            <action>maincpu.mb@4A84 =  param</action>
            <action>maincpu.mb@4A88 = -param</action>
        </script>
        <script state="off">
            <action>maincpu.mw@076E = 07F7            </action>
            <action>maincpu.mq@4A70 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4A78 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4A80 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4A88 = FFFFFFFFFFFFFFFF</action>
        </script>
    </cheat>

    <cheat desc="fuel speed">
        <parameter>
            <item value="0xFF">01 (slow)</item>
            <item value="0x7F">02       </item>
            <item value="0x3F">03       </item>
            <item value="0x0F">04       </item>
            <item value="0x00">05 (fast)</item>
        </parameter>
        <script state="change">
            <action>maincpu.mb@0833 = param</action>
        </script>
        <script state="off">
            <action>maincpu.mb@0833 = 0F</action>
        </script>
    </cheat>

    <cheat desc="sound test mode (test)">
        <comment>reset the game (F3) to enter sound test mode</comment>
        <script state="on">
            <action>maincpu.mw@3450 = 4A90            </action>
            <action>maincpu.mq@4A90 = 0714E601DBA00121</action>
            <action>maincpu.mq@4A98 = B00FE602DB470707</action>
            <action>maincpu.mq@4AA0 = 2008FE2BEF2877BE</action>
            <action>maincpu.mq@4AA8 = FE34012002FE3501</action>
            <action>maincpu.mq@4AB0 = FE0618F03E042004</action>
            <action>maincpu.mq@4AB8 = 187786103E062001</action>
            <action>maincpu.mq@4AC0 = 17FE7E132020FE21</action>
            <action>maincpu.mq@4AC8 = 1829B7CD00060730</action>
            <action>maincpu.mq@4AD0 = 0A184AE4CD17D611</action>
            <action>maincpu.mq@4AD8 = CD432C21062080FE</action>
            <action>maincpu.mq@4AE0 = 210720A7AC18260F</action>
            <action>maincpu.mq@4AE8 = 01FEC9260FCD4459</action>
            <action>maincpu.mq@4AF0 = 02FEC92AEDCD0420</action>
            <action>maincpu.mq@4AF8 = 03FEC92B26CD0420</action>
            <action>maincpu.mq@4B00 = 04FEC92D47CD0420</action>
            <action>maincpu.mq@4B08 = FFC9C930BDCD0420</action>
            <!--
            4A90 | 21 01 A0 : ld   hl,$A001 // temporary input address
            4A93 | DB 01    : in   a,($01)  // read buttons
            4A95 | E6 14    : and  $14
            4A97 | 07       : rlca
            4A98 | 07       : rlca
            4A99 | 07       : rlca
            4A9A | 47       : ld   b,a
            4A9B | DB 02    : in   a,($02)  // read other inputs
            4A9D | E6 0F    : and  $0F
            4A9F | B0       : or   b
            4AA0 | BE       : cp   (hl)
            4AA1 | 77       : ld   (hl),a
            4AA2 | 28 EF    : jr   z,$4A93
            4AA4 | 2B       : dec  hl       // sound code address ($A000)
            4AA5 | FE 08    : cp   $08
            4AA7 | 20 01    : jr   nz,$4AAA
            4AA9 | 35       : dec  (hl)     // decrease code -01
            4AAA | FE 02    : cp   $02
            4AAC | 20 01    : jr   nz,$4AAF
            4AAE | 34       : inc  (hl)     // increase code +01
            4AAF | FE 04    : cp   $04
            4AB1 | 20 04    : jr   nz,$4AB7
            4AB3 | 3E F0    : ld   a,$F0    // decrease code -10
            4AB5 | 18 06    : jr   $4ABD
            4AB7 | FE 01    : cp   $01
            4AB9 | 20 06    : jr   nz,$4AC1
            4ABB | 3E 10    : ld   a,$10    // increase code +10
            4ABD | 86       : add  a,(hl)
            4ABE | 77       : ld   (hl),a
            4ABF | 18 21    : jr   $4AE2
            4AC1 | FE 20    : cp   $20
            4AC3 | 20 13    : jr   nz,$4AD8
            4AC5 | 7E       : ld   a,(hl)   // play sound
            4AC6 | FE 17    : cp   $17
            4AC8 | 30 07    : jr   nc,$4AD1
            4ACA | 06 00    : ld   b,$00    // single channel
            4ACC | CD B7 29 : call $29B7
            4ACF | 18 11    : jr   $4AE2
            4AD1 | D6 17    : sub  $17      // code 0x17 or later are mixed channel
            4AD3 | CD E4 4A : call $4AE4
            4AD6 | 18 0A    : jr   $4AE2
            4AD8 | FE 80    : cp   $80
            4ADA | 20 06    : jr   nz,$4AE2
            4ADC | 21 2C 43 : ld   hl,$432C // stop sound
            4ADF | CD 0F 26 : call $260F
            4AE2 | 18 AC    : jr   $4A90
            4AE4 | A7       : and  a        // handling mixed channel routine
            4AE5 | 20 07    : jr   nz,$4AEE
            4AE7 | 21 59 44 : ld   hl,$4459 // code 0x17 : explosion sound
            4AEA | CD 0F 26 : call $260F
            4AED | C9       : ret
            4AEE | FE 01    : cp   $01
            4AF0 | 20 04    : jr   nz,$4AF6
            4AF2 | CD ED 2A : call $2AED    // code 0x18 : take off
            4AF5 | C9       : ret
            4AF6 | FE 02    : cp   $02
            4AF8 | 20 04    : jr   nz,$4AFE
            4AFA | CD 26 2B : call $2B26    // code 0x19 : scene 1
            4AFD | C9       : ret
            4AFE | FE 03    : cp   $03
            4B00 | 20 04    : jr   nz,$4B06
            4B02 | CD 47 2D : call $2D47    // code 0x1A : scene 2
            4B05 | C9       : ret
            4B06 | FE 04    : cp   $04
            4B08 | 20 04    : jr   nz,$4B0E
            4B0A | CD BD 30 : call $30BD    // code 0x1B : scene 4
            4B0D | C9       : ret
            4B0E | C9       : ret           // to do : other mixed channel sound...
            -->
            <!-- sound routine stopper -->
            <action>maincpu.mb@2AFF = C9</action> <!-- take off -->
            <action>maincpu.mb@2B35 = C9</action> <!-- scene 1 -->
            <action>maincpu.mb@2D56 = C9</action> <!-- scene 2 -->
            <action>maincpu.mb@30CC = C9</action> <!-- scene 4 -->
        </script>
        <script state="run">
            <output format="----- 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 %02X &gt;&gt;" line="19" align="center"  >
                <argument>maincpu.pb@A000</argument>
            </output>
        </script>
        <script state="off">
            <action>maincpu.mw@3450 = 156A            </action>
            <action>maincpu.mq@4A90 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4A98 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AA0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AA8 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AB0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AB8 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AC0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AC8 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AD0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AD8 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AE0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AE8 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AF0 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4AF8 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4B00 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mq@4B08 = FFFFFFFFFFFFFFFF</action>
            <action>maincpu.mb@2AFF = CD              </action>
            <action>maincpu.mb@2B35 = 21              </action>
            <action>maincpu.mb@2D56 = CD              </action>
            <action>maincpu.mb@30CC = CD              </action>
        </script>
    </cheat>

</mamecheat>
  • "rapid fire" : Due to limitation of fire button input, rapid fire is enabled by start button.
    • cabinet type = upright : both players use 1P start button.
    • cabinet type = cocktail and player = 1 : 1P start button.
    • cabinet type = cocktail and player = 2 : 2P start button.
  • "sound test mode" : Test code. You can't play "ALL" sounds (for example, missing scene 3 music). Some sub-routines are called directly with parameter or address to play sound instead of sound code. And you need to call the same sub-routines multiple times with different parameter in case of "mixed" channel sound (for example, scene music). Anyway I try searching but it's very difficult.