IBranchDoor: PHX LDA $1DC7, X ;\ BMI + ;} If door respawn bit is clear: JSL $80818E ;\ LDA $7ED8B0, X ;| PLX ;} And if door index is set: AND $05E7 ;| BEQ ++ ;/ LDA $0000, Y ;\ TAY ;} Jump to argument PLM instruction RTS ;/ ++ - INY ;\ INY ;} Else continue at the next PLM instruction RTS ;/ + PLX BRA - IDoorHit: LDA $7EDF0C, X ;\ INC A ;} Increment PLM counter STA $7EDF0C, X ;/ SEP #$20 ;\ CMP $0000, Y ;| REP #$20 ;} If PLM counter < argument: BCS Branch1 ;/ INY ;\ INY ;} Return to next instruction INY ;/ DefaultRTS5: RTS Branch1: PHX LDA $1DC7, X ;\ BMI + ;| JSL $80818E ;| LDA $7ED8B0, X ;} Set door as opened in door bit array ORA $05E7 ;| STA $7ED8B0, X ;/ + PLX ORA #$8000 ;\ STA $1DC7, X ;} Set respawn bit on PLM room arguement LDA #DefaultRTS5 ;\ STA $1CD7, X ;} Clear pre-PLM instruction INY ;\ JMP IGoTo ;} Branch to arguement ; Draws Draw9BF7: ; Eye door facing left DW $8004 : DW $84AA, $84CC, $8CCC, $8CAA DW $0000 ;21C03 Draw9C03: ; Eye door facing left eye DW $8002 : DW $84CC, $8CCC DW $0000 ;21C0B Draw9C0B: ; Eye door facing left eye DW $8002 : DW $84CB, $8CCB DW $0000 ;21C13 Draw9C13: ; Eye door facing left eye DW $8002 : DW $C4CA, $DCCA DW $0000 ;21C1B Draw9C1B: ; Eye door facing left eye DW $8002 : DW $84CD, $8CCD DW $0000 ;21C23 Draw9C23: ; Eye door facing left eye DW $8002 : DW $84CA, $8CCA DW $0000 ;21C2B Draw9C2B: ; Eye door facing left top DW $0001 : DW $A4AA DW $0000 ;21C31 Draw9C31: ; Eye door facing left top DW $0001 : DW $A4AB DW $0000 ;21C37 Draw9C37: ; Eye door facing left top DW $0001 : DW $A4AC DW $0000 ;21C3D Draw9C3D: ; Eye door facing left bottom DW $0001 : DW $ACAA DW $0000 ;21C43 Draw9C43: ; Eye door facing left bottom DW $0001 : DW $ACAB DW $0000 ;21C49 Draw9C49: ; Eye door facing left bottom DW $0001 : DW $ACAC DW $0000 ;21C4F ; Eye door facing right Draw9C4F: DW $8004 : DW $80AA, $80CC, $88CC, $88AA DW $0000 ;21C5B Draw9C5B: ; Eye door facing right eye DW $8002 : DW $80CC, $88CC DW $0000 ;21C63 Draw9C63: ; Eye door facing right eye DW $8002 : DW $80CB, $88CB DW $0000 ;21C6B Draw9C6B: ; Eye door facing right eye DW $8002 : DW $C0CA, $D8CA DW $0000 ;21C73 Draw9C73: ; Eye door facing right eye DW $8002 : DW $80CD, $88CD DW $0000 ;21C7B Draw9C7B: ; Eye door facing right eye DW $8002 : DW $80CA, $88CA DW $0000 ;21C83 Draw9C83: ; Eye door facing right top DW $0001 : DW $A0AA DW $0000 ;21C89 Draw9C89: ; Eye door facing right top DW $0001 : DW $A0AB DW $0000 ;21C8F Draw9C8F: ; Eye door facing right top DW $0001 : DW $A0AC DW $0000 ;21C95 Draw9C95: ; Eye door facing right bottom DW $0001 : DW $A8AA DW $0000 ;21C9B Draw9C9B: ; Eye door facing right bottom DW $0001 : DW $A8AB DW $0000 ;21CA1 Draw9CA1: ; Eye door facing right bottom DW $0001 : DW $A8AC DW $0000 ;22677 DrawA677: ; Open door facing left DW $8004 DW $0082, $00A2, $08A2, $0882 DW $0000 ;22683 DrawA683: ; Open door facing right DW $8004 DW $0482, $04A2, $0CA2, $0C82 DW $0000 ;2268F DrawA68F: ; Open door facing up DW $0004 DW $0484, $0483, $0083, $0084 DW $0000 ;2269B DrawA69B: ; Open door facing down DW $0004 DW $0C84, $0C83, $0883, $0884 DW $0000 ;226A7 DrawA6A7: ; Grey door facing left DW $8004 DW $C0AE, $D0CE, $D8CE, $D8AE DW $0000 ;226B3 DrawA6B3: ; Grey door facing left DW $8004 DW $80AF, $80CF, $88CF, $88AF DW $0000 ;226BF DrawA6BF: ; Grey door facing left DW $8004 DW $80B0, $80D0, $88D0, $88B0 DW $0000 ;226CB DrawA6CB: ; Grey door facing left DW $8004 DW $80B1, $00D1, $08D1, $88B1 DW $0000 ;226D7 DrawA6D7: ; Grey door facing right DW $8004 DW $C4AE, $D4CE, $DCCE, $DCAE DW $0000 ;226E3 DrawA6E3: ; Grey door facing right DW $8004 DW $84AF, $84CF, $8CCF, $8CAF DW $0000 ;226EF DrawA6EF: ; Grey door facing right DW $8004 DW $84B0, $84D0, $8CD0, $8CB0 DW $0000 ;226FB DrawA6FB: ; Grey door facing right DW $8004 DW $84B1, $84D1, $8CD1, $8CB1 DW $0000 ;22707 DrawA707: ; Grey door facing up DW $0004 DW $C4B3, $54B2, $50B2, $50B3 DW $0000 ;22713 DrawA713: ; Grey door facing up DW $0004 DW $84D3, $84D2, $80D2, $80D3 DW $0000 ;2271F DrawA71F: ; Grey door facing up DW $0004 DW $84B5, $84B4, $80B4, $80B5 DW $0000 ;2272B DrawA72B: ; Grey door facing up DW $0004 DW $84D5, $84D4, $80D4, $80D5 DW $0000 ;22737 DrawA737: ; Grey door facing down DW $0004 DW $CCB3, $5CB2, $58B2, $58B3 DW $0000 ;22743 DrawA743: ; Grey door facing down DW $0004 DW $8CD3, $8CD2, $88D2, $88D3 DW $0000 ;2274F DrawA74F: ; Grey door facing down DW $0004 DW $8CB5, $8CB4, $88B4, $88B5 DW $0000 ;2275B DrawA75B: ; Grey door facing down DW $0004 DW $8CD5, $0CD4, $08D4, $88D5 DW $0000 ;22767 DrawA767: ; Orange door facing left DW $8004 DW $C000, $D020, $D820, $D800 DW $0000 ;22773 DrawA773: ; Orange door facing left DW $8004 DW $8001, $8021, $8821, $8801 DW $0000 ;2277F DrawA77F: ; Orange door facing left DW $8004 DW $8002, $8022, $8822, $8802 DW $0000 ;2278B DrawA78B: ; Orange door facing left DW $8004 DW $8003, $0023, $0823, $8803 DW $0000 ;22797 DrawA797: ; Orange door facing right DW $8004 DW $C400, $D420, $DC20, $DC00 DW $0000 ;227A3 DrawA7A3: ; Orange door facing right DW $8004 DW $8401, $8421, $8C21, $8C01 DW $0000 ;227AF DrawA7AF: ; Orange door facing right DW $8004 DW $8402, $8422, $8C22, $8C02 DW $0000 ;227BB DrawA7BB: ; Orange door facing right DW $8004 DW $8403, $8423, $8C23, $8C03 DW $0000 ;227C7 DrawA7C7: ; Orange door facing up DW $0004 DW $C411, $5410, $5010, $5011 DW $0000 ;227D3 DrawA7D3: ; Orange door facing up DW $0004 DW $8431, $8430, $8030, $8031 DW $0000 ;227DF DrawA7DF: ; Orange door facing up DW $0004 DW $8413, $8412, $8012, $8013 DW $0000 ;227EB DrawA7EB: ; Orange door facing up DW $0004 DW $8433, $8432, $8032, $8033 DW $0000 ;227F7 DrawA7F7: ; Orange door facing down DW $0004 DW $CC11, $5C10, $5810, $5811 DW $0000 ;22803 DrawA803: ; Orange door facing down DW $0004 DW $8C31, $8C30, $8830, $8831 DW $0000 ;2280F DrawA80F: ; Orange door facing down DW $0004 DW $8C13, $8C12, $8812, $8813 DW $0000 ;2281B DrawA81B: ; Orange door facing down DW $0004 DW $8C33, $0C32, $0832, $8833 DW $0000 ;22827 DrawA827: ; Green door facing left DW $8004 DW $C004, $D024, $D824, $D804 DW $0000 ;22833 DrawA833: ; Green door facing left DW $8004 DW $8005, $8025, $8825, $8805 DW $0000 ;2283F DrawA83F: ; Green door facing left DW $8004 DW $8006, $8026, $8826, $8806 DW $0000 ;2284B DrawA84B: ; Green door facing left DW $8004 DW $8007, $0027, $0827, $8807 DW $0000 ;22857 DrawA857: ; Green door facing right DW $8004 DW $C404, $D424, $DC24, $DC04 DW $0000 ;22863 DrawA863: ; Green door facing right DW $8004 DW $8405, $8425, $8C25, $8C05 DW $0000 ;2286F DrawA86F: ; Green door facing right DW $8004 DW $8406, $8426, $8C26, $8C06 DW $0000 ;2287B DrawA87B: ; Green door facing right DW $8004 DW $8407, $0427, $0C27, $8C07 DW $0000 ;22887 DrawA887: ; Green door facing up DW $0004 DW $C415, $5414, $5014, $5015 DW $0000 ;22893 DrawA893: ; Green door facing up DW $0004 DW $8435, $8434, $8034, $8035 DW $0000 ;2289F DrawA89F: ; Green door facing up DW $0004 DW $8417, $8416, $8016, $8017 DW $0000 ;228AB DrawA8AB: ; Green door facing up DW $0004 DW $8437, $8436, $8036, $8037 DW $0000 ;228B7 DrawA8B7: ; Green door facing down DW $0004 DW $CC15, $5C14, $5814, $5815 DW $0000 ;228C3 DrawA8C3: ; Green door facing down DW $0004 DW $8C35, $8C34, $8834, $8835 DW $0000 ;228CF DrawA8CF: ; Green door facing down DW $0004 DW $8C17, $8C16, $8816, $8817 DW $0000 ;228DB DrawA8DB: ; Green door facing down DW $0004 DW $8C37, $8C36, $8836, $8837 DW $0000 ;228E7 DrawA8E7: ; Red door facing left DW $8004 DW $C008, $D028, $D828, $D808 DW $0000 ;228F3 DrawA8F3: ; Red door facing left DW $8004 DW $8009, $8029, $8829, $8809 DW $0000 ;228FF DrawA8FF: ; Red door facing left DW $8004 DW $800A, $802A, $882A, $880A DW $0000 ;2290B DrawA90B: ; Red door facing left DW $8004 DW $800B, $002B, $082B, $880B DW $0000 ;22917 DrawA917: ; Red door facing right DW $8004 DW $C408, $D428, $DC28, $DC08 DW $0000 ;22923 DrawA923: ; Red door facing right DW $8004 DW $8409, $8429, $8C29, $8C09 DW $0000 ;2292F DrawA92F: ; Red door facing right DW $8004 DW $840A, $842A, $8C2A, $8C0A DW $0000 ;2293B DrawA93B: ; Red door facing right DW $8004 DW $840B, $042B, $0C2B, $8C0B DW $0000 ;22947 DrawA947: ; Red door facing up DW $0004 DW $C419, $5418, $5018, $5019 DW $0000 ;22953 DrawA953: ; Red door facing up DW $0004 DW $8439, $8438, $8038, $8039 DW $0000 ;2295F DrawA95F: ; Red door facing up DW $0004 DW $841B, $841A, $801A, $801B DW $0000 ;2296B DrawA96B: ; Red door facing up DW $0004 DW $843B, $843A, $803A, $803B DW $0000 ;22977 DrawA977: ; Red door facing down DW $0004 DW $CC19, $5C18, $5818, $5819 DW $0000 ;22983 DrawA983: ; Red door facing down DW $0004 DW $8C39, $8C38, $8838, $8839 DW $0000 ;2298F DrawA98F: ; Red door facing down DW $0004 DW $8C1B, $8C1A, $881A, $881B DW $0000 ;2299B DrawA99B: ; Red door facing down DW $0004 DW $8C3B, $8C3A, $883A, $883B DW $0000 ;229A7 DrawA9A7: ; Solid blue door facing left DW $8004 DW $800C, $D02C, $D82C, $D80C DW $0000 ;229B3 DrawA9B3: ; Blue door facing left DW $8004 DW $C00C, $D02C, $D82C, $D80C DW $0000 ;229BF DrawA9BF: ; Blue door facing left DW $8004 DW $800D, $802D, $882D, $880D DW $0000 ;229CB DrawA9CB: ; Blue door facing left DW $8004 DW $800E, $802E, $882E, $880E DW $0000 ;229D7 DrawA9D7: ; Blue door facing left DW $8004 DW $800F, $002F, $082F, $880F DW $0000 ;229E3 DrawA9E3: ; Solid blue door facing right DW $8004 DW $840C, $D42C, $DC2C, $DC0C DW $0000 ;229EF DrawA9EF: ; Blue door facing right DW $8004 DW $C40C, $D42C, $DC2C, $DC0C DW $0000 ;229FB DrawA9FB: ; Blue door facing right DW $8004 DW $840D, $842D, $8C2D, $8C0D DW $0000 ;22A07 DrawAA07: ; Blue door facing right DW $8004 DW $840E, $842E, $8C2E, $8C0E DW $0000 ;22A13 DrawAA13: ; Blue door facing right DW $8004 DW $840F, $042F, $0C2F, $8C0F DW $0000 ;22A1F DrawAA1F: ; Solid blue door facing up DW $0004 DW $841D, $541C, $501C, $501D DW $0000 ;22A2B DrawAA2B: ; Blue door facing up DW $0004 DW $C41D, $541C, $501C, $501D DW $0000 ;22A37 DrawAA37: ; Blue door facing up DW $0004 DW $843D, $843C, $803C, $803D DW $0000 ;22A43 DrawAA43: ; Blue door facing up DW $0004 DW $841F, $841E, $801E, $801F DW $0000 ;22A4F DrawAA4F: ; Blue door facing up DW $0004 DW $843F, $843E, $803E, $803F DW $0000 ;22A5B DrawAA5B: ; Solid blue door facing down DW $0004 DW $8C1D, $5C1C, $581C, $581D DW $0000 ;22A67 DrawAA67: ; Blue door facing down DW $0004 DW $CC1D, $5C1C, $581C, $581D DW $0000 ;22A73 DrawAA73: ; Blue door facing down DW $0004 DW $8C3D, $8C3C, $883C, $883D DW $0000 ;22A7F DrawAA7F: ; Blue door facing down DW $0004 DW $8C1F, $8C1E, $881E, $881F DW $0000 ;22A8B DrawAA8B: ; Blue door facing down DW $0004 DW $8C3F, $8C3E, $883E, $883F DW $0000 ; Blue door closing setup. Change current block to solid (or possibly air) SetupB3C1: LDX $1C87, Y ;\ LDA $7F0002, X ;| AND #$8FFF ;} Change PLM block to air/solid STA $7F0002, X ;/ RTS ; Return CodeBD0F: ; Grey door subroutine. GoTo stored pointer and wake up when shot LDA $1D77, X ;\ BEQ + ;} If PLM variable set: STZ $1D77, X ; Clear PLM variable LDA $7EDEBC, X ;\ STA $1D27, X ;} Next PLM instruction = PLM GoTo instruction LDA #$0001 ;\ STA $7EDE1C, X ;} PLM frame delay = 1 + RTS CodeBD26: ; Orange door subroutine. GoTo stored pointer and wake up when shot with power bomb LDA $1D77, X ;\ BEQ ++ ;} If PLM variable clear, return AND #$0F00 ;\ CMP #$0300 ;} If current prjectile is a power bomb: BNE + ;/ STZ $1D77, X ; Clear PLM variable LDA $7EDEBC, X ;\ STA $1D27, X ;} Next PLM instruction = PLM GoTo instruction LDA #$0001 ;\ STA $7EDE1C, X ;} PLM frame delay = 1 RTS ; Return + LDA #$0057 ;\ Else (projectile is not power bomb): JSL $8090CB ;} Sound library 2, $0653 = 06h, sound 57h ++ STZ $1D77, X ; Clear PLM variable RTS ; Return CodeBD50: ; Red door subroutine. GoTo stored pointer and wake up when shot with (super) missile LDA $1D77, X ;\ BEQ ++ ;} If PLM variable clear, return AND #$0F00 ;\ CMP #$0200 ;} If current prjectile is a super missile: branch to +++ BEQ +++ ;/ CMP #$0100 ;\ BNE + ;} If the current projectile is a (super) missile: - STZ $1D77, X ; Clear PLM variable LDA $7EDEBC, X ;\ STA $1D27, X ;} Next PLM instruction = PLM GoTo instruction LDA #$0001 ;\ STA $7EDE1C, X ;} PLM frame delay = 1 RTS ; Return + LDA #$0057 ;\ Else (projectile is not a (super) missile): JSL $8090CB ;} Sound library 2, $0653 = 06h, sound 57h ++ STZ $1D77, X ; Clear PLM variable RTS ; Return +++ LDA #$0077 ;\ STA $7EDF0C, X ;} PLM counter = 119 BRA - ; Branch to - CodeBD88: ; Green door subroutine. GoTo stored pointer and wake up when shot with super missile LDA $1D77, X ;\ BEQ ++ ;} If PLM variable clear, return AND #$0F00 ;\ CMP #$0200 ;} If current prjectile is a super missile: BNE + ;/ STZ $1D77, X ; Clear PLM variable LDA $7EDEBC, X ;\ STA $1D27, X ;} Next PLM instruction = PLM GoTo instruction LDA #$0001 ;\ STA $7EDE1C, X ;} PLM frame delay = 1 RTS ; Return + LDA #$0057 ;\ Else (projectile is not a super missile): JSL $8090CB ; ;} Sound library 2, $0653 = 06h, sound 57h ++ STZ $1D77, X ; Clear PLM variable RTS ; Return SubBDB2: ; Grey door unlocked. GoTo stored pointer and clear check. STZ $1D77, X ; Clear PLM variable LDA $7EDEBC, X ;\ STA $1D27, X ;} Next PLM instruction = PLM GoTo instruction LDA #$0001 ;\ STA $7EDE1C, X ;} PLM frame delay = 1 RTS ; Return SubBDC4: ; Grey door locked. Play sound when shot. LDA $1D77, X ;\ BEQ + ;} If PLM variable set: LDA #$0057 ;\ JSL $8090CB ;} Play sound library 2, $0653 = 06h, sound 57h + STZ $1D77, X ; Clear PLM variable RTS ; Return CodeBDD4: ; Grey door: Area Boss #1 (Main Bosses) LDA #$0001 JSL $8081DC BCC + JMP SubBDB2 + JMP SubBDC4 CodeBDE3: ; Grey door: Area Boss #2 (Minibosses, Mother Brain) LDA #$0002 JSL $8081DC BCC + JMP SubBDB2 + JMP SubBDC4 CodeBDF2: ; Grey door: Area Boss #3 (Torizos) LDA #$0004 JSL $8081DC BCC + JMP SubBDB2 + JMP SubBDC4 CodeBE01: ; Grey door: Room Enemies cleared PHY PHX LDA $0E50 CMP $0E52 BCC + LDA #$0000 JSL $8081FA PLX PLY JMP SubBDB2 + PLX PLY JMP SubBDC4 CodeBE1C: ;Grey door: Always Closed JMP SubBDC4 CodeBE1F: ; Grey door: Delay in Tourian Gate room (closed while 1E6D is positive) PHY PHX LDA $1E6D BPL + PLX PLY JMP SubBDB2 + PLX PLY JMP SubBDC4 CodeBE30: ; Grey door: Dachoras and Etecoons saved (Event Bit 000F is set) LDA #$000F JSL $808233 BCC + JMP SubBDB2 + JMP SubBDC4 ; Instruction BE3F. Set pre-PLM code to specific grey door condition check IGreyDoorCheck: PHY LDY $1E17, X LDA.w .table, Y STA $1CD7, X PLY RTS .table DW CodeBDD4, CodeBDE3, CodeBDF2, CodeBE01, CodeBE1C, CodeBE1F, CodeBE30 InstBE59: ; Grey facing left DW $0002 DW DrawA677 DW $0002 DW DrawA6CB DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA6BF DW $0002 DW DrawA6B3 DW $0001 DW DrawA6A7 InstBE70: DW IBranchDoor DW InstC49E_sub ; Branch to blue door closing facing left sub if door index is set DW ISetGoTo DW .sub1 ;\ DW IGreyDoorCheck ;} Branch to sub1 when specific grey door condition check succeeds DW $0001 DW DrawA6A7 .loop1 DW IWait ;\ DW IGoTo DW .loop1 ;} Loop .sub1 DW ISetGoTo DW .sub2 ;\ DW ISetPreInstructionCode DW CodeBD0F ;} Branch to sub2 when shot .loop2 DW $0003 DW DrawA9B3 DW $0004 DW DrawA6A7 DW $0003 DW DrawA9B3 DW $0004 DW DrawA6A7 DW $0003 DW DrawA9B3 DW $0004 DW DrawA6A7 DW IGoTo DW .loop2 ; Branch to loop2 .sub2 DW IDoorHit DB $01 DW .sub3 ; Clear pre-PLM, set door as opened, and branch to sub3 .sub3 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0004 DW DrawA6B3 DW $0004 DW DrawA6BF DW $0004 DW DrawA6CB DW $0001 DW DrawA677 DW IKill ; Delete the PLM InstBEC2: ; Grey facing right DW $0002 DW DrawA683 DW $0002 DW DrawA6FB DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA6EF DW $0002 DW DrawA6E3 DW $0001 DW DrawA6D7 InstBED9: DW IBranchDoor DW InstC4CF_sub ; Branch to blue door closing facing right sub if door index is set DW ISetGoTo DW .sub1 ;\ DW IGreyDoorCheck ;} Branch to sub1 when specific grey door condition check succeeds DW $0001 DW DrawA6D7 .loop1 DW IWait ;\ DW IGoTo DW .loop1 ;} Loop .sub1 DW ISetGoTo DW .sub2 ;\ DW ISetPreInstructionCode DW CodeBD0F ;} Branch to sub2 when shot .loop2 DW $0003 DW DrawA9EF DW $0004 DW DrawA6D7 DW $0003 DW DrawA9EF DW $0004 DW DrawA6D7 DW $0003 DW DrawA9EF DW $0004 DW DrawA6D7 DW IGoTo DW .loop2 ; Branch to loop2 .sub2 DW IDoorHit DB $01 DW .sub3 ; Clear pre-PLM, set door as opened, and branch to sub3 .sub3 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0004 DW DrawA6E3 DW $0004 DW DrawA6EF DW $0004 DW DrawA6FB DW $0001 DW DrawA683 DW IKill ; Delete the PLM InstBF2B: ; Grey facing up DW $0002 DW DrawA68F DW $0002 DW DrawA72B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA71F DW $0002 DW DrawA713 DW $0001 DW DrawA707 InstBF42: DW IBranchDoor DW InstC500_sub ; Branch to blue door closing facing up sub if door index is set DW ISetGoTo DW .sub1 ;\ DW IGreyDoorCheck ;} Branch to sub1 when specific grey door condition check succeeds DW $0001 DW DrawA707 .loop1 DW IWait ;\ DW IGoTo DW .loop1 ;} Loop .sub1 DW ISetGoTo DW .sub2 ;\ DW ISetPreInstructionCode DW CodeBD0F ;} Branch to sub2 when shot .loop2 DW $0003 DW DrawAA2B DW $0004 DW DrawA707 DW $0003 DW DrawAA2B DW $0004 DW DrawA707 DW $0003 DW DrawAA2B DW $0004 DW DrawA707 DW IGoTo DW .loop2 ; Branch to loop2 .sub2 DW IDoorHit DB $01 DW .sub3 ; Clear pre-PLM, set door as opened, and branch to sub3 .sub3 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0004 DW DrawA713 DW $0004 DW DrawA71F DW $0004 DW DrawA72B DW $0001 DW DrawA68F DW IKill ; Delete the PLM InstBF94: ; Grey facing down DW $0002 DW DrawA69B DW $0002 DW DrawA75B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA74F DW $0002 DW DrawA743 DW $0001 DW DrawA737 InstBFAB: DW IBranchDoor DW InstC531_sub ; Branch to blue door closing facing left down if door index is set DW ISetGoTo DW .sub1 ;\ DW IGreyDoorCheck ;} Branch to sub1 when specific grey door condition check succeeds DW $0001 DW DrawA737 .loop1 DW IWait ;\ DW IGoTo DW .loop1 ;} Loop .sub1 DW ISetGoTo DW .sub2 ;\ DW ISetPreInstructionCode DW CodeBD0F ;} Branch to sub2 when shot .loop2 DW $0003 DW DrawAA67 DW $0004 DW DrawA737 DW $0003 DW DrawAA67 DW $0004 DW DrawA737 DW $0003 DW DrawAA67 DW $0004 DW DrawA737 DW IGoTo DW .loop2 ; Branch to loop2 .sub2 DW IDoorHit DB $01 DW .sub3 ; Clear pre-PLM, set door as opened, and branch to sub3 .sub3 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0004 DW DrawA743 DW $0004 DW DrawA74F DW $0004 DW DrawA75B DW $0001 DW DrawA69B DW IKill ; Delete the PLM InstBFFD: ; Orange facing left DW $0002 DW DrawA677 DW $0002 DW DrawA78B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA77F DW $0002 DW DrawA773 DW $0001 DW DrawA767 InstC014: DW IBranchDoor DW InstC49E_sub ; Branch to blue door closing facing left sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD26 ;} Branch to sub1 when hit shot by power bomb DW $0001 DW DrawA767 .loop1 DW IWait ;\ DW IGoTo DW .loop1 ;} Loop .sub1 DW IDoorHit DB $01 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW $0003 DW DrawA9B3 DW $0004 DW DrawA767 DW $0003 DW DrawA9B3 DW $0004 DW DrawA767 DW $0003 DW DrawA9B3 DW $0004 DW DrawA767 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0004 DW DrawA773 DW $0004 DW DrawA77F DW $0004 DW DrawA78B DW $005C DW DrawA677 DW IKill ; Delete the PLM InstC060: ; Orange facing right DW $0002 DW DrawA683 DW $0002 DW DrawA7BB DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA7AF DW $0002 DW DrawA7A3 DW $0001 DW DrawA797 InstC077: DW IBranchDoor DW InstC4CF_sub ; Branch to blue door closing facing right sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD26 ;} Branch to sub1 when hit shot by power bomb DW $0001 DW DrawA797 .loop1 DW IWait ;\ DW IGoTo DW .loop1 ;} Loop .sub1 DW IDoorHit DB $01 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW $0003 DW DrawA9EF DW $0004 DW DrawA797 DW $0003 DW DrawA9EF DW $0004 DW DrawA797 DW $0003 DW DrawA9EF DW $0004 DW DrawA797 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA7A3 DW $0006 DW DrawA7AF DW $0006 DW DrawA7BB DW $0001 DW DrawA683 DW IKill ; Delete the PLM InstC0C3: ; Orange facing up DW $0002 DW DrawA68F DW $0002 DW DrawA7EB DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA7DF DW $0002 DW DrawA7D3 DW $0001 DW DrawA7C7 InstC0DA: DW IBranchDoor DW InstC500_sub ; Branch to blue door closing facing up sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD26 ;} Branch to sub1 when hit shot by power bomb DW $0001 DW DrawA7C7 .loop1 DW IWait ; Loop .sub1 DW IDoorHit DB $01 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW $0003 DW DrawAA2B DW $0004 DW DrawA7C7 DW $0003 DW DrawAA2B DW $0004 DW DrawA7C7 DW $0003 DW DrawAA2B DW $0004 DW DrawA7C7 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA7D3 DW $0006 DW DrawA7DF DW $0006 DW DrawA7EB DW $0001 DW DrawA68F DW IKill ; Delete the PLM InstC122: ; Orange facing down DW $0002 DW DrawA69B DW $0002 DW DrawA81B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA80F DW $0002 DW DrawA803 DW $0001 DW DrawA7F7 InstC139: DW IBranchDoor DW InstC531_sub ; Branch to blue door closing facing up sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD26 ;} Branch to sub1 when hit shot by power bomb DW $0002 DW DrawA7F7 DW $0001 DW DrawA7F7 .loop1 DW IWait ; Loop .sub1 DW IDoorHit DB $01 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW $0003 DW DrawAA67 DW $0004 DW DrawA7F7 DW $0003 DW DrawAA67 DW $0004 DW DrawA7F7 DW $0003 DW DrawAA67 DW $0004 DW DrawA7F7 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA803 DW $0006 DW DrawA80F DW $0006 DW DrawA81B DW $0001 DW DrawA69B DW IKill ; Delete the PLM InstC185: ; Green facing left DW $0002 DW DrawA677 DW $0002 DW DrawA84B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA83F DW $0002 DW DrawA833 DW $0001 DW DrawA827 InstC19C: DW IBranchDoor DW InstC49E_sub ; Branch to blue door closing facing left sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD88 ;} Branch to sub1 when hit shot by super missile DW $0001 DW DrawA827 .loop1 DW IWait ; Loop .sub1 DW IDoorHit DB $01 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW $0003 DW DrawA9B3 DW $0004 DW DrawA827 DW $0003 DW DrawA9B3 DW $0004 DW DrawA827 DW $0003 DW DrawA9B3 DW $0004 DW DrawA827 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA833 DW $0006 DW DrawA83F DW $0006 DW DrawA84B DW $0001 DW DrawA677 DW IKill ; Delete the PLM InstC1E4: ; Green facing right DW $0002 DW DrawA683 DW $0002 DW DrawA87B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA86F DW $0002 DW DrawA863 DW $0001 DW DrawA857 InstC1FB: DW IBranchDoor DW InstC4CF_sub ; Branch to blue door closing facing right sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD88 ;} Branch to sub1 when hit shot by super missile DW $0001 DW DrawA857 .loop1 DW IWait ; Loop .sub1 DW IDoorHit DB $01 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW $0003 DW DrawA9EF DW $0004 DW DrawA857 DW $0003 DW DrawA9EF DW $0004 DW DrawA857 DW $0003 DW DrawA9EF DW $0004 DW DrawA857 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA863 DW $0006 DW DrawA86F DW $0006 DW DrawA87B DW $0001 DW DrawA683 DW IKill ; Delete the PLM InstC243: ; Green facing up DW $0002 DW DrawA68F DW $0002 DW DrawA8AB DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA89F DW $0002 DW DrawA893 DW $0001 DW DrawA887 InstC25A: DW IBranchDoor DW InstC500_sub ; Branch to blue door closing facing up sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD88 ;} Branch to sub1 when hit shot by super missile DW $0001 DW DrawA887 .loop1 DW IWait ; Loop .sub1 DW IDoorHit DB $01 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW $0003 DW DrawAA2B DW $0004 DW DrawA887 DW $0003 DW DrawAA2B DW $0004 DW DrawA887 DW $0003 DW DrawAA2B DW $0004 DW DrawA887 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA893 DW $0006 DW DrawA89F DW $0006 DW DrawA8AB DW $0001 DW DrawA68F DW IKill ; Delete the PLM InstC2A2: ; Green facing down DW $0002 DW DrawA69B DW $0002 DW DrawA8DB DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA8CF DW $0002 DW DrawA8C3 DW $0001 DW DrawA8B7 InstC2B9: DW IBranchDoor DW InstC531_sub ; Branch to blue door closing facing down sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD88 ;} Branch to sub1 when hit shot by super missile DW $0001 DW DrawA8B7 .loop1 DW IWait ; Loop .sub1 DW IDoorHit DB $01 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW $0003 DW DrawAA67 DW $0004 DW DrawA8B7 DW $0003 DW DrawAA67 DW $0004 DW DrawA8B7 DW $0003 DW DrawAA67 DW $0004 DW DrawA8B7 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA8C3 DW $0006 DW DrawA8CF DW $0006 DW DrawA8DB DW $0001 DW DrawA69B DW IKill ; Delete the PLM InstC301: ; Red facing left DW $0002 DW DrawA677 DW $0002 DW DrawA90B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA8FF DW $0002 DW DrawA8F3 DW $0001 DW DrawA8E7 InstC318: DW IBranchDoor DW InstC49E_sub ; Branch to blue door closing facing sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD50 ;} Branch to sub1 when hit shot by super missile DW $0001 DW DrawA8E7 .loop1 DW IWait ; Loop .sub1 DW IDoorHit DB $05 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW IPlaySound3 DB $09 ; Play sound library 3, $0653 = 06h, sound 09h DW $0003 DW DrawA9B3 DW $0004 DW DrawA8E7 DW $0003 DW DrawA9B3 DW $0004 DW DrawA8E7 DW $0003 DW DrawA9B3 DW $0004 DW DrawA8E7 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA8F3 DW $0006 DW DrawA8FF DW $0006 DW DrawA90B DW $0001 DW DrawA677 DW IKill ; Delete the PLM InstC363: ; Red facing right DW $0002 DW DrawA683 DW $0002 DW DrawA93B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA92F DW $0002 DW DrawA923 DW $0001 DW DrawA917 InstC37A: DW IBranchDoor DW InstC4CF_sub ; Branch to blue door closing facing right sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD50 ;} Branch to sub1 when hit shot by super missile DW $0001 DW DrawA917 .loop1 DW IWait ; Loop .sub1 DW IDoorHit DB $05 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW IPlaySound3 DB $09 ; Play sound library 3, $0653 = 06h, sound 09h DW $0003 DW DrawA9EF DW $0004 DW DrawA917 DW $0003 DW DrawA9EF DW $0004 DW DrawA917 DW $0003 DW DrawA9EF DW $0004 DW DrawA917 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA923 DW $0006 DW DrawA92F DW $0006 DW DrawA93B DW $0001 DW DrawA683 DW IKill ; Delete the PLM InstC3C5: ; Red facing up DW $0002 DW DrawA68F DW $0002 DW DrawA96B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA95F DW $0002 DW DrawA953 DW $0001 DW DrawA947 InstC3DC: DW IBranchDoor DW InstC500_sub ; Branch to blue door closing facing up sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD50 ;} Branch to sub1 when hit shot by super missile DW $0001 DW DrawA947 .loop1 DW IWait ; Loop .sub1 DW IDoorHit DB $05 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW IPlaySound3 DB $09 ; Play sound library 3, $0653 = 06h, sound 09h DW $0003 DW DrawAA2B DW $0004 DW DrawA947 DW $0003 DW DrawAA2B DW $0004 DW DrawA947 DW $0003 DW DrawAA2B DW $0004 DW DrawA947 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA953 DW $0006 DW DrawA95F DW $0006 DW DrawA96B DW $0001 DW DrawA68F DW IKill ; Delete the PLM InstC427: ; Red facing down DW $0002 DW DrawA69B DW $0002 DW DrawA99B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA98F DW $0002 DW DrawA983 DW $0001 DW DrawA977 InstC43E: DW IBranchDoor DW InstC531_sub ; Branch to blue door closing facing down sub if door index is set DW ISetGoTo DW .sub1 ;\ DW ISetPreInstructionCode DW CodeBD50 ;} Branch to sub1 when hit shot by super missile DW $0001 DW DrawA977 .loop1 DW IWait ; Loop .sub1 DW IDoorHit DB $05 DW .sub2 ; Clear pre-PLM, set door as opened, and branch to sub2 DW IPlaySound3 DB $09 ; Play sound library 3, $0653 = 06h, sound 09h DW $0003 DW DrawAA67 DW $0004 DW DrawA977 DW $0003 DW DrawAA67 DW $0004 DW DrawA977 DW $0003 DW DrawAA67 DW $0004 DW DrawA977 DW IGoTo DW .loop1 ; Branch to loop1 .sub2 DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA983 DW $0006 DW DrawA98F DW $0006 DW DrawA99B DW $0001 DW DrawA69B DW IKill ; Delete the PLM InstC489: ; Blue facing left DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA9BF DW $0006 DW DrawA9CB DW $0006 DW DrawA9D7 DW $005E DW DrawA677 DW IKill ; Delete the PLM InstC49E: ; Blue door closing facing left DW $0002 DW DrawA677 DW $0002 DW DrawA9D7 DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawA9CB DW $0002 DW DrawA9BF .sub DW ISetBTS DB $40 ; Set PLM block to door facing left DW $0001 DW DrawA9B3 DW IKill ; Delete the PLM InstC4BA: ; Blue facing right DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawA9FB DW $0006 DW DrawAA07 DW $0006 DW DrawAA13 DW $005E DW DrawA683 DW IKill ; Delete the PLM InstC4CF: ; Blue door closing facing right DW $0002 DW DrawA683 DW $0002 DW DrawAA13 DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawAA07 DW $0002 DW DrawA9FB .sub DW ISetBTS DB $41 ; Set PLM block to door facing right DW $0001 DW DrawA9EF DW IKill ; Delete the PLM InstC4EB: ; Blue facing up DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawAA37 DW $0006 DW DrawAA43 DW $0006 DW DrawAA4F DW $005E DW DrawA68F DW IKill ; Delete the PLM InstC500: ; Blue door closing facing up DW $0002 DW DrawA68F DW $0002 DW DrawAA4F DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawAA43 DW $0002 DW DrawAA37 .sub DW ISetBTS DB $42 ; Set PLM block to door facing up DW $0001 DW DrawAA2B DW IKill ; Delete the PLM InstC51C: ; Blue facing down DW IPlaySound3 DB $07 ; Play sound library 3, $0653 = 06h, sound 07h DW $0006 DW DrawAA73 DW $0006 DW DrawAA7F DW $0006 DW DrawAA8B DW $005E DW DrawA69B DW IKill ; Delete the PLM InstC531: ; Blue door closing facing down DW $0002 DW DrawA69B DW $0002 DW DrawAA8B DW IPlaySound3 DB $08 ; Play sound library 3, $0653 = 06h, sound 08h DW $0002 DW DrawAA7F DW $0002 DW DrawAA73 .sub DW ISetBTS DB $43 ; Set PLM block to door facing down DW $0001 DW DrawAA67 DW IKill ; Delete the PLM SetupC794: ; Grey door setup LDA $1DC8, Y ;\ AND #$007C ;| LSR A ;} Extract grey door condition from room parameter STA $1E17, Y ;/ LDA $1DC7, Y ;\ AND #$83FF ;} Cleanse room parameter of specifically grey door data STA $1DC7, Y ;/ LDX $1C87, Y ;\ LDA #$C044 ;} Set PLM block to shotblock, BTS 44h JSR WriteBlockTypeBTS ;/ RTS ; Return SetupC7B1: ; Orange/green/red door setup LDX $1C87, Y ;\ LDA #$C044 ;} Set PLM block to shotblock, BTS 44h JSR WriteBlockTypeBTS ;/ RTS ; Return SetupC7BB: ; Blue door setup LDX $0DDE ;\ LDA $0C18, X ;| AND #$0F00 ;} If current projectile is a power bomb: CMP #$0300 ;| BNE + ;/ LDA #$0000 ;\ STA $1C37, Y ;} Clear PLM header entry RTS ; Return + LDX $1C87, Y ;\ LDA $7F0002, X ;| AND #$0FFF ;} Set PLM block to solid ORA #$8000 ;| STA $7F0002, X ;/ RTS ; Return DoorC842: ; Grey door facing left DW SetupC794, InstBE70, InstBE59 DoorC848: ; Grey door facing right DW SetupC794, InstBED9, InstBEC2 DoorC84E: ; Grey door facing up DW SetupC794, InstBF42, InstBF2B DoorC854: ; Grey door facing down DW SetupC794, InstBFAB, InstBF94 DoorC85A: ; Orange door facing left DW SetupC7B1, InstC014, InstBFFD DoorC860: ; Orange door facing right DW SetupC7B1, InstC077, InstC060 DoorC866: ; Orange door facing up DW SetupC7B1, InstC0DA, InstC0C3 DoorC86C: ; Orange door facing down DW SetupC7B1, InstC139, InstC122 DoorC872: ; Green door facing left DW SetupC7B1, InstC19C, InstC185 DoorC878: ; Green door facing right DW SetupC7B1, InstC1FB, InstC1E4 DoorC87E: ; Green door facing up DW SetupC7B1, InstC25A, InstC243 DoorC884: ; Green door facing down DW SetupC7B1, InstC2B9, InstC2A2 DoorC88A: ; Red door facing left DW SetupC7B1, InstC318, InstC301 DoorC890: ; Red door facing right DW SetupC7B1, InstC37A, InstC363 DoorC896: ; Red door facing up DW SetupC7B1, InstC3DC, InstC3C5 DoorC89C: ; Red door facing down DW SetupC7B1, InstC43E, InstC427 DoorC8A2: ; Blue door facing left DW SetupC7BB, InstC489, InstC49E DoorC8A8: ; Blue door facing right DW SetupC7BB, InstC4BA, InstC4CF DoorC8AE: ; Blue door facing up DW SetupC7BB, InstC4EB, InstC500 DoorC8B4: ; Blue door facing down DW SetupC7BB, InstC51C, InstC531 PLMC8BA: ; Blue door closing facing left DW SetupB3C1, InstC49E PLMC8BE: ; Blue door closing facing right DW SetupB3C1, InstC4CF PLMC8C2: ; Blue door closing facing up DW SetupB3C1, InstC500 PLMC8C6: ; Blue door closing facing down DW SetupB3C1, InstC531 CodeD753: ; Eye door subroutine. If room argument's door has been opened, wake up PLM. TXY LDA $1DC7, X ;\ JSL $80818E ;| LDA $7ED8B0, X ;} If door opened bit set: AND $05E7 ;| BEQ CodeD779 ;/ TYX LDA #CodeD779 ;\ STA $1CD7, X ;} Clear pre-PLM instruction LDA $7EDEBC, X ;\ STA $1D27, X ;} Next PLM instruction = PLM GoTo instruction LDA #$0001 ;\ STA $7EDE1C, X ;} PLM frame delay = 1 CodeD779: RTS ; Return ; Instruction D77A: Create an object with the argument argument. Also play a sound. ISpawnObject4: LDA $0000, Y ;\ PHY ;| LDY #$B743 ;} Spawn eye door projectile, $1993 = arguement JSL $868097 ;/ LDA #$004C ;\ JSL $8090CB ;} Play sound library 2, $0653 = 06h, sound 4Ch PLY INY ;\ INY ;} Return to next instruction RTS ;/ ; Instruction D790: Create an object with the argument argument. ISpawnObject5: LDA $0000, Y ;\ PHY ;| LDY #$B751 ;} Spawn enemy projectile $B751, $1993 = argument JSL $868097 ;/ PLY INY ;\ INY ;} Return to next instruction RTS ;/ ; Instruction D79F: Create a few objects ISpawnObject6: PHY LDA #$030A ;\ LDY #$E517 ;| JSL $868097 ;| LDA #$030A ;} Spawn, twice, enemy projectile $E517, $1993 = 030Ah LDY #$E517 ;| JSL $868097 ;/ PLY RTS ; Instruction D7B6: Create an object ISpawnObject7: PHY LDA #$000B ;\ LDY #$E517 ;} Spawn enemy projectile $E517, $1993 = 000Bh JSL $868097 ;/ PLY RTS ; Instruction D7C3: Move PLM up a block, setup that block and the 3 below it. IMoveSetBlocks1: PHX LDA $1C87, X ;\ SEC ;| SBC $07A5 ;} Move PLM up a block SBC $07A5 ;| STA $1C87, X ;/ TAX ;\ LDA #$C041 ;} Set PLM block to door facing right JSR WriteBlockTypeBTS ;/ BRA IMoveSetBlocks2_merge ; Branch to merge ; Instruction D7DA: Move PLM up a block, setup that block and the 3 below it. IMoveSetBlocks2: PHX LDA $1C87, X ;\ SEC ;| SBC $07A5 ;} Move PLM up a block SBC $07A5 ;| STA $1C87, X ;/ TAX ;\ LDA #$C040 ;} Set PLM block to door facing left JSR WriteBlockTypeBTS ;/ ; Branch to merge .merge TXA ;\ CLC ;| ADC $07A5 ;| ADC $07A5 ;| TAX ;| LDA #$D0FF ;| JSR WriteBlockTypeBTS ;| TXA ;| CLC ;| ADC $07A5 ;| ADC $07A5 ;} Set the three blocks below to copy the door tile TAX ;| LDA #$D0FE ;| JSR WriteBlockTypeBTS ;| TXA ;| CLC ;| ADC $07A5 ;| ADC $07A5 ;| TAX ;| LDA #$D0FD ;| JSR WriteBlockTypeBTS ;/ PLX RTS ; Eye door facing left eye InstD81E: DW IBranchDoor : DW .sub1 ; Branch to .sub1 if door index is set .loop1 DW $0004 : DW Draw9C03 DW IDetectSamus : DB $06, $04 : DW .sub2 ; Branch to .sub2 if Samus is within 6 blocks x and 4 blocks y DW IGoTo : DW .loop1 ; Branch to .loop1 .sub2 DW ISetGoTo : DW .sub3 ;\ DW ISetPreInstructionCode : DW CodeBD50 ;} Branch to .sub3 when shot with missile or super DW $0008 : DW Draw9C0B .loop2 DW IDetectSamus : DB $01, $04 : DW .sub4 ; Branch to .sub4 if Samus is within 1 block x and 4 blocks y DW $0040 : DW Draw9C13 DW ISpawnObject4 : DW $0000 ; Spawn projectile with sound DW $0020 : DW Draw9C13 DW ISpawnObject4 : DW $0000 ; Spawn projectile with sound DW $0020 : DW Draw9C13 DW ISpawnObject4 : DW $0000 ; Spawn projectile with sound DW $0040 : DW Draw9C13 DW $0006 : DW Draw9C0B DW $0030 : DW Draw9C03 DW $0030 : DW Draw9C03 DW $0006 : DW Draw9C0B DW IDetectSamus : DB $06, $04 : DW .loop2 ; Branch to .sub2 if Samus is within 6 blocks x and 4 blocks y DW IGoTo : DW .loop1 ; Branch to .loop1 .sub4 DW $0004 : DW Draw9C03 DW IGoTo : DW .loop2 ; Branch to .loop2 .sub3 DW IPlaySound2 : DB $09 ; Play sound library 2, $0653 = 06h, sound 09h DW ISpawnObject6 ;\ DW ISpawnObject6 ;} Spawn some projectiles DW IDoorHit : DB $03 : DW .sub5 ; If door hit 3 times: clear pre-PLM, set door as opened, and branch to .sub5 DW $0002 : DW Draw9C1B DW $0002 : DW Draw9C23 DW ISpawnObject6 ; Spawn some projectiles DW $0002 : DW Draw9C1B DW $0002 : DW Draw9C23 DW $0002 : DW Draw9C1B DW ISpawnObject6 ; Spawn some projectiles DW $0002 : DW Draw9C23 DW $0004 : DW Draw9C0B DW $0008 : DW Draw9C03 DW ISpawnObject5 : DW $0000 ; Spawn a projectile DW $0038 : DW Draw9C03 DW $0004 : DW Draw9C0B DW $0004 : DW Draw9C23 DW IGoTo : DW .loop2 ; Branch to .loop2 .sub5 DW IStopPreInstructionCode ; Clear pre-PLM (again) DW ISpawnObject7 ;\ DW ISpawnObject7 ;| DW ISpawnObject6 ;} Spawn some projectiles DW ISpawnObject6 ;/ DW IMoveSetBlocks2 ; Move PLM up a block and set to door facing left DW ISetCounter8 : DB $0A ; Set PLM variable to 10 .loop3 DW $0003 : DW Draw9BF7 DW $0004 : DW DrawA9A7 DW IGoToDecrement : DW .loop3 ; Decrement PLM variable, if non-zero, branch to .loop3 DW IGoTo : DW InstC49E_sub ; Branch to blue door closing facing left sub .sub1 DW IMoveSetBlocks2 ; Move PLM up a block and set to door facing left DW IGoTo : DW InstC49E_sub ; Branch to blue door closing facing left sub ; Eye door facing left top InstD8E9: DW IBranchDoor : DW .sub1 ; Branch to .sub1 if door index is set .loop1 DW IDetectSamus : DB $06, $10 : DW .sub2 ; Branch to .sub2 if Samus is within 6 blocks x and 16 blocks y DW $0008 : DW Draw9C2B DW IGoTo : DW .loop1 ; Branch to .loop1 .sub2 DW ISetGoTo : DW .sub1 ;\ DW ISetPreInstructionCode : DW CodeD753 ;} Branch to .sub1 when door opened bit is set .loop2 DW $0008 : DW Draw9C2B DW $0008 : DW Draw9C31 DW $0008 : DW Draw9C37 DW $0008 : DW Draw9C31 DW IDetectSamus : DB $06, $10 : DW .loop2 ; Branch to .loop2 if Samus is within 6 blocks x and 16 blocks y DW IGoTo : DW .loop1 ; Branch to .loop1 .sub1 DW IKill ; Delete the PLM ; Eye door facing left bottom InstD91F: DW IBranchDoor : DW .sub1 ; Branch to .sub1 if door index is set .loop1 DW IDetectSamus : DB $06, $10 : DW .sub2 ; Branch to .sub2 if Samus is within 6 blocks x and 16 blocks y DW $0008 : DW Draw9C3D DW IGoTo : DW .loop1 ; Branch to .loop1 .sub2 DW ISetGoTo : DW .sub1 ;\ DW ISetPreInstructionCode : DW CodeD753 ;} Branch to .sub1 when door opened bit is set .loop2 DW $0008 : DW Draw9C3D DW $0008 : DW Draw9C43 DW $0008 : DW Draw9C49 DW $0008 : DW Draw9C43 DW IDetectSamus : DB $06, $10 : DW .loop2 ; Branch to .loop2 if Samus is within 6 blocks x and 16 blocks y DW IGoTo : DW .loop1 ; Branch to .loop1 .sub1 DW IKill ; Delete the PLM ; Eye door facing right eye InstD955: DW IBranchDoor : DW .sub1 ; Branch to .sub1 if door index is set .loop1 DW $0004 : DW Draw9C5B DW IDetectSamus : DB $06, $04 : DW .sub2 ; Branch to .sub2 if Samus is within 6 blocks x and 4 blocks y DW IGoTo : DW .loop1 ; Branch to .loop1 .sub2 DW ISetGoTo : DW .sub3 ;\ DW ISetPreInstructionCode : DW CodeBD50 ;} Branch to .sub3 when shot with missile or super DW $0008 : DW Draw9C63 .loop2 DW IDetectSamus : DB $01, $04 : DW .sub4 ; Branch to .sub4 if Samus is within 1 block x and 4 blocks y DW $0040 : DW Draw9C6B DW ISpawnObject4 : DW $0014 ; Spawn projectile with sound DW $0020 : DW Draw9C6B DW ISpawnObject4 : DW $0014 ; Spawn projectile with sound DW $0020 : DW Draw9C6B DW ISpawnObject4 : DW $0014 ; Spawn projectile with sound DW $0040 : DW Draw9C6B DW $0006 : DW Draw9C63 DW $0030 : DW Draw9C5B DW $0030 : DW Draw9C5B DW $0006 : DW Draw9C63 DW IDetectSamus : DB $06, $04 : DW .loop2 ; Branch to .sub2 if Samus is within 6 blocks x and 4 blocks y DW IGoTo : DW .loop1 ; Branch to .loop1 .sub4 DW $0004 : DW Draw9C5B DW IGoTo : DW .loop2 ; Branch to .loop2 .sub3 DW IPlaySound2 : DB $09 ; Play sound library 2, $0653 = 06h, sound 09h DW ISpawnObject6 ;\ DW ISpawnObject6 ;} Spawn some projectiles DW IDoorHit : DB $03 : DW .sub5 ; If door hit 3 times: clear pre-PLM, set door as opened, and branch to .sub5 DW $0002 : DW Draw9C73 DW $0002 : DW Draw9C7B DW ISpawnObject6 ; Spawn some projectiles DW $0002 : DW Draw9C73 DW $0002 : DW Draw9C7B DW $0002 : DW Draw9C73 DW ISpawnObject6 ; Spawn some projectiles DW $0002 : DW Draw9C7B DW $0004 : DW Draw9C63 DW $0008 : DW Draw9C5B DW ISpawnObject5 : DW $0004 ; Spawn a projectile DW $0038 : DW Draw9C5B DW $0004 : DW Draw9C63 DW $0004 : DW Draw9C7B DW IGoTo : DW .loop2 ; Branch to .loop2 .sub5 DW IStopPreInstructionCode ; Clear pre-PLM (again) DW ISpawnObject7 ;\ DW ISpawnObject7 ;| DW ISpawnObject6 ;} Spawn some projectiles DW ISpawnObject6 ;/ DW IMoveSetBlocks1 ; Move PLM up a block and set to door facing right DW ISetCounter8 : DB $0A ; Set PLM variable to 10 .loop3 DW $0003 : DW Draw9C4F DW $0004 : DW DrawA9E3 DW IGoToDecrement : DW .loop3 ; Decrement PLM variable, if non-zero, branch to .loop3 DW IGoTo : DW InstC4CF_sub ; Branch to blue door closing facing right sub .sub1 DW IMoveSetBlocks1 ; Move PLM up a block and set to door facing right DW IGoTo : DW InstC4CF_sub ; Branch to blue door closing facing right sub ; Eye door facing right top InstDA20: DW IBranchDoor : DW .sub1 ; Branch to .sub1 if door index is set .loop1 DW IDetectSamus : DB $06, $10 : DW .sub2 ; Branch to .sub2 if Samus is within 6 blocks x and 16 blocks y DW $0008 : DW Draw9C83 DW IGoTo : DW .loop1 ; Branch to .loop1 .sub2 DW ISetGoTo : DW .sub1 ;\ DW ISetPreInstructionCode : DW CodeD753 ;} Branch to .sub1 when door opened bit is set .loop2 DW $0006 : DW Draw9C83 DW $0006 : DW Draw9C89 DW $0006 : DW Draw9C8F DW $0006 : DW Draw9C89 DW IDetectSamus : DB $06, $10 : DW .loop2 ; Branch to .loop2 if Samus is within 6 blocks x and 16 blocks y DW IGoTo : DW .loop1 ; Branch to .loop1 .sub1 DW IKill ; Delete the PLM ; Eye door facing right bottom InstDA56: DW IBranchDoor : DW .sub1 ; Branch to .sub1 if door index is set .loop1 DW IDetectSamus : DB $06, $10 : DW .sub2 ; Branch to .sub2 if Samus is within 6 blocks x and 16 blocks y DW $0008 : DW Draw9C95 DW IGoTo : DW .loop1 ; Branch to .loop1 .sub2 DW ISetGoTo : DW .sub1 ;\ DW ISetPreInstructionCode : DW CodeD753 ;} Branch to .sub1 when door opened bit is set .loop2 DW $0006 : DW Draw9C95 DW $0006 : DW Draw9C9B DW $0006 : DW Draw9CA1 DW $0006 : DW Draw9C9B DW IDetectSamus : DB $06, $10 : DW .loop2 ; Branch to .loop2 if Samus is within 6 blocks x and 16 blocks y DW IGoTo : DW .loop1 ; Branch to .loop1 .sub1 DW IKill ; Delete the PLM SetupDA8C: ; Eye door eye setup. If room argument's door bit isn't set, setup two blocks. PHY LDA $1DC7, Y ;\ JSL $80818E ;| LDA $7ED8B0, X ;| PLY ;} If door opened bit is clear: AND $05E7 ;| BNE + ;/ LDX $1C87, Y ;\ LDA #$C044 ;| JSR WriteBlockTypeBTS ;| LDA $1C87, Y ;| CLC ;| ADC $07A5 ;} Set PLM block and block below to shotblock, BTS 44h ADC $07A5 ;| TAX ;| LDA #$D0FF ;| JSR WriteBlockTypeBTS ;/ + RTS SetupDAB9: ; Eye door top/bottom setup. If room argument's door bit isn't set, setup block. PHY ;\ LDA $1DC7, Y ;| JSL $80818E ;| LDA $7ED8B0, X ;} If door opened bit is clear: PLY ;| AND $05E7 ;/ BNE + ;\ LDX $1C87, Y ;| LDA #$A000 ;} Set PLM block to spike block JSR WriteBlockTypeBTS ;/ + RTS PLMDB48: ; Eye door facing right eye DW SetupDA8C, InstD955 DoorDB4C: ; Eye door facing right top DW SetupDAB9, InstDA20, InstDoNotMake PLMDB52: ; Eye door facing right bottom DW SetupDAB9, InstDA56 PLMDB56: ; Eye door facing left eye DW SetupDA8C, InstD81E DoorDB5A: ; Eye door facing left top DW SetupDAB9, InstD8E9, InstDoNotMake PLMDB60: ; Eye door facing left bottom DW SetupDAB9, InstD91F