Created
September 19, 2025 21:33
-
-
Save PhoenixBound/4f023e4a845452f0ccf74a64da34b1c7 to your computer and use it in GitHub Desktop.
"Threed tent glitch" or "check area glitch" bug fix for EarthBound
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Tent glitch fix by PhoenixBound | |
| // Last updated 2025-09-18 | |
| import asm65816 | |
| // Edit to C07477 / getMapObjectAt: add bounds checking | |
| ROM[0xC07482] = JSL (bounds_check_door_coords) | |
| bounds_check_door_coords: { | |
| // A = tile X coordinate, X = tile Y coordinate | |
| // EB's map is 1024x1280 minitiles in size, so the coordinates should always be in those bounds | |
| CMP_i (1024) | |
| BCS (10) | |
| CPX_i (1280) | |
| BCS (5) | |
| // Original code | |
| STY_d (0x10) | |
| STA_d (0x0E) | |
| RTL | |
| _bail: | |
| // Return (signed char)-1 to the calling function (pulling 3 extra bytes off the stack for the JSL that got us here) | |
| SEP (0x20) | |
| PLA | |
| PLX | |
| LDA_8 (-1) | |
| PLD | |
| RTL | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment