daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Dec 18th, 2018 67 in 22 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; MAP xy changing code thing sorta?
  2. !setRoomXY = $      ; FREE SPACE by BANK and POINTER
  3.  
  4.  
  5. org $82DE89
  6. JMP setRoomXY   ; Overwrites LDA $0002,x
  7.  
  8.  
  9. org !setRoomXY
  10. setRoomXY:
  11. PHX
  12. PHP
  13.  
  14. ;LDA $8B : BIT !UP : BNE XYend              ; DEBUG DELETE THIS
  15. LDA $04,s       ;\
  16. CMP #$E378      ;} Check that the parent routine is the normal door loading one
  17. BNE XYend         ;} If not, return
  18.  
  19. SEP #$20        ; 8-bit accumulator
  20. TDC             ; A = 0000
  21. LDX $078D       ; X = Current door pointer
  22.  
  23. LDA $830002,x   ;\
  24. BIT #$C0        ;} Check that the door isn't an elevator
  25. BNE XYend         ;} If so, return
  26.  
  27. LDA $0AF7       ;\
  28. CLC             ;|
  29. ADC $07A1       ;|
  30. SEC             ;} Y = Samus' X screen + current automap X - door destination X
  31. SBC $830006,x   ;|
  32. TAY             ;/
  33. LDA $830003,x   ; Door direction
  34. PHA             ; Save it for later too
  35. BIT #$02        ;\
  36. BNE ++          ;} If vertically travelling door, Y needs no modification
  37. BIT #$01        ;\
  38. BNE +           ;|
  39. INY             ;} If door travels right, increment Y
  40. BRA ++          ;/
  41. +               ;\
  42. DEY             ;} Else door travels left, decrement Y
  43. ++
  44. STY $07A1       ; Store Y to automap X
  45.  
  46. LDA $0AFB       ;\
  47. CLC             ;|
  48. ADC $07A3       ;|
  49. SEC             ;} Y = Samus' Y screen + current automap Y - door destination Y
  50. SBC $830007,x   ;|
  51. TAY             ;/
  52. PLA             ; Door direction
  53. BIT #$02        ;\
  54. BEQ ++          ;} If horizontally travelling door, Y needs no modification
  55. BIT #$01        ;\
  56. BNE +           ;|
  57. INY             ;} If door travels down, increment Y
  58. BRA ++          ;/
  59. +               ;\
  60. DEY             ;} Else door travels up, decrement Y
  61. ++              
  62. STY $07A3       ; Store Y to automap Y
  63.  
  64. PLP
  65. PLX
  66. JMP $DE9B
  67.  
  68. XYend:
  69. PLP
  70. PLX
  71. LDA $0002,x
  72. JMP $DE8C
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top