Advertisement
Guest User

OW_TilePos_Calc

a guest
Feb 18th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. ; Routine to get the index to the level number of the
  2. ; tile mario is on on the overworld.
  3.  
  4. ; Use: enter with A/X/Y 16-bit.
  5.  
  6. OW_TilePos_Calc:
  7. PHA
  8. LDX.w $0DD6|!addr
  9. LDA.w $1F1F|!addr,X
  10. AND.w #$000F
  11. STA $00
  12. LDA.w $1F21|!addr,X
  13. AND.w #$000F
  14. ASL
  15. ASL
  16. ASL
  17. ASL
  18. STA $02
  19. LDA.w $1F1F|!addr,X
  20. AND.w #$0010
  21. ASL
  22. ASL
  23. ASL
  24. ASL
  25. ORA $00
  26. STA $00
  27. LDA.w $1F21|!addr,X
  28. AND.w #$0010
  29. ASL
  30. ASL
  31. ASL
  32. ASL
  33. ASL
  34. ORA $02
  35. ORA $00
  36. TAX
  37. LDA.w $0DD6|!addr
  38. AND.w #$00FF
  39. LSR
  40. LSR
  41. TAY
  42. LDA.w $1F11|!addr,Y
  43. AND.w #$000F
  44. BEQ +
  45. TXA
  46. CLC
  47. ADC.w #$0400
  48. TAX
  49. + PLA
  50. RTL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement