Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. ;~@sa1
  2. ;Note that ram address $7FAB10 ($400040 SA-1) are uninitialized when not using a custom sprite.
  3. ;Thus certain emulators may fail on running this code.
  4. LDA $187A|!addr ;\If not riding yoshi, return
  5. BEQ + ;/
  6. PHX ;\Push stack
  7. PHA ;|
  8. PHY ;/
  9.  
  10. if !sa1 == 0
  11. LDX.b #22-1 ;>Number of sprite slots
  12. else
  13. LDX.b #12-1 ;>Number of sprite slots
  14. endif
  15.  
  16. -
  17. LDA !7FAB10,x ;\If custom sprite, next slot
  18. AND #$08 ;|
  19. BNE ++ ;/
  20. LDA !9E,x ;\If other than yoshi, next slot
  21. CMP #$35 ;|
  22. BNE ++ ;/
  23.  
  24. STZ !157C,x ;>default facing direction right
  25. ; LDA $007B+!dp ;\If going foward in the direction yoshi facing,
  26. ; BPL ++ ;/don't alter facing
  27. LDA !Freeram_SSP_PipeDir ;>Direction
  28. CMP #$02 ;\Rightwards
  29. BEQ +++ ;|
  30. CMP #$06 ;|
  31. BEQ +++ ;/
  32. CMP #$04 ;\Leftwards
  33. BEQ ++++ ;|
  34. CMP #$08 ;|
  35. BEQ ++++ ;/
  36. BRA ++ ;>Other directions
  37.  
  38. +++
  39. STZ !157C,x ;>Face right
  40. BRA ++
  41.  
  42. ++++
  43. LDA #$01 ;\Face left
  44. STA !157C,x ;/
  45.  
  46. ;(still checks all slots in case if a double yoshi glitch...)
  47. ++
  48. DEX ;>Next slot/index
  49. BPL - ;>If zero or positive, loop back
  50.  
  51. PLY ;\Pull stack
  52. PLA ;|
  53. PLX ;/
  54.  
  55. +
  56. RTL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement