From 0986626f38ce64adaa9a19991124d60082a094f1 Mon Sep 17 00:00:00 2001 From: Justin Scofield Date: Mon, 30 May 2022 23:12:35 -0400 Subject: [PATCH] Book of Mudora reveals secrets hack --- Book/book.asm | 10 ++++++++++ Book/reveal_secrets.asm | 44 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 Book/book.asm create mode 100644 Book/reveal_secrets.asm diff --git a/Book/book.asm b/Book/book.asm new file mode 100644 index 0000000..4177623 --- /dev/null +++ b/Book/book.asm @@ -0,0 +1,10 @@ +;=========================================================== +; Book of Secrets +; +; +;=========================================================== + +namespace Book +{ + incsrc "reveal_secrets.asm" +} ; namespace Book \ No newline at end of file diff --git a/Book/reveal_secrets.asm b/Book/reveal_secrets.asm new file mode 100644 index 0000000..7c6686f --- /dev/null +++ b/Book/reveal_secrets.asm @@ -0,0 +1,44 @@ +;this is for making BG2 disappear when pressing X+R and having the book of mudora (modified parallel worlds x button secret), i use bank 0x3C for the whole code +;WRITTEN: by XaserLE +;THANKS TO: -MathOnNapkins' Zelda Doc's +; -wiiqwertyuiop for his Zelda Disassembly + +; Layer Flags: xxxsabcd (i count BG from 1 to 4 - MathOnNapkins RAM-Map counts from 0 to 3) +; s - Sprite layer enabled +; a - BG4 enabled +; b - BG3 enabled +; c - BG2 enabled +; d - (BG1 disabled) --> only works properly if the room uses the feature "BG2 on Top" + +header +lorom + + +ORG $0288FD ; go to the code that branches behind the dungeon map load if player didn't press X +BRA $1C ; make it always branch, so map isn't loaded anymore + +ORG $068365 ; go to an originally JSL that is executed every frame +JSL $3CA600 ; overwrite it (originally JSL $099F91) + +ORG $3CA600 ; go to expanded space to write our routine (keep EveryFrame.asm in mind for the right adresses) +LDA $1B ; load data that tells us whether we are in a building or not +AND #$01 ; are we in a building? +BEQ END_XBUTTONSECRET ; if not, don't use the x-button-secret + ;BG2 disable on pressing R + LDA $7EF34D ; load book of mudora slot + CMP #$01 ; do we have the moon pearl? + BNE $0F ; if not, go to enable BG2 + LDA $F2 ; load unfiltered joypad 1 register (AXLR|????) + AND #$50 ; delete all bits except those for X and R + SEC ; set carry for the following subtraction + SBC #$50 ; X+R button pressed? (if yes, zero flag is set) + BNE $06 ; if not, go to enable BG2 + LDA $1C ; load layer flags + AND #$FD ; disable BG2 (0xFD = 11111101) + BRA $04 ; go to store layer flags + LDA $1C ; load layer flags + ORA #$02 ; enable BG2 (0x02 = 00000010) + STA $1C ; store layer flags +END_XBUTTONSECRET: +JSL $099F91 ; at least execute original code +RTL \ No newline at end of file