Hello and welcome to the Super Mario World ASM page! We will first sstart out with a custom block.


This is the easiest part of Assembler. To load a specific value into a variable called The Accumulator ("A"), you use LDA (Load Data to Accumulator). To load that value into a specific address on the RAM Map of the ROM, use STA (Store data from Accumulator). Here's an example:

LDA #$00  ;Load 00 into "A". Notice the # before the $? This means we're loading a Hex value, not an address in the RAM Map.
STA $19  ;Store "A" (00) into RAM Address 19, which is Mario's powerup status. 00 means Small Mario.
RTS  ;Beware of that! It stands for "Return from Subroutine". If you don't put it, then the game will crash.


Let's make a block that acts pretty much as the midaway point. Let's make Mario big, only if he's small. For this, we need 2 new command. CMP (CoMPare), and BEQ. Here's an example:

LDA $19  ;Load Mario's powerup status into "A"
CMP #$00  ;If Mario is small then...
BEQ MakeBig  ;Branch! Also, the thing you type at the end is a '''label'''. You must have it.
RTS  ;If Mario isn't small, then return
MakeBig:  ;See how I set up this?
LDA #$01  ;Load 01 into "A"
STA $19  ;Load it into RAM address 19.
RTS  ;Finish the code.

ENDING! I hope this helps.


Now, let's move on... CREATING PATCHES!!! So, how do you set up a code? Like that:


Let me explain. "header" means that the ROM has a header, which it should. "lorom" means that your ROM is smaller then 4MB. If it is bigger, then use "hirom", but Lunar Magic can't even open those.

HEX Editing through ASMEdit

Let's say we want to switch "Mario Start !" and "Luigi Start !". Well, first we need to jump to the address. We use "org" for that. To change the address, use "db". Type it like that:


org $013DB
db $D0

This is it.

Community content is available under CC-BY-SA unless otherwise noted.