lorom ; cheat is 7FFA0202 for player 2 ; A08F5E CMP #$0800 defines the max amount of enemies in a room ; I suggest setting it to #$0200 (max. of 8 enemies per room) ; player 1 - 4 can be enemies, plus some other ones for decoration { org $86A922 DB $80 org $86A92F DB $80 org $86A942 DB $80 org $86A94F DB $80 org $90E891 REP 7 : NOP org $90F5FD REP 10 : NOP org $90F60C DB $80 org $9BB49B STZ $0DEC LDA #$0001 PLB PLP RTL org $A593DA RTL org $A5941B RTL org $A59430 RTL org $A59441 RTL org $A59466 RTL org $B49ABA DB $80 org $B49F0D RTL org $B49F36 RTL } org $B49A6E REP 7 : NOP { ;org $8094D4 ; REP 5 : NOP ;org $81A809 ; REP 3 : NOP ; DB $80, $10 ;org $81A816 ; REP 3 : NOP ; DB $80, $03 ;org $81A8AC ; REP 5 : NOP ;org $81A8AC ; REP 3 : NOP ; DB $80, $3A ;org $81AD90 ; REP 3 : NOP ; DB $80, $07 ;org $82B6AE ; REP 3 : NOP ; DB $80, $09 } { ;org $809459 !player = $7FFA02 ;This byte is set to 1 by the host and to 2 by the client ; JSR FREE ;LDA $4218 ;controller 1 ; STA $8B ; EOR $97 ; AND $8B ; STA $8F ; STA $93 ; LDA $8B ; BEQ + ; CMP $97 ; BNE + ; DEC $A3 ; BNE ++ ; LDA $8B ; STA $93 ; LDA $89 ; STA $A3 ; BRA ++ ;+ ; LDA $87 ; STA $A3 ;++ ; LDA $8B ; STA $97 ; REP 6 : NOP ; LDA !number ; AND #$00FF ; CMP #$0003 ; BMI + ; PLP ; RTL ;+ ; JSR FREE2 ;org $80CDA0 ;!number = $7FFA04 ;FREE: ; LDA !player ; AND #$00FF ; CMP #$0001 ; BEQ PONE ; CMP #$0002 ; BEQ PTWO ; JMP FREE ;FREE2: ;this marks the host as 'pseudo player 2' ; LDA !player ; AND #$00FF ; CMP #$0001 ; BEQ PSEUDOONE ; CMP #$0002 ; BEQ PSEUDOTWO ; JMP FREE2 ;PONE: ; JSR GETSTATUS ;PSEUDOTWO: ; LDA $4218 ; RTS ;PTWO: ; JSR GETSTATUS ;PSEUDOONE: ; LDA $421A ; RTS ;GETSTATUS: ; SEP #$20 ;- ; LDA $4212 ;check controller status ; AND #$01 ; BNE - ; REP #$20 ; RTS } { org $80A9B1 DB $80 org $81AD95 REP 7 : NOP org $82F1DC RTS org $90E789 PLP RTS org $90E7D8 PLB PLP RTL org $90F54C RTS org $90F60C DB $80 org $918489 PLB PLP RTL org $9184DB PLB PLP RTL org $A5937E RTL org $B49329 LDA #$0001 RTS org $B49587 DB $80 org $B495CF LDA #$0001 RTS org $B49646 RTS org $B496DD DB $80 org $B49702 DB $80 org $B4975D DB $80 org $B49961 STZ $185C LDA #$0000 RTS org $B49A59 JMP $9AB2 org $B49ABA DB $80 org $B49BDA DB $80 org $B49C62 DB $80 org $B49CEA DB $80 org $B49D72 DB $80 org $B49DFA DB $80 org $B49E82 DB $80 } ;________________ { org $809490 REP 7 : NOP !X = $0F7A,x ;enemy X pos (from room pop) !Y = $0F7E,x ;enemy Y pos (from room pop) !index = $0E54 !samusx = $0AF6 !samusy = $0AFA !up = #$0800 !down = #$0400 !left = #$0200 !right = #$0100 !jump = #$0080 org $8094DF REP 7 : NOP org $8094C2 PLP RTL org $A0F7E5 DW INIT org $A0F7EB DW RUNNING ;org $A0F824 ; DW INIT2 org $A0F82B DW RUNNING2 org $A3F320 INIT: ;LDX !index ;enemy index ;LDA #$0001 ;Action delay ;STA $0F94,x ;LDA $0F86,x ;enemy status ;ORA #$0400 ;makes it harmless ;STA $0F86,x ;STZ $0F90,x ;LDA !samusx ;STA !X ;LDA !samusy ;STA !Y ;LDA #$E9CF ;STA $0F92,x JSL $A3EA4F RTL RUNNING: JSL $A3EBAD LDX !index LDA !player AND #$00FF CMP #$0002 BNE + LDA !X SEC SBC #$0080 STA $0911 LDX !index LDA !Y SEC SBC #$0080 STA $0915 LDX !index + LDA $91 BIT !jump BEQ + LDA #$0058 JSL $8090A3 + LDA $8D BIT !up BNE + - BIT !down BNE ++ -- BIT !left BNE +++ --- BIT !right BEQ QUIT1 INC !X INC !X BRA QUIT1 + DEC !Y DEC !Y BRA - ++ INC !Y INC !Y BRA -- +++ DEC !X DEC !X BRA --- QUIT1: RTL RUNNING2: PHY ;JSL $A39D16 LDX !index LDA !player AND #$00FF CMP #$0002 BNE + LDA !X SEC SBC #$0080 STA $0911 LDX !index LDA !Y SEC SBC #$0080 STA $0915 + LDA $91 BIT !jump BEQ + LDA #$0058 JSL $8090A3 + LDX !index LDA $8D BEQ STAND BIT !up BNE STAND ;+ ;- BIT !down BNE STAND ;++ BIT !jump BNE STAND ;++ ;-- BIT !left BNE +++ --- BIT !right BEQ QUIT2 STZ $0FB4,x INC $0FB4,x ; PHA ; JSR $9D83 ; JSL $A39D39 ; PLA TAY LDA #$0001 STA $7E7804,x ;STA $7E7800,x TYA LDY #$9C55 BRA QUIT2 ;+ ; DEC !Y ; DEC !Y ; TAY ; LDA $0FB4,x ; BEQ + ; TYA ; LDY #$9C29 ; BRA - ;+ ; TYA ; LDY #$9C13 ; TAY ; LDA #$0000 ; STA $7E7800,x ; TYA ; BRA - ;++ ; INC !Y ; INC !Y ; TAY ; LDA $0FB4,x ; BEQ + ; TYA ; LDY #$9C29 ; BRA -- ;+ ; TYA ; LDY #$9C13 ;BRA -- +++ STZ $0FB4,x ; PHA ; JSR $9D5E ; JSL $A39D39 ; PLA ; TAY LDA #$0000 STA $7E7804,x ;STA $7E7800,x TYA LDY #$9C3F BRA --- ;STAND: ; TAY ; LDA $0FB4,x ; BEQ + ; TYA ; LDY #$9C29 ; BRA QUIT2 ;+ ; LDY #$9C13 QUIT2: LDA $91 BEQ + TYA STA $0F92,x LDA #$0001 ;Action delay STA $0F94,x STZ $0F90,x ;timer for different actions + JSL $A39D16 STAND: PLY RTL } org $858080 ;removes message boxes PHP org $858490 LDX #$0003 { ;$A39D5E is left ;$A39D83 is right ;FIGHTER PIRATES: ;B2F6A2 running code ;B2804B is RTS ;B2F6A9 seek samus left, then check for projectiles !shoot = $09B2 !L = $09BE org $A0D897 DW ATOMIC org $A8F9D0 ;A8E3C3 ATOMIC: LDX !index LDA !player AND #$00FF CMP #$0002 BNE + LDA !X SEC SBC #$0080 STA $0911 LDX !index LDA !Y SEC SBC #$0080 STA $0915 LDX !index + LDA $91 BIT !jump BEQ AS ;LDA #$003E ;JSL $8090A3 LDX !index ;LDY #$F498 ;LDY #$EBA0 LDA $0F7A,x STA $12 LDA $0F7E,x STA $14 LDA $0FB2,x STA $16 LDY #$A17B ;space pirate shot JSL $868097 ;JSL $A8E6E6 ;JSR $E6FB JMP C AS: BIT !shoot BEQ B LDA #$001C JSL $809125 LDX !index LDA $0F7A,x STA $12 LDA $0F7E,x STA $14 ;LDA $0FB2,x ;STA $16 ;LDA #$0009 ;explosions ;LDY #$E509 ;JSL $868097 ;LDY #$A387 ;elevator LDX !index LDA $0FB2,x ;0 = left ASL ASL LDY #$DAFE ;Saboten JSL $868027 BRA C ; LDA #$0000 ; LDY #$DAFE ; JSL $868027 B: BIT !L BEQ C LDX !index LDA $0F7A,x STA $12 LDA $0F7E,x STA $14 LDY #$F498 JSL $868027 LDA #$0007 JSR $809021 C: LDX !index LDA $8D BIT !up BNE + - BIT !down BNE ++ -- BIT !left BNE +++ --- BIT !right BEQ QUIT3 STZ $0FB2,x INC $0FB2,x INC !X INC !X BRA QUIT3 + DEC !Y DEC !Y BRA - ++ INC !Y INC !Y BRA -- +++ STZ $0FB2,x DEC !X DEC !X BRA --- QUIT3: RTL org $86D9BB DW $F000 ;saboten spike speed skip 4 DW $0F00 ;same } !pausetime = $0A78 org $828999 DW STATE0C DW STATE0D org $828CCF STATE0C: REP #$30 PHP LDA $073B BEQ TIME DEC $073B AND #$0007 BNE PAUSE TIME: LDA $8F BIT #$1000 BEQ PAUSE LDA #$000D STA $0998 BRA PAUSED PAUSE: JSL $808924 ;Darkens the screen LDA $51 ;Load screen brightness AND #$000F CMP #$000A BPL PAUSED LDA $51 AND #$FFF0 ORA #$000A STA $51 PAUSED: LDA #$001B JSR $90F084 JSL $86800B : JSL $8483B8 : JSL $87800B : JSL $8DC4CD SEP #$20 LDA #$00 STA $85 ;turn HDMAs off STA $420C REP #$20 JSL $888293 LDA #$8001 STA !pausetime STA $05F7 JSR $8B44 JSR $90EAAB PLP RTS STATE0D: REP #$30 PHP JSL $80894D ;Brighten the screen to normal LDA $51 ;Load screen brightness AND #$000F CMP #$000F ;Check if fully bright again BNE PAUSED ;If not, skip changing states JSL $868000 JSL $8483AD JSL $878000 JSL $8DC4C2 JSL $82BE2F STZ !pausetime STZ $05F7 LDA #$0008 STA $0998 LDA #$0010 JSL $90F084 JSR $8B44 ;Main engine for state 08 JSL $90EAAB PLP RTS ;90DD5C ;0C: Pausing (normal gameplay but darkening) ;0D: Paused, loading pause screen? ;0E: Paused, continuation of above? ;0F: Paused, map and item screens ;10: Unpausing (Loading normal gameplay) ;11: Unpausing (continuation of above) ;12: Unpausing (normal gameplay but brightening) org $90AED1 JMP CHECK BACK: org $90F640 CHECK: LDA !pausetime BNE + LDA #$0012 JMP BACK + PLP RTS org $8B9374 LDY #$80BB ;NINTENDO sprite array STZ $16 LDA #$00A0 ;X STA $14 LDA #$0070 ;Y STA $12 JSR $81879F ;DISPLAY SPRITE! :D org $8B9757 ;graphics depending on X, sets Y and A, also Intro text