Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Foliage the Para-Plant
- ;; For Morton's Empire
- ;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;; INIT Routine wrapper
- print "INIT ",pc
- STZ $C2,x ; Clear pointers RAM
- LDA #$FF ;\ Set timer
- STA $1540,x ;/
- RTL
- ;;; Main Routine wrapper
- print "MAIN ",pc
- PHB
- PHK
- PLB
- JSR MainRt
- PLB
- RTL
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Main routine
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- MainRt:
- JSR SubGFX
- LDA $14C8,x ;\ Return if status ain't normal
- CMP #$08 ; |
- BNE Return1 ;/
- LDA $9D ;\ If sprites locked, return
- BNE Return1 ;/
- LDA $C2,x ;\ Set pointers
- JSL $0086DF ;/
- ;pointers:
- dw FaceMario ; State 0: Mario faces the plant in a fght pose
- dw Rise ; State 1: Rising (fireballs and go up??)
- ;dw CallGenerators ; tell the shooters to do something?? (maybe i can combine them into 1 state)
- ;dw Hit ; State 2(3): Hit
- ;dw Angry ; Hypothetical State 3(4), where it makes another action after X hits
- ;dw Ded ; State 3/4/5: Dead
- Return1:
- RTS
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;State 0: Facing Mario
- FaceMario:
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- YSpd: db $FA,$F0
- LDA $19 ;\ Preserve powerup
- PHA ;/
- LDA $1540,x ;\ Return if facing time is over
- BEQ .over ;/
- LDA #$01 ;\ Temporarily store powerup
- STA $19 ;/
- .loop
- STZ $7B ;\ Lock player
- STZ $7D ;/
- LDA #$32 ;\ Set the player pose
- STA $13E0 ;/
- LDA YSpd ;\ Set slow Y speed
- STA $AA,x ;/
- JSL $01802A
- LDA $1540,x
- BPL .loop
- LDA YSpd ;\ Set fast Y speed
- INX ; |
- STA $AA,x ;/
- JSL $01802A
- PLA ;\ Restore powerup
- STA $19 ;/
- .over
- INC $C2,x ; Continue
- RTS
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;State 1: Rising
- Rise:
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- RTS
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Graphics routine
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- SubGFX:
- JSR GetDrawInfo
- LDA $00 ; set x position of the tile
- STA $0300,y
- LDA $01 ; set y position of the tile
- STA $0301,y
- LDA #$00
- STA $0302,y
- LDA $15F6,x ; get sprite palette info
- ORA $64 ; add in the priority bits from the level settings
- STA $0303,y ; set properties
- LDY #$02 ; #$02 means the tiles are 16x16
- LDA #$00 ; This means we drew one tile
- JSL $01B7B3
- RTS
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Misc routines
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; $B760 - graphics routine helper - shared
- ; sets off screen flags and sets index to OAM
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;org $03B75C
- TABLE1: db $0C,$1C
- TABLE2: db $01,$02
- GetDrawInfo: 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 TABLE1,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 TABLE2,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 ; /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement