Edit: Irgendwie ist das witzig ich heiße nämlich auch Patrick xD
;Block that is passable only when you have 4 (or specified number) dragon coins.
;Change the number after the CMP #$ to specify the number of dragon coins needed.
print "A block that is passable only when the player has 4 dragon coins."
db $42
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
JMP Corner : JMP BodyIn : JMP HeadIn
Corner:
HeadIn:
BodyIn:
MarioAbove:
MarioBelow:
MarioSide:
LDA $1420 ;Load number of dragon coins
CMP #$01
BEQ GotCoins ;Branch to 'Gotcoins'
LDY #$01 ;act like tile 130 (Grey cement block)
LDA #$30
STA $1693
RTL
SpriteV:
SpriteH:
MarioCape:
MarioFireBall:
GotCoins:
RTL
!DragonCoins = $1420 ; Falls es nicht funktioniert, nutzt stattdessen $1420
JMP Mario : JMP Mario : JMP Mario
JML Return : JML Return
JML Return : JML Return
JMP Mario : JMP Mario : JMP Mario
Mario:
LDA !DragonCoins
BEQ Return
LDA #$01 ; Replace block with block # 025
STA $9C
PHY
JSL $00BEB0 ; Make the block disappear.
PLY
DEC !DragonCoins
Return:
RTL
LDY $57
JSR GetItemMemoryBit
LDA $0F
BNE .return
LDA #$xx ; Das ist die Nummer, wo das Map16-Tile ist ohne die Seite
STA [$6B],y
LDA #$yy ; Das ist die Seite, wo das Map16-Tile ist
STA [$6E],y
.return
RTS
!DragonCoins = $1420 / $1422 ; Falls es nicht funktioniert, nutzt stattdessen $1420
JMP Mario : JMP Mario : JMP Mario
JML Return : JML Return
JML Return : JML Return
JMP Mario : JMP Mario : JMP Mario
Mario:
LDA !DragonCoins
BEQ Return
LDA #$01 ; Replace block with block # 025
STA $9C
PHY
JSL $00BEB0 ; Make the block disappear.
PLY
DEC !DragonCoins
Return:
RTL
;Block that is passable only when you have 4 (or specified number) dragon coins.
;Change the number after the CMP #$ to specify the number of dragon coins needed.
;print "A block that is passable only when the player has 4 dragon coins."
db $42
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
JMP Corner : JMP BodyIn : JMP HeadIn
Corner:
HeadIn:
BodyIn:
MarioAbove:
MarioBelow:
MarioSide:
LDA $1420 ;Load number of dragon coins
CMP #$01
BCS GotCoins ;Branch to 'Gotcoins'
BCC Reset ;Branch to 'Reset'
LDY #$01 ;act like tile 130 (Grey cement block)
LDA #$30
STA $1693
RTL
SpriteV:
SpriteH:
MarioCape:
MarioFireBall:
GotCoins:
LDA $1422
DEC $1422
CMP #$00
BEQ Reset
LDA $1420
DEC $1420
RTL
Reset:
RTL
RTL
db $42
JMP Mario : JMP Mario : JMP Mario
JML Return : JML Return
JML Return : JML Return
JMP Mario : JMP Mario : JMP Mario
Mario:
LDA $1420
BEQ Return
LDA #$01 ; Replace block with block # 025
STA $9C
PHY
JSL $00BEB0 ; Make the block disappear.
PLY
DEC $1420
DEC $1422
Return:
RTL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Level end trigger, by mikeyk
;;
;; Description: This sprite will cause the level to end when all the enemies on screen
;; are killed. This version ignnores sprites that don't turn into a coin when the goal
;; tape is passed.
;;
;; Uses first extra bit: YES
;; When the first extra bit is clear, the sprite will trigger the regular exit. When it
;; is set, the sprite will trigger the secret exit.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EXTRA_BITS = $7FAB10
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; sprite data
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EXTRA_PROP_1 = $7FAB28
EXTRA_PROP_2 = $7FAB34
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; sprite init JSL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dcb "INIT"
RTL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; sprite code JSL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dcb "MAIN"
LDA $1493
BNE RETURN
LDA $13C6
BNE RETURN
LDY #$0B
LOOP_START:
LDA $14C8,y
CMP #$08
BCS TestTweakerBits
DONT_CHECK:
DEY
BPL LOOP_START
LDA #$FF ; \ set time before return to overworld
STA $1493 ; /
LDA EXTRA_BITS,x ; set secret exit if first extra bit is set
LSR A
LSR A
LSR A
AND #$01
EOR #$01
STA $141C
LDA EXTRA_PROP_1,x
CMP #$01
BEQ WALK
DEC $13C6 ; prevent mario from walking at level end
WALK:
LDA EXTRA_PROP_2,x
STA $1DFB
TestTweakerBits:
LDA $1686,y
AND #$20
BNE DONT_CHECK
RETURN:
RTL
LDA $19 ;\If Mario's powerup
CMP #$01 ;|is Big
BEQ GETPOWER ;|then continue
LDA #$00 ;|but if he gets hit or gets another powerup
STA $0DC6 ;/then reset the powerup RAM to Zero.
GETPOWER
JSR SPRITE_CODE_START
PLB
RTL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;flutter/wall jump generator
;based on generator by ICB
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Uses first extra bit: NO
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RAM_IsDucking = $73
RAM_OnYoshi = $187A
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; sprite code JSL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dcb "INIT" ;generators don't have an init routine
dcb "MAIN"
PHB
PHK
PLB
LDA $19 ;\If Mario's powerup
CMP #$01 ;|is Big
BEQ GETPOWER ;|then continue
LDA #$00 ;|but if he gets hit or gets another powerup
STA $0DC6 ;/then reset the powerup RAM to Zero.
GETPOWER
JSR SPRITE_CODE_START
PLB
RTL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; main sprite code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Return_A RTS
SPRITE_CODE_START
LDA $19 ;only let generator process
CMP #$01 ;if big mario
BNE Return_A ;other end
LDA $0DC6
CMP #$03 ;if mode = 3, let mario wallkick
BEQ SET_WALL
CMP #$04 ;if mode = 4, let mario flutter
BEQ SET_FLUTTER
BNE Return_A ;otherwise return
LDA RAM_IsDucking ;if ducking
ORA RAM_OnYoshi ;or on yoshi
BNE Return_A ;end
SET_WALL
LDA $76
BEQ Right
BRA Left
Left LDA $77
AND #$03
BEQ Return6
LDA $15
AND #$80
BEQ Return6
LDA #$E0 ;Horizontal speed
STA $7B ;
LDA #$A7 ;
STA $7D ;Vertical Speed
LDA #$02 ;
STA $1DF9 ;"Click" Sound effect
STZ $76 ;Direction left
BRA Return6 ;Always Return
Right LDA $77
AND #$03
BEQ Return6
LDA $16
AND #$80
BEQ Return6
LDA #$20 ;Horizontal Speed
STA $7B ;
LDA #$A7 ;Vertical Speed
STA $7D ;
LDA #$02 ;
STA $1DF9 ;Click sound effect
LDA #$01 ;Direction Right
STA $76
BRA Return6
Return6 RTS ;return
Return_Again RTS
SET_FLUTTER
LDA $19 ;recheck
CMP #$01
BNE Return_Again
LDA $0DC6
CMP #$04 ;mode = 4
BNE Return_Again
LDA $77
AND #$04
BNE Reset ;won't work while swimming, on air, yoshi
LDA $75
BNE Reset
LDA $74
BNE Reset
LDA $187A
BNE Reset
LDA $140D ;spin jump flutter
BNE Check
LDA $0660
BEQ Check
LDA $1499
BNE Return
LDA $7D
CMP #$7F
BCC Rest
LDA $1470
BNE Carry
LDA $148F
BNE Carry
LDA $0660
CMP #$02
BCS Stand
LDA #$05
STA $13E0
INC $0660
BRA Return
Check
LDA $16 ;button to push
CMP #$80
BNE Return
STZ $140D
LDA #$BF
STA $7D
INC $0660
LDA #$01
STA $1DFA
BRA Return
Stand
LDA #$04
STA $13E0
DEC $0660
BRA Return
Reset
STZ $0660
BRA Return
Rest
LDA $0660
CMP #$15 ;To stop the advantage(or to increase rest time,) increase this hexidecimal number
BNE Rest1
STZ $0660
BRA Check
Rest1
INC $0660 ;continues rest time
BRA Return
Carry
LDA $0660 ;same as above
CMP #$02
BCS Run
LDA #$08
STA $13E0
INC $0660
BRA Return
Run
LDA #$07
STA $13E0
DEC $0660
BRA Return
Return RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Wall jump powerup, by Iceguy
;; Based on wall jump block by Ersanio
;;
;;
;; Description: This sprite, when collected by Mario, will make him turn big and give
;; him the ability to wall jump! If he gets hit, he loses the powerup. For the sprite
;; to work, place the generator at all secondary entrances.
;;
;; This sprite does not use the extra bit.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; sprite init JSL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dcb "INIT"
RTL
dcb "MAIN"
PHB
PHK
PLB
JSR SPRITE_ROUTINE
PLB
RTL
SPRITE_ROUTINE LDA $14C8,x ; return if sprite status != 8
CMP #$08
BNE RETURNED
JSR SUB_GFX
LDA $9D ; return if sprites locked
BNE RETURNED
JSR SUB_OFF_SCREEN_X0 ; only process sprite while on screen
LDA $187A ;if on yoshi
BNE RETURNED ;end code
JSL $01A7DC ;mario/sprite contact..
BCC RETURNED
LDA #$04 ;play flower animation
STA $71
LDA #$30 ;cycle through palettes
STA $149B
LDA #$01 ;make mario big
STA $19
LDA #$0A ;play SFX
STA $1DF9
LDA #$03 ;set new mode
STA $0DC6
STZ $14C8,x ;and erase sprite
BRA Check_Whole ;then check main code
RETURNED RTS
;This part of the code is not executed by the sprite
;it is executed by the generator
;the code below will do nothing if you change it
;except for the graphics routine
Check_Whole STZ $7D
LDA $76
BEQ JumpRight
BRA JumpLeft
JumpLeft LDA $15 ;
AND #$80 ;If you dont press the jump button, return.
BEQ Return ;
LDA #$E0 ;Horizontal speed
STA $7B ;
LDA #$A7 ;
STA $7D ;Vertical Speed
LDA #$02 ;
STA $1DF9 ;"Click" Sound effect
STZ $76 ;Direction left
BRA Return ;Always Return
JumpRight
LDA $16
AND #$80 ;If you dont press the jump button, return.
BEQ Return
LDA #$20 ;Horizontal Speed
STA $7B ;
LDA #$A7 ;Vertical Speed
STA $7D ;
LDA #$02 ;
STA $1DF9 ;Click sound effect
LDA #$01 ;Direction Right
STA $76
Return RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; GRAPHICS ROUTINE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SUB_GFX JSR GET_DRAW_INFO ; after: Y = index to sprite OAM ($300)
; $00 = sprite x position relative to screen boarder
; $01 = sprite y position relative to screen boarder
LDA $157C,x ; $02 = sprite direction
STA $02
LDA $00 ; set x position of the tile
STA $0300,y
LDA $01 ; set y position of the tile
STA $0301,y
LDA #$C2 ; set tile number
STA $0302,y
LDA $15F6,x ; get sprite palette info
PHX
LDX $02 ; flip the tile if the sprite direction is 0
BNE NO_FLIP_1
ORA #$40
NO_FLIP_1 PLX
ORA $64 ; add in the priority bits from the level settings
STA $0303,y ; set properties
INY ; get the index to the next slot of the OAM
INY ; (this is needed if you wish to draw another tile)
INY
INY
LDY #$02 ; #$02 means the tiles are 16x16
LDA #$00 ; This means we drew one tile
JSL $01B7B3
RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ROUTINES FROM THE LIBRARY ARE PASTED BELOW
; You should never have to modify this code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; GET_DRAW_INFO
; This is a helper for the graphics routine. It sets off screen flags, and sets up
; variables. It will return with the following:
;
; Y = index to sprite OAM ($300)
; $00 = sprite x position relative to screen boarder
; $01 = sprite y position relative to screen boarder
;
; It is adapted from the subroutine at $03B760
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SPR_T1 dcb $0C,$1C
SPR_T2 dcb $01,$02
GET_DRAW_INFO STZ $186C,x ; reset sprite offscreen flag, vertical
STZ $15A0,x ; reset sprite offscreen flag, horizontal
LDA $E4,x ; \
CMP $1A ; | set horizontal offscreen if necessary
LDA $14E0,x ; |
SBC $1B ; |
BEQ ON_SCREEN_X ; |
INC $15A0,x ; /
ON_SCREEN_X LDA $14E0,x ; \
XBA ; |
LDA $E4,x ; |
REP #$20 ; |
SEC ; |
SBC $1A ; | mark sprite invalid if far enough off screen
CLC ; |
ADC.W #$0040 ; |
CMP.W #$0180 ; |
SEP #$20 ; |
ROL A ; |
AND #$01 ; |
STA $15C4,x ; /
BNE INVALID ;
LDY #$00 ; \ set up loop:
LDA $1662,x ; |
AND #$20 ; | if not smushed (1662 & 0x20), go through loop twice
BEQ ON_SCREEN_LOOP ; | else, go through loop once
INY ; /
ON_SCREEN_LOOP LDA $D8,x ; \
CLC ; | set vertical offscreen if necessary
ADC SPR_T1,y ; |
PHP ; |
CMP $1C ; | (vert screen boundry)
ROL $00 ; |
PLP ; |
LDA $14D4,x ; |
ADC #$00 ; |
LSR $00 ; |
SBC $1D ; |
BEQ ON_SCREEN_Y ; |
LDA $186C,x ; | (vert offscreen)
ORA SPR_T2,y ; |
STA $186C,x ; |
ON_SCREEN_Y DEY ; |
BPL ON_SCREEN_LOOP ; /
LDY $15EA,x ; get offset to sprite OAM
LDA $E4,x ; \
SEC ; |
SBC $1A ; | $00 = sprite x position relative to screen boarder
STA $00 ; /
LDA $D8,x ; \
SEC ; |
SBC $1C ; | $01 = sprite y position relative to screen boarder
STA $01 ; /
RTS ; return
INVALID PLA ; \ return from *main gfx routine* subroutine...
PLA ; | ...(not just this subroutine)
RTS ; /
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SUB_OFF_SCREEN
; This subroutine deals with sprites that have moved off screen
; It is adapted from the subroutine at $01AC0D
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SPR_T12 dcb $40,$B0
SPR_T13 dcb $01,$FF
SPR_T14 dcb $30,$C0,$A0,$C0,$A0,$F0,$60,$90 ;bank 1 sizes
dcb $30,$C0,$A0,$80,$A0,$40,$60,$B0 ;bank 3 sizes
SPR_T15 dcb $01,$FF,$01,$FF,$01,$FF,$01,$FF ;bank 1 sizes
dcb $01,$FF,$01,$FF,$01,$00,$01,$FF ;bank 3 sizes
SUB_OFF_SCREEN_X1 LDA #$02 ; \ entry point of routine determines value of $03
BRA STORE_03 ; | (table entry to use on horizontal levels)
SUB_OFF_SCREEN_X2 LDA #$04 ; |
BRA STORE_03 ; |
SUB_OFF_SCREEN_X3 LDA #$06 ; |
BRA STORE_03 ; |
SUB_OFF_SCREEN_X4 LDA #$08 ; |
BRA STORE_03 ; |
SUB_OFF_SCREEN_X5 LDA #$0A ; |
BRA STORE_03 ; |
SUB_OFF_SCREEN_X6 LDA #$0C ; |
BRA STORE_03 ; |
SUB_OFF_SCREEN_X7 LDA #$0E ; |
STORE_03 STA $03 ; |
BRA START_SUB ; |
SUB_OFF_SCREEN_X0 STZ $03 ; /
START_SUB JSR SUB_IS_OFF_SCREEN ; \ if sprite is not off screen, return
BEQ RETURN_35 ; /
LDA $5B ; \ goto VERTICAL_LEVEL if vertical level
AND #$01 ; |
BNE VERTICAL_LEVEL ; /
LDA $D8,x ; \
CLC ; |
ADC #$50 ; | if the sprite has gone off the bottom of the level...
LDA $14D4,x ; | (if adding 0x50 to the sprite y position would make the high byte >= 2)
ADC #$00 ; |
CMP #$02 ; |
BPL ERASE_SPRITE ; / ...erase the sprite
LDA $167A,x ; \ if "process offscreen" flag is set, return
AND #$04 ; |
BNE RETURN_35 ; /
LDA $13 ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZcHC:0756 VC:176 00 FL:205
AND #$01 ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0780 VC:176 00 FL:205
ORA $03 ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0796 VC:176 00 FL:205
STA $01 ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0820 VC:176 00 FL:205
TAY ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0844 VC:176 00 FL:205
LDA $1A ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0858 VC:176 00 FL:205
CLC ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZcHC:0882 VC:176 00 FL:205
ADC SPR_T14,y ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZcHC:0896 VC:176 00 FL:205
ROL $00 ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizcHC:0928 VC:176 00 FL:205
CMP $E4,x ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizCHC:0966 VC:176 00 FL:205
PHP ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:0996 VC:176 00 FL:205
LDA $1B ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F0 P:envMXdizCHC:1018 VC:176 00 FL:205
LSR $00 ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F0 P:envMXdiZCHC:1042 VC:176 00 FL:205
ADC SPR_T15,y ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F0 P:envMXdizcHC:1080 VC:176 00 FL:205
PLP ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F0 P:eNvMXdizcHC:1112 VC:176 00 FL:205
SBC $14E0,x ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1140 VC:176 00 FL:205
STA $00 ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizCHC:1172 VC:176 00 FL:205
LSR $01 ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizCHC:1196 VC:176 00 FL:205
BCC SPR_L31 ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZCHC:1234 VC:176 00 FL:205
EOR #$80 ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZCHC:1250 VC:176 00 FL:205
STA $00 ;A:8A7F X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1266 VC:176 00 FL:205
SPR_L31 LDA $00 ;A:8A7F X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1290 VC:176 00 FL:205
BPL RETURN_35 ;A:8A7F X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1314 VC:176 00 FL:205
ERASE_SPRITE LDA $14C8,x ; \ if sprite status < 8, permanently erase sprite
CMP #$08 ; |
BCC KILL_SPRITE ; /
LDY $161A,x ;A:FF08 X:0007 Y:0001 D:0000 DB:01 S:01F3 P:envMXdiZCHC:1108 VC:059 00 FL:2878
CPY #$FF ;A:FF08 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdiZCHC:1140 VC:059 00 FL:2878
BEQ KILL_SPRITE ;A:FF08 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdizcHC:1156 VC:059 00 FL:2878
LDA #$00 ;A:FF08 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdizcHC:1172 VC:059 00 FL:2878
STA $1938,y ;A:FF00 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdiZcHC:1188 VC:059 00 FL:2878
KILL_SPRITE STZ $14C8,x ; erase sprite
RETURN_35 RTS ; return
VERTICAL_LEVEL LDA $167A,x ; \ if "process offscreen" flag is set, return
AND #$04 ; |
BNE RETURN_35 ; /
LDA $13 ; \
LSR A ; |
BCS RETURN_35 ; /
LDA $E4,x ; \
CMP #$00 ; | if the sprite has gone off the side of the level...
LDA $14E0,x ; |
SBC #$00 ; |
CMP #$02 ; |
BCS ERASE_SPRITE ; / ...erase the sprite
LDA $13 ;A:0000 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:1218 VC:250 00 FL:5379
LSR A ;A:0016 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1242 VC:250 00 FL:5379
AND #$01 ;A:000B X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1256 VC:250 00 FL:5379
STA $01 ;A:0001 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1272 VC:250 00 FL:5379
TAY ;A:0001 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1296 VC:250 00 FL:5379
LDA $1C ;A:001A X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0052 VC:251 00 FL:5379
CLC ;A:00BD X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0076 VC:251 00 FL:5379
ADC SPR_T12,y ;A:00BD X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0090 VC:251 00 FL:5379
ROL $00 ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F3 P:enVMXdizCHC:0122 VC:251 00 FL:5379
CMP $D8,x ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNVMXdizcHC:0160 VC:251 00 FL:5379
PHP ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNVMXdizcHC:0190 VC:251 00 FL:5379
LDA.W $001D ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F2 P:eNVMXdizcHC:0212 VC:251 00 FL:5379
LSR $00 ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F2 P:enVMXdiZcHC:0244 VC:251 00 FL:5379
ADC SPR_T13,y ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F2 P:enVMXdizCHC:0282 VC:251 00 FL:5379
PLP ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F2 P:envMXdiZCHC:0314 VC:251 00 FL:5379
SBC $14D4,x ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNVMXdizcHC:0342 VC:251 00 FL:5379
STA $00 ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0374 VC:251 00 FL:5379
LDY $01 ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0398 VC:251 00 FL:5379
BEQ SPR_L38 ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0422 VC:251 00 FL:5379
EOR #$80 ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0438 VC:251 00 FL:5379
STA $00 ;A:007F X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0454 VC:251 00 FL:5379
SPR_L38 LDA $00 ;A:007F X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0478 VC:251 00 FL:5379
BPL RETURN_35 ;A:007F X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0502 VC:251 00 FL:5379
BMI ERASE_SPRITE ;A:8AFF X:0002 Y:0000 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0704 VC:184 00 FL:5490
SUB_IS_OFF_SCREEN LDA $15A0,x ; \ if sprite is on screen, accumulator = 0
ORA $186C,x ; |
RTS ; / return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SUB_HORZ_POS
; This routine determines which side of the sprite Mario is on. It sets the Y register
; to the direction such that the sprite would face Mario
; It is ripped from $03B817
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;