music.inc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. ; ***********************************************************
  2. ; *** Music routine taken from 'ZOOM.ASM'. ***
  3. ; *** Optimized by Yoshi ***
  4. ; ***********************************************************
  5. play_music:
  6. sep #$30
  7. lda #$ff
  8. sta $2140
  9. rep #$10
  10. ldx.w #$7fff
  11. - lda.l $028000,x
  12. sta.l $7f0000,x
  13. lda.l $038000,x
  14. sta.l $7f8000,x
  15. dex
  16. bpl -
  17. stz $00fd
  18. stz $00fe
  19. lda #$7f
  20. sta $00ff
  21. ina ; Oh boy. Actually stores #$80. :-)
  22. sta $2100
  23. stz $4200
  24. sei
  25. jsr res1
  26. sep #$30
  27. - lda $2140
  28. bne -
  29. lda #$e0
  30. sta $2143
  31. lda #$ff
  32. sta $2142
  33. lda #$01
  34. sta $2141
  35. sta $2140
  36. - lda $2140
  37. cmp #$01
  38. bne -
  39. - lda $2140
  40. cmp #$55
  41. bne -
  42. lda $0207
  43. sta $2141
  44. lda #$07
  45. sta $2140
  46. - lda $2140
  47. cmp #$07
  48. bne -
  49. - lda $2140
  50. cmp #$55
  51. bne -
  52. cli
  53. rts
  54. res1 php
  55. jsr res2
  56. plp
  57. stz $2140
  58. rts
  59. res2 php
  60. rep #$30
  61. ;ldy.w #$0000
  62. lda.w #$bbaa
  63. - cmp $2140
  64. bne -
  65. sep #$20
  66. lda #$cc
  67. bra B1
  68. B4 lda [$fd],y
  69. iny
  70. xba
  71. lda #$00
  72. bra B2
  73. B3 xba
  74. lda [$fd],y
  75. iny
  76. xba
  77. B5 cmp $2140
  78. bne B5
  79. ina
  80. B2 rep #$20
  81. sta $2140
  82. sep #$20
  83. dex
  84. bne B3
  85. - cmp $2140
  86. bne -
  87. - adc #$03
  88. beq -
  89. B1 pha
  90. rep #$20
  91. lda [$fd],y
  92. iny
  93. iny
  94. tax
  95. lda [$fd],y
  96. iny
  97. iny
  98. sta $2142
  99. sep #$20
  100. cpx.w #$0001
  101. lda #$00
  102. rol
  103. sta $2141
  104. adc #$7f
  105. pla
  106. sta $2140
  107. - cmp $2140
  108. bne -
  109. bvs B4
  110. plp
  111. rts
  112. pla
  113. sta $2140
  114. - cmp $2140
  115. bne -
  116. bvs B5
  117. plp
  118. rts