EMU618社区

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

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

[复制链接]

签到天数: 39 天

[LV.5]常住居民I

发表于 2023-7-11 19:08:59 | 显示全部楼层 |阅读模式
本帖最后由 yandagui 于 2023-7-11 21:32 编辑 $ H3 u! \3 C  U  K$ {$ H
3 y& i) X& P$ Q; x1 w5 m
1.魂斗罗/ u! {4 }0 t9 d9 a) e' f9 T- ~
2.超级魂斗罗
" E' N# m9 w0 i/ {5 i  o3.赤影战士
) C! K8 K) V* l/ A' Q# V/ o4.忍者龙剑传2
2 b3 w  x# X4 F5 Q( R9 C; a. |0 g5 J2 a! T! B& y) w. c

* g$ G4 A9 C- p/ i" P
* |$ g: B+ h" K/ {' _$ B4 o/ r, X! n; l' S
源码:
+ k& C. ?( Z- y
  1. ;[FC音乐][播放器模板]: T2 d1 a, s9 Y
  2. ;FlameCyclone 20230710! ]+ S6 r1 ]' F3 @6 i2 O

  3. ' L- P* w) R) A
  4. ;文件头* x" E; T  c. D
  5. ;======================================================================
    2 r1 P6 I( R* A% v
  6. .INESPRG 4                                              ;16KB PRG 数量
    $ h4 K: q+ a* h2 C9 T# B
  7. .INESCHR 0                                               ;8KB CHR 数量$ g$ S' C6 R# Z1 H! c0 C
  8. .INESMAP 4                                                   ;mapper 4
      W0 n' i+ q/ j  k( `' E9 H
  9. .INESMIR 1                                   ;命名表镜像 0水平 1垂直3 v; p: a: l) G1 t# O/ ^; F$ R

  10. : ~5 B5 f0 r$ }0 H# Y( G3 l
  11. ;==================================================7 s+ j% b6 R! L' u- Y' B$ }
  12. SOUND_BAR_SHOW_ENABLE       = 1
    ' I' }. ~# o! t  ~0 |
  13. ;==================================================
    ( X$ R6 ^- ?9 Z6 c) J( Z* v
  14. BANK_DATA_MASK              = $07, A; j- b# O. c2 r
  15. ;==================================================: o% K# A! \& u0 e  k
  16. SOUND_DATA_BANK_0           = $001 q# y2 V3 C9 B- K5 O4 o
  17. SOUND_DATA_BANK_1           = $014 K! B0 d5 z0 i6 y3 ]. c0 F
  18. SOUND_DATA_BANK_2           = $02
    ! Z0 ?! T: @/ P# f7 G; B
  19. SOUND_DATA_BANK_C000        = $06
    $ C$ c0 U8 y3 g( j6 v0 j9 ?; J' h" \

  20. 7 K7 x: F+ g& X
  21. ;-------------------------------------------------! a' v/ u" a3 S
  22. CHR_DATA_BANK               = $04
    / R* T# [' L3 V# @# M' f: P
  23. CHR_DATA_ADDR               = $A000; H4 @  }0 z$ h1 E0 T8 X2 Q- e
  24. ;-------------------------------------------------7 U2 J- a- v8 y6 ~4 ?" s) r
  25. PROGRAM_BANK                = $05
    5 L. f2 v, r. W
  26. PROGRAM_ADDR                = $8000- R! A/ B2 s6 x" h# q2 B
  27. ;-------------------------------------------------
    ) Q- j# e- X# i& y8 m$ J4 h! S1 H; m
  28. RESET_BANK                  = $07
    6 P+ ]( D( p/ z8 R
  29. RESET_ADDR                  = $FE007 R+ A; U, _& V8 |( k
  30. ;==================================================( l. a& S: x) k1 Z8 b
  31. Music_Init_Addr             = $DFF0 ;音乐初始化地址1 z8 o7 W' U! Z, Z7 A; `. z
  32. Music_Play_Addr             = $813C ;音乐播放地址
    / G3 d- Q5 I# T& t
  33. Music_Reset_Addr            = $0000 ;音乐重设数据地址* ]2 N( Q; h8 f& u0 X8 p: T
  34. ;==================================================% f* e, Y/ n. ^* l7 V
  35. Music_Song_Total            = 039  ;全部曲目总数4 ]; r5 q7 |- G/ s' }% i5 T
  36. Music_Start_Song            = 007  ;初始播放曲目
    8 z  c2 R! O8 H/ P* X; r
  37. ;==================================================
    " ]% P. k* V9 w9 i; {' ?# Q

  38. 0 x' m% Q' v- n: ^/ A/ v; G6 w
  39. ;==================================================
    + c0 @, x7 y! J4 V8 \7 F. {# O
  40. Title_Text_Pos      = $210D ;标题文本位置3 [) l- g! w$ o4 F( B* \( a$ j
  41. Author_Info_Pos     = $2284 ;作者文本位置! l1 w8 E2 f) g) {/ k% }5 P
  42. Date_Info_Pos       = $22CB ;日期文本位置
    , o. I' m% _# g" Z
  43. ;------------------------------; e% y  a9 l9 f
  44. ;------------------------------' {; F( s% t- ]8 t
  45. .IF SOUND_BAR_SHOW_ENABLE/ z3 R$ Y+ F' n( Q! w
  46. Play_Index_Pos      = $21B3 ;当前曲目位置! k, c  G5 q( [! B0 ^  n
  47. Play_Time_Pos       = $21F3 ;播放时间位置
    5 M. X; D5 `& i8 Z' k. n0 }( h/ G
  48. Play_State_Pos      = $2233 ;播放状态位置
    " i1 _* F1 S% x$ D1 s( q
  49. .ELSE! j# t, a6 s# n2 Y  E7 E

  50. ' l& o5 w5 J& v! j$ a
  51. .IF Music_Song_Total > 99
    ' W, Y* R; W' |
  52. Play_Index_Pos      = $21AC ;当前曲目位置! L( F, ~' s. z
  53. .ELSE( z' L- e% T2 g/ ?" c5 x
  54. ! `: @8 g) L# Y# x3 B4 J  C
  55. .IF Music_Song_Total > 9
    + G' N! X& l; C4 n
  56. Play_Index_Pos      = $21AD ;当前曲目位置
    3 y/ l+ e: u' O8 ]; P+ X9 \& q( E
  57. .ELSE
    , K$ r/ b) i$ C$ W) d2 k2 A( y
  58. Play_Index_Pos      = $21AE ;当前曲目位置: O+ d2 ^# q: r( t
  59. .ENDIF
    6 X- D; t5 j. @- H5 K( j
  60. : g$ [6 F3 n; E# Q# U) v" S
  61. .ENDIF
    ) m; `& n! M; ~
  62. 8 f$ o$ a5 `: M3 y) [

  63. " f/ s6 A' z" R# `, F! x
  64. Play_Time_Pos       = $21EC ;播放时间位置
      F5 ?: A" _: f" A0 A4 m5 g$ \
  65. Play_State_Pos      = $222C ;播放状态位置
    * h: b: K. y. B' T) u
  66. .ENDIF5 l9 ]* W3 B: B0 U! x3 |
  67. ;------------------------------
    9 K1 q2 y# J2 N, g9 v* C. i
  68. Track_Name_Pos      = $216B ;曲目文本位置2 {; G" u  u3 L
  69. Sound_Track_Pos     = $21A5 ;声道文本位置
    ) s% ]. S, D( G" W' C* i
  70. Sound_Bar_Pos       = $21A9 ;音乐条位置
    ) U/ U, Q  b- o- C
  71. ;==================================================  }# R% _. W5 d  W6 v6 y  C4 {
  72. Scroll_X = $00
    # G3 b" e& R- }, l
  73. Scroll_Y = $069 M+ e! c% _4 a/ l7 ~3 I
  74. ;==================================================( C3 Z7 f& r1 {( b$ g
  75. RAM_Cln_1       = $0100
    : R6 u7 R, K- k9 M: o
  76. RAM_Cln_1_Size  = $80
    # Y" }# J& `9 J! y8 {7 e3 Q1 @
  77. RAM_Cln_2       = $00E08 A3 w! q5 O0 V" B$ ~2 i' w
  78. RAM_Cln_2_Size  = $20
    3 U0 ~0 @1 x" f
  79. RAM_Cln_3       = $00E0" L& d& r1 ?3 W* @5 f
  80. RAM_Cln_3_Size  = $205 {/ G" d2 e, X

  81. 9 _* Y- }* c4 V4 H
  82. ;==================================================+ O. G+ Y3 b4 k7 `
  83. PPU_CTRL                =   $2000   ;PPU控制寄存器# M$ v) }, L9 n0 @9 Y
  84. PPU_MASK                =   $2001   ;PPU掩码寄存器0 z7 `' }; [; d$ G; n. C$ O  F
  85. PPU_STATUS              =   $2002   ;PPU状态寄存器:读取后PPU_SCROLL和PPU_ADDRESS被复位,下一个写到PPU_SCROLL的数据是水平的,写到PPU_ADDRESS的数据是高位
    3 u2 {/ Y2 {5 p
  86. PPU_OAM_ADDR            =   $2003   ;精灵RAM地址:用来设置通过PPU_OAM_DATA访问的256字节精灵RAM地址。每次访问PPU_OAM_DATA后该地址增加1' y6 L4 Q, @  y. j  f) u! x
  87. PPU_OAM_DATA            =   $2004   ;精灵RAM数据:用来读/写精灵内存。地址通过PPU_OAM_ADDR来设置,每次访问后地址增加1
    5 V& I1 |7 @2 A8 ]9 O, W  w4 @( `
  88. PPU_SCROLL              =   $2005   ;屏幕滚动偏移:第一个写的值会进入垂直滚动寄存器(若>239,被忽略)。第二个值出现在水平滚动寄存器
    7 [, N4 z" `5 V$ z5 H
  89. PPU_ADDRESS             =   $2006   ;VRAM地址:设置PPU_DATA访问的VRAM地址。第一个写地址的高6位。第二个写低8位。每次访问PPU_DATA后地址增加9 o; E0 ?( }! {1 j
  90. PPU_DATA                =   $2007   ;VRAM数据:用来访问VRAM数据,通过PPU_ADDRESS设置的地址在每次访问之后会增加1或32 + j- ~2 r* ~* V2 P" \, Q/ B
  91. OAM_DMA                 =   $4014   ;DMA访问精灵RAM:通过写一个值xx到这个端口,引起CPU内存地址为$xx00-$xxFF的区域传送到精灵内存7 ]! M+ w" B" Z4 S
  92. APU_STATUS              =   $4015   ;声音通道切换
    $ x" E! i" _. a. S- b/ j
  93. JOY1_FRAME              =   $4016   ;手柄1 + 选通6 u6 R" S- k9 l- L3 A" C' g
  94. JOY2_FRAME              =   $4017   ;手柄2 + 选通
    5 t2 B  j3 j2 Q; j$ g( u
  95. ;==================================================
    ' q; I+ t: D4 i: c: L: M
  96. MMC3_BANK_CTRL          =   $8000
    2 r* u/ }; w- |8 ], D
  97. MMC3_BANK_DATA          =   $8001' t) i% @3 T& k  t% O( h2 h. p
  98. MMC3_MIRRORING          =   $A0008 ]+ V" J) l1 \1 d9 i
  99. MMC3_PRG_RAM_PROTECT    =   $A001
    $ k9 z8 L6 }  v& p
  100. MMC3_IRQ_LATCH          =   $C0006 b) B( b. G- H  o- G
  101. MMC3_IRQ_RELOAD         =   $C001
    ! ~9 e. {* R  B  o& r  \
  102. MMC3_IRQ_DISABLE        =   $E0008 F9 D7 B  c% d
  103. MMC3_IRQ_ENABLE         =   $E001" U/ i- D! l& i1 ?5 H; ^
  104. + P3 O& r9 J4 Z8 z' F) U5 p3 g( f
  105. ;音乐数据块
    , [4 |7 J. M0 Y# @4 p. X! K

  106. 7 D" }; W1 X0 g* M
  107. ;======================================================================% P9 ^1 T1 u6 ~. z0 G$ B
  108. .IF SOUND_BAR_SHOW_ENABLE% a# P1 ]1 I5 P8 k7 k+ R. z
  109. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK  s& w; c2 Y2 o; j* K9 d4 I8 F8 G
  110. .INCBIN "sound_bank_bar/music_data_0.bank"2 B1 L- ]* q+ w) X- Y

  111. 1 P5 O$ ~; r! ]" o2 Y
  112. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK
    " f, N* x' y! H- |+ O
  113. .INCBIN "sound_bank_bar/music_data_1.bank"* m( I3 o4 k' L, h
  114. ( n0 t! A, ]0 }4 [8 B. P
  115. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK% Q  `% F8 z1 J# _; h2 H
  116. .INCBIN "sound_bank_bar/music_data_2.bank"
    : b* Q( K7 N# {3 h6 o! U* s# j

  117. 6 U1 R  j0 J9 I* S
  118. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK
    , B( c! F  N9 k) d% A2 C
  119. .INCBIN "sound_bank_bar/music_data_3.bank"
    ) x; c+ J( ^' X& ^
  120. 3 {( L9 l/ O" b) ?  H
  121. .ELSE
    * d8 q; C; I8 g
  122. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK
    - {$ j) V" L5 a1 ], v
  123. .INCBIN "sound_bank/music_data_0.bank"8 A. s. y+ q6 f1 }

  124. - b1 j! _+ {4 L: o1 n9 _
  125. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK
    # U- T+ j, H7 _0 _( R
  126. .INCBIN "sound_bank/music_data_1.bank"/ I: n+ j% ?" K! Y

  127. ; c5 ~. T& `2 K" R
  128. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK* W0 R0 Y5 Q7 D" t4 x& m  O$ E
  129. .INCBIN "sound_bank/music_data_2.bank"
    % T. \- J) D- w1 A9 V
  130. , K# h" ~) G' ?: X% U
  131. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK
    + y! T0 v$ u; t1 f  x; ^
  132. .INCBIN "sound_bank/music_data_3.bank"
    6 v  U# N4 M* P
  133. .ENDIF  _+ i7 w! p; F" L7 {; c
  134. + O* `, L1 i# Q  R) G
  135. ;CHR图形数据
    8 }8 x* V( W0 J7 j/ r
  136. ;======================================================================
    & d% A: _5 w( b9 [0 n
  137. .BANK CHR_DATA_BANK6 B# a! L0 u. M: H( @9 \* d' U5 _; r" u
  138. .INCBIN "chr_bank/chr_data.chr"
    9 ]/ q; j. }7 w! l
  139.   u5 m0 q/ l# U' v! y5 u( ]: N
  140. ;==================================================
    9 a, [7 z  q7 S% C% `2 H1 A
  141. PPU_Addr        = $0300$ C& t* I5 j: z- t; ]0 ~
  142. Palette_Addr    = $03C0
    ; x9 a  E, L  h# N
  143. Sound_Bar       = PPU_Addr+$E01 z2 R" d4 J+ a
  144. ;==================================================& H: ~8 {3 ]+ }1 q& j/ |- |
  145. Palette_Update_Addr     = Palette_Addr+$0D) c2 H7 p& k/ @% o0 `) T
  146. Palette_Update_Max      = $2C: q- w: ]* G$ q
  147. Palette_Update_Min      = $21  q( t0 E/ c. E+ f$ {6 ?
  148. Palette_Update_Interval = 60
    3 v$ H& @6 N. d
  149. ;==================================================
    ) T" ?( A1 S/ |" ~- ?5 ?
  150. Sound_Bar_Cnt       = PPU_Addr+$F0
    2 d, j7 R: ~; \' X5 O8 [- d6 Y  B
  151. Screen_State        = Sound_Bar_Cnt+$014 v5 N6 l+ w' a. V" ]& H
  152. PPU_Cur             = Sound_Bar_Cnt+$02- t$ x+ a& m4 n2 d8 o5 l
  153. PPU_Addr_H          = Sound_Bar_Cnt+$03" g* i3 F8 C7 _# E( I
  154. PPU_Addr_L          = Sound_Bar_Cnt+$04+ b- L4 i1 C7 f
  155. ;==================================================$ }5 Z' U4 X+ d4 k# w
  156. Data_L              = $70
      k; r" i7 [2 W# v9 W7 H# ?# F
  157. Data_H              = Data_L + $01
    $ `3 E' q/ T' @
  158. Data_Cnt            = Data_L + $02! Z& [, D* C( R* c$ k
  159. Data_Buf            = Data_L + $03
    / g, d: f5 X1 a- ~% n$ P
  160. Time_Wait_Cnt       = Data_L + $04
    1 t; u, G. w0 ], A
  161. Palette_Wait_Cnt    = Data_L + $05  A$ M& q5 k! r
  162. Palette_Update_Flag = Data_L + $06
    0 e7 q* `- Q" |
  163. Show_Track_Name     = Data_L + $07
    0 }0 }8 l( x% ?7 N3 N
  164. ;==================================================
    ! y; T$ U" b$ q- P: t; U
  165. Key_Keep            = Show_Track_Name + 18 |! ]# H5 v* ^  i3 l& g& y
  166. Key_Once            = Key_Keep+$01
    2 Q; c2 v8 R( N7 p. }7 K
  167. Key_Kemp            = Key_Keep+$02# E( i# P0 m! G1 O- _& `
  168. Key_Temp            = Key_Keep+$03
    6 `5 c: l' C7 _' Z
  169. Key_Getv            = Key_Keep+$04
    ( y1 O  H8 m1 v' l
  170. ;==================================================
    ) x3 j# N0 |3 Q; C7 h
  171. Music_Cur           = Key_Getv+$01
    0 h( w  O% [8 b( A
  172. Music_Last          = Music_Cur+$01
    ) s8 t# f: R8 I
  173. Music_State         = Music_Cur+$02  o  P4 L' R+ e& `' R( G
  174. ;==================================================/ N/ Q9 _7 R% N" Z9 h) V" R+ V
  175. HEX_Data            = Music_State+$01: ]  A/ q# N' U6 G+ ~" M
  176. DEC_H               = HEX_Data+$01
    0 e- J( ?8 A1 R9 R6 @# w7 I# ], U: k
  177. DEC_T               = HEX_Data+$029 N& H/ U0 J; P8 ?
  178. DEC_L               = HEX_Data+$03
    ! O$ ]8 J; M& Y. ~+ B4 x
  179. ;==================================================
    5 w, x/ c" |  p4 M* C, ^% o
  180. Time_S              = DEC_L+$01" g7 H  ]% @& c  ~+ i9 t+ T* d
  181. Time_M              = Time_S+$01
    0 b' J" l$ t, z& @' Y3 Q
  182. Time_H              = Time_S+$028 v( I6 h+ n+ w8 V# `7 D3 w
  183. Time_Cnt            = Time_S+$03
    ( F0 b  d9 h% Z  [/ J# a* _' n" {7 _( r
  184. ! t( d5 P7 _  [1 A# X6 p  Z. h
  185. ;==================================================
      J% N3 a1 D: s- C7 Q
  186. Music_Bank_8000 = Time_Cnt + 1
    7 w+ j/ d/ ?; b7 @4 R# X
  187. Music_Bank_A000 = Music_Bank_8000 + 1+ q3 R  j+ }* |
  188. ;==================================================
    ' X6 w- m( A$ m3 v
  189. - W# M# t6 J% T  k+ R
  190. ;======================================================================
    " k, E. M' S2 ?  J3 H  j
  191. .BANK PROGRAM_BANK
    * A3 r9 g  i" R5 c9 J( r/ N) i0 _
  192. .ORG PROGRAM_ADDR9 h9 B) w# X( }  R5 h+ T
  193. / F  y( |+ V8 \8 P. [# ^/ N6 q$ X3 I
  194. ;==================================================; D+ M7 t5 R3 J4 |8 q+ g; \
  195. NmiProgramProcess;NMI中断程序处理
    7 q5 ^% Q9 J) G4 U
  196. ;处理PPU图像: \9 ?2 l6 g8 C3 _" i! ~
  197. JSR PPU_Proc
    8 }( `3 O1 A3 ~8 C8 u
  198. 4 U+ A7 i9 G$ D3 L$ ^
  199. ;启用NMI中断
    ) D6 Z  E6 ]0 X6 f! r
  200. LDA #$80
    - ?# |. @: W, I6 Z. ?6 f8 p& X
  201. STA PPU_CTRL
    0 O/ j; Y" N$ }, _
  202. " o, X3 h6 {9 g( |
  203. ;更新调色板: o1 Y* f& O. ^9 g3 C# F- K
  204. JSR Update_Palette_Data
    6 D; s, g+ r4 L/ H0 V# ?, H! H! p- o
  205. ! z9 i5 L+ I! q: _& S
  206. ;显示时间(缓冲)
    1 I) Z5 I8 g, V8 e
  207. JSR Time_Show6 Z6 k* e! y' I& x1 c6 l) L5 \; m

  208. ; J2 ^, v. e* j: N# s( j* p
  209. ;播放计时) Y) p- t6 B% R  \" I/ F
  210. JSR Time_Count
    " J" s/ W2 y# P- ?8 A
  211.   U& d5 W$ k  I# D8 P$ `  w2 c
  212. ;播放声音
    , p  g7 z0 u/ H* v9 R4 }
  213. JSR Sound_Play
    ) X7 ?! U+ b& r/ c5 L8 u! t' M  N; Q
  214. ; |; ~& a- q- k) O0 p- o
  215. ;切换音乐(手柄触发)
    % t* N/ n2 @( j/ [) a
  216. JSR Music_Switch
    , s8 ]0 e4 k! q0 |
  217. 4 t- o8 k* T& m7 S1 Y' p
  218. ;音乐显示(缓冲)% F9 ^6 g6 u% ^1 Q* w4 x
  219. .IF SOUND_BAR_SHOW_ENABLE+ I1 X5 b1 [! ?6 q* D
  220. JSR Music_Vision
    6 ?2 f+ R9 |. g. ?2 y* @  t# Q
  221. .ENDIF
    4 u) Y" q) n4 \( I

  222. 0 I  b1 i) J7 d! V
  223. LDA Time_Wait_Cnt6 g& N% }8 M. s, L$ a
  224. BEQ NmiProgramProcessEnd
    ! t1 O) [$ g& u1 [- S0 H) m
  225. DEC Time_Wait_Cnt
    % T" e, o+ u, H
  226. NmiProgramProcessEnd8 V- Y: x0 E' c! x6 K
  227. RTS7 [+ p5 N, g) @4 `; P1 J4 f1 L" X
  228. % }+ @( S5 D8 I" Z. u& A
  229. ;==================================================
    ) `$ d8 Q( A- r4 }% B
  230. ProgramBegin;主程序
    0 }# y8 p; n  S8 p( s3 B! g$ n8 B
  231. LDA #$00
    " @6 v+ |. T. Q' U/ l
  232. STA PPU_CTRL
    8 V! |- `% F/ Z+ }
  233. STA PPU_STATUS
    1 M" P* W/ }1 C! s8 x6 d8 \6 ~" `
  234. STA PPU_MASK
    1 ^6 n0 Q: o4 c6 @  m6 ~
  235. STA APU_STATUS4 }  p* V# r$ g: ?$ a
  236. STA PPU_SCROLL
    3 ~( u& x2 B5 Y& f2 l
  237. STA PPU_SCROLL
    " t( L5 Q3 t% S7 C# S
  238. LDA #$C04 }' Y$ {0 R7 C1 L+ s: d
  239. STA JOY2_FRAME6 z: L& R5 M8 T% B) [# V
  240. # P0 d6 c1 C% U, A
  241. LDX #$FF9 {$ s$ S' b% n& ?# e
  242. TXS4 A6 o& t( H' ?
  243. LDA #$00
    5 d$ t0 p7 {: O  g  ]9 t: ~  z; e" |
  244. STA PPU_CTRL9 s6 Q. N3 G3 ~% d) p# x
  245. STA PPU_MASK5 M% S! e5 ^- \8 Y& }6 F% O6 t
  246. STA MMC3_IRQ_DISABLE# Y" r/ P, V" ]

  247. ' {1 _7 C: t# @% _
  248. ;==============================, _" D4 f' J3 r" D( t
  249. ;调色板清空
    : {  A' h% A# `% Z
  250. LDA #$3F
    ; a1 }7 T+ I0 l
  251. STA PPU_ADDRESS8 E: @5 }5 U" `! F: a5 E
  252. LDA #$005 P0 Q$ c7 x" l( k# d0 E: ^; {
  253. STA PPU_ADDRESS
    ( f* |3 c4 U' ]- U* A
  254. LDA #$0F
    % F; X+ a8 `  ?( V" p
  255. Palette_Clear
    ! P/ X2 L& ^, e9 q8 z
  256. STA PPU_DATA; k7 ]5 I% F; l- f: M2 o1 A8 o
  257. INX
    : p8 ]9 B3 A8 P% x! u; i; V6 B
  258. CPX #$20; ~9 l: Y, }& j& D0 U+ D
  259. BCC Palette_Clear1 o" ^8 F# Q. Z5 Z
  260. LDA #$00' }/ ~- Y, d: u* m# }6 O' ^
  261. STA APU_STATUS
    " \9 s6 x- r4 l/ r+ B( h
  262. ;==============================) B. s9 b: q* ]0 T1 q5 }6 I
  263. ;初始化背景调色板9 a& k2 c7 m# Q& u$ e7 I5 I
  264. JSR Set_Palette_Color
    2 M/ G% I: V; \. ?2 v
  265. JSR Set_NameTable_Attributes* c1 P$ W3 M* L2 x; W/ s

  266. & f9 |( J$ Z: w! ^3 C/ w
  267. ;==============================/ s% x/ ~0 \4 g, n+ q3 @8 _; k( o
  268. ;RAM初始化
    0 Y# D6 y- w0 K. K' n; z" T9 v
  269. RAM_Clear_All
    # r5 m+ z3 G/ t& c, n# @% G, [
  270. LDX #$00
    & K$ `) R5 z$ p8 @
  271. LDA #$00
    . p) \# C( `6 g) Z! N
  272. RAM_Clear_All_Start; T) V5 j0 H+ V) d% P
  273. STA $00,X$ l+ X  L6 S& J& q' p" j' v
  274. STA $0100,X7 }6 ^; L  _: d% s$ N5 r  G: w$ K$ z
  275. STA $0200,X$ n& W1 e* |6 z0 p5 P
  276. STA $0300,X. f. s3 }4 a3 c* I5 V0 l
  277. STA $0400,X
    ) S  N5 u( O1 T! b1 S
  278. STA $0500,X
    1 b# d9 [! ~" e
  279. STA $0600,X
    ( b/ a* ?1 b$ w' A4 D3 H; @5 b# Q
  280. STA $0700,X" u0 f5 g& H9 z8 p
  281. INX" b5 O8 ]' D* A8 b3 {
  282. BNE RAM_Clear_All_Start0 V. P5 h* x+ Z! H) G

  283. 1 I+ Q/ W, ?, U8 c% i
  284. JSR VramInit! D/ H, k' V1 y2 j
  285. JSR Init_Palette_Addr
    . b) [6 Z$ w" Y. b4 P4 V

  286. 7 R- p2 k. R* {; }
  287. .IF Music_Reset_Addr) u8 i- S6 P" ?0 f1 ?4 b
  288. JSR Sound_Reset
    # Q) ]0 e; K' k* @% i; Y- c
  289. .Endif
    3 [4 G& [4 B6 M6 q
  290. , Z5 _7 {' z" S3 z" U9 O' K5 ~/ J
  291. LDA #Music_Start_Song-$01% S5 W/ }) a& Y- u1 [. U
  292. STA Music_Cur
    7 Z4 k  W& g6 {  {
  293. 6 T7 C+ U+ y1 h& \/ B
  294. JSR Show_Music_Text- u$ k0 }% v5 a3 X
  295. ) T! W2 v  A3 h: s/ d6 M
  296. .IF SOUND_BAR_SHOW_ENABLE
    9 Z* `. R2 t, T' B( P1 K$ o+ N
  297. JSR Sound_Bar_Text_Set
    0 z$ Z9 k8 x" ?8 |  m6 s
  298. .ENDIF2 x. P1 h9 v- P8 s

  299. - K2 {/ F/ B' v; a5 l7 d
  300. .IF Track_Name_Pos3 T  J9 P! H- e1 Y# K" U
  301. JSR Show_Track_Info/ @1 ^& \2 l5 T* k7 W" d
  302. .ENDIF: E4 W& E. U) e! Z4 e& Z7 V- ?

  303. - {6 k9 n9 a6 ^/ U
  304. JSR PPU_Proc# u6 o* ]4 x# S9 d8 w: p

  305. 0 c( W) W* h9 Z/ v- w7 u
  306. LDA #$0E9 E& j& q$ o+ v4 T  ?, F
  307. STA Screen_State1 b' D# G& F' G+ P* S0 @4 a+ X: H
  308. 3 r1 i% ?5 C1 x! s; J
  309. JSR Sund_Bank_Init5 f1 ]( r' U' O3 x+ z! y' D
  310. : }/ [' H  {- [! p
  311. JSR Music_Show
    * K5 C. d: Z1 {4 e$ ?
  312. JSR Time_Show
    + p1 h2 T0 w! q3 w. I( H
  313. JSR Music_Stata_Show  M3 f& [) f1 K
  314. JSR Time_Delay
    # }1 u9 {1 N3 {) @# W+ [
  315. ( G6 z) R$ y& X5 }
  316. 1 ^8 r1 f/ V! y
  317. LDA #$80. c1 H9 U& |* D0 l7 c
  318. STA PPU_CTRL
    2 Z0 G3 J! U* B! C( ]

  319. / T% B( X8 O- P- ~
  320. LDA #$20. t8 M9 `) {( g& H" h
  321. STA Time_Wait_Cnt3 g" V& I) R% O) A8 S
  322. ( ]9 j- B  B0 O+ @  L* f
  323. Wait_Time_Over
    / v& K: t- ?8 s
  324. LDA Time_Wait_Cnt
    , ]9 v2 j/ v% W4 R% T, R, e
  325. BNE Wait_Time_Over
    / ^) B) \+ }! s2 }

  326. 7 F; h- K) t0 d; j
  327. LDA #$1F
    ! E$ |# K9 q' L; ^3 ?
  328. STA APU_STATUS
    ! D/ P$ ~, Q) b- `
  329. LDA Music_Cur4 v; C( p& n* F; b0 k) i) W  T: K9 |
  330. JSR Sound_Init0 T$ [3 a) g* G0 b  @8 R
  331. ! \, n3 o" O- G4 N1 K$ ]$ i
  332. JMP MainLoop
    " I4 C: v& P( I0 c0 s! [8 v$ Q
  333. 6 |; E% B% R" n$ J, B: J
  334. ;==============================9 k9 I* {3 _4 b8 }: K
  335. Time_Delay;延时等待2 R" B" l7 W! O# m6 L2 H
  336. LDA PPU_STATUS( Q! s4 l* l( ?# l
  337. BPL Time_Delay: u' }9 `" T7 U: w8 t7 j
  338. RTS& B$ x. _0 b% H7 B& @8 [

  339. 3 K0 J: h  w: u/ ]" R, B
  340. ;==============================; Z. A7 Y5 Z( P! Y3 Y$ ]7 x0 R
  341. VramInit;初始化图形内存
    - f2 g) O) c' b$ Q% F
  342. LDA #CHR_DATA_BANK) q1 W7 v; N9 E9 G9 @
  343. JSR SwitchBankA000
    6 ~  R5 P2 {1 C7 J3 F; M' I1 @' f, ^
  344. LDA #LOW(CHR_DATA_ADDR)
    8 a! o/ r4 I. U: h
  345. STA <Data_L
    5 I2 n$ R/ A# k
  346. LDA #HIGH(CHR_DATA_ADDR), G0 x. w+ @) M) {. j( @2 P
  347. STA <Data_H
    , |. L& ]/ u  W. P% q; N
  348. LDY #$00- _, `2 b% _3 K( C4 B5 ~, j
  349. LDX #$20% l6 R4 x3 K0 N( b: s/ n$ t
  350. LDA #$00- ]- _& m1 e# J: l
  351. STA PPU_ADDRESS
    1 h2 D# N( e9 l8 y( `
  352. STA PPU_ADDRESS. G& G* Y* k: ?4 |& h
  353. VramInitWrite
    4 ?+ |- r. z# ?1 C& G/ M- @/ M8 h9 {% D
  354. LDA [Data_L],Y; l6 }# x% z: F: {/ f7 q% n
  355. STA PPU_DATA! Z4 [; N3 B9 Z0 y) G8 X
  356. INY
    2 P3 G+ S' i1 b+ w( L  w' L8 K4 m
  357. BNE VramInitWrite
    0 S' M2 h  o/ V6 b7 i
  358. INC Data_H, G; e. [2 @1 t7 ]4 B8 w5 M0 t
  359. DEX
    6 [/ g9 A3 n% c+ s- o( J
  360. BNE VramInitWrite
    7 k* Y" J- S# T, T
  361. RTS" u4 z3 Y3 @/ b3 n

  362. * T- }0 u2 r6 Y7 k+ [6 @
  363. ;==============================6 f7 }9 {" ^/ Z6 M% Q6 m/ Z) ~0 m
  364. RAM_Clear;RAM清除
    ! s  ?) O% @( Z9 b" N
  365. LDX #$00) L% q5 v  ^9 v
  366. LDA #$00
    4 q9 `2 t& x0 L
  367. RAM_Clear_1- f2 n) q7 d# l" \. M! i
  368. STA RAM_Cln_1,X  i: l: O" r( u( A$ C6 o$ ^- a
  369. INX
    # o# C9 V1 ?7 Y+ h" G6 C. e
  370. CPX #RAM_Cln_1_Size
    + N. d6 R" Q3 K  b! k
  371. BNE RAM_Clear_1
    : A5 N/ X- M% ?$ \. E: F) y  k/ ?
  372. LDX #$00, J- D4 T) i0 f1 y* B) l% C
  373. RAM_Clear_21 F/ ~3 H8 H0 p: i/ i; I
  374. STA RAM_Cln_2,X7 J% M5 r5 V) T* R7 I8 a' [
  375. INX
    1 Y5 b0 K0 C# |, U
  376. CPX #RAM_Cln_2_Size
    # C6 O- y0 k0 ?4 e4 d/ O
  377. BNE RAM_Clear_2; K! @2 m6 ]4 S  `( J6 G$ w
  378. LDX #$00: e4 }% h9 y: f( x
  379. RAM_Clear_3
    ; O& K& F: |. G( f# G0 S, [
  380. STA RAM_Cln_3,X
    " P+ M8 O8 s- R; E8 `1 i
  381. INX
    ; M7 b3 H5 f# M1 a; o( |1 B
  382. CPX #RAM_Cln_3_Size, Z5 E* c& U6 n4 Y7 T
  383. BNE RAM_Clear_3! t+ U) {/ Y" O* O; t
  384. RTS  |. F& V! J1 j
  385. : b1 b/ \/ y* X- t. b. n6 X5 ]
  386. ;==============================
    * A; S1 e% s8 `2 {
  387. ;音乐切换5 u9 P( z7 b6 D) @" S$ [0 v" V8 N
  388. Music_Switch& v/ S# \- ~0 K0 v6 {: o2 R
  389. JSR Key_Proc
    # |7 v) N) l" E
  390. LDA Key_Once- @  |& L9 t) ~2 }
  391. CMP #$100 I7 @6 r9 l+ n# ^" x; d
  392. BNE Music_Start_SongStop: R1 W" ?8 Z7 |0 k1 k9 I+ |
  393. JSR Music_ReSet( i3 H2 E$ W/ G) B+ {

  394. 1 g, c$ W7 N, G* t) [2 {. h
  395. ;音乐停止+ m  Z! d* c: X/ p
  396. Music_Start_SongStop
    ) m# g  }# g! }6 `9 P) E
  397. LDA Key_Once3 u$ ]1 N6 |5 f  f8 ]! Y( U
  398. CMP #$20" C: ?2 q6 _. {, b. q6 k0 U, O7 C, s
  399. BNE Music_arrow
    ! `0 L& C+ M9 {5 {' i$ Y/ r
  400. LDA #$01$ j+ D5 z- ~) _9 e0 `
  401. STA Music_State/ Y2 A; d2 U$ v. `7 _
  402. JSR Music_Bar_ReSet
    0 R5 F  p- {1 |7 B1 b3 ]1 o2 m
  403. JSR Time_ReSet  }4 A, U% z, N9 m2 z9 I. O
  404. JSR RAM_Clear
    % p3 t% p9 n+ J: K9 p. o9 g
  405. JSR Sound_Clear, l2 h3 z# w* T
  406. JSR Music_Stata_Show- w4 U& Y% J  A; z- m3 d
  407. Music_arrow% `/ m/ O0 n' @. Z9 t+ U
  408. LDA Key_Once( D  b) e/ G9 l
  409. AND #$CF
    % n# P" M* p) i  Q
  410. BEQ Music_Switch_End+ t5 M/ }* }! ]+ Z, n! x0 r
  411. JSR Music_Number
    # Z, a$ m' T- [8 N" n( S
  412. JSR Music_ReSet
    2 |9 H3 n2 S3 N/ H
  413. JSR Music_Show* K/ j' [/ x: \8 }; V
  414. Music_Switch_End
    0 i, a& M. q9 Y5 K3 A/ }
  415. RTS, ?$ |; f; N. ]/ y
  416. 4 h4 m% ?+ O+ @. b; I8 b' w& ]
  417. ;==============================
    : j8 p- _# _# M. J- P% {% v
  418. ;音乐曲目切换
    * V1 ~, _# r- V; f: \4 T
  419. Music_Number! n3 j2 [! s/ d: n& v, A0 A8 F2 B
  420. LDA Music_Cur/ s2 a+ |7 F/ W1 e# x0 j% R6 O1 U
  421. STA Music_Last' n& Q' ~4 Q  Q
  422. Music_Decrease* z: t' q- ?" y/ g8 t
  423. LDA Key_Once9 t( ?. l- m: Y; O2 B
  424. AND #$42
    % f: G6 {# r/ `  _4 l
  425. BEQ Music_Increase: ^% o+ P+ d* l. y& ~) s+ e( R
  426. LDA Music_Cur, i. h) \' q5 e9 X" ]
  427. BEQ Music_Increase
    ( P( V8 U7 a& T2 a
  428. DEC Music_Cur7 C/ f4 k4 d# C8 O' t
  429. Music_Increase
    , L4 w% ]& W$ e  y8 T
  430. LDA Key_Once
    / E% n- ?6 x5 ]0 T% @3 }! f
  431. AND #$81
    1 t% z0 `  c6 `, T* p
  432. BEQ Music_Decrease_10# F. v' T- a7 D9 l
  433. LDA Music_Cur
    + n8 H$ k: i' }3 c. [# t5 a3 N5 K
  434. CMP #Music_Song_Total-013 b, C3 Z& U- }9 ?
  435. BCS Music_Decrease_10
    ( b/ A$ }6 T& [" O  X8 B/ p. L' Z
  436. INC Music_Cur' V  J# K6 @' G+ y6 `2 K
  437. Music_Decrease_10* Z; _1 d( f- O* i/ P" |. g, @, K, c
  438. LDA Key_Once
    % ~8 m2 G# y5 u/ u" F
  439. CMP #$04* y* d- U/ @: ]
  440. BNE Music_Increase_10
    : H  B: w4 A5 ~
  441. LDA Music_Cur
    8 B2 n& p& Z3 _9 \" |
  442. CMP #106 o7 T4 N1 b1 S) t
  443. BCC Music_Start_Song_Min
    ! C. A6 m$ T, ?8 e
  444. LDA Music_Cur
    0 B1 k' A! P# i+ }' D$ s2 w
  445. SEC
    % U8 ]! L& i9 U
  446. SBC #10% O( Z4 ^% |* M; m: H) H( p* V
  447. STA Music_Cur
    5 G( ~' t$ ^* l3 M
  448. LDA #$00+ i* H" d% C. z4 S  n
  449. BEQ Music_Increase_10
    ( K2 H: i5 W, O% N
  450. Music_Start_Song_Min0 K# E! T0 l. i
  451. LDA #$00
      H+ T1 v- S9 `2 q! ]+ W! t
  452. STA Music_Cur
    " M4 P1 O$ V9 k! O' _# ~/ K
  453. Music_Increase_107 |- X! e% x) ?
  454. LDA Key_Once7 O) `$ Z+ L, L( c" {5 L& Q
  455. CMP #$08( l; @  D% S; ~" T+ ^. m! h: ?# h  e
  456. BNE Music_Number_End
    # d( O2 O/ f3 ]/ k2 H8 I
  457. LDA Music_Cur0 Z  Y- T: @6 f( }' s- g0 ]
  458. CLC5 M" W& `' M  L8 f8 t
  459. ADC #10' q- W# R0 N+ z! H( ^
  460. CMP #Music_Song_Total-01
    " H2 ^. j7 M4 t! {8 l. _* u9 M* n9 `3 {
  461. BCS Music_Start_Song_Max6 }* q2 V; ]9 \9 L
  462. STA Music_Cur
    % n0 E7 T0 O' Y4 S& z
  463. LDA #00
    ( h1 C8 n1 O; |4 r
  464. BEQ Music_Number_End, M" F5 ?# v: k) @, ~
  465. Music_Start_Song_Max
    ; o" S/ q, E8 y9 X
  466. LDA #Music_Song_Total-01
    ( u$ \4 M' T' N: l2 `6 e/ \6 D8 |8 _
  467. STA Music_Cur! h3 l& h: O6 z0 U( Q, ^6 L9 b
  468. Music_Number_End8 q5 K$ H" J. {  R% n
  469. RTS
    7 J! q/ z$ X4 D- Y, i' Z* `3 X- a) V- A

  470. 8 g. d! M& a" N; J, g+ `, Z; b1 E
  471. ;==============================: ]) O- ^, U8 j" }& x: p) D
  472. ;音乐重设2 C/ u  N5 A1 a5 _5 t+ @( X: U
  473. Music_ReSet
    ) ^2 u, J- G$ G# p$ a" }
  474. JSR RAM_Clear
      s, m( p2 W& {1 M- D
  475. JSR Sound_Clear  K' ], I& P+ @4 O) @# |
  476. LDA #$1F
    % X, ?0 i, N9 ^3 l4 R' K, Y
  477. STA APU_STATUS) `2 ?, G. N  P6 z; |$ b
  478. LDA Music_Cur$ w* W+ |3 C( h
  479. JSR Sound_Init' s% K: ~$ _) H2 |+ t' _
  480. RTS3 H& R2 ?1 |$ Z) b% N
  481. 3 m. F" N+ B; D9 x$ ]
  482. ;==============================% z) e4 U! J1 p- d0 a1 d3 V
  483. ;音乐端口清除
    + S8 E" }1 M. B
  484. Sound_Clear
    1 }/ ~' j" l( k" q
  485. LDA #$001 \7 w. A9 m) R
  486. STA APU_STATUS9 o2 _$ Y) d6 ^1 c0 }7 o9 a
  487. LDX #$00- M! W/ [6 f9 q( U. y5 U! `- l
  488. Sound_Clear_Start
    6 X0 O5 \/ X, g0 G, l) C0 \3 w
  489. STA $4000,X
    ( d3 W# T% c6 E0 l5 \8 f" |
  490. INX4 j- q/ E9 I' J. s* T
  491. CPX #$14
      \) W# t$ ^" D2 x
  492. BCC Sound_Clear_Start
    6 E% U9 m/ m5 j: w: T
  493. RTS
    9 a7 C1 {$ p. y- Y7 V/ e) c% B
  494. 2 {) A2 L" |4 D2 H: r3 }  R  O
  495. ;==============================
    6 P2 k! [; W' W- z
  496. ;按键处理$ M+ o6 ?5 F7 C  i$ _5 r1 l; l
  497. Key_Proc
    7 h; }# |* k# q7 {; z( p
  498. JSR Key_Scan9 h9 I1 s0 F8 q  k5 v$ g, G) p( d( ?
  499. LDA Key_Keep& u. J2 |# V- z0 A1 R# N4 g0 i
  500. STA Key_Temp/ q+ I3 |1 j7 Y0 N" M" R# L
  501. JSR Key_Scan; a$ C8 \% `6 ^9 H4 R
  502. LDA Key_Keep, R" ]# b, C8 T- |3 i- @
  503. CMP Key_Temp
    , G1 L$ t3 m- c- i8 W7 i* U8 }; A
  504. BEQ Key_Get_Once
    6 E# A3 S+ I( Z& m: j3 R: c  [' Z8 r
  505. LDA Key_Kemp( I1 K" k1 I% O
  506. STA Key_Keep
    ( Y6 R: d% D9 g
  507. Key_Get_Once/ V- X4 O  v7 M  T% u4 Z
  508. TAY
    4 w' ^. `. u) l) W3 g
  509. EOR Key_Kemp7 g$ B: `- h, r+ A  w" x, H
  510. AND Key_Keep+ ?) Q7 \8 E, S2 p, ?
  511. STA Key_Once* s% ^" P# |0 e  Y, T7 T! [  e3 j
  512. STY Key_Kemp1 A* e7 n# l8 N) v; [" {7 R3 C0 ?
  513. RTS
    ! b( }& v- H+ d% m0 F/ E- z/ a* y
  514. ;------------------------------
    " z- G6 ~' |+ L6 g, x! J, _) j
  515. ;按键扫描2 ^3 G4 {. j6 E
  516. Key_Scan4 K/ |/ n3 @5 _7 G" {) H0 _
  517. LDX #$01
    % b+ W6 a0 u2 J) w' [& Y/ c% ~
  518. STX JOY1_FRAME
    5 `8 e6 D, O% l7 T0 F
  519. DEX
    8 j$ e" Z8 U; d, k
  520. STX JOY1_FRAME
    3 p/ W1 |2 o+ [1 e6 d4 @  H% E: z
  521. LDX #$084 N/ e+ \5 b% X% }5 B
  522. Key_Value1 u  M% [: J% K" d
  523. LDA JOY1_FRAME
    9 q2 \8 m* x- Q  i
  524. STA Key_Getv
    6 q* r8 X( R6 v  c7 E6 w. S  J
  525. LSR A2 ~0 M; r% }+ ?# M
  526. ORA Key_Getv
    2 \# ~$ ?: C, ?8 \2 k3 l+ W& Q1 F
  527. LSR A
    ( K' O, e0 g. I) P* O0 g
  528. ROL Key_Keep( Q4 r3 N( u  V  J, Z- t) E0 f5 s
  529. DEX( J( U2 F- z# _0 v# z, Q) L1 g+ {, t! ]
  530. BNE Key_Value' R) g1 W2 u9 q
  531. RTS, j) B: A3 Z7 ^. Y; d" k$ _# @
  532. 3 p) M" H* ?$ [4 b6 h- L: {5 H
  533. ;==============================
    / N1 M7 T, T( T1 C( u. f
  534. .IF SOUND_BAR_SHOW_ENABLE
    : C" t3 r% V6 I; U9 _- x1 L
  535. ;音乐条显示
    " X: |9 \1 i: G6 a  w
  536. Music_Vision% T( y2 E" o, r/ i# F  x2 G
  537. JSR Music_Animation2 @9 @9 O# M0 v% J7 |2 _9 Q4 M3 |
  538. JSR PPU_End
    * ^$ U1 B5 [0 o& N
  539. RTS8 ^) f  M4 M) `# G3 V
  540. ;------------------------------8 o+ \* _) `, M) D8 a
  541. ;音乐条显示处理
    ) w2 C( T8 A( t. D8 I% f
  542. Music_Animation  M" W6 @, z2 W$ R& F- h9 N
  543. LDX PPU_Cur
    & S2 [% c3 d# F' D
  544. LDA #Mode_Line, z% y2 {9 U% |' I9 J
  545. STA PPU_Addr,X
    1 Y4 i3 I4 Q  }6 P$ w: Q2 {
  546. INX
    & _7 I' f! x# {1 a
  547. LDA #HIGH(Sound_Bar_Pos)6 Y" s5 g6 V$ k; _$ R; K- x6 o( A
  548. STA PPU_Addr,X# i( Y$ Q6 a8 ]* e
  549. INX( q  Y4 u0 Y( y3 p( _7 ?
  550. LDA #LOW(Sound_Bar_Pos)- B; P8 r, o" M5 s( i9 f
  551. STA PPU_Addr,X+ w! r8 |4 J* Z# M% s# i$ d$ t
  552. INX
    ( ~1 C- Z! ]) }# t& Q# e
  553. LDA Sound_Bar- T5 G, \+ e* p& l( y
  554. JSR Volume_Convert& n# A0 u2 O0 W& s4 n' C
  555. JSR PPU_Return4 h8 t/ O2 U# |  r' x' [* r/ Z+ E
  556. LDA Sound_Bar+$4
    $ O% r+ M( g9 Q1 r1 `
  557. JSR Volume_Convert
    8 M$ h- U; U& [; x" b( T) a
  558. JSR PPU_Return
    8 n- p1 \1 Q8 \; S4 T! y
  559. LDA Sound_Bar+$8
    " J: _# _( g3 q% x" B+ U3 O+ d2 d$ j- g
  560. JSR Volume_Convert_Ex
    % K1 p7 N3 _  z1 U) D& n
  561. JSR PPU_Return2 x" C5 |; h* p: p
  562. LDA Sound_Bar+$C
    3 h: D7 J# ?. Y4 b
  563. JSR Volume_Convert
    % s9 h/ q2 \1 f, x
  564. JSR PPU_Return' y5 W5 X, S/ _; O: ?- O/ t# Y
  565. LDY #$10
    . Q/ L6 R  t$ g5 _% T& M
  566. LDA APU_STATUS% x* ?( q: Z4 m$ `
  567. AND #$107 G; M2 y; B: ^1 c' Z9 h5 ^
  568. BNE Volume_Count" D# l7 G! C9 ~. o2 l
  569. LDY #$005 U, Y' t& E2 B. K
  570. BEQ Volume_Count
    7 t5 }1 C/ ]+ ]- ?" {+ G
  571. ;------------------------------/ h$ h- B1 Z8 O
  572. ;音乐条处理
    % r4 v) _9 t" L
  573. Volume_Convert_Ex4 A" J  V0 f/ ~4 ?6 U
  574. AND #$1F  q2 b+ k7 x2 F. |1 M+ y/ L) z
  575. TAY& G: x8 ]0 W/ `& G5 C5 _7 P2 u
  576. BNE Volume_Count& h1 s* A+ d  c6 m. B
  577. Volume_Convert- E) Y$ v1 A2 W- P
  578. AND #$0F- g- G2 _, G- O/ m
  579. TAY! [$ L. s/ {4 g3 O7 `
  580. Volume_Count
    % @$ D6 A0 i5 C& b8 r/ M+ r! p
  581. LDA #$08
    8 v( t) @+ W. Y& ?4 q
  582. STA Sound_Bar_Cnt
    ( v0 b& o. j3 t  D  {$ v
  583. Volume_FILL
    & r+ y. @4 b! P
  584. DEY2 Y7 _% P9 n7 J& d6 o* j+ T
  585. BEQ Volume_Half6 x- u" c( d. S  k0 `$ s& I- W
  586. BMI Volume_Empty
    + J! A" x: A+ b( b
  587. DEY2 c) ]# }( a; B! C1 C/ k) f, T
  588. Volume_Full1 A, o3 y, {6 b: C
  589. LDA #$16
    & \0 W8 D) x% b8 ^0 S. C/ ?  D
  590. BNE Volume_PPU+ E& d' Y; `1 U' j6 |
  591. Volume_Half
    " h' F9 [& ]1 z; l$ m
  592. LDA #$15
    3 G- H+ z; L: `8 w, p4 F
  593. BNE Volume_PPU
    : ?2 w3 z, I9 {7 }
  594. Volume_Empty
    0 F) C" Z# H% y/ R/ }' W9 [# w4 ^
  595. LDA #$14
    6 l* [0 M7 S! V7 Z  M# S) K. Z  Z
  596. Volume_PPU+ n$ ^( T8 J6 F5 y
  597. STA PPU_Addr,X5 j' h/ a* e1 c) K& e' C
  598. INX/ v/ A+ z: j$ e
  599. DEC Sound_Bar_Cnt
    ) k! b& ^; F( \' H
  600. BNE Volume_FILL
    7 ?' H" c* x5 f% x2 l# d6 d. r
  601. RTS
    % o! r1 j2 V& A4 ^7 I

  602. , [2 D/ s5 J$ {& v
  603. .ENDIF
    & y" o$ d+ Z* o' |9 W
  604. . k3 ?& P' d; w8 G4 H* e" p" N
  605. ;==============================6 ]( S$ `6 ?. ]) }1 U$ o  b
  606. PPU_Addr_Set;PPU行开始
    ' }' [% t. ^! Z+ R9 f* t) I3 s
  607. LDX PPU_Cur
    5 A' h9 Q0 @- U; d0 B3 A, u) V
  608. LDA #Mode_Line3 I- j; O! `! B) a* M
  609. STA PPU_Addr,X( m5 b* v' G2 n7 G5 c7 P
  610. INX
    1 f# X/ M" e# @4 w! g% m- A
  611. RTS
    ; A' q+ H6 ]- d3 G- c( N

  612. / H( m4 \3 B+ R! e* D) `. w! X
  613. PPU_Return;PPU转行
    6 F$ ~) y" n: ]- l* ~
  614. LDA #Flag_Over) m1 J* S4 m5 d, {' Z
  615. STA PPU_Addr,X
    8 _# Q  z* \& X" Q/ e
  616. INX, S" ~* ?2 G0 x5 N
  617. LDA #Mode_Return
    . o3 B1 m7 P5 n
  618. STA PPU_Addr,X! p5 t" Y% _! w$ `
  619. INX; Q5 F6 ]. m+ f( P# y' V
  620. RTS6 y1 i2 w5 ]: A! h& y  @3 }
  621. # D  i- X' W3 q8 a, ~# v3 R; {& p
  622. ;------------------------------' k8 T3 k4 [3 f$ B. m3 w2 Y% t
  623. PPU_End;PPU结束# \. s0 X$ h" |/ V
  624. LDA #Flag_Over
    $ b7 o& n6 V  u& Y
  625. STA PPU_Addr,X% J2 k- e8 H* C
  626. INX$ N& y+ u: x$ L8 R
  627. STX PPU_Cur
    ( V& g5 t/ J" R* b
  628. RTS" ~6 A7 K2 D. p3 D  F' D2 U4 u/ c
  629. ;==============================4 d4 S6 P* m. @2 ^: R, A
  630. Mode_Line     = $FD    ;新起行模式
    1 s& K" ^6 T; w' S! o6 x/ @+ r- B
  631. Mode_Return   = $FE    ;转下行模式! v  E1 L- m3 R$ V* `* c
  632. Mode_Clear    = $FC    ;行清除
    * z. ?6 f! i! ^5 C
  633. Mode_CntLine  = $FB    ;行计数写入
    9 Y3 R, l4 {" ?( T: ^2 R& [
  634. Flag_Over     = $FF    ;行结束标志
    - i- Z) X0 K- Q; q% g

  635. 6 T5 K7 b' C% z$ e- ~( [
  636. ;------------------------------8 x6 n) p4 Y* e1 p  m! b) h# s/ ]
  637. ;PPU处理3 u, a6 c# @( V/ H( @
  638. PPU_Proc1 H) o$ O" [; E, Y
  639. LDX PPU_Cur( C7 S$ {* R0 Z
  640. LDA #$00
    0 D/ f8 m& D" q8 W+ B4 r; t  o
  641. STA PPU_Cur& o/ x* q# X5 _6 D  X7 q. E: I
  642. STA PPU_Addr,X
    0 _0 n+ ]' u0 {2 C' k
  643. LDA PPU_Addr2 B& r9 O- d8 N
  644. BNE PPU_Proc_Beg; ]1 W1 p* A  l4 O
  645. PPU_Proc_Ret
    6 e9 X! ?6 y3 w
  646. RTS
    / X; u5 z% {" F
  647. ;------------------------------- U' ?/ C% |$ E3 p5 S4 `. |
  648. PPU_Proc_Beg  ;处理开始
    ) |8 H3 _" X4 I9 V, C" L) Z4 y" e7 h
  649. LDX #$003 i' R, X* [1 [4 t" b& L
  650. STX PPU_MASK
    " ~. Z  }2 R6 y  G! e* J2 T6 ~
  651. ;------------------------------
    3 d' p4 l& X6 f3 o( E2 B- E9 }
  652. PPU_Mode_Select  ;模式选择
    - ~6 _. N  w1 [, G2 R
  653. LDA PPU_Addr,X& d7 i9 @* N3 ^7 k, l) a
  654. CMP #Mode_Line+ R/ n( U6 G& g) n4 I) m% h( m7 S
  655. BEQ PPU_Mode_Newline# P: }2 J) ?4 K/ @6 Z1 }( [2 h
  656. CMP #Mode_Return
    2 M! h- |0 r1 F8 v' f( K
  657. BEQ PPU_Mode_Return
    ; k/ `1 e3 ^; p% q* D, n5 O
  658. CMP #Mode_Clear
    + U, a! H' L2 K! a
  659. BEQ PPU_Proc_Clear4 u( {/ V, ?) j/ |" i! U; [9 x
  660. CMP #Mode_CntLine5 z5 H- r2 e9 t8 G) u
  661. BEQ PPU_Proc_Cnt_Line
    9 V1 M0 D$ T: w( L' Z: ]3 V
  662. RTS& I6 `( K' ~+ n9 T# g. d9 H
  663. ;------------------------------
    , x  D9 w" \5 D7 T, I% z, r
  664. PPU_Mode_Return  ;转下行模式
    - M" I  P1 j/ l4 f& t  z2 @6 p
  665. LDA PPU_Addr_L
    ! b3 f- r1 Z2 `1 a/ V( x- \
  666. CLC0 v# Q+ E2 N" K# B' H7 d4 ]5 m
  667. ADC #$20  a" W. s) I2 r0 y8 M' i5 _
  668. STA PPU_Addr_L
    ) B/ K$ B: c; f3 W) y2 r
  669. BCC PPU_Return_End
    ; {% l# A/ n4 {
  670. INC PPU_Addr_H
    ! n% d* M; ]0 `/ T9 U
  671. PPU_Return_End
      J8 _% [) c4 n4 u0 _% u
  672. JMP PPU_Set_Increaser
    3 [% R3 g/ b0 {0 z: s' [0 ~
  673. ;------------------------------( M9 H7 c4 B) r' W+ Z% e
  674. PPU_Mode_Newline  ;新起行模式) f' E5 a: O! S* |; G8 O9 ^5 D
  675. INX4 }* H- u( _8 ~! q' G! `
  676. LDA PPU_Addr,X- f- M3 x0 q9 T5 L8 b
  677. STA PPU_Addr_H- u2 B; ?* `2 N( B9 H4 S2 N
  678. INX
    5 t/ v5 k) |6 K2 c  F  G; X2 t/ D
  679. LDA PPU_Addr,X
    1 g7 S/ n' i' g
  680. STA PPU_Addr_L* p3 E) F0 g/ z: V
  681. ;------------------------------
    # t" r# J8 A% ]5 J- x: s7 u& t
  682. PPU_Set_Increaser   ;设置写入地址: R( ^( h; f8 m% R$ H
  683. LDA PPU_Addr_H
    ! e" z4 i# b7 r7 v
  684. STA PPU_ADDRESS
    . N5 e5 N0 S* U
  685. LDA PPU_Addr_L
    . ~- s4 V: B/ @7 |+ v  O0 J! d, E& s+ J
  686. STA PPU_ADDRESS
    ! T' P; [* Z6 W& S1 Q  Q
  687. ;------------------------------" R, V5 U* O! ]" B  \
  688. PPU_Write   ;写入数据3 l! \5 M) t& l. N6 B/ E9 w
  689. INX
    2 _; `$ p6 x6 _! o3 v3 Q. Q
  690. LDA PPU_Addr,X
    6 }* |6 U( W' p5 b
  691. CMP #Flag_Over$ f' B) W" X8 B: c  u
  692. BEQ PPU_Proc_End
    3 d+ K' N' s# u! A* P: L
  693. STA PPU_DATA5 V& g- W0 `8 `* Z* n: _
  694. JMP PPU_Write
    2 \7 Y* B9 f" ?  ]
  695. ;------------------------------' f: B& ~0 v% z9 J2 ~
  696. PPU_Proc_End  ;单行写入结束* Q# Q+ O1 B9 W$ p5 V
  697. INX2 S" j4 r# n' U7 y
  698. LDA PPU_Addr,X
    1 R: y: p" @% z0 D% N  L
  699. BNE PPU_Mode_Select
    9 E0 }' \* z, J8 H
  700. STA PPU_Addr5 s  g0 q& m: F) p, W9 f# X
  701. JSR Update_Palette_Color% y; f0 z( U, o& E) I* ^: _
  702. LDA #$00) Q' q( R8 d0 ^4 |  Y
  703. STA PPU_ADDRESS
    6 U2 r) y5 L& X8 I% Z( ~( S7 C
  704. STA PPU_ADDRESS+ p. A+ q- o, P  T$ y
  705. STA Show_Track_Name( X  T2 J6 x4 J$ s, w' ~
  706. LDA #Scroll_X: F; f) {! v+ K/ t
  707. STA PPU_SCROLL
    + `2 P' P1 b) I5 c! e4 @
  708. LDA #Scroll_Y( [# g: T/ u3 Y9 r' D6 a
  709. STA PPU_SCROLL4 ^/ O0 H' d+ {$ Y, {  A
  710. LDA Screen_State; y/ @9 y/ K+ L3 M, J, k$ O( r/ a# M
  711. STA PPU_MASK0 ]( S# T; b1 D+ Q0 l$ g
  712. RTS
    ( m  T/ u% Y+ ^) @' X# w0 F

  713. 3 q. b# R& X( q6 e0 b9 p
  714. PPU_Proc_Clear
    1 `! Q' p) X: a
  715. INX
    9 O' j0 H9 ~6 r: J% _) K
  716. LDA PPU_Addr,X
    6 r, K& W, `0 g8 `  d( o& _7 K
  717. STA PPU_ADDRESS
    / N, {" o" Y, e$ J
  718. INX. t! J6 A+ F6 K
  719. LDA PPU_Addr,X
    / l, }" k' {7 O" X$ x; U
  720. STA PPU_ADDRESS
    4 }" P9 ^. A2 O
  721. INX
    * m$ Z. Z/ U/ k7 k5 H7 Y
  722. LDY PPU_Addr,X
    6 O0 G6 B: v' R$ V
  723. LDA #$00& `- `8 F+ u% G5 g* h
  724. PPU_Proc_Clear_Write( Z5 k8 h4 Z4 [
  725. STA PPU_DATA' M6 @, Z$ E* X- K
  726. DEY0 O' L- k, P5 f" T
  727. BNE PPU_Proc_Clear_Write
    5 M$ B5 S& }5 `+ s& u0 m( ^
  728. JMP PPU_Proc_End
      _; r! U1 z- p% r
  729. ( u& U8 B. G8 N6 B9 c& B
  730. PPU_Proc_Cnt_Line
    ) n) d4 C5 k0 K  P! T8 L  s
  731. INX2 g) |1 s( C9 _! S7 U
  732. LDA PPU_Addr,X
    + T, Q& i4 b* r8 B
  733. STA PPU_ADDRESS7 Z4 g$ o5 Z# C0 U4 f# i
  734. INX. N; M2 A, v( E- a
  735. LDA PPU_Addr,X
    $ b1 Y; j2 C4 l  a  F
  736. STA PPU_ADDRESS
    8 }* f  ~6 h! m, E2 H
  737. INX: o8 n. C: }* z  o
  738. LDY PPU_Addr,X5 U7 ]' }2 Y; X2 I7 V/ Y
  739. PPU_Proc_Cnt_Line_Write
    4 {  w. X% ]6 V' z- {& J
  740. INX1 `/ D" z: v( d: i4 k* U7 W- X8 v0 H, `! n
  741. LDA PPU_Addr,X
    4 E4 d' }: a9 ?7 ^. `" K. |
  742. STA PPU_DATA& L  L- q  L7 I6 O1 }
  743. DEY8 V7 Z9 U/ I* g' P
  744. BNE PPU_Proc_Cnt_Line_Write
    - o  T& z: K, e& L
  745. JMP PPU_Proc_End
    4 D2 L5 L, A5 ], |3 `
  746. , i) c7 D8 |7 }: i0 I
  747. ;==============================
    + \- k; M% i% Z1 h/ O- P
  748. HEX_To_Dec;十六进制转十进制
    5 b, g5 ]: W3 u) k# A/ @
  749. STA HEX_Data1 F# u% n% j( o& t+ d) }
  750. PHA
    . z) U9 {6 }$ t
  751. TXA
    ! }; Z% y  R8 I
  752. PHA
    . V7 B/ g( S, S, V' g5 s0 N9 C
  753. LDX #$004 o. m# t) m9 e( J1 u  V2 }* ^; h& Z
  754. LDA #$00
    5 x0 q& W/ z) @' s
  755. HEX_Cln9 Z- X+ n- d8 F# q9 x
  756. STA DEC_H,X5 ?6 p  ~1 N! C! Z2 c; `
  757. INX
    % f7 X7 P1 ]% ]
  758. CPX #$03
    / A9 q2 V" q5 Q+ x! B0 J% o2 }4 v
  759. BCC HEX_Cln
    ; s# A5 S6 o6 z- `& t5 X* G
  760. LDA HEX_Data
    / k$ ~. q5 W' N; T
  761. ;------------------------------% Z3 K; i4 y% z6 K0 t
  762. HEX_100: q& K( g) a8 ^4 }+ @* T8 L7 v
  763. CMP #100" n; Y- N/ A- G2 [5 T' E
  764. BCC HEX_10
    : e' v. K# I/ @) p
  765. SEC
    # ?" h3 M7 B( U3 P) c* U  R1 P
  766. SBC #100& R  d# D* N& L% Y1 Q3 ~
  767. INC DEC_H
    - o9 f: n5 l; e4 v/ @/ n8 P
  768. BNE HEX_100
      `$ [# y) i" r* I
  769. ;------------------------------: Q# L+ B2 j2 L: d* c
  770. HEX_101 F$ N  Y% t' n2 p" K1 V3 t
  771. CMP #10
    % o  f! @" w; h4 W. |9 a  g
  772. BCC HEX_11 p, B4 N: W+ G% O
  773. SEC
    % m" J3 ^- L$ a5 K- E$ m
  774. SBC #10
    % M% d8 f2 T+ N0 v
  775. INC DEC_T1 ^$ ?1 V  _- b% z; L, M% p
  776. BNE HEX_10
    6 z8 W! u$ f# l/ D
  777. ;------------------------------9 R8 B: y# s- p8 C$ `! }3 w# e* d
  778. HEX_1' d* A/ l3 E% u. z/ V
  779. STA DEC_L
    , @1 U0 Z# p# D# n# ]5 F
  780. PLA; F) Q8 v/ s/ w9 a% D: {
  781. TAX2 o: D* `; P/ W( S# Z
  782. PLA" n* @% ^" M9 _5 T9 ]; y7 W
  783. RTS
    % R  V* T" W) Y/ L
  784. 5 s4 C6 Y! f% T7 J. I5 T: P7 ~) v+ s
  785. ;==============================1 f4 K3 ]8 o$ ?! C- e
  786. ;音乐曲目显示
    6 e  L- q( @% S# N
  787. Music_Show
    9 n7 R' O$ e: F$ o
  788. LDA Music_Cur% S% }$ O) t. d, p3 W8 {
  789. CLC, v. T1 O* H$ e6 m) N( M0 Q
  790. ADC #$01
    % \5 X  u% `% n' J0 J/ p- R
  791. JSR HEX_To_Dec! h! p4 R$ A* U- O3 n4 R6 W$ a
  792. LDX PPU_Cur3 G4 O/ v. W: l8 B* F
  793. LDA #$FD
    ! x  c9 ^# V- M6 U+ k
  794. STA PPU_Addr,X
    # P+ y0 T# Q' Q. r
  795. INX
    ! H* V$ U7 D; a4 A0 O
  796. LDA #HIGH(Play_Index_Pos)
    & b6 P# m7 t/ d  X
  797. STA PPU_Addr,X5 V1 s* p, x0 z3 l7 {: n0 T7 z+ F
  798. INX
    " W% p, m; q- S8 s6 b/ Y/ z9 P
  799. LDA #LOW(Play_Index_Pos)
    8 S* F5 e, h0 ^7 n4 W
  800. STA PPU_Addr,X
    * S/ Y( w+ d1 e* g3 [9 P; V
  801. INX; b! m& p3 M4 R; t8 `6 ?
  802. - v( ^% \. n- h% k1 w4 Z, q7 I  H
  803. .IF Music_Song_Total > 99" Z6 {5 P5 H# [; W
  804. LDA DEC_H( @" U1 u; H+ K" Z: T5 c0 b
  805. ORA #$308 I9 ?" Y7 L$ I+ d+ w& E
  806. STA PPU_Addr,X* N# C6 Y/ W6 R7 J
  807. INX
    2 t9 Z  y6 X$ k4 a
  808. .ENDIF
    " |# I! x: U' z, z3 ?

  809. % e: B, z6 d) S/ C7 T
  810. .IF Music_Song_Total > 90 p6 n5 j8 g6 Q
  811. LDA DEC_T
    1 o' D! D" \7 o4 g4 ~
  812. ORA #$30
    " x5 e- _0 r1 X. a& G7 m1 d. j
  813. STA PPU_Addr,X! D+ `+ g) i( }; W  j6 w: U
  814. INX( z9 s- U' _. U
  815. .ENDIF
      L6 C  g9 j+ f3 L; V. [  ^

  816. & V' r- J  J/ x! l
  817. LDA DEC_L$ w5 W0 v; W! O2 t1 J
  818. ORA #$30
    5 h, [- R. M8 l+ t" Z' F9 t
  819. STA PPU_Addr,X# ?; T: y( r# X5 i( y
  820. INX
    . y1 K. _5 w- F$ P- V4 M  L
  821. $ k. ?  K/ Q. c
  822. LDA #'/'" h8 r  G$ [# w
  823. STA PPU_Addr,X* T; C" Q9 ~, u
  824. INX  e3 p% ~0 j5 }, g
  825. Music_Show_Total
    - G$ |2 Y6 Z  O/ M0 \  q8 v) y, t1 H
  826. LDA #Music_Song_Total6 |  w2 ]( ^6 P2 k
  827. JSR HEX_To_Dec2 k% ]( F- d' Z; H+ M) R

  828. / k7 L$ w+ L) R
  829. .IF Music_Song_Total > 99
    . C3 L2 `4 X9 _) Z4 g
  830. LDA DEC_H
    1 x/ A% v4 l3 {
  831. ORA #$30
    # }5 ~9 T5 B7 o) g' I, F; s& B
  832. STA PPU_Addr,X
    % j! y; O+ [2 h& A; ^' U
  833. INX' @: |! A- M# `# E; M; |& s
  834. .ENDIF
    " s. a, ?, Y* f6 Y1 f  ^8 J
  835. 1 V# E' @6 L7 Z( o2 L5 P) S& j( w
  836. .IF Music_Song_Total > 9  }/ z5 K0 S, m
  837. LDA DEC_T% t, S$ M1 d2 y+ t1 m
  838. ORA #$30
    . X: q, V. Z; t8 F4 V1 P6 d
  839. STA PPU_Addr,X
    5 p' E! x% n9 s  x& N0 t! m
  840. INX! Z4 ^) A" j5 U" K' x1 M8 X
  841. .ENDIF  K1 u( f3 S5 c5 x5 p
  842.   J" f2 F( r9 Q% r: |! [; f
  843. LDA DEC_L( q3 q) Q5 k* ]! ]# q
  844. ORA #$30
    ) ^" ?4 `, y/ W4 Y$ ]! m
  845. STA PPU_Addr,X; `; v) ^9 [7 B7 A* D  Z
  846. INX4 _  l2 k  V8 N- \& I" c+ h0 @1 W! q
  847. " _1 Q! M" _, j0 a8 \4 t9 j3 j& g
  848. JSR PPU_End! S9 u/ i9 L4 R  g
  849. Music_Show_End
    0 h9 B; d( ^, i
  850. RTS
    7 O8 o( B! v/ M- o# z) A
  851. / r; n* F) Q/ V+ e0 I" `* d+ }
  852. ;==============================& E- Q" `1 t( _4 [" W0 e1 c
  853. Time_Show;播放时间显示
    ! q* e/ v, G* E# o  A1 w
  854. JSR PPU_Addr_Set
      D4 P) w+ l) ~# m& G2 q6 q
  855. LDA #HIGH(Play_Time_Pos)
    . A% \- y8 b& }
  856. STA PPU_Addr,X; I$ t1 {$ y4 X) ~
  857. INX
    & d5 T6 M& B- ?& C& Z/ J" h
  858. LDA #LOW(Play_Time_Pos)
    # _0 [% r+ x# m; r
  859. STA PPU_Addr,X
    4 X8 q( }& t  R: D
  860. INX
    9 t1 f  I! g4 s$ s- _
  861. Time_Show_H8 n- k6 C1 K: V0 c6 N  N/ w: n
  862. LDA Time_H; ^, {* c& l& y, ?3 o3 z
  863. JSR HEX_To_Dec. B7 U* ?  v6 V2 P% m$ g3 P
  864. JSR Time_Digit- G" G1 \) d: L% X% O7 Z1 \3 k
  865. LDA #':'( ~7 j" b+ \6 u
  866. STA PPU_Addr,X9 v/ ?! {4 d8 p' x  ^4 o- J4 P
  867. INX
    $ G8 r" Z( Q# C! W
  868. Time_Show_M
    0 P9 g/ u# V2 |( I% F$ Z9 D2 {( a
  869. LDA Time_M% L7 o( v# P, i& u" T, c% t8 W
  870. JSR HEX_To_Dec
    % \0 h1 y% {# Q4 X% x$ g% s
  871. JSR Time_Digit
    . g, G# g) S; {  J3 }  V  f
  872. LDA #':'
    / b1 P" k2 S" D! I7 q2 D
  873. STA PPU_Addr,X6 B; `9 r+ ^7 R' x- d+ g
  874. INX& e- w4 M3 j  y4 `# i" c3 _- k3 [
  875. Time_Show_S
    4 d2 G$ h* Q& p9 L8 R  q
  876. LDA Time_S
    ) z- V0 R) h6 L: q4 h
  877. JSR HEX_To_Dec
    / l1 F/ D3 F3 o/ c( W
  878. JSR Time_Digit
    1 l9 y9 _+ a) }1 U" N" |, ]& {
  879. JSR PPU_End7 M3 B& Y; P" r9 I" h, F6 A# a
  880. Time_Show_End9 a' X, O0 V7 G3 p9 Y1 i6 i8 \" w
  881. RTS
    6 g( K. K: I/ _% {; B

  882.   [! @! t' D$ z/ s
  883. Time_Digit
      s3 K) J, {# H) }/ A. t
  884. LDA DEC_T
    8 r! L/ o& X( ?. B% O0 G! ~
  885. ORA #$30
    6 u5 R! @4 t9 H5 n' B3 Y" I& X
  886. STA PPU_Addr,X
    ( V+ {. i$ q3 }6 G) F8 h6 X/ r( T
  887. INX
      f  F9 g  Q9 [# |$ _
  888. LDA DEC_L
    * O3 p0 {3 \9 Y0 P1 ?' r& U
  889. ORA #$303 V5 t& d5 P( q. n* o
  890. STA PPU_Addr,X
    , N) t9 n' c$ J& \2 d- i
  891. INX
    - ~% M; f1 B5 I7 C0 ~9 D
  892. RTS% A. f* {$ Q* \! s+ G

  893. 1 J" p$ c1 A. {: n
  894. ;==============================
    ) f% J0 t/ P- k1 _7 Y: V( s
  895. Time_Count;计时
    . G& U0 B: {. M+ l
  896. LDA Music_State5 V1 S5 h. L7 |7 H7 u
  897. ORA Time_Wait_Cnt
    - H; W! X! k/ q. \, y7 }
  898. BNE Time_Count_End% h7 r8 ?2 ~8 L; `/ Z* R& @
  899. INC Time_Cnt+ V3 f/ S/ G6 O" X/ d' n1 [
  900. LDA Time_Cnt* A# I# j+ c0 f3 L2 V
  901. CMP #600 ~! b6 ]0 H8 P# g+ }  n& j
  902. BCC Time_Count_End
    , A2 D5 t  z- Q8 C; i% |: x0 \
  903. LDA #00
    8 q; V1 M  @, ?2 z& Q3 @
  904. STA Time_Cnt  c1 i& i  u/ E7 r, f
  905. INC Time_S
    2 ]1 Z  a7 A. ]( P1 ^) `/ P
  906. * x0 H' i1 |8 V$ v5 q
  907. Time_S_Cnt7 l$ E# s. @' H# Z% t/ D' J% L2 C. F
  908. LDA Time_S
    9 I$ W+ w% q) m$ G; ~* p- Z
  909. CMP #60
    3 ~% U" y1 ~. Y* X- F3 C: y
  910. BCC Time_Count_End$ Z$ C. {% Y& _! y# r
  911. LDA #00
    # F7 Y6 R+ N- R+ c4 l
  912. STA Time_S
    % F" y) y  I9 t+ B
  913. INC Time_M8 Z( m1 z5 r! K! H* _$ E

  914. / o% y% d" K8 f( X0 b
  915. Time_M_Cnt2 C1 c1 {: z! n" Y
  916. LDA Time_M' q7 J0 J  V+ O- D4 r! v
  917. CMP #601 c+ p! f7 L- ]8 t1 v2 \
  918. BCC Time_Count_End3 i3 L" \5 }# g4 H" F: J
  919. LDA #00
      G$ W8 o) \/ e; K
  920. STA Time_M
    ; l5 R; M3 N4 L2 R( q# T7 R
  921. INC Time_H1 k3 c* v1 S" b+ R# {

  922. 7 k2 ^3 P$ n$ [) _" T3 W3 i% g
  923. Time_H_Cnt3 \0 q! \6 Z' k' W
  924. LDA Time_H2 T: W- K- l& \1 B! M
  925. CMP #246 e2 f7 q, Q! h" a; z  `
  926. BCC Time_Count_End
    3 F5 q- S! y7 |1 ~
  927. LDA #00( i8 S' K  f  A+ w: n
  928. STA Time_H
    $ L. `' p1 S) h; `) [8 {% q

  929. # T- v6 @# T1 N
  930. Time_Count_End/ y# q2 c/ d( K5 t/ e
  931. RTS
    + D$ ]# E5 Z+ s+ ~* _& Z

  932. 4 \2 c4 r) p! g, Z: D7 t
  933. ;==============================
    4 y( ]. n+ I' c" `
  934. Time_ReSet;播放时间重置/ D  A7 |3 @$ G3 Y+ C
  935. LDA #$00' S$ B" y% w& q
  936. STA Time_S& Z0 v4 }8 ~( k- n! P
  937. STA Time_M % b" j$ G  e4 K- K0 d3 o
  938. STA Time_H& M, p% S* \! x6 M/ Y  T  o3 l% U
  939. STA Time_Cnt
    3 s5 S3 K7 U: F& a0 Y
  940. RTS# D$ R3 `3 w# E5 a

  941. & Q; C* b: @- j2 x8 V
  942. ;==============================5 C+ v- i+ L! [& K. {5 a: S' C
  943. Music_Bar_ReSet;音乐条重置
    8 E# k# D) [$ R
  944. LDA #$00/ {' k& [, y/ F( m: V
  945. LDX #$00+ t4 P. r3 o' U) d$ A
  946. Music_Bar_ReSet_Set
    0 w- P/ G0 N% ]/ r
  947. STA Sound_Bar,X
    * @5 _1 V3 R4 s( L! L
  948. INX
    # ]9 y; T9 y3 s
  949. CPX #$10$ C6 F$ d  f! A1 I3 i
  950. BCC Music_Bar_ReSet_Set& V! |  m! g# e) b( V# o
  951. RTS
    6 |0 ?, B+ L3 s

  952. / }1 m  A, S- N: p) I% Y& C
  953. ;==============================& H* G3 M" \( m, d& r
  954. PPU_Data;PPU数据写入  m( z$ ?2 s- C3 l# _
  955. STY Data_L7 T. g7 l  I# b
  956. STX Data_H
    + {5 r6 G: W3 v" Z/ L, m
  957. LDY #$FF' S7 O2 |; A% f( Z  `5 t. n) W5 F& F
  958. LDX PPU_Cur# g& f( ~* f4 |
  959. DEX, T1 ^4 |4 W, c: x& v8 l. L5 G
  960. PPU_Data_Beg7 o9 j3 G/ a2 i/ ?  q, b! j
  961. INX- e* T% c: W/ L9 z. X6 T9 I' U' V
  962. INY0 ]  a" F* N6 \1 x3 J
  963. LDA [Data_L],Y6 g# P2 ^# u/ l; ]8 U9 |- S7 n
  964. STA PPU_Addr,X
    1 \4 b( r7 w' y4 c9 J' `6 u( I+ _
  965. BNE PPU_Data_Beg
    + W: v) o* o7 }, h) F
  966. STX PPU_Cur
    % z5 F4 k9 B* G* E+ {$ R$ D* y
  967. PPU_Data_End1 X1 j# k$ g; {9 s
  968. RTS
    3 w* l8 [& d. y/ |

  969. 3 `! v) w8 S. C, I3 a( U
  970. ;==============================
    5 d% c7 l0 U- ?% ]3 E
  971. Music_Stata_Show;播放状态显示
    + p6 f/ y, b% m$ N
  972. LDA Music_State3 Y# k0 l, J, V
  973. BEQ Music_Stata_Show_Play4 o( C6 D0 ~: Y$ l% v2 c
  974. Music_Stata_Show_Stop& a7 A8 l% U7 }" f, y
  975. LDY #LOW(Music_State_Stop)3 s1 y( Y4 [' B8 [* \
  976. LDX #HIGH(Music_State_Stop)- I. [; A, E% a6 M
  977. JSR PPU_Data! g! f* O4 a9 Q# {
  978. RTS' J7 H% f" w  g/ ^3 m/ U
  979. Music_Stata_Show_Play
    3 N8 T6 z; ^* e" b  }+ O1 T! W3 R
  980. LDY #LOW(Music_State_Play)
    8 L6 t. D5 [) b9 E
  981. LDX #HIGH(Music_State_Play)
    / m# C6 r" ], [
  982. JSR PPU_Data
    ! N, t3 g# P' B7 k
  983. RTS1 i7 j. L* u2 B) ?2 f4 P7 f$ ]

  984. # k( I2 `9 s* X- h6 Y3 E( E
  985. .IF SOUND_BAR_SHOW_ENABLE7 R' N8 V$ D" _9 b% W- W
  986. ;==============================; M- G# q1 I) E/ W3 @  h
  987. Sound_Bar_Text_Set;标题与音乐条初始化* `: k+ Z3 U& W% N7 J/ O
  988. LDY #LOW(Sound_Bar_Text_Data)- {9 W0 d1 B, H: k9 H6 j/ X; a9 p( R
  989. LDX #HIGH(Sound_Bar_Text_Data)
      [- {# F8 q; T, b) U7 L
  990. JSR PPU_Data
    + L9 v9 R9 q3 }7 a
  991. RTS
    ) l1 i1 @( \: H

  992. $ E# ~# [6 y# M  }" N" @- C
  993. .ENDIF
    1 i* ~9 ~6 {! Z/ V$ ?$ J

  994. % p. Z. J+ q3 I+ O
  995. ;==============================
    ) m& R* p/ V) T2 d  K+ K9 l
  996. Set_NameTable_Attributes;设置命名表属性7 a" V1 m4 q! h0 A
  997. LDA PPU_STATUS
    6 h' B: [* ^' E9 `* C/ B' O# Y
  998. LDA #$235 t9 `1 `4 B& r4 w$ g; d# n, [
  999. STA PPU_ADDRESS4 d4 n5 u) i; U# N$ R* K5 a+ g
  1000. LDA #$C0
    ) ]  m8 F1 t" h4 R: R% r: w; M2 g
  1001. STA PPU_ADDRESS, L3 x- W/ u# U( H; Z5 a
  1002. LDX #$00
    0 G) L, V" g/ Y. O
  1003. Set_NameTable_Attributes_Write. F8 b$ H4 d  \* N" U
  1004. LDA Palette_Attributes,X5 y& A+ F, ]) p* y; Z, U
  1005. STA PPU_DATA0 K+ r& o  o0 @- y. w2 _
  1006. INX
    - ?+ L+ N3 c7 f& O& _: G) O5 K
  1007. CPX #$400 M+ Y: x/ u$ |) e- i5 N2 ~9 _  \
  1008. BCC Set_NameTable_Attributes_Write
    / f( ?; }2 s1 i: `: y4 @: `
  1009. RTS7 q' B/ d  H. {4 x7 N
  1010. ; a7 U' T+ L" ?
  1011. ;==============================
      {5 [1 L0 Q7 U, ~2 ]% \7 r
  1012. Set_Palette_Color;设置调色板数据
    ( l. u. O7 J' O7 G# B! N3 |
  1013. LDA PPU_STATUS
    ! D. ]# _1 A/ h6 Y9 x; L2 \
  1014. LDA #$3F; {3 c0 E0 k8 N& _& U9 O4 B
  1015. STA PPU_ADDRESS) W  S( r& u9 w# u& `5 |
  1016. LDA #$00
    . f. `: ]1 [1 Q) F- d4 h. \
  1017. STA PPU_ADDRESS. R" s4 j0 f( g/ U
  1018. LDX #$002 ~! S& T4 ~/ b
  1019. Set_Palette_Color_Write8 K% ]) p3 Y2 Y
  1020. LDA Palette_Data,X
    8 K- t4 l! }5 f
  1021. STA PPU_DATA
    + |/ o3 `" e' Z* J6 K
  1022. INX
    7 g' w! ?* g. f: h: E$ O
  1023. CPX #$20
    - a# u  ~5 C3 k  k& X
  1024. BCC Set_Palette_Color_Write" b; t9 J, @- }  x/ [0 b
  1025. RTS5 L# x6 Z0 K- I5 [- T

  1026. ; y1 m: D* M9 ~9 L) p
  1027. ;==============================- Z9 _. M' S; o. ~% |  q, W
  1028. Init_Palette_Addr;初始化调色板数据
    # l0 y' {0 J3 k# H4 M) C
  1029. LDX #$00( Z" W7 q  F' A! D
  1030. Init_Palette_Addr_Write/ Q6 w' w& v8 \  E: P
  1031. LDA Palette_Data,X9 U- A3 `" i7 J: Z; M2 d
  1032. STA Palette_Addr,X$ n  X& w* b1 F+ d
  1033. INX8 u: O  {1 v+ S4 Y
  1034. CPX #$20
    4 d$ d, M0 W* d8 n5 K; n
  1035. BCC Init_Palette_Addr_Write
    . @" r+ k) J% v& F7 o, ~7 R! W5 e4 q+ `
  1036. RTS' J, u* C. D4 \0 H7 g
  1037. 4 v1 [+ Q5 u, r* o% c4 T; O( T
  1038. ;==============================
    + X5 y2 S8 L. z& Y- ^. E7 r
  1039. Update_Palette_Color;更新调色板颜色
    3 x+ U* o8 Z' B
  1040. LDA Show_Track_Name
    * p, |$ O0 S5 `, J+ R$ O3 v
  1041. BNE Update_Palette_Color_End: M4 ~$ X0 {3 y5 O% Y+ u
  1042. LDA Palette_Update_Flag
    : r( t  E3 n; h! @0 I1 Q
  1043. BEQ Update_Palette_Color_End. l, T. n5 k' z% d$ ]
  1044. LDA #$3F, M5 u' @0 i. Y* @% k; L
  1045. STA PPU_ADDRESS
    " Y  R7 u1 g2 _4 g; e0 j6 |
  1046. LDA #$00# `1 c; e. E7 ^9 K  O" i
  1047. STA PPU_ADDRESS
    3 X7 r2 x2 t3 M/ h5 b
  1048. LDX #$00
    : Q9 V, o2 E1 r4 A" G
  1049. Update_Palette_Color_Write
    5 n. K/ ~1 W! I# \0 W
  1050. LDA Palette_Addr,X
    ! @, i  t! z9 c3 k) d! W
  1051. STA PPU_DATA
    2 {: s( P$ V& k! C; v1 E6 V5 d8 R
  1052. INX
    7 r. e. Y/ y: C7 b/ \
  1053. CPX #$20/ g0 m* o- E) _& q' V- l
  1054. BCC Update_Palette_Color_Write
    / k$ z$ s4 h3 w) S
  1055. LDA #$00, D; }: L& P/ P6 ]
  1056. STA Palette_Update_Flag
    " E/ T2 k3 f( ^. o- B1 R4 ?
  1057. Update_Palette_Color_End
    - k3 s' s* v! t7 M% p% O
  1058. RTS/ P; D/ G! P% G$ i$ ]4 [2 S) x# f+ X7 ~
  1059. 7 H2 j# B* L. E6 Z4 q5 S# M% v
  1060. ;==============================
    2 e1 ~$ d. Z+ z2 ]8 [
  1061. Update_Palette_Data;更新调色板数据
      Y( s+ d9 ~+ e: t1 e6 @! L
  1062. LDA Show_Track_Name
    . ^& j) @9 C' ?' r
  1063. BNE Update_Palette_Data_End2 F# @$ A" i8 h
  1064. LDA Music_State$ z( t* j# B8 E* {2 w8 e( n
  1065. BNE Update_Palette_Data_End
    5 A' X/ L( z/ ~  I; D6 d) \9 g
  1066. Update_Palette_Data_Check
    ; L/ A9 [' D8 X0 `3 |* S- H
  1067. LDA Palette_Wait_Cnt
    * o0 o% o& q$ B. z
  1068. BPL Update_Palette_Data_Check_Over% y: T9 B: v$ w1 q& U3 i4 n) C5 z
  1069. LDA #Palette_Update_Interval
    9 Q: \0 O5 V% ?' C. g$ X. }& T
  1070. STA Palette_Wait_Cnt9 d  c# C6 _; S$ f1 ^) h+ x
  1071. Update_Palette_Data_Check_Over
    9 o. d  Y9 ]. ~/ r* X3 i- G
  1072. DEC Palette_Wait_Cnt
    + l( a# U9 E4 y$ `
  1073. BNE Update_Palette_Data_End+ Z. u( l& M$ m% I0 V6 j
  1074. INC Palette_Update_Flag
    6 j) q! T6 Y* L" n/ e4 A
  1075. LDA #Palette_Update_Interval; @" K" r8 |! c
  1076. STA Palette_Wait_Cnt
    7 e) @5 N' H4 j  l2 u
  1077. LDA Palette_Update_Addr
    2 \) I2 r+ [  J% Q
  1078. CMP #Palette_Update_Max
    9 Q$ m+ v1 v! Q: w2 V
  1079. BNE Update_Palette_Data_Set
    , }' |# }! k. G7 D' }  {) P0 H
  1080. LDA #Palette_Update_Min - 1! V; e+ [3 g8 R# u6 X0 a
  1081. STA Palette_Update_Addr
    ' m; ~0 l2 t* O4 V' o9 A5 i2 e" C. a- ~
  1082. Update_Palette_Data_Set
    " o2 E% R) X% A1 D
  1083. INC Palette_Update_Addr
    + V! f! t4 H& W4 k! U& ]( b
  1084. Update_Palette_Data_End
    / X4 V. U- `+ |) j% f2 M3 e( A
  1085. RTS
    - ]+ p3 I, a- O

  1086. 7 X$ l: E. m9 _
  1087. ;==============================! w' Z/ l+ X% h0 K: J9 V# H. C4 c
  1088. Show_Music_Text;显示静态文本
    + ]: z9 T  h2 y5 g4 q
  1089. LDX #$002 `9 u' L9 E8 L  V8 h& ?
  1090. Show_Music_Text_Set
    2 }6 M1 R( r( M# T
  1091. LDA Static_Text_Data,X/ C. r) B; ?( |+ M) o$ y6 p
  1092. STA Data_L
    , _/ L' g4 A" v/ l2 o" \7 b
  1093. INX# ]! [3 J/ j7 G) d
  1094. LDA Static_Text_Data,X
    7 W+ K" ~' u) V" x2 J( F9 L4 [7 v' k" H
  1095. STA Data_H
    5 O4 E0 n3 \/ v" s8 K7 ?& h
  1096. INX0 D5 ?  F2 J3 {. T1 a$ y) k
  1097. LDY #$00
    6 u: R% L: A3 E1 I8 V' H
  1098. LDA [Data_L],Y
    # p# b/ }/ s+ W; i
  1099. STA Data_Cnt
    9 d) |8 f) k8 R# y4 Q# M
  1100. DEX" p% }2 B5 T$ Y# C+ G5 z
  1101. DEX
    ; o. [8 K5 U; @4 n  W. D
  1102. LDA Static_Text_Pos,X( O$ E' ?0 p! w6 u* S1 n& m0 q
  1103. STA PPU_ADDRESS* x6 D1 _) L( K
  1104. INX: S2 L  L0 V0 C5 n
  1105. LDA #$206 [, p7 P) }6 j: J+ s: P
  1106. SEC" \+ U2 p9 M3 ~. o, Y, N- j' [
  1107. SBC Data_Cnt4 g, ~  I1 X3 ]3 L
  1108. LSR A: [4 S8 C1 x" u/ n$ v2 [
  1109. STA Data_Buf9 c- y# |0 w( H1 h5 }+ ?& \
  1110. LDA Static_Text_Pos,X1 ]4 P8 O8 ?0 }7 \$ h$ F4 c
  1111. AND #$E0: t: k3 [8 c- T& B" B; J
  1112. CLC( S  e0 w' T7 H. B
  1113. ADC Data_Buf
    : y! J! |: D$ {' W
  1114. STA PPU_ADDRESS) F8 D; b2 J) R; n4 F2 \
  1115. INX# V- K2 l) D/ ]/ i$ t5 ?
  1116. Show_Music_Text_Set_Write
    7 W: M% w* p7 u' [0 V2 D
  1117. INY
    6 D; d# m( |; `# E# O- R$ c3 g
  1118. LDA [Data_L],Y
    0 v$ E+ U% T% t% a  G( Z: G9 U
  1119. STA PPU_DATA& [# h4 q" Y: \1 r& K
  1120. DEC Data_Cnt
    $ r: a) g$ ^3 Q
  1121. BNE Show_Music_Text_Set_Write- r* M6 {" y+ Z9 x5 d
  1122. CPX #Static_Text_Pos_End - Static_Text_Pos! W  v  [$ f" j' j  @% s
  1123. BCC Show_Music_Text_Set
    4 T% H  w2 C" ]+ }4 Z: [
  1124. RTS
    2 s2 V7 K6 J: C; @

  1125. , k6 R& n) d+ @+ v. x- x' q
  1126. ;==============================
    " {- s' _7 s, J2 \( e
  1127. .IF Track_Name_Pos;显示曲目信息
    6 `  h3 z" n  t  k6 h
  1128. Show_Track_Info
    / O# c; k) c% H3 b' O
  1129. INC Show_Track_Name
    ! ?. H/ k* r) i: l
  1130. Show_Track_Info_Clear: B# A: v1 }5 T. b" U" u* M: }7 N
  1131. LDX PPU_Cur( ^( u+ N# S1 d
  1132. LDA #Mode_Clear/ O; H" D% t7 n/ v( k$ i5 \8 U1 u
  1133. STA PPU_Addr,X
    ; |, s* {7 {4 ~$ S4 M( j4 P
  1134. INX
    $ l/ ]! ^+ ~4 r& Z; v

  1135. / G$ g  }) b2 `; h
  1136. LDA Music_Last) a; s- f. j2 ~! X( v  N, J
  1137. JSR Show_Get_Track_Name_Center_Pos( l* N5 \! s4 a- x4 L- x
  1138. Show_Track_Info_Write_Cur
    ' ]* u0 J; t& h9 e1 p
  1139. LDA #Mode_CntLine
    5 ~; J% j' t2 F8 w) A( L
  1140. STA PPU_Addr,X
    * _5 R: M+ z$ i' V$ M  D
  1141. INX
    7 [' _8 a/ E! f  @9 l

  1142. / U- [! W) z3 w5 v/ A; q6 \7 E
  1143. LDA Music_Cur
    ; d3 K5 x1 N. z6 }. ~$ n: _+ X  P
  1144. JSR Show_Get_Track_Name_Center_Pos3 ~1 U# A7 v7 n0 A

  1145. % B0 j! n! `/ b- U4 x* P7 F- I
  1146. Show_Track_Info_Write_Cur_Data
    0 f5 F* y$ i7 u) r
  1147. INY1 m( J7 A! W) a1 }0 J1 S
  1148. LDA [Data_L],Y; `+ [) _& ~- o4 m
  1149. STA PPU_Addr,X
    & ]2 c. C, [. m5 g6 D* B2 N# I! b
  1150. INX8 `4 e' j( ]; y
  1151. DEC Data_Cnt
    4 M$ E3 u! L/ _+ z! t- L
  1152. BNE Show_Track_Info_Write_Cur_Data
    / `$ d* W/ F' C7 P  m
  1153. Show_Track_Info_End2 F' T0 p: ^6 ^) W
  1154. STX PPU_Cur
    + }* O# V7 ?0 o2 A  w
  1155. RTS
    $ H0 t! T- W; E5 }- l

  1156. 0 ^9 [) j  K. l6 w$ J% N& `
  1157. ;==============================% r; {+ b0 |6 w& w% g
  1158. Show_Get_Track_Name_Center_Pos;获取中间位置
    $ Z2 ?8 W: c& P+ y; t; ?/ G. O5 Z
  1159. ASL A
    & g. U' S4 X0 z* l
  1160. TAY
    3 e6 d: ^& F! }9 ?  V8 I3 ]4 I7 |/ S* a5 j
  1161. LDA Track_Name_Addr,Y; |& E: c  _8 z2 k
  1162. STA Data_L3 G$ }! e" N  V
  1163. INY
    8 u, D: w. n* p) W
  1164. LDA Track_Name_Addr,Y& g* R9 [0 V+ X) P. @
  1165. STA Data_H( @* u4 x; N& r6 O
  1166. LDY #$00
    1 ?: M# o% U# ^/ o$ F& z: h
  1167. LDA [Data_L],Y4 C+ U' e4 l/ s- I/ d
  1168. STA Data_Cnt: h% I0 [% h" I" M6 y; W
  1169. LDA #$20! r/ m' L5 I& J% R; g" s1 f$ o6 u( \
  1170. SEC: C1 O3 Y  S$ \! @9 W' J
  1171. SBC Data_Cnt
    ; ]: p$ m/ U# t, M/ R* n
  1172. LSR A
    8 S5 z) m1 X1 D" t
  1173. STA Data_Buf# w- n' W3 Y+ n+ O$ u
  1174. LDA #HIGH(Track_Name_Pos)
    ! v1 b; a, s: E; l9 H. z6 f
  1175. STA PPU_Addr,X2 L) L. j" Y# L1 W. U
  1176. INX
    ! B. l! ?* j/ P4 e
  1177. LDA #LOW(Track_Name_Pos)8 Z* {  a+ {8 |5 W  d# S. Q
  1178. AND #$E02 A, _3 O. ?7 ?8 E
  1179. CLC
    ( h* G& Y7 `0 I$ w$ M& m9 J$ V% E
  1180. ADC Data_Buf; B) t5 Y. H5 Y: C  I
  1181. STA PPU_Addr,X
    : u. j( C+ u  o1 b1 X  r
  1182. INX2 B* `: e  m& G4 S, ~/ L2 t
  1183. LDA Data_Cnt
    ' T3 @3 G8 m7 k
  1184. STA PPU_Addr,X' n/ \1 m! {2 t3 [4 Q8 J0 W: _
  1185. INX  f' w& Y4 c' p% g$ z0 \3 l
  1186. Show_Get_Pos_Center_End
    & S/ N: M% \2 F/ o& F& K. m
  1187. RTS
    5 r" H- W4 S  E/ V1 j( m9 R
  1188. .ENDIF
    0 ?% O# e/ ~1 ]+ j
  1189. # Y# ^! N) I2 g! c
  1190. ;------------------------------2 W+ P8 q' X3 Y# N, K. f
  1191. ;命名表数据
    7 V/ W; U7 x& X: a( s/ J
  1192. Palette_Attributes
    & S. u  X- |, z5 w" B7 W
  1193. .IF SOUND_BAR_SHOW_ENABLE
    & Y5 F. @" k% o! h' U8 [8 e
  1194. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00: W. C) h/ n. B
  1195. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$BB,$AA,$AA,$AA
    ' L: H1 Q0 E5 S5 [4 U$ M
  1196. .DB $0F,$0F,$0F,$0F,$0B,$0A,$0A,$0A,$55,$55,$55,$55,$55,$55,$55,$553 S0 {) b- ^" v, K1 i" Z
  1197. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55/ R  p9 i$ T! L5 Q: ]! J
  1198. .ELSE" p7 ~, W& i; l6 C$ K3 N
  1199. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
    7 j$ v$ X0 E- c5 Z
  1200. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
    ! j5 {7 j( c( _  X5 h
  1201. .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$55,$55,$55,$55,$55,$55,$55,$55( G! i9 P! c- H9 V5 }3 H% }
  1202. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$558 F- N; Z( l; ]& D- t, |; @! F0 w0 h
  1203. .ENDIF
    & ^# f; g' d# f: D! N- g

  1204. : d, Y$ C  j9 F# T! Q6 J5 L
  1205. ;------------------------------
    8 x& i- d6 q' T: n  t& e
  1206. ;调色板数据
    3 s( @/ C' q7 V6 U+ P/ l  S
  1207. Palette_Data
    ; f8 Z( o3 |6 F6 @0 a3 v% l
  1208. .DB $0F,$27,$20,$0F,$0F,$24,$20,$0F,$0F,$21,$20,$0F,$0F,$25,$20,$0F
    . x' a" v9 N, K' i& A4 H0 e6 r+ r
  1209. .DB $0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F
      }! @8 [+ b& a3 \8 j% k

  1210. * K2 b: u5 h& j( J
  1211. ;------------------------------  w6 M: v" `# d2 V$ c6 V
  1212. Static_Text_Data: y: ~: e/ u4 y% I
  1213. .WORD Static_Text_Title_Data
    5 \5 r& V4 S/ K4 H5 h# D" I
  1214. .WORD Static_Text_Author_Data
    1 E( j: M6 H4 L' w1 X, a
  1215. .WORD Static_Text_Date_Data* x9 E. d& I# u9 ^! w5 c
  1216. Static_Text_Data_End0 @6 n( O- m) g! @/ z9 B: a4 l
  1217. + c. }, Z4 {9 L. ^
  1218. ;------------------------------# W9 K* x- k( P( b4 P) K
  1219. Static_Text_Pos
    8 _1 z/ j. c% T" q8 ~1 s
  1220. .DB HIGH(Title_Text_Pos),LOW(Title_Text_Pos)  [6 v  J% l) U- ?7 Q  w1 o
  1221. .DB HIGH(Author_Info_Pos),LOW(Author_Info_Pos)9 P: j& {' c. i7 K! H
  1222. .DB HIGH(Date_Info_Pos),LOW(Date_Info_Pos)( N7 j1 k) T  C' ?% r  c
  1223. Static_Text_Pos_End4 L1 z. E' o- P: j$ M) U$ \( I
  1224. , ?' P( l3 `4 n" V9 ?2 K
  1225. ;------------------------------
    2 K1 m* P4 m- L; q4 u0 U' P
  1226. Music_State_Stop
    ) M. T+ H1 @7 X; T
  1227. .IF SOUND_BAR_SHOW_ENABLE  r7 E0 l1 ?% I  y" v8 X. K
  1228. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"STOPED ",$FF,$00, W, Y' r# C& n' |7 x
  1229. ELSE
    - o7 F! P$ h: s3 L; P2 Z2 R0 r
  1230. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos)," STOPED",$FF,$000 [4 R, o. x2 c' E5 {8 O
  1231. .ENDIF2 v% R, b9 d( y
  1232. Music_State_Play  l/ R7 Q; s" G) V
  1233. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"PLAYING",$FF,$00
    6 G/ i7 j! t; ^6 \
  1234. 7 b/ t2 j) m( E) }
  1235. ;------------------------------% E, r- B2 r! j5 j; X7 @0 H
  1236. Sound_Bar_Text_Data;声音类型文本$ a6 a0 Y8 T  S5 a1 f
  1237. .DB $FD,HIGH(Sound_Track_Pos),LOW(Sound_Track_Pos)* ?$ e/ `5 K5 @: x+ l+ B
  1238. .DB "SQ1-",$FF- x/ Z/ U$ r7 X. ]( z
  1239. .DB $FE,"SQ2-",$FF% _; z* p% R; n
  1240. .DB $FE,"TRI-",$FF
      |$ l. E: |7 _# U1 M9 j4 a
  1241. .DB $FE,"NOI-",$FF$ _' M" I3 v7 b" h% ]
  1242. .DB $FE,"DMC-",$FF,$00
    + J3 j; o( [3 X5 N  X- M' J, b

  1243. % ~/ i+ G1 m& K% e
  1244. .IF Track_Name_Pos
    $ M* _2 t* J( U
  1245. ;------------------------------
    ) J7 l+ Q+ m5 Y* h
  1246. Track_Name_Addr;曲目名地址索引
    . c/ l8 V0 t& ^8 A" {  q
  1247. .WORD Trackr_01
    3 m  E$ s8 b. Q* X: [1 H9 |
  1248. .WORD Trackr_02
    $ Y1 T! E( U5 E+ `9 L
  1249. .WORD Trackr_038 p1 n7 E- w3 W0 C/ z) y7 G7 A6 F
  1250. .WORD Trackr_04
    $ L* c/ T! r! I  Y* l2 E1 z  t$ H
  1251. .WORD Trackr_05
    8 N3 h; R5 X4 r4 Y' t
  1252. .WORD Trackr_067 x) h/ Q9 u6 J
  1253. .WORD Trackr_07
    - J) g, h; ~: o, A: W
  1254. .WORD Trackr_08
    9 H* j# ~( ]# |' ]6 w7 M9 C
  1255. .WORD Trackr_09- w+ ~; ?" x0 p- `) M
  1256. .WORD Trackr_10
    " t% B% k' w" G' q1 H* n/ V. u
  1257. .WORD Trackr_119 K" P1 O2 m' D! t
  1258. .WORD Trackr_12
    6 u; E+ |  {/ z" D
  1259. .WORD Trackr_13. j( U' T2 Q) c, x, z+ G% j, A
  1260. .WORD Trackr_14
    / ^  ?; p+ U" g. S9 S7 Z
  1261. .WORD Trackr_15
    - y1 A; y( l8 v1 O8 B7 K
  1262. .WORD Trackr_165 N; F0 m# _4 A$ H" d; o# S
  1263. .WORD Trackr_17
    % m, h6 X6 C1 W& b, g5 O9 L
  1264. .WORD Trackr_18
    # i9 h* [) o% I& L$ |# S% G1 F3 Q
  1265. .WORD Trackr_19
    0 d$ S& J; f# a3 S% {
  1266. .WORD Trackr_200 p- \# c4 N: @. `* q/ ~# y( y
  1267. .WORD Trackr_21
    2 v4 }7 ~  g; w' j& _
  1268. .WORD Trackr_225 [- S- ]9 a  `% b9 \! x  h
  1269. .WORD Trackr_237 ?' ^6 v/ A, ^
  1270. .WORD Trackr_242 ]! l6 y% J, c% G2 o, W
  1271. .WORD Trackr_25$ u* H9 W2 I8 U4 m$ A2 |
  1272. .WORD Trackr_26+ `. W  K1 Q, {( g& K8 R
  1273. .WORD Trackr_273 w0 ~7 m, B- g7 D9 b
  1274. .WORD Trackr_28
    3 l* c: U- m" Q6 x3 o
  1275. .WORD Trackr_29
      u9 q& {; _- d; x; [
  1276. .WORD Trackr_30
    % @$ g$ l0 B8 r- j- a
  1277. .WORD Trackr_31
    . n" a4 f# f0 J( Y
  1278. .WORD Trackr_32
    + w. E, n) z7 `2 V- g, P* F" e7 T; \$ K
  1279. .WORD Trackr_33
    ) s1 p$ m/ ~+ Z, w" `1 A& V
  1280. .WORD Trackr_34$ Z( K3 m1 |# e3 c* F: n* S
  1281. .WORD Trackr_35  j$ a+ i. I4 p* Z; W) v
  1282. .WORD Trackr_36
    5 \( m  b4 |8 Q! N% N6 r2 a
  1283. .WORD Trackr_37
    7 V% S7 s  K5 C
  1284. .WORD Trackr_38
    9 Q! {8 W; K5 @7 O! ~
  1285. .WORD Trackr_39
    8 Y  \3 r( Y' B* I% B
  1286. 2 }) k! X2 |4 C! H. `4 r) o
  1287. ;------------------------------
    + Z2 B0 m7 M  p7 |  X
  1288. Trackr_Name_Data! _( O3 w; Q. S! Q
  1289. Trackr_01 .DB $05,"BGM 1"
    4 i/ |- t  Z" N; q4 [8 v+ E
  1290. Trackr_02 .DB $05,"BGM 2"
    % B; r3 z$ W( O5 h, D" y% z. y: f7 y
  1291. Trackr_03 .DB $05,"BGM 3"! A7 ]/ B4 l# g/ ]
  1292. Trackr_04 .DB $05,"BGM 4", S5 \/ J( l1 t. s; I# U7 m. r- @: e
  1293. Trackr_05 .DB $05,"BGM 5"
    9 `; r% N: I# P
  1294. Trackr_06 .DB $05,"BGM 6"
    2 \$ x4 ^+ T# \" v; W( v, _, ~; P
  1295. Trackr_07 .DB $05,"BGM 7"
    7 n/ w0 K  t7 U7 S
  1296. Trackr_08 .DB $05,"GREAT"
      e  D7 b7 V) P4 c
  1297. Trackr_09 .DB $08,"BOSS BOM"
    4 J: e( |* P" B5 m  r$ c, a5 Z
  1298. Trackr_10 .DB $08,"BOSS2BGM"# l0 ~7 K& K# b/ a, T" Y
  1299. Trackr_11 .DB $07,"P CLEAR"
    + o* J& O9 W  {, Q6 ]
  1300. Trackr_12 .DB $07,"A CLEAR"; Z% c, l9 K: Q1 H; f# `
  1301. Trackr_13 .DB $04,"OVER"0 O0 R! v& F1 M, z% t5 k
  1302. Trackr_14 .DB $06,"ENDING"
    ) B% @, ~- Q2 u: M6 m
  1303. Trackr_15 .DB $04,"SUTA"% M5 P' ^5 K! G' i- s6 a5 V  f( X
  1304. Trackr_16 .DB $07,"THUNDER"9 f6 E4 ~! L+ ]! k& Q
  1305. Trackr_17 .DB $04,"SHOT"
    ) P  @  D2 A- |- ^
  1306. Trackr_18 .DB $05,"LASER"
    . \8 V: ]! q- _4 t. L
  1307. Trackr_19 .DB $06,"SPREAD"( f; l0 ]7 y/ k: N9 V2 M
  1308. Trackr_20 .DB $04,"FIRE"* R* C" C- `+ K" m
  1309. Trackr_21 .DB $06,"B SHOT"* n! \1 c( b# V
  1310. Trackr_22 .DB $08,"T DAMEGE"
    9 V4 L7 n) q9 o/ f& r% M2 Q" ?- }
  1311. Trackr_23 .DB $07,"HARETSU"1 @1 t  |9 _/ U
  1312. Trackr_24 .DB $05,"T OUT"
    3 d1 v! s/ G9 B& o4 k
  1313. Trackr_25 .DB $05,"Z OUT"
    % W; ^- R5 g& \4 v# j
  1314. Trackr_26 .DB $05,"A OUT"
      u) n( _6 X! ^
  1315. Trackr_27 .DB $04,"ROLL"3 R3 h0 Y/ p- M3 Y. K& _6 V) d- q" F
  1316. Trackr_28 .DB $06,"APPEAR"
    0 P9 S1 V" D. E- Z$ j5 I
  1317. Trackr_29 .DB $05,"POWER"
    7 a$ [  [: B; L
  1318. Trackr_30 .DB $07,"BOKK BK"
    : c$ t; A# e: o( Q) ]
  1319. Trackr_31 .DB $08,"BAKUHA 1"/ W& [8 |$ N. X0 m6 C& s% W
  1320. Trackr_32 .DB $08,"BAKUHA 2"
    ( L3 |1 J( ^& f! `! r$ \
  1321. Trackr_33 .DB $05,"ARUKU"% Z+ W, x7 `% x
  1322. Trackr_34 .DB $06,"JIWARE"1 a3 l+ k' r' m5 b1 p& V
  1323. Trackr_35 .DB $05,"SILEN"
    & \1 U; w; w  q6 k9 L
  1324. Trackr_36 .DB $05,"P 1UP"
    & ~- _2 m7 \. y* A3 t
  1325. Trackr_37 .DB $05,"P OUT"2 c' u1 U" @1 B% p. ^. ?
  1326. Trackr_38 .DB $05,"B OUT"
    ; @. i- |1 \6 b, i8 A0 g9 i
  1327. Trackr_39 .DB $05,"PAUSE"
    + @- M! M) B- b, `

  1328. 9 p# u% S$ _2 p  w% u' S
  1329. .ENDIF
    3 v$ j. e& Y; A# P; c0 h3 W& S
  1330. & F6 n5 P6 c( v/ @$ x
  1331. ;------------------------------6 K) E3 C6 z  w: [) `$ w( V  h
  1332. Static_Text_Title_Data;静态文本数据! {2 O# O# J  y/ X5 G/ @$ ]. e
  1333. .DB 12
    9 F) Z4 O1 A7 Q4 U' Y9 t
  1334. .DB "SUPER CONTRA"
    7 H+ ]+ c3 W  _; s+ f
  1335. Static_Text_Author_Data
    - m) \! q# u2 C
  1336. .DB 23
    : h" Z* j9 m1 F* j2 B
  1337. .DB "EXTRACT BY FLAMECYCLONE"7 y3 M" ~4 W% ^5 G" K' F$ i
  1338. Static_Text_Date_Data
    9 [6 A- O/ @# E0 I6 K9 M  h
  1339. .DB 10
    3 w: J' s9 ]6 M9 Q3 Q( S# ^/ x3 D1 S
  1340. .DB "2023.07.11"3 p3 C8 d9 m1 a9 y

  1341.   D, N8 i% I- u# u4 G
  1342. .BANK RESET_BANK & BANK_DATA_MASK$ o: ]0 O5 Z- S. h9 {& n# S7 b
  1343. .ORG RESET_ADDR
    6 j+ S* m8 S. k% j4 j) ]1 }
  1344. , W$ j, \* V% I4 X0 K  z

  1345. 4 R0 W) |" M" p
  1346. ;==================================================
    8 o: b! I' a- D5 N1 ~
  1347. ;切到主程序bank
    ; O( `! L" p7 i, x
  1348. SwitchMainBank& L2 p$ U/ {( @: j9 Z' T; X: k
  1349. LDA #PROGRAM_BANK & BANK_DATA_MASK
    6 x4 O  j8 b9 X! q) T6 a8 @
  1350. JSR SwitchBank8000
    / \) P+ K- ], @
  1351. RTS$ j1 f; x6 ^& o" s
  1352. 4 V& L& r% V& P2 ?
  1353. ;==================================================
      M# b9 ~; e% u7 m: b
  1354. SwitchBank8000;切换bank到8000-9FFF
    ! m3 H# @* \2 N, P: O/ V
  1355. PHA
    7 N2 [) f( J* W; i% e. I8 c0 G7 f3 D- [
  1356. LDA #$06
    ( z, N- ^4 C( f0 C* v  @) g' X
  1357. STA MMC3_BANK_CTRL
    4 W* Q8 L$ \- s/ i
  1358. PLA
      Q  ]9 F5 N& X4 F( C* n8 M' H* L
  1359. STA MMC3_BANK_DATA
    ) F0 l/ I- [  G8 i+ o
  1360. RTS: T7 l( x6 k9 A

  1361. 0 y) N( X+ J9 Y7 a" I/ A: |
  1362. ;==================================================* J) w5 _0 i6 f. z
  1363. SwitchBankA000;切换bank到A000-BFFF
    0 f- D& {3 _$ N1 P
  1364. PHA
    4 n1 r3 h; ^: t5 R: S# l& v
  1365. LDA #$07
      ]% |8 W; m8 s3 m* Z* J
  1366. STA MMC3_BANK_CTRL
    ( A" h% Y6 J  y/ t
  1367. PLA
    : r9 o4 M. ]( y1 j1 K/ T7 q( |
  1368. STA MMC3_BANK_DATA
    8 l- V- v4 ?8 u* ^
  1369. RTS7 r9 N# U' ?0 j+ N  r- D1 b# [

  1370. 4 L& Q% z' }) j, W6 U; T* t. l; M
  1371. ;==================================================
    5 ?# Y: B6 Z7 z, O8 J
  1372. Sund_Bank_Init;音乐bamk初始化
    , |4 ]+ |3 \7 C# l  [7 L
  1373. LDA #SOUND_DATA_BANK_0 & BANK_DATA_MASK
    ; G# B7 ]' I' h7 b/ b* X: V+ h, ]
  1374. STA Music_Bank_8000
    : W2 n4 A5 A! k1 s
  1375. LDA #SOUND_DATA_BANK_1 & BANK_DATA_MASK' P& {. z! B+ A0 t) A
  1376. STA Music_Bank_A000
    0 N2 a9 E( _4 u% q
  1377. RTS, T7 p6 e* Y7 `

  1378. 3 ?* P" L# Y, `1 h! ^/ b0 c2 t# b% a
  1379. ;==================================================
    $ C3 X: P2 q9 z7 {1 t; F, Y* q% w
  1380. Sund_Bank_Set;切换音乐bank
    6 M8 [4 A1 U/ ?: W
  1381. LDA Music_Bank_8000( m; E7 t; X) x+ Y0 ~8 X7 I3 d- b
  1382. JSR SwitchBank80000 ?) A* H5 d) U+ J+ Z; \
  1383. LDA Music_Bank_A000% r5 ^* f* v+ w& a. c0 Z! G9 b" x
  1384. JSR SwitchBankA0002 F6 h3 E" ~$ P
  1385. RTS3 A, E+ a$ D8 ?! a8 c9 H7 m$ {4 O5 \
  1386. & S6 T7 o# U3 I+ f/ q
  1387. ;==================================================
    ; z2 g* R5 E- A1 Q3 ?; E
  1388. Sound_Init;音乐初始化
    - P* o  t: r7 `: Y8 H0 q/ }; w
  1389. PHA
    5 o0 ?3 e. i2 H5 M
  1390. JSR Sund_Bank_Set
    8 s- _( G3 V3 ^0 I, u
  1391. PLA* r" Z# Z8 P+ ]+ I+ a. Z3 X
  1392. JSR Music_Init_Addr
    7 H! o7 e! L. B# t8 ^! _7 q
  1393. JSR SwitchMainBank
    * {+ L# c9 |$ I2 V+ u5 V

  1394. - E  ]# t7 G( L3 i$ i
  1395. JSR Music_Bar_ReSet8 q6 q- F' @1 h" k4 p& Z+ j: i- C
  1396. JSR Time_ReSet& v' V; Y+ @4 V. T3 q0 Z6 }8 [
  1397. LDA #$00
    " S4 H/ y+ x" V. E0 i( n9 ~
  1398. STA Music_State. _! K4 B/ I- v$ `8 t* W: x& n7 v
  1399. JSR Music_Stata_Show: _) l6 [+ j1 x
  1400. .IF Track_Name_Pos  r& Q* b  G* m# ]5 }0 z
  1401. JSR Show_Track_Info
    . ]1 f' w  W9 ?/ }+ j
  1402. .ENDIF( Z- s* V; ]/ n
  1403. , @* _2 @: {* u% R0 a, V
  1404. RTS; w) E( O6 X5 I7 m$ i

  1405. 7 b) o1 i  C9 \0 I" {* x
  1406. ;==================================================
    1 Q4 M% @; O  e
  1407. Sound_Play;音乐播放: X3 H' q. f, F5 i  u
  1408. PHA
    8 B0 X$ U4 k3 A/ l- W
  1409. JSR Sund_Bank_Set
      k5 D% o7 I  a, x$ w9 i8 G, b
  1410. PLA
    ) T3 v; i2 S% V1 R
  1411. LDA Music_State
    ' T. E0 u) g/ R
  1412. BNE Sound_Play_End
    * R3 l7 O9 J/ l' i1 z
  1413. JSR Music_Play_Addr" V( b4 z4 G" U5 j3 l9 r) l& ~
  1414. Sound_Play_End
    ! W5 u( X! j  e0 q3 ~2 b
  1415. JSR SwitchMainBank) h4 o& R& W, k- V# ^# v. g! h
  1416. RTS, p4 f/ f6 T: E. Z7 t: g7 _
  1417. + L' S. t9 r/ c. b' j( \3 S
  1418. ;==================================================
    0 x; w1 L+ g; e5 I! E! U/ F
  1419. .IF Music_Reset_Addr
    + l7 n: q! M1 B+ m- i
  1420. Sound_Reset;音乐重设(如果有的话)
    ) {: H2 M* c$ L4 M. O! h
  1421. JSR Sund_Bank_Set8 p4 u! |5 c7 n! J; I- s9 o3 ^/ G
  1422. JSR Music_Reset_Addr, \2 q1 p" Z$ G
  1423. JSR SwitchMainBank
    - K* s0 Z2 u) }
  1424. RTS
    3 X( J$ T7 g( |6 ]
  1425. .ENDIF
    8 x( K1 ], w3 X1 F

  1426. 5 X$ F' r& a3 Y4 I
  1427. ;==================================================
    . _. z/ b* ?( G2 I- V
  1428. MainLoop;死循环/ {, K' l" s" n- V! y  d
  1429. JMP MainLoop( W% g; f) r, ?; x

  1430. ( q: p0 F; K  y' w
  1431. ;==================================================
    3 N5 p; G. K9 q% o+ |9 b6 Q4 e8 I. R
  1432. NmiProgram;Nmi中断处理0 n- I$ f, r  R, y2 i/ w
  1433. PHA( B5 n! z+ E3 K+ ~5 d
  1434. TXA
    4 A" E/ T, w% ]* @4 s
  1435. PHA
    7 k1 G+ L3 t; k; A
  1436. TYA! B- k, m( A9 f0 ]+ Z! h6 m- ^0 O. I
  1437. PHA! @2 Z8 j& K/ F' I

  1438. / ]5 a4 J; @( k7 s
  1439. LDA PPU_STATUS
    ) n3 \; M) E1 X! A" v9 y+ M
  1440. LDA #$00
    $ U8 f7 O! d) g& K% _" ]
  1441. STA PPU_CTRL) G" Z5 x/ G' b8 |; u
  1442. * T8 d8 \3 i+ p0 V# ?
  1443. ;切换主程序bank
      x7 p, h6 J! B2 O) t
  1444. JSR SwitchMainBank0 R4 Q$ t3 e# a+ O7 |
  1445. 6 Y6 u+ V; n, o
  1446. ;NMI处理
    4 Q0 d4 M2 f' v! {. \8 ~
  1447. JSR NmiProgramProcess
    0 x* H8 b* f3 d7 y

  1448. 7 ]( f9 }$ W9 R" Y( \8 R% @2 P
  1449. Nmi_Proc_End+ _* e- A" u. a- h8 S: g; `# u
  1450. PLA
    7 Q& m; g- b9 c" e- Y9 f
  1451. TAY
    ! N/ V7 F& c) s0 j
  1452. PLA
    ! H) H0 i1 D$ ?" y; c6 _
  1453. TAX
    . u! h% u3 V+ v2 N  F5 j
  1454. PLA" B: Y6 H* P1 i* d9 M2 _
  1455.   F: P5 A* c! B7 P  M
  1456. RTI
    ) n1 L% ~' H1 \2 d& ]
  1457. * b- Z2 I* C7 |* O, A3 _
  1458. ;==================================================+ Z- J6 d" O$ K) w; Q
  1459. ResetProgram;重置中断处理4 V, r. [# j2 f, f8 ]- w$ J8 \
  1460. SEI4 \; L  t1 P" J1 b) Z
  1461. CLD. d8 _/ a: J) Z
  1462. LDA #$00
      O2 w! l4 J/ q- b4 T; q- b
  1463. STA PPU_CTRL+ I2 v% Y6 u- I  r4 `- Z/ c
  1464. STA PPU_MASK2 L0 O0 p3 \$ e' G' d
  1465. & B! b3 ~1 k% t3 K' y
  1466. JSR SwitchMainBank1 f5 ]6 C( x+ u
  1467. JMP ProgramBegin6 {& K2 `6 G( G" I6 e  R. S9 R
  1468. & U  r3 [) N. U& q2 m6 Y
  1469. ;==================================================2 ?+ A7 C7 S5 C$ S! @+ c7 E
  1470. IrqProgram;Irq中断处理
    & ?% w7 N' t4 \/ r) {
  1471. RTI
    9 ?5 i  N; P2 r5 B( L* W

  1472. 6 h8 s! ~7 O  L! Y+ [0 I4 {% A
  1473. .IF SOUND_BAR_SHOW_ENABLE9 a# G1 a3 t1 J# C! Z7 p% ^8 S6 Y
  1474. .ORG $FF806 a1 {8 I! j5 ~' T) \5 ^3 g
  1475. STA $4000,X6 k9 E* ^! |! h$ O! I! \6 ~
  1476. STA Sound_Bar + $00,X& f4 G' `: A  B' h) ~
  1477. RTS
    8 w9 N% N% v' q0 `: E; k
  1478. 9 u* P- Q1 f1 {; l* H( r) `8 _# ~" X
  1479. .ORG $FF889 A. E# e9 g/ w- L0 X  g
  1480. STA $4000,Y0 w0 n& h- k1 v7 k
  1481. STA Sound_Bar + $00,Y5 {' I! m" s) [- N9 X
  1482. RTS. I0 M2 p+ L( N! w, Z

  1483. ( f! Z$ L9 e5 E5 v  o( M* K/ z; k
  1484. .ORG $FF90
    , O( v8 D6 k( M# J  K
  1485. STA $4004,X. B6 }( e, t, v% D
  1486. STA Sound_Bar + $04,X
    + Z: J8 j& I+ M$ g; I2 I: ?2 J7 p
  1487. RTS7 H: m0 |5 ?; C, \, f% f2 k, y
  1488. + o+ }+ \, [! ~
  1489. .ORG $FF98
    2 W  K, t- U  v1 B2 S
  1490. STA $4004,Y* D! J6 |0 e) m3 e; z$ K+ E. Y
  1491. STA Sound_Bar + $04,Y
    + v" J. Y( D4 P7 V
  1492. RTS
    $ v0 U/ c  I7 v: f- b3 ]% q

  1493. / {4 T2 g+ R0 ~, r
  1494. .ORG $FFA0
    , s! S6 }2 w% y; b6 r
  1495. STA $4008,X* L. D  o& C2 H2 o6 T# v
  1496. STA Sound_Bar + $08,X
    ( J& z4 B0 x( z0 T1 d
  1497. RTS* ^" E% y: B( ^# d  b) |3 w- y! y
  1498. . u5 v* n5 O1 Q( i; f* n: x
  1499. .ORG $FFA8
    ( [5 _. Y: `3 G+ k! y# i
  1500. STA $4008,Y6 K0 d, O* d; p4 Y2 o
  1501. STA Sound_Bar + $08,Y
    2 R" [+ H8 `6 h) B2 u
  1502. RTS, r# h+ [# d' j3 q! H& K

  1503. : T+ D- Y  M" Z) {( w
  1504. .ORG $FFB0
    - h' ?1 N2 b8 e9 A% l
  1505. STA $400C,X
    9 b" o$ `8 B3 z: V7 u2 x9 p
  1506. STA Sound_Bar + $0C,X
    9 m& E' ^; ]. K( _
  1507. RTS
    : D) B( d9 @! `

  1508. ( z% M) W  l/ u
  1509. .ORG $FFB8/ w6 @; Y4 D7 G1 M3 ~
  1510. STA $400C,Y
    . o- \2 m4 a1 m4 \: y& c7 r/ C
  1511. STA Sound_Bar + $0C,Y# k# p. p  i2 C- r- d
  1512. RTS
    - E. ^4 o# n9 L& m% i( |  X6 S" T

  1513. 4 w; l0 N% Y. q# q+ f% e1 ~! k8 o
  1514. .ORG $FFC0
    / \7 P0 f$ b& V4 `  S" \+ n" i
  1515. STA $40005 b' V( k9 a$ T5 x$ Q1 z
  1516. STA Sound_Bar + $00
    " D- q* |1 b! E3 J: N( k
  1517. RTS8 i; u& ~) T, {

  1518. # X$ ?5 h' y2 d, m9 z* I9 C
  1519. .ORG $FFC8
    7 u0 O5 {  G, e! d& D3 e
  1520. STA $4004$ F8 P* @4 G6 J* i& e/ B( t0 M# m0 T
  1521. STA Sound_Bar + $04
    7 x+ j! h" }' D( \1 w; [( K" u
  1522. RTS
    - T+ H: q6 \- \, x: \
  1523. 9 |$ n+ A7 r5 O3 R7 ]" ?
  1524. .ORG $FFD0" M2 H9 q2 f' K3 b% E1 u
  1525. STA $4008
    : f( r0 `4 O6 j1 g- R0 j: h
  1526. STA Sound_Bar + $08& T; X+ A! A8 \6 f( z/ W
  1527. RTS
    % t* Q+ K# j; N! }8 K  V

  1528. 1 M! _# X& o# L  r6 J' h7 M
  1529. .ORG $FFD8
    9 B/ e& {  O5 h  E
  1530. STA $400C
    , R! y3 K" ]+ g7 I9 v
  1531. STA Sound_Bar + $0C
    ' B9 N# L: B* z, c' O( t
  1532. RTS
    & n2 Z' \9 |9 T( e& w

  1533. $ [* v1 c& g* W! @  I
  1534. .ENDIF
    4 X/ d8 h! }: d0 @
  1535. ' a- \6 p5 ]* I) b1 h; a
  1536. .ORG $FFFA
    ' N( r% g0 p1 [6 F6 e) \& r
  1537. .WORD NmiProgram8 F9 i7 i! Q$ y
  1538. .WORD ResetProgram
    1 b6 F& v/ a. j. w5 ~- Q
  1539. .WORD IrqProgram
复制代码

% i& x# i4 ?) ?' r! h' {8 W0 E, C2 t3 @9 P% S6 m+ `* R: k# {
游客,如果您要查看本帖隐藏内容请回复

本帖子中包含更多资源

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

x

评分

1

查看全部评分

签到天数: 1101 天

[LV.10]以坛为家III

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

使用道具 举报

签到天数: 3074 天

[LV.Master]伴坛终老

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-8 05:25 , Processed in 1.079101 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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