airjump

by tjb0607

Game: SMW

Description: jump literally anytime

	LDA $100	; \ only run in gamemode 14
	EOR #$14	; |
	ORA $9D		; | and when the game isn't paused
	BEQ +		; |
	RTL		; |
	+		; /

	;LDA $72		; \ don't check if in the air
	;BNE +			; |
	;RTL			; |
	;+			; /
	
	LDA $16			; \ check for newly pressed jump inputs
	ORA $18			; |
	BMI +			; |
	RTL			; |
	+			; /
	
	LDA $18			; \ check whether jump was a spin
	AND #$80		; |
	EOR #$80		; |
	ORA $148F		; /
	BNE +
	LDA #$04		; \ play spin jump sound
	STA $1DFC		; /
	STA $140D		; and set spin flag
	BRA ++
	+
	LDA #$01		; \ play normal jump sound
	STA $1DFA		; /
	STZ $140D		; reset spin flag
	++

	LDA $7B			; \ https://smwc.me/m/smw/rom/00D2BD/
	BPL +			; | algorithm to give jump speed.
	EOR #$FF		; |
	INC A			; |
	+			; |
	LSR #2			; |
	AND #$FE		; |
	TAX			; |
	LDA $140D		; |
	BEQ +			; |
	INX			; |
	+			; |
	LDA $00D2BD,x		; |
	STA $7D			; /

	LDA #$0B		; \ set player as in the air
	STA $72			; /

	RTL
back to listings