EMU618社区

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

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

[复制链接]

签到天数: 39 天

[LV.5]常住居民I

发表于 2023-7-11 19:08:59 | 显示全部楼层 |阅读模式
本帖最后由 yandagui 于 2023-7-11 21:32 编辑
; \! Z8 n- S  D4 a' C& S3 p- K0 d$ ~, k8 d8 G# L6 p0 v
1.魂斗罗
- B5 L4 C/ L; I' }; Z# }- n  j+ J5 S2.超级魂斗罗
% L; l  B8 K% O) f3.赤影战士+ c9 x+ A6 S! |9 t; |
4.忍者龙剑传2
1 c9 g' H0 |: U
+ b+ _/ ^9 A( W5 o7 X; N
3 p* V, m# X" q/ L* p8 D# F$ j" W% g! ^7 ?" a. b  I. X- e

; {8 s- w# T/ Y2 w. h3 S源码:- y  m% J" \3 U  B' L7 {0 `! b
  1. ;[FC音乐][播放器模板]
      d9 {- q: @% Z# F8 W- m# z) p2 p
  2. ;FlameCyclone 20230710- m8 o, m1 i1 v$ d3 [4 Q, {7 G% ?

  3. ( Z$ H% C7 F* J+ L9 d
  4. ;文件头
    ' F" q3 w+ @: S4 w
  5. ;======================================================================5 o. R2 O: z3 X- k$ s
  6. .INESPRG 4                                              ;16KB PRG 数量
      ~' W& k% M+ p* J, O- F4 n, X! w& I
  7. .INESCHR 0                                               ;8KB CHR 数量! S1 y) }: v- q) H" u
  8. .INESMAP 4                                                   ;mapper 4
    $ C4 d) X* _' Q% ?# W+ i: {% x$ T: Y
  9. .INESMIR 1                                   ;命名表镜像 0水平 1垂直$ a6 E; L& n0 @! @) k/ s4 ^
  10. 8 A) @7 v6 L  e3 z7 h2 z* K3 m, t
  11. ;==================================================
    8 @$ T; A* d3 r4 E: o, J/ m
  12. SOUND_BAR_SHOW_ENABLE       = 1
    ; i) I* t. C8 f, W6 h
  13. ;==================================================
    7 Z& }! }  X4 S% U, o8 e
  14. BANK_DATA_MASK              = $07
    ! m0 E" I/ m. r) y; [
  15. ;==================================================
    9 h0 ?% [/ }5 R
  16. SOUND_DATA_BANK_0           = $008 M- G3 ?  v* V" U2 z6 i* b9 S8 |4 H
  17. SOUND_DATA_BANK_1           = $01
    * U4 ~) y! ^' U
  18. SOUND_DATA_BANK_2           = $02
    4 ]- o" T  n, |6 W  a/ i
  19. SOUND_DATA_BANK_C000        = $06
    2 z, s1 B! A: o/ U' l" w

  20. " q; m) E' O7 y
  21. ;-------------------------------------------------
    + G- R2 ~% m2 I4 C, J$ w
  22. CHR_DATA_BANK               = $04
    . K# Q, V5 g1 g% B
  23. CHR_DATA_ADDR               = $A000& `) |" o4 L: z! ?: d. f: B/ \; C
  24. ;-------------------------------------------------
    - P& t; n4 M- N6 s. |
  25. PROGRAM_BANK                = $05
    : }0 ^/ D4 [$ n. Q
  26. PROGRAM_ADDR                = $8000
    0 M5 h, W; c' A5 I$ n6 M
  27. ;-------------------------------------------------
    " l9 o* H! N: t* ]% y3 o( S
  28. RESET_BANK                  = $07' k3 u8 p6 H% j. R: |
  29. RESET_ADDR                  = $FE00
    / t9 g) v0 E5 K, q
  30. ;==================================================
    6 |: s% z- C0 }( K
  31. Music_Init_Addr             = $DFF0 ;音乐初始化地址$ b; s& R6 v0 H$ L
  32. Music_Play_Addr             = $813C ;音乐播放地址# E3 ]  K, o, t8 M9 m/ P1 w" ?
  33. Music_Reset_Addr            = $0000 ;音乐重设数据地址
    2 D" ?/ ~+ p2 c
  34. ;==================================================
    # c; v% {5 U2 X5 U$ G' [2 L
  35. Music_Song_Total            = 039  ;全部曲目总数
    0 V9 A& {$ }- p# ?8 k- o* i
  36. Music_Start_Song            = 007  ;初始播放曲目
    , Y& S. ^7 Q7 M0 R# u+ C/ A# n4 @4 a
  37. ;==================================================$ t6 S$ q( I) {9 `
  38. 5 o1 n% |, I9 Y; N, m% N' w
  39. ;==================================================
    * _/ }2 b0 A6 L* @: E
  40. Title_Text_Pos      = $210D ;标题文本位置4 k6 ?" e; a* |: S+ P+ @
  41. Author_Info_Pos     = $2284 ;作者文本位置. G6 [% Z' b' k' F; I
  42. Date_Info_Pos       = $22CB ;日期文本位置
    * G% ]: S  A: o: o1 i* g! G0 ?; M, X
  43. ;------------------------------
    9 V' W6 I( v5 w* i* q: v& b, i5 G
  44. ;------------------------------
    2 l6 a( Z/ n# w
  45. .IF SOUND_BAR_SHOW_ENABLE
    ( J' ^8 O+ a, R  ~
  46. Play_Index_Pos      = $21B3 ;当前曲目位置
    ) L+ H* M2 E4 n. u9 \9 i
  47. Play_Time_Pos       = $21F3 ;播放时间位置; U: E6 |  X! S
  48. Play_State_Pos      = $2233 ;播放状态位置! g5 R' Y/ k1 a# a* }; k
  49. .ELSE( M  ?) I+ o2 R! U/ a. L$ V
  50. ) y* O" @7 M$ a& Q; r
  51. .IF Music_Song_Total > 99) m6 s. X& p1 N1 p8 m% `
  52. Play_Index_Pos      = $21AC ;当前曲目位置
    % ?- G5 Q: \. q) O( T: D( G; v
  53. .ELSE6 U  m& Z, N$ U6 }! `

  54. 0 ~0 v2 C0 ?- U6 |  E& h
  55. .IF Music_Song_Total > 9
    ' Q  a" i4 j' z7 r5 O
  56. Play_Index_Pos      = $21AD ;当前曲目位置) A; k& F, \) c4 ?# r) T
  57. .ELSE! y+ o: {! t; ]$ V$ l
  58. Play_Index_Pos      = $21AE ;当前曲目位置
    ( u3 ]9 W/ E/ V; t  y# q0 i& p' t
  59. .ENDIF! ?5 N8 E6 J! R. X! Y: n* T! Z
  60. / ~. Q$ N/ o: P( |( W+ |# s" S
  61. .ENDIF! t# g" m; e1 S, T

  62. ( Z9 C% e1 U7 ^) A: m  R
  63. 8 G9 \' ^% q: z' S3 i* A, H9 L0 E, f
  64. Play_Time_Pos       = $21EC ;播放时间位置4 N1 _9 _/ z, U1 T) i
  65. Play_State_Pos      = $222C ;播放状态位置
    + I  F2 t4 z+ ?$ y' S# B! L
  66. .ENDIF
    $ i" @4 {" P3 q/ n& C
  67. ;------------------------------+ Z9 s8 }' n! l4 ]
  68. Track_Name_Pos      = $216B ;曲目文本位置
    $ B4 @! ]6 e% M7 Z; h7 b4 s: Y
  69. Sound_Track_Pos     = $21A5 ;声道文本位置
    - N* F7 |5 g/ l# z
  70. Sound_Bar_Pos       = $21A9 ;音乐条位置0 o6 R  e. s8 z! X' C( q
  71. ;==================================================) z2 @, w9 u' n) V1 r( c
  72. Scroll_X = $00
    ; D# w* l" d/ c* L* K5 _
  73. Scroll_Y = $069 x5 l5 S$ v! N$ C( |  J% h
  74. ;==================================================
    ' r9 i3 t1 [  c* h
  75. RAM_Cln_1       = $0100
    $ E0 S( Q0 F* @. K& M
  76. RAM_Cln_1_Size  = $80* k& H0 m; C% m  N( \
  77. RAM_Cln_2       = $00E0# v8 O" R7 f" D
  78. RAM_Cln_2_Size  = $20% l2 f" o6 [' `! ~1 Z( p
  79. RAM_Cln_3       = $00E0
    - q) p* m3 X# p8 H7 s" y. R
  80. RAM_Cln_3_Size  = $20# k* e1 n# K/ G) B# C% z, j, F
  81. , l: ^* _  u0 q" O
  82. ;==================================================
    % Z8 F! V& D2 D7 l7 \. I3 g
  83. PPU_CTRL                =   $2000   ;PPU控制寄存器- w4 `6 ]3 N& ]
  84. PPU_MASK                =   $2001   ;PPU掩码寄存器
    . T5 F) c0 u8 S" I4 b1 \
  85. PPU_STATUS              =   $2002   ;PPU状态寄存器:读取后PPU_SCROLL和PPU_ADDRESS被复位,下一个写到PPU_SCROLL的数据是水平的,写到PPU_ADDRESS的数据是高位+ g9 R' `9 u, D" T
  86. PPU_OAM_ADDR            =   $2003   ;精灵RAM地址:用来设置通过PPU_OAM_DATA访问的256字节精灵RAM地址。每次访问PPU_OAM_DATA后该地址增加1
    7 e% }" n% D- F5 }
  87. PPU_OAM_DATA            =   $2004   ;精灵RAM数据:用来读/写精灵内存。地址通过PPU_OAM_ADDR来设置,每次访问后地址增加1
    ' W- f, O2 ^1 c& k8 g* T0 O4 v
  88. PPU_SCROLL              =   $2005   ;屏幕滚动偏移:第一个写的值会进入垂直滚动寄存器(若>239,被忽略)。第二个值出现在水平滚动寄存器
    * K0 H- T  v0 Y6 o; x& Y
  89. PPU_ADDRESS             =   $2006   ;VRAM地址:设置PPU_DATA访问的VRAM地址。第一个写地址的高6位。第二个写低8位。每次访问PPU_DATA后地址增加
    / S' @9 Y. `7 _5 M8 g9 g. S! e
  90. PPU_DATA                =   $2007   ;VRAM数据:用来访问VRAM数据,通过PPU_ADDRESS设置的地址在每次访问之后会增加1或32 . Q! P& _3 p: }
  91. OAM_DMA                 =   $4014   ;DMA访问精灵RAM:通过写一个值xx到这个端口,引起CPU内存地址为$xx00-$xxFF的区域传送到精灵内存  L: D: m7 {; H+ Y
  92. APU_STATUS              =   $4015   ;声音通道切换7 s, E* E& H- i# N. f# _
  93. JOY1_FRAME              =   $4016   ;手柄1 + 选通4 N/ f2 H' Q4 c4 Y
  94. JOY2_FRAME              =   $4017   ;手柄2 + 选通! T- r- b0 |1 a; ^/ C* D* R4 {
  95. ;==================================================
    0 o( o4 Y% i# ?+ |8 I
  96. MMC3_BANK_CTRL          =   $8000' l  K' M7 [1 L- ]
  97. MMC3_BANK_DATA          =   $8001& b3 F. p; R+ G/ R7 K7 j8 X+ i
  98. MMC3_MIRRORING          =   $A000
    7 ?. H  _+ J5 v
  99. MMC3_PRG_RAM_PROTECT    =   $A001
    4 ~  x$ g/ X+ s3 _8 u2 M/ i
  100. MMC3_IRQ_LATCH          =   $C000
      N& P+ h0 E  k6 P
  101. MMC3_IRQ_RELOAD         =   $C0013 X5 t8 S+ ]2 ?. e3 x0 h! F+ `, h
  102. MMC3_IRQ_DISABLE        =   $E000
    4 Q& e  c+ o' q' A$ K4 p- Y9 i
  103. MMC3_IRQ_ENABLE         =   $E0016 J. F% e. P0 G, Z/ ?0 s

  104. + x, k" A; Q# v4 ^. H
  105. ;音乐数据块
    - V2 P* ~# K2 k  v) ^+ L

  106. 7 M2 M* a" s& o, @3 x
  107. ;======================================================================
    2 G' y# k5 |7 g
  108. .IF SOUND_BAR_SHOW_ENABLE
    % `/ l, S  q* g  ^
  109. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK
    $ j- k6 J1 |6 t
  110. .INCBIN "sound_bank_bar/music_data_0.bank"# Q6 U( F3 e( d( r
  111. % a- w' U( j0 c9 E
  112. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK
    9 n$ x. ?1 n& L" m7 {8 Y2 O% p
  113. .INCBIN "sound_bank_bar/music_data_1.bank"
    : F! Q- E' V  P: I
  114. % j/ T/ G) o' [# C
  115. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK. z$ d; z. P: O9 {8 S
  116. .INCBIN "sound_bank_bar/music_data_2.bank"
    5 Q) G( Q  ~0 J6 ]6 ~0 `" e

  117. * ]  ?: }: b/ m4 Y+ U) R6 a# l
  118. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK7 F$ m) X+ k  p6 Q" c; X* W
  119. .INCBIN "sound_bank_bar/music_data_3.bank"
    ( L# \2 k( q3 B

  120. 8 p& c' ^* i! @
  121. .ELSE4 b& y  |$ ^1 N+ P$ [
  122. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK2 }  u; K# }$ Q( ~0 N
  123. .INCBIN "sound_bank/music_data_0.bank"/ A6 ?( `' R: N8 i7 a

  124. & d5 o& u, T" w- M" I6 v6 |( b
  125. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK
    " }6 U3 V( [& ?, f5 k% F
  126. .INCBIN "sound_bank/music_data_1.bank"
    + `4 Y5 P# z' }- o) x+ {3 b' s

  127. ( C- U) Z' c/ T" t7 X0 c# u, h
  128. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK  K" n7 O. [' y, b
  129. .INCBIN "sound_bank/music_data_2.bank"
    ( x+ N: G; `$ Q0 p: u( B& h

  130. + W5 T% j# I3 s* Z
  131. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK# w' g- @8 ]2 N
  132. .INCBIN "sound_bank/music_data_3.bank"
    : b$ }' u6 T, c. [# E8 u
  133. .ENDIF3 m/ k% \: p% f/ r! T
  134. 8 Q( s* p3 w5 v- A# N
  135. ;CHR图形数据, y7 N1 M& k, s7 |, m
  136. ;======================================================================
    ; {! v! E% A) I/ b
  137. .BANK CHR_DATA_BANK: |$ n  N4 o4 a* h+ b5 b% u) m
  138. .INCBIN "chr_bank/chr_data.chr"  ~6 {6 W2 Y5 e2 W
  139. / f* X7 q" ?* o- a3 `* v& R& e; j
  140. ;==================================================
    ' p, J4 a: P* }
  141. PPU_Addr        = $0300% I( O- @. T  M
  142. Palette_Addr    = $03C00 C* B. a! k/ ^
  143. Sound_Bar       = PPU_Addr+$E00 d  {. k+ X' S1 \7 }% `
  144. ;==================================================
    1 I+ \0 B" {  p+ T# r
  145. Palette_Update_Addr     = Palette_Addr+$0D6 i4 ~, u3 G* |2 t# _, D
  146. Palette_Update_Max      = $2C
    6 b0 }: U5 U% Y2 b
  147. Palette_Update_Min      = $21
    : j% a4 C5 }1 X4 B/ q
  148. Palette_Update_Interval = 60
    * R# Z4 ~+ N: R4 W) n9 ^5 z8 v3 v
  149. ;==================================================
    & c0 q. w1 N3 K$ f
  150. Sound_Bar_Cnt       = PPU_Addr+$F0
    . J( q8 d! ~: B/ [% W4 C6 W8 N. s! ]
  151. Screen_State        = Sound_Bar_Cnt+$01; [5 d/ H9 K& ]% f% x
  152. PPU_Cur             = Sound_Bar_Cnt+$02" ~5 ?5 O8 i7 h
  153. PPU_Addr_H          = Sound_Bar_Cnt+$031 h7 }3 E  Z+ D; m. {& i6 l7 ?1 H
  154. PPU_Addr_L          = Sound_Bar_Cnt+$042 w9 n2 N* V5 J% _- Z, c9 N7 V
  155. ;==================================================) S' a9 N: Q3 w+ L
  156. Data_L              = $70
    $ h' ?5 q) t- v" K
  157. Data_H              = Data_L + $01
    * w7 a. Z# S" i, @- l' h2 I; o* I
  158. Data_Cnt            = Data_L + $02
    ; K4 ~: [) X9 ^+ z5 A# [
  159. Data_Buf            = Data_L + $03
    % `) r" j2 C) o5 {1 ]1 h$ K
  160. Time_Wait_Cnt       = Data_L + $040 T* i9 p: J: d* ~, J& k6 m
  161. Palette_Wait_Cnt    = Data_L + $05
    3 B' t7 i1 q* R5 M
  162. Palette_Update_Flag = Data_L + $06
    ( D" B3 {3 R8 h$ a# x
  163. Show_Track_Name     = Data_L + $07
    & h5 f9 t4 S- f- w% c# T2 ]& c/ ]. P) {
  164. ;==================================================
    2 |3 }; q. B/ r2 E* t, |- ~
  165. Key_Keep            = Show_Track_Name + 1
    ' e3 W2 j# P5 I! o
  166. Key_Once            = Key_Keep+$01
    9 ]1 P- V. C) ]9 h7 s% c2 u- J
  167. Key_Kemp            = Key_Keep+$02. R' Q" P7 i+ ~
  168. Key_Temp            = Key_Keep+$03
    + L9 S! t1 ^1 ^+ N' @* M* ]1 z
  169. Key_Getv            = Key_Keep+$046 P$ c& B3 p+ r) c) ?: E
  170. ;==================================================" T3 a) [, s( v- X4 h* J! w" v( z4 N
  171. Music_Cur           = Key_Getv+$01/ l+ `2 U  J" J
  172. Music_Last          = Music_Cur+$01
    1 C* e3 c9 Y% b5 c0 p" e5 _7 F) _
  173. Music_State         = Music_Cur+$02' w) _; q' p9 o, }: S6 _- o2 e
  174. ;==================================================
    , U$ g/ ^( s( x: X
  175. HEX_Data            = Music_State+$011 e/ k0 u9 p8 P9 B4 A4 i+ @! x
  176. DEC_H               = HEX_Data+$010 [4 ~8 ?: k# B
  177. DEC_T               = HEX_Data+$02
    2 j! C' o# h9 e7 s
  178. DEC_L               = HEX_Data+$03' a3 k+ |( a2 C0 b
  179. ;==================================================
    + M* G. T- F, @
  180. Time_S              = DEC_L+$01
    3 M9 c( y2 Y  E0 G! f' B+ [1 B
  181. Time_M              = Time_S+$01' ^" H$ d: L; y5 u
  182. Time_H              = Time_S+$02, }' l; k; \; i: U9 @1 X
  183. Time_Cnt            = Time_S+$03/ _! J7 l" k( n; P
  184. / V, A: s: p9 t# D
  185. ;==================================================# p& |( e7 @2 n: ]$ t! `
  186. Music_Bank_8000 = Time_Cnt + 1' T1 \" `& f5 j3 a, u/ q
  187. Music_Bank_A000 = Music_Bank_8000 + 1# g1 b  R# O( N& I
  188. ;==================================================0 R. F  g% ]' k0 i( e7 U

  189. 7 {6 c, M3 C# B& y2 V
  190. ;======================================================================
    7 {& V5 s  E! l. N" t# C
  191. .BANK PROGRAM_BANK
    ) m3 `( c! T" f7 O' ~* Y  K/ Z
  192. .ORG PROGRAM_ADDR" y0 P/ G, F5 S6 I* o
  193. 8 ^; R" c2 c! N# {* W
  194. ;==================================================
    2 k/ |% F( h& z! y7 {) j
  195. NmiProgramProcess;NMI中断程序处理
    $ f0 h& K$ C8 a+ v( v6 N
  196. ;处理PPU图像8 x2 q1 K$ [' [/ e
  197. JSR PPU_Proc
    * `' ?' s  A8 a

  198. ) A5 q" f3 j8 u; h
  199. ;启用NMI中断
    2 N2 n1 l2 e5 s7 u5 G( c) x
  200. LDA #$80" T' L/ ~0 z  h- \
  201. STA PPU_CTRL
    2 K. X, s2 r: g# [
  202. # {& Z3 X0 b* @$ q9 k
  203. ;更新调色板
    ! e8 N" k4 T' y8 B  F* u
  204. JSR Update_Palette_Data6 ], c5 N8 k) p7 U% y1 d
  205. % K! Z* H1 d" h& V
  206. ;显示时间(缓冲)3 X& V5 i) `/ i
  207. JSR Time_Show
    1 G# H4 G* R0 T8 M$ W0 B
  208. % Y  c; I1 F$ X% x( B
  209. ;播放计时! C& H: _# F7 R! S1 `6 _
  210. JSR Time_Count& `9 y9 k# w( a5 Y
  211. : m* K! d! B$ f$ D2 n
  212. ;播放声音
    6 h6 q1 K7 \/ a6 Z2 K% A; R
  213. JSR Sound_Play
    . M: A( M/ o" k

  214. * d6 E. C! a/ t
  215. ;切换音乐(手柄触发)% o- K; G4 }3 o1 `; U9 w1 x
  216. JSR Music_Switch3 ~( Z, G# w0 L

  217. - s0 j9 ^4 h" T( y
  218. ;音乐显示(缓冲)% B9 e+ e8 i/ W
  219. .IF SOUND_BAR_SHOW_ENABLE; D7 v: [9 z" B0 E, t' N+ Q8 u
  220. JSR Music_Vision
    ! L, k" W. U+ I* i1 A
  221. .ENDIF' D+ m- ]7 k2 p& A0 c$ J$ g: ]/ I
  222. + O  Y. @- G+ a1 V. S
  223. LDA Time_Wait_Cnt
    . j- L) r7 ^+ `) u4 ~2 u4 I
  224. BEQ NmiProgramProcessEnd
    9 T6 L% g: M8 `
  225. DEC Time_Wait_Cnt
    6 k" t. g4 h* r3 Z
  226. NmiProgramProcessEnd; g9 ~, u8 A7 F' c7 B
  227. RTS+ n0 @9 r/ u7 _( T% l# _
  228. 6 H6 \/ N7 ?' H; \5 `  W5 n( e: L
  229. ;==================================================
    ' B& C- K2 R. g& t3 o
  230. ProgramBegin;主程序
    ( Y5 j' W$ ]# N
  231. LDA #$00
    8 W5 V8 ^; R& r1 ~& s$ v$ S
  232. STA PPU_CTRL
    ( c6 M1 r) X/ Q* }
  233. STA PPU_STATUS# k3 |$ x" s9 a
  234. STA PPU_MASK
    # y! @5 M& V6 |! a
  235. STA APU_STATUS
    3 d% M5 y7 J; l
  236. STA PPU_SCROLL9 P/ k7 H: d" f/ x3 S1 K
  237. STA PPU_SCROLL
    $ V: `  r0 B. q8 a# A4 e
  238. LDA #$C01 H2 [$ Y, {# O) [1 c
  239. STA JOY2_FRAME) k8 }% O2 }1 G8 f' q
  240. 4 l6 m4 L, t& A0 o" {* \/ v, ?: b" V
  241. LDX #$FF5 V. k+ x) r( b
  242. TXS2 I# O6 s! x  `5 C3 a
  243. LDA #$00
    , _6 p/ ]1 B: t9 [, f; O
  244. STA PPU_CTRL' I% @: S( U- J4 M) P
  245. STA PPU_MASK! v. V. s: x" n1 b7 r6 i# j
  246. STA MMC3_IRQ_DISABLE- X$ c' `( x& g3 I$ i# L

  247. + F7 z1 A& E6 u
  248. ;==============================% {% Z6 ~; B6 i7 l, a# A2 p
  249. ;调色板清空
    * L& ~: v& J7 w$ p( h% |  e" Y5 U5 S
  250. LDA #$3F- y5 p9 a' |3 G, \4 J1 q7 \8 i/ x
  251. STA PPU_ADDRESS) D; u. _7 ]9 Z; ?( ^: s  a
  252. LDA #$00* U- I6 W$ I8 X% X2 W8 V
  253. STA PPU_ADDRESS+ T' l# c7 _: N  C0 {1 A1 e* u* O
  254. LDA #$0F6 _' r( K6 i, Y$ X. R. m
  255. Palette_Clear
    8 y- C% L, i  o
  256. STA PPU_DATA: d3 i/ _9 A+ b1 k
  257. INX
      b! m' I4 J) M: x6 [& a
  258. CPX #$20* A# |' f: O& t+ r
  259. BCC Palette_Clear7 ?( {5 \( q3 K- X6 j( C
  260. LDA #$00, _1 \! z: x8 g6 W0 q
  261. STA APU_STATUS7 }: [/ J' E$ i( f
  262. ;==============================
    6 M0 _" G! ^. c
  263. ;初始化背景调色板
    4 c) q; e+ u3 n! V6 d' U2 y4 R
  264. JSR Set_Palette_Color: m) S7 c$ ^5 E" y/ Z
  265. JSR Set_NameTable_Attributes% l, {0 u9 @7 K( T4 V3 \
  266. ( }3 e6 w$ x% Z4 S. J3 D
  267. ;==============================! P0 w: a) P+ [. @8 x
  268. ;RAM初始化
    ) d' \: E* `) `: C& |- ~* L
  269. RAM_Clear_All0 j, P% z0 `+ x1 F# k) Y/ k' p
  270. LDX #$00
    ' C0 N8 _, o# k- N
  271. LDA #$00
    6 L$ ?) K5 T' ]+ G# k
  272. RAM_Clear_All_Start
    , n# D5 Z+ @0 Y; r* O. y
  273. STA $00,X% l) c& P5 q* e3 i, ?
  274. STA $0100,X5 _; V8 I! j& _$ Z+ g' w) d
  275. STA $0200,X
    4 G5 g, d7 @& r0 L0 ]( c; H( P
  276. STA $0300,X  Y3 C4 B6 y- U& v  z7 f& W
  277. STA $0400,X
    - M7 X) z5 V7 Z/ r, v
  278. STA $0500,X: Z, V& h! |  a" L
  279. STA $0600,X
    : D% O! B- e7 i; R" P+ z
  280. STA $0700,X, Z' n7 G2 J4 k3 E
  281. INX1 L  C( w0 I) l6 W+ K; O
  282. BNE RAM_Clear_All_Start; b6 P% r% d  o

  283. ( C; S* a6 i( y( I# a9 O
  284. JSR VramInit
    , G8 H/ w( u" k! P! ?
  285. JSR Init_Palette_Addr
    ; a: ?+ V8 ]5 L
  286. ; w4 ]8 N" |! [% L; b1 V
  287. .IF Music_Reset_Addr
    . \. G/ c9 H% R8 }. ^: v# ^
  288. JSR Sound_Reset
    # v$ e1 E( z4 ^; e2 w% {# s
  289. .Endif* h" `+ Y: P' n3 v

  290. # S* t& r7 I" n0 b1 i$ a% t  c
  291. LDA #Music_Start_Song-$01* P4 ~1 d" p& M6 e
  292. STA Music_Cur
    3 B1 N- H% L( s8 Y- v. h

  293. 2 A, b* B& |7 U5 j5 M
  294. JSR Show_Music_Text( t% o; m2 b+ L& x) T" a

  295. 3 V# h. q4 V. \
  296. .IF SOUND_BAR_SHOW_ENABLE
    ! X2 J  t: n/ ^
  297. JSR Sound_Bar_Text_Set
    ( J) E. ^& ]3 q8 y  {8 y
  298. .ENDIF
    # ^$ {/ R- Z% n9 ^; Z" b

  299. 8 f' H8 A7 x& ~6 W- i- a+ L
  300. .IF Track_Name_Pos8 a2 V( C  c- Z5 i- M8 r
  301. JSR Show_Track_Info& b: s* I4 l# p& f$ ^7 P
  302. .ENDIF1 Z  b8 U4 ~% h/ @8 Y' r

  303. , y  r5 Y& ~  @) k& U. W3 N
  304. JSR PPU_Proc
    * {  @+ z. y( a/ ~
  305. , B  x5 A, C+ y$ D5 h% N; @
  306. LDA #$0E
    $ ?5 ?6 F) s. Z6 s7 T3 o( j: ?
  307. STA Screen_State
    " }: }: f" d1 h0 D

  308. 7 Q, ~1 i2 I" f" @$ ?
  309. JSR Sund_Bank_Init- q% l8 C( p: Y) P9 {

  310. " o: F3 Q* u* k" \5 V- r
  311. JSR Music_Show
    : P5 @7 N% n5 ]: L: N) ]0 a
  312. JSR Time_Show
    ' i( x6 o( P0 {
  313. JSR Music_Stata_Show
    $ C, o( m. c7 `' ?8 Y; f
  314. JSR Time_Delay7 P4 U( W# z! ^. d

  315. $ P, R6 ]2 h# W/ u, {3 @! J

  316. 5 r6 n0 g- k$ A4 ]" P
  317. LDA #$80: @# z2 z. D  v3 q; ~
  318. STA PPU_CTRL
    9 x3 j& T# k  [" v7 f' E
  319.   s9 G6 w/ y" ?  Q* X8 ]
  320. LDA #$20' `3 e) |* c4 Y7 n2 d  Z
  321. STA Time_Wait_Cnt2 ^1 m0 \6 e- e) g

  322. ! u" c/ ~# o; l# s1 }
  323. Wait_Time_Over, ]/ ]( s& \4 o# ?
  324. LDA Time_Wait_Cnt
    + Z& ?( A: o4 i' P, p  o
  325. BNE Wait_Time_Over# N( H  q' j6 q/ h' U1 v. p

  326. 6 s6 l6 w+ l  [6 j6 S9 x
  327. LDA #$1F$ u* j9 x8 Q6 ^# d* r
  328. STA APU_STATUS
    ' O3 e' t6 n  |
  329. LDA Music_Cur& C9 R& O7 N. D0 ?# R9 [  O
  330. JSR Sound_Init+ a. }7 g) o( {  d
  331. ) @- d2 b. l& s0 G3 s
  332. JMP MainLoop4 h2 Z% P+ }5 ?
  333. * R3 S# S9 \8 R3 C/ p
  334. ;==============================
    0 x0 c" r* `! G) S" s
  335. Time_Delay;延时等待- s1 L1 S; c1 A$ Z' P- t: ~, j3 C
  336. LDA PPU_STATUS" A% s* A" W; o
  337. BPL Time_Delay
    0 n5 ^0 D1 E' T# o, b8 ^/ u% B6 f. m8 }
  338. RTS
    5 N' x& J# ]% r$ r* c- T* Q
  339. , y8 V5 G1 o3 {$ u& [% t
  340. ;==============================
    6 W# n0 ]3 ]6 T; v
  341. VramInit;初始化图形内存! {+ J  U4 l( @* S
  342. LDA #CHR_DATA_BANK
    2 T) h' `. z: W  o& f. k
  343. JSR SwitchBankA000
    ' r5 U) u* x9 z9 \
  344. LDA #LOW(CHR_DATA_ADDR)# I5 s$ I2 S7 l7 Z. K( o/ `, S
  345. STA <Data_L
    : y& r8 w4 X: ^
  346. LDA #HIGH(CHR_DATA_ADDR)
    5 U, m9 n% {" U0 t+ u( k8 }5 ^
  347. STA <Data_H; a' G8 O+ T* t% D# R4 y: d! c
  348. LDY #$00
    3 @$ [! n$ x$ Q" x* G; f$ i
  349. LDX #$20
    ! N$ A* V& o  i: S
  350. LDA #$00
    " S" U4 J5 {: Z$ f* p% a
  351. STA PPU_ADDRESS
    " h- H3 S7 P- E' R$ C
  352. STA PPU_ADDRESS, H: {, k; U7 H8 N2 V/ Z4 `; C
  353. VramInitWrite
    + S' o$ [8 r6 B/ e1 V4 a; R4 y
  354. LDA [Data_L],Y5 h& ~, t7 H2 y+ q& q7 A
  355. STA PPU_DATA
    " m! k' M) o, U; Q8 u* g- i# C
  356. INY
    : c. Y& j* Y1 e
  357. BNE VramInitWrite
    ; W# [; G+ }6 X  w3 N' }, |) B3 I
  358. INC Data_H
    5 ?. x- G9 s2 L: h
  359. DEX* N" K' v. s: V8 D# X0 q
  360. BNE VramInitWrite
    4 |3 ]1 t5 @5 w; J( [0 B3 k* l
  361. RTS
    8 I8 q/ c9 \; D, _! {3 {) U: S

  362.   w; l1 C- L7 ^: y% Q
  363. ;==============================" @; r' c/ o; A1 ^) P& W5 U/ Q, a
  364. RAM_Clear;RAM清除
    0 n0 E: y' `7 c% E/ z5 u7 B
  365. LDX #$00
    2 z3 M) L2 d1 t0 x0 ~! `
  366. LDA #$00
    $ H) `# @5 C( G' @3 H6 |* x* W
  367. RAM_Clear_1
    - B' p; R& F, `8 F
  368. STA RAM_Cln_1,X
    % m7 o1 J1 t7 D
  369. INX  E( a2 m( @3 ?6 _
  370. CPX #RAM_Cln_1_Size
    / X# a7 ]7 Z1 l, j/ h) g0 h
  371. BNE RAM_Clear_1
    4 F& C' E# Q! `9 O: x2 O
  372. LDX #$00  B/ {  E( r0 r* H8 P- g
  373. RAM_Clear_2
    ' W& z! b' L$ l* Q5 X# F
  374. STA RAM_Cln_2,X
    + k6 n. W2 ^4 [: Q$ V
  375. INX
    " R5 \! T+ G; q' z/ u0 H" \
  376. CPX #RAM_Cln_2_Size( H9 G0 J) d$ `; j" U! u
  377. BNE RAM_Clear_23 n8 C! u& y+ _5 ~4 W, r) s
  378. LDX #$00
    ) T$ W6 K0 j" g0 a: {
  379. RAM_Clear_3
    . j' @; i+ [6 D$ |* q
  380. STA RAM_Cln_3,X& A% g5 h5 b3 F! @9 b
  381. INX6 e" K) [! e2 W% F9 w
  382. CPX #RAM_Cln_3_Size8 T4 J4 t+ g+ n  W' [8 n7 l
  383. BNE RAM_Clear_30 m% l+ f  |. L. s$ ]) [- P8 X
  384. RTS
    7 J1 [- f" r# i9 N0 T6 [$ I0 m
  385. 9 K  V5 R7 I  U% a2 l8 O
  386. ;==============================/ S4 p8 I* ^- B: ?/ V! j, o
  387. ;音乐切换1 K. l0 O1 T1 w' t" L' f* z/ [7 c$ i
  388. Music_Switch
    6 R5 y( }1 V8 R
  389. JSR Key_Proc' l! C+ z$ ?' v8 R: b
  390. LDA Key_Once+ A3 y3 y/ ~3 F3 T* q# \: P. h
  391. CMP #$10
    4 |) ^  b/ P' [" e1 }+ y* j$ ?6 m' d9 ]! n
  392. BNE Music_Start_SongStop/ M! Z1 D- C5 l8 k; n4 ], {
  393. JSR Music_ReSet/ k7 X2 d; L8 ~0 n' U  M

  394. & S! D+ H& r% J6 d
  395. ;音乐停止. b/ j3 g2 E6 w* J: l" W- H
  396. Music_Start_SongStop
    * B1 [4 A. Q% O! }  E5 S; _/ `! L( g
  397. LDA Key_Once
    * U. b1 e$ E9 S
  398. CMP #$20  S, `5 o/ Y* y7 h9 K" z
  399. BNE Music_arrow
    * H" [' [: x6 e& h$ ^. {  M% F0 j
  400. LDA #$01
    + k2 V! c3 W; p
  401. STA Music_State
    ! R( t) D8 z7 G. C
  402. JSR Music_Bar_ReSet0 e$ m" k1 m! E9 e, b) M$ `% m/ d
  403. JSR Time_ReSet
    : M+ G, [; C. G
  404. JSR RAM_Clear
    2 B. }+ ^- n" j; t
  405. JSR Sound_Clear$ H/ n- Y* T* ~. C) I) O7 Y
  406. JSR Music_Stata_Show
    + I* `& o- ~: Z: q
  407. Music_arrow2 H! O4 M- b: D+ V/ {+ l( H/ Z
  408. LDA Key_Once5 R$ ^1 [" L& I( L3 q( }
  409. AND #$CF$ z" f$ Z2 Z3 X+ |$ _$ F* s
  410. BEQ Music_Switch_End4 U- [4 T, h+ t
  411. JSR Music_Number
    $ m- i0 S6 Y" h3 J
  412. JSR Music_ReSet
    ! R  g" @$ H% g- @5 J! P
  413. JSR Music_Show6 t; g1 o+ k* f
  414. Music_Switch_End
    * p* o7 @# `5 M" W7 X  y6 {
  415. RTS
    3 \! V0 d  |7 Q& b' R2 {
  416. * f+ {2 X7 y0 B/ d. d
  417. ;==============================! k3 O& J7 G- y
  418. ;音乐曲目切换( R# }7 ^% p$ f5 C4 m
  419. Music_Number
    / E3 p4 X: ?* A9 R0 E8 U- [
  420. LDA Music_Cur2 N8 d' W' |/ a; J
  421. STA Music_Last: S: V. P" ~) ~8 M( k) c  @
  422. Music_Decrease- j( O4 h2 s. O" [' p
  423. LDA Key_Once: E/ M- I- Y* H, `& c. t
  424. AND #$42
    % u& B3 k+ S, `$ x5 M% W, B8 T6 a/ p, c
  425. BEQ Music_Increase
    / I6 S- c4 B6 T/ l; z. s( M$ o) S
  426. LDA Music_Cur
    5 S. }0 V! D, C
  427. BEQ Music_Increase
    ; ]! g& K5 @6 n7 ]% K5 o. R, d6 _
  428. DEC Music_Cur
    6 g' s: `& x! Z4 r( Z+ x; |
  429. Music_Increase$ B. A& I1 I8 W
  430. LDA Key_Once
    % T+ t9 Z5 n# ]2 J" k
  431. AND #$81
    / Z2 x& D+ W# _4 v6 w
  432. BEQ Music_Decrease_10$ ]/ ?  ?" j2 Q0 K
  433. LDA Music_Cur
    6 f) I3 Q0 B- \- T/ M% g  ]( i4 s+ U
  434. CMP #Music_Song_Total-015 E0 J0 |6 L9 D$ o: `, `
  435. BCS Music_Decrease_10( I- f, r/ h/ M5 S9 B
  436. INC Music_Cur
    % }6 t1 L2 U) }* N; N$ e/ F
  437. Music_Decrease_10
    " H3 s4 P6 \2 w+ I: w5 O( i4 Y
  438. LDA Key_Once
    % R  d- `) T7 n, e
  439. CMP #$04
    ) t( t& j- k  Q
  440. BNE Music_Increase_10! Y' v' m3 [1 c7 U/ I0 I& s
  441. LDA Music_Cur, P9 m3 }$ c1 h5 u4 F3 N
  442. CMP #102 ?2 @+ m% r. l) r2 R. J8 Y
  443. BCC Music_Start_Song_Min
    - c2 b" x/ d& X4 P/ M
  444. LDA Music_Cur: ~; n' F2 A, v6 W
  445. SEC
    0 l" g4 _. P0 I9 P8 M: a+ }1 }* w
  446. SBC #10
    4 P* o: G: a; c( j6 u7 B( p
  447. STA Music_Cur  \: K7 g9 F. i/ R, Y: x/ B9 C
  448. LDA #$00
    & }+ D' H4 F, X
  449. BEQ Music_Increase_10
    5 A$ S8 \5 q6 F( L/ c
  450. Music_Start_Song_Min
      @3 Q+ m9 k4 C! F7 |% c) h/ B
  451. LDA #$00) p  L1 Z. k& L0 ~) ]; @( G! u0 B
  452. STA Music_Cur
    3 U; ?. X$ R2 v2 G+ K; z, v6 z
  453. Music_Increase_10
    # J2 B$ {" r; h1 N
  454. LDA Key_Once
    % W* C$ a( s/ E
  455. CMP #$08
    ! K$ U+ _* {+ ^. e; j
  456. BNE Music_Number_End
    6 ^, z; V0 w/ s3 L: k
  457. LDA Music_Cur
    % L  }6 C# Q$ C( V
  458. CLC
    & E' G$ a, G# g4 d/ k
  459. ADC #100 c) F) p/ d1 H  X% l
  460. CMP #Music_Song_Total-015 v. w4 b% k7 N9 S. }
  461. BCS Music_Start_Song_Max. y2 D: z6 D8 o5 ?( v
  462. STA Music_Cur
    * Y* c/ W4 d: r4 f1 T7 Q
  463. LDA #00
    ( f6 H6 ~- t6 T3 }
  464. BEQ Music_Number_End& x. C; K/ c- y  i
  465. Music_Start_Song_Max
    . d6 N; x+ s5 g$ P4 e
  466. LDA #Music_Song_Total-01
    & k, N" ]* z2 k3 g" _/ b
  467. STA Music_Cur: }0 U" X' O. ?7 \7 W0 b  Y7 }
  468. Music_Number_End
    8 J1 N. M0 ?5 f! s
  469. RTS
    ) V* u9 i3 n6 U- t& {& q1 N3 j6 P, W
  470. + l/ e( O9 V2 z% `  l
  471. ;==============================
    . D# m# z$ @# G* w' r
  472. ;音乐重设! ]) Y, s7 @9 I
  473. Music_ReSet$ ?" a8 N& n/ x+ n
  474. JSR RAM_Clear
      K6 D, U; \: D! N, O+ Y6 e, X
  475. JSR Sound_Clear
    # Y% b! u: E, n% x
  476. LDA #$1F$ o% }$ Z. z  J7 d" V1 F
  477. STA APU_STATUS
    ) R) T# M$ t+ p2 S% i% H4 u
  478. LDA Music_Cur
      {, H: g) d  i9 c
  479. JSR Sound_Init
    & P' P; `9 k7 F" F
  480. RTS& N1 Q$ {$ @; |2 @
  481. 6 d( r7 v0 \5 `8 @" b
  482. ;==============================
    * `7 ^: ~2 S5 N" }$ Z" a
  483. ;音乐端口清除3 ~6 _$ J2 `5 z8 N+ w+ N5 W& a$ D
  484. Sound_Clear$ `. G( f; ~& R; d
  485. LDA #$00
    2 b2 E: M1 O# t7 a' \% H4 R
  486. STA APU_STATUS
    " B( Z- c9 C2 c+ g, h+ C; r# W. n
  487. LDX #$00. X+ p! G2 Y8 {- I6 t7 I
  488. Sound_Clear_Start
    # b4 |2 I/ A# g. T
  489. STA $4000,X8 E  A- ]- E: e
  490. INX. |2 b0 ~, |) s( _8 a7 w
  491. CPX #$14* W& r) h( l: S7 w$ j7 H7 e
  492. BCC Sound_Clear_Start
    ! ]! T" g  Y) `5 b5 {8 B/ X
  493. RTS2 T- w3 O4 r/ b

  494. 0 {* r9 p# a9 M, {7 f7 p3 ^( v! S
  495. ;==============================4 P" t8 x  v' W* d: X  ^2 l4 E
  496. ;按键处理
    , b! S6 s6 p) x8 w
  497. Key_Proc
    ) h  M' ~/ M- m' K5 Y# A: \9 c
  498. JSR Key_Scan
    ' e2 E1 ?- i5 z, @2 I$ I, s+ i
  499. LDA Key_Keep6 x0 ^, i9 ~5 ^. J
  500. STA Key_Temp
    - _! m" U: c# O/ o4 r
  501. JSR Key_Scan
      b2 F, j0 D" h* z
  502. LDA Key_Keep% s' K4 b; D- d
  503. CMP Key_Temp
    ( W: B; I  Q+ |! y! ?, g" F; d
  504. BEQ Key_Get_Once
    / J# b! |; i0 ?
  505. LDA Key_Kemp$ m5 `: n5 ]. Q* W' Z+ E
  506. STA Key_Keep& L" H/ F  A% J& l) h
  507. Key_Get_Once4 j( j3 n- q) n7 f' x
  508. TAY
    1 h  ]8 c& r+ Y7 y0 f: N1 M
  509. EOR Key_Kemp- q" g; }& ^$ z) R3 l0 p1 u
  510. AND Key_Keep/ k: z; [8 q# N/ q4 y1 `# `2 J8 K
  511. STA Key_Once
    ) u/ L' X( D* @7 m
  512. STY Key_Kemp- y- @: h% k2 G0 S
  513. RTS
    ) m+ m* I0 L' v6 e' D3 t$ _
  514. ;------------------------------4 ?2 ?4 \  U) U8 F2 F. c+ Q
  515. ;按键扫描
    ( ?0 q0 w9 }8 z$ D2 K2 \
  516. Key_Scan9 y0 W, ], J: s! D) H' v- l! _0 H
  517. LDX #$01
    0 n: O( n5 S' Y7 a; L8 b
  518. STX JOY1_FRAME
    7 R; P" N8 \$ D4 T& f
  519. DEX: Q5 o% \" z# G& O8 C$ U: g
  520. STX JOY1_FRAME% A& u& ?2 f4 i/ G5 |- L1 h. n
  521. LDX #$08
    / ?! ~9 y  b, R; p" g. V3 W
  522. Key_Value
    0 ^: K9 V# e: D
  523. LDA JOY1_FRAME
    # R* C$ X" e* J# V' B9 E% _# t
  524. STA Key_Getv' t. {. u, I6 J% E+ w
  525. LSR A& T! T, l7 i' \$ H
  526. ORA Key_Getv. L0 Y7 Q! e. X: R* @. p9 o! @
  527. LSR A
    7 [9 e8 O4 S# Y. e5 `
  528. ROL Key_Keep
    ! z: J  I: t: V% w7 t
  529. DEX
    ; o# z% i/ |% k2 m: u
  530. BNE Key_Value
    & l1 B( m( I0 K3 \
  531. RTS! x1 |. J% j" Z0 s2 L3 t

  532. . E4 e" [2 S4 h5 s& S8 [
  533. ;==============================% @' G+ {( H2 w) m1 ^0 d
  534. .IF SOUND_BAR_SHOW_ENABLE5 k$ h  ]$ M- l7 j6 Z
  535. ;音乐条显示
    / b' ^: L: ?1 U& _7 _1 ~. d5 `
  536. Music_Vision8 ?0 o6 l7 \& E: O/ C0 w
  537. JSR Music_Animation/ G/ P) p: s; T
  538. JSR PPU_End3 g. I9 n! V% `
  539. RTS/ }. h! ]2 N, L# k
  540. ;------------------------------% b. x" ~4 h  I& L* v
  541. ;音乐条显示处理
    9 |% b9 F! S1 t9 g6 J' F% |, X
  542. Music_Animation
    / b7 |- r" W; q! {+ J
  543. LDX PPU_Cur- h: G0 r) ^3 K8 z" B( Z& j
  544. LDA #Mode_Line2 q* ^3 T4 y5 s2 n3 Z% z- d* G3 K9 B
  545. STA PPU_Addr,X
    ) Z' {* ~8 V2 Y$ ^
  546. INX  b/ l3 f8 _: T% T; R1 S! o( J+ O
  547. LDA #HIGH(Sound_Bar_Pos)6 _1 P5 O( r: r$ H3 _
  548. STA PPU_Addr,X
    - d" s. r0 @# C
  549. INX3 g$ H7 G+ [- ]9 ?3 z% J
  550. LDA #LOW(Sound_Bar_Pos)
    , e' V! f- Z5 d( c* u) S
  551. STA PPU_Addr,X
    5 O% I2 V+ w- B. W+ C. v) W/ L) Y
  552. INX- g: z" v) l* d  V3 `
  553. LDA Sound_Bar
    9 p7 a2 B* s1 H' `! s9 I" S
  554. JSR Volume_Convert( U5 l' @; ?& r
  555. JSR PPU_Return0 o! h5 X0 d- d# {1 B
  556. LDA Sound_Bar+$4# A/ e; w  S& {; H+ K  e7 @8 P
  557. JSR Volume_Convert* Y) o, q; `: ^
  558. JSR PPU_Return
    # J$ n' C9 U) `# `" m9 W3 P2 }* C
  559. LDA Sound_Bar+$8& i# |9 T( H7 T7 T- K
  560. JSR Volume_Convert_Ex
    ; G4 L1 y, t0 v; ?  j  c8 S
  561. JSR PPU_Return
    : Q" B: B% m* N5 e0 Q) P/ |, ]
  562. LDA Sound_Bar+$C+ u, i, F' s( [
  563. JSR Volume_Convert
    % Q3 A1 e: I; X- F0 {; [- ~
  564. JSR PPU_Return
    ; U7 V. k4 M2 b. r
  565. LDY #$10
    8 B3 x1 }& Q+ {  a) Y
  566. LDA APU_STATUS
    - R$ l2 S( ^' q: |+ W/ r1 F5 ?
  567. AND #$10: q- [8 z$ v, C2 a1 J. O, g* b! _
  568. BNE Volume_Count, s3 K/ m5 j8 Q0 ?+ p& k
  569. LDY #$00+ \8 o8 l# T$ P0 ]+ l' V/ J/ t5 ~
  570. BEQ Volume_Count
    # i+ e) Q9 p8 f" d3 I/ {; ?
  571. ;------------------------------# m8 m, p4 m( |' H2 ]. g) a
  572. ;音乐条处理
    : _  B  o; s+ U7 n" j. X  V1 W
  573. Volume_Convert_Ex% W! E8 A; F+ O8 c4 {: N. ?
  574. AND #$1F
    9 m' J4 e" F( ]1 @- S
  575. TAY4 ^# ^" M8 p4 l+ ~2 ]6 `9 N
  576. BNE Volume_Count( R4 {3 U$ r; a$ W, R7 R
  577. Volume_Convert# O- _& y. v! c* b# @
  578. AND #$0F" K( O* K0 e! r- F( B
  579. TAY( k8 }, G3 g% E/ G! O& _
  580. Volume_Count* x4 |$ `! s* g3 o0 c, n
  581. LDA #$08
    4 n9 m% z" b, @! r) g1 a
  582. STA Sound_Bar_Cnt
    ) u5 o; M' Z/ }" H  K! i
  583. Volume_FILL
    * h& r  s% H( m% Q
  584. DEY
    / L& f2 o3 |+ p  E, y6 \* e" c; _
  585. BEQ Volume_Half
    1 P, I$ u# q' C5 `
  586. BMI Volume_Empty- y; K; F9 b! ^
  587. DEY
    . f. L( ]. |$ b7 F% ?
  588. Volume_Full
    . m( K& H0 Y( y
  589. LDA #$16
    # k/ J; i* b) F% t8 ~
  590. BNE Volume_PPU
    ) c5 P' \: ?% P$ N  x2 X/ k
  591. Volume_Half) t; e& m1 j) J: v( j
  592. LDA #$15- n7 _8 a# n# S$ R) H6 \1 i/ F3 Y
  593. BNE Volume_PPU5 Z- c) ]) `' ]/ y) G/ l( l# @
  594. Volume_Empty
    # N7 R0 Y8 E( H
  595. LDA #$14
    / p- O( [: e9 A7 O  y
  596. Volume_PPU
    7 b* J1 }5 F" C5 }- b# _/ l$ W
  597. STA PPU_Addr,X
    / j/ d' f0 P, G6 y1 @$ s& R: X2 h7 w
  598. INX. M7 D/ l$ _7 l5 k  I
  599. DEC Sound_Bar_Cnt
    6 k) n8 k' C/ |0 P. ^
  600. BNE Volume_FILL
    $ Z# b2 `2 x4 u5 @
  601. RTS
    ) ]1 }) D2 ]5 N% e  n

  602. * R6 n& J* e  x5 O& A
  603. .ENDIF; w2 J0 {% ?% Z5 b8 H
  604. / v8 ?3 n9 b: S' K8 [% T+ }
  605. ;==============================0 U6 x: v' U6 G" ^5 R7 ^
  606. PPU_Addr_Set;PPU行开始
    1 W% l/ }# B4 L8 i. {7 G9 B
  607. LDX PPU_Cur
      I5 W! j0 m1 V" ?$ O; B
  608. LDA #Mode_Line! ^. `* P# S0 J! q
  609. STA PPU_Addr,X' z1 B. n1 z7 i6 D, `/ N* B
  610. INX
    ' j+ o" A( D( \) I
  611. RTS
    9 C8 f5 s3 G6 w; U8 u" V
  612. / l9 N; C" [! U/ p
  613. PPU_Return;PPU转行
    1 z  k/ Y3 s& h3 f: I
  614. LDA #Flag_Over
    ! {& M7 Q, {  y# W% z4 `
  615. STA PPU_Addr,X' _! u$ g$ D0 O
  616. INX1 K. I3 X! W, m; J6 Q4 r
  617. LDA #Mode_Return
    8 z3 D: S# s: |) c/ y2 ~/ C
  618. STA PPU_Addr,X9 _/ V. [* U; j- z
  619. INX* O* h! T/ i5 v4 q
  620. RTS
    , f% I9 S" L8 R. \/ X

  621. + w  C9 \' _; l
  622. ;------------------------------/ Z7 v3 g3 F& c6 P3 C6 {
  623. PPU_End;PPU结束0 O% s5 c3 N2 o; U" @/ w) }" O
  624. LDA #Flag_Over
    . ^( n) |6 N6 k5 z/ q/ S' l; i
  625. STA PPU_Addr,X6 J- l9 B- U. M2 M) z
  626. INX
    $ h5 z! Y8 ?" a0 f, _
  627. STX PPU_Cur
    - D4 {6 j& }, r; O, J
  628. RTS5 M  d' m+ M: |
  629. ;==============================) I- B; `6 o5 z- o' b  ?; \* q
  630. Mode_Line     = $FD    ;新起行模式
    6 Q$ Y3 p/ z+ }& q4 |
  631. Mode_Return   = $FE    ;转下行模式3 x1 `" z7 D( O* X" F0 \( S
  632. Mode_Clear    = $FC    ;行清除/ z. ~' S2 v. ^- Q8 Y: F
  633. Mode_CntLine  = $FB    ;行计数写入
    9 H5 P) q) E+ b. s3 W
  634. Flag_Over     = $FF    ;行结束标志5 b4 y; b, G- \; O6 i: c3 f

  635. - O$ |/ `: K& p2 j
  636. ;------------------------------
    - b6 k+ K3 `4 c0 [
  637. ;PPU处理( g0 z- }6 a2 Y2 I) k3 Q4 _- {7 |0 d
  638. PPU_Proc! i4 s/ d" u$ \. j8 X$ X2 V1 Y
  639. LDX PPU_Cur: S1 x( V" b0 \6 y
  640. LDA #$00
    ! z( ]9 Q+ _0 H' S! \
  641. STA PPU_Cur- V- `1 H+ r8 D; L$ ?  I' d
  642. STA PPU_Addr,X# _  X5 G) f  }! ]) }2 }1 C4 R
  643. LDA PPU_Addr" o6 i. B) g  W2 `
  644. BNE PPU_Proc_Beg  v8 a1 m8 X/ M# H$ S" a
  645. PPU_Proc_Ret0 D5 V5 ^" n6 Z: U- A6 R0 a" k
  646. RTS
    2 `: m8 W' F5 j. R9 P& e  _5 b, i1 ~
  647. ;------------------------------
    3 Y9 s  A% I" n' h0 c+ r0 v
  648. PPU_Proc_Beg  ;处理开始
    5 `9 p3 t1 x; e( h# _: ?) J) W
  649. LDX #$009 ]% x0 [% J3 e  X2 |  I
  650. STX PPU_MASK
    5 X/ F  h9 [* S. {6 N6 o3 Y
  651. ;------------------------------
    " F3 v  z% c) J8 _1 l1 H: K
  652. PPU_Mode_Select  ;模式选择9 W" E# ^1 @6 A. z; O! d9 A
  653. LDA PPU_Addr,X
    9 \& J3 O, Q7 Q, {  V' A' D
  654. CMP #Mode_Line0 U, R; m! A# U/ c* U6 Z
  655. BEQ PPU_Mode_Newline& H5 U( D8 E- d" {8 b0 f, R
  656. CMP #Mode_Return! `% M1 p+ G5 ^& X( p8 t* A- N
  657. BEQ PPU_Mode_Return% ^+ r. f* d/ b. L, p
  658. CMP #Mode_Clear
    , d- {1 X& a, U5 k. b  |
  659. BEQ PPU_Proc_Clear
    1 ]$ i, w- f. o/ @" ~/ b* L1 ?
  660. CMP #Mode_CntLine) g. @' X( O2 ^9 d
  661. BEQ PPU_Proc_Cnt_Line
    % c0 w9 G9 z# {( x: W0 m% x+ D  A
  662. RTS" j# N- X9 C: p4 K/ E
  663. ;------------------------------
    ; h! S+ H; n# J3 E& N' C
  664. PPU_Mode_Return  ;转下行模式3 o1 m( ~9 ]* x+ D& W, Q
  665. LDA PPU_Addr_L3 j/ z# f( f" C" R) @+ ?' c
  666. CLC/ e/ f1 e& S: Z# n+ P
  667. ADC #$203 B" Q8 c$ p, [& ^4 p) B* A
  668. STA PPU_Addr_L
    8 Z7 b! p. h$ P% h8 y- ^% R
  669. BCC PPU_Return_End
    . @% s5 Z. u3 \1 S8 h- i& W
  670. INC PPU_Addr_H$ Y( p+ O# X" ^, H- f
  671. PPU_Return_End" }/ q) h( H' }  N. e9 ]% I
  672. JMP PPU_Set_Increaser4 f6 k8 D- o- q
  673. ;------------------------------
    9 I# {! _9 Q2 A3 Z( l9 q
  674. PPU_Mode_Newline  ;新起行模式; A( O, s/ B" F2 x6 P
  675. INX
    - [4 d5 B6 w; U8 c' L6 F
  676. LDA PPU_Addr,X
    $ @! Y7 ?/ e' j' m! f$ O
  677. STA PPU_Addr_H
    & b' \$ F% R* C! s( f3 P3 P: c
  678. INX3 r( q* R3 c  G' R1 `1 W
  679. LDA PPU_Addr,X$ c0 y( Y( A+ @3 q
  680. STA PPU_Addr_L
    * Z$ E6 X4 x# t- G2 B' H
  681. ;------------------------------
    * F( E1 ]# z9 h
  682. PPU_Set_Increaser   ;设置写入地址
    ' \$ _, @0 `1 U& t* r% T
  683. LDA PPU_Addr_H' [+ r3 n4 ^$ E7 C: v$ Q* ?
  684. STA PPU_ADDRESS/ A" A4 `" C& c, B0 F
  685. LDA PPU_Addr_L# s1 p2 `9 [+ n, d, o9 \
  686. STA PPU_ADDRESS9 W! B" }9 y& B+ }) q% R2 d
  687. ;------------------------------
      ]; G* ~1 {! b! J% x  l
  688. PPU_Write   ;写入数据% G9 t! R% q* u4 q( a% u* X2 ~5 b0 _5 N" P
  689. INX, |" Q$ |3 Q* Z# \
  690. LDA PPU_Addr,X9 t) h/ g6 O! d/ C; Y8 E& K4 x
  691. CMP #Flag_Over# |, b% M4 u% b2 ]0 ~7 i4 A
  692. BEQ PPU_Proc_End
    - _5 _/ g/ @0 w3 |# h8 X
  693. STA PPU_DATA
    6 |1 X9 k2 h6 Y4 X) m; B
  694. JMP PPU_Write( A& a, ]: S: e: q8 {: L
  695. ;------------------------------
    ) U' M4 Y. E8 p7 Y6 f$ M: a
  696. PPU_Proc_End  ;单行写入结束" J" M! ~" I7 \8 |& j# i+ S
  697. INX
    7 e8 O9 h1 e8 D" M
  698. LDA PPU_Addr,X
    2 R# a7 @3 z& Q  d4 A
  699. BNE PPU_Mode_Select, _! ^0 Q% f. I, R/ d" Z
  700. STA PPU_Addr  u! s0 {/ T( d& R5 E
  701. JSR Update_Palette_Color
    & s  v7 B4 u) }7 z. ^
  702. LDA #$000 c6 I& x8 y. U4 D% e- D( g
  703. STA PPU_ADDRESS# J5 g0 x9 H# k- S
  704. STA PPU_ADDRESS
    0 z7 Z( L1 |1 v/ h' T4 G% }5 o
  705. STA Show_Track_Name) S% b! e8 m5 a, c- a1 d5 M
  706. LDA #Scroll_X/ K1 N, F: z% ~
  707. STA PPU_SCROLL
    9 r8 l" v) h1 C7 U5 ~  E: p3 \
  708. LDA #Scroll_Y
    $ t9 S5 I& t' F3 E$ Z: ?1 T# E& h) V
  709. STA PPU_SCROLL. h1 j6 k" {' `8 l# {. A
  710. LDA Screen_State
    2 c) K0 q  i8 c( `* R. {
  711. STA PPU_MASK
    + p. Q( ^$ Z# s7 G+ ~# o6 t! {, l
  712. RTS
    $ R6 u5 m- y1 E- W+ x; ?+ V% E3 @
  713. ' n) |$ J/ L# o, {; }
  714. PPU_Proc_Clear
    0 Q3 D4 f; c) B* N  u5 J) K2 |
  715. INX3 J7 }/ W+ S; I1 r! H
  716. LDA PPU_Addr,X7 z% I2 c3 ^3 M- [# G* o2 D: L
  717. STA PPU_ADDRESS
    # v; ^" ]( R6 N" O- v3 M0 X7 I7 g
  718. INX. ?; t; t& ?" D. w
  719. LDA PPU_Addr,X
    $ @: L2 r, U, b, i
  720. STA PPU_ADDRESS3 O+ {+ i: z7 j- M* [6 R
  721. INX
    7 P+ z1 |! T% D
  722. LDY PPU_Addr,X
    / y. e- `  s) h# @, c! I- |
  723. LDA #$00
    6 d9 z6 B1 d+ G% V" d5 w
  724. PPU_Proc_Clear_Write
    + T1 @  \" t& N5 |
  725. STA PPU_DATA$ Q% V: z  n2 @/ M+ `8 }
  726. DEY
    9 E2 k9 `" y* p/ u
  727. BNE PPU_Proc_Clear_Write
    - T$ y2 I6 w: _+ F2 W; e, U
  728. JMP PPU_Proc_End6 u. `# _) x& N8 S9 c" f
  729. , ~$ u: M3 Y( L3 h3 K! A; m+ v
  730. PPU_Proc_Cnt_Line
    5 x, ~6 g% P  d
  731. INX- W; p7 z. H% l! o
  732. LDA PPU_Addr,X% A! L# E/ ]/ `
  733. STA PPU_ADDRESS
    $ C8 C' `/ I: K$ n  r5 |
  734. INX
    ! q! m# q' r4 x( Q4 |
  735. LDA PPU_Addr,X+ P2 k$ m3 X- z2 ^9 A( o
  736. STA PPU_ADDRESS' l( i2 |. N/ B* `  u& j$ I# l
  737. INX7 B2 A% Q; ]3 K- W6 ]  {* O
  738. LDY PPU_Addr,X+ s, Z' p" ?7 y" S* |; z5 L$ n4 O
  739. PPU_Proc_Cnt_Line_Write  w6 s$ |+ r; y2 X' J+ q
  740. INX
    ' Z. l$ X5 e! R- D7 P8 }
  741. LDA PPU_Addr,X1 H0 Q0 `8 g( R: j+ `" K$ L# m8 ]
  742. STA PPU_DATA
    2 g1 M3 i+ I' P- d9 _6 W0 w5 ]8 M
  743. DEY
    ( I) x1 f! _/ ]8 C
  744. BNE PPU_Proc_Cnt_Line_Write
    7 \# _* z6 v: S6 l
  745. JMP PPU_Proc_End3 v, s  j6 Z% C5 P0 M. {/ U9 Y

  746. 1 n9 l) q& E% b- i6 [
  747. ;==============================% G& f7 h6 H* U
  748. HEX_To_Dec;十六进制转十进制
    % E. X# s2 j' n
  749. STA HEX_Data
      H" X, i: N, \
  750. PHA
    7 C$ ?/ L1 G( {& {& [( ^
  751. TXA1 i/ g. J- @# J$ E. }  Q9 f
  752. PHA
    . P9 c, F. O% s. g
  753. LDX #$00% {' o2 m( D) R4 D: S. {
  754. LDA #$00
      @8 ]% E2 Z  F' ^! u
  755. HEX_Cln8 x4 @& T4 v& l" e  A
  756. STA DEC_H,X
    9 f6 {# Z1 T8 x. {* W; i0 f$ c
  757. INX+ {& D% e0 b$ v1 c$ N0 ]* l
  758. CPX #$033 M; z- A! ], p4 b
  759. BCC HEX_Cln1 Y/ I5 N0 m# r0 j! m/ l
  760. LDA HEX_Data0 g" r6 u; O1 N; F) c) L
  761. ;------------------------------
    9 [) K& |( q8 ?* H2 i; g) j$ u1 J) C% u
  762. HEX_100) A, y; k" i3 j% C  t4 C
  763. CMP #100
    - a* T7 |" k6 J  B1 D0 t9 x5 ?
  764. BCC HEX_10& |& b- G1 y# L" V# V
  765. SEC
    % d! r! e) I. \
  766. SBC #100
    5 @: b" J$ Z& s/ H+ o
  767. INC DEC_H! K3 Y: A( U$ h4 |; b  H
  768. BNE HEX_100
    , w& a$ C' P+ c( m; c4 J
  769. ;------------------------------
    ) H4 \! H' z  R- X/ c# X* x- J
  770. HEX_10
    * H  T0 v* `2 V0 b% o# b
  771. CMP #10( ]3 P: A$ N$ M' r6 R& }3 A+ h
  772. BCC HEX_13 |1 b' U2 Z, x, r4 g0 C
  773. SEC
    - t+ L0 N, p: N# A/ E# ^
  774. SBC #10( ?" R# Q5 U# ]- q
  775. INC DEC_T" H9 q2 V1 B* N/ n: X
  776. BNE HEX_10
    % N0 v1 G& e( x  p6 j
  777. ;------------------------------7 v! V% ~+ \7 A9 Y7 v
  778. HEX_1
    , s9 F1 H6 _  `# O1 K% _8 a
  779. STA DEC_L
    1 N1 y/ X2 Z+ w! J2 o4 O! l7 j
  780. PLA# z4 C) d- A" S" @1 q( C
  781. TAX* }  R4 A' n+ J6 d
  782. PLA
    + J# Y# R& h& I) ~5 r& S
  783. RTS
    " ], g3 ]4 c' V

  784. % J4 F0 W! e4 f8 a6 P' @6 S& q5 G
  785. ;==============================+ q* o# t% {: h. k) T! I
  786. ;音乐曲目显示
    " @$ a4 N! U  ~: Y
  787. Music_Show
    + Z) l: m7 |& P* h6 n
  788. LDA Music_Cur" C* f0 k1 x. e5 i% B
  789. CLC
    3 l9 I1 p% A  c( z% g4 v/ g+ q/ f
  790. ADC #$01
    % w' p/ V2 G. |2 c
  791. JSR HEX_To_Dec
    ! T% g! n% W: m/ A8 X8 X
  792. LDX PPU_Cur* L) {8 ^) _) R# U
  793. LDA #$FD
    2 C2 o. U0 y" ~. n
  794. STA PPU_Addr,X
    , ~5 C; H/ [2 j$ a6 L
  795. INX# k. v2 O: \2 `& v3 Z% q
  796. LDA #HIGH(Play_Index_Pos)
    + u; ?/ z# p1 \& \
  797. STA PPU_Addr,X
    ; v5 N- I4 A1 L1 @
  798. INX
    + }% s; |: R; N# J- Y' K' E/ p9 f
  799. LDA #LOW(Play_Index_Pos)
    + x) k/ F: j! x" s6 J4 L
  800. STA PPU_Addr,X
    % e! i7 w* ^8 M4 V5 o) W" L+ r+ l: s
  801. INX" R) j. S: v) u9 x

  802. ; F" i3 H% j/ V% l+ R3 ~6 p8 x" S  }
  803. .IF Music_Song_Total > 99
    9 {$ K9 Z+ p! `' n. [
  804. LDA DEC_H
    . y5 F1 ^1 Q$ t8 i0 M9 y' E, z
  805. ORA #$300 i7 G2 p+ C& ~$ k# T" {$ G
  806. STA PPU_Addr,X. ?' i  @( j" x, ?, C/ e6 f
  807. INX; h) W9 \6 }8 f
  808. .ENDIF
    : Z- c3 \3 X+ w( ^

  809. * @" l2 m+ B1 u+ l: n. N
  810. .IF Music_Song_Total > 9; c6 v) {1 M% d! Q, ]
  811. LDA DEC_T! p* f$ C# J1 r9 g& b+ U
  812. ORA #$30+ c0 Q2 T+ ?" I" p9 R
  813. STA PPU_Addr,X4 h+ N& i: M' v" ^$ i! P
  814. INX
    # N& D% y' ]2 T1 ]- h' W
  815. .ENDIF
    4 @- e, h0 `: r7 u( F" W

  816. , n  ?- f( a, [  ^" N
  817. LDA DEC_L: `  z# z# J9 B! w4 a; j
  818. ORA #$30
    9 ~# X* Q( Q  `! k  [" e7 I
  819. STA PPU_Addr,X
    7 U6 e4 V0 r' W  \. K. s
  820. INX, y, d3 y4 o8 W) t$ R% {) c- i) O
  821. 7 ]9 n2 N3 e$ f
  822. LDA #'/'
    3 {9 o% Z1 L9 u6 D0 R2 `
  823. STA PPU_Addr,X
    8 |  b& v8 ^7 m% N: ^& k, U
  824. INX
    1 {- ?" i- r& p. A
  825. Music_Show_Total4 u  r3 U& k" N' F0 r
  826. LDA #Music_Song_Total' {7 Z2 q5 L! ?% b0 ~2 `
  827. JSR HEX_To_Dec
    / h. W+ n8 R7 D! ?6 u7 l% X9 r- K

  828. , C6 _9 z" x, l# m/ u6 I6 A1 d
  829. .IF Music_Song_Total > 99
    + l1 y) d1 @# K3 N; w- f( C
  830. LDA DEC_H
    8 f" G' i7 i. H6 `- z3 q
  831. ORA #$30
    - ~! f( j6 B  {( R. O
  832. STA PPU_Addr,X
    7 a/ A  G1 J: ?
  833. INX
    4 E2 y1 {) s: ~3 T. E
  834. .ENDIF; b( y- E$ \# [; O
  835. : ?  i/ `* B7 K/ e& O% S
  836. .IF Music_Song_Total > 9; G! |8 P1 K) Q8 r9 N, }, y; Z* D
  837. LDA DEC_T% m( x4 h; T0 r- J- x: H2 c
  838. ORA #$30
    , L  k: h2 Z$ j
  839. STA PPU_Addr,X
    + ], G9 @& |* T, P4 s# _$ L
  840. INX
    . L7 j0 D( K; [. V/ t
  841. .ENDIF
    9 O% s( P& x' A# H) X% [

  842. ; t0 K2 U4 K! d; J0 x
  843. LDA DEC_L$ n5 a) `3 G$ l( e8 D( T% v# @
  844. ORA #$30
    1 }( g. v0 N: C) O+ F
  845. STA PPU_Addr,X
    $ c" x$ f, N% B+ P: r) t
  846. INX
    + P; p. c4 G5 B1 N% o4 ^% S; h

  847. 4 ^  P7 Q% `+ h9 m+ [& X( R
  848. JSR PPU_End. `- S. Z0 y. n" @0 F1 D
  849. Music_Show_End
    6 z0 M( ^6 m) e' K
  850. RTS' ~; W8 S$ L1 J+ A6 J/ @, d  X
  851. 4 u5 E% J) C4 X  o8 ?' c$ J2 i$ H
  852. ;==============================
    2 e5 N* Z2 }: z$ k+ V9 y
  853. Time_Show;播放时间显示" ?' n/ J: h0 n8 x" l) l  M) [$ n
  854. JSR PPU_Addr_Set
    . g; g  _/ ]4 x" l0 @6 F
  855. LDA #HIGH(Play_Time_Pos)
    # Q: ?6 h/ m5 O* P% B; K, r% _, \
  856. STA PPU_Addr,X& q; _0 ~. v6 ]
  857. INX2 v2 U) J& g5 h8 }. ^! m& V4 a3 @$ T( f
  858. LDA #LOW(Play_Time_Pos)' u: e* Z9 P4 Q) V* x
  859. STA PPU_Addr,X
    . o4 m+ I8 q2 J0 P. m8 a( }9 B! Q
  860. INX
    " M8 d5 b2 z+ x2 r' R- F6 b
  861. Time_Show_H+ ?" @5 N7 @  o$ ^5 n2 {4 M
  862. LDA Time_H
    " A' a6 o  Q: c7 k/ A
  863. JSR HEX_To_Dec# u+ U+ g' B# T0 ^8 Z
  864. JSR Time_Digit
    ; K' P5 Y/ J8 R- a( U! {- s
  865. LDA #':'' E% l4 q5 x! r0 u+ q
  866. STA PPU_Addr,X
    9 t2 V6 w) G% v. T8 Z- s1 w1 d
  867. INX! w9 F, V. D7 W9 G# H
  868. Time_Show_M+ c! d9 f8 h1 Z3 T. [$ k$ T% u# m
  869. LDA Time_M2 C# k5 j& H5 A0 }5 _) ^) H
  870. JSR HEX_To_Dec
    , K& x" g& \! V# G* u4 W8 {  Z
  871. JSR Time_Digit* }7 p; I5 m$ W4 u- s3 N; T. ^* }& z
  872. LDA #':'
    ; l* D' j: g2 p0 t
  873. STA PPU_Addr,X( J  q7 u" n# t
  874. INX
    , w- i" e# @" g
  875. Time_Show_S
    ' s. Q! [: L/ E
  876. LDA Time_S% L0 |8 v" t; @& Q+ f( K; m
  877. JSR HEX_To_Dec
    " l" S2 o' B' ]& {, u' J
  878. JSR Time_Digit0 Z+ a* r5 V2 ]& }: G
  879. JSR PPU_End/ k3 I8 K8 i' s/ v
  880. Time_Show_End, D& u9 G! [  m6 ^' @3 L2 ^
  881. RTS
    ' t9 y4 \! _& j: o! H
  882. + |' x; B1 u. m2 P. B; a3 G- [
  883. Time_Digit. L# P0 N$ j) l4 ^6 A0 i/ Z& r
  884. LDA DEC_T& R1 Z- k  H2 w3 S/ L
  885. ORA #$30
    9 i1 c! p7 N8 b4 n, U+ L( u8 c
  886. STA PPU_Addr,X
    * p/ D" d" D" N) z$ u9 ^( i
  887. INX
    % S; B6 x  C4 L% \' }7 [
  888. LDA DEC_L, d' z# g# P9 L, W/ b6 [& N
  889. ORA #$30
    1 ]8 J: A. W' J% o6 ]% [, J
  890. STA PPU_Addr,X
    9 W( |! M  e: B/ p* Q
  891. INX
    ' ]  V9 H9 C# A( X2 @6 q; t6 [
  892. RTS
    ) D. U: U7 t, l7 f/ w
  893. 6 O  E) `" ~# P
  894. ;==============================) o2 t- p: F  X! X' q
  895. Time_Count;计时
    4 j0 R1 j& l0 j4 }8 U
  896. LDA Music_State
    & a* d, C$ J( z1 v" ~
  897. ORA Time_Wait_Cnt
    ( {0 I4 i0 O. j) p) }/ I
  898. BNE Time_Count_End
    # `, B5 Z9 s; M4 w2 m9 O+ p
  899. INC Time_Cnt
    9 _# i3 x$ D9 a" v
  900. LDA Time_Cnt: z6 U9 A* L- D1 V0 h! d
  901. CMP #60
    5 K9 ^* {# ~+ b$ I* ^
  902. BCC Time_Count_End
    ) H6 q1 U! K: x$ ?! F9 x
  903. LDA #00
    . c5 w! t6 d; n8 }' P2 Y; @! k0 y
  904. STA Time_Cnt8 i( W; a* n- T+ @5 @+ u4 J
  905. INC Time_S( n( z* T; X$ [* b
  906. ; M! @7 n) j$ K: X
  907. Time_S_Cnt: i$ C/ Z( w  n/ e$ c2 X
  908. LDA Time_S4 y( P# G3 \. \4 r4 }' D
  909. CMP #607 O9 \$ L2 T1 K3 d
  910. BCC Time_Count_End
    ; f1 w# \; s& t# L* b. C' J  r
  911. LDA #00
    / o% ~# u$ c8 J+ E
  912. STA Time_S
    ; d% s# p2 t# L# {. r$ s; ]
  913. INC Time_M# L: r4 V0 Y1 `! G

  914. 2 M" z/ y% \$ |" b
  915. Time_M_Cnt' ~  ?/ \- Z+ E$ S
  916. LDA Time_M/ Z5 r  h7 r* m8 w" _
  917. CMP #60' H# G; i: S1 ?' |" _6 _* T
  918. BCC Time_Count_End
    ' r) H9 w$ J( p& |/ ]% p0 o
  919. LDA #00" c5 M! g1 X5 }# r" l
  920. STA Time_M
    " @3 c% J' l$ a. @5 R) m
  921. INC Time_H
    ; H2 {/ x+ m+ A/ n; w

  922. 8 ^4 Q$ _! Z! A/ ^' k
  923. Time_H_Cnt
    & l# M7 J2 @% @0 d8 A# e5 \
  924. LDA Time_H0 R3 M* \2 d" Q+ |& m
  925. CMP #24
    6 h5 p% ^" ?6 x+ {
  926. BCC Time_Count_End
    2 S! T1 K  Q. _$ c8 |5 J) N# d
  927. LDA #004 C4 x1 m' k. c+ V/ c
  928. STA Time_H
    / W8 l5 u! R2 d6 p( c
  929. ; v& Y% W9 V- {- e. O- M) I1 }
  930. Time_Count_End
    0 ~0 N# B* A- @/ ]" B/ Z
  931. RTS& U  |& m, X( ~  ]% f

  932. 4 b& m9 r! L% Z: y! Z
  933. ;==============================  c4 a- n5 a" J4 [
  934. Time_ReSet;播放时间重置+ {/ C# o. Q0 L3 _& n. |, q
  935. LDA #$00
    , @& @9 Z: M1 b# U1 I7 m! g
  936. STA Time_S0 d# N' t6 J' ^6 Z+ g; i- I
  937. STA Time_M ' Z8 m: \# K0 j; H4 ?, ]' L" [
  938. STA Time_H" M3 R6 G, U% ^* m1 ^5 P- x6 x
  939. STA Time_Cnt
    2 b3 ^1 e- z+ j2 ~' l0 m
  940. RTS1 L. j" T: r6 ~. e
  941. 7 u5 p6 P  {% a/ W* X
  942. ;==============================$ X0 l  w& e$ p$ }# B  F
  943. Music_Bar_ReSet;音乐条重置; K/ [- n3 [: M, ?& T, T/ l7 Y
  944. LDA #$002 ?% V4 v8 N, ^6 V5 w3 [" A4 M
  945. LDX #$00; V" o- Q5 z* [5 N
  946. Music_Bar_ReSet_Set
    2 N, p- @) ^" i& D
  947. STA Sound_Bar,X
    9 H3 |" P) M+ i7 O& }; G
  948. INX8 p! H! `- j3 X$ ~- i
  949. CPX #$10# b; M$ E. d2 P0 l! ?; }2 R  `
  950. BCC Music_Bar_ReSet_Set" h) |1 u7 z0 B+ q& y) \: v
  951. RTS
    * |& ]$ E8 A& e/ F( h
  952. , s7 W1 A. }9 o1 l& D$ H  B
  953. ;==============================* b. p) v! C. h
  954. PPU_Data;PPU数据写入9 b. f+ t$ U/ E7 t6 d, d! s8 g
  955. STY Data_L
    & K9 X+ x( m: V* X4 H. [
  956. STX Data_H1 v( @0 S$ F5 H. _7 q9 j- B, q
  957. LDY #$FF
    ( k* X/ @, O' v$ V% ?$ X  |+ A/ c
  958. LDX PPU_Cur
    1 j, H  F  E2 }: J; r# H
  959. DEX
    , C" d" S% T" y: Z
  960. PPU_Data_Beg
    8 S+ n+ w) Z# K/ z
  961. INX3 V( O2 C6 l2 l
  962. INY5 U6 F# O' t/ v4 y* V
  963. LDA [Data_L],Y: Q7 j/ M2 J$ ~- C0 N# K
  964. STA PPU_Addr,X
    + b, {. g# v  T' n
  965. BNE PPU_Data_Beg
    + i& i, g5 Z/ B) u- U" b5 Z
  966. STX PPU_Cur
    , Z3 ~, a+ s  Q% m; C8 j$ O2 N) p
  967. PPU_Data_End
    $ _7 {/ D0 N- U6 D
  968. RTS
    9 C$ g& l' @$ ]4 S5 q1 V) ~% f

  969. & a/ j  ~3 V. Q: p5 ?0 U4 X* u
  970. ;==============================
    . m4 @) e0 y  ]- c. Q' z7 {. g
  971. Music_Stata_Show;播放状态显示
    & Z) b; W+ t/ f, N! l6 Z! F
  972. LDA Music_State
    . k: s" S' @! H. `4 Z/ W  |1 ^
  973. BEQ Music_Stata_Show_Play
    9 a4 L4 |+ r- M! [6 R- \9 |: k/ m$ d# S
  974. Music_Stata_Show_Stop
    ( w* O- M4 ^/ Y
  975. LDY #LOW(Music_State_Stop)
    , |5 l0 L& c. s- h, ?7 ~
  976. LDX #HIGH(Music_State_Stop)$ ]$ d* ~( C& _
  977. JSR PPU_Data0 g; |) a, Y/ s( R
  978. RTS
    5 ]7 L+ E( [# y" f6 O
  979. Music_Stata_Show_Play
    & ?$ U! c! f* C
  980. LDY #LOW(Music_State_Play): @' [" I% c$ c- a* o
  981. LDX #HIGH(Music_State_Play)
    % f  W! S1 a: W. @6 Q8 ]. W* M
  982. JSR PPU_Data3 y: {/ y7 X7 _' b: ^$ z
  983. RTS7 \- I' p/ N3 w: @0 W, u

  984. ! \/ @8 R5 P' d- ^
  985. .IF SOUND_BAR_SHOW_ENABLE. M2 M7 c$ k) w6 M
  986. ;==============================# C4 Y& Z. G! A3 S. d
  987. Sound_Bar_Text_Set;标题与音乐条初始化! x* y2 ]$ l7 y( @+ T. r
  988. LDY #LOW(Sound_Bar_Text_Data)
    8 Z+ a- T; _, ?$ G# ^: `
  989. LDX #HIGH(Sound_Bar_Text_Data)8 B  ]* T. J/ Y% v7 l
  990. JSR PPU_Data
    0 D9 E* _6 I) n# o5 S% G
  991. RTS2 ?0 t5 N& B6 w* ~5 c
  992. % d# @" |; O8 B' Y
  993. .ENDIF
    0 E7 o5 C  J$ J& ]) L) ^
  994. " U& p' M+ i4 u5 j( q7 |; s
  995. ;==============================
    : D) B6 _9 J; h: t) k" p
  996. Set_NameTable_Attributes;设置命名表属性
    9 u! M- w' u0 O7 l4 Q
  997. LDA PPU_STATUS& ?! n5 Q' {/ @& Y4 n/ T
  998. LDA #$23
    7 `: T  K* h( u$ {# ~* v* K' [
  999. STA PPU_ADDRESS
    7 h/ C; u1 d8 R* {1 V& D
  1000. LDA #$C04 B# G1 N# n6 w8 j* a
  1001. STA PPU_ADDRESS
    + l$ a0 c% E# J
  1002. LDX #$008 {/ q/ F( ]( ^( s# x/ ~
  1003. Set_NameTable_Attributes_Write5 b9 ~" p5 v7 _& I
  1004. LDA Palette_Attributes,X
    / r& q7 A' t' Y' D! }% U
  1005. STA PPU_DATA7 Z5 f% y+ f6 T0 a
  1006. INX" c: Q2 q0 e1 C  [; ~% W
  1007. CPX #$400 w: i- @+ }: `8 S, o
  1008. BCC Set_NameTable_Attributes_Write+ m9 s5 K" e. l0 m( H9 L, k2 {
  1009. RTS
    % K/ {) p% V( t5 t1 a) p: k
  1010. ; E- B/ K( Q4 u
  1011. ;==============================
    / {& D8 Q; g! C0 d5 H, u/ k4 |
  1012. Set_Palette_Color;设置调色板数据
    " `" t3 j% q2 I7 o! U6 f4 z6 w! Z
  1013. LDA PPU_STATUS% m5 v7 W3 P; ?& v0 s5 Q
  1014. LDA #$3F1 E- i1 ~9 C* {/ s- z8 m
  1015. STA PPU_ADDRESS
    1 I( u7 ?" _6 r$ f/ E1 K
  1016. LDA #$00! ], ~7 o% q3 h$ L. r
  1017. STA PPU_ADDRESS
    3 ]# U5 n3 z, g" z* [/ q
  1018. LDX #$00
    ! [+ E4 `, I% d# E# I: V- U5 k
  1019. Set_Palette_Color_Write8 H9 i# S' p7 d( |" K
  1020. LDA Palette_Data,X9 O5 M: C% q% k+ Q- R1 I8 z* Y
  1021. STA PPU_DATA
    / b1 ^( Z( I8 }0 r- U' G
  1022. INX" Y  p/ l% \4 F4 x+ x
  1023. CPX #$20' I, S4 n8 b& q8 S/ c
  1024. BCC Set_Palette_Color_Write) L4 {) @0 L% n. V
  1025. RTS  E1 Z: z- d3 I1 L. {4 J
  1026. 1 v# P" t2 t& P
  1027. ;==============================
    , g2 a; B6 k2 i6 M9 g! E0 B1 l- G. f
  1028. Init_Palette_Addr;初始化调色板数据
    ; T8 @, d+ A6 W
  1029. LDX #$00
    : B8 I# y5 V5 {8 N1 z0 P1 _
  1030. Init_Palette_Addr_Write
    : E& ~7 o- s% y' r- ^) v
  1031. LDA Palette_Data,X3 u! O* a: g1 j  I
  1032. STA Palette_Addr,X
    1 w. C& A! d' N: a) F6 D9 K. a, o
  1033. INX
    % E9 m% U% u* ^
  1034. CPX #$20! I# M0 i/ f( c5 j+ ~4 `. t" [& J
  1035. BCC Init_Palette_Addr_Write7 K- f; Y7 I3 _" |7 a# t
  1036. RTS) M# }0 K& p4 e* v) x, q" p
  1037. - Z" u, Q' h0 E: K2 |* S% {
  1038. ;==============================
    6 \4 c7 u8 a; x
  1039. Update_Palette_Color;更新调色板颜色/ o! G7 r* F4 q- X, E: x7 m
  1040. LDA Show_Track_Name: j$ F1 G# ]. c8 u& R1 n( _
  1041. BNE Update_Palette_Color_End
    + h" P& e; V3 L+ T9 v* P
  1042. LDA Palette_Update_Flag( v  R1 r2 d; y. y% h
  1043. BEQ Update_Palette_Color_End
    7 m' Y0 E5 o# @' l/ O2 p/ u4 k
  1044. LDA #$3F' V2 n. {3 B0 ~
  1045. STA PPU_ADDRESS
    2 P) R! |. n  l3 |% Q
  1046. LDA #$00  _* Y+ X& T4 e* d
  1047. STA PPU_ADDRESS
    8 c6 w8 ]% H7 ~. M7 i7 `4 R. T
  1048. LDX #$000 k7 n& Y: a" ?% O9 ?
  1049. Update_Palette_Color_Write
    ( S& p" Q7 N1 y1 g' i/ C6 m
  1050. LDA Palette_Addr,X* x. M$ j& L3 `1 S
  1051. STA PPU_DATA/ Z% F! P5 e5 O
  1052. INX9 J& D% ]+ R. [+ H3 ?
  1053. CPX #$20$ d8 ]$ l2 ]; O4 Z) {! T9 L" Z  A
  1054. BCC Update_Palette_Color_Write4 \0 {+ ?& k# D! Q0 T4 L
  1055. LDA #$00
    , B- I: X. O% C* V* }3 I3 ?. X
  1056. STA Palette_Update_Flag9 F  i( |# D- \$ K  \  V1 w6 S+ B
  1057. Update_Palette_Color_End' m8 A' [  K4 h$ H0 z/ z
  1058. RTS
    . V5 m' ]$ P5 U: j8 b4 S( G

  1059. + v' |1 V3 t+ S4 i% K% `' P: n6 C
  1060. ;==============================5 ~2 n3 K8 [( ?9 \( G* S2 i3 v
  1061. Update_Palette_Data;更新调色板数据2 E1 N2 ^- K/ ^! h! L- T9 X( L# l
  1062. LDA Show_Track_Name
    2 y0 x, g9 x! b
  1063. BNE Update_Palette_Data_End
    0 Y4 {2 j; Z5 N! x# Z/ Y% U
  1064. LDA Music_State
    $ f9 e& |- F7 l! C! z" K0 v5 P
  1065. BNE Update_Palette_Data_End
    ! z% {: n7 g! g2 Q( k: Y0 |# S6 c0 T
  1066. Update_Palette_Data_Check. X1 {. k; L* V3 t& d) V% K% e
  1067. LDA Palette_Wait_Cnt+ ?( N; V( Y8 R: x5 u3 I( r2 W
  1068. BPL Update_Palette_Data_Check_Over9 p7 ^/ T( ?/ R0 C4 D* J
  1069. LDA #Palette_Update_Interval2 Y2 k2 m- d; |8 N' E) V. J
  1070. STA Palette_Wait_Cnt
    " U( }; c7 c  c  x1 }: @
  1071. Update_Palette_Data_Check_Over+ {+ P, m& d" y4 e
  1072. DEC Palette_Wait_Cnt8 l; R$ M% E$ w3 b* D; y4 X5 N
  1073. BNE Update_Palette_Data_End9 Y" h# o& S7 c% J+ _
  1074. INC Palette_Update_Flag
    4 J( w2 U* @3 S* {# `4 @
  1075. LDA #Palette_Update_Interval
    5 @$ ?* N- x) \! |' ]) K
  1076. STA Palette_Wait_Cnt
    1 E) _4 {0 D; X, F
  1077. LDA Palette_Update_Addr5 z. @* g9 d( ^  `9 H6 a( y
  1078. CMP #Palette_Update_Max4 [8 d& A) q5 P4 S9 A
  1079. BNE Update_Palette_Data_Set$ M1 \6 q" f& g: E$ F  i% D
  1080. LDA #Palette_Update_Min - 1" S+ D; J) i5 Z5 h* N9 A& D# r
  1081. STA Palette_Update_Addr
    * X" f. y, i: q3 M% w
  1082. Update_Palette_Data_Set1 N$ L- Q! E4 }: k1 ]# k& {8 w5 K$ m
  1083. INC Palette_Update_Addr$ q& V. z" J0 G. I% x2 U1 G
  1084. Update_Palette_Data_End
    + _; s* t! n) [" P0 b9 C
  1085. RTS
    + W* W* P; u/ P7 @

  1086. 3 q* _3 N( w( H& v
  1087. ;==============================
    6 a3 d2 c( k8 |+ i, f: P
  1088. Show_Music_Text;显示静态文本- w& F5 \3 e% a) _
  1089. LDX #$00
    , \2 M6 u6 Y9 T: H
  1090. Show_Music_Text_Set
    8 B8 P6 k3 u2 a% P7 W, M* w
  1091. LDA Static_Text_Data,X
    " _1 C& ~% b* d3 j$ {
  1092. STA Data_L* A8 D8 k9 r* I& t; {4 p- [  ~
  1093. INX' t; S2 ^3 P% K) h
  1094. LDA Static_Text_Data,X5 q/ J; ~" x8 k$ l2 ]: s
  1095. STA Data_H
    ' J$ ?! ^8 S' ]) a: ~8 u6 x
  1096. INX) K' k/ W/ w7 ~1 v  S
  1097. LDY #$00
    # i4 y; a! c' w) `# v; Q
  1098. LDA [Data_L],Y& ~6 J9 ?& c8 M
  1099. STA Data_Cnt7 B5 A. }" O5 @) }1 A) Q5 v' h( H
  1100. DEX
    0 }% i+ A& V) f3 m0 `
  1101. DEX
    " \7 K2 L- t) |6 N  q4 F
  1102. LDA Static_Text_Pos,X
    ' W  o; f8 p5 f+ K7 h* x( x8 _0 x0 S
  1103. STA PPU_ADDRESS" o3 G, P# u( H! G# X1 f% ?+ Q5 ]
  1104. INX
    4 ]! q& ?' m, g' o$ A+ s
  1105. LDA #$205 o) [! J4 R$ r1 |/ a: j2 v: V
  1106. SEC
    ! F" F& W4 A6 K, Q+ D
  1107. SBC Data_Cnt3 k! i# L- G" m7 m
  1108. LSR A' G% P/ D, ?( O! o$ Z+ ^5 l) T. c
  1109. STA Data_Buf3 m8 _& R" A/ }+ J- h  {0 g
  1110. LDA Static_Text_Pos,X# o! a3 @7 c) _% k& _
  1111. AND #$E0
    2 l3 _% |6 j# A9 D
  1112. CLC5 o. }" T6 a: [
  1113. ADC Data_Buf
    . U! `4 ~7 q" J- X1 t0 x
  1114. STA PPU_ADDRESS
    - o; A( j# P9 D. ?4 j2 x, D
  1115. INX, n! K, h8 a, H5 u% S
  1116. Show_Music_Text_Set_Write0 r$ e9 K7 D8 ^/ ^4 t3 R
  1117. INY+ U# _2 S7 F' i  z7 N
  1118. LDA [Data_L],Y
    4 s+ B* r3 T& r3 y" Q7 u4 Z& K# W
  1119. STA PPU_DATA
    2 @6 b9 E2 m  S, j  i+ @
  1120. DEC Data_Cnt( z7 U' A3 y5 {/ i  d* X
  1121. BNE Show_Music_Text_Set_Write
    5 t  q  }8 h+ Y. u  t" g
  1122. CPX #Static_Text_Pos_End - Static_Text_Pos
    ' g! d0 Q3 X, l8 R
  1123. BCC Show_Music_Text_Set% A5 P% ~# I, t( i
  1124. RTS( y" N$ w3 ^% c, U% R

  1125. 2 u7 ]+ x8 o, T, ~% h: |3 g  \
  1126. ;==============================- `1 Y7 n2 h, P! A
  1127. .IF Track_Name_Pos;显示曲目信息9 Y* ]1 u: M) J* L" U: n9 Y. l" Y
  1128. Show_Track_Info) I$ r8 T0 {, G3 u5 R+ {. T
  1129. INC Show_Track_Name! ~. A; c" |& d/ b" }8 W! t
  1130. Show_Track_Info_Clear- a. n5 k( [1 C- O
  1131. LDX PPU_Cur( |+ u' Y9 u' R5 V
  1132. LDA #Mode_Clear: [! `" A' h: ^; j# ]# |
  1133. STA PPU_Addr,X
    ( R) R; j+ ^3 V& }" D, J
  1134. INX
    # M( t: D1 @5 t& N) t2 Q

  1135. % N' k" N3 w! V  |* |3 @: k
  1136. LDA Music_Last
    4 b2 L" x  A$ E2 J- P
  1137. JSR Show_Get_Track_Name_Center_Pos
    - x3 O  G: Z: D* k
  1138. Show_Track_Info_Write_Cur0 j0 f1 Y6 A+ d
  1139. LDA #Mode_CntLine
    0 w/ U* J3 k! w; h' ^  H
  1140. STA PPU_Addr,X6 j$ w5 g$ N$ j4 V
  1141. INX) h* F) d' t8 H: b
  1142. / ?2 e: }$ l2 W5 w
  1143. LDA Music_Cur% V3 I* F7 F$ J7 a& t! Y
  1144. JSR Show_Get_Track_Name_Center_Pos
    * B% E( ^% L) _* {

  1145. ' k& K( a) R7 P' U
  1146. Show_Track_Info_Write_Cur_Data
    9 A3 A- {: @& L6 b+ m4 e/ V" K# k
  1147. INY+ G0 @( I2 i$ M
  1148. LDA [Data_L],Y) H( i! ~% |3 }
  1149. STA PPU_Addr,X
    8 H- S1 M4 D: d0 J9 r! P/ K7 L
  1150. INX
    + \2 j. z. ]. n4 R) {
  1151. DEC Data_Cnt3 h7 `3 U0 ?( l* i
  1152. BNE Show_Track_Info_Write_Cur_Data6 V+ S. w. k+ u6 I6 ]# Z
  1153. Show_Track_Info_End
    7 r5 T; c3 d, ]8 S" z+ r" b
  1154. STX PPU_Cur- |' O" k$ L/ g9 t% ?! k8 D( }
  1155. RTS  _. _, t! Q/ u0 h( i% s% ^' T
  1156. / \4 v2 _. R, |: z' I7 l  k1 @
  1157. ;==============================
    8 n' c& r& U0 r  L! G9 a
  1158. Show_Get_Track_Name_Center_Pos;获取中间位置, k! Q! h! b1 K; Y
  1159. ASL A
    . u8 h4 l/ ~* T& T9 [
  1160. TAY
    % V% S. ]+ r) p4 X# n( @6 s
  1161. LDA Track_Name_Addr,Y
    1 o0 G( U6 g" u% K
  1162. STA Data_L
    , L" a1 e. k9 y' [9 F& H) K
  1163. INY
    6 U0 F) U; u- C; K2 z- ^$ O; w9 G
  1164. LDA Track_Name_Addr,Y
    # Y3 W# v9 _, X3 Q1 q+ L5 W
  1165. STA Data_H0 d; g3 ~: U- @4 Y! e
  1166. LDY #$00
    2 c  t% a" L/ c& M) U5 i
  1167. LDA [Data_L],Y: X/ r* G% U9 a$ `
  1168. STA Data_Cnt( V- B+ ?( W% o
  1169. LDA #$20
    . j, B2 W8 b1 V9 C/ ]! T. U
  1170. SEC% Y& r- r) S1 k+ k3 Z  I6 w
  1171. SBC Data_Cnt5 H% s, I& c- V) T* o. B
  1172. LSR A. C! S5 j' J6 W7 m+ n  P# ^: j- J
  1173. STA Data_Buf
    ' P, M2 r8 T2 I: A% }
  1174. LDA #HIGH(Track_Name_Pos)3 O9 J9 g9 g- I. J  c. q
  1175. STA PPU_Addr,X3 I, g/ j& Y8 ?0 T9 G4 L. K" O! R
  1176. INX
      Y6 Q. [; [: v& F3 j
  1177. LDA #LOW(Track_Name_Pos)& P* H0 g0 N3 g
  1178. AND #$E0
    : c+ o% ^1 q1 z% Q  z
  1179. CLC
      I/ t$ E& V4 A  b# d
  1180. ADC Data_Buf
    ' P: c" Y: i: Y9 X
  1181. STA PPU_Addr,X
    ( E. Y! {# A& [0 C( }
  1182. INX6 ]5 o' i& X# z; V% Y. F3 v
  1183. LDA Data_Cnt
    % k" b9 _: I& _' [* Q
  1184. STA PPU_Addr,X$ m& \$ J* ^( l5 r( o. q1 }' ]  Q
  1185. INX
    ! @0 H* q9 _; |$ n3 \* y% N+ h
  1186. Show_Get_Pos_Center_End
    . D0 Q; \) c; E# t+ G1 g/ k* k; @0 f. i
  1187. RTS: t( Z: A8 r; i! r0 H  q
  1188. .ENDIF
    9 ?$ ]5 P+ Q9 S9 k
  1189. 9 ?+ N. E& N6 F  i1 A
  1190. ;------------------------------
    ! n( D! H5 X0 F8 C
  1191. ;命名表数据" e6 V% I2 Q. G4 u
  1192. Palette_Attributes
    4 E# q+ C" Q# T0 U7 [
  1193. .IF SOUND_BAR_SHOW_ENABLE
    , E8 e5 |2 g0 ~4 I" @1 {$ D
  1194. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00" s: b9 ~9 _3 v- s9 G
  1195. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$BB,$AA,$AA,$AA
    ) b& s4 @" C: I- i( ^( ^/ W
  1196. .DB $0F,$0F,$0F,$0F,$0B,$0A,$0A,$0A,$55,$55,$55,$55,$55,$55,$55,$554 W4 S& w0 c3 K& t3 o. N' Y
  1197. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$554 t. O% t' Y4 `
  1198. .ELSE7 i8 ?; {( D  ?2 B: ]; B
  1199. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00. {4 x) u. G6 B. y7 {% L
  1200. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
    ; S' Z0 |7 Q% H$ \5 \
  1201. .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$55,$55,$55,$55,$55,$55,$55,$55
    4 e4 ], Z5 @, G7 @, I4 t
  1202. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
    ) S; ?$ f" m3 c( U
  1203. .ENDIF* s* q7 ~7 ?  u9 [- d5 o; v$ Q

  1204.   g6 I: V3 I+ O3 i" G: A
  1205. ;------------------------------
    9 ]' Y9 Y$ ^9 N
  1206. ;调色板数据7 q6 _' S0 ^: X
  1207. Palette_Data. r3 Z% Q3 V' p/ A- y
  1208. .DB $0F,$27,$20,$0F,$0F,$24,$20,$0F,$0F,$21,$20,$0F,$0F,$25,$20,$0F
    4 r. u' v, N& ]- c; M0 J+ `2 I- y
  1209. .DB $0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F
    $ _9 u( p) R8 {1 E
  1210. # }& G9 M1 j4 U& n9 H* k2 W: q
  1211. ;------------------------------' O1 K" t8 T6 |- I' B5 v
  1212. Static_Text_Data
    3 G3 U. R; n! M* K6 l
  1213. .WORD Static_Text_Title_Data6 O4 s4 y1 x& N7 i9 s
  1214. .WORD Static_Text_Author_Data
    # y, |  H: ~' L* Y
  1215. .WORD Static_Text_Date_Data; p6 _+ N" {( a2 T5 D* q6 k+ E
  1216. Static_Text_Data_End
    . N+ z8 J! @* X1 Y

  1217. * E( L! y/ ]* c* I0 E; ?
  1218. ;------------------------------
    # ~3 {* M! C- j4 z, t
  1219. Static_Text_Pos
    0 K8 B8 M( c: u
  1220. .DB HIGH(Title_Text_Pos),LOW(Title_Text_Pos)
    1 E6 w8 J" Q; O( ~, p
  1221. .DB HIGH(Author_Info_Pos),LOW(Author_Info_Pos)# n) }* g* r1 \
  1222. .DB HIGH(Date_Info_Pos),LOW(Date_Info_Pos)" U- u  m: g( w
  1223. Static_Text_Pos_End
    / H/ ~2 ]+ e' i- C1 d

  1224. - P. A: ^& l# i1 k- o
  1225. ;------------------------------
    : r5 M6 m, S; A
  1226. Music_State_Stop& H$ ^; V" l! s. C: e# u/ ]
  1227. .IF SOUND_BAR_SHOW_ENABLE# p, s* l- b9 Y7 P/ m0 N. t
  1228. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"STOPED ",$FF,$00
    2 S3 X% v( L% d: Q! z
  1229. ELSE
    6 ~/ t" \% ]. K
  1230. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos)," STOPED",$FF,$00$ I4 v- A! [) N( D
  1231. .ENDIF
    ; Q4 o" k5 h" w& y, U! E" e
  1232. Music_State_Play; y+ O  c0 m: g8 i- j3 d6 n! e. @
  1233. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"PLAYING",$FF,$00
    * ~8 z0 e. N% P  @8 d* O8 D1 Y
  1234. # q8 s; W* |- {* j; w
  1235. ;------------------------------
    1 h8 n/ @, Q2 P
  1236. Sound_Bar_Text_Data;声音类型文本
    6 }4 e+ H" p/ M$ j$ ~
  1237. .DB $FD,HIGH(Sound_Track_Pos),LOW(Sound_Track_Pos)# b* {% Q5 R8 x  W3 m$ k
  1238. .DB "SQ1-",$FF
    % A2 T& d: m1 B5 |6 J+ P6 p
  1239. .DB $FE,"SQ2-",$FF" Q& g5 I2 D6 L0 j7 g7 K1 u
  1240. .DB $FE,"TRI-",$FF
    5 T* e. K( v% L( i" ]- h  ]  l8 m2 Q
  1241. .DB $FE,"NOI-",$FF: o- ?, Y" X0 Z  U% j
  1242. .DB $FE,"DMC-",$FF,$00
    3 D' ]+ [( ~/ Z; v+ s
  1243. 9 v% J2 P3 d. e, A8 {
  1244. .IF Track_Name_Pos
    . N, w. _6 j% N
  1245. ;------------------------------
    . L( F% E- w$ a' Z
  1246. Track_Name_Addr;曲目名地址索引
    ) C& N+ Y+ j' p, H! k1 L+ k+ c
  1247. .WORD Trackr_01
    , S- {" d, R3 ~
  1248. .WORD Trackr_02
    ; X2 V. X: Y  ]4 c) `6 I
  1249. .WORD Trackr_03
    ' G% b; K6 @; n
  1250. .WORD Trackr_04
    4 ~; ~' H8 h+ T7 H  t
  1251. .WORD Trackr_05
    3 e  Y' A9 I( Z$ O$ {- ^, J5 a
  1252. .WORD Trackr_06' |  m7 f) R$ D1 A& o% N
  1253. .WORD Trackr_07# S8 L" A0 f6 M. t% W
  1254. .WORD Trackr_08
    9 d2 |3 ]& A! M$ I: q% \
  1255. .WORD Trackr_09
    # q) k( ~% G$ F
  1256. .WORD Trackr_10
    , {  l/ v" r/ L) Z- N  m2 }
  1257. .WORD Trackr_11/ Y' T: g. H. \4 ^3 F! u& h
  1258. .WORD Trackr_12
    & m& N# k! j9 u
  1259. .WORD Trackr_13
    8 G* h# y$ ^* }( Y% Y
  1260. .WORD Trackr_14  H# ~# J; n$ A3 o0 Y( W2 F
  1261. .WORD Trackr_15- w" e% ^1 c, o3 V4 w: O
  1262. .WORD Trackr_16
    ) _7 Y( Q$ |6 Q- j" k- g
  1263. .WORD Trackr_17
    2 n1 Z' Q" D* O6 Z# Q
  1264. .WORD Trackr_18! K& y, B) Q* {/ Q. [$ D
  1265. .WORD Trackr_197 i7 ?; u2 N6 Q3 k' w
  1266. .WORD Trackr_20
    ' B, W# s) u# y/ a% o  F1 r2 y0 q- |  a
  1267. .WORD Trackr_21
    ; d$ b$ {) h% b
  1268. .WORD Trackr_22
    . H* z1 d, u0 A9 K+ V, p) g
  1269. .WORD Trackr_23
    # Z8 S) z* K5 G6 T% k: E9 R1 T  n
  1270. .WORD Trackr_24' @# @$ I# ^- U1 p
  1271. .WORD Trackr_25
    ; W1 c0 U, g. S% N
  1272. .WORD Trackr_26
    ; C, X  a+ b1 c: \" l% |* r7 g
  1273. .WORD Trackr_27
    8 l! H5 b4 x. I/ o1 N# [$ F) [
  1274. .WORD Trackr_28
    $ h9 ?% Y% G: K
  1275. .WORD Trackr_29* g& S+ A$ T9 k0 w* O7 E
  1276. .WORD Trackr_30% M$ @: G+ w9 M9 p
  1277. .WORD Trackr_310 n7 ?: |) Z/ t8 y) `
  1278. .WORD Trackr_32
    ! s( \& M8 P6 D
  1279. .WORD Trackr_33
    ( e' T8 l1 X! s8 }
  1280. .WORD Trackr_34& V- d& }+ r) m. ?8 Q
  1281. .WORD Trackr_35# f& l  C$ ]# j9 F
  1282. .WORD Trackr_36
    . u3 a- Q0 w8 h" [. M- v/ I" p  A
  1283. .WORD Trackr_37
    * z7 j% V* |( k5 u0 w
  1284. .WORD Trackr_38& r" i- r0 K9 V/ O* F
  1285. .WORD Trackr_39
    6 [/ H) q, T$ r( }. L# d% y' q
  1286. 3 N8 B; {. e  ~, K1 x$ O  v6 H
  1287. ;------------------------------5 D$ x# Y* T; ]( d) N# m3 C
  1288. Trackr_Name_Data9 u7 ]$ O+ J( \7 p2 c
  1289. Trackr_01 .DB $05,"BGM 1"/ y0 B: f$ ~: o; f9 u* \7 C: \
  1290. Trackr_02 .DB $05,"BGM 2"
    # @" u2 v- L9 x
  1291. Trackr_03 .DB $05,"BGM 3"9 Z: C8 b0 n4 D0 J/ x3 e0 N3 Z
  1292. Trackr_04 .DB $05,"BGM 4"
    0 p6 @# ~. E8 T3 c8 K6 I& y: i" f
  1293. Trackr_05 .DB $05,"BGM 5"
    1 r. p1 k4 q6 `. z( |) k& ~2 ^3 a
  1294. Trackr_06 .DB $05,"BGM 6"/ `) m8 k9 @* U" n6 k
  1295. Trackr_07 .DB $05,"BGM 7"
    9 r% p2 [$ [" H* S+ `- c0 v& A
  1296. Trackr_08 .DB $05,"GREAT"8 E. M& d  B! p
  1297. Trackr_09 .DB $08,"BOSS BOM"$ v8 }3 ?1 S: ^) F; S
  1298. Trackr_10 .DB $08,"BOSS2BGM"% J# ?) H) p: F' o
  1299. Trackr_11 .DB $07,"P CLEAR"
    6 [  L& |5 }+ V+ J( a1 n( Z
  1300. Trackr_12 .DB $07,"A CLEAR"1 O9 b; O/ G. E( G# h
  1301. Trackr_13 .DB $04,"OVER"
    ' l* d8 O5 R4 v0 O
  1302. Trackr_14 .DB $06,"ENDING"
    8 p) M# }4 y& ?9 q% I; T, _! ^
  1303. Trackr_15 .DB $04,"SUTA"
    , V, }# J- `$ ?' j! W3 z5 x) H! w
  1304. Trackr_16 .DB $07,"THUNDER"
    ) n( F* l% Z+ O  F$ A# p
  1305. Trackr_17 .DB $04,"SHOT"
    0 z/ |$ K8 \- |2 V. f
  1306. Trackr_18 .DB $05,"LASER"! l* R/ l5 u  X$ l) K/ d% R
  1307. Trackr_19 .DB $06,"SPREAD"/ ^+ {1 y: d- ?. \
  1308. Trackr_20 .DB $04,"FIRE"; L6 i( V' W0 B
  1309. Trackr_21 .DB $06,"B SHOT"
    - I0 \: a' d% Z/ d  f
  1310. Trackr_22 .DB $08,"T DAMEGE"
    ' U( H2 a5 [  K, w
  1311. Trackr_23 .DB $07,"HARETSU"
    2 W4 d. q( s( ^5 Y4 q
  1312. Trackr_24 .DB $05,"T OUT"5 R4 L' d5 G/ H* F; m  {( f5 A
  1313. Trackr_25 .DB $05,"Z OUT"
    / Q. ?5 j$ P& {9 v6 Z2 z& k: F
  1314. Trackr_26 .DB $05,"A OUT"" V0 w& V3 Y8 J1 f
  1315. Trackr_27 .DB $04,"ROLL"
    " T! B+ `+ e  R5 x, ~$ E# ~; k
  1316. Trackr_28 .DB $06,"APPEAR"
    ; c% D* ^# e& O7 @9 i
  1317. Trackr_29 .DB $05,"POWER"5 X7 O! D4 b6 h" E
  1318. Trackr_30 .DB $07,"BOKK BK"# J: u0 \: T: Q7 s% f, o! ~+ p. s
  1319. Trackr_31 .DB $08,"BAKUHA 1"& k0 x* E0 ~4 f7 [
  1320. Trackr_32 .DB $08,"BAKUHA 2"2 S3 ?4 ]3 u/ D
  1321. Trackr_33 .DB $05,"ARUKU"' D$ y) X8 B0 q/ I9 h
  1322. Trackr_34 .DB $06,"JIWARE"$ l/ P  X% h4 L9 P: W: C& D5 t3 R
  1323. Trackr_35 .DB $05,"SILEN"
    . V5 O2 ~8 \7 ]* s2 I. ?' t
  1324. Trackr_36 .DB $05,"P 1UP"# \9 _! n4 M4 C! k# E3 t3 h) d6 k
  1325. Trackr_37 .DB $05,"P OUT"3 @1 `$ J- }( _1 B9 }# {$ \" N
  1326. Trackr_38 .DB $05,"B OUT"6 h% Z* \6 U. Z" n. {; }, A
  1327. Trackr_39 .DB $05,"PAUSE"
    1 J8 s* |% ]9 }
  1328. / L( S  ^  u' Q$ j" O- f5 S5 H
  1329. .ENDIF3 Z! i# o% D" t# I) a% ~8 R/ Q/ i0 ^

  1330. ' ?: B4 o/ N* d
  1331. ;------------------------------
    0 D% [# F& X7 E6 F6 @
  1332. Static_Text_Title_Data;静态文本数据
    1 }. s6 e9 `6 ~8 v- @
  1333. .DB 128 F/ i7 k# \8 {
  1334. .DB "SUPER CONTRA"
    & i. w. j. w+ t# G8 O3 t2 k
  1335. Static_Text_Author_Data% p9 Z5 u' W/ }& s  C) m; z- `
  1336. .DB 23- ^) T+ G+ l$ d; H7 u0 M
  1337. .DB "EXTRACT BY FLAMECYCLONE"
    & r" W7 f+ \2 s6 d
  1338. Static_Text_Date_Data
    / n. X5 ~; a. Z$ h& g- \# b
  1339. .DB 10- J# U# \1 u3 v; N% y6 ?) [
  1340. .DB "2023.07.11"
    $ q/ i4 I, P6 y6 K+ |1 d6 V. G
  1341. 0 W/ w- @. m4 T9 K( R4 k
  1342. .BANK RESET_BANK & BANK_DATA_MASK& E( c1 }9 o6 H: x
  1343. .ORG RESET_ADDR2 N4 y( `- m9 m: _8 l

  1344. + `9 N4 k5 q$ R1 V  S3 X& s

  1345. 8 S+ P' M! Y8 c2 s6 H, J
  1346. ;==================================================! j# p' E+ j" W( f" _
  1347. ;切到主程序bank
    , l+ t1 F; ?' m+ }' W
  1348. SwitchMainBank4 b3 X0 U3 A7 _+ `+ V% p# `
  1349. LDA #PROGRAM_BANK & BANK_DATA_MASK
    ! n' r3 [7 q# F/ j0 \
  1350. JSR SwitchBank8000
    0 z: d9 A2 b4 F) q
  1351. RTS
    & [/ ^5 `% @' Q
  1352. 0 }  C' Z/ ~# R# S  L+ p7 l
  1353. ;==================================================
    7 @. ^8 }5 `. G6 F
  1354. SwitchBank8000;切换bank到8000-9FFF5 F8 V2 B/ w* K( q' P7 d
  1355. PHA
    + D1 M, s) P7 Z6 j" c, c* V! Z
  1356. LDA #$06
    * H1 k3 R) p3 _3 {  C
  1357. STA MMC3_BANK_CTRL
    : \0 {9 B1 X# a
  1358. PLA5 V" K. R6 n5 i6 q* X
  1359. STA MMC3_BANK_DATA" z: @4 _# j' e2 u6 O5 h0 D9 q8 `4 e
  1360. RTS
    % ~! f* c! w+ G

  1361. % Q3 {$ d5 i4 h8 p6 p6 F! R
  1362. ;==================================================* F3 C4 {7 |% R' V
  1363. SwitchBankA000;切换bank到A000-BFFF1 R' s- ~$ Q8 O2 g
  1364. PHA
    / H5 l5 {( s% {" n) q* j+ t
  1365. LDA #$07
    ) u: v  |& j4 [
  1366. STA MMC3_BANK_CTRL( }! }* r8 y3 X# |
  1367. PLA3 g* [1 |7 ~2 q; P1 t* X6 |; g
  1368. STA MMC3_BANK_DATA
    - A9 d# ?; k" i; w
  1369. RTS
    3 f$ k+ ~! [" h
  1370. : n) [5 w+ q- v1 s+ P! R6 i  S2 L
  1371. ;==================================================
    + P6 t4 Z* _) |1 ~, L/ V. ~  k
  1372. Sund_Bank_Init;音乐bamk初始化
      l# S; O/ S) Z8 |9 \6 M  w& }
  1373. LDA #SOUND_DATA_BANK_0 & BANK_DATA_MASK6 T2 o0 F4 I7 k+ g, @4 _0 T! f
  1374. STA Music_Bank_80004 \/ ]3 p9 z: G+ T* p: E
  1375. LDA #SOUND_DATA_BANK_1 & BANK_DATA_MASK
    7 h. m; H( S% S9 r( ~6 e
  1376. STA Music_Bank_A000
    $ k" f* \3 e6 \, G. X; A9 J
  1377. RTS
    & ?! y$ k' J8 ^1 l

  1378. # d. |0 ~/ S& l3 C% {# L! Y
  1379. ;==================================================
    7 f7 \8 C) @: U! X; t- |
  1380. Sund_Bank_Set;切换音乐bank4 z5 v) u3 z" ]2 }. O
  1381. LDA Music_Bank_8000
    2 S: x. s4 f% v- m; t: G' l/ k7 v" r
  1382. JSR SwitchBank8000
    ' u. J  d/ o( _; t4 R, `0 o% y
  1383. LDA Music_Bank_A000$ _6 _6 N% K1 \5 A3 O% E* C
  1384. JSR SwitchBankA0003 _. @. s9 r  u. v& Y
  1385. RTS
    & v5 M& X" W" \) N1 ^8 ?7 V# o9 R. F6 [) N

  1386. # p3 Z; I2 A4 [7 Q1 B$ d( @! Y
  1387. ;==================================================
    $ X4 ^; E& ^6 O# f
  1388. Sound_Init;音乐初始化% K- f& W$ S- \- D/ l: Y3 p0 ^
  1389. PHA
      S4 l/ `: s' V; H+ @; w
  1390. JSR Sund_Bank_Set
    2 E* o% N, U7 @% [# q
  1391. PLA
    " q4 w+ S7 C' I5 d* ?9 S. y. x) h
  1392. JSR Music_Init_Addr* ]/ v- x7 t- Z; H, d
  1393. JSR SwitchMainBank+ x/ j- g! b  n- H, r' E+ k* o
  1394. 6 u+ m9 S/ j7 f& \* ~# I; O
  1395. JSR Music_Bar_ReSet
    ) m% ^2 l+ k6 u7 H6 p$ b1 V4 R0 o
  1396. JSR Time_ReSet* d  H7 u) m, M/ k+ I! _' R
  1397. LDA #$006 f0 I: f8 V0 g
  1398. STA Music_State
    + r! Y- @+ ]4 h" A8 m5 c
  1399. JSR Music_Stata_Show# N3 Z* r. l  Y- ~3 _/ b: c& f7 L
  1400. .IF Track_Name_Pos* U3 Q4 ^: C1 S3 W$ O0 H  N8 I
  1401. JSR Show_Track_Info" H5 ^8 i) U; E/ p
  1402. .ENDIF1 a" x% J( b( d+ A1 V. m

  1403. & u$ N5 @6 G  @& A
  1404. RTS) T  I# d  |/ T0 N) z

  1405. 9 c7 @, J/ ~4 @# `
  1406. ;==================================================  P& E, K% L' Z0 `
  1407. Sound_Play;音乐播放
    8 E$ u' j" {& j- S4 T  \! y
  1408. PHA" H# f+ n/ B( _- R4 D1 H* U) [
  1409. JSR Sund_Bank_Set
    + \: g3 K+ q5 e9 @/ L
  1410. PLA. |5 E! c9 Q) P+ @- q) Y7 g
  1411. LDA Music_State
    2 l( z& K! K  U: T- ?5 ^& c6 K
  1412. BNE Sound_Play_End  J, M2 i8 }7 T( a6 e
  1413. JSR Music_Play_Addr
    & P  z6 D, i0 J9 I$ Z
  1414. Sound_Play_End6 D! r3 x/ T/ m8 Y8 \
  1415. JSR SwitchMainBank
    ( w& f  }7 ^! m/ k( `) G; M
  1416. RTS
    6 x" i0 h" L: i: H+ m8 h4 K3 L1 S

  1417. 6 _7 }% ~, }# Q+ Q$ {+ y" w- j
  1418. ;==================================================
    . ]& t  @5 W( L
  1419. .IF Music_Reset_Addr
    8 o, E8 |: z# S# S7 E& p/ G
  1420. Sound_Reset;音乐重设(如果有的话)/ J9 {8 w/ z: y, y
  1421. JSR Sund_Bank_Set
    8 F" j% ^% {: w
  1422. JSR Music_Reset_Addr3 H* q( _2 H! O
  1423. JSR SwitchMainBank% V& e9 r  Z( {! P
  1424. RTS
    ' D1 `/ C5 p) H' Q
  1425. .ENDIF' c6 E: |6 o0 d0 C! a
  1426. : [8 C  ?( _: O
  1427. ;==================================================- n; [8 s# z. I* N, a
  1428. MainLoop;死循环# t& H! Q' F! ?
  1429. JMP MainLoop
    . c3 d. \9 J& b1 J$ |- j$ d3 u3 r
  1430. 4 z" V3 i( j" X% K3 }$ D
  1431. ;==================================================
    $ L" v- D, s) t* ]2 G5 D
  1432. NmiProgram;Nmi中断处理
    1 ~3 m- D3 V! i: E8 v( m+ w
  1433. PHA
    , j6 y$ |& m# O/ Y
  1434. TXA) ?# O7 o+ o3 x0 p4 W
  1435. PHA
    ' N% j' s& v2 c. ?- @: r4 H
  1436. TYA
    1 R2 s( o5 h0 p6 i
  1437. PHA
    ' }7 h4 c0 d4 X, m) N1 K

  1438. ! n. p6 G' J* S5 Q! N2 [7 E& c- b
  1439. LDA PPU_STATUS
    + q7 j! a# h9 n- ~+ X  e
  1440. LDA #$00) t: k5 c5 m: t$ c  ]
  1441. STA PPU_CTRL$ l% n% V  X! \

  1442. " {/ P2 }, }/ B
  1443. ;切换主程序bank" H; j% Z0 q$ I5 N3 [+ {! S% V
  1444. JSR SwitchMainBank* B7 @8 J: v1 _* ^8 `

  1445. + Z4 d; H+ z% s7 B  |0 {8 c+ c. F/ E
  1446. ;NMI处理1 D5 J# F% I6 M( k0 z
  1447. JSR NmiProgramProcess
    5 w2 B$ C# x6 f3 Z, ^' Q9 Q
  1448. 5 T* n, Y# k5 c
  1449. Nmi_Proc_End
    ' B7 X! U, Q5 g$ w
  1450. PLA
    & _' h# K: p; ~: V. X, H7 |
  1451. TAY
    7 Z$ L6 i& t8 j  S2 T1 {# s5 Z1 e
  1452. PLA# E5 j5 w7 V$ @' Z( `; T
  1453. TAX
    1 X% U# _6 m4 q
  1454. PLA% i8 t, v2 O9 j+ Z( J& h

  1455. . }+ e# v+ U5 Z  \, t" D8 G
  1456. RTI
    , Q4 k# a' o2 T0 D
  1457. 2 B0 q) i7 G, \  d5 W
  1458. ;==================================================! G$ {5 {- g5 A: s$ K2 m7 C, U6 O7 o0 I
  1459. ResetProgram;重置中断处理
    9 H# W# I6 q% o* N3 V& ^, D
  1460. SEI* a* x0 m0 B  t, |4 a. A2 R
  1461. CLD
    ; T* p3 i, L' u% Q3 p) H
  1462. LDA #$00- {2 d$ `6 f, E4 Q9 R
  1463. STA PPU_CTRL( @% x  T# S; C' A* J
  1464. STA PPU_MASK
    $ J+ Y" @, K* i& M* D7 D# h* v
  1465. % Y4 j, q1 {. l+ S: |0 @/ x
  1466. JSR SwitchMainBank
    $ h) v4 W/ d- Q4 I+ F# t/ j+ V) v8 K
  1467. JMP ProgramBegin" u+ ?) C& ]' X; `  _4 Q) T9 K- I

  1468. - w* W( [# k& F/ B
  1469. ;==================================================9 ?9 n) @* a. c$ C: c9 A8 K7 |
  1470. IrqProgram;Irq中断处理% \- f! q# ]; }, c5 ?  x0 z! \- K, S
  1471. RTI
    8 j. {+ D( i( c
  1472.   R4 u; N+ e) P7 D
  1473. .IF SOUND_BAR_SHOW_ENABLE6 T: e" h& N& `9 B2 K
  1474. .ORG $FF803 O5 y) Y$ q) V, o' c0 |' R% d
  1475. STA $4000,X! F! S8 u* v4 L
  1476. STA Sound_Bar + $00,X* R7 t. C5 ~- y: b. M
  1477. RTS
    / ?" y8 R# n' V3 h" q* G& h8 w+ I
  1478.   K; p5 p0 _# h4 z1 C' W8 G
  1479. .ORG $FF88
    : d. ]6 O$ d( Y8 S# S
  1480. STA $4000,Y
      E. L6 g5 L3 L! t# x2 ]
  1481. STA Sound_Bar + $00,Y
    0 S) d' w# @0 T$ t# k+ L" ^4 v( y
  1482. RTS
    6 n( [0 e, H$ H1 ~: X2 M4 W

  1483. " o* I$ @, J) X: D
  1484. .ORG $FF90
    ; }) a, F2 _2 U- O, Z; }7 D8 ?
  1485. STA $4004,X
    " O1 A: W: }9 d% l# K5 A9 N7 N
  1486. STA Sound_Bar + $04,X
    ' [- H% i9 `5 _' `( }" ?3 @
  1487. RTS7 t( f* ?5 e* w! N
  1488.   b1 H+ ^% s& s8 |  b! l7 ^9 T
  1489. .ORG $FF98. k4 f2 ?$ L" f/ m$ A) W
  1490. STA $4004,Y1 W7 q( G/ W) p- @
  1491. STA Sound_Bar + $04,Y
    ! M! m9 ~% C8 O: B1 a+ a% I1 u
  1492. RTS/ L. B% m9 h/ T2 d; u" A" Z
  1493. 0 r9 G2 {8 N1 e7 N1 P: n% q
  1494. .ORG $FFA0
    - a/ z4 P( f& n6 {
  1495. STA $4008,X+ x% x/ t8 G, j; W$ [) a6 O6 L$ Y$ Q
  1496. STA Sound_Bar + $08,X
    4 O# J( X+ J0 T# `! O$ Z. `5 a1 p
  1497. RTS
    7 ]$ x2 R& }& D4 N  N6 _
  1498. 0 v- v9 R8 K: N" A, K
  1499. .ORG $FFA8. C* Z( y& G8 L! S" Z7 p7 E
  1500. STA $4008,Y
    0 k% N5 ]( r. }
  1501. STA Sound_Bar + $08,Y
    & Q" h6 s% o( Z0 |2 ?
  1502. RTS6 {, x! D7 u8 f+ i( a( ?. u/ r" p

  1503. * ]7 M1 {! \, f; b
  1504. .ORG $FFB03 j& k6 ?, C$ I9 R: l$ R9 [
  1505. STA $400C,X9 \; S' u0 ]' \$ z/ a
  1506. STA Sound_Bar + $0C,X
    ( g3 g6 p) ]& b
  1507. RTS
    7 U( E6 v3 ~3 q; C" h. A

  1508. 8 B3 J& G+ ]1 C! n1 A
  1509. .ORG $FFB8; G& P  l0 b( X* n1 E8 K% h
  1510. STA $400C,Y
    1 R  B  J' G! D, a+ j: l) \& z
  1511. STA Sound_Bar + $0C,Y
    ! _& |( O2 R+ Q
  1512. RTS( m2 E; ~1 Q2 a
  1513. / H% B5 E9 [; m2 o
  1514. .ORG $FFC0
      s3 l* k6 G$ n- e
  1515. STA $4000
    ! N7 F# u2 u, k& \
  1516. STA Sound_Bar + $002 u9 a' @% Y5 V* b, N$ R
  1517. RTS
    . |. H# ], K6 ^2 B/ n1 u

  1518. + M5 ~: {% i% i) q/ X
  1519. .ORG $FFC8
    + m" y, l6 A0 O  u6 d# ]7 X
  1520. STA $4004
    4 [! H) D$ T+ u0 V
  1521. STA Sound_Bar + $04
    6 P: `% y' I9 ~5 e3 k' N
  1522. RTS/ N8 T+ d  C! F+ C9 |
  1523. 5 P: y1 k& ]) h, P
  1524. .ORG $FFD00 a$ D# q) u: y
  1525. STA $4008
    $ M6 Q9 P! J+ ]+ L8 M6 g
  1526. STA Sound_Bar + $08
    ' w# s- ]: z. c
  1527. RTS
    / X6 ?( Z, N- u3 `& \
  1528. : O+ X- c. D) l6 ?$ Y6 E7 ]+ r
  1529. .ORG $FFD89 w( @# Z7 i2 \# T' b0 r4 G
  1530. STA $400C5 e" E4 I0 N0 Y0 K9 ~0 @  q9 X# o
  1531. STA Sound_Bar + $0C
    4 P$ P9 I$ ]* G1 p
  1532. RTS! N3 m0 \  a& \2 l
  1533. # @0 W3 n: N8 ]) V! N; N- |
  1534. .ENDIF
    ! _# s2 u- L6 h5 L7 {" b3 n, S; Z
  1535. ! h9 t$ a+ k7 T; J+ y
  1536. .ORG $FFFA
    : \" Q# X2 d: j. w5 J1 D- {1 p
  1537. .WORD NmiProgram$ G) J2 g0 V% w+ _( L( J1 s
  1538. .WORD ResetProgram: v4 D4 p- G" C. s
  1539. .WORD IrqProgram
复制代码
# b3 D. B# j( ?: d. @
7 `+ c; K* M2 V2 e! _
游客,如果您要查看本帖隐藏内容请回复

本帖子中包含更多资源

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

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 16:07 , Processed in 1.093750 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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