EMU618社区

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

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

[复制链接]

签到天数: 39 天

[LV.5]常住居民I

发表于 2023-7-11 19:08:59 | 显示全部楼层 |阅读模式
本帖最后由 yandagui 于 2023-7-11 21:32 编辑 - [8 H' F0 @/ k* w7 V* X
8 f1 i& D5 t2 w6 T& b
1.魂斗罗
$ k3 @/ V" O4 K8 T/ P! X2.超级魂斗罗
! p; a( e& @* O2 p3.赤影战士
/ _% q' A9 ^6 R. h4.忍者龙剑传2) i3 [' [0 h" S$ ~( T

; n& p! ^  W+ X! C1 O0 n; T0 R7 H
. u# w* U  C+ m6 O7 a9 e0 A
; K! P0 p+ ?. e5 ]; k
源码:6 `+ ]0 X0 E# p0 k3 P
  1. ;[FC音乐][播放器模板]0 G, V+ w4 C) v" q- K
  2. ;FlameCyclone 20230710) v! y) E. B5 q* Z. h* ?
  3. % }" U6 r* w$ A3 N6 d
  4. ;文件头& W) ^. k4 k7 _8 J; ]6 e; t
  5. ;======================================================================$ {6 K3 z  Z' u
  6. .INESPRG 4                                              ;16KB PRG 数量
    ; k5 ?' |4 q+ [
  7. .INESCHR 0                                               ;8KB CHR 数量& z! Y# _; m5 t( d- j# `
  8. .INESMAP 4                                                   ;mapper 4
    * A/ D, H' X3 l7 o8 j5 R
  9. .INESMIR 1                                   ;命名表镜像 0水平 1垂直
    " y4 g+ }; {- Y  ]( U' p; u
  10. . H! q8 J, b7 s  ?6 W6 L
  11. ;==================================================
    9 o: D4 d% s+ q& G& f
  12. SOUND_BAR_SHOW_ENABLE       = 1& u& H2 F, z5 G! b' |+ r, d
  13. ;==================================================4 N; M  w! ^! f6 T$ e
  14. BANK_DATA_MASK              = $07! t; I/ L5 l7 k) G7 q0 T/ _$ c
  15. ;==================================================
    " J! W  }4 r4 m7 J" V& F
  16. SOUND_DATA_BANK_0           = $00
    8 M) i0 I+ ]* z  Y
  17. SOUND_DATA_BANK_1           = $01
    . k; {# k8 f5 _* j- m6 D# g
  18. SOUND_DATA_BANK_2           = $02
    3 e7 u3 K3 G" W4 v, P
  19. SOUND_DATA_BANK_C000        = $06
    ; \6 B# w2 ^* B$ V( c0 T0 j. ~
  20. 0 p( m# w6 F2 N5 x- v! r
  21. ;-------------------------------------------------1 i( k1 Z6 f5 g
  22. CHR_DATA_BANK               = $04" w6 p4 q9 L! `8 S% u1 j
  23. CHR_DATA_ADDR               = $A000
    ' s- P- s4 M( H* z* K5 U' g9 ?% Q
  24. ;-------------------------------------------------8 E7 r5 n, M* G  S
  25. PROGRAM_BANK                = $05# j5 V+ K2 X! Y1 Q' W' X' u
  26. PROGRAM_ADDR                = $8000" g' J- r+ s  b" j7 T
  27. ;-------------------------------------------------. \" q4 B- j, Q4 B" _  g
  28. RESET_BANK                  = $07
    / P+ O( j( l$ h7 e8 g% E5 ~: H
  29. RESET_ADDR                  = $FE00
    & o  b9 W, q, V4 h+ w# U
  30. ;==================================================3 Q& @3 e5 Y, W. U* s" c
  31. Music_Init_Addr             = $DFF0 ;音乐初始化地址
    / Z+ Z3 `2 c4 Z, u1 ]* n
  32. Music_Play_Addr             = $813C ;音乐播放地址7 g% [- k) {$ I2 t* n' v* n5 Y( W$ ^
  33. Music_Reset_Addr            = $0000 ;音乐重设数据地址* S( i2 f5 Z' s; R+ o
  34. ;==================================================
    6 ?$ k; p. l1 j8 ~
  35. Music_Song_Total            = 039  ;全部曲目总数) C& A" S5 `) m/ u6 y' f- P9 {
  36. Music_Start_Song            = 007  ;初始播放曲目
    $ N; x- B4 f/ n: c  {, t0 I
  37. ;==================================================) U% J& W9 M* K. i( W0 G
  38. 4 o; x  N7 f/ J9 ^# g
  39. ;==================================================
    # k9 b5 O* [* I
  40. Title_Text_Pos      = $210D ;标题文本位置3 M/ p7 H8 X; ^6 F
  41. Author_Info_Pos     = $2284 ;作者文本位置
    . }5 S1 z6 {$ P
  42. Date_Info_Pos       = $22CB ;日期文本位置
    7 E& t) H7 N8 a8 e
  43. ;------------------------------1 ]0 A( _  @; q7 L8 y
  44. ;------------------------------
    2 z2 C! B! L% ~" w  a+ Q- y0 @
  45. .IF SOUND_BAR_SHOW_ENABLE  O3 A8 j  J% }4 y+ S
  46. Play_Index_Pos      = $21B3 ;当前曲目位置
    2 J& \, ~& o+ R) E8 L- Z$ z
  47. Play_Time_Pos       = $21F3 ;播放时间位置: f8 |6 x# `" D# S* L  Y% p- B
  48. Play_State_Pos      = $2233 ;播放状态位置
    # h3 o0 g& X; @' c4 |
  49. .ELSE6 N' K7 Z& e9 F5 J

  50. . T7 C/ s1 p7 G& J6 t, E
  51. .IF Music_Song_Total > 99
    0 |" j/ L/ h5 W; l6 X/ c
  52. Play_Index_Pos      = $21AC ;当前曲目位置: R( k8 V5 Q; z3 O  M9 T
  53. .ELSE% p) A6 ?# T2 Q0 x- ]
  54. ( C' G) I0 ^& ]$ Z  W& O# O
  55. .IF Music_Song_Total > 9
    6 V; u2 O5 u1 \
  56. Play_Index_Pos      = $21AD ;当前曲目位置" I& N7 D" d6 E# T& I) e: O7 a. w! g/ I
  57. .ELSE
    . F5 [% l  S3 l% k
  58. Play_Index_Pos      = $21AE ;当前曲目位置6 X7 }) a8 X3 Y/ o" a/ S  o5 m# i
  59. .ENDIF
    7 e; D- h  X1 g3 l- F4 v

  60. * S- r" _6 N0 H3 n
  61. .ENDIF
    * o4 i% K+ V8 N/ R! P) s# R

  62. , q/ f+ t3 M% `* h: k
  63. 9 H, E/ F8 z7 J
  64. Play_Time_Pos       = $21EC ;播放时间位置0 M9 U, U8 N) y8 v8 I1 Y
  65. Play_State_Pos      = $222C ;播放状态位置  k8 y9 C6 a+ I; n. r" |) C
  66. .ENDIF
    1 a: i! v0 N, }4 [% Q0 x- K9 k
  67. ;------------------------------
    " p# B3 j" N4 l. c' c; z
  68. Track_Name_Pos      = $216B ;曲目文本位置; t0 E- J% i! c' O" Z
  69. Sound_Track_Pos     = $21A5 ;声道文本位置
    8 J. c7 D  e# u3 H4 J
  70. Sound_Bar_Pos       = $21A9 ;音乐条位置
    ! w; ~7 o2 }* [  T/ D
  71. ;==================================================- a/ m( R! w6 w4 t8 g
  72. Scroll_X = $00
    : @6 {3 a9 k& k+ N3 E4 ?. R
  73. Scroll_Y = $061 `- p6 r7 t6 \+ C
  74. ;==================================================
    . W2 k/ l$ D' [6 |4 o
  75. RAM_Cln_1       = $01006 d$ n2 {8 R; R* o4 X9 F
  76. RAM_Cln_1_Size  = $809 @1 o+ o8 u1 g% u7 D
  77. RAM_Cln_2       = $00E0
    4 i: N" [: ]. |4 v: r: s4 P2 [8 u
  78. RAM_Cln_2_Size  = $203 W+ g3 |1 g5 i7 V* S$ P
  79. RAM_Cln_3       = $00E0# x+ S. E) @* f! j% T/ x5 p$ e, h0 p
  80. RAM_Cln_3_Size  = $20
    ) @/ G# l3 l" h
  81. * B: q1 x- L7 W& _3 K
  82. ;==================================================6 C+ ?4 T9 J! N' e5 e, O4 {# T
  83. PPU_CTRL                =   $2000   ;PPU控制寄存器, k! g! ]9 u+ f6 B- ^% Q* p
  84. PPU_MASK                =   $2001   ;PPU掩码寄存器
    " u1 D* J. ^0 m1 I( [. {9 M
  85. PPU_STATUS              =   $2002   ;PPU状态寄存器:读取后PPU_SCROLL和PPU_ADDRESS被复位,下一个写到PPU_SCROLL的数据是水平的,写到PPU_ADDRESS的数据是高位
    & W9 E3 T' m/ n* k* D; E  K
  86. PPU_OAM_ADDR            =   $2003   ;精灵RAM地址:用来设置通过PPU_OAM_DATA访问的256字节精灵RAM地址。每次访问PPU_OAM_DATA后该地址增加1- Y+ [" Z: a/ k
  87. PPU_OAM_DATA            =   $2004   ;精灵RAM数据:用来读/写精灵内存。地址通过PPU_OAM_ADDR来设置,每次访问后地址增加1
    * {: p) ~- j9 B. C8 f
  88. PPU_SCROLL              =   $2005   ;屏幕滚动偏移:第一个写的值会进入垂直滚动寄存器(若>239,被忽略)。第二个值出现在水平滚动寄存器
    ) s; f! T& @1 h/ V4 V/ [
  89. PPU_ADDRESS             =   $2006   ;VRAM地址:设置PPU_DATA访问的VRAM地址。第一个写地址的高6位。第二个写低8位。每次访问PPU_DATA后地址增加
    & V  ~2 q+ d: y4 Y6 h
  90. PPU_DATA                =   $2007   ;VRAM数据:用来访问VRAM数据,通过PPU_ADDRESS设置的地址在每次访问之后会增加1或32
    ) Y; O, d5 ^6 r, L8 a6 I8 z
  91. OAM_DMA                 =   $4014   ;DMA访问精灵RAM:通过写一个值xx到这个端口,引起CPU内存地址为$xx00-$xxFF的区域传送到精灵内存
    * ^2 O! ]# d. u6 O# |
  92. APU_STATUS              =   $4015   ;声音通道切换" F' N& ]) D- y, G; f
  93. JOY1_FRAME              =   $4016   ;手柄1 + 选通
    ' Q9 _. }0 h0 r5 H
  94. JOY2_FRAME              =   $4017   ;手柄2 + 选通
    8 \( \* a" l/ i5 B, w
  95. ;==================================================# P- _  q  u4 I2 d- ?# Z% Y
  96. MMC3_BANK_CTRL          =   $8000) K! N8 T- o* ]7 R7 N* b9 V7 B0 b) n
  97. MMC3_BANK_DATA          =   $80011 C5 s! v- ~$ V6 |. W# g1 @
  98. MMC3_MIRRORING          =   $A0000 d+ D0 k! b, v9 ~! y
  99. MMC3_PRG_RAM_PROTECT    =   $A001
    : o# ^/ ]6 I- W) S  f2 g
  100. MMC3_IRQ_LATCH          =   $C000
    6 i, Y( \7 B7 [7 l% B& Z
  101. MMC3_IRQ_RELOAD         =   $C001+ F3 W8 q) h. V% m7 M+ K9 O
  102. MMC3_IRQ_DISABLE        =   $E000* v0 u6 l6 \6 O7 x3 n' ]
  103. MMC3_IRQ_ENABLE         =   $E001  [9 R' F+ m( j. }! W& F
  104. 9 k5 [4 E1 u2 ^5 m. {
  105. ;音乐数据块: M/ v# A! N. S) J2 T9 l
  106. 7 d3 k' V& q/ h8 t
  107. ;======================================================================, Q/ A: Z& M+ u+ p
  108. .IF SOUND_BAR_SHOW_ENABLE8 ?. X6 x" f3 k: v+ [
  109. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK2 G5 ]: v7 Y  L" j! B+ |! a" F
  110. .INCBIN "sound_bank_bar/music_data_0.bank"5 d& p" K, t1 d
  111. 3 N; [: m2 o3 K3 a0 [8 B/ [# r$ L
  112. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK
    2 z. p0 {  K% U9 T
  113. .INCBIN "sound_bank_bar/music_data_1.bank"
    - k. p3 Z+ U* ~
  114. ( D% R/ v$ R* f( t" R$ \
  115. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK. Y' m9 N# P# `
  116. .INCBIN "sound_bank_bar/music_data_2.bank"
    # I9 `1 Q0 a! h# H. i3 C3 m+ M
  117. 1 f) H0 k1 e  \( e" I
  118. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK
    ) \8 g( {+ _/ M+ K# P
  119. .INCBIN "sound_bank_bar/music_data_3.bank"" Q! A9 w% y+ i# i7 ^: y% l
  120. 1 ^9 c6 m; I/ U2 ?7 C6 Q
  121. .ELSE5 {: o. }- V- _$ i! l
  122. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK6 y! T/ I& [# X$ R# j
  123. .INCBIN "sound_bank/music_data_0.bank"
    3 n/ B4 P) X9 v- F
  124. . T: f( `2 s0 |
  125. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK; x- ?$ g2 x8 J2 W) ?, Q
  126. .INCBIN "sound_bank/music_data_1.bank"
      r% n: j4 d! \5 T/ J" _

  127. , }/ o& z9 j/ \( |
  128. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK2 Q9 ?% `8 \5 G: I3 h9 L
  129. .INCBIN "sound_bank/music_data_2.bank"
    ( s6 h. n3 E- e1 s

  130. 2 P& D4 Q( ^; r- Q8 [7 [/ V
  131. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK! R5 x/ x1 o. x$ @6 d# `$ Z+ w
  132. .INCBIN "sound_bank/music_data_3.bank"  U5 A3 i5 ^, I. j8 c
  133. .ENDIF9 D& D& b  N6 U
  134. * H  R/ l, K+ N! v; a5 C
  135. ;CHR图形数据
    % U( g  ?2 l  C
  136. ;======================================================================
    7 R4 [. R5 F3 O' R9 J* s% Q
  137. .BANK CHR_DATA_BANK: @& k6 T5 f! P$ z& _$ i
  138. .INCBIN "chr_bank/chr_data.chr"* ]: z! S; e' M' Q: y
  139. ' G- K+ T7 k& y0 S4 E+ d$ i$ z
  140. ;==================================================
    / B" D5 I5 l& p$ l
  141. PPU_Addr        = $0300
    ; d, j9 a4 @9 i: `8 c% H
  142. Palette_Addr    = $03C0% q& W; ^7 W0 X0 f% {" ]) W+ x1 C
  143. Sound_Bar       = PPU_Addr+$E0
    & [' B- ~. ?. p8 Z$ q& ~9 v1 m
  144. ;==================================================
    & H. d7 ?% u) ^4 l
  145. Palette_Update_Addr     = Palette_Addr+$0D3 Z/ s9 y3 H6 m# G3 w/ f
  146. Palette_Update_Max      = $2C( X) U5 h3 }; q# N5 m: n
  147. Palette_Update_Min      = $21# l3 E3 c1 k- O; v# C% Q4 [7 f% Z
  148. Palette_Update_Interval = 60( v. i% }3 h, k5 U8 t3 U8 \
  149. ;==================================================
    9 i/ [( y2 {& P( ~9 |7 H( v/ o
  150. Sound_Bar_Cnt       = PPU_Addr+$F0
    8 P3 \" H9 W& b9 l5 v' S& C6 ?
  151. Screen_State        = Sound_Bar_Cnt+$01
    " W( H# b9 N; d: x' W/ x, ]; R
  152. PPU_Cur             = Sound_Bar_Cnt+$02
    3 H# n) l0 e( }/ S7 k  K
  153. PPU_Addr_H          = Sound_Bar_Cnt+$03
    / C  L5 Q6 t6 U) U/ J& a: h
  154. PPU_Addr_L          = Sound_Bar_Cnt+$047 f2 o1 f+ D' b) y# J
  155. ;==================================================, I, e. }. s$ x, O2 J: t! Y6 I
  156. Data_L              = $70
    1 c) F# N4 w9 l" X2 U. J( f0 V3 q
  157. Data_H              = Data_L + $014 s1 w1 r% w, a2 u
  158. Data_Cnt            = Data_L + $02
    ) n0 ]+ F  t; P
  159. Data_Buf            = Data_L + $03
    , J: b4 Z& ?8 O7 v$ a. w
  160. Time_Wait_Cnt       = Data_L + $04
    3 H: [, o6 t% P9 }  ]% p/ Y
  161. Palette_Wait_Cnt    = Data_L + $05) J, R7 X, o% K
  162. Palette_Update_Flag = Data_L + $06
    3 x/ V! M  z' A1 G; [( U
  163. Show_Track_Name     = Data_L + $07
    % B  ^1 i+ K# M  O& N8 _5 X2 R7 l) |7 z
  164. ;==================================================
    ' n. u3 \* d- i" B* r- D5 C
  165. Key_Keep            = Show_Track_Name + 14 Y4 S, _5 \& S- m: `" x$ S, C
  166. Key_Once            = Key_Keep+$017 \, e- h* @% u. P. s0 |
  167. Key_Kemp            = Key_Keep+$027 H2 J) w' Y( V
  168. Key_Temp            = Key_Keep+$03
    % H! X0 c1 Y/ x
  169. Key_Getv            = Key_Keep+$04
    + }( c- Q3 i* p! F. t$ R- l& E- p
  170. ;==================================================/ U  S; V. E6 m1 v
  171. Music_Cur           = Key_Getv+$01
    & S/ I9 R% _3 m3 a
  172. Music_Last          = Music_Cur+$01
    * N" Z5 g4 x  ^+ }
  173. Music_State         = Music_Cur+$026 l1 f! i- F& m  M1 N0 D
  174. ;==================================================
    / Q( C" l3 H4 z, v/ k; L0 X1 r
  175. HEX_Data            = Music_State+$01
    ; l" a! j0 l9 a' B9 s+ l
  176. DEC_H               = HEX_Data+$01
    + a# ]4 k# C/ L1 h+ D0 U
  177. DEC_T               = HEX_Data+$02( E$ \8 y8 c) g  B" y; `% T
  178. DEC_L               = HEX_Data+$03
    5 r) u9 z/ Q8 W1 |& T
  179. ;==================================================8 B7 W9 a" T$ e
  180. Time_S              = DEC_L+$01
    9 y( H) I! k  \5 D8 k& N
  181. Time_M              = Time_S+$018 p# A/ V: V7 R" O. U! n
  182. Time_H              = Time_S+$02: [7 G6 t( w- c
  183. Time_Cnt            = Time_S+$03$ k% B) n$ g& a, \
  184. - Y) v, C8 d2 G6 C2 ~; a" t
  185. ;==================================================
    ) b: R/ I3 x3 I
  186. Music_Bank_8000 = Time_Cnt + 1
    % v0 z. I5 h  S% M
  187. Music_Bank_A000 = Music_Bank_8000 + 1
    . s2 I! s  R/ C! y
  188. ;==================================================: s: C" a! W, Q) j9 Z' G6 Q. H. |
  189. 1 P# s) [9 ?8 x; k
  190. ;======================================================================/ X  T/ |, v% E5 V$ z0 n9 I# c+ }
  191. .BANK PROGRAM_BANK
    8 r4 h+ J) m6 ^, S
  192. .ORG PROGRAM_ADDR0 g( s9 p' \8 A! r: [$ o5 F6 O

  193. . L4 G7 g2 d2 y9 @) Y
  194. ;==================================================
    : o, }6 y4 O0 P5 y
  195. NmiProgramProcess;NMI中断程序处理
    6 E' g) N0 |: N
  196. ;处理PPU图像. X7 b7 {4 K. B
  197. JSR PPU_Proc. M4 V' M( }4 M( `
  198. 2 a- V2 X& H; H, k& _- d3 `
  199. ;启用NMI中断
    9 [8 O% L- m4 n* Y# \
  200. LDA #$807 m0 N& A' n' l# d5 _. z
  201. STA PPU_CTRL/ N, F# N2 C7 n4 X; C
  202. ) `- W1 z- S6 A
  203. ;更新调色板6 l7 P$ b& k) d! R5 ?7 d. p
  204. JSR Update_Palette_Data
    , j3 h- L6 O1 T3 o
  205. ' f$ [- S! M, c: H
  206. ;显示时间(缓冲)
    $ C; z7 C2 O1 P7 ~$ F6 B
  207. JSR Time_Show
    8 s  r$ n# B/ ^$ u8 T  W2 G4 Z' P7 W
  208. 0 N+ M% t  ]7 \
  209. ;播放计时
      g# [5 M$ F- R# q
  210. JSR Time_Count" c5 R9 Q  ]$ \) n" O+ c

  211. ' n- S0 N4 F+ [0 m5 z0 k) U7 r
  212. ;播放声音
    0 C( C) L. @' U; ~$ }  }
  213. JSR Sound_Play$ Z% K3 E2 D. p6 r5 d3 f2 k

  214. 4 [+ o, c. _& J7 z! v
  215. ;切换音乐(手柄触发)
    7 Y3 R! W: x& U/ \! k. h
  216. JSR Music_Switch' i# E, |" l& v1 r
  217. 3 ?2 _( y6 I1 D6 X- B$ Z
  218. ;音乐显示(缓冲)0 c: @9 U% j: ]
  219. .IF SOUND_BAR_SHOW_ENABLE
    & F# v  t& M7 e. G# X2 c
  220. JSR Music_Vision1 \  J4 ?9 Q+ ]
  221. .ENDIF1 m! W5 j: F3 u6 r/ E+ P9 A) `

  222. ) n' T' H& J/ e+ z1 z: {* B6 P
  223. LDA Time_Wait_Cnt- c9 }) i$ ]0 b0 O6 v2 j% c2 G
  224. BEQ NmiProgramProcessEnd
    2 d" ~. L2 c+ N
  225. DEC Time_Wait_Cnt, }: z- t, g! j$ e! g3 S+ l
  226. NmiProgramProcessEnd
    8 W2 u# F, J4 u6 k. Y4 Q
  227. RTS; v2 r0 c0 F* F4 Z0 d

  228. 9 h  \& I+ x- e/ c0 i0 W
  229. ;==================================================; T% g# Y; X7 d( L: C! S, h4 T1 _$ R
  230. ProgramBegin;主程序
    ( ?/ K7 |  E  e4 r+ h
  231. LDA #$00( @' _+ R1 F2 F2 X1 S% ~' T$ B
  232. STA PPU_CTRL
    & A, S. t5 L% t4 U9 P
  233. STA PPU_STATUS9 p0 c3 v- o# N
  234. STA PPU_MASK
    1 W5 o7 \6 Y  |
  235. STA APU_STATUS# P/ k6 }9 @8 |. c! P. O
  236. STA PPU_SCROLL
    ) X- B: V4 E# i
  237. STA PPU_SCROLL
    + Y' U& k3 Y( e8 p
  238. LDA #$C0- x: O. B- O" L1 S; y' l
  239. STA JOY2_FRAME
    ; A) D2 A% ^" {1 `: @
  240. ; J) s+ }( Z  y8 @" i, M# S) o, `
  241. LDX #$FF
    4 r: b' l/ H. |  j
  242. TXS
    ; Q0 G; m% o  z+ s4 p$ n
  243. LDA #$00
    6 l/ h; s- U) `5 m& o$ x6 y) l
  244. STA PPU_CTRL
    ( N9 m8 Q" k# Q6 g( n
  245. STA PPU_MASK
    2 B* G2 D  p8 V9 t
  246. STA MMC3_IRQ_DISABLE
    & V. b9 U1 E, }# q/ x- P8 h

  247. ) V& K, A5 P8 p. k/ b) |/ |2 z/ i
  248. ;==============================) o1 h! X3 D* `1 Q$ a
  249. ;调色板清空- t' V; v0 D! _5 \* q9 |' s3 l9 O" R
  250. LDA #$3F
    1 z! p! K* Q, s6 v% d
  251. STA PPU_ADDRESS
    ( n: J% H( x$ e  f# E! A2 G1 X
  252. LDA #$00. r' ^# V9 i4 y
  253. STA PPU_ADDRESS
    ' j, T& }0 y4 c% X' F- W
  254. LDA #$0F. F2 f  D8 O- H) y3 s/ K) I
  255. Palette_Clear
    ; x( _6 Y& T- _+ n
  256. STA PPU_DATA9 d/ C9 k/ b; v
  257. INX
    ; o. K6 V8 E: w' `* C
  258. CPX #$20
    % R) n( c& m  Q3 |+ m/ Z
  259. BCC Palette_Clear+ H4 ]7 B: {, n  K( q  V3 I# J$ Y# D
  260. LDA #$00# i" `+ K4 q% C
  261. STA APU_STATUS
    6 u. u) Z) n) Q, N3 w  t
  262. ;==============================
      z& X. _; I$ \) t
  263. ;初始化背景调色板
    " F/ W9 ]# i8 |8 s" [! O( l! F
  264. JSR Set_Palette_Color
      R& D7 g% w6 w1 Y( Z
  265. JSR Set_NameTable_Attributes
    ( }% T- W' }1 q' S- r1 _

  266. & ^# I7 ^" n1 {1 g1 U
  267. ;==============================
    ! K; l+ a0 Y" C) _. o: G
  268. ;RAM初始化% Q$ o1 E7 i3 m! q, I
  269. RAM_Clear_All% S+ m2 n) ^2 C. l# Y
  270. LDX #$00
    / e' J$ f2 B3 Y& }
  271. LDA #$00
    6 p! @- h  ?$ E# W
  272. RAM_Clear_All_Start
    9 m/ `" E3 a7 \/ p" c) o
  273. STA $00,X
    4 D' U8 [# G. x3 H" t/ H
  274. STA $0100,X9 e( H2 P! i0 t) T' D4 S7 q  p
  275. STA $0200,X
    * Z) z& H/ V0 j* H/ L
  276. STA $0300,X
    3 _% A3 m; k& ^! l; l% _9 Q  Q/ J& o
  277. STA $0400,X- o1 O1 N. w  _* A, y. c
  278. STA $0500,X
    ; F  @$ u) S: B* a5 v! c$ M
  279. STA $0600,X
    5 g, [; w' F. L) X, [, H
  280. STA $0700,X- u! j- X( l! x  `- O5 w
  281. INX* b( V" X! L  p7 l+ f
  282. BNE RAM_Clear_All_Start, Z6 U6 a" `+ [8 ^

  283. ' }( U0 Y# R) h) s4 u/ A- ?
  284. JSR VramInit, m& `) ^1 X6 k
  285. JSR Init_Palette_Addr
    + c. e' w9 S+ M( {1 q

  286. ) _7 o! J# Q, s  S
  287. .IF Music_Reset_Addr4 D+ L/ R& c- s4 ]" I9 F& m
  288. JSR Sound_Reset8 T) q- O8 Q1 w2 b  J) T! E
  289. .Endif
    & ]! s" M6 f! ?- ~

  290. 8 W, U( C% {* [% E. |
  291. LDA #Music_Start_Song-$010 m' ]6 O/ I. ?2 a. W2 M6 d6 Z
  292. STA Music_Cur+ f, a, |- [2 [" k- b2 x0 `& p
  293. 0 X9 Z0 E- H0 z8 u& g! j
  294. JSR Show_Music_Text
    2 v3 G; n# j5 {7 `

  295. 2 v0 q: e7 s6 Q3 R, f
  296. .IF SOUND_BAR_SHOW_ENABLE
    8 C# x: t% }( s7 a* }. ^
  297. JSR Sound_Bar_Text_Set) c0 C/ p8 l  {! m
  298. .ENDIF/ M  O/ F9 i; g7 f9 ]; n
  299. 3 M5 s  X; W! x
  300. .IF Track_Name_Pos2 a$ O9 v& d7 t! B. ^4 M
  301. JSR Show_Track_Info
    1 j+ b5 g/ p% [7 V9 x& M8 j' E2 G
  302. .ENDIF0 [- E) q, D0 I& Q
  303. 1 n  D# s  P. r/ C
  304. JSR PPU_Proc
    % Q) d# B: Q0 {! _

  305. 4 P4 t( B0 A2 [
  306. LDA #$0E
    2 P) I/ E* p+ u9 F" l9 V* Q) C
  307. STA Screen_State
    1 B' p0 ?& D) W# m

  308.   S9 ~; m8 K8 D6 r( Y
  309. JSR Sund_Bank_Init
    7 c% @. \0 h9 x

  310. 8 o& P1 I, k- t' S6 F: X
  311. JSR Music_Show
    5 N8 F. t( j; _9 `' d
  312. JSR Time_Show
    - i/ l. k7 _( l' n/ A  ^
  313. JSR Music_Stata_Show
    7 D; ]5 j; P3 o3 x
  314. JSR Time_Delay
    - [8 y, o3 O' \5 b2 u
  315. # Q7 l6 {2 m6 H$ |

  316. 1 _$ ~9 X# K5 Y) R; K8 g; s
  317. LDA #$80& @" v2 z: q2 {
  318. STA PPU_CTRL4 R5 P& x& V1 k: |1 v, y( `

  319. 4 z) X) J/ m! y  Z/ p7 i
  320. LDA #$206 d) D1 u: f6 F/ P
  321. STA Time_Wait_Cnt% K  ?$ w; V9 Y' P1 C; S; }
  322. & w7 l. T  |8 x, ^* R. d8 M
  323. Wait_Time_Over( g( R5 Y9 x6 x% {+ j$ i! N- E
  324. LDA Time_Wait_Cnt+ X6 y8 b# s* w
  325. BNE Wait_Time_Over
    3 o3 z" e# i! n$ e. w

  326. 4 ?* R7 h5 z' S) _( T; p7 ~
  327. LDA #$1F
    " }2 a+ p  J' C  J& G5 S9 J  Q# {! A
  328. STA APU_STATUS
    ' C" p- F; z% X' G% r4 U) n$ V
  329. LDA Music_Cur( t, e0 A1 ]- ^
  330. JSR Sound_Init" h; P4 s- b2 C/ Z0 n6 p

  331. $ E  ]  y4 Y! V/ j, c, q
  332. JMP MainLoop5 g8 p+ b. T3 w: B9 }0 ]$ V

  333. ; U) w( R9 _- X4 L: B6 l
  334. ;==============================
    % ~. I9 S0 m: w& T5 ]) j
  335. Time_Delay;延时等待& C6 e/ {  v+ T/ ]- r% |% _2 t
  336. LDA PPU_STATUS
    0 l' q5 i" _' e( R8 k
  337. BPL Time_Delay
    " C& D, }4 }+ P
  338. RTS3 X7 k% \* Z' v8 [3 R

  339. 0 b* l$ v4 @9 r
  340. ;==============================
    6 \/ ~1 C& ^3 ?6 ~" w8 Y
  341. VramInit;初始化图形内存
    - W( p+ F. t# F5 Q+ q: ?: P$ ^" b
  342. LDA #CHR_DATA_BANK/ u8 Y% X2 R7 \9 v* O& y( V
  343. JSR SwitchBankA000
    + A+ ^! G" [' z5 V& D, p
  344. LDA #LOW(CHR_DATA_ADDR)
    + w) p. K' q, Y" h
  345. STA <Data_L- D& F) N" t; ~: @. G( y
  346. LDA #HIGH(CHR_DATA_ADDR)6 J+ T+ P. o9 z7 m
  347. STA <Data_H
    5 M7 ?: m! u; X3 K
  348. LDY #$001 w7 D# T% ?+ z$ i, w
  349. LDX #$20' y" j( n0 C# E
  350. LDA #$009 C( f  ]$ `! R2 d# b% t, ]0 ^
  351. STA PPU_ADDRESS- m9 e8 U& Z/ V$ O# [# x
  352. STA PPU_ADDRESS
    ; |( m( R* n( @7 N
  353. VramInitWrite. \0 [' b/ l7 p' `% N$ C
  354. LDA [Data_L],Y1 I  F" y% }7 V; i1 W
  355. STA PPU_DATA6 A. F) Y; a7 U' e8 B* ]
  356. INY
    : ^5 B$ O. C$ _2 W
  357. BNE VramInitWrite8 W! w9 J: b7 n* k
  358. INC Data_H/ ^$ W) W7 b: x0 W4 M+ Q
  359. DEX
    3 s; T! g  z! g$ B
  360. BNE VramInitWrite6 y. I: E4 q9 I  s" |8 T
  361. RTS& C1 @9 S$ ]/ Y. d7 p+ A

  362. / X/ h3 O& @8 k! ]8 `* [
  363. ;==============================* g+ Q# I  W- b0 y3 P& E; T
  364. RAM_Clear;RAM清除' L8 H1 b% S- q% x' |
  365. LDX #$000 Q; e1 M8 A& T7 ]
  366. LDA #$00
    & H0 |  C" U) J- K! q/ X$ j
  367. RAM_Clear_13 |$ G/ a+ M2 f
  368. STA RAM_Cln_1,X& Q) Y$ c4 P. D
  369. INX/ A+ C5 D1 j9 {
  370. CPX #RAM_Cln_1_Size
    * H) v5 l/ U" n5 s! l
  371. BNE RAM_Clear_14 K+ c- N* C* _1 z
  372. LDX #$000 m+ L+ r- I* g  l, S  H
  373. RAM_Clear_26 n- Q- c# p% A. p1 i
  374. STA RAM_Cln_2,X
    ) o9 \6 f' K. |
  375. INX
    0 Y- V* I; |3 i3 Z: D  W
  376. CPX #RAM_Cln_2_Size
    9 e. Y7 Y9 p* [) c( W
  377. BNE RAM_Clear_2
    ) N" W  @8 j: ?7 l6 `+ t
  378. LDX #$00
    * m5 k# {2 ~9 {- I! @2 j- r
  379. RAM_Clear_3
    7 z& ]& B7 _5 {; H1 S3 F: f
  380. STA RAM_Cln_3,X
      d/ k7 Z1 z5 a* w
  381. INX
    2 _: {2 @" Q: f7 r% i/ Z! H
  382. CPX #RAM_Cln_3_Size
    0 X, `! W9 t8 C' c# t1 G" I
  383. BNE RAM_Clear_35 K8 K- X9 _& s" |, u# F
  384. RTS
    / S0 S! Z5 o. z2 |% w; p3 h
  385. . I$ p; @% ?  `9 O, O* k" t/ [& E8 p( x
  386. ;==============================
    6 V, L/ O# w# d: F7 o8 q
  387. ;音乐切换7 B/ k, I& j. X+ {+ S
  388. Music_Switch; C- H% x9 E. W0 Y. R& u
  389. JSR Key_Proc
    * d/ ]$ m5 O5 `; O* N: d, r
  390. LDA Key_Once* T2 q, f2 W9 o6 Z# K
  391. CMP #$10$ j2 O. y# W2 R# g  M$ Q
  392. BNE Music_Start_SongStop
    * L7 x/ Y. \* k
  393. JSR Music_ReSet
    0 n& ^# V+ w7 i* W  T9 L

  394. " {: ~4 P  C# k/ u# T/ }
  395. ;音乐停止
    $ q7 u$ B& |: G, n
  396. Music_Start_SongStop
    # l. c, _/ k' c# I3 m. m0 D
  397. LDA Key_Once& D1 }' ^6 O0 v" a1 v1 e0 i
  398. CMP #$205 o# O0 w5 u% P( Q2 Z/ M6 t
  399. BNE Music_arrow1 u* t" x- c% |8 E9 M  |8 ?- D% {
  400. LDA #$010 F0 n$ |6 Z8 e0 o$ Q" t
  401. STA Music_State6 [4 s* e2 |' n$ a8 h
  402. JSR Music_Bar_ReSet
    0 M1 k+ s" C5 T5 t
  403. JSR Time_ReSet" j# L; }* U7 U# v" w# @8 X3 w* A
  404. JSR RAM_Clear) k# _/ o9 W* x8 o  W" Y3 g$ b
  405. JSR Sound_Clear
    & u3 w, K7 b1 M' o
  406. JSR Music_Stata_Show$ Q# d/ F7 W, c$ I- f% e9 K0 q
  407. Music_arrow. Y' i% i7 Q3 u% J
  408. LDA Key_Once8 E1 p) b) B' b$ o5 q
  409. AND #$CF7 [8 N& z; @1 h5 u# t  X9 l' c3 E
  410. BEQ Music_Switch_End
    9 [3 S0 n- Y; Z# B2 @5 |
  411. JSR Music_Number
    ' V: Y; |3 o7 V
  412. JSR Music_ReSet) v; N; `/ p. _# |
  413. JSR Music_Show
    2 Q* ?9 H7 f+ H- m
  414. Music_Switch_End
    5 m' t) G. g3 W; P  k3 e* T# c
  415. RTS' c4 v+ L1 J1 o8 ]; @) d& s

  416. 4 c+ X( X# R' R3 ?
  417. ;==============================( o1 g. e# A1 ]7 m
  418. ;音乐曲目切换
    , j& p8 t' [' f9 M: a+ b
  419. Music_Number+ P5 u! J8 L, j+ L, L' f6 B
  420. LDA Music_Cur9 h# a! x) \/ q" R; [
  421. STA Music_Last9 ]7 ], Q$ S& C. T) e; P
  422. Music_Decrease" C' A/ ^% D% M0 s
  423. LDA Key_Once
    ' m; ?) \5 U2 F3 G' t0 o
  424. AND #$423 b8 t# E6 |' U! D% N1 {7 w
  425. BEQ Music_Increase# l  M: L9 @) v" ~7 ~8 `# g% D
  426. LDA Music_Cur( V/ ]/ `  N& ^. V
  427. BEQ Music_Increase) o+ w( a+ f2 u) |
  428. DEC Music_Cur
    $ Q3 T6 x6 Q3 G2 y# f5 A( c
  429. Music_Increase
    3 s. E1 t- Y' _! ^( B- H: M1 m
  430. LDA Key_Once2 t. ^% Z: J  |" f' g% ?% o
  431. AND #$81
    $ G2 l7 `, [$ [% C2 |2 @
  432. BEQ Music_Decrease_10
    $ Y! G: b6 A0 A$ j" K
  433. LDA Music_Cur$ @' _: t5 f* [8 C9 g# y$ d
  434. CMP #Music_Song_Total-010 Q. T: V+ P& g7 Y4 `8 \% n
  435. BCS Music_Decrease_10
    9 K& g1 i  y8 C' q6 K6 R: v
  436. INC Music_Cur
    # @/ g3 v) i/ U4 n0 {
  437. Music_Decrease_10) O+ r; G, H2 ~, ]
  438. LDA Key_Once
    7 u6 O: r- _! I& k& ?2 [' d
  439. CMP #$04
    . h# r; e  t0 m6 V( {  r
  440. BNE Music_Increase_10
    5 Q+ R$ i% t( ?) o* q9 r$ `6 W+ k
  441. LDA Music_Cur* C# N# j3 w; ]4 o7 L1 @
  442. CMP #10
    + w% e" z7 C6 m( Q
  443. BCC Music_Start_Song_Min
    % a+ ]' F( u0 ?. e2 @& j* |
  444. LDA Music_Cur
    " Z4 A0 S6 e6 R! l
  445. SEC
    8 y% ~# ?* Y' p) R; f4 m; V8 [
  446. SBC #101 J" R1 F( T- G4 I: z
  447. STA Music_Cur
    : F. |% o( g% t, `, D6 \/ ~
  448. LDA #$00
    1 o4 |6 p7 ]' Y1 `1 _8 e  z
  449. BEQ Music_Increase_10
    & U* \4 J  D: Q( }6 A/ o
  450. Music_Start_Song_Min
    4 T- i6 [$ j. F# n) G
  451. LDA #$00
    % b. z' ^6 V4 P3 }3 x1 l
  452. STA Music_Cur
    : Y2 R# b' o' `! ^5 R9 T. R
  453. Music_Increase_105 O, V4 B$ F* _
  454. LDA Key_Once# w2 K7 K5 L- x) `
  455. CMP #$08
    ; {6 U  }2 R) c6 z9 N# {
  456. BNE Music_Number_End
    6 g) x- M3 |1 ^/ ]; v
  457. LDA Music_Cur& ]) N7 [0 {: j. m% W/ f
  458. CLC4 I1 K1 V( q, }9 M6 G
  459. ADC #106 b$ D) y" p8 d1 s3 Y* k1 a/ F
  460. CMP #Music_Song_Total-01
    $ W% R7 l( `: Q0 G" V
  461. BCS Music_Start_Song_Max. Q. Q6 t: m/ q+ Y# w& W! b
  462. STA Music_Cur8 V; D7 l* B+ y7 E) V. n2 |5 d
  463. LDA #00
    1 W6 ^* ]3 y0 R% M* U' w5 C3 n
  464. BEQ Music_Number_End
    ) e4 r- I- {* A4 P; s; }2 |- V* G
  465. Music_Start_Song_Max" t+ K3 `+ l" K& i
  466. LDA #Music_Song_Total-01
    ( ?3 B+ r8 A+ t& g/ S
  467. STA Music_Cur
    & a7 @0 \/ t& z) z- @, A
  468. Music_Number_End
    " P. P+ V3 b3 i! m1 N  e- x( }
  469. RTS
    0 X5 J* t- V6 Z0 F# \
  470.   C5 M9 J# s7 _0 A
  471. ;==============================/ q/ U- i! F" U; Y8 F6 }9 J
  472. ;音乐重设
    $ K- M1 z" {3 u  S! ^
  473. Music_ReSet. f1 E7 z! S$ x- E' O9 C" b
  474. JSR RAM_Clear
    ) P# |. \" K6 x) g# H$ O
  475. JSR Sound_Clear
    # _+ v$ h0 T  `  M0 p  v$ x
  476. LDA #$1F
    ! Q4 g2 \, |  A
  477. STA APU_STATUS( Y# o: P- p  k, {& Z- \' E
  478. LDA Music_Cur
    $ O( B, g- _# R9 o" p9 c) V
  479. JSR Sound_Init7 z1 F. h, B! p  U& I
  480. RTS
    ' h$ V4 `+ z. l* [/ E3 d1 ^
  481. 0 x0 j# }2 M9 W0 f0 X
  482. ;==============================
    3 @. w% x+ I7 W; I
  483. ;音乐端口清除
    4 C5 z: y! P; @" H( w
  484. Sound_Clear4 Y. b$ w! I8 c. X! u4 R5 v
  485. LDA #$00
    ) x% {8 V& y# c7 ~; i% Q# z% d
  486. STA APU_STATUS( T: t5 n9 v5 \$ h( o5 V
  487. LDX #$00+ c$ x* V; P" z# k* L8 G: V/ z4 |
  488. Sound_Clear_Start
      Y- d( L/ s, z: y% [2 D! R* v" I
  489. STA $4000,X/ n! v: d2 l2 x. I0 x" w! r
  490. INX, L% r9 ^' L7 m- u8 C) d
  491. CPX #$142 C, [, H5 t5 c" _
  492. BCC Sound_Clear_Start8 s/ H8 `$ g, r2 d
  493. RTS9 _0 L3 q. m& ?0 h& H5 z! j

  494. % _  z- M7 v7 ]' ^2 Z4 F
  495. ;==============================
    % s7 d; s, y. j' X' U  k% [
  496. ;按键处理
    / d0 N5 w9 t2 ^+ V  x" P1 Z
  497. Key_Proc
    8 I7 @& p1 o2 V, Z& I
  498. JSR Key_Scan
    * b+ n$ Z# B, y: P2 g! M1 Z/ q6 o0 q+ z5 r
  499. LDA Key_Keep
    ' P+ n. F: M( {- c9 O# m
  500. STA Key_Temp+ n6 M+ \# A+ c* n
  501. JSR Key_Scan0 c' P- T* C% c# A
  502. LDA Key_Keep$ K6 {  r  w+ x" b
  503. CMP Key_Temp
    3 z) d- ~  g  C; D5 V
  504. BEQ Key_Get_Once( w8 W8 C7 q2 c$ x1 T$ X' t
  505. LDA Key_Kemp# Q" p" C: I2 X! {. f# ?
  506. STA Key_Keep
    - I3 V4 V& C) }9 Z2 }* s& |$ g7 P
  507. Key_Get_Once
    $ N2 W* s; o+ O$ X. e* S
  508. TAY/ P* q' @# w' k& m
  509. EOR Key_Kemp
    8 V# c" k" K2 [% m
  510. AND Key_Keep5 O, n9 w6 s& l, M; A; l0 O' ?
  511. STA Key_Once$ p3 f% X$ s; Q# R; n& H
  512. STY Key_Kemp
    ; w9 ~9 T0 T7 b5 Z; z
  513. RTS
    ( a3 v1 U$ [$ ?3 f2 K
  514. ;------------------------------
    , {4 S+ |3 X  V7 y
  515. ;按键扫描- t/ ?0 X& m. I4 m. H( R( q
  516. Key_Scan
    7 J" [  U  J; d3 N# o6 }
  517. LDX #$01
    ; d+ @$ w  ^% {, S* x" u/ |9 L6 l
  518. STX JOY1_FRAME
    ( e4 J: R* ?. N# S( _
  519. DEX3 O& ~2 Q6 A: t1 g2 x
  520. STX JOY1_FRAME" z% _- j' A% r( G6 d. V: N
  521. LDX #$08
    7 W& P; T: X1 S
  522. Key_Value
    * N2 V" Y( m7 u
  523. LDA JOY1_FRAME9 F1 K8 s# t2 X0 e, s) q1 ]
  524. STA Key_Getv
    ; P- A( n, O/ W) _
  525. LSR A: F1 j3 K; k/ t# v% J: p
  526. ORA Key_Getv
    + i& {" Z4 K$ {& t/ @) R6 N
  527. LSR A9 [) ?1 n/ ~; ^/ W% T+ J4 ~# f
  528. ROL Key_Keep
    3 O2 m& x4 t' W6 L
  529. DEX
    1 a/ k# c/ O0 E: v
  530. BNE Key_Value
    ' ^% U8 u, a. }& B3 G% x6 y
  531. RTS
    # z0 w, ?. W9 R" E( T
  532. / [& J# S) _1 X4 m
  533. ;==============================& a: a/ g2 v# w7 X
  534. .IF SOUND_BAR_SHOW_ENABLE. c7 o" N# w" U) k, h0 D
  535. ;音乐条显示
    " U& E2 ]. D& H( A7 q6 o, Z! d
  536. Music_Vision# k$ a  o7 J+ [6 B1 w
  537. JSR Music_Animation& }5 b  U& d: s& E- h
  538. JSR PPU_End
    2 H) R% }9 v3 m2 P+ L$ |$ y
  539. RTS
    7 M3 }  M! S( B0 q" ?+ m" W% N$ A
  540. ;------------------------------
    & L) K1 u/ ?3 Q7 O  A
  541. ;音乐条显示处理
    3 g4 ]# ]; R( a0 R0 ^& \
  542. Music_Animation
    * ]# _2 x# O8 \3 ^. E! W
  543. LDX PPU_Cur
    5 ?+ Q, ]0 n/ W# o
  544. LDA #Mode_Line
    ' v+ m- Q/ p8 ^7 l! l, @8 u  Q
  545. STA PPU_Addr,X
    1 B' U+ A7 H3 h8 N/ o/ H. G
  546. INX
    , Z8 ^) [( l  a  X
  547. LDA #HIGH(Sound_Bar_Pos)
    4 h' z3 g$ c/ w" Q
  548. STA PPU_Addr,X
    $ z# s$ f+ ~- ~6 m
  549. INX( E" Q4 G2 A- {; L3 Q, H
  550. LDA #LOW(Sound_Bar_Pos): c2 Q: o9 E1 o5 G5 k, `
  551. STA PPU_Addr,X' n7 J9 l* G( y$ `8 E$ m+ G
  552. INX
    + T; u: N0 F+ |& V* U, s
  553. LDA Sound_Bar3 m8 A0 m2 }! u
  554. JSR Volume_Convert/ s# N$ Z/ R6 x/ i, d  o: U
  555. JSR PPU_Return# \; R2 e9 B, C" ^1 F  b
  556. LDA Sound_Bar+$4
    ; {7 P' j8 n& p! [
  557. JSR Volume_Convert. O/ Y: j! S4 j5 d' A; E
  558. JSR PPU_Return
    - d+ m" M1 i& L  j( m9 W
  559. LDA Sound_Bar+$8; m( E2 n7 T) t0 E$ U5 @3 t) n( x
  560. JSR Volume_Convert_Ex9 S9 y1 m2 q3 [2 G3 X
  561. JSR PPU_Return2 [8 t6 T3 R- R
  562. LDA Sound_Bar+$C/ m; p- ~& v2 ?6 B& `# m7 M" n1 M2 \
  563. JSR Volume_Convert! q1 p$ t* J+ q/ B1 P
  564. JSR PPU_Return9 W/ J9 h8 O& x3 x/ a5 l  }6 O; h6 Q
  565. LDY #$10
    , h5 m% H' H, e( O) d+ |4 z
  566. LDA APU_STATUS
    ' @2 w# p' C" r& a- }
  567. AND #$10
    2 Z9 e3 Y' m0 {! n
  568. BNE Volume_Count
    $ N5 |, U6 `& X
  569. LDY #$004 X% \# e) @7 N  O" j1 q
  570. BEQ Volume_Count
    9 G9 U( ~4 t* d1 R" Q: N
  571. ;------------------------------
    ) ~/ ], @& c' X. O$ p3 H
  572. ;音乐条处理  B+ S7 h' f9 F, q2 w' J
  573. Volume_Convert_Ex- p/ }# G6 R- Y1 ]; |" s1 l$ @
  574. AND #$1F4 y/ [3 F# x) ^: g( K' a+ K
  575. TAY
    6 w7 m. c  @" W1 z
  576. BNE Volume_Count0 W( m- m! Z) @( B
  577. Volume_Convert
    7 [. U# |7 b3 Q) \3 l2 B' k/ i
  578. AND #$0F
    4 ~/ A2 d+ v8 @$ _5 A  p" N
  579. TAY
    * r" K+ d2 U" {0 X: d6 J
  580. Volume_Count. A: p' t3 a( Z" T9 w
  581. LDA #$08
    1 h! L- J, ^9 r
  582. STA Sound_Bar_Cnt
    - b+ I/ c# n/ i; m3 E% ~* P' z/ n
  583. Volume_FILL. I: s/ y* F( E- ]' j; w& f
  584. DEY  T* [/ S7 [1 U
  585. BEQ Volume_Half
    ( F! L3 ~2 }/ @
  586. BMI Volume_Empty
    * B3 u( x; X, m1 E0 C
  587. DEY- ^- f; d2 T) @, \
  588. Volume_Full
    # L8 O  s5 ~/ \
  589. LDA #$16: A  p6 D: L- n# ]6 L) `
  590. BNE Volume_PPU
    ) H' o0 L" k- L" {5 N# q
  591. Volume_Half. |- R1 E) T% ~3 A$ Y( s9 [
  592. LDA #$15
    ) }( e. |9 ?2 H* Z8 t
  593. BNE Volume_PPU6 i& ?) c& }3 t' A
  594. Volume_Empty
    : q4 R! w" A, H. c  ?
  595. LDA #$14
    2 Z" E0 k$ s' N6 f, u* X
  596. Volume_PPU  t! Z) l8 M, @+ w# L* E
  597. STA PPU_Addr,X
    ( h# m% ~4 z% S- r1 k* a1 `
  598. INX9 ^6 |# l* |0 |( V/ J
  599. DEC Sound_Bar_Cnt' \/ g8 k2 P& U! y% T" w. ]( @6 j2 M
  600. BNE Volume_FILL1 n9 A9 ?* z# }+ \: ]+ X6 }
  601. RTS
    2 v7 d& i" ~5 j6 _* A+ D4 [

  602.   x- ^2 v( _4 ]) M$ A, Q# Q& a
  603. .ENDIF; t" f6 z! h1 R! x  k0 E, _  H% @' d

  604. 2 U/ a) N& `8 M& I. {9 Y
  605. ;==============================( `* ]% \. x* Z
  606. PPU_Addr_Set;PPU行开始0 n9 M% p$ a+ [& g: j
  607. LDX PPU_Cur, B' k0 n( N2 B; J+ |0 o/ O  c
  608. LDA #Mode_Line4 S. D' w+ k( P/ K$ X9 t
  609. STA PPU_Addr,X2 }- f5 S( e4 S6 V
  610. INX% _) V' V( p6 O/ e
  611. RTS! m  [, A. T/ g( J) s; x
  612. % _/ {/ w( ]) O: h( `
  613. PPU_Return;PPU转行
    " G! W. ^0 h" W& S# F2 i6 o& o
  614. LDA #Flag_Over+ {; N3 R/ a+ G* z& s% M
  615. STA PPU_Addr,X* s& Z9 i% I/ ?8 l/ V/ `: z2 D3 a
  616. INX
    4 K% w7 M; q- K! z3 M. Z; u/ H
  617. LDA #Mode_Return- O& u( |; ?1 T6 p2 b
  618. STA PPU_Addr,X
    & Z; c9 A/ H: H; K4 P
  619. INX. x9 L2 M7 Y7 }0 u
  620. RTS+ x2 O% Y% b( q2 t
  621. 2 c$ B: D7 a: n& i) ?
  622. ;------------------------------
      H/ L! V2 G' P9 d" D. A# c
  623. PPU_End;PPU结束% f7 E( w7 H; L& A9 y4 Z
  624. LDA #Flag_Over* p4 F# ^2 \7 R& x+ m8 d
  625. STA PPU_Addr,X9 c5 R& `- x* z: Y
  626. INX* g3 a4 c' a8 z( O. d9 b: h
  627. STX PPU_Cur% a# J0 _8 w; i2 J/ R; _  p
  628. RTS5 D3 G7 \5 p7 ]% j
  629. ;==============================
    ) d0 w0 I6 J' u% j5 E+ G: G: L
  630. Mode_Line     = $FD    ;新起行模式
    $ V4 y1 {' k$ i5 Q- D
  631. Mode_Return   = $FE    ;转下行模式
    2 }8 X  W5 N6 s. G
  632. Mode_Clear    = $FC    ;行清除
    % ~$ C2 b! z4 j6 l7 H& V+ T
  633. Mode_CntLine  = $FB    ;行计数写入+ }) T. q$ i0 {1 e
  634. Flag_Over     = $FF    ;行结束标志- T0 J& r1 n9 p" f- |
  635. ' n$ e$ e+ e& X+ W
  636. ;------------------------------
    / R7 d; ]1 Z/ f5 S4 e/ Q' Y$ E
  637. ;PPU处理
    " A* S1 N3 r3 U9 J* D$ ?9 k% c$ F6 R6 e
  638. PPU_Proc
    3 T! G0 D; A8 s
  639. LDX PPU_Cur
    " b& q! S) j. g0 C% F" I4 f) V
  640. LDA #$00
    " [5 B2 H) l" \9 R
  641. STA PPU_Cur
    , n( K. `- H- M1 ?0 a  }
  642. STA PPU_Addr,X' U/ w: ^% A4 Y- m0 J
  643. LDA PPU_Addr
    # G5 y; o6 ]6 r0 K0 R; S& I, [+ |
  644. BNE PPU_Proc_Beg4 Z' }7 V6 G$ f1 g) `! t& W! z2 J
  645. PPU_Proc_Ret
    " d+ n, A! F0 p7 @# E( [! }
  646. RTS6 `. T  n6 o' X/ c8 d4 A4 w% [
  647. ;------------------------------
    6 X7 K7 `- q: m
  648. PPU_Proc_Beg  ;处理开始- E  T1 c8 U  ]7 K
  649. LDX #$006 Y# h! B" C/ T
  650. STX PPU_MASK
    7 s0 k8 I. j% G9 t, j. y
  651. ;------------------------------
    " E: w0 _$ R5 J8 ?) A* v; T* n
  652. PPU_Mode_Select  ;模式选择
    : E) Q  F' h( N  T& J! C/ X# o
  653. LDA PPU_Addr,X
    $ r$ i& b7 B, G
  654. CMP #Mode_Line
    7 [% U- ?6 R- j- b$ s* C* y
  655. BEQ PPU_Mode_Newline
    3 t3 ]5 T8 o' ^, g; I1 p
  656. CMP #Mode_Return+ K; |! y  b3 A% y
  657. BEQ PPU_Mode_Return
    / D9 L8 ~! W( y$ v! O
  658. CMP #Mode_Clear# M5 |% p& P1 t- n) S5 X
  659. BEQ PPU_Proc_Clear7 y: _* {, c1 _3 Q- C8 K+ E( s* N
  660. CMP #Mode_CntLine0 M1 J; w- @$ |  C
  661. BEQ PPU_Proc_Cnt_Line) B' ~0 n2 c2 U+ p2 Y. k
  662. RTS
    9 P3 S, E, d* a  q1 D) s' m2 ]
  663. ;------------------------------' S  N6 y0 T% E' A
  664. PPU_Mode_Return  ;转下行模式+ U' b( a  ]: p- ]
  665. LDA PPU_Addr_L/ V! C' B; A1 ?; P' a" o. F: Y- k
  666. CLC
    ) ]0 U# S4 Q9 B/ k; H6 u4 |, b
  667. ADC #$20) D7 K4 S  Y* W( T& b
  668. STA PPU_Addr_L
    8 e' T* Z4 B, ?* |: z3 F9 r
  669. BCC PPU_Return_End
    4 i4 M0 v6 G3 b; |, t
  670. INC PPU_Addr_H
    " z! f: a8 O+ o, e; I+ `! l
  671. PPU_Return_End
    5 I3 P; c/ ~) M
  672. JMP PPU_Set_Increaser$ a3 ^+ C! Y/ F; |  K2 ?
  673. ;------------------------------
    4 w& A0 `; |& ^8 Q9 z4 u
  674. PPU_Mode_Newline  ;新起行模式
    1 z; L0 P( a1 s+ ~
  675. INX
      F& e/ p* G* y- m+ x" z) Z# k4 i
  676. LDA PPU_Addr,X, F7 l$ Q- N) T
  677. STA PPU_Addr_H  O, `5 g* R( `6 Q- p
  678. INX$ B6 d3 E  y6 \! _( k
  679. LDA PPU_Addr,X
    2 U: v! [& l0 Y( t) }) y+ @
  680. STA PPU_Addr_L
    ; W1 R  j  U# A0 j) a
  681. ;------------------------------
    1 ]$ S: N& y  A! ^2 K
  682. PPU_Set_Increaser   ;设置写入地址
    : I' a9 x, B/ E+ Z. d
  683. LDA PPU_Addr_H' ?* o2 J6 w" s2 S; n$ w, }; v, s
  684. STA PPU_ADDRESS6 r# ~* p. M" q$ Z2 Y+ V3 ?& a
  685. LDA PPU_Addr_L
    & I, z; L1 r* M) K2 N
  686. STA PPU_ADDRESS
    5 N, U/ f8 C4 y
  687. ;------------------------------
    ; ]6 U# g1 j/ A
  688. PPU_Write   ;写入数据( B9 V4 ^- A- ^0 o; m" O2 A
  689. INX
    ) C: O0 G& G7 M. w7 k
  690. LDA PPU_Addr,X. z9 a4 b; `2 I0 m, A6 Q
  691. CMP #Flag_Over1 J) b$ V/ y. I) k( v( M( V
  692. BEQ PPU_Proc_End
    3 l! D, n5 v# J% c! e4 G3 M
  693. STA PPU_DATA7 Y' i6 M2 u+ H9 e0 G1 s. c" d
  694. JMP PPU_Write
    2 M! _  z; |# [
  695. ;------------------------------
    " z* e2 h/ V! X1 Q5 s
  696. PPU_Proc_End  ;单行写入结束6 S) k6 x" u1 G8 S( E7 d3 L( x
  697. INX+ A6 I, \) V0 ^* a% p) U& l
  698. LDA PPU_Addr,X
    + n( b+ `9 M% j7 T7 M  G' ^
  699. BNE PPU_Mode_Select
    " U. v/ p( p1 Q+ a4 a* S$ t& Y6 C
  700. STA PPU_Addr0 a, N! V2 d8 H5 _6 A/ S
  701. JSR Update_Palette_Color
    ; q* O$ w' h- c- ~0 a
  702. LDA #$00
    9 E# \* Q3 F* Y: t& j0 G) ]6 l4 q
  703. STA PPU_ADDRESS$ R/ |; [+ q7 C9 N& W* R
  704. STA PPU_ADDRESS# b9 F" W' D5 z- g  R  T$ f$ V- Q
  705. STA Show_Track_Name  Q2 V9 F- y- Q3 S7 |& Q
  706. LDA #Scroll_X
    4 y4 o6 \/ \) e$ N7 @7 |
  707. STA PPU_SCROLL
    ( A6 B  i# h9 P: t& @6 L" F
  708. LDA #Scroll_Y
    0 R+ C- K% Y  O2 \2 U; c7 k
  709. STA PPU_SCROLL/ \# o1 I1 G0 \( C# I7 A: k
  710. LDA Screen_State4 H3 w5 H  e+ B; E, c
  711. STA PPU_MASK
    , ?9 o! Y. s% v* x0 [
  712. RTS3 d2 a5 e! t, Q  d# w

  713. 9 R" c5 Q) f% Q2 F/ m
  714. PPU_Proc_Clear
    ) x6 F: ^* n, a1 v7 u1 E
  715. INX
    : p% N* S5 s- i9 Z0 z# j* Z3 o" k
  716. LDA PPU_Addr,X: {- }: E: f# Z# M, f# c/ }4 [# Y$ A
  717. STA PPU_ADDRESS
    * {* q+ M0 h# l( m3 x+ Y5 k( e
  718. INX, _/ l; O* b0 r) V# k3 f$ C8 @
  719. LDA PPU_Addr,X6 x% `0 Q, k2 f' D' C3 o
  720. STA PPU_ADDRESS
    ; w/ o2 O2 q0 j! b: x
  721. INX
    ( O9 T  c: s$ i! c2 _
  722. LDY PPU_Addr,X+ t5 m: _3 c# C* E
  723. LDA #$00
      i/ u- E3 V8 t% G: h/ d! o
  724. PPU_Proc_Clear_Write& E! s: ^8 @- a& H; d- E
  725. STA PPU_DATA3 y1 V& u6 v& O9 M3 o& H
  726. DEY
    1 J% h: [/ _' ~0 z: v5 v
  727. BNE PPU_Proc_Clear_Write
    % v) d: G" u, G$ C* `) e3 f
  728. JMP PPU_Proc_End
    " S* C4 D  n- c9 z! k: c  F" k" H

  729. - }1 y; s' t' Y- e3 H4 b
  730. PPU_Proc_Cnt_Line
    ; Z- R7 X+ c, N4 P
  731. INX
    4 l( T, a& t( X- ]( L+ `% I
  732. LDA PPU_Addr,X
    : ^; Z- f6 Z: C5 p0 m( g6 ^& s5 ]7 S" O
  733. STA PPU_ADDRESS% g3 w; f& K2 q' H% U! Z+ W/ A  b
  734. INX
    7 w0 x* l  ^/ N  Q: b( c
  735. LDA PPU_Addr,X; ], l( T6 L2 u( i1 X3 f$ q
  736. STA PPU_ADDRESS
    - X7 h- ^2 O; o; v. V
  737. INX* |- r: x0 k% n; M: W) W8 T) x
  738. LDY PPU_Addr,X6 {+ J- O, A: _5 @
  739. PPU_Proc_Cnt_Line_Write) `2 C  c. [; Z+ [9 A  Y! t5 X
  740. INX
    $ \8 F1 [5 w6 |0 M2 K, L
  741. LDA PPU_Addr,X
    9 N6 B5 L5 c/ l/ E4 q3 ~
  742. STA PPU_DATA
    / [4 c, i; L/ E! e
  743. DEY2 n9 }! u9 W. M: M2 A+ [
  744. BNE PPU_Proc_Cnt_Line_Write/ f9 P8 C8 G3 i: q  b% R- }( L
  745. JMP PPU_Proc_End
    ( {3 }7 k+ d3 T  m. q$ P
  746. ; f! r# |' x6 b) i& ?- ~& c1 J
  747. ;==============================, I7 k: C4 D& ~" E2 ^" M* b) H/ a- E* ?
  748. HEX_To_Dec;十六进制转十进制2 f# z& \0 U3 v0 y6 z, y' f. B
  749. STA HEX_Data3 p! ]: d/ Z4 K1 }, ?
  750. PHA  ?1 H; ]8 y# I5 _2 i
  751. TXA1 v2 p+ G1 a7 i4 e
  752. PHA- y9 \5 b5 |  n% P# F* t9 w
  753. LDX #$00
    ! N' r+ O+ I2 z) V1 |1 Q- x0 e% C% b
  754. LDA #$00
    4 A4 X5 w: Z+ U+ G( s) g- w  M1 {
  755. HEX_Cln6 a# Q: a0 I) L& O& `1 z8 r
  756. STA DEC_H,X
    / _2 I* i5 `! L" i9 Y
  757. INX5 X" |' T( z" \9 z$ q
  758. CPX #$03; s- G/ h* b) r3 K* k
  759. BCC HEX_Cln
    " `7 z# X# E% o% }5 R
  760. LDA HEX_Data3 H6 ]+ U3 z4 S+ r- ^
  761. ;------------------------------
    3 \0 u3 W# P& a: c7 v, ^0 X  P3 I
  762. HEX_1008 O# ?6 D, \+ v2 t7 o
  763. CMP #1001 T+ i6 B  V/ }& h0 F( |
  764. BCC HEX_10
    , I6 h! O, @( L9 V5 H' O1 p0 J
  765. SEC2 B3 Q9 s2 `0 v8 m% h+ x
  766. SBC #100
    & A0 D8 T$ S0 E' i& ]9 O
  767. INC DEC_H
    & F9 Z  b7 ]# [$ |" u
  768. BNE HEX_100+ i1 j6 u  ^% V: Q. j
  769. ;------------------------------
    ( G. R  A0 W( V  c% D% m
  770. HEX_10
    ; J: t% w. E' K8 K8 b
  771. CMP #10
    3 e/ d; H, `7 g7 Q- K8 ~& H! h
  772. BCC HEX_1  ]/ c. j. n5 L2 _# S" _  p7 c' P  m
  773. SEC
    / V  R8 p( V4 d0 X( _; C& o; s
  774. SBC #10
    ' f7 H& M; O, Q) }) K. x( a
  775. INC DEC_T  ~% w9 F9 P0 D4 q+ {7 ^  G
  776. BNE HEX_10
    3 d! m$ |$ F' R* G% P, q* Q
  777. ;------------------------------
    # G: x7 V, q) Q+ ~; Z9 U
  778. HEX_1
    ; p, ~0 X! K. V7 D0 ?0 L. Q0 H
  779. STA DEC_L
    9 F5 T4 S; V& _
  780. PLA
    9 U' S6 \% m) I& A* [) V
  781. TAX
    # E* K9 z8 x7 J5 R
  782. PLA
    . N4 Q9 v+ o) f; B. g
  783. RTS
      j. n/ Y0 @5 ]7 A& F
  784. % B) m+ [$ o+ J5 F# k
  785. ;==============================
    . v" S6 H$ w5 t8 z, `4 [) O7 D  D0 i
  786. ;音乐曲目显示5 F  T% D  O3 }' ?/ f
  787. Music_Show0 w0 P+ B( T3 T. ?
  788. LDA Music_Cur2 R. l. p( n# S7 h3 h' G0 z6 k
  789. CLC
    ( g4 a7 T; j9 s- e: `/ e! V7 v6 |
  790. ADC #$011 x6 z9 h4 Y3 |9 r1 k9 W  X9 |
  791. JSR HEX_To_Dec1 \/ W6 I- q, u
  792. LDX PPU_Cur1 p2 E: ~4 G  y% V+ E
  793. LDA #$FD0 z7 J& T7 Z6 J5 `1 ?3 i
  794. STA PPU_Addr,X
    3 X& L. {# D( c
  795. INX$ j0 E$ q8 c+ |( G
  796. LDA #HIGH(Play_Index_Pos)
    2 w& p5 Z2 [/ |# _3 h2 i  v
  797. STA PPU_Addr,X/ |# ?1 F4 g8 Z2 N0 I
  798. INX
    2 C4 I. {! l# j) V' F( e: j" l
  799. LDA #LOW(Play_Index_Pos)  h0 _3 @: J: Y: Z- Q6 c
  800. STA PPU_Addr,X5 d& T- p5 i6 D. K
  801. INX/ E8 E0 {! l9 u) e: t5 Y7 c
  802. + e: _( W' _0 q( S1 ]9 K
  803. .IF Music_Song_Total > 995 C% O+ j6 T' U; R# }2 x
  804. LDA DEC_H5 ]3 Y. ~! ?9 Y5 m( K, B( K
  805. ORA #$30
    7 p, O& P3 O9 t( E4 g
  806. STA PPU_Addr,X
    9 B  @% E2 F: V8 l' r/ c0 `
  807. INX0 H0 P! H: R8 ^0 l3 g4 y/ @7 T
  808. .ENDIF$ K- c5 q8 v5 b2 y& v1 G

  809. ( q; _0 G# A# U0 d$ X, C. m
  810. .IF Music_Song_Total > 9
    : C+ G& z' J" U1 _! |( h7 }  ^
  811. LDA DEC_T
    + M- ~9 H2 V2 t% r
  812. ORA #$308 Z: A2 z& ?8 P' g7 a+ V, [# k! b$ w
  813. STA PPU_Addr,X. [2 t- F  {: B8 n. {$ ?, ~4 ^
  814. INX
    7 Q4 o9 F; w) v- v$ V9 N9 p- U
  815. .ENDIF$ s, |7 B& b4 |; l4 M8 E+ d
  816. 8 `9 S  A/ {7 C( F! }
  817. LDA DEC_L/ r# ]8 L, N  n3 H; o6 n4 N3 B
  818. ORA #$30
    $ r% k9 U+ ?4 H3 ^9 Y/ d
  819. STA PPU_Addr,X
    - ^  T' i; q/ i, d- F
  820. INX
    5 [$ G& ?& f* {3 R
  821. " d, i; s) H' ^) t! n7 x+ F7 P' ^
  822. LDA #'/'
      H9 z0 W! b! S  d" h2 G6 o
  823. STA PPU_Addr,X: ?$ `7 v# I+ p
  824. INX6 Q" O7 _0 f. J# g2 [8 v4 Q" j  m
  825. Music_Show_Total
    1 ?2 i! t5 Y, F( F4 i
  826. LDA #Music_Song_Total; R! ?. E4 X# n. Z
  827. JSR HEX_To_Dec% M9 D+ U7 T$ a: N" w0 {2 m( y- r
  828. 1 G$ v+ M5 h3 J' D5 d" l& j8 v) }
  829. .IF Music_Song_Total > 99
    + N$ ?$ K9 C0 V4 I8 ?- H9 m
  830. LDA DEC_H
    : Z4 K0 S7 w" G, w' H/ g5 ?( o
  831. ORA #$30& E1 c: V8 P' `$ s/ u1 \% B
  832. STA PPU_Addr,X+ f/ s. M4 r& |1 y6 T
  833. INX
    5 |" _% b2 ~3 z
  834. .ENDIF2 p: o* D' X; z" S- w1 g5 D" C
  835. / x. C4 I5 a$ H
  836. .IF Music_Song_Total > 9+ ?# q% t' n- K  Y% r6 ?7 }
  837. LDA DEC_T+ h0 i! X& L$ p
  838. ORA #$30
    $ q2 I3 h6 l2 E8 @: ?7 m
  839. STA PPU_Addr,X/ a9 v) x) q/ ], ^& D
  840. INX# Z, T7 ^) G2 W
  841. .ENDIF' j4 r: K) ^) ~4 D. p! L

  842. + i2 B9 ~  E7 j
  843. LDA DEC_L
      `* L& c; I1 R2 Y
  844. ORA #$30
    8 o, i. c6 z0 j: y
  845. STA PPU_Addr,X3 w5 o0 _7 ?* a; I
  846. INX5 i$ _) k+ Y3 @0 [. S% p9 W

  847. , `/ Y1 b: f* F
  848. JSR PPU_End0 {: e" _( t$ w; n- m5 V
  849. Music_Show_End- g. a9 R: }) X% a; D) p; o& d  i
  850. RTS
      u  h2 J* a  l! [* `9 t6 e, ~
  851. " H: n( K% \  C
  852. ;==============================
    4 G: @4 c5 ?6 g4 {& g# W
  853. Time_Show;播放时间显示
    : W* R0 m* `- u7 E
  854. JSR PPU_Addr_Set5 x# k: o& k3 j) z. H' e
  855. LDA #HIGH(Play_Time_Pos): h. {6 s/ _: E8 N
  856. STA PPU_Addr,X
    4 |# w- v- t9 [  B' m
  857. INX: W; D0 p1 M6 g; w& [: J
  858. LDA #LOW(Play_Time_Pos)
      r1 ~; b3 _4 E" n
  859. STA PPU_Addr,X
    . v& P4 z$ j5 S( c
  860. INX6 E$ ~9 k3 \0 I' p+ ^
  861. Time_Show_H; R0 B' a% C1 [( p' I2 n
  862. LDA Time_H# B0 E$ Z# l& T/ a7 I
  863. JSR HEX_To_Dec4 k5 C1 S9 U& U' |: M  _/ H
  864. JSR Time_Digit
    2 D, I8 K# f6 M
  865. LDA #':'
    + f" {5 o/ L/ s3 {3 D- F% X" [
  866. STA PPU_Addr,X
    3 A" z6 P; p" N% z7 d7 @+ X  T
  867. INX
    & ^: ?+ c' q! t
  868. Time_Show_M7 q; b+ u( T' c2 C5 _; W" N( `! u
  869. LDA Time_M
    * {7 J# p- @* B6 I9 q
  870. JSR HEX_To_Dec
    2 i, c' @: n8 ?1 v! I# h" Q
  871. JSR Time_Digit/ E9 y8 x: D9 |$ j- K8 g8 r# U$ v2 [
  872. LDA #':'
    " ?$ m7 s3 O+ g  T. b
  873. STA PPU_Addr,X
    4 O' ~- @8 P5 b' x/ K
  874. INX
    - W9 x6 m  I1 O5 ]) a; ]
  875. Time_Show_S$ q' p" }9 M( x- b8 X
  876. LDA Time_S' x; e6 X' D9 i6 A- @9 C& W4 @
  877. JSR HEX_To_Dec7 b& O- X. s# N* T/ I; C
  878. JSR Time_Digit
    0 z5 M( v% K5 L8 j$ R6 w
  879. JSR PPU_End
    " C% W, e, I$ J5 O" r
  880. Time_Show_End6 U# V  u# q* T7 a9 D
  881. RTS
    3 V& n0 M" j5 ^6 a9 r8 }( d- b
  882. 9 w1 }5 I% _( ?& {# ~
  883. Time_Digit
    . M1 {$ j6 J! p) o. X6 [1 _& \4 f
  884. LDA DEC_T
    % t9 W% |1 G* F' |3 `
  885. ORA #$30
    . c1 B& ~4 X/ p# g
  886. STA PPU_Addr,X
    - m- H1 ]( v& |+ v* ]
  887. INX, e% `9 ^+ L; \" C+ C
  888. LDA DEC_L/ \; T! G, E/ Z/ `$ M
  889. ORA #$30
    $ Z9 o) j0 y7 `1 M! B# ?8 ]7 z# a7 p
  890. STA PPU_Addr,X
    / N, @- U3 g0 M- ]$ I+ b7 _
  891. INX
    ; b8 V) m; B! H8 w5 i! ^; j) ?4 w. R
  892. RTS
    $ D! V% D/ d1 n! I# T1 e

  893. 6 a9 I/ J3 ^. n' i( ]) Q
  894. ;==============================
    % }5 E: b3 B6 d# b2 f. z! ?, z: X1 v  _; q
  895. Time_Count;计时/ g( Y. u' b2 L
  896. LDA Music_State6 N; ]- o# I" `" g" M" {
  897. ORA Time_Wait_Cnt5 v# v2 `6 o) b( y
  898. BNE Time_Count_End7 M2 R. f0 u* d9 T# O2 X* A
  899. INC Time_Cnt
    0 u4 r: l4 K$ t4 W: w, A
  900. LDA Time_Cnt
    * k1 \; @" v4 \1 i& B7 Z# L
  901. CMP #60( U: @% f" }6 L4 a
  902. BCC Time_Count_End% F# p. I. {( F0 t" d) J) x0 W3 s+ z
  903. LDA #00) |  q$ f' U& r! }( F- h
  904. STA Time_Cnt  R3 F' I. N* C; r+ r
  905. INC Time_S7 H# Y& j: w" W' D" r' B
  906. 9 D# |1 R  \/ x+ A6 M" U3 b
  907. Time_S_Cnt8 o8 f9 B6 n4 o6 q! C$ l( ~/ g
  908. LDA Time_S8 y1 e) H3 E2 y
  909. CMP #60
    % {0 \; [, \$ Q
  910. BCC Time_Count_End
    . S- T% k% z! Z( o  N
  911. LDA #00) @! H& u& T: }, c3 G
  912. STA Time_S! x) F5 ?( L. K/ s( ^, Z6 |
  913. INC Time_M
    ) C5 f, ?- P3 w& r: L% O+ b$ G
  914. 3 c+ A. q9 m; y: p+ v$ ?7 d
  915. Time_M_Cnt% s$ ]6 R9 @' ?
  916. LDA Time_M
    & P' Q$ L8 I0 ]+ x* T  ]
  917. CMP #601 c. g9 L. Y) b! D1 l
  918. BCC Time_Count_End
    1 X3 r! q3 j) N- X9 `
  919. LDA #007 ]6 p* F! \& P( e( X) b* L
  920. STA Time_M
    5 ]7 L/ M. C2 G7 B6 U# Z% d
  921. INC Time_H4 C7 J: o* E8 [! N6 {# x  `9 R+ u
  922. ' F: H* N' U. b4 L% c7 h  d
  923. Time_H_Cnt
    ) t- C  B; U1 J* E0 K
  924. LDA Time_H2 Z4 B4 L' f" h% N
  925. CMP #246 j, k# ]6 r( G' A$ P
  926. BCC Time_Count_End/ U/ o7 D7 F. N4 e2 n  S$ x
  927. LDA #00
    + l0 R' e2 o% G: X5 O0 O9 p7 y7 U
  928. STA Time_H" e+ }4 _  h' J7 t& W) T  p

  929. 3 f8 D7 n3 t( S: C3 Y1 A! M
  930. Time_Count_End
    , e: ]3 _% V: H! T
  931. RTS+ {% K7 _4 C* a- g5 y9 N, O

  932. 7 d4 h8 R+ @% j6 n. x
  933. ;==============================4 p; U, k" I5 d1 g& [4 A8 ?
  934. Time_ReSet;播放时间重置0 ?) P; l0 m, g1 ]$ D
  935. LDA #$00( I' A, u( c5 Y. |. Y
  936. STA Time_S! `- \9 q2 ?- s- K: p
  937. STA Time_M * a) l/ C& I* W0 G- e+ v8 O* `3 I
  938. STA Time_H& b' G# U) y7 z" B
  939. STA Time_Cnt9 U% V+ k. d6 O5 e4 M$ s! v& b3 C
  940. RTS2 P, h' @+ p5 K( d2 L: L3 ]' Y

  941. 6 Y" Q* O7 j. j
  942. ;==============================9 G" q% W) H) ?6 w5 ?
  943. Music_Bar_ReSet;音乐条重置
    , e) r6 F4 Z$ P  m6 P
  944. LDA #$00& W; N) C" A  G7 e( [" |
  945. LDX #$00
    : X, o+ U/ c5 q2 C* Y8 y- _- h
  946. Music_Bar_ReSet_Set. w' C0 B: w7 l$ C9 ?# M& H# U
  947. STA Sound_Bar,X
      a, B% h/ J1 a( J% P% ^2 i2 U
  948. INX$ h  i, h8 h* p& u% f+ B+ b& ?
  949. CPX #$107 p! Y# r2 y2 v) I: M
  950. BCC Music_Bar_ReSet_Set1 V3 n; G- r, M" L" k) K
  951. RTS, q9 d- C  l) x$ C- {& P( ^

  952. ' j* J8 x8 A: Q1 c- i0 f8 Q$ ^& d3 C% n  T
  953. ;==============================
    . k! B' ]4 @' H- W6 M3 k
  954. PPU_Data;PPU数据写入
    ) V4 _+ x& x2 x& _* m3 Y, n
  955. STY Data_L
    $ ~" L/ V4 V+ t; n/ v
  956. STX Data_H
    1 K8 C8 v/ ~9 r7 L0 W" b) U
  957. LDY #$FF
    1 A2 H) X5 {' W
  958. LDX PPU_Cur
    ; A; D' Z. _( |+ m+ ~, s) n
  959. DEX: l5 O( `2 Z) M  E
  960. PPU_Data_Beg9 ^+ t2 }. Z6 F9 N+ O
  961. INX; Y- m% B0 ]" n1 n' n3 M3 A
  962. INY" I- R/ |5 h: L. a  D( [
  963. LDA [Data_L],Y
    # T- @: x6 Q4 `/ ~! R4 b
  964. STA PPU_Addr,X
    4 g: o& \9 y1 S% V
  965. BNE PPU_Data_Beg4 ~4 `- k7 ]$ W7 j; u4 j
  966. STX PPU_Cur
    # D" }3 Z7 X$ P2 ^( B
  967. PPU_Data_End
    9 @1 }/ u' Z* c5 Z% }4 B2 t
  968. RTS! h" b; C$ L8 {

  969. $ v- [! [+ J$ O& v$ v& V
  970. ;==============================+ w8 g% Z" T% q  w! n* W  D
  971. Music_Stata_Show;播放状态显示" V# p4 }; [) q* _/ }* Y8 d7 H+ L
  972. LDA Music_State
    ( J) d: N. k+ x/ \9 V& m8 n
  973. BEQ Music_Stata_Show_Play6 n7 d- b9 A+ a3 h7 ?3 ^
  974. Music_Stata_Show_Stop
    1 D, F7 i, W$ f1 C
  975. LDY #LOW(Music_State_Stop)# ^1 K' w6 K; n& B; ?* f
  976. LDX #HIGH(Music_State_Stop)' e+ N6 R3 O& T
  977. JSR PPU_Data# ?4 }1 z- K. u/ c
  978. RTS
    : X4 R  g3 x4 `) P; p
  979. Music_Stata_Show_Play
    ) V1 f1 [* ^- E
  980. LDY #LOW(Music_State_Play)
    1 O0 E& i" v0 l/ L8 O2 [
  981. LDX #HIGH(Music_State_Play)
    1 p# L0 l) _# s7 O% c; t* Z; [
  982. JSR PPU_Data' ~, X' f1 I! t; k( V2 B. q
  983. RTS4 I# ^/ }- ~0 B( c* p5 o* G
  984. & ?7 A: ^2 B6 V! S9 K+ Y
  985. .IF SOUND_BAR_SHOW_ENABLE8 n3 n4 Z- [) B
  986. ;==============================# C3 {- L0 x) {6 V& R
  987. Sound_Bar_Text_Set;标题与音乐条初始化
    $ b9 C7 {$ y7 t8 F' v/ W2 `
  988. LDY #LOW(Sound_Bar_Text_Data)$ l" e$ e* h1 d+ b8 j
  989. LDX #HIGH(Sound_Bar_Text_Data)
    7 k: ?% M. g$ M9 A  l) B5 k
  990. JSR PPU_Data
    # D2 o/ q8 G2 `1 n5 x
  991. RTS
    1 q) }7 S4 c* s& N* b# A

  992. 4 z$ L, L- i! M  H  ]
  993. .ENDIF
    2 I$ ]' \# I& b) ~% x5 G

  994. 2 J" J! a7 d! v5 c% b
  995. ;==============================5 B0 Z7 Y# t" V9 }  U
  996. Set_NameTable_Attributes;设置命名表属性
    - T9 S4 |. e7 X5 \4 I# n0 R4 _
  997. LDA PPU_STATUS6 c- t7 n! |0 b( K# V" i) O
  998. LDA #$23" l; u8 H3 u! a4 I( t0 Z
  999. STA PPU_ADDRESS. y2 p9 C* e! L1 Q! G2 u7 O
  1000. LDA #$C0
    6 v0 K" Q2 r. u# C
  1001. STA PPU_ADDRESS
    7 I" x5 H1 b7 s+ `( M$ @+ X
  1002. LDX #$00
    + k6 J; R, D- t, e, d! r$ U$ Z
  1003. Set_NameTable_Attributes_Write0 ~8 k; k( R, L# x
  1004. LDA Palette_Attributes,X" W* t: L( Z3 r1 a/ g
  1005. STA PPU_DATA# t% ?+ a, E& Z' K2 Z
  1006. INX
    0 J5 Z% u# \2 O
  1007. CPX #$402 v4 r# {+ Z) C
  1008. BCC Set_NameTable_Attributes_Write
    / a0 e( N$ s2 k# h6 O
  1009. RTS1 V* l0 Y+ H  y+ @9 e, [8 Q1 E, n

  1010. 8 o" x& K5 b" U, o
  1011. ;==============================
    + }" X# }; ?" f) w" _$ g1 I8 L; }( i" m
  1012. Set_Palette_Color;设置调色板数据
    $ x# E  ?7 ]4 b  B
  1013. LDA PPU_STATUS8 f5 a4 v5 @1 g9 D; F
  1014. LDA #$3F
    ( S, L, W2 w4 ^8 m
  1015. STA PPU_ADDRESS
    ) K5 E# D# g/ L1 {' D  k
  1016. LDA #$006 h: E1 l$ E' i2 ?5 t$ L& V
  1017. STA PPU_ADDRESS" }7 T5 y$ H( S  l' _! z
  1018. LDX #$00
    2 ~) w8 B; U1 @; n5 U
  1019. Set_Palette_Color_Write$ l% Y$ `" s' B" o. N6 @# m5 O
  1020. LDA Palette_Data,X! }* E0 V7 {7 k& J
  1021. STA PPU_DATA
    ) j" |( u! i( X" [* U6 G$ y  B2 ?
  1022. INX2 |* |  `. D" B$ S2 V5 A8 m9 I3 T
  1023. CPX #$208 M, u" L) c2 ?4 E4 b/ W
  1024. BCC Set_Palette_Color_Write" L! |3 V& T6 h! B. s: x1 v# G) ]
  1025. RTS
    $ n/ p- p. ~/ {7 z1 N/ ]
  1026. 1 m( u9 S: ?6 A3 U1 I" j3 e7 z  ]
  1027. ;==============================  V9 ^$ n9 E0 e
  1028. Init_Palette_Addr;初始化调色板数据" A6 p1 |4 t/ E3 E
  1029. LDX #$00, P8 m& S$ O3 Y
  1030. Init_Palette_Addr_Write. H) v, d* n+ a3 s# W/ C8 H
  1031. LDA Palette_Data,X
    ( X3 |4 A1 _  b+ O9 D
  1032. STA Palette_Addr,X+ }# j6 z) m% E0 M" l+ v7 }
  1033. INX
    - {8 n6 X% f* V$ z
  1034. CPX #$202 {: K$ ~; t5 R4 N1 w- V
  1035. BCC Init_Palette_Addr_Write3 b, @- c7 ~" Z& C1 K+ Q
  1036. RTS" Z- w% E7 R' B% d1 i

  1037. / l3 n! e% F  n" B/ P1 t
  1038. ;==============================& I& G, i( j, {
  1039. Update_Palette_Color;更新调色板颜色
    ' n/ X, n3 T) a
  1040. LDA Show_Track_Name% a1 q3 j' m: K; s/ Y) @$ P
  1041. BNE Update_Palette_Color_End$ V1 |0 U- e: ~) W2 D; L( s
  1042. LDA Palette_Update_Flag( E& @: S% z& s2 i& d
  1043. BEQ Update_Palette_Color_End* s' M; v2 R# o- K
  1044. LDA #$3F  C8 k% M/ |2 q! L
  1045. STA PPU_ADDRESS
    8 W0 p0 I; Q7 Y' b/ {6 k
  1046. LDA #$00
    % a+ w, Z& g+ ~% B5 C' Q
  1047. STA PPU_ADDRESS
    * ?2 \/ t: q3 h6 I# b& c/ V
  1048. LDX #$00
    4 b3 }, N% O; p: k# ?
  1049. Update_Palette_Color_Write
    ! I' t7 {% Z* T1 T3 \/ Z
  1050. LDA Palette_Addr,X
    ' L3 o# G: @/ S. Y  b
  1051. STA PPU_DATA, ^6 S0 V7 L" }# p( W) j
  1052. INX6 T$ M" z1 n  L7 W0 |4 _
  1053. CPX #$20
    + E7 J5 q' P5 C
  1054. BCC Update_Palette_Color_Write# ]' C  w8 ?5 h1 ^
  1055. LDA #$001 `( N4 n1 ]+ Z6 E: \+ F$ Z
  1056. STA Palette_Update_Flag  }5 L, p  d4 A  G: X7 r
  1057. Update_Palette_Color_End* [* k( N) r6 h0 ^2 j0 B
  1058. RTS& M& D) @4 L  C3 a2 H4 m
  1059. % u% `4 C; ~8 q9 I8 T! z
  1060. ;==============================
    3 @  o( Y' }/ ]- M! ]7 z
  1061. Update_Palette_Data;更新调色板数据) }2 L4 Q+ L& O& ^: R4 }& y- O, ], `
  1062. LDA Show_Track_Name7 `5 I& T. A7 m) {, Q3 P* c
  1063. BNE Update_Palette_Data_End5 D  D9 C  m. B& v! {0 [/ P3 R
  1064. LDA Music_State
    5 }0 u9 X6 t" Q0 {" g3 U
  1065. BNE Update_Palette_Data_End
    ( o" w8 r9 D. T  E$ @
  1066. Update_Palette_Data_Check
    ' l- y" Z( ]* I( Q0 ]
  1067. LDA Palette_Wait_Cnt7 `! B" j8 J7 x1 q$ b
  1068. BPL Update_Palette_Data_Check_Over
    * m! E$ V& c9 P0 ~  W
  1069. LDA #Palette_Update_Interval
    . }# h' H/ `( O' i  `) X, `( ^
  1070. STA Palette_Wait_Cnt
    ! M7 m% a: R9 `# b" T
  1071. Update_Palette_Data_Check_Over2 i0 K" z- v( {7 D& ]( d7 @2 V
  1072. DEC Palette_Wait_Cnt" O* A, g4 a8 v4 p% {. I( m2 @" u
  1073. BNE Update_Palette_Data_End* L1 [. {( @# e; H9 A  d/ n
  1074. INC Palette_Update_Flag" j6 {5 l/ R9 f" G: g
  1075. LDA #Palette_Update_Interval# N9 i4 O) a/ B3 j( w& S
  1076. STA Palette_Wait_Cnt% M+ h8 N. m$ H# W, x5 Q6 f
  1077. LDA Palette_Update_Addr/ T/ B8 c1 y) U3 g
  1078. CMP #Palette_Update_Max
    8 d, G( f# }, B
  1079. BNE Update_Palette_Data_Set
    * ]* @) G. U& M+ E4 R7 d; Z& x
  1080. LDA #Palette_Update_Min - 18 f, @6 J  Y: N, e- U; B3 n. d! z
  1081. STA Palette_Update_Addr
    3 m. @" @- M, |
  1082. Update_Palette_Data_Set* j; u: O3 k8 ?
  1083. INC Palette_Update_Addr
    ) D8 T" {& x7 Y
  1084. Update_Palette_Data_End$ U$ b: A9 l% h- l+ T! L
  1085. RTS4 B3 {% C4 Y+ I/ V0 H

  1086. * v5 n; z5 m. o( R$ `
  1087. ;==============================
    % ?2 f+ t' C4 s- y8 {5 k
  1088. Show_Music_Text;显示静态文本
    # Y, v$ [* w9 A* [: F
  1089. LDX #$00
    / r4 w2 T4 `( O2 Y: f
  1090. Show_Music_Text_Set8 H: D, T5 Q  N/ M! {$ N/ w# M( r% X* |
  1091. LDA Static_Text_Data,X3 ?. n  U# |5 z# ?) X- e
  1092. STA Data_L8 j& j9 p/ K: K) ]! @. _
  1093. INX
    & d, k! Q8 ?0 u: F9 g- R
  1094. LDA Static_Text_Data,X! {2 X2 v  B+ \/ d
  1095. STA Data_H
    ) h' [; c: h4 e; l0 o$ W9 a% \
  1096. INX
    6 j4 I4 A( q2 e( f' }$ |8 I
  1097. LDY #$00
    # }5 k+ e( g% B5 z
  1098. LDA [Data_L],Y
    ; J4 ]9 r. a5 e0 _) z; N
  1099. STA Data_Cnt/ `4 S' u5 |4 b  o6 `5 I
  1100. DEX
    * K! O- x5 G) r* Z2 s; Y7 o
  1101. DEX
    ; J2 A! b: ]* a' G& K
  1102. LDA Static_Text_Pos,X4 ]" d0 [) N0 C% I
  1103. STA PPU_ADDRESS
    0 W4 c" M" B7 V- w7 B
  1104. INX) p/ y& \6 ~& {; f: w( p6 p3 X
  1105. LDA #$20
    ! B" q; \+ p% T+ S4 M3 A6 X, V) e: B
  1106. SEC! s, e! i" o* D" ]
  1107. SBC Data_Cnt8 D- f5 t0 L  r3 A0 h
  1108. LSR A+ Z3 l8 [* G7 Z; h! G: w8 }
  1109. STA Data_Buf
    . D4 @) o4 Z' }3 b3 L
  1110. LDA Static_Text_Pos,X+ p' K  l* W+ S) r, y" D0 v( ~( p
  1111. AND #$E05 x9 A  P3 n, n& F9 K$ ?
  1112. CLC5 c! \. [" K. |" ]/ r
  1113. ADC Data_Buf
    : S1 _5 o  O( `& [  G4 h
  1114. STA PPU_ADDRESS3 i4 k2 n( w/ D* g
  1115. INX
      {+ f, h: E( z% P1 H* k
  1116. Show_Music_Text_Set_Write3 ?! ~( l7 U: ?* L. N+ {, L/ R
  1117. INY
    " V" r. T% D7 |" B" Q
  1118. LDA [Data_L],Y
    1 F6 v0 [# e7 X
  1119. STA PPU_DATA
    9 C5 k) D- t2 D7 f1 E/ Y4 G1 L, [
  1120. DEC Data_Cnt, f( w7 G3 G4 m* z# d! G/ s; p
  1121. BNE Show_Music_Text_Set_Write: v4 e& f/ r- X/ B; |6 }  B9 L
  1122. CPX #Static_Text_Pos_End - Static_Text_Pos
    ) b9 Y& r1 W8 T
  1123. BCC Show_Music_Text_Set; i6 p  B6 U: I$ o
  1124. RTS! c! p" w4 g; U% W$ Y# K$ ~
  1125. - Q5 r- q: L! F* N9 M+ K& ~1 x" D
  1126. ;==============================' p% V' C3 ]& Z
  1127. .IF Track_Name_Pos;显示曲目信息
    2 t' j7 V$ E& M% g
  1128. Show_Track_Info$ v9 B& S& I/ X6 W
  1129. INC Show_Track_Name
    % y7 B+ F! I. j7 Y
  1130. Show_Track_Info_Clear: D6 P# o5 Z3 O  V/ p
  1131. LDX PPU_Cur
    # c* D% t/ \0 Z; N" M- i7 K
  1132. LDA #Mode_Clear
    * k9 i  x0 h' w. g1 U& s
  1133. STA PPU_Addr,X
      c/ r/ w# w4 Z. z8 U' u8 k  X
  1134. INX; {# `# s& R2 V% A

  1135. 8 o3 v1 M# B; r6 |; P# u
  1136. LDA Music_Last
    4 [( ?  c3 k- d4 e, a
  1137. JSR Show_Get_Track_Name_Center_Pos1 M- u/ f+ O3 e' w9 |- c
  1138. Show_Track_Info_Write_Cur' y* x3 z# x. X$ \" C2 ]
  1139. LDA #Mode_CntLine( a3 f9 ~; \' n
  1140. STA PPU_Addr,X
    1 g- P2 H5 k' e! D6 ?  y4 R- l$ h
  1141. INX
    : h* }$ e) D; r3 l) c" q8 Z6 E0 L
  1142. % n, j0 w/ j1 K+ K* j- c0 E. k
  1143. LDA Music_Cur
    + o0 i8 b' g/ q
  1144. JSR Show_Get_Track_Name_Center_Pos
    / K3 W/ O2 j& g+ p
  1145. 9 I$ G  p/ [/ G7 q( E4 H7 G+ ~0 Q
  1146. Show_Track_Info_Write_Cur_Data
    9 y1 y/ [; `$ C$ S: I# _! @
  1147. INY; X, M" v. G2 n) ]/ K0 o
  1148. LDA [Data_L],Y  P- k& e8 ^& z! _; ^! M3 V
  1149. STA PPU_Addr,X6 ~6 |# L9 r3 s( g  K6 U
  1150. INX9 z* d1 J+ I, s0 n& |4 ]; l; v, l
  1151. DEC Data_Cnt. }& t& j; K' u2 p* n5 b5 J- g( V
  1152. BNE Show_Track_Info_Write_Cur_Data
    0 z7 Y- v$ D' }% x1 T
  1153. Show_Track_Info_End: J0 z, i' l. p) c, Q
  1154. STX PPU_Cur( K. ]8 i% r" p( U3 f
  1155. RTS" h! N  w" T3 X# e

  1156. % k3 U/ r3 F' ^2 A: V& x
  1157. ;==============================% o% ~' c1 b, B8 k( ~: G  O) `3 l0 N
  1158. Show_Get_Track_Name_Center_Pos;获取中间位置
    8 h  B/ X8 Z; U+ Y. }; Z: B
  1159. ASL A
      ^+ l3 _; ^2 c/ P0 [: ?
  1160. TAY
    # k. v3 j7 q; J+ V8 M' W
  1161. LDA Track_Name_Addr,Y7 O% J# G) e+ v
  1162. STA Data_L
    4 [3 a" ~0 B1 ~8 y
  1163. INY
    8 e: A$ ^% Q& e: ?4 L# _& X3 a0 i
  1164. LDA Track_Name_Addr,Y
    : s3 `% |! r5 q+ m1 t* S
  1165. STA Data_H
    . Z8 L5 T2 d2 x* q- c
  1166. LDY #$00
    ' Q. g9 ?) t8 P* r! G
  1167. LDA [Data_L],Y) [+ k( o) F8 Q# N2 |7 A3 F
  1168. STA Data_Cnt
    # f$ n0 L2 D3 c7 e/ u0 S1 D: ~
  1169. LDA #$20! E# n5 a' b" d! U# G3 Q7 A( u# |
  1170. SEC1 K. @. ?6 R+ g) Z- t9 S
  1171. SBC Data_Cnt
    - ]' z$ x4 [; J* y) Q$ f1 [
  1172. LSR A
    # a" F- b) K0 R5 m) K: G7 C
  1173. STA Data_Buf7 g1 i' J; ]2 B- k
  1174. LDA #HIGH(Track_Name_Pos)
    : g- R/ H8 V* D8 i( }1 ~
  1175. STA PPU_Addr,X
    . M! m# a0 D# e. Z1 ?) p
  1176. INX8 N$ ?3 [* r- h1 W
  1177. LDA #LOW(Track_Name_Pos)) K' D) ~/ L! o0 Z! b- u( a" H% k
  1178. AND #$E0
      K# [* l0 N( o. Q
  1179. CLC8 ^4 q1 s: x# P! c2 z$ u6 q* A; E& N
  1180. ADC Data_Buf9 B7 q: J2 y( n8 E
  1181. STA PPU_Addr,X; \. j' T, }! Z/ v  R) O9 M
  1182. INX9 a( J5 M! G- C7 m6 f
  1183. LDA Data_Cnt
    3 n3 I: E$ j/ e
  1184. STA PPU_Addr,X
    ; B, [* r$ u* z1 o
  1185. INX
    8 M' o7 b" _9 V: p: Z9 V2 X
  1186. Show_Get_Pos_Center_End7 _3 v3 s& l' y
  1187. RTS
    ; x2 R- _& Y. F7 [6 C
  1188. .ENDIF7 t  O8 y+ s- O1 I$ h, A

  1189. : {5 y& j9 I4 s+ c# ]3 Y' Q/ Z
  1190. ;------------------------------
    & ?( J3 i6 i2 P
  1191. ;命名表数据
    2 [. M3 f' _# ]7 q, I$ R# @. D
  1192. Palette_Attributes
    , ~0 D( x. Q! s9 Y: K( L
  1193. .IF SOUND_BAR_SHOW_ENABLE8 _5 |: _" p5 E' }2 R' i* x
  1194. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00; X( u/ w$ o6 f* S& u
  1195. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$BB,$AA,$AA,$AA
    + A' K7 o: l: X+ q9 k) n9 e
  1196. .DB $0F,$0F,$0F,$0F,$0B,$0A,$0A,$0A,$55,$55,$55,$55,$55,$55,$55,$55  R- H# X& b5 S
  1197. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55( V* M; g  y- a9 u
  1198. .ELSE6 t) `# \9 y0 \, g
  1199. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
    % Y4 U2 u- @/ c
  1200. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF* u; o5 \8 W  `. x
  1201. .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$55,$55,$55,$55,$55,$55,$55,$55
    8 u3 q& f4 c7 T! R- N' E
  1202. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
    4 _4 u9 I7 ^5 b6 o* y
  1203. .ENDIF
    5 f2 H% a5 L+ x, t
  1204. ' s6 I6 R) Y" Q
  1205. ;------------------------------" h' u( y* Q3 L
  1206. ;调色板数据! f/ S1 m6 r7 D! r
  1207. Palette_Data
    ( C5 Q, \  h0 |( t# C' W
  1208. .DB $0F,$27,$20,$0F,$0F,$24,$20,$0F,$0F,$21,$20,$0F,$0F,$25,$20,$0F
    ( [; S$ z' P& y# Z
  1209. .DB $0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F
    $ H  |7 \& J$ F. _
  1210. 7 k- ~5 o% C7 U4 }$ r0 @
  1211. ;------------------------------" o8 A, C% V5 {# f9 ?
  1212. Static_Text_Data
    9 F1 s, G9 ^: c# m1 _2 y
  1213. .WORD Static_Text_Title_Data
    5 m- a& y6 x: ]! w- R* z3 v: h
  1214. .WORD Static_Text_Author_Data3 u( h* l- T& h! H) a1 Y
  1215. .WORD Static_Text_Date_Data7 ^' |/ E+ l3 I( v9 X, E6 P4 s
  1216. Static_Text_Data_End" V- l, t& O+ U! _+ a4 M- ~7 e
  1217. * j, F& I) A$ p4 d- `. _, a
  1218. ;------------------------------
    # {7 Y1 A% a/ F) t. W+ c
  1219. Static_Text_Pos* M3 Q6 ]$ R4 ~; [# }
  1220. .DB HIGH(Title_Text_Pos),LOW(Title_Text_Pos)
    * e) C1 W- T0 `9 K
  1221. .DB HIGH(Author_Info_Pos),LOW(Author_Info_Pos)# Z8 s5 N/ b, s" W5 q# `
  1222. .DB HIGH(Date_Info_Pos),LOW(Date_Info_Pos)( w1 C$ V+ N: x/ ^9 F
  1223. Static_Text_Pos_End
    # B* {9 t/ g0 L! d8 h/ M: \

  1224. 6 a) G+ n: a$ w
  1225. ;------------------------------$ i& l6 I! k+ J
  1226. Music_State_Stop& D: X$ k" t; J3 i! ?) ^. L1 ?6 f
  1227. .IF SOUND_BAR_SHOW_ENABLE
    . B# A+ u! k- L. h; V6 Z
  1228. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"STOPED ",$FF,$00
    7 W& ?0 G! h' _
  1229. ELSE5 o& w( U3 d& A  }4 P& M
  1230. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos)," STOPED",$FF,$004 y9 i! q- U' Z( m3 {" u; ]% f
  1231. .ENDIF
    & q. T6 _- |- d
  1232. Music_State_Play4 p/ K% W) Y; f8 M, @$ W6 p
  1233. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"PLAYING",$FF,$00
    " N$ h; j  z: P) P/ k& G' P

  1234. % ]7 ~  V) u% Z! M: Z6 F9 J3 V
  1235. ;------------------------------, p2 }) t$ }( G3 a1 W
  1236. Sound_Bar_Text_Data;声音类型文本
    4 B( d0 b$ m6 h
  1237. .DB $FD,HIGH(Sound_Track_Pos),LOW(Sound_Track_Pos)
    ; ]. |8 K# x6 M6 O) }: F1 {
  1238. .DB "SQ1-",$FF
    7 ?, _5 f8 K' _+ A5 P; m! i+ g
  1239. .DB $FE,"SQ2-",$FF" A$ x9 O# U7 l# _, L
  1240. .DB $FE,"TRI-",$FF
    " ?9 |0 f3 n" D7 C5 s* |$ Z
  1241. .DB $FE,"NOI-",$FF
    1 T1 g; a  Q$ @
  1242. .DB $FE,"DMC-",$FF,$00
    - r- C- u' I9 d
  1243. 1 i! {, E: v  Z
  1244. .IF Track_Name_Pos
    0 K) o# G4 Q: h( R7 n
  1245. ;------------------------------
    - R. a# @, U# E9 W
  1246. Track_Name_Addr;曲目名地址索引2 |6 Q( C4 k0 L. w6 [8 r- E
  1247. .WORD Trackr_01
      ]9 V" n  @3 a; X
  1248. .WORD Trackr_02' U1 S0 H- [" d& n
  1249. .WORD Trackr_03. L- j, a, T- i5 p3 r+ `! p
  1250. .WORD Trackr_04
    $ i3 i1 t( w1 Q) P& z
  1251. .WORD Trackr_05
    : {1 P5 v" _: n1 D3 M2 |
  1252. .WORD Trackr_06+ D+ c9 T; }* u+ U
  1253. .WORD Trackr_07
    $ P$ E+ ?7 ^( ]
  1254. .WORD Trackr_087 o+ A" {9 i$ T( @" w; g2 x( n1 w" \
  1255. .WORD Trackr_09
    ; G3 B7 T7 A2 `
  1256. .WORD Trackr_102 g1 n$ s$ M7 m0 l0 r
  1257. .WORD Trackr_11
    / q+ ?( `9 e* p( A) @) U# @
  1258. .WORD Trackr_12
      L5 X9 o% Y- r& V  [5 }
  1259. .WORD Trackr_13! c- f' r0 ]: D% |
  1260. .WORD Trackr_14
    . S$ [1 r1 D5 O8 {7 R
  1261. .WORD Trackr_15
    . L; v: V, c8 K, ^3 z$ N
  1262. .WORD Trackr_166 o* \( f" A7 a3 B* P( `
  1263. .WORD Trackr_17
    4 v2 _' U+ g- ?7 b% m! Z
  1264. .WORD Trackr_18
    7 T7 d* @3 {1 S0 ^  a
  1265. .WORD Trackr_19
    5 ?2 x5 X( n) x* j/ O) O# b
  1266. .WORD Trackr_20
    ! k' E- L( K4 [1 r: f4 e& X
  1267. .WORD Trackr_21( G& N  I7 Z9 W* M6 U2 ?
  1268. .WORD Trackr_22
    % g2 P5 w( g: H2 a( j0 f
  1269. .WORD Trackr_23
    ! i$ H7 X6 ]+ G: }/ I" d
  1270. .WORD Trackr_24
    : g) h0 t; i$ b. ?4 u3 |
  1271. .WORD Trackr_25
    1 J: P1 G5 Z% [( P6 X
  1272. .WORD Trackr_26
    1 y) L$ S: L! W$ c/ t
  1273. .WORD Trackr_27
    ! D' r3 q6 ]8 Z4 i1 C! U
  1274. .WORD Trackr_283 k& T( c8 K( C6 l* `
  1275. .WORD Trackr_29
    ) f3 w0 J5 M( S1 a1 q+ J* L
  1276. .WORD Trackr_307 ^1 k* i' ]" O1 \2 {
  1277. .WORD Trackr_31
    . D2 f3 m2 E2 i* o% e
  1278. .WORD Trackr_320 G  b7 x+ z/ {
  1279. .WORD Trackr_33
    " i  e! G% a$ `* G9 T
  1280. .WORD Trackr_34
    ; H9 p* `7 d) x: K7 G
  1281. .WORD Trackr_35
    4 [3 h3 ^2 v5 D8 O
  1282. .WORD Trackr_36
    : O1 W; F0 s" u- v7 e/ W$ B  M
  1283. .WORD Trackr_37: f4 |% v/ K8 I3 s7 Z5 l
  1284. .WORD Trackr_38
    / P4 N2 M) b6 ]* f, I* T/ Y
  1285. .WORD Trackr_39
    8 f- e. k6 @8 o1 V: d6 j3 N% a

  1286. ( T  m$ A* L1 ?) f
  1287. ;------------------------------* ^0 d" B8 C4 [
  1288. Trackr_Name_Data
    ) {0 i6 w, q2 I6 Z% _6 q
  1289. Trackr_01 .DB $05,"BGM 1"
    4 M4 y- @, Z0 K) _$ ]5 U: G- I4 L
  1290. Trackr_02 .DB $05,"BGM 2"/ s. b  a. r2 a1 d1 Z
  1291. Trackr_03 .DB $05,"BGM 3". ^0 }& u$ ?; M, Z- d
  1292. Trackr_04 .DB $05,"BGM 4"& J% ~8 Q0 o6 X6 G, _8 f' Y/ L6 m
  1293. Trackr_05 .DB $05,"BGM 5"
    " m) U/ o2 @4 b3 O) x0 A( j
  1294. Trackr_06 .DB $05,"BGM 6"2 p9 c6 b8 o6 I2 ]; ^
  1295. Trackr_07 .DB $05,"BGM 7"
    2 P2 e( L( x5 s0 q! N
  1296. Trackr_08 .DB $05,"GREAT"
    $ u# |+ [% U2 ~
  1297. Trackr_09 .DB $08,"BOSS BOM"
    9 f* g- J: x1 `, _6 Y
  1298. Trackr_10 .DB $08,"BOSS2BGM"( D' o( }# ^0 e4 W
  1299. Trackr_11 .DB $07,"P CLEAR"
    0 l4 V9 u5 }7 l  F9 ~9 g
  1300. Trackr_12 .DB $07,"A CLEAR"
    8 ^0 @  N# w1 u$ A3 C
  1301. Trackr_13 .DB $04,"OVER"
    7 |* {9 s/ ]" s2 P
  1302. Trackr_14 .DB $06,"ENDING"
    ' t, s: V* u8 l& V' l
  1303. Trackr_15 .DB $04,"SUTA"" B9 n# z' c, ^3 o5 d# w
  1304. Trackr_16 .DB $07,"THUNDER"
    . `! ?0 I) S+ o2 ^* s
  1305. Trackr_17 .DB $04,"SHOT"
    1 k. y/ d- a. \% ?  b
  1306. Trackr_18 .DB $05,"LASER"1 \6 N' H: u3 C1 o1 R: s( |
  1307. Trackr_19 .DB $06,"SPREAD", i& F+ q' r$ o3 A
  1308. Trackr_20 .DB $04,"FIRE"
    7 e& L/ S' S; w6 g6 C" G
  1309. Trackr_21 .DB $06,"B SHOT"# \4 y4 X: k  c4 R3 y8 u
  1310. Trackr_22 .DB $08,"T DAMEGE"
    8 b3 _# O$ x' b6 N" r. F
  1311. Trackr_23 .DB $07,"HARETSU"* \/ t$ u- U0 Q4 }8 L9 l% |
  1312. Trackr_24 .DB $05,"T OUT"
    8 r/ `9 G  E" n* P" U' Y2 i7 r
  1313. Trackr_25 .DB $05,"Z OUT"
    5 }6 m! D6 r$ K' Y$ H5 E; f3 ^# i  A7 H
  1314. Trackr_26 .DB $05,"A OUT"! Y6 W$ @) I& k0 e
  1315. Trackr_27 .DB $04,"ROLL"
    1 S4 U+ J2 K0 S# F! L: ^
  1316. Trackr_28 .DB $06,"APPEAR"
    : W* u" N0 D6 t& U3 F- A2 q
  1317. Trackr_29 .DB $05,"POWER"
    + t6 S" [! u8 t% u: f4 i
  1318. Trackr_30 .DB $07,"BOKK BK"& O8 n; X, i  G$ D) M/ R( ]
  1319. Trackr_31 .DB $08,"BAKUHA 1") Y# l! ^( H$ i6 H; y0 E, _% S0 F- }
  1320. Trackr_32 .DB $08,"BAKUHA 2"
    4 V1 }. K  r+ E
  1321. Trackr_33 .DB $05,"ARUKU"
    : C3 s( g5 ]/ r" m8 H# \0 ^
  1322. Trackr_34 .DB $06,"JIWARE"
    - i/ G7 R* x6 N  m* C9 ~" W
  1323. Trackr_35 .DB $05,"SILEN"
    ( c5 V3 @2 t: c  E# `
  1324. Trackr_36 .DB $05,"P 1UP"2 {# H% x; D7 i1 f7 m6 v' ~* o" Y
  1325. Trackr_37 .DB $05,"P OUT"5 K1 Q+ a- u2 i
  1326. Trackr_38 .DB $05,"B OUT"$ A! X, U: Q6 B- f' T4 X
  1327. Trackr_39 .DB $05,"PAUSE"
    * g1 `* O% o& t$ D' |. L1 L+ B2 t3 x

  1328. & |5 Z8 A, q7 H9 f
  1329. .ENDIF
    : s. V, v  v" ^+ R( K

  1330. 6 F6 S6 @/ c1 h2 n/ a
  1331. ;------------------------------+ \3 p* ~* _' J( E0 i6 b, r% s( R
  1332. Static_Text_Title_Data;静态文本数据
    . R$ [9 ]8 x- ^
  1333. .DB 12
    ( l2 x" x/ p5 F; @9 D
  1334. .DB "SUPER CONTRA"/ r# [  O# P* G- F+ f' h
  1335. Static_Text_Author_Data
    7 V0 V& F/ s) B1 N
  1336. .DB 236 g. ~5 |7 Z  D
  1337. .DB "EXTRACT BY FLAMECYCLONE"6 T: z' f4 T. E  O( d$ x
  1338. Static_Text_Date_Data
    3 s, `+ \. v5 a! E5 z. t/ m
  1339. .DB 10
    : z6 T% s- @& @' H- X( Z% T+ z
  1340. .DB "2023.07.11"
    * d: _  L( a% f+ j7 j. n- j

  1341. ! j' ]! l; E1 w" v. a# J
  1342. .BANK RESET_BANK & BANK_DATA_MASK
    - `$ M/ n4 J8 [6 Y/ Z0 w2 V+ R
  1343. .ORG RESET_ADDR/ r* y! f% r) [: ]0 P: d

  1344. ( f4 U  m( P4 O  i9 w
  1345.   _& z" ?! D; w/ k$ f
  1346. ;==================================================2 I" {- O# }+ A5 f7 L
  1347. ;切到主程序bank9 r# v7 c  T: d0 ^
  1348. SwitchMainBank- t0 n9 E9 O7 e: M2 ?6 r+ l, v) m
  1349. LDA #PROGRAM_BANK & BANK_DATA_MASK
    3 i" F$ c( `- p, @
  1350. JSR SwitchBank8000
    ) Q$ ~" S  d3 K8 o: G8 I/ F
  1351. RTS7 P; X* Y0 y9 Y, [* V9 v0 _1 j

  1352. 2 J; R! ?. X  I9 ]& p+ S8 W
  1353. ;==================================================) U5 c$ V5 M% H& G) [  s4 ^
  1354. SwitchBank8000;切换bank到8000-9FFF9 \2 d7 h, F/ m  y8 _& p7 H
  1355. PHA$ A  ~& z# G9 \4 a
  1356. LDA #$06& |+ D' i; M( w1 u
  1357. STA MMC3_BANK_CTRL
    # r- \/ C  x5 @3 C. A
  1358. PLA0 g6 S( n$ m. z" ~: e/ j
  1359. STA MMC3_BANK_DATA
    ! j5 {' X7 H3 h) X8 ?: c
  1360. RTS& ^+ O" V) @1 H6 V1 u0 O1 N* F
  1361. 2 C+ i8 l0 E) w& O* _2 S* l* t
  1362. ;==================================================
    ) f3 U6 g$ j# K
  1363. SwitchBankA000;切换bank到A000-BFFF$ p# m2 S5 k$ Z, g2 z
  1364. PHA
    + \: v  S1 e8 D* V5 `& y+ u! G4 r/ i
  1365. LDA #$07% a/ N1 U. ?& U# |0 U
  1366. STA MMC3_BANK_CTRL7 F. T! Z3 o  R( M$ I# ]+ K
  1367. PLA
    . C) Z7 g! i( @1 S' t
  1368. STA MMC3_BANK_DATA
    - u/ _( e# x3 \8 l8 U! o
  1369. RTS' T( E& n# {: S5 G1 D
  1370. 7 B  I' @* r) k4 _: }" F) M; J8 z# k( J
  1371. ;==================================================
    / d* L2 O$ ~  L0 ]* [0 t) H
  1372. Sund_Bank_Init;音乐bamk初始化8 T% y) ~1 K" N0 q' p
  1373. LDA #SOUND_DATA_BANK_0 & BANK_DATA_MASK
    0 F! x* n. v( v; f5 M
  1374. STA Music_Bank_8000) }5 S( J, s0 t6 l
  1375. LDA #SOUND_DATA_BANK_1 & BANK_DATA_MASK! S. c0 @9 o5 |4 A8 h( D
  1376. STA Music_Bank_A000
    $ u3 L8 m9 a" }( h* r) w/ G6 Z
  1377. RTS
    * }8 S( K& y& ~5 ^% A* V  C6 R
  1378. , M  B+ l% E: R+ R# l6 b
  1379. ;==================================================
    4 W- A7 a, P( Z) q
  1380. Sund_Bank_Set;切换音乐bank
    " ?8 g3 d( z8 G3 o, N3 @) v
  1381. LDA Music_Bank_8000( c/ f7 J5 w9 V; A& \( J$ n
  1382. JSR SwitchBank8000
    1 n/ \5 f; J# S$ Y
  1383. LDA Music_Bank_A000
    9 ~: K" `/ b$ f+ ^; ]7 L# C
  1384. JSR SwitchBankA000( s& v9 B) R2 z+ Y6 L& p5 k
  1385. RTS
    : g5 x# l$ m) r' t  f

  1386. ! _9 p  o- V3 e7 P
  1387. ;==================================================1 J- |* v  v0 ]5 W3 x: w7 L  }
  1388. Sound_Init;音乐初始化! m5 A; x# ^; y; s2 ^8 b: i
  1389. PHA+ L6 X( F  ~; p# Y: Y- }  U% M
  1390. JSR Sund_Bank_Set" j: O/ m- E5 ^& J0 i, i% D
  1391. PLA
    4 v! P( _- u2 {# [2 S) }3 I* I
  1392. JSR Music_Init_Addr0 @7 Y% X  I9 k. ?( @
  1393. JSR SwitchMainBank
    8 A9 ?' X. M9 R. B  W& c7 U, b9 x
  1394. 7 g  I% Y4 z; z  R% H$ ^' M
  1395. JSR Music_Bar_ReSet
    3 p# ^. ]' O4 Q- f- J: m5 v
  1396. JSR Time_ReSet
    : n2 P' o4 t: A: }+ R
  1397. LDA #$00
    7 u; y9 @  t# X/ I8 U( M! F# m
  1398. STA Music_State9 e& F' m! J6 T( d: y2 O  U- q
  1399. JSR Music_Stata_Show
    ! G5 ~; p- i6 M# |0 E
  1400. .IF Track_Name_Pos7 ]! ?- B$ O& U. {/ ^+ v
  1401. JSR Show_Track_Info* h8 z% p) H+ Y; t4 p
  1402. .ENDIF5 e4 G8 v" z2 p1 k
  1403. 4 T, W$ H4 T9 E( v! x( k
  1404. RTS7 D% R- ~4 F8 e8 J) D' M; H0 H
  1405. 0 f2 V" V/ Z3 j; V0 Y9 [
  1406. ;==================================================% r9 ?2 ~% o$ k. W7 {
  1407. Sound_Play;音乐播放
    " A$ K  K. ^! }
  1408. PHA
    : T. b/ n/ {$ ?3 c( ?
  1409. JSR Sund_Bank_Set
    7 h! @5 i6 ]+ q
  1410. PLA
    6 K/ e2 P7 V, ]- a, A: G, p
  1411. LDA Music_State' x7 W3 B# W! w' w
  1412. BNE Sound_Play_End
    8 R# Q- |+ L2 U; k
  1413. JSR Music_Play_Addr
    0 d9 s1 |3 F+ R3 J* e
  1414. Sound_Play_End
      ?+ q. q7 A. ]+ V/ n% A5 L  Y# ^
  1415. JSR SwitchMainBank
    ! e4 U: h" L1 {" I$ l
  1416. RTS
    3 c# ^. T! y: i  z

  1417.   n/ A2 q' x5 G, p/ ^- q5 I
  1418. ;==================================================- i' _! T9 M" D  X
  1419. .IF Music_Reset_Addr
    7 C* q4 _- S; ?$ e  _. N; N1 }
  1420. Sound_Reset;音乐重设(如果有的话)9 W' c, f6 L5 {. }7 X' ?
  1421. JSR Sund_Bank_Set( s& F+ y1 G; j6 ^4 ]) J
  1422. JSR Music_Reset_Addr
    : @& s8 I! I- r
  1423. JSR SwitchMainBank' o2 C# B* b, ]) y& x
  1424. RTS) J( |" B5 N6 {6 i* s
  1425. .ENDIF
    6 w9 h, k3 u4 {* `4 ~: N

  1426. + P; s- i3 c" B  L% e* {- T
  1427. ;==================================================
    - R0 I. O! {3 j
  1428. MainLoop;死循环  E: G  v. E7 c% c+ o3 L; v: h
  1429. JMP MainLoop  X" O3 N5 l& c( t$ {1 v
  1430. # N) u5 H. n, w) V
  1431. ;==================================================5 C' M. g# k( [3 O0 M
  1432. NmiProgram;Nmi中断处理
    0 F! y: F+ i, }, S( |9 V
  1433. PHA
    " r9 y$ J1 W+ B$ b3 O$ y
  1434. TXA
    0 G& |, M; `4 r! ]" W0 I# `
  1435. PHA4 J/ t3 w" h# H$ I* I' I
  1436. TYA) h3 i  D$ _* {; [5 F0 n
  1437. PHA
    5 |( B( \) x1 b! }2 L  |4 J

  1438. ; ^. F+ y% f( o% K
  1439. LDA PPU_STATUS8 c- `) r" u, Y/ b1 x; _
  1440. LDA #$00; I1 n' ~  c2 F; k2 H
  1441. STA PPU_CTRL, \/ ^( d& q- m" v9 l
  1442. 7 t' y6 M+ E$ d
  1443. ;切换主程序bank% ~+ }/ ]9 B& X; c+ N0 E/ t9 D
  1444. JSR SwitchMainBank" S# U$ G- g- \! i7 D
  1445. ; _) q) s( J7 K. L& A" I. @
  1446. ;NMI处理6 m1 t3 F' i9 y5 Q! N5 c
  1447. JSR NmiProgramProcess
    . u: y# T) Z: Z* `/ j) F

  1448. 9 @9 l  ~3 K* _! a! q3 n9 |
  1449. Nmi_Proc_End
    2 \2 Y# A9 ?, d7 H6 C4 N, L
  1450. PLA
    6 P* S; M0 u1 k6 H: \
  1451. TAY# H. s2 V- z$ J, D% @5 F
  1452. PLA6 w: o7 A% ]# l  R
  1453. TAX3 z& b2 O* F: H
  1454. PLA
    & {2 |8 @2 ^  H% v

  1455. : z5 N0 }# T* t# [
  1456. RTI
    " `+ v/ X/ r5 ]8 Y
  1457. 4 w& ]$ G1 l3 R1 v
  1458. ;==================================================
    * g; @& R  M& g! ?* T% I
  1459. ResetProgram;重置中断处理
      z; A& `2 O9 o4 s! j; c2 h, X
  1460. SEI
    ; P, _* `. w; a0 P, E& W5 {+ ?9 S
  1461. CLD
      M. F: A; v$ k, ~
  1462. LDA #$003 N" ?% P4 x" }: K; `! j" @
  1463. STA PPU_CTRL3 M& J. ]  c5 F+ J4 H0 N
  1464. STA PPU_MASK
    $ K2 q6 \, @7 c' z0 {

  1465. 2 U* V) w0 b& b5 K9 Y% [
  1466. JSR SwitchMainBank4 h3 i- W! Z9 D0 G& a
  1467. JMP ProgramBegin
    - D! k9 C9 G9 t2 ^' z) v0 A
  1468. 7 s1 C. q5 r$ w2 H7 j9 F
  1469. ;==================================================
    . B4 S6 I% v5 Y/ P( S! W
  1470. IrqProgram;Irq中断处理
    4 N& m' ?" S) q, {; ^; e
  1471. RTI" M; R5 Y9 l) X$ l* r1 Q& t
  1472. ' J; q# X; b+ v& J% g
  1473. .IF SOUND_BAR_SHOW_ENABLE  U9 i9 U" |' P  r, b  k$ C- t
  1474. .ORG $FF80& ]& B. n( e+ \$ b2 j
  1475. STA $4000,X
    ) |9 f0 t  C' M8 k7 j" z; \. y1 P
  1476. STA Sound_Bar + $00,X
    6 J' ^  |: p- A$ T/ m; h
  1477. RTS
    5 b& z, l* q" e* G) h
  1478. 2 E: _) Q  M8 X" N2 x
  1479. .ORG $FF88
    - K! w7 \8 P, c7 n& _. D$ ?, Z5 b" [
  1480. STA $4000,Y
    + @0 m6 ~4 A/ v) ?% E
  1481. STA Sound_Bar + $00,Y) C. b# R$ l4 S* g  f
  1482. RTS
    : \& \( S+ _6 N- q4 J
  1483. 5 J' C* Y- F$ J
  1484. .ORG $FF90
    - R2 [7 b; `- P$ o* N
  1485. STA $4004,X0 j! m4 y$ z$ n1 ]
  1486. STA Sound_Bar + $04,X
    ' n7 C$ K1 U" }
  1487. RTS/ S6 U: L. F9 C* o; K4 f) V

  1488. 5 U* ^; L* ~1 b8 @# G
  1489. .ORG $FF98$ p# V' g1 w  n+ e9 P
  1490. STA $4004,Y: L& r  e" W! s$ p9 F7 R
  1491. STA Sound_Bar + $04,Y
    6 ]$ l( B. I, r- b
  1492. RTS: H9 J8 O, @/ Z! h

  1493. : I# u! u' B2 F6 `5 L
  1494. .ORG $FFA0
    5 |+ Q. R) h5 Y+ t% V
  1495. STA $4008,X
    ! a- l9 j8 L1 W7 E7 @0 o8 I
  1496. STA Sound_Bar + $08,X3 T4 Y9 V9 d  Z9 Q; Q$ W6 ~5 I
  1497. RTS) ~8 K. l1 g: c& B

  1498. # m8 m! H  O  l$ B1 j
  1499. .ORG $FFA8' i5 ]  F1 Q/ J' A+ X: E  g4 d! Z
  1500. STA $4008,Y. P, ~; m! V# P
  1501. STA Sound_Bar + $08,Y2 M' U5 h) V% R. l3 H9 y( ]
  1502. RTS/ b4 h( ]+ }# T  q- ^
  1503. 1 R8 K- n8 ~3 K: b: \
  1504. .ORG $FFB0% f3 x+ y/ ?9 V
  1505. STA $400C,X
    ) L/ P6 n$ I( h0 f+ x; G7 v
  1506. STA Sound_Bar + $0C,X, J, y. I. F# _' l  G! u1 m5 S2 a
  1507. RTS: `/ }2 W! I1 b- d$ k3 K
  1508. - k# W$ c1 L6 q
  1509. .ORG $FFB8
    0 m) b% c" \9 U  t7 F
  1510. STA $400C,Y& B( x% f5 U8 m4 @
  1511. STA Sound_Bar + $0C,Y! b0 K2 O; Z2 x" r+ K
  1512. RTS
    ( U* T& }  |8 Q$ c8 B5 m$ |3 v6 W1 ^

  1513. - ~* |/ G6 ^( j) ]/ b
  1514. .ORG $FFC0
    4 {8 y) S" i, n- T1 m) R0 D3 r% ^, A! x
  1515. STA $4000. }4 N; N/ K& k- Y9 g; p
  1516. STA Sound_Bar + $00) X6 E$ f- q+ J" R) X  S* [
  1517. RTS
    2 J5 a( P% j) B3 L* u! r* C

  1518. 2 S! R! i. _/ k3 D/ L0 s0 M, b6 w. d/ ^
  1519. .ORG $FFC8+ c% r  n$ @4 L+ S$ b! F7 a
  1520. STA $4004, j9 T- T" a8 Z* `
  1521. STA Sound_Bar + $04
    * H' N- c/ a/ i' r3 F5 Z$ K
  1522. RTS
    / U+ d  Y' D& C, c  E
  1523. 7 w+ C, c7 k& v2 m# m
  1524. .ORG $FFD0! ^' n" ?2 ?9 V$ L! c
  1525. STA $40086 D, S! k; q6 Q1 f5 z
  1526. STA Sound_Bar + $08
    . A8 ~0 H) d. h& b
  1527. RTS: b9 k% Q: h/ c0 J; r( ~

  1528. ( h/ ?) v/ \" T
  1529. .ORG $FFD8
    4 R5 J# g8 m! p- E
  1530. STA $400C
    7 v. I6 b9 D9 Y- @  l
  1531. STA Sound_Bar + $0C
    3 q* J* E* a, i6 y
  1532. RTS& d5 j& j. g$ c9 V/ @# X; i1 l3 s

  1533. # |9 S+ y6 B' r) P: x/ C0 Z
  1534. .ENDIF) T' W1 W0 k1 a2 _

  1535. # T" }! k* C; ~4 [
  1536. .ORG $FFFA' W8 V8 }2 }( v3 n- K1 w- X
  1537. .WORD NmiProgram& L& y' l% u" W1 k; ?
  1538. .WORD ResetProgram7 [& d( s% i8 }* g
  1539. .WORD IrqProgram
复制代码

0 P; G3 u& w  {$ v9 G8 R
0 V: N/ m( m3 }8 s' f
游客,如果您要查看本帖隐藏内容请回复

本帖子中包含更多资源

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

x

评分

1

查看全部评分

签到天数: 1085 天

[LV.10]以坛为家III

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

使用道具 举报

签到天数: 3055 天

[LV.Master]伴坛终老

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-12-19 15:55 , Processed in 1.089844 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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