SNES Development
Xkas Patching Example

Below is an example of using Xkas to patch an existing game. The game is Super Mario World and the patch was coded by Videogamer555, you can also view the original thread.

Firstly you need the SMW ROM without a header, and should expand the ROM to 8Mbits using Lunar Expand or with a Hex Editor. The cheats effect that we will be coding is rather extensive. When you grab a coin instead of increasing the coin count it: gives you 99 lives, set the timer to 999, gives you the Cape and sets the item reserve box to contain the Fire Flower.

Since every coin (including Yoshi coins) triggers the cheat, that means that the coin you get at the end when you pass through the end-of-level gate will set your time to 999, meaning you automatically complete the level with an impossibly high time. Since the total time you beat a level in adds to your game’s score, it means you can easily get record-breaking scores.

This patch has been tested on a UFO Super Drive Pro 8 (an SNES copier) and has been verified work properly even on a real SNES.

lorom ;set Kxas to lo-rom mapping

ORG $808F25 ; coin-handling programming starts here
CLC         ; clears the carry bit, but is needed as a one-byte command with little overall effect,
            ; to make sure the desired command lines up on the correct byte
CLC         ; as the normal coin-handling code I'm replacing is exactly 6bytes long,
            ; thus 2 CLCs and then the JMP command which in total also occupies 6bytes
JMP $908000 ; goes to the code I've added in the expanded part of the rom

ORG $908000 ; cheat programming starts here
LDA #$09    ; put the number 9 in the accumulator
STA $0F31   ; put the accumulator value 9 in the timer's 100s digit
STA $0F32   ; put the accumulator value 9 in the timer's 10s digit
STA $0F33   ; put the accumulator value 9 in the timer's 1s digit
LDA #$02    ; put the number 2 in the accumulator
STA $0019   ; put the accumulator value 2 in the memory location for currently active item, and 2 corresponds to the cape
STA $0DC2   ; put the accumulator value 2 in the memory location for currently reserve item, and 2 corresponds to the Fire Flower here
LDA #$63    ; put the number 99 in the accumulator
STA $0DBE   ; put the accumulator value 99 in the memory location for current number of lives
JMP $808F2B ; go back to the next line in the game's main code, so game can continue