Skip to content

Commit

Permalink
Fix a crash when Kevin's VRAM optimization patch is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernap committed Feb 12, 2023
1 parent 88c534b commit c4ab006
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions assets/asm/base/gamemode.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ endmacro
;db "tool"

CallGamemode:
pla : pla ; kill the return address of the jsr that went here -- we're in a different bank and jumping directly back
phb

ldx #$02 ; offset for main
Expand Down Expand Up @@ -54,7 +53,7 @@ CallGamemode:
endif
phk
pea .End-1
pea $84CF-1
pea $84CF-1 ; rtl
jml [!dp] ; game mode routines end in rts, so we need this

.End:
Expand All @@ -64,4 +63,4 @@ CallGamemode:
plb

; return from hijack
jml $008075|!bank
jml $009326|!bank
6 changes: 5 additions & 1 deletion assets/asm/base/main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ org $00A18F

; handles all of main, init, end
org $009322
autoclean JML CallGamemode
autoclean jml CallGamemode

; this is new as of 2.0, so we can return here after gamemode end:, maintaining compatibility with kevin's vram optimization patch
rts
nop #2

; this handles both uberasm initializaiton, as well as calling the init: label for the global code file
org $00804E
Expand Down

0 comments on commit c4ab006

Please sign in to comment.