mansbesthorse

by snydej

Game:

Description: He's there for you whether you want him or not.

!game_mode = $7e0100
!buttons1 = $7e0016
!ground_stand = $7e13ef
!sprite_stand = $7e1471
!sprite_0_id = $7e009e
!sprite_0_status = $7e14c8
!sprite_0_phase = $7e00c2
!sprite_0_yoshi_routine = $7e1594
!riding_yoshi = $7e187a
!yoshi_flag = $7e18e2
!mario_y_lo = $7e0096 ;If Mario falls through the floor this might need to be $7e00d1
!mario_y_hi = $7e0097
; Shared with blowshi
!bomb_time = $7fba13
!bomb_timer = $7fba14

	lda !game_mode
	cmp #$14
	bne end
	
;b jump test
	lda !buttons1
	bit #$80
	beq end
	
;b jump

;Test if the player is on the ground.
	lda !ground_stand
	ora !sprite_stand
	beq end

;Skip the yoshi if mario is already on one. Otherwise shifting Mario upward
;ruins things
	lda !riding_yoshi
	bne end

;To make Bowser tractable also skip the yoshi if an item is being held.
	ldx #$0b
-	lda !sprite_0_status,x
	cmp #$0b
	beq end
	dex
	bpl -

;Player is jumping off the ground. Put them on a yoshi!
	lda #$35
	sta !sprite_0_id
	lda #$08
	sta !sprite_0_status
	lda #$01
	sta !riding_yoshi
	sta !yoshi_flag
	sta !sprite_0_phase
	lda #$00
	sta !sprite_0_yoshi_routine

;This resets the bomb timer for blowshi
	lda !bomb_time
	sta !bomb_timer
	
;Yoshi was shoved underneath Mario. Move them both up so the Yoshi is on the ground.
	sec
	lda !mario_y_lo
	sbc #$10
	sta !mario_y_lo
	lda !mario_y_hi
	sbc #$00
	sta !mario_y_hi

end:
	lda #$00
	rtl
back to listings