EMU618社区

 找回密码
 立即注册
搜索
查看: 210|回复: 2

[原创] [FC][音乐播放器][NES + 源码]

[复制链接]

签到天数: 39 天

[LV.5]常住居民I

发表于 2023-7-11 19:08:59 | 显示全部楼层 |阅读模式
本帖最后由 yandagui 于 2023-7-11 21:32 编辑 1 q* l8 }0 ~) f

; t4 [: G" f; B1 z1 w1.魂斗罗
3 ]' B1 k# _! Y- Q# g) N* z6 i2.超级魂斗罗2 {' w" f6 S+ A0 {& x9 V6 H
3.赤影战士# }' b; Y2 {( W6 l& u  B1 k
4.忍者龙剑传2
$ a5 p3 _( f$ c. [  c5 k; ]( X+ s9 l* |; q8 t

( T: k- o' c: y" `0 o* i
: r0 \8 S% C1 Y8 d; U7 H
: ?+ Z5 Q! z5 G" Y4 O2 E7 E1 ~( D源码:& R& d$ V; ^* ]0 I
  1. ;[FC音乐][播放器模板]8 D7 O) l6 |# K* Q& y$ t6 D
  2. ;FlameCyclone 20230710
    " W1 R- y0 I# ?' d3 Z

  3. 6 Q2 }+ P3 ]' @! T- c+ w1 h
  4. ;文件头1 K' T! d9 J3 y/ B
  5. ;======================================================================
    1 {8 I" u' s- V6 t# u7 X+ Z: i# m
  6. .INESPRG 4                                              ;16KB PRG 数量2 h) c7 a4 |9 {4 \$ t
  7. .INESCHR 0                                               ;8KB CHR 数量5 |) I: s% t& Q, W6 b$ P
  8. .INESMAP 4                                                   ;mapper 4, ^. C( U: e! B7 A5 R8 ]
  9. .INESMIR 1                                   ;命名表镜像 0水平 1垂直! ?! I9 _- x$ X0 `# h
  10. 6 w7 |- y) m7 M
  11. ;==================================================
    8 D7 a$ S! t8 S0 U/ t* \- \
  12. SOUND_BAR_SHOW_ENABLE       = 1- @8 v5 C8 f% x; `9 r
  13. ;==================================================
    % n5 E! _) O* R4 j& T
  14. BANK_DATA_MASK              = $07
    2 ?" }/ H* e; X8 X1 l
  15. ;==================================================
    ( G9 C: g4 b+ L9 ^' s) B" _; j
  16. SOUND_DATA_BANK_0           = $00
      m6 p: P* H7 Y: I) _
  17. SOUND_DATA_BANK_1           = $01
    , H5 r: F# E+ |0 _. R' Q" c
  18. SOUND_DATA_BANK_2           = $02
    4 L+ D1 \' d+ y7 R: A
  19. SOUND_DATA_BANK_C000        = $062 ?+ J( P* F! |; g
  20. 6 U* i4 v* D. [/ B$ v
  21. ;-------------------------------------------------1 L0 v! Z! M; S) o, T3 }
  22. CHR_DATA_BANK               = $04
    5 y+ j7 }+ z1 o9 z6 J9 @! e+ W
  23. CHR_DATA_ADDR               = $A000
    ) r& s- |" O  [7 Z2 u. W2 I/ O9 H* f
  24. ;-------------------------------------------------
    ! O. Y/ T: m2 A1 ]) `/ T
  25. PROGRAM_BANK                = $05
      X" d' a  \: v9 A( o
  26. PROGRAM_ADDR                = $8000, n& @% }/ ]& N: ]6 a) Z
  27. ;-------------------------------------------------
    4 @! S/ U  k5 K  b  y
  28. RESET_BANK                  = $07
    1 _8 `8 T+ L% @3 `
  29. RESET_ADDR                  = $FE00" X, X7 T  F: p- C- K) v1 o: N) v
  30. ;==================================================+ F- Y9 M5 o; L& W+ v5 G: z
  31. Music_Init_Addr             = $DFF0 ;音乐初始化地址
    8 l6 y2 b% q+ \4 v/ f7 M
  32. Music_Play_Addr             = $813C ;音乐播放地址' c8 `' l% k- g0 \* |
  33. Music_Reset_Addr            = $0000 ;音乐重设数据地址3 {9 j- N6 p6 }
  34. ;==================================================1 U6 A5 L- ^& j, D( W' H5 x6 e$ s
  35. Music_Song_Total            = 039  ;全部曲目总数
    6 ^" N6 V% `7 T: N8 ^4 |
  36. Music_Start_Song            = 007  ;初始播放曲目/ a& _. ?4 C9 \7 J$ W; L
  37. ;==================================================
    5 X- _5 _3 k8 ]8 z* V% M/ H/ C
  38. 1 N9 W1 P. p" X# E8 y, ~8 J
  39. ;==================================================
    * v- [: ?" G+ k' S: n3 u8 L
  40. Title_Text_Pos      = $210D ;标题文本位置
    6 J$ I# d0 w$ J$ V9 @1 V
  41. Author_Info_Pos     = $2284 ;作者文本位置- F' j9 w: u3 N4 k$ d
  42. Date_Info_Pos       = $22CB ;日期文本位置
    " F3 t( @0 v; f* w- ]8 I0 n5 r, H
  43. ;------------------------------
    / O1 O9 c8 h0 E; F
  44. ;------------------------------
    % K+ D: t# o& q2 n0 C6 r, F
  45. .IF SOUND_BAR_SHOW_ENABLE
    " m( n2 g2 N, ^% M# f) z3 h
  46. Play_Index_Pos      = $21B3 ;当前曲目位置
    , p7 F: e* q0 r' m- I
  47. Play_Time_Pos       = $21F3 ;播放时间位置
    6 l4 m% H, H: p9 Y9 c4 n
  48. Play_State_Pos      = $2233 ;播放状态位置9 U1 b( [' c9 r7 t- X
  49. .ELSE* k* I7 E( B; \1 z
  50. 0 M0 o7 K6 o, l: x3 {
  51. .IF Music_Song_Total > 99% ?1 {1 ~9 o) J# n  ^
  52. Play_Index_Pos      = $21AC ;当前曲目位置. ^) V1 C# ?4 O
  53. .ELSE- }  P8 U  X+ A1 d& J" }

  54. $ Y% J" ^* m  b# g- ]
  55. .IF Music_Song_Total > 9( q* ?( ~+ x, X5 w0 A8 v& {& T" q
  56. Play_Index_Pos      = $21AD ;当前曲目位置5 T% O; J/ o  ?
  57. .ELSE
    - Q" ^9 L" X2 Z' x& \
  58. Play_Index_Pos      = $21AE ;当前曲目位置  K0 ~0 B! ?  j1 C$ q
  59. .ENDIF
    % O/ \6 g% P( L5 j) N9 T8 X
  60. : X8 L! }8 J8 j" O+ T" ]" I  b( ^; V1 g+ d
  61. .ENDIF
    3 |8 |5 C6 Y& s9 e" I# _

  62. % l  |: d5 L% _
  63. & w0 {8 k5 F6 }  K8 h
  64. Play_Time_Pos       = $21EC ;播放时间位置
    / e( h6 z5 ]4 n
  65. Play_State_Pos      = $222C ;播放状态位置
    # N! S! W0 @% s' h5 n
  66. .ENDIF
    6 A6 B2 v) p! I
  67. ;------------------------------
    6 _0 D8 N) g0 _
  68. Track_Name_Pos      = $216B ;曲目文本位置
    ! k) ]4 q* B2 @: N* X
  69. Sound_Track_Pos     = $21A5 ;声道文本位置# ~' S) o, i( r  ^+ S/ a
  70. Sound_Bar_Pos       = $21A9 ;音乐条位置
    % k3 ^5 c& h0 C# }0 o
  71. ;==================================================
    - H" S' ?/ n- }$ p
  72. Scroll_X = $00
    , t* I* l, S" ^8 h9 L
  73. Scroll_Y = $06# K# Q9 W9 G) F) O5 X
  74. ;==================================================! |4 A# K; a8 M# T* u
  75. RAM_Cln_1       = $0100. F6 u% S# ~% @1 s( H+ l
  76. RAM_Cln_1_Size  = $806 p% J4 I+ r7 Y( `. h  r" l1 _
  77. RAM_Cln_2       = $00E0  C- ]2 T  f4 T0 T: F
  78. RAM_Cln_2_Size  = $20
    3 ^6 M* x7 P9 F
  79. RAM_Cln_3       = $00E0
    # ~$ Z2 v9 v' U2 ~3 y7 Z* w# Z
  80. RAM_Cln_3_Size  = $20
    . A, i7 x/ K7 k  r' w5 M

  81. * I% y' i2 c  I) v0 i; c3 F: K
  82. ;==================================================
    , V6 l: Z: H( [9 i- ~% E
  83. PPU_CTRL                =   $2000   ;PPU控制寄存器7 Z& o# R/ m& k; |# V" L" H: o
  84. PPU_MASK                =   $2001   ;PPU掩码寄存器
    6 t  i6 d. L" l  ^4 W9 e! Y
  85. PPU_STATUS              =   $2002   ;PPU状态寄存器:读取后PPU_SCROLL和PPU_ADDRESS被复位,下一个写到PPU_SCROLL的数据是水平的,写到PPU_ADDRESS的数据是高位
    ( ~" |& c# s7 T( G
  86. PPU_OAM_ADDR            =   $2003   ;精灵RAM地址:用来设置通过PPU_OAM_DATA访问的256字节精灵RAM地址。每次访问PPU_OAM_DATA后该地址增加16 |9 ~6 d$ S% }  v% J+ d8 C
  87. PPU_OAM_DATA            =   $2004   ;精灵RAM数据:用来读/写精灵内存。地址通过PPU_OAM_ADDR来设置,每次访问后地址增加10 j; Y% J8 n; N! F
  88. PPU_SCROLL              =   $2005   ;屏幕滚动偏移:第一个写的值会进入垂直滚动寄存器(若>239,被忽略)。第二个值出现在水平滚动寄存器 9 h1 J' Q; a. c8 }
  89. PPU_ADDRESS             =   $2006   ;VRAM地址:设置PPU_DATA访问的VRAM地址。第一个写地址的高6位。第二个写低8位。每次访问PPU_DATA后地址增加2 H, K2 A/ Q& k/ N' L" K
  90. PPU_DATA                =   $2007   ;VRAM数据:用来访问VRAM数据,通过PPU_ADDRESS设置的地址在每次访问之后会增加1或32 1 i; b" ]! E! G, T. q$ Q  O
  91. OAM_DMA                 =   $4014   ;DMA访问精灵RAM:通过写一个值xx到这个端口,引起CPU内存地址为$xx00-$xxFF的区域传送到精灵内存& w2 e) n+ r+ l) m
  92. APU_STATUS              =   $4015   ;声音通道切换
      I: y6 G% ?' a+ P/ M; v/ ~
  93. JOY1_FRAME              =   $4016   ;手柄1 + 选通
    & I9 u3 b$ Y- I0 M( M7 r# O
  94. JOY2_FRAME              =   $4017   ;手柄2 + 选通# D; R1 ^( E8 A! Q
  95. ;==================================================
    6 |; f7 j# Q! m. s
  96. MMC3_BANK_CTRL          =   $8000% G3 \, ]) s9 b) e9 y
  97. MMC3_BANK_DATA          =   $8001
    % P; ]3 N8 y: W! U- t
  98. MMC3_MIRRORING          =   $A000* a) u; n8 n% x* z. r
  99. MMC3_PRG_RAM_PROTECT    =   $A0016 o  W% e# B( S3 C5 Z* D* L4 n
  100. MMC3_IRQ_LATCH          =   $C000
    & `9 g; f: C' S0 }+ |% o
  101. MMC3_IRQ_RELOAD         =   $C001
    ! }# V# X) s; ^
  102. MMC3_IRQ_DISABLE        =   $E000
    , q" n- i/ b* T* O, h; y, K
  103. MMC3_IRQ_ENABLE         =   $E001
      E9 s6 J9 J8 r# X

  104. 6 J7 a( K  V& I0 r' s/ }# n+ E! M
  105. ;音乐数据块# ?; E6 [6 }: i. Q* W/ d! @& i

  106. 7 p$ G% U" g0 B  t; S
  107. ;======================================================================+ F8 Z8 I9 @* [+ E; _( ^, j  v
  108. .IF SOUND_BAR_SHOW_ENABLE; A7 f$ a7 a9 ~* b, Z. Z
  109. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK& [1 y3 U6 F0 A" v0 d5 t1 i5 @
  110. .INCBIN "sound_bank_bar/music_data_0.bank"1 A& Q+ |" i& T3 s9 }) J) {9 ?- A

  111. $ _2 W' o& X- M
  112. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK! u1 G2 x& Q7 Z4 V
  113. .INCBIN "sound_bank_bar/music_data_1.bank"
    : s. n3 z: U- |8 Y
  114. 6 W) ~; L( c, ]- T& T9 @$ h
  115. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK5 U) @4 O* A- j1 R$ g0 [: [; O
  116. .INCBIN "sound_bank_bar/music_data_2.bank"
    3 O1 Q/ L0 L+ G2 T" r+ S
  117. ! ^" f  E# Z7 L& }  Y
  118. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK
    * V0 v# S0 E  i( t0 k
  119. .INCBIN "sound_bank_bar/music_data_3.bank". {4 J. R& a6 N6 [" N; Y. K

  120. 1 D* G; L# u2 K3 E/ X4 {7 U0 m- Q
  121. .ELSE
    : U2 t% j& t/ w4 H1 N  @# _3 i& |1 y
  122. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK
    3 c+ e$ [0 d) i3 g, |
  123. .INCBIN "sound_bank/music_data_0.bank"  M) G3 N. j* d% t, K

  124. 5 d3 p# X0 d4 s/ Q
  125. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK
    5 K5 Z% S4 c$ e2 |
  126. .INCBIN "sound_bank/music_data_1.bank"+ H+ x  p( Y; j3 T
  127. 7 v7 n9 J3 S) {
  128. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK
    # o  `+ d' v( E! U- z. r9 e
  129. .INCBIN "sound_bank/music_data_2.bank"% Y6 i3 b6 e5 e) }) p) O( {
  130. / s- E" g& l9 B
  131. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK
    2 w  s/ j2 }$ D7 L/ X8 e
  132. .INCBIN "sound_bank/music_data_3.bank"
    . p$ h' I9 k6 h* j
  133. .ENDIF: l2 x8 ?0 U! {# U

  134. / P' j6 z3 `5 [$ O
  135. ;CHR图形数据* Q9 z$ W. j# L1 y4 m. {
  136. ;======================================================================/ T, _( Y' t# e. m* U0 ~' F
  137. .BANK CHR_DATA_BANK) d2 y1 D* j: u& o. v2 g& W
  138. .INCBIN "chr_bank/chr_data.chr"7 G, K* L" M" T# s* t5 Q! V. n( ?

  139. & x1 N" L2 b* f' ~
  140. ;==================================================8 T3 b8 {" s/ G; ]0 Q
  141. PPU_Addr        = $0300: W- s4 P3 Y0 h* ]7 {* Y
  142. Palette_Addr    = $03C0
    ) Q$ L' V) u2 b2 Y2 ?* J
  143. Sound_Bar       = PPU_Addr+$E0
    ' z) g& D; v/ x' p/ }: K
  144. ;==================================================
    0 [) ~" Z( N7 ]; i. @
  145. Palette_Update_Addr     = Palette_Addr+$0D
    / o8 e  g* Q8 U; B
  146. Palette_Update_Max      = $2C
    8 z: ~* t, p3 }" y. v/ }3 B8 b
  147. Palette_Update_Min      = $21
    ( r, ?  l5 F- |! W' c( s# S
  148. Palette_Update_Interval = 60
    + Y( G& `: Q2 R/ y
  149. ;==================================================) O2 r& _. _; m
  150. Sound_Bar_Cnt       = PPU_Addr+$F0
    5 ~- [* f' k0 K) q# l0 q! n
  151. Screen_State        = Sound_Bar_Cnt+$017 V5 A- k2 @5 \6 p/ {4 \. y
  152. PPU_Cur             = Sound_Bar_Cnt+$02
    4 z% y# \) p2 N- }
  153. PPU_Addr_H          = Sound_Bar_Cnt+$033 V: S2 s' L" a2 c) y- r
  154. PPU_Addr_L          = Sound_Bar_Cnt+$045 J' z# P7 |6 t- r
  155. ;==================================================
    # v0 d: n! P' }' j9 D) H
  156. Data_L              = $70
    + ]5 G0 Q& b8 D( s0 U9 I5 p8 [
  157. Data_H              = Data_L + $01# Z' x! D; A7 ?/ k0 D
  158. Data_Cnt            = Data_L + $02
    $ c' d4 c9 y1 k
  159. Data_Buf            = Data_L + $03
    0 R9 g8 ?# N! g0 l, J) v- y7 `
  160. Time_Wait_Cnt       = Data_L + $046 N  j0 G/ e! X0 ^# E  H
  161. Palette_Wait_Cnt    = Data_L + $05! `' b2 Z2 Q/ m1 u7 x
  162. Palette_Update_Flag = Data_L + $06' i& M" m1 O, I. o+ k
  163. Show_Track_Name     = Data_L + $07) s# Y" `* E1 }6 o' f! \& e
  164. ;==================================================
    2 B# C# ]+ P* C9 k. M
  165. Key_Keep            = Show_Track_Name + 1
    0 _) |! q( a& o& A9 a$ i. A. j% D
  166. Key_Once            = Key_Keep+$015 R  t+ [2 ~' x/ l, p% o- l# `
  167. Key_Kemp            = Key_Keep+$02' P( n, L# Q0 V0 Q6 Z( O
  168. Key_Temp            = Key_Keep+$03
    % {2 X. H" f. V. p
  169. Key_Getv            = Key_Keep+$04
    % u0 W6 S6 @, {  U6 j% F0 S( ^
  170. ;==================================================
    - H4 p6 T+ O5 w9 X# H3 j( w+ J$ j
  171. Music_Cur           = Key_Getv+$01
    9 k8 S! M4 ~# {1 P& |3 u2 [5 {' ?
  172. Music_Last          = Music_Cur+$01& B9 b/ M! ]' b1 `0 ~/ d
  173. Music_State         = Music_Cur+$02
    ; c9 q# u, a/ D9 D+ `9 @& X
  174. ;==================================================
    3 Y7 Q- O4 `  `! `! d9 M* N" h
  175. HEX_Data            = Music_State+$01; O( w* L) B$ [6 F
  176. DEC_H               = HEX_Data+$01
      F9 g+ k6 N) `) y1 j, V$ }
  177. DEC_T               = HEX_Data+$025 {: _% y# i3 z+ a' \. T, U
  178. DEC_L               = HEX_Data+$03
    8 O. t# V0 @8 y) u: Q- {
  179. ;==================================================
    , |4 ~$ q* |4 M
  180. Time_S              = DEC_L+$01
    ) y1 v  g. n% d& i
  181. Time_M              = Time_S+$017 X5 u' v; u. H* D
  182. Time_H              = Time_S+$02- e, e6 \' x6 r& z  D) m
  183. Time_Cnt            = Time_S+$03
    2 }1 k( }2 r  F  i% q/ V" k

  184. $ \# l0 N. L% Y9 X  Y8 T  R
  185. ;==================================================& c& e+ C1 q# G1 ?. j
  186. Music_Bank_8000 = Time_Cnt + 1) o/ q0 a* Z2 \* _6 `
  187. Music_Bank_A000 = Music_Bank_8000 + 1
    - z6 o2 }$ Z$ M+ b  M- n' L
  188. ;==================================================+ h) J. O4 m( c

  189. & _2 F7 d+ e+ k0 ^# x1 _7 D
  190. ;======================================================================
    1 k$ x+ _/ h2 L; {' D' E$ |% A0 ]
  191. .BANK PROGRAM_BANK
      y5 ]* y& h: t- G1 D! o' ]
  192. .ORG PROGRAM_ADDR
    8 I9 [6 |3 V# x3 |5 L* D! Y& q
  193.   i  ?+ z; v( S
  194. ;==================================================! n3 X4 T' r/ q# ?8 D( M' M- B5 j: @
  195. NmiProgramProcess;NMI中断程序处理& W+ l4 e: {; o9 A
  196. ;处理PPU图像
    ! G" D3 m" b1 {& M' k' U  K
  197. JSR PPU_Proc& M3 [5 P& N0 P  ^0 s1 [7 R& E2 A3 h$ ?
  198. - M1 Y, N, F" Y8 k. |
  199. ;启用NMI中断% B$ z2 x" `, U6 Q, K1 I$ Z
  200. LDA #$80
    , `1 W8 ?) }. Q8 K% u) ~6 E
  201. STA PPU_CTRL$ q2 U, b) q4 ~
  202. ! U) }9 p/ y, [
  203. ;更新调色板* A7 H# v  |: V4 K; n6 \; P! m
  204. JSR Update_Palette_Data
    6 a6 S" @$ w4 [6 J( h

  205. 7 d! r8 Q( m4 U  l
  206. ;显示时间(缓冲). I% C  @) U1 Q, V% |2 [
  207. JSR Time_Show
    6 @8 [0 H$ i/ b: ?& l6 }% B

  208. 0 Z7 W/ T& W" @8 t
  209. ;播放计时- J1 k7 n$ |; f+ A
  210. JSR Time_Count
    ; @6 _4 j9 u' Z6 U4 p
  211. $ A  {+ U  ?) O5 M+ H* w! m  o9 J
  212. ;播放声音5 p" T# _. D6 B% C& w
  213. JSR Sound_Play1 R: |; z1 ^) E# A+ }& m- S$ ]

  214. 9 V: O: I+ M' R% N! w) ]
  215. ;切换音乐(手柄触发)" s$ E+ U- S- T8 d
  216. JSR Music_Switch2 h6 F" S2 \0 ~1 X; n7 ^

  217. . J- ?  J! f) I9 s+ i7 E
  218. ;音乐显示(缓冲)
    1 k: I  M, R8 z) V8 O, T
  219. .IF SOUND_BAR_SHOW_ENABLE
    ! ~; ~, x# p. P2 t4 @
  220. JSR Music_Vision
    , D5 C0 p, J2 v- D1 q- T6 z
  221. .ENDIF
    " n# H5 \6 S* T
  222. ! H( ?4 n0 Y5 J6 z+ Q6 c8 k
  223. LDA Time_Wait_Cnt' O. h; d  y9 d  H
  224. BEQ NmiProgramProcessEnd
    2 Q2 G; W& {" p* g# M5 i$ t
  225. DEC Time_Wait_Cnt
    7 k  V3 e+ P7 g( V( f) n
  226. NmiProgramProcessEnd4 \9 `' V2 q, U- _
  227. RTS! D" c$ B- T2 \" k

  228. 1 @4 n1 s. l; }5 Z, `& f
  229. ;==================================================
    & J" N. A4 {0 c+ s  `4 J' Y# ~# K
  230. ProgramBegin;主程序
    : h, ~6 `  a# ]( D
  231. LDA #$006 x1 w. j0 Q; q2 p6 x: m" b8 c
  232. STA PPU_CTRL
    * W' u) Y/ ]$ e/ Y: Q: M& O4 F
  233. STA PPU_STATUS
    2 a5 |# b- Y6 v0 |8 R7 B1 [
  234. STA PPU_MASK: j9 y3 o. g# _& l
  235. STA APU_STATUS2 ~% ~0 C& z5 L. d
  236. STA PPU_SCROLL
    ; q) N0 A" q) D7 K# l; V
  237. STA PPU_SCROLL% }. E1 i& Z3 {+ x" M- b/ e2 [
  238. LDA #$C02 o3 p7 \( Q- m* f
  239. STA JOY2_FRAME
      p2 o  i) H7 N+ L: V$ X  j; ?1 n$ Q1 h
  240. 1 k- U% }' `: r' Y2 P: n
  241. LDX #$FF
    ( d3 r( o: T6 X2 }6 M( t
  242. TXS( T* ~8 F* l. i$ |
  243. LDA #$00+ @$ C$ j; I* J) [3 O& z8 u
  244. STA PPU_CTRL
    : m7 H! w  ]' _# i, e" S# e6 k( ?2 \6 m
  245. STA PPU_MASK1 Z) e$ _9 G$ n$ v0 j+ Q: `* ?  y! x
  246. STA MMC3_IRQ_DISABLE* ~; |) J, Y  {' b9 ?; r
  247. 8 ^0 F% X8 Y, l! c/ o/ i2 f- ~* y0 y
  248. ;==============================
    1 {( K3 x0 `5 }
  249. ;调色板清空' Y  C1 e  Y( q1 s( `
  250. LDA #$3F, ]2 _5 L' d7 U" y% r& ^  i4 P& ^
  251. STA PPU_ADDRESS
    8 {) ~( X- u# b
  252. LDA #$00: x; o2 ^$ G* k/ o: o
  253. STA PPU_ADDRESS
    * ?; H  m; m: q
  254. LDA #$0F, k& b( e4 S) l, J: g  a3 A
  255. Palette_Clear, ~# ~; u6 ]2 o, ^! {& V1 Y  \/ j6 W' E
  256. STA PPU_DATA& O! m; a6 P! P) ~( B" v
  257. INX8 T7 t3 d# j" Y
  258. CPX #$20
    7 t, M) R# p4 z1 w; g
  259. BCC Palette_Clear; y1 X7 t1 J, h
  260. LDA #$00
    ' h/ i! p, Q' g  j' z! ^3 k8 z
  261. STA APU_STATUS
    * _5 p' M- ?) A
  262. ;==============================7 t: r. f, i9 J3 C6 r, \' m
  263. ;初始化背景调色板/ |) T" A( w9 o, N- k4 N
  264. JSR Set_Palette_Color
    , s* C3 t( H5 y+ ]/ g
  265. JSR Set_NameTable_Attributes
    $ q& G  Y& C8 ]5 ~7 i1 o* I8 F( o

  266. # Q" v/ z' H% A4 q
  267. ;==============================
    5 E. U7 o! c% ]5 x; k6 e. Y- f- d" |
  268. ;RAM初始化) a" I% _' O! M- q
  269. RAM_Clear_All, F6 e" c9 ]& X: a* t9 p) O  F
  270. LDX #$00
    ) B( p' m- o! T/ [
  271. LDA #$00# N/ w; N8 u! \! O) `6 S, ^
  272. RAM_Clear_All_Start
    ! B' g4 |- }- w6 u1 [: H( ^
  273. STA $00,X
    - s( S( x  n3 r6 b5 k9 J. i
  274. STA $0100,X
      L2 w7 Y; B# G' w  a4 e
  275. STA $0200,X0 N% K0 f: _9 b
  276. STA $0300,X3 a3 s$ U' @% e
  277. STA $0400,X
    , R) \. y/ E0 W# o+ D
  278. STA $0500,X6 h: E3 v0 f8 _/ k* l) S2 [. l: U
  279. STA $0600,X
    3 R, r3 ], |8 {9 J6 o. ~
  280. STA $0700,X
      \; M! @" f1 t' I5 Y# F- J, n
  281. INX' U8 E2 m4 Y, \% ~
  282. BNE RAM_Clear_All_Start# g" O3 L( D" i, H
  283. * d: t" e9 x% ], E) e$ V- M5 I( l
  284. JSR VramInit
    ; d2 S) z4 h) c: g5 ?
  285. JSR Init_Palette_Addr
    ' T& f0 J# w& ~, r
  286. ' i4 P: O( s6 o5 U4 b
  287. .IF Music_Reset_Addr7 e! t4 z8 I) x  }
  288. JSR Sound_Reset( F& ]/ V7 a  Y
  289. .Endif
    2 k( i- O" n7 O. z) i+ b$ s5 K

  290. 3 Q, Q. M, G: p
  291. LDA #Music_Start_Song-$01+ M1 g7 W/ d: [
  292. STA Music_Cur. B% G0 V7 [% i- W5 i
  293.   a  _4 I" t+ y4 s9 ?, J4 J
  294. JSR Show_Music_Text) U9 s. a' B7 g) I. B0 y

  295. . }8 U' b/ O$ l6 T& V# p4 J
  296. .IF SOUND_BAR_SHOW_ENABLE
    : L# c+ e* E9 l' n6 x
  297. JSR Sound_Bar_Text_Set
    . w) X% p) Q. @9 K
  298. .ENDIF
    9 K5 z# a& S$ l/ f

  299. " X" m  }5 [9 g4 B4 r
  300. .IF Track_Name_Pos4 h$ `. o( [0 x% {9 z' W! x0 t
  301. JSR Show_Track_Info8 W* K2 g3 M8 O% K- X
  302. .ENDIF- `7 I0 x( k( K2 @8 g& I6 e; x

  303. - W8 F& e* n' t. w
  304. JSR PPU_Proc
    2 A# X/ V( G- Y4 T5 c- A

  305. . G+ _3 t5 U7 W; a( Y" B3 Z
  306. LDA #$0E
    1 @  b, H" i6 \3 G( |0 a
  307. STA Screen_State0 W( t# N" I5 g* i
  308. * j  K% k; R" h& [
  309. JSR Sund_Bank_Init
    5 ]  |, j/ w- Z  v& C" c

  310. $ |$ c' c$ l% Z3 d8 X. [
  311. JSR Music_Show% ^6 K: _/ {3 {
  312. JSR Time_Show  B9 L" {% W: r* y- e3 u
  313. JSR Music_Stata_Show& |8 F, L) G; f3 f
  314. JSR Time_Delay
    1 g1 ^" d6 A" ]8 ]* P% B' `
  315. 3 x8 u" S) X; ]" l* V

  316. ' @4 a* X) D  R9 d) T! B' }( D. F
  317. LDA #$80
    2 v8 m6 O  s0 D5 h( N
  318. STA PPU_CTRL# o8 Q, K1 |% o5 ?8 p4 h

  319. , Q1 d6 m# |) K. B$ |) s
  320. LDA #$20
    $ h" A1 v% Q# t/ j/ P) {  k
  321. STA Time_Wait_Cnt# m" S( c, g1 x
  322. ! C" K  M# b8 K& r0 y
  323. Wait_Time_Over
    3 p, P6 T' M0 B& H" p
  324. LDA Time_Wait_Cnt
    $ S  v" X9 |0 U4 R& K8 n" d
  325. BNE Wait_Time_Over. a$ {8 w. J" k  M6 u4 K; z

  326. . a8 c+ g' M; @* h$ I; q+ t6 |# b) N
  327. LDA #$1F, m' L+ A, ?" Z' r4 ?* M
  328. STA APU_STATUS
    3 o+ z0 Z) Z( _, j$ l2 B$ T, O
  329. LDA Music_Cur( Q$ k% Q% [6 ~; v2 `4 V1 v
  330. JSR Sound_Init$ c2 }# z' b) `0 j3 Z8 ^

  331. ' {3 J5 R- n- W. ^0 H7 L9 l1 \& I
  332. JMP MainLoop
    2 g5 y. r/ c! ]" c5 m& e
  333. ( }% M* L* C( |  ?+ |$ o
  334. ;==============================
    " m$ l! S# V0 M6 v; H4 z' j2 U
  335. Time_Delay;延时等待. G& f8 S7 v0 ^% l6 q6 P7 ?
  336. LDA PPU_STATUS
    9 ^8 S0 {) `7 j; r% F" T
  337. BPL Time_Delay' z. V2 d  P4 y' z8 f3 i! A
  338. RTS
    & B4 T$ M% }6 M) z% f$ X* d
  339. 3 }7 t! |$ ?: y+ u9 _* D
  340. ;==============================. n& V  O! }5 u! H
  341. VramInit;初始化图形内存
    % m5 c8 Q/ N, }3 X# s& L' C: w6 F
  342. LDA #CHR_DATA_BANK
    3 x+ t* \4 ?! F0 F, n6 ?1 w
  343. JSR SwitchBankA000
    6 g: V4 [$ I5 A" _. x7 o8 s
  344. LDA #LOW(CHR_DATA_ADDR)
    # K% [# r9 l* j2 W8 L
  345. STA <Data_L' b& g) `2 X* R" N
  346. LDA #HIGH(CHR_DATA_ADDR)
    " W% m% P" Q; Q7 _9 d
  347. STA <Data_H
    * W; u# j; R# I: l* D, V
  348. LDY #$00
    7 o$ I% G* M! i0 ]" G5 S: e
  349. LDX #$20
    " ^/ B* v/ a9 T' B+ l* U1 k- g
  350. LDA #$00
    * v" o" n( y9 h% M
  351. STA PPU_ADDRESS
    3 Z: m1 @' d* m: }7 T. E. S1 l
  352. STA PPU_ADDRESS
    4 z* W  h7 A. j
  353. VramInitWrite
    . U' @/ W; u+ }  v0 d
  354. LDA [Data_L],Y0 A. H* S" W8 v
  355. STA PPU_DATA) x0 M, \) L. N7 i% H+ s! K9 N
  356. INY
    ! q: u& `& E- t; |; \" A$ a) J" A; V
  357. BNE VramInitWrite
    4 ^2 n) Y. N* P9 O0 H  X) f3 g
  358. INC Data_H& i1 D# j  D: I
  359. DEX
    + v3 C) ?5 e7 _1 \8 m, m. o* T$ Y
  360. BNE VramInitWrite0 a  _6 M0 i1 k
  361. RTS
    ! H! d. `# o9 F- v! j& z) G
  362. $ p4 A9 D9 T3 X$ H
  363. ;==============================- l! ~6 s2 o: W% J: E
  364. RAM_Clear;RAM清除
    8 @9 G9 L* U3 q9 Y0 s* T: y
  365. LDX #$00
    5 |4 W2 `5 v1 z7 v$ q$ V
  366. LDA #$00
    1 t' y# l* `' P$ F, n
  367. RAM_Clear_1% B8 d/ e' Y7 W7 u" f, w
  368. STA RAM_Cln_1,X
      G+ t* r8 e% ^8 m* ~- ~
  369. INX
    1 m7 ^$ j6 i& ]( ~) @
  370. CPX #RAM_Cln_1_Size* t, W" ]. {# a4 h6 a) R( o0 R" p
  371. BNE RAM_Clear_1. a6 m1 w2 f$ l/ S7 d" P
  372. LDX #$00; Y+ f% `$ q. L* f: I
  373. RAM_Clear_2
    + f, X6 K/ m0 S/ }) {- U% n
  374. STA RAM_Cln_2,X) d8 S* Q9 G, u5 |2 N+ A+ v% A
  375. INX- E7 Z' c" [7 F5 K/ a! l, W% {# U
  376. CPX #RAM_Cln_2_Size
    3 V7 @& b% V' Z' V
  377. BNE RAM_Clear_27 d1 I' I; B2 G+ \8 X5 k/ i7 q
  378. LDX #$00( Q; @) \8 k, h$ b" t6 K! m
  379. RAM_Clear_3
    & S1 l2 `, p( h
  380. STA RAM_Cln_3,X
    * v, Y5 u5 I& N9 y
  381. INX; @2 J9 d7 q% _3 k: w/ N+ ^
  382. CPX #RAM_Cln_3_Size' }) p3 N! X9 j' V" b. Q
  383. BNE RAM_Clear_3
    5 f; q4 |& o0 `4 P  S' V9 U
  384. RTS$ P" _: d5 X2 _4 ~+ m

  385. 6 G% Q" [: m" a0 b
  386. ;==============================3 ^) {: D5 H  I* t
  387. ;音乐切换
    * i4 `: n5 H4 t% d, |4 o9 g* s- s
  388. Music_Switch
    3 e" d" T0 o. g; w/ E2 p7 j
  389. JSR Key_Proc& h' C8 }: V( d: P5 p+ F! D9 m
  390. LDA Key_Once5 A+ \( x7 @. j- p
  391. CMP #$10
      D1 h! i: F2 ~1 o% B- }. L- B
  392. BNE Music_Start_SongStop
      ?" m  W2 c1 O7 S- W4 ~' Z& j
  393. JSR Music_ReSet
    ' W# A4 P4 f" g- E( L9 w% L
  394. ( A! G1 n* `) l! H9 u
  395. ;音乐停止
    ) G, ], \* @' H# o1 m$ e
  396. Music_Start_SongStop
    & [4 K; r+ H9 n
  397. LDA Key_Once
    % w" X1 b0 f: E+ Q% _
  398. CMP #$20
    9 r4 w) G2 y0 J' Q$ j4 D# g+ ?
  399. BNE Music_arrow
    0 ^6 y. @" o- \
  400. LDA #$01
    # m4 n8 T2 _" `1 V" n/ N' {
  401. STA Music_State2 d% ~/ O4 r! ^" s! N
  402. JSR Music_Bar_ReSet
    5 I9 N# Q) ^, Z5 J4 C
  403. JSR Time_ReSet
    ' O) K- }9 S( `$ p! O: W# N
  404. JSR RAM_Clear8 A0 k9 b+ A4 {, c
  405. JSR Sound_Clear
      `. S; r% ^+ Q+ C! E0 t
  406. JSR Music_Stata_Show
    2 C/ F5 E/ ?8 P8 ^
  407. Music_arrow, ^0 u+ F% {5 z1 P  w
  408. LDA Key_Once
    9 a- A* M0 E$ l* [; O2 ]( u" q
  409. AND #$CF
    $ m- r# \4 y) b) x6 s4 X
  410. BEQ Music_Switch_End9 ?! g$ f6 G3 y& }9 h1 P) q# F6 o8 j
  411. JSR Music_Number. C/ {' v5 b9 p# M/ f
  412. JSR Music_ReSet
    * `4 C4 I/ f" l- l% i0 Q& Y: M
  413. JSR Music_Show
    # F  O( H% ?+ n% L: |1 B7 k
  414. Music_Switch_End1 I% B7 R1 M2 C. }  a
  415. RTS% x+ E' y  ~' l! _

  416. 6 l4 V) L( B. h( a
  417. ;==============================
    ) Q! |1 a, Z/ A0 \
  418. ;音乐曲目切换/ l3 `% `2 e) T* Z; O) U3 Z" Z+ J
  419. Music_Number
    3 B) O. E3 A. D8 Z5 Y% N
  420. LDA Music_Cur$ g" W2 `6 W/ E) Z- j: r0 Y
  421. STA Music_Last
    & K. v" B: J9 P
  422. Music_Decrease
    ) {/ X4 O; {, y7 J6 |
  423. LDA Key_Once
    ) G# S- n: J( |- L
  424. AND #$42
    % e2 n0 W  b! F% s
  425. BEQ Music_Increase3 ?8 U" L) m+ c% I( C
  426. LDA Music_Cur
    ' M( `& M5 j( v( \4 T+ G; a7 W
  427. BEQ Music_Increase
    , O* R% \& z7 {: `6 x
  428. DEC Music_Cur  m. H" ?8 U# q& k. w
  429. Music_Increase
    4 u$ X, L/ h- s, X- ?6 C. f  w2 ?* m
  430. LDA Key_Once
    7 p# w% P' o3 X  c* r8 b5 k
  431. AND #$81
    % k  O9 [( J9 A5 U0 S: q: j
  432. BEQ Music_Decrease_101 R) n: ?: ~4 n! ~/ i3 @% x' B
  433. LDA Music_Cur( k2 V- j+ Q% h3 ]- y$ M) Y
  434. CMP #Music_Song_Total-01
    ) p- Y7 h9 O* x1 V
  435. BCS Music_Decrease_10
    4 [6 X  [! F. j1 k+ n5 K+ ^- I
  436. INC Music_Cur
    $ i) L. m4 x# _+ q' p& y; v4 @
  437. Music_Decrease_10
    9 u( s( Y0 u+ ?) @7 B
  438. LDA Key_Once
    3 p" c5 C" |  `$ f
  439. CMP #$04
    ) T" f) ^$ i+ \4 X, _0 p5 _0 L
  440. BNE Music_Increase_10
    & A+ g2 t. N: j" {( S
  441. LDA Music_Cur
    $ v9 o# D7 d" N, \5 L1 T9 p: |- ^0 h
  442. CMP #10
    / N1 ?! K9 k3 S
  443. BCC Music_Start_Song_Min
    ( y5 ^/ r) W" c4 f1 ^/ x/ C8 i
  444. LDA Music_Cur
      c1 t2 T( _5 g8 A9 b
  445. SEC; l2 Q2 |" f& Z
  446. SBC #10; S, D9 D) G6 b3 P0 z
  447. STA Music_Cur+ v. W& P9 B0 L8 c9 `: u+ u  d
  448. LDA #$00
    1 _7 H7 A/ [; C# N3 g
  449. BEQ Music_Increase_10
    * ~/ V5 V7 V" a, Z) d' A6 k: J
  450. Music_Start_Song_Min# J0 j3 _3 B/ e' ]0 ^
  451. LDA #$00
    8 M) L7 E: k' F
  452. STA Music_Cur
    : k; o, Z, Y6 |0 x% Q) U% }9 s1 C1 G
  453. Music_Increase_10# _- |6 \+ c3 h- t- a" `1 X
  454. LDA Key_Once
    9 n. C" ~& s' I3 U: L9 J
  455. CMP #$08
    1 M: {( q1 A  S3 i
  456. BNE Music_Number_End
    7 |7 ]) c4 w  O: u2 ^% {& n
  457. LDA Music_Cur
    $ C! a& B& t7 q7 J
  458. CLC
    + T9 q5 C4 ^9 s; b4 D, F
  459. ADC #10
    & s- c% @% ]0 L$ k
  460. CMP #Music_Song_Total-01, j/ p0 x; v4 F1 X& M: |/ q
  461. BCS Music_Start_Song_Max
    ( u9 B0 q/ l: [# }2 Y
  462. STA Music_Cur' ]7 E! ~  Y7 y1 Q3 |% G
  463. LDA #00" t9 p: E3 C4 B2 c9 l7 b- `
  464. BEQ Music_Number_End/ M, i5 P2 i1 \! g+ J, C$ B( E
  465. Music_Start_Song_Max
    ) c1 n2 t+ B  o' Z, G4 q! J
  466. LDA #Music_Song_Total-01
    . Z8 ~1 E" i* {( r
  467. STA Music_Cur
    ; j8 K0 j0 f- `  ]4 ]* k
  468. Music_Number_End
    * ~8 H4 k) H! q7 l7 a
  469. RTS
    8 T( B# R9 ?" L  Q

  470. - \, S) G3 T1 I, N
  471. ;==============================
    5 k6 j% I5 b6 \8 O
  472. ;音乐重设
    $ V  y, P5 u% ~# c% l0 H
  473. Music_ReSet. y5 E3 }0 g" [. g: {6 ~. v4 S
  474. JSR RAM_Clear
    . [8 B" a; O: y
  475. JSR Sound_Clear
    ; O) `5 ]4 }# b
  476. LDA #$1F8 T' d. G" K, O2 ]( C  M  }4 \/ E
  477. STA APU_STATUS" F. n9 f8 B: |! \1 c
  478. LDA Music_Cur
    1 S* R  B; b1 w
  479. JSR Sound_Init
    6 I: G" H) a  |8 j
  480. RTS
    8 @6 }  b) l+ T# j$ O) M0 Q0 q& n

  481. 2 L7 P" ~" f+ R( r  m
  482. ;==============================
    + }' D7 O/ A7 }4 u
  483. ;音乐端口清除
    3 C2 b' M, Y6 Z/ m
  484. Sound_Clear
    7 P3 q; L' ]6 C" ~/ N
  485. LDA #$00
    - L6 t4 O) G0 W) T# \6 A
  486. STA APU_STATUS
    $ f1 r: z9 H4 z# F( _
  487. LDX #$009 q1 r/ j- `1 `7 o* ~* \
  488. Sound_Clear_Start
    3 ~4 \2 W( c2 q, O0 `2 g
  489. STA $4000,X) s* y" l8 P  Y0 ?6 _
  490. INX3 U, |1 Q8 G* L& ~$ r1 }& H) b
  491. CPX #$14
    # ~; F8 d: u: e5 V. r. F
  492. BCC Sound_Clear_Start
    $ D, b9 H% z  H# S( E8 ?; j5 V6 ~
  493. RTS# m2 k* D( x& H- r

  494. 7 \+ ]% U  d  K) z: c8 _2 q
  495. ;==============================+ n2 L7 A; s+ ^6 [. j( M
  496. ;按键处理% X0 J0 `  ?& {8 F, q
  497. Key_Proc
    ( b  S* s( A4 b0 \
  498. JSR Key_Scan
    . E  y7 O) I: W! J4 j8 j* h2 \
  499. LDA Key_Keep$ f% A6 k4 d# R+ p
  500. STA Key_Temp; P  V8 v( b, f2 w
  501. JSR Key_Scan$ Q  @: k" L3 D9 J3 P
  502. LDA Key_Keep
    4 o% D, f0 B! P0 z8 `7 ^+ X
  503. CMP Key_Temp
    ' [! i, C8 }+ B, z* C! D
  504. BEQ Key_Get_Once
    ; v7 h) Y3 ~/ B+ q. R, `* u5 U
  505. LDA Key_Kemp
    % f* D) J0 _8 v) `, A* m
  506. STA Key_Keep
    9 H+ D9 v9 `9 v& A
  507. Key_Get_Once
    3 B  _# Y5 j9 P' |% X
  508. TAY7 W6 a! A9 Y- c1 Z% E
  509. EOR Key_Kemp1 Q! N& N/ U: F! F  ?
  510. AND Key_Keep8 y2 B% _9 [3 b! K( R3 ^& B
  511. STA Key_Once
    2 c, s: q' G! ?% F9 x  ]. Y! K1 z
  512. STY Key_Kemp  j8 U4 H/ k' f' I. c" G( V3 h
  513. RTS
    * K1 j: J# q4 E8 h4 X& [
  514. ;------------------------------' Y/ ^4 h3 ]$ n7 y
  515. ;按键扫描
    , F5 P  `4 X# x8 G9 ^3 S2 J
  516. Key_Scan9 P$ c; g' t3 O
  517. LDX #$012 H" p$ g9 u3 x2 C# n& u
  518. STX JOY1_FRAME
    - K5 I/ X$ ~# F' ~  v
  519. DEX
    ; m2 H4 p' b0 b5 p( ]& @" e3 m
  520. STX JOY1_FRAME
    , m6 c; w& `- E
  521. LDX #$080 f. q  s  X# _! L- l( @  R/ T& Z
  522. Key_Value
    ( u7 c0 ]. y$ I, O" h- E
  523. LDA JOY1_FRAME
    6 R6 u  X6 X; e+ p3 J# ^
  524. STA Key_Getv
    , ~  C' V! L8 `: W. T# Q$ {+ @8 k$ h
  525. LSR A
    - e3 l1 l* I" l
  526. ORA Key_Getv8 m3 U' L# c8 ]0 H5 S
  527. LSR A  H" [3 E8 y1 [' d5 ?' K6 S
  528. ROL Key_Keep: j& C; b7 O" C% M% w3 V% x9 A5 D
  529. DEX
    9 k' v& o( s7 Z1 j
  530. BNE Key_Value1 F. x' U- h- P  m0 z: D
  531. RTS
    / p  O6 d) }, b" u

  532. # k1 {/ e# Y! g* I5 a
  533. ;==============================6 Y6 q9 N) ^  l* l6 o* |# W/ y
  534. .IF SOUND_BAR_SHOW_ENABLE
    2 S5 n' B! y5 d2 |5 r# D7 F: g
  535. ;音乐条显示
    # `1 b& N% _8 b3 u5 j6 E
  536. Music_Vision
    1 p+ A! ~' d9 g5 K
  537. JSR Music_Animation
    4 s' a/ R* f( m
  538. JSR PPU_End
    8 Z* [  |" U: R
  539. RTS3 d( @$ G$ Q2 ]3 {' `- W* `
  540. ;------------------------------
    6 S  Y  m- d0 x0 z+ U" U
  541. ;音乐条显示处理8 J2 v7 f8 ~# Z* }
  542. Music_Animation
    3 M8 {8 E* \- o" c6 F, J
  543. LDX PPU_Cur
    . |& C' ?, Z; O; @
  544. LDA #Mode_Line7 F9 v/ a1 J4 J( b9 F
  545. STA PPU_Addr,X, m+ r) S# I1 P# J- M
  546. INX
    , F8 P( z: S5 \8 y. H! h5 M( j1 @: c
  547. LDA #HIGH(Sound_Bar_Pos)8 }, k- n3 J6 |$ R6 L
  548. STA PPU_Addr,X* u' H; T  r! E- T
  549. INX0 I! w0 N" [5 c3 J6 F9 `' Z( L' D
  550. LDA #LOW(Sound_Bar_Pos)' c  s/ I6 C/ l7 E1 `; x$ {
  551. STA PPU_Addr,X4 D9 ^3 N9 ?) U2 C6 `( P  ?
  552. INX* D$ I' l% K" }/ l' |) {( k
  553. LDA Sound_Bar
    ) A  M" N5 d3 U2 B
  554. JSR Volume_Convert
    " x/ @5 \9 k% A/ ~6 S  e1 I
  555. JSR PPU_Return- D2 P6 k5 t0 t  M
  556. LDA Sound_Bar+$4
    0 ~1 K; o( Q" P0 t: Z+ P
  557. JSR Volume_Convert
    : B# e/ c7 Y6 |
  558. JSR PPU_Return7 W5 P' n+ `! M! c1 G3 [% s
  559. LDA Sound_Bar+$8
    + u$ k' y/ ?0 y
  560. JSR Volume_Convert_Ex
    + }4 N4 N" m) ^  i+ C1 `  e
  561. JSR PPU_Return# K! d7 E( t5 m; k1 b
  562. LDA Sound_Bar+$C2 F9 _, W" \& k) B9 `" _0 T3 N  X
  563. JSR Volume_Convert2 u7 V$ I5 a0 E
  564. JSR PPU_Return
    7 y3 a# k3 ]1 `! O* V
  565. LDY #$100 l3 S& W7 P+ v4 c; X
  566. LDA APU_STATUS, q# }; G) [6 e3 G2 [4 ?8 x6 I
  567. AND #$10
    , V: N4 D# d5 i) T; x
  568. BNE Volume_Count
    . l) x9 s7 I' \/ i; {
  569. LDY #$00
    & G+ C# W8 z, n- G" p) f5 i
  570. BEQ Volume_Count4 P) G! d; I# B8 m( X
  571. ;------------------------------
    & s1 @/ L5 `' B, S
  572. ;音乐条处理3 u8 I8 ^( A* f5 r
  573. Volume_Convert_Ex4 k9 F* e' ^6 H6 ?
  574. AND #$1F
    * Z( |+ U2 c! K/ u9 [  t/ k0 i% q
  575. TAY5 I9 s4 ]' q- Q4 ~) C1 c
  576. BNE Volume_Count; t$ e) L6 d8 N- W
  577. Volume_Convert- A7 H. t  @( Q7 N( l9 `+ _* i
  578. AND #$0F
    + o9 ~, b7 H) I- g4 ~' f0 z
  579. TAY
    9 {- \# l7 n- Q" B# Y
  580. Volume_Count  R' {3 z( N( P: o6 A& g
  581. LDA #$08/ O+ o0 g8 n4 f3 Z8 N
  582. STA Sound_Bar_Cnt4 o8 x8 q$ {! g8 q$ v" @
  583. Volume_FILL) W" {8 b) e9 |$ b% ]
  584. DEY! W" u) R. ^: g2 V% S/ S) A; m
  585. BEQ Volume_Half
    ) S8 c3 q5 \! s' `) ?
  586. BMI Volume_Empty
    4 @* t! I, G4 a2 t4 K7 Z
  587. DEY8 i& p! X$ K0 Z0 \5 i: W
  588. Volume_Full* u5 S, a- }8 c* ^
  589. LDA #$16
    6 F( Y5 h* l/ O4 e+ z/ K- w
  590. BNE Volume_PPU
    : X" o' F2 f, Z% j" |3 R
  591. Volume_Half9 B& x% h5 M1 c6 E7 K4 L3 _& p
  592. LDA #$15
    0 D  \/ I: }( P( ^  H! C! H
  593. BNE Volume_PPU
    ; r; t7 O7 I. V; X3 @, p  H( f+ t
  594. Volume_Empty; l7 M" z7 A9 u: ~, E1 u% C" ^
  595. LDA #$14
    8 a6 ]* U" ^' p8 p1 {
  596. Volume_PPU2 c/ k7 r6 @, r: t; [
  597. STA PPU_Addr,X
    ; f! e4 y: ]% p
  598. INX5 e8 C* M+ Q7 W  b: Y
  599. DEC Sound_Bar_Cnt$ ?7 k; E8 i% J
  600. BNE Volume_FILL: g$ _! G/ c# q6 {  K" \
  601. RTS
    + M+ T# z! J+ t7 y

  602. / Y) U$ g% Z& |5 P2 c9 `
  603. .ENDIF
    5 W! x4 Y. f# [: z$ ?" s

  604. * s) W) @2 C! Z$ I% x( p: m
  605. ;==============================
    # @0 `: O1 F2 W4 H# a6 {
  606. PPU_Addr_Set;PPU行开始- n5 X+ m! B% f$ ^/ L0 u* p
  607. LDX PPU_Cur
    ) H- u  ^* n  n5 Y
  608. LDA #Mode_Line
    ' K" B/ ?  z* b; X% N$ a
  609. STA PPU_Addr,X
    5 g0 c! H3 w# P" K
  610. INX
    7 n+ N5 f% K- ]
  611. RTS8 S1 j- M( M$ v: X# Y- x% n7 C
  612. : V$ h2 n# y" l/ p; i2 Z
  613. PPU_Return;PPU转行
    # a% q* O+ B. x) E/ s# X7 a
  614. LDA #Flag_Over; z+ p3 i# @- Z& y1 g
  615. STA PPU_Addr,X; e) |1 \* ~! b
  616. INX' @+ N( v* a, D% e( t; v+ n8 P
  617. LDA #Mode_Return
    + C3 A9 ~# F) b- e$ S% W
  618. STA PPU_Addr,X
    0 E" ^5 U. w' r2 B0 ]
  619. INX
    / G% h: s4 o' v. u' ~( t9 H
  620. RTS
    ) w) }. J7 {3 r8 x7 g: O

  621. $ ^" P4 _& J  e% g
  622. ;------------------------------
    0 k# X  s; `, {- k  e* V0 w% d+ j! x
  623. PPU_End;PPU结束: G: i& `  R5 X, ]: |  A2 J
  624. LDA #Flag_Over9 a; n( h. E$ r+ d3 w1 B; Q  i& f
  625. STA PPU_Addr,X6 m( E5 i! D4 W0 h- w$ ]: E
  626. INX8 g) I$ y3 L! l' @
  627. STX PPU_Cur) m0 Z) U  q; H; |. p( F8 I4 p  g
  628. RTS
    ; M) J, K) G9 n+ k% a$ W
  629. ;==============================# r8 E/ i& G% S, g4 D
  630. Mode_Line     = $FD    ;新起行模式: ?9 R' b7 U8 Z8 H: t; i$ M2 z8 Q
  631. Mode_Return   = $FE    ;转下行模式, h+ y9 Y/ F0 m9 ^+ h0 M1 ?
  632. Mode_Clear    = $FC    ;行清除
    6 G  q! Y4 a$ `
  633. Mode_CntLine  = $FB    ;行计数写入+ d2 K4 p" _+ @5 I6 ?7 E
  634. Flag_Over     = $FF    ;行结束标志
    " M! r/ U& {$ R8 w

  635. + f5 Y. w* k1 U9 p( m
  636. ;------------------------------
    / a$ S: o& A- \# f$ L) r7 ?
  637. ;PPU处理
    / Y7 ]+ J5 |% f, K) ~- x
  638. PPU_Proc
    * q/ t7 Q" g  e+ K
  639. LDX PPU_Cur
    3 ^6 E! R( o9 f7 i* j  E
  640. LDA #$00+ l- y) _( t5 P' _
  641. STA PPU_Cur
    ' k0 j2 k; T! a$ t/ y  c
  642. STA PPU_Addr,X/ h* m% u0 R6 M0 l0 I/ I
  643. LDA PPU_Addr9 M% L; ?# @. t2 ]9 Q# `
  644. BNE PPU_Proc_Beg+ A$ [; T5 N2 M% Z) Y
  645. PPU_Proc_Ret% Z1 u4 Y1 `- _5 E9 W! o! h% a
  646. RTS
    $ U$ z7 K, l. ?5 H: G* K
  647. ;------------------------------
    ) p2 R! D: t2 }' b2 p& N
  648. PPU_Proc_Beg  ;处理开始9 p& `$ Z2 |6 c" S& z! V
  649. LDX #$00/ i/ c, I  `+ \5 w. X; M, P+ E
  650. STX PPU_MASK# c1 c0 a% ~& k. Q4 B% Z
  651. ;------------------------------2 W% ?! V8 U$ o2 W
  652. PPU_Mode_Select  ;模式选择
    ; I7 F# P; D9 d$ U1 }
  653. LDA PPU_Addr,X
    . X. S& o. O% D' }  l
  654. CMP #Mode_Line
    4 M$ b" K" j; ^8 R# n% g
  655. BEQ PPU_Mode_Newline
    ' y: e) d1 w  Y5 M
  656. CMP #Mode_Return
    ' n1 u( x# H0 K1 ~
  657. BEQ PPU_Mode_Return
    4 F- h# b+ M" P# N4 _
  658. CMP #Mode_Clear: T: U5 A: y2 P: L
  659. BEQ PPU_Proc_Clear. h" c; X7 v5 c6 z0 r
  660. CMP #Mode_CntLine! n  @  \/ Z/ X7 E! T1 b) o& i8 K( T
  661. BEQ PPU_Proc_Cnt_Line
    0 e( d5 @0 X7 Q! i  r% P/ Y8 d3 T
  662. RTS
    4 [( ]! F/ A1 ^. v8 Y! N
  663. ;------------------------------
    . \7 t( l" c* }& i' w
  664. PPU_Mode_Return  ;转下行模式
    & m& D, l$ A; b3 W
  665. LDA PPU_Addr_L% B4 B2 ^8 O9 L' ?8 M
  666. CLC
    , c/ _, \; S% U& D
  667. ADC #$201 e7 d# O. u1 {/ ?0 G& T
  668. STA PPU_Addr_L
      g. _6 A0 E( V" E4 `
  669. BCC PPU_Return_End$ W% t: }; C- f+ ~
  670. INC PPU_Addr_H& N  c6 C9 ^3 b% a' g
  671. PPU_Return_End( q- V& I9 M+ c( s
  672. JMP PPU_Set_Increaser
    . E5 f! b' m3 g6 D! J
  673. ;------------------------------/ E  V$ I0 [* d- v
  674. PPU_Mode_Newline  ;新起行模式: j& V: ?+ S: B- a' H9 }/ W; v# C
  675. INX
      s3 g" y! K5 z! g
  676. LDA PPU_Addr,X+ R- M3 i' @5 c0 H0 R" t; d% }
  677. STA PPU_Addr_H
    & M! ]# R- o9 Y
  678. INX. x# B3 }  [4 C# e
  679. LDA PPU_Addr,X
    0 w0 A5 A9 G. c! e; {& s  l- d( l
  680. STA PPU_Addr_L
    $ D7 E& p' F3 S* P+ x+ t
  681. ;------------------------------' R; u" u$ u0 `! p/ W7 J, O: k
  682. PPU_Set_Increaser   ;设置写入地址
    $ i: ]: O8 a4 ?9 T
  683. LDA PPU_Addr_H, J8 ]3 Y' w/ O0 v- K/ [- V
  684. STA PPU_ADDRESS
    " R: Z; q  m3 I6 l: W
  685. LDA PPU_Addr_L' b( g4 L. s$ Z5 |& G. i
  686. STA PPU_ADDRESS
    0 D0 d! U+ ?2 w% g1 G6 E
  687. ;------------------------------3 I; a+ l1 \" G9 U% {
  688. PPU_Write   ;写入数据) E& w, y) D1 K7 H
  689. INX) u% I. X! v3 v/ u
  690. LDA PPU_Addr,X  r6 {0 T* m, c/ z0 ]( l/ G1 J& ?& j
  691. CMP #Flag_Over7 Q9 W# t) n) v& Q
  692. BEQ PPU_Proc_End# o* G# H+ B1 J; W* |
  693. STA PPU_DATA
    & B. U, N( E+ J1 P- F9 Z1 o, A! U
  694. JMP PPU_Write
    0 r2 N$ S) J  k8 _3 w7 G/ y
  695. ;------------------------------" U6 p2 D5 l8 q2 Q
  696. PPU_Proc_End  ;单行写入结束
    ' W$ T8 P0 @1 m, s6 |0 U# o$ H- W
  697. INX
    8 V# r- a: x) s3 o9 x; z$ b
  698. LDA PPU_Addr,X
    $ V+ q$ j1 S! ]/ e
  699. BNE PPU_Mode_Select
    ; j9 C7 |# s( V1 ]! T) @0 t
  700. STA PPU_Addr( U* k' H% F( W8 D) f: `: C  B
  701. JSR Update_Palette_Color
    ) ]6 s4 e! w! ^8 ~/ P
  702. LDA #$00. N! ?6 A4 a1 T$ S7 v/ z' a; W
  703. STA PPU_ADDRESS/ F0 W( y7 E/ c) P. I  R+ r
  704. STA PPU_ADDRESS
    * W8 N; t- E! g/ W+ i& A2 T, n
  705. STA Show_Track_Name8 h' h- r$ e; D) u8 p. A4 Y
  706. LDA #Scroll_X
    ( Z( }& s; y8 [* t7 R9 z
  707. STA PPU_SCROLL( w9 n) \/ Y* u+ l
  708. LDA #Scroll_Y
    , b& W  J' U& t: y* [+ B
  709. STA PPU_SCROLL% S! c: f+ @/ I2 y/ ]8 L; Q" e
  710. LDA Screen_State
    , c* S& W8 [$ @7 B
  711. STA PPU_MASK
    2 t) U1 _0 h/ t
  712. RTS
    5 o6 {2 O  d* ^2 T. b, V
  713. * u8 |/ a7 Z8 j% \; o
  714. PPU_Proc_Clear
    + p1 V% p, P% ^7 u% ~; n
  715. INX3 e; x% D7 L- n( K
  716. LDA PPU_Addr,X
    / b$ T0 m/ {1 d3 @2 Z. o
  717. STA PPU_ADDRESS
    2 L5 {+ n) C1 i6 x  z7 b" Y1 X
  718. INX+ n9 I4 _5 H, }2 H4 x
  719. LDA PPU_Addr,X3 R1 @0 ~; Q5 D; j6 C5 O2 E
  720. STA PPU_ADDRESS% C6 Q. c0 h" H! k3 {
  721. INX
    & f% U* f( N: }9 k. p% j, U1 i5 l
  722. LDY PPU_Addr,X
    7 V& n; c/ j; x9 S/ w
  723. LDA #$00: O, P# g4 E4 Q+ n
  724. PPU_Proc_Clear_Write
    9 p# C7 m: k  x. K& @5 [; }/ B0 S
  725. STA PPU_DATA
    8 K1 U% K9 K' U5 h
  726. DEY
    & C7 Q* Y: T" |* y8 X7 B. L9 C
  727. BNE PPU_Proc_Clear_Write2 F- N) X# m" S$ L# Y
  728. JMP PPU_Proc_End
    2 ]* o: b1 V9 e+ J# ^
  729. " ~: t) K1 ^* U- X* w* \/ Z0 K
  730. PPU_Proc_Cnt_Line
    ' ]8 m( U: D/ p& O7 Q+ Z9 K( l4 u% A$ z
  731. INX6 @0 M  l7 Q: R  z
  732. LDA PPU_Addr,X: D: ?2 Q7 l6 X+ R. d5 E
  733. STA PPU_ADDRESS
    ! ?! T0 r/ u  t5 M8 ?
  734. INX
    ( o5 h# G0 E' a/ c+ h& N6 Q
  735. LDA PPU_Addr,X$ V9 y( j  S) ?$ w* t7 Q% `0 p' i0 N
  736. STA PPU_ADDRESS) c) D& m7 B* S  G! C/ t0 N
  737. INX
    ) J4 t2 a$ Q. a/ [
  738. LDY PPU_Addr,X
    ' {# ^. z* w$ V; Q
  739. PPU_Proc_Cnt_Line_Write. ~0 F3 r. b$ W, V: T
  740. INX7 D- v9 q' q1 X9 F1 @4 B/ C
  741. LDA PPU_Addr,X
    7 i& p3 A6 R0 g/ _9 X
  742. STA PPU_DATA7 X1 J: l) P: f/ c, f
  743. DEY2 ]% X1 E- k. C+ h8 @* p$ [) F0 B
  744. BNE PPU_Proc_Cnt_Line_Write1 }# q7 n7 F0 V
  745. JMP PPU_Proc_End' r/ }# U9 u  A5 L3 F) E! U
  746. 6 _( y* g, C" Y5 V  ?( Y$ R
  747. ;==============================
      j6 I: e! K- y; c" W
  748. HEX_To_Dec;十六进制转十进制! A0 w+ d# ?: Z9 M5 B
  749. STA HEX_Data( o# \; p; c  ~; h3 L
  750. PHA& q* V+ A& C7 L4 f
  751. TXA
    ( z) e6 I9 y. B$ t8 C
  752. PHA
    1 h" t3 C' w; t. N5 K
  753. LDX #$00. V3 }7 l9 K' K4 ]+ o) I4 s
  754. LDA #$00
    : M8 N+ r. h' {7 ?
  755. HEX_Cln! N" ?  u1 Y: N# f# O
  756. STA DEC_H,X
    8 E; |2 N8 l! T
  757. INX
    ' j4 w. b' j: j* N
  758. CPX #$03
    , f3 l! _$ l4 Z5 G' N$ Y
  759. BCC HEX_Cln& D" v4 H: P1 u9 K
  760. LDA HEX_Data
    ' }8 I; a5 D9 g  i) H. o- T
  761. ;------------------------------9 P/ z/ [/ E1 l; N' L  X2 C; N. J% y+ E
  762. HEX_100
    . b1 ~, M  x+ R& D$ c
  763. CMP #1008 i  S7 P4 o# Y3 U9 R& R7 Y3 v
  764. BCC HEX_10
    ; i& f; j$ J: F" U. a
  765. SEC
      T! N6 v' }1 v+ X
  766. SBC #100
    & L* M+ Z% V1 d  e% _8 t
  767. INC DEC_H
    ! b  l' C; q$ F0 c( ?  P' u
  768. BNE HEX_100
    * k8 C; p% u# g. E( P
  769. ;------------------------------
    . D4 b& F8 D5 B1 Y
  770. HEX_10. D% b' ?" A4 U: p% J
  771. CMP #10+ n! y- u- j4 N) v  T; U) e
  772. BCC HEX_1- x+ I5 K$ p3 y7 C
  773. SEC$ o- f1 q* e  A9 L; ^+ P+ p
  774. SBC #10, m9 K& t- t; ?4 Y
  775. INC DEC_T
    : Z7 l  p3 g2 w+ N
  776. BNE HEX_10
    3 q, h2 j( h* v4 v( U, ~! v5 @
  777. ;------------------------------
    ! |1 |  F- k) [. A% l
  778. HEX_15 V% [# h1 Z; q  t% F" h
  779. STA DEC_L
    ( _. W- \9 m4 `9 O6 |: {$ v
  780. PLA
    ) E7 [, i# {6 V" _; r/ k) i: Z* _
  781. TAX
    0 q0 q- N% }6 t
  782. PLA
    5 J* E" d, m4 Q) f: k
  783. RTS2 u1 d6 `- z# Y

  784. . J; V* y1 `/ G8 u& K: j8 K" K
  785. ;==============================
    9 S1 ^  w4 c; c; Y2 c
  786. ;音乐曲目显示1 x9 _2 d% I. `) h, w# E, b! i# b
  787. Music_Show
    7 z2 d* l  z8 a# H0 d/ F) P* b- d! r
  788. LDA Music_Cur
    4 Y" C1 w; A8 x0 G5 L0 B1 d
  789. CLC
    . s$ w4 M8 l! z5 m' n
  790. ADC #$019 T- q6 U% t6 ^: y8 O
  791. JSR HEX_To_Dec
    ; |2 C4 Y# I0 n7 T% V- A
  792. LDX PPU_Cur
    6 I7 s) n; f3 Y- q% D' b4 Y
  793. LDA #$FD( o/ Y2 ~$ B" O( Z, v7 S9 J
  794. STA PPU_Addr,X8 ?; \  B9 ^" e8 U5 {$ H
  795. INX; g' S& l3 p5 ^! a9 Z
  796. LDA #HIGH(Play_Index_Pos)
    # }) V; n. x, Y, ^
  797. STA PPU_Addr,X
    ! R% ]  X. P$ b6 U0 P) O; i$ [
  798. INX, e0 H1 s' c% p. P6 B3 f
  799. LDA #LOW(Play_Index_Pos)0 z) A5 D; U; j+ N: b2 u
  800. STA PPU_Addr,X
    8 M- r" P; K7 o; Y4 \
  801. INX
    * X$ B! Z+ G$ C- Z0 M5 h
  802.   g7 l) a0 p  n9 V/ ?, {
  803. .IF Music_Song_Total > 99
    , f# \- Z, Z: y0 i3 A+ _
  804. LDA DEC_H
    # v2 _  z& R! J) Q* l
  805. ORA #$30
    7 r; G8 k; W0 a  R; L
  806. STA PPU_Addr,X
    & f8 L; c6 w; t7 s
  807. INX
    1 [$ J# P" W& w6 P/ ?  c& ^0 N
  808. .ENDIF
    $ i5 c+ N$ Y% N" w# \

  809. 4 X# R! ^6 \' Y; Y! m
  810. .IF Music_Song_Total > 9
    ) |6 c4 Q+ l4 ~1 i: H
  811. LDA DEC_T7 `7 N4 |; p# c% C6 u
  812. ORA #$30, y( B  i, Z1 y4 M+ g
  813. STA PPU_Addr,X0 i$ J7 I; w8 S0 b4 w
  814. INX2 w8 c& }2 e  N
  815. .ENDIF
    0 `0 s; E$ b  @9 a
  816. % _1 R4 I/ @, t1 v& y8 j
  817. LDA DEC_L
    6 D0 f+ S: _4 a% O
  818. ORA #$30( o3 z5 v. l5 V, w( W
  819. STA PPU_Addr,X1 E0 N$ ]$ M. r, z9 h4 r
  820. INX5 g% m1 L8 _' B2 e+ u

  821. , D; ]8 i7 X. M! x; f, N
  822. LDA #'/': {4 k" S1 w7 s  u
  823. STA PPU_Addr,X
    9 G& s, L# w$ n' _8 N1 \! s
  824. INX
    : k( I5 g8 j( C: ~# Z
  825. Music_Show_Total% o* Q% z9 S8 G
  826. LDA #Music_Song_Total4 o% K" E1 _' Z; c$ l
  827. JSR HEX_To_Dec
    1 [! b0 S+ r# l! ?. U4 C* ~
  828. 3 w) G2 R2 w% f" E' c0 T5 e
  829. .IF Music_Song_Total > 99
      `* i9 J, S/ A  }
  830. LDA DEC_H
    * _5 w) _! \2 Y2 i" R  k/ |# \
  831. ORA #$30
    , c7 I( i, a! P# t( V
  832. STA PPU_Addr,X
    ; @: b9 s5 ]: g7 e  H) K
  833. INX
    ( h9 ?6 }" Y) W
  834. .ENDIF$ e6 E, @; @  A+ t
  835. ) U1 d  E* i6 \5 ^4 `
  836. .IF Music_Song_Total > 9( f9 }9 T5 E* u% ~( v- o6 g
  837. LDA DEC_T7 b$ Z' E, t9 \7 p  o
  838. ORA #$30  z: t, J3 d- f$ x1 O+ m
  839. STA PPU_Addr,X  c- l. ?9 t. H, f" \
  840. INX
    7 V( N# j- @$ D1 g9 V- z! x
  841. .ENDIF# C3 ~3 L2 _1 w

  842. 0 r' A0 ]4 p6 e/ D7 I$ y
  843. LDA DEC_L
    & B# P# {1 G3 q  f6 e3 a) ]; W
  844. ORA #$30
    - ]' B; D+ s; q+ `( m
  845. STA PPU_Addr,X3 a0 Y& B4 A# `! Y2 h
  846. INX; I( q; f3 s4 K  W( N, |/ J. G5 Z4 U
  847. , S9 x1 E) f" N; ?
  848. JSR PPU_End
    2 g% Q/ X4 J" J$ n& Q. q# ~9 G1 u6 O
  849. Music_Show_End8 v, X8 P' Q; k7 j8 V! D( @. @
  850. RTS
    : p, j- C5 `8 |7 [. C

  851. 4 I& U4 N9 s7 x
  852. ;==============================! v6 L% }6 f# N2 t: }
  853. Time_Show;播放时间显示- g4 B/ X/ Q% |( M
  854. JSR PPU_Addr_Set
    / L* f* y- n. j9 B
  855. LDA #HIGH(Play_Time_Pos)% n8 D) j8 B% t2 D8 ]
  856. STA PPU_Addr,X/ {# V+ x. m# C; }  b. p' T
  857. INX
    # {8 J+ a$ G0 E; H3 _
  858. LDA #LOW(Play_Time_Pos)
    7 F$ B9 p9 Q" |+ Q6 ]
  859. STA PPU_Addr,X
    3 c! j+ K3 U' X+ a- B
  860. INX, [2 w( z9 @9 O  O+ q6 D8 V- e
  861. Time_Show_H- c6 k  y# K$ V% e" |
  862. LDA Time_H, t2 T- f2 y& }! v5 S0 }1 M
  863. JSR HEX_To_Dec2 u- \9 i3 k9 F7 W+ l+ ~. o/ v
  864. JSR Time_Digit( b3 D5 y! y' q- Y7 y' g" V; B# T, }
  865. LDA #':'
    3 H" g! J; M- W& s; x
  866. STA PPU_Addr,X/ b. J% f; r  F. W+ f
  867. INX
    # E" y& j2 S4 X  G) e
  868. Time_Show_M
    9 `6 X# n! h" h2 U, `% t7 {0 I
  869. LDA Time_M; m6 t$ E8 R/ X
  870. JSR HEX_To_Dec* K" ^# d1 Q( B2 V% Q% X  i: V
  871. JSR Time_Digit
    $ O* M) g: P+ {
  872. LDA #':'
    ( }4 F9 X6 i" n9 N( s
  873. STA PPU_Addr,X
    5 p9 g" @6 v! G4 ]. H4 i
  874. INX3 E8 ]  w. k8 d
  875. Time_Show_S' O0 S  y$ K% C+ z4 B( B
  876. LDA Time_S+ E+ U/ i4 `' O% Z" j. D- e- k0 p
  877. JSR HEX_To_Dec
      C) e# p0 \& P% l3 `( k
  878. JSR Time_Digit
    " o4 e7 y$ Q# R& Q& O8 }
  879. JSR PPU_End
    ! N2 m6 j+ Z8 p' W, Z
  880. Time_Show_End
    / a- ~+ W& y4 Z, w8 y/ V
  881. RTS
    7 }5 v/ c0 W2 e& T; c
  882. 1 a) D( ?% p* |# A
  883. Time_Digit
    9 k. {% }. K7 R; w" C" k
  884. LDA DEC_T6 U% [1 Z/ r) I
  885. ORA #$302 R# o3 N+ E' M0 s6 h  S2 k
  886. STA PPU_Addr,X
    . N- G0 b0 T; m  v/ m3 U
  887. INX- Z8 ~% f: @1 }% ?4 U2 t* c
  888. LDA DEC_L
    - n' W, K+ r4 D0 P) [8 o2 n3 M
  889. ORA #$30
    , {1 m$ P$ t; r/ Q% \
  890. STA PPU_Addr,X
    $ r4 k" Q; Y8 o' y/ L% l
  891. INX
    5 o' W) p  `( o( P) c+ ]
  892. RTS
    , J3 E/ s! S' o5 q- i) J
  893. 4 s( z% M$ s" _( N) Q7 @+ [
  894. ;==============================: v8 E2 L% j$ Q$ _$ \9 A
  895. Time_Count;计时
    2 C7 w( h5 w0 K4 C
  896. LDA Music_State: l2 _8 K, k+ c
  897. ORA Time_Wait_Cnt
    * \* p, F% }  A1 s3 J/ r5 K
  898. BNE Time_Count_End. p3 ~4 }( {+ G: L6 k* E
  899. INC Time_Cnt" x% O3 m4 a" x; k2 a3 \8 k7 S0 {0 Q
  900. LDA Time_Cnt6 C+ p" ?# W5 q& {
  901. CMP #60
    # r' z) `$ u  X; k
  902. BCC Time_Count_End
      G+ i" W$ B$ s$ S8 O. e8 s
  903. LDA #006 |7 V2 D6 W5 X" _
  904. STA Time_Cnt$ }3 w3 z! b0 Y; M; ^, M  a
  905. INC Time_S
    # ?2 q( c( V4 g8 V# }% J* d0 i

  906. / H6 {; \# v0 @/ V6 c
  907. Time_S_Cnt0 o0 ?1 w1 W# q9 C- J
  908. LDA Time_S8 u' Z: @$ y! T, A! x  i0 H
  909. CMP #60
    & T7 O, E1 V% \
  910. BCC Time_Count_End
      o& k- e% e$ F: Q
  911. LDA #008 P. G1 Q! R4 G
  912. STA Time_S! C: k9 H. N$ h8 y% b  D* ?
  913. INC Time_M
    4 Z# d, f+ H! g& }- n2 ?% Q, q( t$ c
  914. ; I3 C( o8 z4 `
  915. Time_M_Cnt4 [4 Z& I) I7 d& ~0 y( y8 j: v
  916. LDA Time_M
      y$ U7 ~/ K# o6 V
  917. CMP #60
    5 C: f- G3 l. X  L6 a$ A* \
  918. BCC Time_Count_End
    / S4 Y# j/ ?/ t
  919. LDA #00
    ( s& O6 Z, W/ c/ y" O7 `
  920. STA Time_M
    0 t- \+ u7 j( U* r, R" L- p. i* n9 j
  921. INC Time_H! j5 ?# W; h8 z' g4 ]. u! d9 E+ L: n

  922. - c4 x" X2 E: E0 \2 ]6 r
  923. Time_H_Cnt
    ' B$ v, y! F( N9 \5 H0 Z6 r6 |
  924. LDA Time_H* A% q2 D6 ^* @2 G( c
  925. CMP #24
    & y$ d: v" T5 S! w
  926. BCC Time_Count_End
    ' E0 x. k( n& V! Z
  927. LDA #00
    * k( o0 J$ Y4 W$ [2 T2 R
  928. STA Time_H
    9 d7 j: k7 W- m, T. `

  929. 3 Z3 q+ K5 O& \' x
  930. Time_Count_End
    9 {6 }9 I+ u/ Z" O- F$ e# P  M/ J
  931. RTS
    9 X. m0 Q; P/ x, J  X
  932. ' z. T" O9 P0 G5 s6 \
  933. ;==============================
    6 f+ I5 F% ~- S. L1 p
  934. Time_ReSet;播放时间重置
    0 b6 w& S6 d! a! o6 r" k, @
  935. LDA #$00
    : @0 _; c9 n* f
  936. STA Time_S
    # g! |: a  v& n6 H/ N2 ?# p
  937. STA Time_M . B: ~0 N& b* \* Y/ ^/ W: [
  938. STA Time_H
    7 O" e" n; q/ U
  939. STA Time_Cnt
    " {% ]5 z" n9 Y
  940. RTS
    8 l# |3 E8 w; S/ }
  941. ) a3 o! ?( R( V% a0 Q, H  q* F) f
  942. ;==============================
    ( `7 X' W: M6 j4 w6 @, X
  943. Music_Bar_ReSet;音乐条重置  R  W% @7 L1 f$ y7 A( b
  944. LDA #$00
    % H; q% L4 c$ F$ q: Z: H
  945. LDX #$00/ q5 l% q" m8 p2 K) D( R
  946. Music_Bar_ReSet_Set7 j, E& v0 a8 h) I8 l4 r
  947. STA Sound_Bar,X
    4 h  ^+ T3 P: R
  948. INX
    5 U. M2 M  F3 n1 K' F$ U
  949. CPX #$10- X. a. K3 h5 Z5 t$ p9 B7 L; h! x
  950. BCC Music_Bar_ReSet_Set+ z( O" F! t' X; ^$ l/ H
  951. RTS# ?! Q6 e2 U0 e6 U+ F
  952. 0 m  e: C7 E7 U& p, W3 z
  953. ;==============================( v  t0 n' g+ Q, p' ?0 }7 y; z* s
  954. PPU_Data;PPU数据写入1 c6 {' R' {2 B+ _
  955. STY Data_L
    1 T2 S+ j2 ^' q$ t  r
  956. STX Data_H9 l1 A' u1 S& u
  957. LDY #$FF7 c& E+ y, N5 s1 Y5 S# u; n* G& |
  958. LDX PPU_Cur0 j  ?  H2 Y) a% l
  959. DEX
    % K+ P6 `' d4 b( T, _
  960. PPU_Data_Beg
    7 H, }  E& s9 ?: a
  961. INX
    4 k/ _6 i6 ~. v- N
  962. INY1 Q# r1 W( O$ X3 Z3 Q) M
  963. LDA [Data_L],Y4 f, v( D# d/ J* Y1 u! p
  964. STA PPU_Addr,X8 e  L9 k! U: g
  965. BNE PPU_Data_Beg' Q: k( M" j+ V4 S0 c9 Z% Q0 \
  966. STX PPU_Cur9 l# Y& [9 r1 F! a& j; ?
  967. PPU_Data_End0 ]8 v% p$ Y: \) d; V; x. l
  968. RTS
    . l8 w# _1 E  o  p

  969. " z; i; E2 Y( m
  970. ;==============================
    1 D; ~5 S! a0 d( b+ W
  971. Music_Stata_Show;播放状态显示6 }5 m7 _8 h) b/ n2 w- @6 M5 A
  972. LDA Music_State
    4 Q* w# G  L/ h2 x# j  e
  973. BEQ Music_Stata_Show_Play6 d  p: x) k: @" J
  974. Music_Stata_Show_Stop
    # H2 U3 T+ K" x$ |' @% d$ L
  975. LDY #LOW(Music_State_Stop)7 C% _9 a6 b% K* X9 k
  976. LDX #HIGH(Music_State_Stop); w9 w* Y/ {% \6 o" K$ v8 H! G  K5 w
  977. JSR PPU_Data
    " W+ s, o6 Q  n
  978. RTS
    0 N8 V" ]( h+ B& X1 s5 I
  979. Music_Stata_Show_Play
    " ?, r+ z9 D1 }1 O
  980. LDY #LOW(Music_State_Play)
    ; i# W5 L* d) G. N
  981. LDX #HIGH(Music_State_Play)
    ! C! F0 w4 c# x. R
  982. JSR PPU_Data
    4 [, x" g# @9 y8 H( W; ~0 |1 Q& E
  983. RTS
    " v& |) _( G# N8 P

  984. + g+ p# d$ ^& G8 F3 V
  985. .IF SOUND_BAR_SHOW_ENABLE
    9 |0 s$ V. \0 R2 p" {' [2 R0 G
  986. ;==============================
    0 ^) ^) |3 r2 g/ B1 o
  987. Sound_Bar_Text_Set;标题与音乐条初始化6 \3 c' Y( n2 O) W8 w& ~# }- D2 e$ o: ?
  988. LDY #LOW(Sound_Bar_Text_Data)
      p$ t5 ^( ]0 Q  {5 \5 T/ ]
  989. LDX #HIGH(Sound_Bar_Text_Data)+ Z/ [! f$ _' X! D& ]' \8 x+ x; m; \
  990. JSR PPU_Data8 N& T* }/ o% u7 c: f/ c8 l/ [
  991. RTS, T9 E6 q% O" ]2 G, z$ ]" n0 d
  992. ' b) U' k0 P6 g; ~3 ]
  993. .ENDIF
    / z" F+ v5 x5 A+ K' m! l" d1 T

  994. - v2 m! r; ~$ g
  995. ;==============================
    : M3 }& K, Q9 p/ y$ g* n
  996. Set_NameTable_Attributes;设置命名表属性9 ]: A# o+ R* }) g1 ~7 e4 ?" H
  997. LDA PPU_STATUS, _0 R1 T/ |0 ?0 I. C
  998. LDA #$236 `% o2 f. Z, B  _% _
  999. STA PPU_ADDRESS
      k: x2 r+ I7 ?4 j  I' N& P3 M3 K9 P
  1000. LDA #$C0& r6 \+ g$ f1 }: \2 B
  1001. STA PPU_ADDRESS
    " q: `$ K. i% n+ M3 O" I
  1002. LDX #$00
    $ {! `4 ?+ E7 n- q' n6 w, A% A  U" [
  1003. Set_NameTable_Attributes_Write
    ( b3 n4 ]+ V4 P" e  h6 z
  1004. LDA Palette_Attributes,X  h$ L1 t9 {  i) y* ^7 z0 g
  1005. STA PPU_DATA
    % i# R9 S( l6 R; J8 K% d8 ~; F
  1006. INX! w! s' v( n% H0 `+ u; ]
  1007. CPX #$408 I& T( D8 Q4 i, w3 H
  1008. BCC Set_NameTable_Attributes_Write
    / L' v( ]1 u8 \, B0 Y8 d; ~* [; X
  1009. RTS& b& N5 B3 I' X( E: F3 V8 h& D

  1010. ; @8 A. Y, T' k1 b3 I) M
  1011. ;==============================. K, C6 \6 Y+ ^, l# _% t5 v* ]6 p
  1012. Set_Palette_Color;设置调色板数据$ J& C4 ^) {! I! Z) }6 D
  1013. LDA PPU_STATUS
    3 }9 r9 [; C5 _" r* @9 Y
  1014. LDA #$3F2 L* H9 _6 w( X& J5 c- W
  1015. STA PPU_ADDRESS
      a' r4 f2 v2 `+ K: Y0 a" z
  1016. LDA #$00% c4 o+ }) {4 S& h% Q- V' ?
  1017. STA PPU_ADDRESS
    # v7 E( I! J8 M$ T' A/ f9 J
  1018. LDX #$002 H7 z8 V: b- ^, q# }7 b& p
  1019. Set_Palette_Color_Write5 b5 I) C9 D  P" N9 z3 ~
  1020. LDA Palette_Data,X) s1 C+ h" X2 g' w" p
  1021. STA PPU_DATA; l, v: G; I' L1 z4 B0 L) k5 z# U
  1022. INX
    1 G/ u: O7 s' Z- h) e% V7 Y
  1023. CPX #$201 C7 v0 q: M6 X) {4 H/ w
  1024. BCC Set_Palette_Color_Write6 U' _6 q! d( z/ o
  1025. RTS
    " x5 Z. M2 I/ s2 w7 l, [
  1026. * h) C8 E1 y. j( ]
  1027. ;==============================( e4 [$ [% U3 x* [$ V; M9 C9 N
  1028. Init_Palette_Addr;初始化调色板数据
    3 _- }2 N7 S  J1 Y0 F8 u
  1029. LDX #$004 {3 g! E! z! Q) Y7 W& Z
  1030. Init_Palette_Addr_Write
    # @2 x0 |% k3 `  O  M4 h' }
  1031. LDA Palette_Data,X
    ' u0 G. }/ e& {4 w% x( s5 Z
  1032. STA Palette_Addr,X
    - c/ a4 ~: U1 @
  1033. INX
    $ z5 s" F$ l/ p; a; B
  1034. CPX #$208 V' J. U0 y8 q$ p' H# }
  1035. BCC Init_Palette_Addr_Write
    . c! S0 Z( d/ ^& r5 H. l$ [
  1036. RTS9 W: v% y3 }/ ~" I/ d
  1037. 4 @& l5 t. Q) i8 Z+ v
  1038. ;==============================4 }+ ]& l! T3 U* ~8 ~! f& a! B
  1039. Update_Palette_Color;更新调色板颜色
    & O( y0 Y" y% x5 F+ A3 s8 ]4 ]  p
  1040. LDA Show_Track_Name
    + F2 ]% `! D, i. m7 B9 V' V& P. [
  1041. BNE Update_Palette_Color_End
    6 u: Y# @) k& z
  1042. LDA Palette_Update_Flag
    ( b$ C. H  s6 U4 s$ l! O9 ?& @
  1043. BEQ Update_Palette_Color_End
    4 b; `1 a' w9 h: |) o% [. Y
  1044. LDA #$3F
    9 L2 ^0 q8 B, g" q
  1045. STA PPU_ADDRESS
    ; f$ I3 T( R4 G3 i6 b- `. t- q5 d
  1046. LDA #$00' {/ p( [4 n9 A: `
  1047. STA PPU_ADDRESS% I) m, I, S( H& D' C
  1048. LDX #$00
    % r7 u6 h3 l+ W
  1049. Update_Palette_Color_Write
    + G5 d) U# z1 T6 f% \% b2 G
  1050. LDA Palette_Addr,X
    8 G) P- C6 P- B: l
  1051. STA PPU_DATA# j0 k% |" R- i9 @. O
  1052. INX, v# ?. h: c- b
  1053. CPX #$20, U/ m1 G, R  E/ F: r1 A6 b
  1054. BCC Update_Palette_Color_Write! ~7 t- Y3 x% C& }6 m& |0 Z
  1055. LDA #$00
    9 u. d* U, ~# X. Q+ Z4 a8 x9 g# I
  1056. STA Palette_Update_Flag
    8 U% z# @. @, {0 K2 G& R4 N5 v
  1057. Update_Palette_Color_End
    ( @( m# n* ]7 B! v/ h
  1058. RTS6 b% D$ [: C8 g# u% O& F
  1059. " ]' _) ~4 U' ?, ~1 u( \: d
  1060. ;==============================
    9 u2 S( Y/ H6 W/ h  e1 \0 c
  1061. Update_Palette_Data;更新调色板数据
    4 X* @5 ]+ O9 ]6 T
  1062. LDA Show_Track_Name. g3 {% |7 s" g$ O1 S( K
  1063. BNE Update_Palette_Data_End# q6 D' J' P+ K- T4 `
  1064. LDA Music_State! n7 d! S7 G8 P* R7 Y
  1065. BNE Update_Palette_Data_End! @& ?- P, `! L* |
  1066. Update_Palette_Data_Check
    " L' b$ X2 |* Z/ a* r
  1067. LDA Palette_Wait_Cnt7 z. y) g& b2 d( B  m) Z5 r. J
  1068. BPL Update_Palette_Data_Check_Over
    : U7 r5 s$ o; q9 g
  1069. LDA #Palette_Update_Interval
    1 ?" L: s5 V. B: J4 _: V" R
  1070. STA Palette_Wait_Cnt; B! t$ z6 ?& D" l
  1071. Update_Palette_Data_Check_Over
    1 q8 o7 I9 V( L
  1072. DEC Palette_Wait_Cnt
    0 l: N2 |! E1 e" R
  1073. BNE Update_Palette_Data_End
    + N3 {+ ~, J6 Y* U) u0 X3 L" A
  1074. INC Palette_Update_Flag
    + u6 L0 J9 a& }: r+ C6 B8 m
  1075. LDA #Palette_Update_Interval% M# K. ^/ _, \: c
  1076. STA Palette_Wait_Cnt/ F1 k1 i0 `0 m; p7 k1 G6 Q8 [; Q" Z
  1077. LDA Palette_Update_Addr! Z8 L5 {8 A3 c  u3 \* N
  1078. CMP #Palette_Update_Max
    6 M3 M$ c4 O( ~- [" U
  1079. BNE Update_Palette_Data_Set9 z* b, ~/ u' A
  1080. LDA #Palette_Update_Min - 1' I  N; H; M/ ?0 ^# u
  1081. STA Palette_Update_Addr
      A5 z, K$ E9 {2 u% ~
  1082. Update_Palette_Data_Set9 n! j6 x4 d. o+ v
  1083. INC Palette_Update_Addr5 p' \/ Q4 J& O* W, y9 `) o
  1084. Update_Palette_Data_End5 y8 z, _# D- T* [2 Z4 Y9 O
  1085. RTS6 [4 x5 e& x2 V3 ]+ I8 I5 q
  1086.   D0 u3 w, b8 S% [0 P% M4 i! G4 M
  1087. ;==============================
    ) ~) _0 D: E, K6 A5 f
  1088. Show_Music_Text;显示静态文本
    $ K: i; W! m/ S9 K! P6 [/ B
  1089. LDX #$00# J3 d: G  _3 G" v5 g. e
  1090. Show_Music_Text_Set, P6 c; M/ a: F* d
  1091. LDA Static_Text_Data,X9 m1 T5 v# Y* a* Y5 ^
  1092. STA Data_L
    # C- [' F4 U# p( l% n0 U5 Q6 p
  1093. INX' @5 l2 Q: s4 u
  1094. LDA Static_Text_Data,X
    0 s# v% F5 V0 y% r# O
  1095. STA Data_H) L* j4 c, s) Y% T( \! r, v
  1096. INX; c5 p/ k' Y$ i, ~2 R" Q2 z) E
  1097. LDY #$00
    9 R! d" n% o% X. l9 V( Z, ^
  1098. LDA [Data_L],Y, a3 A) z5 K" T" H* @
  1099. STA Data_Cnt
    & V! }$ m' B8 a9 |7 v1 [
  1100. DEX/ [' S, `: }# s
  1101. DEX
    ; L: u1 s7 o0 w1 o. J
  1102. LDA Static_Text_Pos,X' \: u9 d/ V  Z! p/ R, c
  1103. STA PPU_ADDRESS0 G4 Z0 v% M/ \& c1 m7 |8 l! g
  1104. INX+ z3 X2 n) Y1 c8 p+ m
  1105. LDA #$20
    6 f( v0 d9 x) b! n) Z) ^- e4 w
  1106. SEC, i' F) q8 ^8 `& T$ X1 `
  1107. SBC Data_Cnt
    1 A* i: U5 F' A' D" l. p* F( u
  1108. LSR A. X3 w9 b2 A+ h& [# \
  1109. STA Data_Buf2 _$ E2 B+ f  N6 o( |! x
  1110. LDA Static_Text_Pos,X
    + R4 m+ t! H: u4 U* a) W
  1111. AND #$E0
    ! }5 i7 R- t- [& C( k
  1112. CLC
    3 q9 K6 O4 g9 ]( b* j
  1113. ADC Data_Buf
    3 ~( A$ a, g' g3 g  M, q% F, G
  1114. STA PPU_ADDRESS
    ' _8 t% j1 Q, R' v, b" E) r
  1115. INX
    2 e4 n) Z! y( Z# l: k
  1116. Show_Music_Text_Set_Write
    5 i! m$ j9 g# U& n; s! @7 |
  1117. INY
    - ?# ?8 f- m% P& ?* T
  1118. LDA [Data_L],Y7 u6 r9 L  G% _$ }8 D4 L# A& T
  1119. STA PPU_DATA# S* c7 F* A% \
  1120. DEC Data_Cnt
    3 D; X5 g3 e4 F/ V( D$ `9 F
  1121. BNE Show_Music_Text_Set_Write
    ) L& b* E0 L! z
  1122. CPX #Static_Text_Pos_End - Static_Text_Pos# M$ M9 ~6 z  E$ W) Y( x
  1123. BCC Show_Music_Text_Set) e& W( x/ z! i, @! R9 g1 q9 K! B: E
  1124. RTS! m! X( N1 {7 K" R) y$ T' K- M
  1125. ! Y: n6 i1 A6 c/ [1 ]: _3 f; O
  1126. ;==============================1 n0 k" E9 G- @
  1127. .IF Track_Name_Pos;显示曲目信息, I' j" o3 ~3 d- u! H
  1128. Show_Track_Info
    1 h, H7 f9 [' z( e8 a& L
  1129. INC Show_Track_Name
    * U3 ]0 [) D  x/ W, J. e1 y- H
  1130. Show_Track_Info_Clear
    " U' R* k5 `* @# P7 k
  1131. LDX PPU_Cur9 o/ K4 U2 E2 s, s! b
  1132. LDA #Mode_Clear
    6 j+ U2 O: J# _' q
  1133. STA PPU_Addr,X& n7 Q# w  |6 G/ F+ n4 N, Q0 |
  1134. INX2 L, v% J0 q4 T
  1135. " w2 A7 @  K  |+ }: |
  1136. LDA Music_Last
    2 V- T5 s" \5 I
  1137. JSR Show_Get_Track_Name_Center_Pos
    2 {+ w8 H4 y9 H" z
  1138. Show_Track_Info_Write_Cur
    ) [4 }; h+ c# F' v( ~" C
  1139. LDA #Mode_CntLine
    0 Z0 D# A- i# J, C9 j' Q# u
  1140. STA PPU_Addr,X
    6 t& J! x8 }7 U( K' g/ Y, A8 c
  1141. INX  \! U- W6 N! r

  1142. . W8 F/ M) N# T7 M$ ?
  1143. LDA Music_Cur
    # T/ g; I% J8 Y% d0 E1 _2 G0 v
  1144. JSR Show_Get_Track_Name_Center_Pos; v$ p. w3 B# J+ V+ v' \5 Y

  1145. ) F5 L" S3 f3 e1 ]) |/ z& \
  1146. Show_Track_Info_Write_Cur_Data; z# a& ?9 J1 T( {3 C$ m/ |
  1147. INY
    # k6 z6 C7 {' o  [
  1148. LDA [Data_L],Y
    ; H% X* a2 o8 u  m$ e' W
  1149. STA PPU_Addr,X0 q3 D+ y7 Q3 m5 s0 d8 e
  1150. INX
    ( q4 }+ j) o7 Q
  1151. DEC Data_Cnt
    4 L6 N9 E+ E/ X
  1152. BNE Show_Track_Info_Write_Cur_Data
    5 g6 ?+ s1 E- W& A7 O" ~4 d. E* _/ g! U
  1153. Show_Track_Info_End3 v( |0 H4 R: o. L
  1154. STX PPU_Cur$ z/ {3 {/ ~/ B8 _3 J  Q1 w; ?
  1155. RTS
    ( ?* P6 m5 m  m) |' D
  1156. ! W9 G9 `' D3 v' d
  1157. ;==============================
    , M0 X! w1 }; |3 H: s6 t. g& W
  1158. Show_Get_Track_Name_Center_Pos;获取中间位置
    ( ?1 Z4 d- n5 r
  1159. ASL A
    * }1 E6 f% k+ Q: L
  1160. TAY
    & u/ p3 t7 }$ m7 L( ]
  1161. LDA Track_Name_Addr,Y3 w/ X2 _! r. ~! k. K9 d* U+ h
  1162. STA Data_L
    & B) i( c/ Y+ f. s
  1163. INY
    # u' ?$ r9 Q; U- q/ ]. U
  1164. LDA Track_Name_Addr,Y8 N# O$ D# v3 |$ u$ S5 x
  1165. STA Data_H
    5 O4 x) Z+ A: Y0 E3 E8 E8 X
  1166. LDY #$00
    9 c+ n) }  }6 z* G. T% T, y: t
  1167. LDA [Data_L],Y( o! u6 h- \! {2 L
  1168. STA Data_Cnt0 s" Q& [. j  `- k9 v
  1169. LDA #$20
    + J" k) ~. g0 q6 D# }* c4 X0 ]
  1170. SEC
    8 r& A$ W) G1 C5 F
  1171. SBC Data_Cnt. V" {" X( \" @* `* R
  1172. LSR A
    ' v5 P4 x  }6 t& L8 {
  1173. STA Data_Buf2 [3 L1 V6 s- `' o
  1174. LDA #HIGH(Track_Name_Pos)6 u4 B! _& {6 j  O5 |$ C
  1175. STA PPU_Addr,X/ Y4 K2 z3 {/ h  W3 s  u
  1176. INX$ q/ O. j3 L5 H  `  R
  1177. LDA #LOW(Track_Name_Pos)* d" [9 [* z1 Y: K' N/ }6 ^* o
  1178. AND #$E0
    : @' D; z. `, g
  1179. CLC1 A* Q6 s; L0 {. Y  A
  1180. ADC Data_Buf
    ' ^; I. q9 f$ e% T/ |9 [' n  e
  1181. STA PPU_Addr,X4 x+ l  W3 r6 z; f: g* R  g
  1182. INX' x1 e' e+ y/ o# V! Q
  1183. LDA Data_Cnt
    + j* x& m/ D% G) s9 b* z7 H
  1184. STA PPU_Addr,X+ ?7 m0 K% T- Z* c
  1185. INX
    * M' n2 d6 R7 W- ]
  1186. Show_Get_Pos_Center_End
    , ~4 i! b: [2 Z
  1187. RTS4 o1 W1 }. s9 A
  1188. .ENDIF$ y+ X0 A' Z& H& ~! n

  1189.   A: `5 ~4 k! H+ i- H+ D2 ~: a. P
  1190. ;------------------------------1 {" }. I* c! G+ A# Z
  1191. ;命名表数据
    % v' n! b" P  v* c: R+ `3 i: v$ r
  1192. Palette_Attributes
    3 @  ]% P  o+ o3 l2 X% a" S
  1193. .IF SOUND_BAR_SHOW_ENABLE% T( @9 y* C: [1 ~" u6 h
  1194. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00( H+ W* `. s- D. u- S2 N
  1195. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$BB,$AA,$AA,$AA+ X0 R& ?" U3 J* `
  1196. .DB $0F,$0F,$0F,$0F,$0B,$0A,$0A,$0A,$55,$55,$55,$55,$55,$55,$55,$55
    7 ?6 E5 z: b) k: }/ V  `
  1197. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55' }5 f2 t# \) R0 r8 \( W8 F
  1198. .ELSE5 F( ^3 T  c, f  v
  1199. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
    ; T9 F+ e; x( X0 Y; n
  1200. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; L4 X: ?! u# M1 \2 z
  1201. .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$55,$55,$55,$55,$55,$55,$55,$55
    # G$ w' P% c9 P
  1202. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
    3 `3 h6 c- h( Q1 L( r7 q
  1203. .ENDIF( I, K- A1 h% L/ P) q

  1204. 4 Z8 m( C  m( w0 }% n$ _6 p4 x
  1205. ;------------------------------4 u1 J  S/ g- G4 V3 T7 s
  1206. ;调色板数据
    0 Z3 z% J& a8 v9 L7 A
  1207. Palette_Data. c. g6 n" f! p
  1208. .DB $0F,$27,$20,$0F,$0F,$24,$20,$0F,$0F,$21,$20,$0F,$0F,$25,$20,$0F
    ( a3 \# d. Y+ {7 s* ?
  1209. .DB $0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F4 T1 i! e9 z: f7 ^$ ]9 s
  1210. ' n, @, I3 T5 p2 [5 c! |
  1211. ;------------------------------
    , s2 b) r* F; l- |! N* p
  1212. Static_Text_Data9 Q2 [* [" T% W# O6 e& b& k
  1213. .WORD Static_Text_Title_Data
    : H+ x- {! ?7 A- n. l& g- G
  1214. .WORD Static_Text_Author_Data
    : z* k* A" \7 B: U4 l+ x1 A$ J
  1215. .WORD Static_Text_Date_Data
    " K% y2 I- U; [# ]( ?" \5 m" A# g( G
  1216. Static_Text_Data_End! w' t0 ?' r# H  g* [1 l
  1217. ! }- o. _3 n4 ?, {. z* ]
  1218. ;------------------------------
    0 I4 {1 Q- l2 }1 ?
  1219. Static_Text_Pos
    ' R! Q# M8 e; q* M
  1220. .DB HIGH(Title_Text_Pos),LOW(Title_Text_Pos)
    0 r( g0 O5 o3 T1 e' h
  1221. .DB HIGH(Author_Info_Pos),LOW(Author_Info_Pos)' q! {" m* F' ?& x$ w
  1222. .DB HIGH(Date_Info_Pos),LOW(Date_Info_Pos)( ~% [2 Y- a& h* g# p! I
  1223. Static_Text_Pos_End
    9 @+ [8 @5 l, _0 z1 ?

  1224. 8 X. ~$ P& Y& j+ c
  1225. ;------------------------------  r3 a, ?  V$ ?$ @3 R  @
  1226. Music_State_Stop9 H+ z. L1 F) h, M1 F( }2 [
  1227. .IF SOUND_BAR_SHOW_ENABLE- K4 t/ g0 g+ j; p, I/ P
  1228. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"STOPED ",$FF,$008 @/ J4 O0 |1 t) |# f9 B: W4 ?9 y7 V
  1229. ELSE/ \  A, a6 D/ @# ^1 R* K
  1230. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos)," STOPED",$FF,$00
    " W4 G. s2 M- K9 e4 c; Z0 H5 ^4 U
  1231. .ENDIF
    : g/ ~0 e$ P+ X. C9 f9 B) m9 S# K) V/ {) `
  1232. Music_State_Play6 @( @# I$ w& i
  1233. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"PLAYING",$FF,$00% M7 U3 x( x6 {% s) U
  1234. ) {8 k% ?6 A6 K/ X1 L
  1235. ;------------------------------9 @* i- d! b  {) a! R
  1236. Sound_Bar_Text_Data;声音类型文本
    ( _" l: n# z2 x! z0 w4 S  L
  1237. .DB $FD,HIGH(Sound_Track_Pos),LOW(Sound_Track_Pos)6 J) k& G9 ^, ^: O) r* T7 f( b3 E
  1238. .DB "SQ1-",$FF
    / R. Z" n5 t) G+ V- \$ m% Q6 m
  1239. .DB $FE,"SQ2-",$FF
    & S" R7 t7 E+ t$ p8 u; V0 S  z
  1240. .DB $FE,"TRI-",$FF
    % b. J6 x3 U# g/ D$ [6 f
  1241. .DB $FE,"NOI-",$FF
    2 y9 M- |: k0 R* p7 C% r
  1242. .DB $FE,"DMC-",$FF,$00
    ( i& V+ f( Q! G% R: r, s1 F

  1243.   k' U+ g, r# P$ Q2 C6 [, @
  1244. .IF Track_Name_Pos5 ]) [. w: |) y! F$ X
  1245. ;------------------------------' {+ f/ N1 K/ B6 b3 @4 I/ T
  1246. Track_Name_Addr;曲目名地址索引
    7 S' a! _8 P/ l
  1247. .WORD Trackr_01
    % `0 C+ @1 M& N
  1248. .WORD Trackr_02
    ! F+ m) j6 N- `% V  y/ K6 E
  1249. .WORD Trackr_03
    8 S( B1 ~5 K% b: }" C2 H
  1250. .WORD Trackr_04" j& o5 `9 c( U& ^
  1251. .WORD Trackr_05
    ( S+ W/ L4 r; U3 f$ m/ Q" j
  1252. .WORD Trackr_06
    * m% V/ U% D) @% i
  1253. .WORD Trackr_07
    $ \1 d8 `, l' D
  1254. .WORD Trackr_08
    % L9 f! C! q" |- u  Z3 W- b
  1255. .WORD Trackr_09" L1 I7 `. I6 m
  1256. .WORD Trackr_10" D9 @4 o; [8 Z8 P5 p* F4 ]; H3 I7 J
  1257. .WORD Trackr_11
    # ?3 D* `7 b: L1 l+ g; ^) ~
  1258. .WORD Trackr_12
    1 _) M& G6 X  _  Q6 n8 j
  1259. .WORD Trackr_13  |' ~7 L3 M. g+ k  ~4 K6 t
  1260. .WORD Trackr_14
    + u5 u8 T+ ?- k# Q
  1261. .WORD Trackr_157 W1 I9 z3 B% D9 r/ M
  1262. .WORD Trackr_16
    - }8 G, a5 q; r. @  s7 l
  1263. .WORD Trackr_175 ^. M) a5 w7 Y1 B; z# J
  1264. .WORD Trackr_18
    * L% C; _3 v: x
  1265. .WORD Trackr_19
    9 H1 ?4 v# e+ j+ m8 n
  1266. .WORD Trackr_20
    ' I0 [0 z  O% w( b
  1267. .WORD Trackr_21. W; \! k# [+ |5 `3 u
  1268. .WORD Trackr_22
    5 s! o$ i, G& ?; @9 D
  1269. .WORD Trackr_23
    5 l& Z" m* Y  V  Q# c9 u! g
  1270. .WORD Trackr_243 h( l8 f" t1 x* u9 _
  1271. .WORD Trackr_25$ X$ O1 H7 N" R0 f0 _
  1272. .WORD Trackr_26
    3 {! `' M$ O+ I, L* F6 t1 h
  1273. .WORD Trackr_27
    ) z% i6 k: ~3 {
  1274. .WORD Trackr_28! M1 L6 i8 i# U" ^/ o9 m& t+ M
  1275. .WORD Trackr_29
    + b8 j. }+ r, h: M0 _
  1276. .WORD Trackr_30
    6 Z0 ^0 q7 x& E$ n& r3 G
  1277. .WORD Trackr_31
    9 Z( X2 |3 q" d. y/ b$ @
  1278. .WORD Trackr_32
    # p7 u) n4 h! {- G% f
  1279. .WORD Trackr_33
    7 J' h/ k. G/ R) Z# h) b, F8 G
  1280. .WORD Trackr_34
    - Y( V5 N/ h8 C, a. s0 F6 f# G" @/ j
  1281. .WORD Trackr_35% }' Y5 M+ b0 i- c+ l- l1 H1 i
  1282. .WORD Trackr_36
    & \- P+ r7 K% n! Y( t* P$ |6 [% m- s
  1283. .WORD Trackr_37
    - p7 m1 S/ S; }! p" D% N
  1284. .WORD Trackr_38" J# q" I3 M% n  Q- |% o" U) f/ H
  1285. .WORD Trackr_39
    8 P" h) V  O8 i; n' [1 v; H+ l
  1286. 8 Z: `6 I- q) h
  1287. ;------------------------------5 Z% K0 }/ O/ g! t0 m1 v
  1288. Trackr_Name_Data! N/ V: g% j; c8 o2 p
  1289. Trackr_01 .DB $05,"BGM 1"' C9 c: `) R  s+ J
  1290. Trackr_02 .DB $05,"BGM 2"9 j4 V$ \; r* A, S5 d* h: u
  1291. Trackr_03 .DB $05,"BGM 3"
    9 _- s: @- O2 y  x" i8 y/ s9 r
  1292. Trackr_04 .DB $05,"BGM 4"
    8 \+ X( s' Q2 I7 q
  1293. Trackr_05 .DB $05,"BGM 5"# C  ^1 D5 y# g4 V
  1294. Trackr_06 .DB $05,"BGM 6") t" [9 a; e( U2 \$ i2 t# e
  1295. Trackr_07 .DB $05,"BGM 7"
    $ ?. ~; d, r1 S8 M# B7 }: X! U( a0 B
  1296. Trackr_08 .DB $05,"GREAT"7 o" M% S3 s) w5 R& f& D9 @2 W, f
  1297. Trackr_09 .DB $08,"BOSS BOM"$ e% b/ K. q* m! P8 h9 G
  1298. Trackr_10 .DB $08,"BOSS2BGM"
    * H: O  l1 f6 _* i, b, d9 m
  1299. Trackr_11 .DB $07,"P CLEAR"9 n0 r4 e) X, H4 R
  1300. Trackr_12 .DB $07,"A CLEAR"
    7 a- q7 x2 \2 ]
  1301. Trackr_13 .DB $04,"OVER"
    9 L( P" f/ R- q6 p0 d! [
  1302. Trackr_14 .DB $06,"ENDING"
    * X  @* E$ C7 a! k0 A! I/ ^9 A" h
  1303. Trackr_15 .DB $04,"SUTA"  o7 P/ ?! n+ d- M( K! h" R( W
  1304. Trackr_16 .DB $07,"THUNDER"* ~, A+ r) x, H4 x8 \% L
  1305. Trackr_17 .DB $04,"SHOT"5 j# |9 f, }/ c% i; i8 j
  1306. Trackr_18 .DB $05,"LASER"
    3 g# @# ^( q6 N; p; G) ^
  1307. Trackr_19 .DB $06,"SPREAD"
    - }6 U- s- b: I- t; @- n
  1308. Trackr_20 .DB $04,"FIRE"
    : `. |& ^+ L% Y
  1309. Trackr_21 .DB $06,"B SHOT"
    0 O% d, b- p4 Y
  1310. Trackr_22 .DB $08,"T DAMEGE"
    + k6 Y/ g% l" m
  1311. Trackr_23 .DB $07,"HARETSU"
    ( t0 T/ S7 f) c9 h- i7 _# [
  1312. Trackr_24 .DB $05,"T OUT"
    , j  x* [' r6 O
  1313. Trackr_25 .DB $05,"Z OUT"1 K: n8 C$ k( D' T0 [
  1314. Trackr_26 .DB $05,"A OUT"+ i( L; }2 t; T" X1 S0 Q6 g- E
  1315. Trackr_27 .DB $04,"ROLL"
    ' y/ {1 l1 R7 r& X2 X$ }4 ~# }. b
  1316. Trackr_28 .DB $06,"APPEAR"( W9 D3 U8 T. t1 l5 n
  1317. Trackr_29 .DB $05,"POWER". q* `! @! X& t# ?8 T, I3 L
  1318. Trackr_30 .DB $07,"BOKK BK"
    ( K- ?- c. b/ d! G
  1319. Trackr_31 .DB $08,"BAKUHA 1"
    5 h+ y/ A9 w/ O( P
  1320. Trackr_32 .DB $08,"BAKUHA 2"
    ! J* c) F1 d3 K. j) b, @
  1321. Trackr_33 .DB $05,"ARUKU"
    ) G8 v9 b. X/ ^. N9 v! \$ j3 X
  1322. Trackr_34 .DB $06,"JIWARE"( B8 n* y' k  [" ?( e+ x' K
  1323. Trackr_35 .DB $05,"SILEN"  D' |& }; E' O! \; y. X# t6 K. \
  1324. Trackr_36 .DB $05,"P 1UP"' j! m+ W: `, m/ h$ n: g- A
  1325. Trackr_37 .DB $05,"P OUT"
    , b, Z. I; ?+ Y% S. S7 \4 h
  1326. Trackr_38 .DB $05,"B OUT"  l' W% ?/ ~6 `: [) ^
  1327. Trackr_39 .DB $05,"PAUSE"
    + H7 G; p/ [) c
  1328. ; o& ?. l& {! F0 I' Z9 W
  1329. .ENDIF* ?) l6 ]6 D1 L; t1 P1 o; _- p
  1330. : R& V, ]0 u; s" W6 w! X
  1331. ;------------------------------9 x2 P. ]2 r/ z8 m( d& @# X: D! K
  1332. Static_Text_Title_Data;静态文本数据
    8 J* l5 X  C6 R1 i3 Q' y8 L3 v# e9 D. M
  1333. .DB 12
    3 D, `0 H' x0 W* p( V
  1334. .DB "SUPER CONTRA"
    ' v6 d1 B9 ~3 m' b' O# a2 S  E
  1335. Static_Text_Author_Data2 \2 q5 a7 S& j2 L
  1336. .DB 23% {& P9 [; e& S4 `2 @
  1337. .DB "EXTRACT BY FLAMECYCLONE"+ K( m0 ~( b! t( \" |) M. N4 y2 L
  1338. Static_Text_Date_Data
    ) X, }! c8 V0 }( u5 e7 J
  1339. .DB 10
    ; \; |7 K3 F) s' Q6 V) I& A! A
  1340. .DB "2023.07.11"" n4 ?2 v- _9 a/ c& [
  1341. ! f  T3 s7 G& Y' x2 M
  1342. .BANK RESET_BANK & BANK_DATA_MASK
    4 i8 }. R* M. Y9 ]
  1343. .ORG RESET_ADDR' l4 J1 w- g3 g$ z

  1344.   o0 P/ O) S& J6 ~0 q
  1345. 3 P. Y* b% Y1 Q. V) s& }/ V) L
  1346. ;==================================================
    3 W% J$ t* @/ I  t
  1347. ;切到主程序bank6 v! |, @8 o1 g
  1348. SwitchMainBank
    9 a' \# Q8 Z+ K0 R0 i4 e( u
  1349. LDA #PROGRAM_BANK & BANK_DATA_MASK
    : G0 ]9 B0 C4 J' _: D" @
  1350. JSR SwitchBank8000  t) j, ^- q1 t4 v
  1351. RTS: B0 j% F. j4 g( f/ W3 @6 @

  1352.   T  t7 _0 Z  N5 H& P3 @
  1353. ;==================================================
    $ M8 d/ d+ k4 r1 @. c9 O7 s0 t
  1354. SwitchBank8000;切换bank到8000-9FFF8 m* w8 J2 l" }1 R% _
  1355. PHA
    & ?5 ]5 `" g& ]& C4 Q- k# z
  1356. LDA #$06
    8 }) Q' D% d5 `# `! X- m
  1357. STA MMC3_BANK_CTRL+ V$ w; |2 h# f, r+ K9 P
  1358. PLA
    ) |" @8 v; C: N8 }
  1359. STA MMC3_BANK_DATA
    & T' O' j( M+ Y# K3 d5 _$ A
  1360. RTS2 B/ T3 r0 ?7 X0 A. f0 G

  1361. , u% n9 F! U: n3 W/ v2 ~/ B/ ?
  1362. ;==================================================8 Q  e# f$ C/ y
  1363. SwitchBankA000;切换bank到A000-BFFF/ F$ c. q8 H9 z. n& n( I
  1364. PHA5 |8 I  y5 \" S
  1365. LDA #$07
    ; E+ [+ j: j' R* F) S! {# c6 @! W2 r
  1366. STA MMC3_BANK_CTRL+ D, S5 n3 r) @8 X/ U' ?
  1367. PLA
    + E. X- y# o' l! D2 k
  1368. STA MMC3_BANK_DATA7 i; ^: u1 b" b5 J
  1369. RTS
    ; w! ^( A7 O5 [, O4 T. X3 b- Z

  1370. 5 w1 Q7 H4 D2 K- @8 N7 s0 T! m
  1371. ;==================================================6 y, n* U$ O; h9 b2 m: K6 B' ]6 y
  1372. Sund_Bank_Init;音乐bamk初始化/ `) \; l  E  A% j
  1373. LDA #SOUND_DATA_BANK_0 & BANK_DATA_MASK3 U7 R; z7 D; z  x8 N
  1374. STA Music_Bank_80001 x  ~0 O  U9 h$ i, I
  1375. LDA #SOUND_DATA_BANK_1 & BANK_DATA_MASK4 I6 E- v- u8 D. E. Q) E
  1376. STA Music_Bank_A000
    : B) g. m0 }/ O2 {9 L8 e; Z  V
  1377. RTS4 t1 U7 n/ `& Q& n( f! W2 B

  1378. + L; L% c  z0 z5 n
  1379. ;==================================================# Y' M4 o& u' R
  1380. Sund_Bank_Set;切换音乐bank
    " d; f3 M1 w8 {/ j  `3 {
  1381. LDA Music_Bank_8000
    , Y# S0 x: G8 H& p) `! |
  1382. JSR SwitchBank8000
    , {7 X' e  v$ o+ D$ M
  1383. LDA Music_Bank_A000
    # z& c: q$ M5 ^, |- K
  1384. JSR SwitchBankA000% H, N$ ^. x8 t. ?7 @! f& e
  1385. RTS0 Z$ O! e" _; ~8 {3 n
  1386. / K1 g# O, z" m# W1 }8 y5 l& L& T
  1387. ;==================================================+ i2 [* i: A- \8 B2 i7 U4 K
  1388. Sound_Init;音乐初始化: _7 B) L0 e1 `. a
  1389. PHA" b# @! R, o* |9 u; w
  1390. JSR Sund_Bank_Set
    5 }( W, D2 a# L* [% _, {# G
  1391. PLA
    " i9 ~6 P3 L9 u
  1392. JSR Music_Init_Addr
    ; {! r* F6 Z* H+ u: o' `
  1393. JSR SwitchMainBank
    ( [8 d2 d' {1 E9 q  n
  1394. - J/ U0 Q  e! M+ l* V' X8 A
  1395. JSR Music_Bar_ReSet- x0 z3 j( ]9 z/ g
  1396. JSR Time_ReSet
    - s* X3 E/ J  u# B. k
  1397. LDA #$00
    8 C2 J+ r4 `3 i3 {6 M
  1398. STA Music_State  u# B* I, N; Q
  1399. JSR Music_Stata_Show; l# C# k3 f( @( w; c$ J
  1400. .IF Track_Name_Pos
    , ^9 l. l/ m) ^/ F) q9 p
  1401. JSR Show_Track_Info
    5 i. v2 x% c& C
  1402. .ENDIF
    , j! [) L4 e" `

  1403. ) O6 j& x& }2 H5 Z
  1404. RTS( O/ L& ^. b; |1 b% [

  1405. - t1 }2 \0 \7 P% ?1 }: B
  1406. ;==================================================: A- a4 f5 V$ ?+ L) U: h6 {0 k
  1407. Sound_Play;音乐播放
    : \% e0 \2 H% U8 `8 o9 G* A
  1408. PHA
    8 g  w& N* `" b9 [/ ]4 r
  1409. JSR Sund_Bank_Set
      L- F( r- F4 n
  1410. PLA2 ?- t9 n* D  O$ m2 p; N3 E
  1411. LDA Music_State- z. i$ E/ ]$ T& Y5 ~
  1412. BNE Sound_Play_End
    6 {* ^, D6 z. G/ s$ l2 x2 ~) i
  1413. JSR Music_Play_Addr. D$ l) g) O5 B5 k0 q# r
  1414. Sound_Play_End
    % B2 v+ ~, t: \; V* q6 H$ v( |
  1415. JSR SwitchMainBank+ V. D/ n4 {7 S% G. m/ ~8 W
  1416. RTS
    ! S9 V" {0 Q" ^6 [

  1417. % n7 a1 c; [2 m) l
  1418. ;==================================================8 h8 \8 h5 t# a, w& S; R
  1419. .IF Music_Reset_Addr0 g' N- X/ b0 T. j! W
  1420. Sound_Reset;音乐重设(如果有的话)
    0 E# N/ R& L, m
  1421. JSR Sund_Bank_Set4 o5 L7 n8 ]3 M5 K* |
  1422. JSR Music_Reset_Addr) F3 }; [- l/ l: A% q* S4 q* P
  1423. JSR SwitchMainBank
    2 M- ]% e4 C+ O# b0 A% A
  1424. RTS4 s& L# p8 C; G+ U& h: D
  1425. .ENDIF. C. }/ Y$ c' V: |! b

  1426. % |* R# O, }+ ?. J3 J. }% U* @
  1427. ;==================================================
    5 U; k8 O7 I  F8 K
  1428. MainLoop;死循环
    * F2 @6 J7 R; h$ o  W! [
  1429. JMP MainLoop. v' V+ B- ~: ]# R1 d1 `

  1430. + ?  q/ G0 M& A4 J* q
  1431. ;==================================================
    + M3 w2 l; c' m) N8 l' U" ?$ A5 U
  1432. NmiProgram;Nmi中断处理0 z6 Z# z( C7 U, `
  1433. PHA
    6 S! F2 J( \5 p4 ~( i" z' Q
  1434. TXA
    $ x# L6 u& V: K8 D# |. a# y
  1435. PHA2 {# J5 @( o# o" s3 H* z% N( j
  1436. TYA
    9 b* s' ?8 `, ~# a
  1437. PHA3 R8 i! D2 s/ a" R: k4 u

  1438. / p  }2 v) F" T4 \
  1439. LDA PPU_STATUS
    " G, @- R1 v" G' u
  1440. LDA #$00
    ' D" c- n0 Z5 o2 Q
  1441. STA PPU_CTRL- Y1 U. |" K3 z, t4 c$ d
  1442. % k  ^5 ?$ c) H' Z8 d! |
  1443. ;切换主程序bank/ F7 Y: U8 X# l* y1 e/ @& l
  1444. JSR SwitchMainBank) ~+ c  d& H  v! {+ h
  1445. & A- Z5 \: t' \9 T1 c+ b
  1446. ;NMI处理+ b. m( w* h' b- G2 Y/ z! \
  1447. JSR NmiProgramProcess
    3 T1 \/ ~& }  x% V) d
  1448. ( }! m( d# F% o; E& m% @0 g
  1449. Nmi_Proc_End7 u9 Q7 R# T- q/ ]1 r) C
  1450. PLA
    9 j: A2 o3 u1 S* V7 k6 c1 Q0 z8 D
  1451. TAY9 k; s3 X3 v) @8 `% |$ ]; G
  1452. PLA! p9 j6 u5 \, J# G( X, @. F
  1453. TAX
    5 f- X( p7 a6 k
  1454. PLA+ n3 h! ^1 b1 _- q( V2 r+ D
  1455. 0 }4 E* G$ o+ d( P5 n
  1456. RTI- R1 [6 |, \- K1 P4 n+ |/ i
  1457. ! V" i" D; V9 Y% {* v  c5 Q
  1458. ;==================================================
    ! B! I, r( m6 i0 `& z! p: O
  1459. ResetProgram;重置中断处理
    : A9 u) |4 g' ]& r
  1460. SEI
    ( R* }: h0 Q  z+ @; L$ D: O
  1461. CLD
    1 K# I) Q2 ?+ m. N* L( j! y% h' {
  1462. LDA #$00
    5 Y0 C! n) E& j9 c5 H
  1463. STA PPU_CTRL
    * I. X4 o/ U% ~/ L$ d
  1464. STA PPU_MASK' X* Z- |2 u. e; J3 W' n1 T
  1465. 6 H3 S; n# e' \2 e/ \; n1 f
  1466. JSR SwitchMainBank
    . G/ l+ \9 S6 a2 ^( a
  1467. JMP ProgramBegin( L4 C  v9 S! c
  1468. 7 G6 u/ a2 h' p  ?  t
  1469. ;==================================================
    : b5 F% t) a% n5 B
  1470. IrqProgram;Irq中断处理
    . r0 ]2 v3 D9 r9 i6 E
  1471. RTI
    : V& R7 i- z; w; Z' [0 F3 r9 s

  1472. $ S; v; W" A9 {7 J
  1473. .IF SOUND_BAR_SHOW_ENABLE- O, A4 J, w1 m0 M' [) u
  1474. .ORG $FF80
    ( g8 k  v2 t9 ~3 n: E: b9 O
  1475. STA $4000,X
    5 A1 M/ }6 e$ w/ i0 P
  1476. STA Sound_Bar + $00,X7 v' |4 T8 }5 m/ e1 z5 b( m. o6 a" ~' a
  1477. RTS
    ! {! t- u9 U- Z9 a% o9 `& b  X

  1478. 5 \2 j$ v2 K: q. F8 R5 o! ?
  1479. .ORG $FF88
    ' a2 v; j% c- n- N: H
  1480. STA $4000,Y( e5 g% y6 R8 a/ H
  1481. STA Sound_Bar + $00,Y
    . S' _& }- m! J1 F
  1482. RTS8 Z# F+ |; G$ h. D5 i+ `
  1483. ) C9 v1 V. }# N7 W& F
  1484. .ORG $FF90
    ) a  G6 A* h* P' S2 h. A
  1485. STA $4004,X: M/ u, c- b  k; n, M
  1486. STA Sound_Bar + $04,X9 e- I: ~& }3 ~/ {# Q) I+ {
  1487. RTS
    * s6 g2 U. {4 I+ }
  1488. 1 b  m0 f& p$ u3 _4 j: J
  1489. .ORG $FF98
    # M( B. L: C1 W4 p' R- G9 A
  1490. STA $4004,Y
    " X0 a9 S0 Z0 `3 z+ u. Y
  1491. STA Sound_Bar + $04,Y0 B. s6 M( L7 x( O& v% D% }
  1492. RTS  B6 e0 H* }" N5 s0 P
  1493. 8 ^( y9 O5 F3 g- p* B2 V% J
  1494. .ORG $FFA0$ m6 _2 L' B- U. [: W( |% Q
  1495. STA $4008,X' e( Z3 G" u+ D" M2 M
  1496. STA Sound_Bar + $08,X
    , R. H5 v- y7 {. k1 G1 p
  1497. RTS
    7 T2 X/ d, J$ B- o+ l. A/ G
  1498. - I" P6 H1 ]: U, t/ c6 ?5 _
  1499. .ORG $FFA8
    & k3 R2 v; s+ w, N
  1500. STA $4008,Y7 I2 O' j9 B. R. P3 P1 s& ^8 h
  1501. STA Sound_Bar + $08,Y% w& I1 T/ D8 L- ~. T
  1502. RTS! S* N: ^" i* H' {9 H0 c/ `' [

  1503. 4 @7 b& Y7 l8 G  r2 ?6 A2 J
  1504. .ORG $FFB0
    & m, O, f6 T1 p9 y7 b) o  T
  1505. STA $400C,X" }& O4 U2 F9 H4 s2 T, b( P
  1506. STA Sound_Bar + $0C,X! Y1 A& f  k# L0 m
  1507. RTS6 T5 A5 r2 ^! D$ _9 x4 S
  1508. % p; {: I( e, l( |2 t- h
  1509. .ORG $FFB8
    0 p, z& |+ P# p4 t/ k9 H
  1510. STA $400C,Y
    ' h, p2 r8 A$ g
  1511. STA Sound_Bar + $0C,Y
    , ]1 q4 h' q  @! n
  1512. RTS
    4 I: d, Q' D+ P3 _

  1513. ( e  O& r7 ^/ O+ W* U4 O! D" N6 P
  1514. .ORG $FFC0. U4 p4 d5 c4 e: ?# Q
  1515. STA $4000. y  H9 I6 h1 h$ j, ]* `3 P9 T% O
  1516. STA Sound_Bar + $00
    ) `- s% D! a4 {
  1517. RTS
      y: E0 S. p( I& G

  1518. 6 d5 j6 Z6 @0 b9 |5 ~/ ?) P) ?
  1519. .ORG $FFC8
    . w+ N5 p, _( w: B, O+ F' S3 \
  1520. STA $4004, n( J3 A% ?9 [0 B9 t6 y
  1521. STA Sound_Bar + $04
    2 r) q- s1 i/ |2 d7 X
  1522. RTS
    2 U5 B* K3 F9 H3 _2 p( x, A& O/ G

  1523. & l  s; K1 m1 J+ ?5 w) X
  1524. .ORG $FFD0
    3 P' ~/ z) g8 o" W) J
  1525. STA $4008
    9 C- Q6 ~# ~' g4 T* O5 V
  1526. STA Sound_Bar + $08! P9 x; Z6 N/ [5 X8 ^
  1527. RTS
    3 }4 C3 o2 G8 y* R8 t# A

  1528. ; I" m7 R) J( a* P/ Q
  1529. .ORG $FFD8
    ! {" P4 }8 y. N  P6 }% O# A
  1530. STA $400C
    7 c* v8 `2 \# ~- z4 b7 O
  1531. STA Sound_Bar + $0C
    4 r! I8 {4 y( C! X
  1532. RTS5 }& T1 k7 V- d  Y

  1533. 2 ?" ?! R+ Y2 J* [" E
  1534. .ENDIF9 x1 j/ K) K: \) I0 e
  1535. , n$ g! J( p4 l/ e1 p8 B+ w- h
  1536. .ORG $FFFA* l$ _# e# G, _" ^9 M
  1537. .WORD NmiProgram
    9 F. w. S# i6 L. z# a, E1 J2 [3 P- ~
  1538. .WORD ResetProgram7 n! |0 g. m6 [0 p% {
  1539. .WORD IrqProgram
复制代码
( X/ s8 ~1 d2 U  C

2 I9 W# T5 k; j4 ^. `8 }
游客,如果您要查看本帖隐藏内容请回复

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

评分

1

查看全部评分

签到天数: 1057 天

[LV.10]以坛为家III

发表于 2023-7-13 16:43:54 | 显示全部楼层
很赞啊!
[发帖际遇]: fragranse 在网吧通宵,花了 3 个 柠檬. 幸运榜 / 衰神榜
回复 支持 反对

使用道具 举报

签到天数: 3022 天

[LV.Master]伴坛终老

发表于 2023-8-5 12:44:16 | 显示全部楼层
必须支持
[发帖际遇]: leshui 在网吧通宵,花了 6 个 柠檬. 幸运榜 / 衰神榜
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|国治模拟精品屋 ( 沪ICP备15012945号-1 )

GMT+8, 2024-11-17 00:19 , Processed in 1.085938 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表