Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dcb "INIT"
  2. JSR SUB_HORZ_POS
  3. TYA
  4. STA $157C,x
  5. RTL
  6.  
  7. dcb "MAIN"
  8.  
  9. PHB                         ;\
  10. PHK                         ; | Change the data bank to the one our code is running from.
  11. PLB                         ; | This is a good practice.
  12. JSR SpriteCode              ; | Jump to the sprite's function.
  13. PLB                         ; | Restore old data bank.
  14. RTL                         ;/ And return.
  15.  
  16. ;===================================
  17. ;Sprite Function
  18. ;===================================
  19. ExplodeBomb:
  20.     PHB                     ;\ Change Bob-omb into explosion
  21.     LDA.B #$02              ;|
  22.     PHA                     ;|
  23.     PLB                     ;|
  24.     JSL $028086             ;|
  25.     PLB                     ;|
  26.     RTS                     ;/
  27.  
  28.  
  29. RETURN:
  30.     RTS
  31.  
  32. SpriteCode:
  33.     LDA.W $1534,X           ; \ Branch if exploding
  34.     BEQ No_Explode          ; /
  35.     JSR ExplodeBomb
  36.     RTS
  37. No_Explode:
  38.     JSR Graphics
  39.  
  40.     LDA $14C8,x             ;\
  41.     CMP #$08                ; | If sprite dead,
  42.     BNE RETURN              ;/ Return.
  43.     LDA $9D                 ;\
  44.     BNE RETURN              ;/ If locked, return.
  45.  
  46. JSR SUB_OFF_SCREEN_X0       ; Handle offscreen.
  47.  
  48.     LDA $1588,x             ; ... if sprite is touching a wall.
  49.     AND #$03                ; (bit 0 and 1)..
  50.     BEQ DontFlip            ; If bits aren't set, don't flip the sprite.
  51.            
  52.     LDA $157C,x             ;\
  53.     EOR #$01                ; | Flip sprite's direction when touching wall.
  54.     STA $157C,x             ;/
  55.  
  56. DontFlip:
  57.     LDA $1588,x
  58.     AND #$04                ; If the sprite is in air ..
  59.     BEQ NotOnGround         ; Don't set speeds and branch.
  60.            
  61.     LDY $157C,x             ;\ Get direction into Y.
  62.     LDA XSPEED,y            ; | Load X speed indexed by Y.
  63.     STA $B6,x               ;/ Store to X speed table.
  64.     LDA #$10                ;\ Y Speed for sprite on ground
  65.     STA $AA,x               ;/ = 10.
  66.  
  67. NotOnGround:
  68.     JSL $01802A             ; Apply speed.
  69.     JSL $018032             ; Make the sprite interact with others. Make sure the .cfg setting for this
  70.                             ; is off!
  71.     LDA $15AC,x             ;load the turn timer
  72.     BEQ No_sprite_contact
  73.     INC $1534,x
  74.     INC $1534,x
  75.     LDA.B #$09              ; \ Bomb sound effect
  76.     STA.W $1DFC             ; /
  77.     LDA.B #$01
  78.     STA.W $1534,X
  79.     LDA.B #$40              ; \ Set explosion timer
  80.     STA.W $1540,X           ; /
  81.     LDA.B #$08              ; \ Set normal status
  82.     STA.W $14C8,X           ; /
  83.     LDA.W RAM_Tweaker1686,X ; \ Set to interact with other sprites
  84.     AND.B #$F7              ;|
  85.     STA.W RAM_Tweaker1686,X ; /
  86.     RTS
  87.    
  88. No_sprite_contact:
  89.     JSL $01A7DC
  90.     BCC NoContact
  91.     INC $1534,x
  92.     LDA.B #$09              ; \ Bomb sound effect
  93.     STA.W $1DFC             ; /
  94.     LDA.B #$01
  95.     STA.W $1534,X
  96.     LDA.B #$40              ; \ Set explosion timer
  97.     STA.W $1540,X           ; /
  98.     LDA.B #$08              ; \ Set normal status
  99.     STA.W $14C8,X           ; /
  100.     LDA.W RAM_Tweaker1686,X ; \ Set to interact with other sprites
  101.     AND.B #$F7              ;|
  102.     STA.W RAM_Tweaker1686,X ; /
  103.     RTS
  104.    
  105.     LDA $0E                 ;\
  106.     CMP #$E6                ; | Determine if Mario touches sprite from sides.
  107.     BPL SpriteWins          ;/ If he does, branch.
  108.  
  109. ;===========================================
  110. ;Mario Hurts Sprite
  111. ;===========================================
  112.  
  113. JSL $01AA33                 ;\ Set mario speed.
  114. JSL $01AB99                 ;/ Display contact graphic.
  115. LDA #$10                    ;\
  116. STA $AA,x                   ; | Make sprite fall.
  117. JSL $01802A                 ; |
  118. LDA #$02                    ; |
  119. STA $14C8,x                 ;/
  120. LDA #$13                    ;\
  121. STA $1DF9                   ;/ Play sound.
  122. RTS
  123.  
  124. ;===========================================
  125. ;Sprite Hurts Mario
  126. ;===========================================
  127.  
  128. SpriteWins:
  129.     LDA $1490               ;\ IF Mario has star power ..
  130.     BNE HasStar             ;/ Kill sprite.
  131.     JSL $00F5B7             ;\ Otherwise, hurt Mario.
  132. NoContact:
  133.     RTS
  134.  
  135. XSPEED:
  136.     dcb $1B,$E5
  137.  
  138. ;===========================================
  139. ;Killed by Star Routine
  140. ;===========================================
  141.  
  142. HasStar:
  143.     LDA $167A,x             ;\ Don't disable clipping when killed by a star.
  144.     ORA #$01                ; | NOTE: We do this to not make glitched graphics show up ..
  145.     STA $167A,x             ; | when the sprite is killed by a star.
  146.                             ;/ You can also check this option in the .cfg editor.
  147.     LDA #$02                ;\ Set the sprite status to ..
  148.     STA $14C8,x             ;/ Killed by a star.
  149.     LDA #$D0                ;\
  150.     STA $AA,x               ;/ Set Y speed so sprite falls down.
  151.     INC $18D2               ; Increase number of consective enemies stomped/ killed by star.
  152.     LDA $18D2               ; IF consecutive # of enemies killed by star/stomped ..
  153.     CMP #$08                ; IS 8 ..
  154.     BCC NotEight           
  155.     LDA #$08                ;\ Keep it static at 8, because you get 1-ups all the time afterwards.
  156.     STA $18D2               ;/
  157. NotEight:          
  158.     JSL $02ACE5             ; This code calls the "give points" routine.
  159.     LDY $18D2               ; Get consecutive # of enemies stomped in Y.
  160.     CPY #$08                ; If it's less than 8 once again, return.
  161.     BCC NoSound    
  162.     LDA StarSFX,y           ;\
  163.     STA $1DF9               ;/ Play sounds depending on how many enemies were stomped/killed by star.
  164. NoSound:       
  165.     RTS                     ; Return.
  166.  
  167. StarSFX:
  168.     dcb $00,$13,$14,$15,$16,$17,$18,$19
  169. ;===================================
  170. ;Graphics Code
  171. ;===================================
  172.  
  173. TILEMAP:
  174.     dcb $80,$A0
  175. TILEMAP2:
  176.     dcb $82,$A2
  177.  
  178. PROPERTIES:
  179.     dcb $4F,$0F             ; NOTE: Flip the X direction when going right.
  180.  
  181. YDISP:
  182.     dcb $10,$00
  183.  
  184. Graphics:
  185.     JSR GET_DRAW_INFO       ; Before actually coding the graphics, we need a routine that will get the current sprite's value
  186.    
  187.     LDA $14                 ;\ Frame counter ..
  188.     LSR A                   ; |
  189.     LSR A
  190.     LSR A                   ; | Add in frame animation rate; More LSRs for slower animation.
  191.     AND #$01                ; | 01 means we animate between 2 frames (00 and 01).
  192.     STA $03                 ;/ i.e. first animation and second animation. The result is stored into $03.
  193.    
  194.     LDA $157C,x
  195.     STA $02                 ; Store direction to $02 for use with property routine later.
  196.    
  197.     PHX                     ;\ Push the sprite index, since we're using it for a loop.
  198.     LDX #$01                ;/ X = number of times to loop through. Since we only draw one MORE tile, loop one more time.
  199.     Loop:
  200.         LDA $00             ;\
  201.         STA $0300,y         ;/ Draw the X position of the sprite
  202.        
  203.         LDA $01             ;\
  204.         SEC                 ; | Y displacement is added for the Y position, so one tile is higher than the other.
  205.         SBC YDISP,x         ; | Otherwise, both tiles would have been drawn to the same position!
  206.         STA $0301,y         ; | If X is 00, i.e. first tile, then load the first value from the table and apply that
  207.                             ;/ as the displacement. For the second tile, F0 is added to make it higher than the first.
  208.        
  209.         LDA $03
  210.         BNE A
  211.         LDA TILEMAP,x       ; X still contains index for the tile to draw. If it's the first tile, draw first tile in
  212.         BRA B
  213.         A:
  214.         LDA TILEMAP2,x
  215.         B:
  216.         STA $0302,y         ; the table. If X = 01, i.e. second tile, draw second tile in the table.
  217.        
  218.         PHX                 ; Push number of times to go through loop (01), because we're using it for a table here.
  219.         LDX $02             ;\
  220.         LDA PROPERTIES,x    ; | Set properties based on direction.
  221.         ORA $64
  222.         STA $0303,y         ;/
  223.         PLX                 ; Pull number of times to go through loop.
  224.        
  225.         INY                 ;\
  226.         INY                 ; | The OAM is 8x8, but our sprite is 16x16 ..
  227.         INY                 ; | So increment it 4 times.
  228.         INY                 ;/
  229.        
  230.         DEX                 ; After drawing this tile, decrease number of tiles to go through loop. If the second tile
  231.                             ; is drawn, then loop again to draw the first tile.
  232.     BPL Loop                ; Loop until X becomes negative (FF).
  233.     PLX                     ; Pull back the sprite index! We pushed it at the beginning of the routine.
  234.     LDY #$02                ; Y ends with the tile size .. 02 means it's 16x16
  235.     LDA #$01                ; A -> number of tiles drawn - 1.
  236.                             ; I drew 2 tiles, so 2-1 = 1. A = 01.
  237.     JSL $01B7B3             ; Call the routine that draws the sprite.
  238.     RTS                     ; Never forget this!
  239. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  240. ; GET_DRAW_INFO
  241. ; This is a helper for the graphics routine. It sets off screen flags, and sets up
  242. ; variables. It will return with the following:
  243. ;
  244. ; Y = index to sprite OAM ($300)
  245. ; $00 = sprite x position relative to screen boarder
  246. ; $01 = sprite y position relative to screen boarder
  247. ;
  248. ; It is adapted from the subroutine at $03B760
  249. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  250.  
  251. SPR_T1
  252.     dcb $0C,$1C
  253. SPR_T2
  254.     dcb $01,$02
  255.  
  256. GET_DRAW_INFO
  257.     STZ $186C,x             ; reset sprite offscreen flag, vertical
  258.     STZ $15A0,x             ; reset sprite offscreen flag, horizontal
  259.     LDA $E4,x               ; \
  260.     CMP $1A                 ; | set horizontal offscreen if necessary
  261.     LDA $14E0,x             ; |
  262.     SBC $1B                 ; |
  263.     BEQ ON_SCREEN_X         ; |
  264.     INC $15A0,x             ; /
  265.    
  266. ON_SCREEN_X
  267.     LDA $14E0,x             ; \
  268.     XBA                     ; |
  269.     LDA $E4,x               ; |
  270.     REP #$20                ; |
  271.     SEC                     ; |
  272.     SBC $1A                 ; | mark sprite invalid if far enough off screen
  273.     CLC                     ; |
  274.     ADC.W #$0040            ; |
  275.     CMP.W #$0180            ; |
  276.     SEP #$20                ; |
  277.     ROL A                   ; |
  278.     AND #$01                ; |
  279.     STA $15C4,x             ; /
  280.     BNE INVALID             ;
  281.  
  282.     LDY #$00                ; \ set up loop:
  283.     LDA $1662,x             ; |
  284.     AND #$20                ; | if not smushed (1662 & 0x20), go through loop twice
  285.     BEQ ON_SCREEN_LOOP      ; | else, go through loop once
  286.     INY                     ; /
  287. ON_SCREEN_LOOP
  288.     LDA $D8,x               ; \
  289.     CLC                     ; | set vertical offscreen if necessary
  290.     ADC SPR_T1,y            ; |
  291.     PHP                     ; |
  292.     CMP $1C                 ; | (vert screen boundry)
  293.     ROL $00                 ; |
  294.     PLP                     ; |
  295.     LDA $14D4,x             ; |
  296.     ADC #$00                ; |
  297.     LSR $00                 ; |
  298.     SBC $1D                 ; |
  299.     BEQ ON_SCREEN_Y         ; |
  300.     LDA $186C,x             ; | (vert offscreen)
  301.     ORA SPR_T2,y            ; |
  302.     STA $186C,x             ; |
  303. ON_SCREEN_Y
  304.     DEY                     ; |
  305.     BPL ON_SCREEN_LOOP      ; /
  306.  
  307.     LDY $15EA,x             ; get offset to sprite OAM
  308.     LDA $E4,x               ; \
  309.     SEC                     ; |
  310.     SBC $1A                 ; | $00 = sprite x position relative to screen boarder
  311.     STA $00                 ; /
  312.     LDA $D8,x               ; \
  313.     SEC                     ; |
  314.     SBC $1C                 ; | $01 = sprite y position relative to screen boarder
  315.     STA $01                 ; /
  316.     RTS                     ; return
  317.  
  318. INVALID
  319.     PLA                     ; \ return from *main gfx routine* subroutine...
  320.     PLA                     ; | ...(not just this subroutine)
  321.     RTS                     ; /
  322.  
  323. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  324. ; SUB_OFF_SCREEN
  325. ; This subroutine deals with sprites that have moved off screen
  326. ; It is adapted from the subroutine at $01AC0D
  327. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  328.  
  329. SPR_T12:
  330.     db $40,$B0
  331. SPR_T13:
  332.     db $01,$FF
  333.  
  334. SPR_T14:
  335.     db $30,$C0,$A0,$C0,$A0,$F0,$60,$90 ;bank 1 sizes
  336.     db $30,$C0,$A0,$80,$A0,$40,$60,$B0 ;bank 3 sizes
  337. SPR_T15:
  338.     db $01,$FF,$01,$FF,$01,$FF,$01,$FF ;bank 1 sizes
  339.     db $01,$FF,$01,$FF,$01,$00,$01,$FF ;bank 3 sizes
  340.  
  341. SUB_OFF_SCREEN_X1:
  342.     LDA #$02                ; \ entry point of routine determines value of $03
  343.     BRA STORE_03            ; | (table entry to use on horizontal levels)
  344. SUB_OFF_SCREEN_X2:  
  345.     LDA #$04                ; |
  346.     BRA STORE_03            ; |
  347. SUB_OFF_SCREEN_X3:  
  348.     LDA #$06                ; |
  349.     BRA STORE_03            ; |
  350. SUB_OFF_SCREEN_X4:  
  351.     LDA #$08                ; |
  352.     BRA STORE_03            ; |
  353. SUB_OFF_SCREEN_X5:  
  354.     LDA #$0A                ; |
  355.     BRA STORE_03            ; |
  356. SUB_OFF_SCREEN_X6:  
  357.     LDA #$0C                ; |
  358.     BRA STORE_03            ; | OMG YOU FOUND THIS HIDDEN z0mg place!111 you win a cookie!
  359. SUB_OFF_SCREEN_X7:  
  360.     LDA #$0E                ; |
  361.     STORE_03: STA $03       ; |
  362. BRA START_SUB               ; |
  363.     SUB_OFF_SCREEN_X0:  
  364.     STZ $03                 ; /
  365.  
  366. START_SUB:
  367.     JSR SUB_IS_OFF_SCREEN   ; \ if sprite is not off screen, return
  368.     BEQ RETURN_35           ; /
  369.     LDA $5B                 ; \ goto VERTICAL_LEVEL if vertical level
  370.     AND #$01                ; |
  371.     BNE VERTICAL_LEVEL      ; /
  372.     LDA $D8,x               ; \
  373.     CLC                     ; |
  374.     ADC #$50                ; | if the sprite has gone off the bottom of the level...
  375.     LDA $14D4,x             ; | (if adding 0x50 to the sprite y position would make the high byte >= 2)
  376.     ADC #$00                ; |
  377.     CMP #$02                ; |
  378.     BPL ERASE_SPRITE        ; / ...erase the sprite
  379.     LDA $167A,x             ; \ if "process offscreen" flag is set, return
  380.     AND #$04                ; |
  381.     BNE RETURN_35           ; /
  382.     LDA $13                 ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZcHC:0756 VC:176 00 FL:205
  383.     AND #$01                ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0780 VC:176 00 FL:205
  384.     ORA $03                 ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0796 VC:176 00 FL:205
  385.     STA $01                 ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0820 VC:176 00 FL:205
  386.     TAY                     ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0844 VC:176 00 FL:205
  387.     LDA $1A                 ;A:8A01 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizcHC:0858 VC:176 00 FL:205
  388.     CLC                     ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZcHC:0882 VC:176 00 FL:205
  389.     ADC SPR_T14,y           ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZcHC:0896 VC:176 00 FL:205
  390.     ROL $00                 ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizcHC:0928 VC:176 00 FL:205
  391.     CMP $E4,x               ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizCHC:0966 VC:176 00 FL:205
  392.     PHP                     ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:0996 VC:176 00 FL:205
  393.     LDA $1B                 ;A:8AC0 X:0009 Y:0001 D:0000 DB:01 S:01F0 P:envMXdizCHC:1018 VC:176 00 FL:205
  394.     LSR $00                 ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F0 P:envMXdiZCHC:1042 VC:176 00 FL:205
  395.     ADC SPR_T15,y           ;A:8A00 X:0009 Y:0001 D:0000 DB:01 S:01F0 P:envMXdizcHC:1080 VC:176 00 FL:205
  396.     PLP                     ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F0 P:eNvMXdizcHC:1112 VC:176 00 FL:205
  397.     SBC $14E0,x             ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1140 VC:176 00 FL:205
  398.     STA $00                 ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizCHC:1172 VC:176 00 FL:205
  399.     LSR $01                 ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:eNvMXdizCHC:1196 VC:176 00 FL:205
  400.     BCC SPR_L31             ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZCHC:1234 VC:176 00 FL:205
  401.     EOR #$80                ;A:8AFF X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdiZCHC:1250 VC:176 00 FL:205
  402.     STA $00                 ;A:8A7F X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1266 VC:176 00 FL:205
  403. SPR_L31:       
  404.     LDA $00                 ;A:8A7F X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1290 VC:176 00 FL:205
  405.     BPL RETURN_35           ;A:8A7F X:0009 Y:0001 D:0000 DB:01 S:01F1 P:envMXdizCHC:1314 VC:176 00 FL:205
  406.     ERASE_SPRITE:      
  407.     LDA $14C8,x             ; \ if sprite status < 8, permanently erase sprite
  408.     CMP #$08                ; |
  409.     BCC KILL_SPRITE         ; /
  410.     LDY $161A,x             ;A:FF08 X:0007 Y:0001 D:0000 DB:01 S:01F3 P:envMXdiZCHC:1108 VC:059 00 FL:2878
  411.     CPY #$FF                ;A:FF08 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdiZCHC:1140 VC:059 00 FL:2878
  412.     BEQ KILL_SPRITE         ;A:FF08 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdizcHC:1156 VC:059 00 FL:2878
  413.     LDA #$00                ;A:FF08 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdizcHC:1172 VC:059 00 FL:2878
  414.     STA $1938,y             ;A:FF00 X:0007 Y:0000 D:0000 DB:01 S:01F3 P:envMXdiZcHC:1188 VC:059 00 FL:2878
  415. KILL_SPRITE:       
  416.     STZ $14C8,x             ; erase sprite
  417. RETURN_35:
  418.     RTS                 ; return
  419.    
  420. VERTICAL_LEVEL:    
  421.     LDA $167A,x             ; \ if "process offscreen" flag is set, return
  422.     AND #$04                ; |
  423.     BNE RETURN_35           ; /
  424.     LDA $13                 ; \
  425.     LSR A                   ; |
  426.     BCS RETURN_35           ; /
  427.     LDA $E4,x               ; \
  428.     CMP #$00                ; | if the sprite has gone off the side of the level...
  429.     LDA $14E0,x             ; |
  430.     SBC #$00                ; |
  431.     CMP #$02                ; |
  432.     BCS ERASE_SPRITE        ; / ...erase the sprite
  433.     LDA $13                 ;A:0000 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:1218 VC:250 00 FL:5379
  434.     LSR A                   ;A:0016 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1242 VC:250 00 FL:5379
  435.     AND #$01                ;A:000B X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1256 VC:250 00 FL:5379
  436.     STA $01                 ;A:0001 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1272 VC:250 00 FL:5379
  437.     TAY                     ;A:0001 X:0009 Y:00E4 D:0000 DB:01 S:01F3 P:envMXdizcHC:1296 VC:250 00 FL:5379
  438.     LDA $1C                 ;A:001A X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0052 VC:251 00 FL:5379
  439.     CLC                     ;A:00BD X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0076 VC:251 00 FL:5379
  440.     ADC SPR_T12,y           ;A:00BD X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0090 VC:251 00 FL:5379
  441.     ROL $00                 ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F3 P:enVMXdizCHC:0122 VC:251 00 FL:5379
  442.     CMP $D8,x               ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNVMXdizcHC:0160 VC:251 00 FL:5379
  443.     PHP                     ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNVMXdizcHC:0190 VC:251 00 FL:5379
  444.     LDA $001D               ;A:006D X:0009 Y:0001 D:0000 DB:01 S:01F2 P:eNVMXdizcHC:0212 VC:251 00 FL:5379
  445.     LSR $00                 ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F2 P:enVMXdiZcHC:0244 VC:251 00 FL:5379
  446.     ADC SPR_T13,y           ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F2 P:enVMXdizCHC:0282 VC:251 00 FL:5379
  447.     PLP                     ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F2 P:envMXdiZCHC:0314 VC:251 00 FL:5379
  448.     SBC $14D4,x             ;A:0000 X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNVMXdizcHC:0342 VC:251 00 FL:5379
  449.     STA $00                 ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0374 VC:251 00 FL:5379
  450.     LDY $01                 ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0398 VC:251 00 FL:5379
  451.     BEQ SPR_L38             ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0422 VC:251 00 FL:5379
  452.     EOR #$80                ;A:00FF X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0438 VC:251 00 FL:5379
  453.     STA $00                 ;A:007F X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0454 VC:251 00 FL:5379
  454.     SPR_L38: LDA $00        ;A:007F X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0478 VC:251 00 FL:5379
  455.     BPL RETURN_35           ;A:007F X:0009 Y:0001 D:0000 DB:01 S:01F3 P:envMXdizcHC:0502 VC:251 00 FL:5379
  456.     BMI ERASE_SPRITE        ;A:8AFF X:0002 Y:0000 D:0000 DB:01 S:01F3 P:eNvMXdizcHC:0704 VC:184 00 FL:5490
  457.    
  458. SUB_IS_OFF_SCREEN:  
  459.     LDA $15A0,x             ; \ if sprite is on screen, accumulator = 0
  460.     ORA $186C,x             ; |
  461.     RTS                     ; / return
  462. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  463. ; SUB HORZ POS
  464. ;
  465. ; $B817 - horizontal mario/sprite check - shared
  466. ; Y = 1 if mario left of sprite??
  467. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  468.  
  469. SUB_HORZ_POS:
  470.     LDY #$00                ;A:25D0 X:0006 Y:0001 D:0000 DB:03 S:01ED P:eNvMXdizCHC:1020 VC:097 00 FL:31642
  471.     LDA $94                 ;A:25D0 X:0006 Y:0000 D:0000 DB:03 S:01ED P:envMXdiZCHC:1036 VC:097 00 FL:31642
  472.     SEC                     ;A:25F0 X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizCHC:1060 VC:097 00 FL:31642
  473.     SBC $E4,x               ;A:25F0 X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizCHC:1074 VC:097 00 FL:31642
  474.     STA $0F                 ;A:25F4 X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizcHC:1104 VC:097 00 FL:31642
  475.     LDA $95                 ;A:25F4 X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizcHC:1128 VC:097 00 FL:31642
  476.     SBC $14E0,x             ;A:2500 X:0006 Y:0000 D:0000 DB:03 S:01ED P:envMXdiZcHC:1152 VC:097 00 FL:31642
  477.     BPL LABEL16             ;A:25FF X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizcHC:1184 VC:097 00 FL:31642
  478.     INY                     ;A:25FF X:0006 Y:0000 D:0000 DB:03 S:01ED P:eNvMXdizcHC:1200 VC:097 00 FL:31642
  479. LABEL16:    
  480.     RTS                     ;A:25FF X:0006 Y:0001 D:0000 DB:03 S:01ED P:envMXdizcHC:1214 VC:097 00 FL:31642
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement