Guest User

Untitled

a guest
Jul 11th, 2019
1,341
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # several game addresses need to be patched (and nop adjusted):
  2. # 228C -> jsr FF000 send sound code at %d0. Codes > 0x80 are music
  3. # 1982 -> jsr FF008 resume music
  4. # 193a -> jsr FF004 pause music
  5. # 6668 -> jsr FF00C reset z80, so stop (pause) music
  6.  
  7.  
  8. #entry at FF000
  9. bra PlayCode
  10. #entry at FF004
  11. bra Pause
  12. #entry at FF008
  13. bra Resume
  14. bra Reset
  15. #for expansion
  16. nop
  17. nop
  18. nop
  19. nop
  20.  
  21. PlayCode:
  22. #magical sound shower
  23. cmp.b #0x81, %d0
  24. bne nextcode1
  25. #remap to cd track 1
  26. move.b #0x1, %d0
  27. jmp playfromcd
  28.  
  29. nextcode1:
  30. #splash wave
  31. cmp.b #0x82, %d0
  32. bne nextcode2
  33. #remap to cd track 2
  34. move.b #0x2, %d0
  35. jmp playfromcd
  36.  
  37. nextcode2:
  38. #passing breeze
  39. cmp.b #0x83, %d0
  40. bne nextcode3
  41. #remap to cd track 3
  42. move.b #0x3, %d0
  43. jmp playfromcd
  44.  
  45. nextcode3:
  46. #last wave
  47. cmp.b #0x84, %d0
  48. bne nextcode4
  49. #remap to cd track 4
  50. move.b #0x4, %d0
  51. jmp playfromcd
  52.  
  53. nextcode4:
  54. #play as is
  55. move.b %d0,(0xa01c0a)
  56. rts
  57.  
  58. playfromcd:
  59. #open command overlay
  60. move.w #0xCD54,(0x03F7FA)
  61.  
  62. #send track with command 12, play with loop
  63. or.w #0x1200, %d0
  64.  
  65. move.w %d0, (0x03F7FE)
  66.  
  67. #close command overlay
  68. move.w #0x0000,(0x03F7FA)
  69. rts
  70.  
  71.  
  72. Pause:
  73. #call the patched opcode @ 193A
  74. move.b #1,(0xA01C10)
  75.  
  76. Pause2:
  77. move.w #0xCD54,(0x03F7FA)
  78.  
  79. #send command 13, pause
  80.  
  81. move.w #0x1300, (0x03F7FE)
  82.  
  83. move.w #0x0000,(0x03F7FA)
  84.  
  85. rts
  86.  
  87. Resume:
  88.  
  89. move.w #0xCD54,(0x03F7FA)
  90.  
  91. #send command 14, resume
  92.  
  93. move.w #0x1400, (0x03F7FE)
  94.  
  95. move.w #0x0000,(0x03F7FA)
  96.  
  97. #call the patched opcode @ 1982
  98. move.b #0x80,(0xA01C10)
  99.  
  100. rts
  101.  
  102. Reset:
  103. move.w #0,0xa11200
  104. bra Pause2
RAW Paste Data