10-18-2026, 01:51 AM
So I finished the level design of Realm 4-1, the next level involves mycology, the plumber can't just consume everything that he finds in his way:
![[Image: jips-animation-13.webp]](https://i.postimg.cc/90Zsg73c/jips-animation-13.webp)
Now explaining a bit about the custom codes: in the start of the freespace I use the opcode $89, that's an unofficial opcode which just read an immediate byte and skip it (like a NOP with a single argument), I use it as a freespace signature, to make it easier to find in a hex editor, here's the macro I use:
Then in the end of the freespace I use this macro to assert if the custom code size can fit in the freespace (to prevent overflow), if the assembled code is too big the Asar assembler gives an error (I use another unofficial NOP as a canary value):
![[Image: jips-animation-13.webp]](https://i.postimg.cc/90Zsg73c/jips-animation-13.webp)
Now explaining a bit about the custom codes: in the start of the freespace I use the opcode $89, that's an unofficial opcode which just read an immediate byte and skip it (like a NOP with a single argument), I use it as a freespace signature, to make it easier to find in a hex editor, here's the macro I use:
Code:
macro begin_signature(sub_id)
db $89,<sub_id> ; 2-byte unofficial NOP
endmacroThen in the end of the freespace I use this macro to assert if the custom code size can fit in the freespace (to prevent overflow), if the assembled code is too big the Asar assembler gives an error (I use another unofficial NOP as a canary value):
Code:
macro end_signature(end_label)
assert pc() < <end_label>,"<end_label> overflow detected!"
db $da ; unofficial NOP
endmacro
Check out my SMB1 Hack development thread: Journey Into Plumber Subconscious


![[-]](https://forums.mfgg.net/images/skins/boo/collapse.png)
![[Image: CourseClear.gif]](https://dl.dropbox.com/s/d5mcpm4nmt0gd14/CourseClear.gif)