EMU618社区

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

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

[复制链接]

签到天数: 39 天

[LV.5]常住居民I

发表于 2023-7-11 19:08:59 | 显示全部楼层 |阅读模式
本帖最后由 yandagui 于 2023-7-11 21:32 编辑
+ |! }1 T( m& `' S
  O( }' d. i/ [1.魂斗罗
, G9 Y# X) k+ q2 u2.超级魂斗罗
0 E( a; E, U8 }3.赤影战士
1 t/ i* \7 d, b2 b4.忍者龙剑传2& v$ p* V9 g( e* i# ~

: k0 T+ {& ?4 k+ ]2 O" d) Z# C# `( R& W8 C
3 l( ?% J/ ]" \2 c8 _5 @

$ k# Y5 |2 \( s1 U$ B源码:+ w! H; @2 R. }; `& }: o8 u
  1. ;[FC音乐][播放器模板]6 m2 ?2 U! f" F' y
  2. ;FlameCyclone 202307108 f/ q7 M2 w; Q$ q, n8 E

  3. # `$ P6 f, e3 t+ K2 r
  4. ;文件头. ~/ q) Q( h8 u9 o& ~. h
  5. ;======================================================================" Z# {/ I* t9 g
  6. .INESPRG 4                                              ;16KB PRG 数量( v8 @& t* x; ^. |3 X
  7. .INESCHR 0                                               ;8KB CHR 数量
    # [/ m+ c: r% v5 m  N% b  n3 a3 ~
  8. .INESMAP 4                                                   ;mapper 4. E; `' x2 Y7 U2 J
  9. .INESMIR 1                                   ;命名表镜像 0水平 1垂直
    ( d' H3 X2 \. b2 Z

  10. 1 B+ W3 E3 P' S
  11. ;==================================================
    - L# @; Q  G8 i$ ^
  12. SOUND_BAR_SHOW_ENABLE       = 1+ s" f" y6 H7 m. C' E( T
  13. ;==================================================9 M7 |% Q' I1 k, E  w" ~' H- H, O
  14. BANK_DATA_MASK              = $079 B9 M# U1 P! ^* ~
  15. ;==================================================
    3 W- `/ r, N/ ]7 n
  16. SOUND_DATA_BANK_0           = $00
    ; I2 I0 A- V+ P# l9 e
  17. SOUND_DATA_BANK_1           = $012 |6 I/ |9 p% Q% [' `' o
  18. SOUND_DATA_BANK_2           = $027 A( w; S. E7 r  y* {+ T$ M
  19. SOUND_DATA_BANK_C000        = $066 D9 o# i# y% j7 j& p
  20. 7 ]8 P6 o6 M+ H
  21. ;-------------------------------------------------
    % R, j4 Y9 L' w0 ]3 I
  22. CHR_DATA_BANK               = $04
    8 o- c+ b6 F. C# U& w
  23. CHR_DATA_ADDR               = $A000  M3 g% `5 _; ~' r9 J" B& s" ?
  24. ;-------------------------------------------------3 x5 u; q- u5 m
  25. PROGRAM_BANK                = $05! V  E% `) b+ A' B& c+ W  P
  26. PROGRAM_ADDR                = $8000# Y% @) c2 X7 n' u, t& g
  27. ;-------------------------------------------------
    ! |$ S4 I  h+ t
  28. RESET_BANK                  = $07
    0 b; P' S2 O( h( `
  29. RESET_ADDR                  = $FE00
    ; f" z( _; g3 B: r/ Q/ q. e' J
  30. ;==================================================; ^4 s8 n; g; e  Y: f: V
  31. Music_Init_Addr             = $DFF0 ;音乐初始化地址) N+ R) L: V$ J! u* d
  32. Music_Play_Addr             = $813C ;音乐播放地址" m8 ^# h6 m" S6 Y5 i
  33. Music_Reset_Addr            = $0000 ;音乐重设数据地址. R5 i5 Y* E& H  ~
  34. ;==================================================* Y9 i3 r: `0 Y$ A5 |
  35. Music_Song_Total            = 039  ;全部曲目总数
    - M& b9 [/ M; ^
  36. Music_Start_Song            = 007  ;初始播放曲目
    3 `! ^  i9 |- }7 v
  37. ;==================================================
      n. v* t3 a. t" l  N# x# q8 d

  38. : i9 n( Z# T6 D! u( P
  39. ;==================================================) T. m0 {9 Q- F/ J$ A6 ]' F, k
  40. Title_Text_Pos      = $210D ;标题文本位置
    3 Z- `$ d1 l& s6 ^
  41. Author_Info_Pos     = $2284 ;作者文本位置8 S5 G" v! I7 f. y; a9 F9 A
  42. Date_Info_Pos       = $22CB ;日期文本位置, R) w5 k% v1 e4 P& ]5 _+ u5 |
  43. ;------------------------------( d" R2 s- \$ ~9 ^
  44. ;------------------------------
    ; @3 O) H* F( |+ N
  45. .IF SOUND_BAR_SHOW_ENABLE
      W: Q6 i, h  e& r% |% M- n# I/ q
  46. Play_Index_Pos      = $21B3 ;当前曲目位置
    ) X$ u0 ^8 y' q! n5 c7 Z
  47. Play_Time_Pos       = $21F3 ;播放时间位置/ e! b- X/ C- I. V- F
  48. Play_State_Pos      = $2233 ;播放状态位置
    ! N0 P0 U+ t' `9 r! W7 U
  49. .ELSE
    9 m6 _4 U! R5 x3 E# ?' i
  50. : w% S( ^0 d; ?8 m" G. Y
  51. .IF Music_Song_Total > 99
    ' v' z+ W. Q, W  S! I: e
  52. Play_Index_Pos      = $21AC ;当前曲目位置
    * B" g3 J/ c7 B' Y- W, k8 |. n* Y
  53. .ELSE' l; e( O, s8 N2 ^: j: `. o8 X
  54. " O9 [# a6 [0 ]/ K0 O" S: X
  55. .IF Music_Song_Total > 91 D  B$ ?2 ]2 I8 w+ d
  56. Play_Index_Pos      = $21AD ;当前曲目位置
    & O" [/ J- b; \* k" |
  57. .ELSE4 A9 J9 z, ~; i$ R4 f* d; e
  58. Play_Index_Pos      = $21AE ;当前曲目位置$ W" @! @! t4 P% z; ]6 v5 _
  59. .ENDIF) t) R2 S& \# f: J5 J+ P; o' Q4 s4 o

  60. ) }) J/ C0 B# j" r+ n/ x" |
  61. .ENDIF& M2 ~4 M5 e% L- @6 U6 H
  62. 0 E& u2 w/ u" B% t: r
  63. & C9 k- F! ?; E* p3 b1 `
  64. Play_Time_Pos       = $21EC ;播放时间位置
    8 B7 t6 |. E7 m0 Z
  65. Play_State_Pos      = $222C ;播放状态位置0 K2 x- I) H4 R& D; k, q; j; q
  66. .ENDIF0 N' F# c: L9 J* Z7 L4 u* P% q1 H
  67. ;------------------------------
    0 |5 I2 m* @, G1 t8 [$ ^
  68. Track_Name_Pos      = $216B ;曲目文本位置0 Y) G' A4 x' u- b
  69. Sound_Track_Pos     = $21A5 ;声道文本位置4 R; G# ^$ E* p, D5 n) J
  70. Sound_Bar_Pos       = $21A9 ;音乐条位置" G7 ~* j' i: l; K& v" I
  71. ;==================================================( h, t! ?7 H" d2 L/ J" e0 L5 e5 K5 t
  72. Scroll_X = $003 p( T5 c* d! S6 c' ]# W+ [
  73. Scroll_Y = $066 f5 Z( D' N$ b# z0 \
  74. ;==================================================
    * M0 @3 l, q9 L; l
  75. RAM_Cln_1       = $01001 V" B- @, A% T& N$ f  L: t" i2 k/ w
  76. RAM_Cln_1_Size  = $800 G- V$ M: Y! f( P2 L
  77. RAM_Cln_2       = $00E0) C5 d& `9 N6 H, ]6 ^) H
  78. RAM_Cln_2_Size  = $20' p8 A& d1 Y7 R( y9 n
  79. RAM_Cln_3       = $00E07 C* h6 y9 W4 |" u
  80. RAM_Cln_3_Size  = $205 `% Z/ a% W, l* Y7 T4 c' P* J

  81. 2 C: C. q2 z5 l% s  K* I7 q
  82. ;==================================================' u" y0 R. t) b/ _
  83. PPU_CTRL                =   $2000   ;PPU控制寄存器
    " n% i" e" u" {, r+ f
  84. PPU_MASK                =   $2001   ;PPU掩码寄存器' ]6 K$ Q! U$ Q
  85. PPU_STATUS              =   $2002   ;PPU状态寄存器:读取后PPU_SCROLL和PPU_ADDRESS被复位,下一个写到PPU_SCROLL的数据是水平的,写到PPU_ADDRESS的数据是高位- \- y3 d* u* r4 l8 o9 ?8 t# s
  86. PPU_OAM_ADDR            =   $2003   ;精灵RAM地址:用来设置通过PPU_OAM_DATA访问的256字节精灵RAM地址。每次访问PPU_OAM_DATA后该地址增加1
    * h" \! j2 m! L
  87. PPU_OAM_DATA            =   $2004   ;精灵RAM数据:用来读/写精灵内存。地址通过PPU_OAM_ADDR来设置,每次访问后地址增加11 h$ i, A( L9 V
  88. PPU_SCROLL              =   $2005   ;屏幕滚动偏移:第一个写的值会进入垂直滚动寄存器(若>239,被忽略)。第二个值出现在水平滚动寄存器   w/ Y& A: q; w2 A- G, N
  89. PPU_ADDRESS             =   $2006   ;VRAM地址:设置PPU_DATA访问的VRAM地址。第一个写地址的高6位。第二个写低8位。每次访问PPU_DATA后地址增加
    ' x: U& u! A9 W
  90. PPU_DATA                =   $2007   ;VRAM数据:用来访问VRAM数据,通过PPU_ADDRESS设置的地址在每次访问之后会增加1或32
    ( W0 z9 A* e! ~# l5 |0 A( J
  91. OAM_DMA                 =   $4014   ;DMA访问精灵RAM:通过写一个值xx到这个端口,引起CPU内存地址为$xx00-$xxFF的区域传送到精灵内存
    : V9 b1 x* z5 f/ s7 h5 k& h$ U2 `
  92. APU_STATUS              =   $4015   ;声音通道切换  Q/ Z* {; b2 l7 W0 V
  93. JOY1_FRAME              =   $4016   ;手柄1 + 选通
    * R$ v" k4 t: K- a
  94. JOY2_FRAME              =   $4017   ;手柄2 + 选通
    " T8 }0 n4 h+ r+ h4 s5 L4 d$ m& c
  95. ;==================================================' F1 k: O9 k% B3 D
  96. MMC3_BANK_CTRL          =   $8000
    / z8 E" ^% N$ w& H3 f. i
  97. MMC3_BANK_DATA          =   $8001; ~2 z0 x" d8 N2 B" q6 r  {! @
  98. MMC3_MIRRORING          =   $A000
    ( S: T" b; t+ m9 w
  99. MMC3_PRG_RAM_PROTECT    =   $A001
    , v' K. ]4 |: |0 ?4 E
  100. MMC3_IRQ_LATCH          =   $C000( w& ]$ U& U0 n( C! c: U( L8 Z4 {
  101. MMC3_IRQ_RELOAD         =   $C001
    ( B$ P; s2 `9 x# c
  102. MMC3_IRQ_DISABLE        =   $E000, ?: E, \9 `; [
  103. MMC3_IRQ_ENABLE         =   $E001
    6 {& H/ f9 y% n& U5 K1 P+ m9 u) f  o

  104. 7 T8 H/ i$ J8 Y2 f4 ~
  105. ;音乐数据块
    . d; ~1 m% `. s4 N9 R+ c3 T

  106. 4 C# h" q- b+ [* |! q
  107. ;======================================================================
    ; E8 x* h) H- K$ }) e. F2 S0 P
  108. .IF SOUND_BAR_SHOW_ENABLE
    1 w; h3 V( b( n7 R
  109. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK
    - d2 U/ _- G, l
  110. .INCBIN "sound_bank_bar/music_data_0.bank"
    " w" ]7 b5 m  I9 z& w
  111. 0 B' z+ `; Q: K( B3 X* `
  112. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK
    7 }( ]. M) J# c+ D. o/ S$ H
  113. .INCBIN "sound_bank_bar/music_data_1.bank"" R& w* x. Q% L) g: `1 V8 s
  114. 4 `& A( a: C8 K1 E4 z. W
  115. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK
    # z1 }# z* m7 K# L8 a7 O, i
  116. .INCBIN "sound_bank_bar/music_data_2.bank"
    & ~$ m" r" j: x1 d

  117. . B6 K! h6 }0 G% z1 X
  118. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK+ i$ f. |2 O: X8 `$ t. [! R
  119. .INCBIN "sound_bank_bar/music_data_3.bank"
    ; [* D1 O) H& G9 W! ], X) ^- d

  120. 3 K3 e7 j$ Z! N" w
  121. .ELSE
    / A: `* S8 n0 a: D2 \- `0 K
  122. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK
    7 E5 s( U% m% N* l
  123. .INCBIN "sound_bank/music_data_0.bank"
    2 _) `- y; u. J$ o: B
  124. , c# c0 C& A% `: N, _# L( Q  Q
  125. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK
    , _' O' u& Z- d1 z; ^7 m
  126. .INCBIN "sound_bank/music_data_1.bank"
    : Y1 W$ M9 J4 h' K3 C$ B
  127. 8 s% |4 D) J0 x0 e# U4 o
  128. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK
    . r, C* d1 Y" ~
  129. .INCBIN "sound_bank/music_data_2.bank", X1 X8 X- T6 N' t& R0 f0 D

  130. 5 i1 q2 S6 c6 Y/ h' `( F/ P
  131. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK1 B; M9 q* Z- `& Q
  132. .INCBIN "sound_bank/music_data_3.bank": k2 k2 M+ l  a7 v. w/ G3 @
  133. .ENDIF5 G' m0 q0 t, ^7 f
  134. 2 @# t& `( B! c
  135. ;CHR图形数据
    + I4 L7 l/ S; O( a* V: N+ t
  136. ;======================================================================
    9 n/ S3 f9 l! J2 `" J$ k& V  ^+ @
  137. .BANK CHR_DATA_BANK/ R6 y3 P' Y+ P
  138. .INCBIN "chr_bank/chr_data.chr"4 P, E& d9 N, w
  139. 3 D5 n9 }; z+ Y% x/ _" @: z# j
  140. ;==================================================
    $ W* Q* |  U5 z5 T6 o# g
  141. PPU_Addr        = $0300
    7 ?' K/ h! o# l! {, b
  142. Palette_Addr    = $03C0
    + F- j  B7 j+ v9 Z5 t9 T* s& \
  143. Sound_Bar       = PPU_Addr+$E0
    ( t* C) C" q0 p. F% S
  144. ;==================================================" L6 f  j6 G7 w# t& z* ^
  145. Palette_Update_Addr     = Palette_Addr+$0D; H" ^, A; Q' W. x8 `; W5 m
  146. Palette_Update_Max      = $2C
    1 n8 A! t0 ]7 @
  147. Palette_Update_Min      = $21
    2 [! ^, R6 u* [7 c7 j& L
  148. Palette_Update_Interval = 60- q5 r  ]! v, ~+ t. a
  149. ;==================================================  N$ a7 n# g! E0 Q% ?* u$ C+ n
  150. Sound_Bar_Cnt       = PPU_Addr+$F00 A: D# j' u# d5 _/ {  P- Z
  151. Screen_State        = Sound_Bar_Cnt+$01- j3 _) @, Q7 M7 b
  152. PPU_Cur             = Sound_Bar_Cnt+$02
    5 h& ^/ O7 F9 N0 F$ z$ p! ~1 H; r
  153. PPU_Addr_H          = Sound_Bar_Cnt+$038 P, j2 U5 Y$ H0 y* m0 N2 {
  154. PPU_Addr_L          = Sound_Bar_Cnt+$046 s% C- K' D2 A
  155. ;==================================================. ?# V) @" \4 V3 x
  156. Data_L              = $70
    1 _& J9 e/ O8 K% I! Y/ j. |* `
  157. Data_H              = Data_L + $01
    ( }( _- ?" B! ?6 B, C6 [
  158. Data_Cnt            = Data_L + $02
    * w6 _# |" V/ Z7 U% D
  159. Data_Buf            = Data_L + $03
    1 i8 ?% j6 h7 M
  160. Time_Wait_Cnt       = Data_L + $04" ?% ~; \3 g: H1 }4 a. q  N, a
  161. Palette_Wait_Cnt    = Data_L + $05
      _5 N* n0 r2 C  }
  162. Palette_Update_Flag = Data_L + $06
    1 p# u5 d) S3 p. n
  163. Show_Track_Name     = Data_L + $07
      e' I7 O" q" v! c/ B( d
  164. ;==================================================$ K" M8 Y! {8 y4 ~/ ^7 O( F9 O
  165. Key_Keep            = Show_Track_Name + 1
    ; P& Y7 G7 w" s; g2 p6 f
  166. Key_Once            = Key_Keep+$01
    + k3 K$ ^4 h& b8 ]6 X& u# y) X
  167. Key_Kemp            = Key_Keep+$02
    $ a& P' z4 A8 f
  168. Key_Temp            = Key_Keep+$03$ h: \7 M2 t' V4 D# ~& K/ h7 N0 {
  169. Key_Getv            = Key_Keep+$04. M$ t; Q( y: G6 d' f0 m0 E% h. F- `
  170. ;==================================================
    1 }. Q) e. V+ P9 Z6 [
  171. Music_Cur           = Key_Getv+$01
    . ~' B+ S* w. X: I  b
  172. Music_Last          = Music_Cur+$01
    , c& c! Q% \3 }$ l* F6 i
  173. Music_State         = Music_Cur+$029 j. T7 t( `6 v- D  b4 R; F! N
  174. ;==================================================. I$ q3 t1 X: R+ o
  175. HEX_Data            = Music_State+$016 a" X8 ^2 b1 Z7 T1 i
  176. DEC_H               = HEX_Data+$01) C6 }, @+ K5 Q( Q8 y, a
  177. DEC_T               = HEX_Data+$02
      L: ?. z  q( g( O& K
  178. DEC_L               = HEX_Data+$03
    3 Y/ F3 j# H+ P+ @& x
  179. ;==================================================+ _- r! _( B  ]
  180. Time_S              = DEC_L+$01
    9 k3 L( K( f7 q5 ?
  181. Time_M              = Time_S+$01
    + @& w; Y' ]: ^3 |
  182. Time_H              = Time_S+$02
    2 ^' c' T! `! p
  183. Time_Cnt            = Time_S+$036 ^' x, X; |( L( q' L
  184. 5 J7 o$ O: ~6 L8 n% ~4 T
  185. ;==================================================
    9 [: s6 ]) B  U8 Q4 ]
  186. Music_Bank_8000 = Time_Cnt + 1
    5 i  x- ?  B) R. N, Q/ m1 L
  187. Music_Bank_A000 = Music_Bank_8000 + 1
    8 j% @  C8 J; o( m  n  l0 ?3 E
  188. ;==================================================
    + y2 o; |" @# z1 D1 j* @3 Y+ j
  189. + L8 b  d, |4 B8 K& F
  190. ;======================================================================
    / @+ a1 }- y6 {4 w1 Z6 s5 M
  191. .BANK PROGRAM_BANK  F# v, o1 g% I% F2 G* {
  192. .ORG PROGRAM_ADDR
    9 a- c/ e) q& {

  193. ; ~7 m' t' ]+ N+ B! \+ {3 D
  194. ;==================================================# w9 S' ^. P6 E/ `+ [9 Z
  195. NmiProgramProcess;NMI中断程序处理1 e2 a& ]+ X  R" _
  196. ;处理PPU图像
    ( Z/ M* ^, H: {4 L5 e0 r( V* q6 w
  197. JSR PPU_Proc
      v) G" r: M( F2 ~3 B3 m8 h

  198. 3 @  ]- m" D! D3 K: T2 k. G% g; K1 W4 O
  199. ;启用NMI中断
    3 O4 q$ E" o; l
  200. LDA #$80
    ; E& R" y4 }! g+ P
  201. STA PPU_CTRL4 r+ S+ ], {) X. O+ x
  202. ( |; f: S1 l( f
  203. ;更新调色板
    0 H% X$ f. `8 G+ ?! b3 B  [( y! L
  204. JSR Update_Palette_Data
    4 _: t$ D* i" k' e# a
  205. 9 L0 D6 s$ V! \2 [$ z
  206. ;显示时间(缓冲)
    ) j8 N9 G5 L& Z! o
  207. JSR Time_Show
    5 c5 i2 {5 [5 z  g
  208. & Y2 Z1 v8 c5 Y3 k4 a/ W  H
  209. ;播放计时
    ; y0 E4 v* b6 c" e4 n
  210. JSR Time_Count8 X* f( K8 N) u+ {: y) u" g" `2 j
  211. # K  c; S7 [+ c3 o- W
  212. ;播放声音% q2 D1 w' n  b8 u2 Y( g
  213. JSR Sound_Play
    6 l0 D8 t( N& E* K$ E: K
  214. 5 o! R$ Y; T- t+ y0 I* M
  215. ;切换音乐(手柄触发)0 k) n. x0 |4 b& Z5 m
  216. JSR Music_Switch
    9 E0 x$ D, s0 z8 x! m0 W1 |

  217. + @4 W# L1 c6 N3 e) e
  218. ;音乐显示(缓冲), \5 y- M# u6 K0 e
  219. .IF SOUND_BAR_SHOW_ENABLE  M- `9 `/ F/ W
  220. JSR Music_Vision# G5 p0 Q$ `! k7 a# C3 F
  221. .ENDIF
    9 l: ?6 M0 u2 \4 ], M0 T
  222. * Y" E; U, x" ^: q5 e
  223. LDA Time_Wait_Cnt
    " [' ]  `& q) u( M
  224. BEQ NmiProgramProcessEnd
    ( i; A- `0 \0 X" A  r/ I4 y' H
  225. DEC Time_Wait_Cnt
    " |2 y: X, z* e
  226. NmiProgramProcessEnd
    # w& j' Y: n) A. M+ Z
  227. RTS6 C% w( y  i7 d# o& l# ]# i
  228. ; S9 ^% ?  F+ `& F" ?
  229. ;==================================================
    : }7 q) \" n% ]0 _" l% m4 \
  230. ProgramBegin;主程序4 W4 _! n3 S: [0 x% f9 N  S
  231. LDA #$00
    4 ?$ }6 z: q# `; k4 U, X2 p# r
  232. STA PPU_CTRL
    ! d; o  O. D4 V( z
  233. STA PPU_STATUS7 H+ o6 @" f0 K. R# J6 _
  234. STA PPU_MASK
    , n4 `# u4 N/ t5 X" r
  235. STA APU_STATUS
    # H1 j$ Q: k. o6 U/ X9 ~/ e
  236. STA PPU_SCROLL
    6 Y1 t: u* r8 r/ q
  237. STA PPU_SCROLL
    + U0 {0 T) s7 N( z! x1 a4 d% n
  238. LDA #$C0
    - e  F3 L, u- t  C1 a  |2 ]9 B
  239. STA JOY2_FRAME
    5 g4 X$ p0 {: b: U3 I; l$ F8 U
  240. # f( [% t/ j% `! b7 |
  241. LDX #$FF, c8 E3 a  E. `
  242. TXS
    / `, C- b! m! L1 k/ b, u* ~" _5 W
  243. LDA #$00
    2 V  Q" T, I2 s3 |8 l7 e; K; ^
  244. STA PPU_CTRL
    - B8 |3 R- `6 Z
  245. STA PPU_MASK
    1 A4 ^/ p( I2 ~3 c# ~0 d
  246. STA MMC3_IRQ_DISABLE
    + V- ]' {% m  |: j- z
  247. ' k# ^* d, m5 {: ~- J1 J
  248. ;==============================
    ' R7 K. |5 ?/ b1 t
  249. ;调色板清空3 K8 V  V3 b  S9 Y8 U/ x
  250. LDA #$3F; T  G$ Y. r! [. H
  251. STA PPU_ADDRESS
    , [- m& m2 v, a: R( A  u3 k! U
  252. LDA #$00
    4 E; ^% E6 z1 ]
  253. STA PPU_ADDRESS7 T* b, q1 P2 k% }
  254. LDA #$0F
    ; T1 {' ]5 _( i0 G
  255. Palette_Clear- ~& x0 ]3 Z/ Q( T6 x% m
  256. STA PPU_DATA
    ' l$ Y7 Z& x, w
  257. INX7 J$ c0 Y2 O) g* U7 t+ t2 a
  258. CPX #$20
    # n" ]+ L! f2 ~0 ~, h, o
  259. BCC Palette_Clear$ M' k0 N% n. O# E& t* p7 W$ a
  260. LDA #$003 L) t5 x# w! Q
  261. STA APU_STATUS
    2 E3 c% l8 U0 O( y5 A2 p6 F$ w/ L8 S
  262. ;==============================
    + v3 Y: W- K; t$ N2 f7 @
  263. ;初始化背景调色板3 m( _! m3 ~& K! `+ N
  264. JSR Set_Palette_Color
    1 Y( n9 {+ g8 u% i
  265. JSR Set_NameTable_Attributes5 V# o) K$ C/ F3 o/ l+ V$ W
  266. + R: a% {; w; K: ^$ c
  267. ;==============================/ A: i, ?( g: P, x1 S
  268. ;RAM初始化, b$ C( U3 B5 P" t8 G, c
  269. RAM_Clear_All
    ! g( y! }* a. W- p4 F
  270. LDX #$00& o. X( U7 V! |2 P7 j2 ]$ p
  271. LDA #$00
    * \9 J8 O# V' m. ]8 ?
  272. RAM_Clear_All_Start" g, @" q. X# K/ n7 A1 J
  273. STA $00,X
    ' v; C. U- o* i; s- }4 R  U" h3 y
  274. STA $0100,X
    , h$ a1 m0 `+ `. m/ A
  275. STA $0200,X
    $ ^+ O  E  z- K  ?
  276. STA $0300,X& {$ Z) O$ g+ Y$ x) A
  277. STA $0400,X" C6 p4 M. X; q& {
  278. STA $0500,X3 x8 h7 i% }, Q* t/ c4 |) Z
  279. STA $0600,X
    / }/ I8 @, c2 v7 A# i
  280. STA $0700,X
    0 D- A* O$ |- d8 C% ~4 z; I: X
  281. INX/ M: w: [, x% ?7 b
  282. BNE RAM_Clear_All_Start
    3 H, E7 `2 c' x2 q
  283. 9 f. Z/ q2 S! o  _. \1 {
  284. JSR VramInit- y6 }, `, o: t7 `
  285. JSR Init_Palette_Addr
    4 j& p4 Q( G, S) V; f( K
  286. 3 x( d  X; p! ^" ~
  287. .IF Music_Reset_Addr
    , ^% [  l2 _! u9 F# a3 A7 q
  288. JSR Sound_Reset
    : i: `9 }5 A8 T6 P
  289. .Endif
    4 m8 L4 K+ r0 L' N

  290. # D, i. D  o: z) F6 P
  291. LDA #Music_Start_Song-$01& E& p& ?" h9 {4 Y
  292. STA Music_Cur. X0 O; `: T" c7 o5 x, h3 m' v* R# N
  293. / W& X  s2 l$ S
  294. JSR Show_Music_Text
    : k' g2 S' U3 F8 H. Z

  295. + Q5 Q6 t8 k1 d" O/ k
  296. .IF SOUND_BAR_SHOW_ENABLE
    # A- s* v4 _! C, C
  297. JSR Sound_Bar_Text_Set7 h5 m. ]: T' p: H  b6 N
  298. .ENDIF
    # d# m4 s1 A: \6 l

  299. 0 e9 t  @& I; p, {5 _
  300. .IF Track_Name_Pos
    ' k8 {" R4 L  I4 }
  301. JSR Show_Track_Info% F* x: g! I/ {$ A/ J$ H) x
  302. .ENDIF
    ! X; m1 r) _9 i$ b: ^- T

  303. , T( |% N1 v1 C  {2 G; a( U8 C8 e+ C" C
  304. JSR PPU_Proc2 g4 V# t- a' r6 c

  305. : |& ^/ h9 x, k
  306. LDA #$0E% X3 f; ^# O  n/ O
  307. STA Screen_State
    - b' c. v. D; V* m1 Z8 M2 }* n
  308. , W. N6 w, }0 i; I. n* I% |$ C; `* J( R
  309. JSR Sund_Bank_Init
    8 e( t! A) J9 C& k" x3 }/ w$ T3 i: p

  310. 1 h+ U" f4 S' Y5 ~9 ^1 a, e" x' ]
  311. JSR Music_Show
    1 p' J3 D6 Z5 @. h, d8 H/ w* b. }
  312. JSR Time_Show/ E8 R3 `1 q6 j3 s
  313. JSR Music_Stata_Show
    + [" o1 z& {7 ~" `) x) E4 X6 w. H& Q, p
  314. JSR Time_Delay
    * J8 D3 G& w- z

  315. & U' B& y, L) N' Z, A' r5 D6 k& \0 m

  316. % _9 J% w: e. b' e2 k9 p
  317. LDA #$80
    * i+ k- X( a( z3 i1 m- o- l6 }* l! Z) r
  318. STA PPU_CTRL
    6 `, q: ^! [6 o  w* b4 H) w

  319. & Z; J# @, p8 c  ?1 g0 h2 @. E
  320. LDA #$20$ E+ M3 i; D( J
  321. STA Time_Wait_Cnt
    / R4 ~1 x/ ?2 g/ g* Q

  322. $ }1 N: `+ `. W! _& G
  323. Wait_Time_Over/ m+ Q* I4 j& m, |
  324. LDA Time_Wait_Cnt, }( v! m1 y$ I2 Y; \5 B! j
  325. BNE Wait_Time_Over! X2 }) `! E% M& w# \. R

  326. , Z" H; n/ I& J  g0 N+ b
  327. LDA #$1F
    . H# S% }: X$ m" ^
  328. STA APU_STATUS' _! [  q& k0 r* H6 g( \* B9 H- Q
  329. LDA Music_Cur
    ! U4 ?+ ^0 a4 T. u# Z" A2 f' N
  330. JSR Sound_Init# F. C! w; ^$ J6 Y# {
  331. * s1 ^: N( Q) I% h5 |* h
  332. JMP MainLoop
    & a$ a, e2 _* Z, d' O
  333. * k; B2 O0 f1 f0 B0 r
  334. ;==============================' D( w, l; M* w. }' |
  335. Time_Delay;延时等待
    5 n4 O; \, N6 C4 v2 s# q: }
  336. LDA PPU_STATUS% `3 @) }* A, N' t* o
  337. BPL Time_Delay
    ; q; p/ |3 ^8 P9 `/ A* n, b
  338. RTS+ u1 C6 b/ c, k$ z; K% {

  339. + B; K+ _0 X1 U/ W0 M; ]2 i" X6 f
  340. ;==============================, i. V: n8 T# W4 f9 q
  341. VramInit;初始化图形内存" {$ v1 K$ W) m, c& b
  342. LDA #CHR_DATA_BANK, P/ u3 M* X! C; l" l
  343. JSR SwitchBankA000
    " \# A* @% Z+ S- T# [  V  r0 x$ z
  344. LDA #LOW(CHR_DATA_ADDR); [. q1 N- B( w" x4 {
  345. STA <Data_L
    0 {: @4 u) H+ U3 T! }& e
  346. LDA #HIGH(CHR_DATA_ADDR)
    8 c6 Z( y+ T0 f3 H8 |$ H- @" n
  347. STA <Data_H: m& l( a2 X& O1 l- O# C  a
  348. LDY #$00/ ]9 u7 e% i% i1 G3 D7 B  U
  349. LDX #$205 ^$ F, F0 h; c0 i  O0 L4 F6 q2 w
  350. LDA #$00
    6 J, }0 M3 G. Y- `1 Q8 l, K
  351. STA PPU_ADDRESS
    4 k; U7 M4 g+ b2 s
  352. STA PPU_ADDRESS% |+ y- R; g" y: ]" U8 ^
  353. VramInitWrite
    " ]! F1 V2 M% y
  354. LDA [Data_L],Y
    7 y- }8 Z& s$ _1 J/ p' R
  355. STA PPU_DATA3 W- C8 {) [7 q- _; n! L3 W
  356. INY, N, G5 w' ]* g; z
  357. BNE VramInitWrite
    , @" N) E% F9 r( p, r( V) I
  358. INC Data_H
    5 ?/ C4 L9 v* v+ H0 Q
  359. DEX
    2 H' v9 D- d; Y% z! }8 B. n7 G
  360. BNE VramInitWrite0 k( H" l# R8 d
  361. RTS+ ~* q* M: D) T' K8 t

  362. : w' x" V. B1 i8 e- Q5 A0 Y% |
  363. ;==============================
    5 y( |' n5 l- ?5 o! V" r. {* ]6 Q
  364. RAM_Clear;RAM清除
    & }9 J" O) q* p" Q
  365. LDX #$00. R$ `. k5 P" m3 y
  366. LDA #$00
    # X2 N) H7 e. X
  367. RAM_Clear_1
    8 Q5 I' M' S$ N# Z* |2 F
  368. STA RAM_Cln_1,X
    . J4 B0 k, G3 S* F. ]
  369. INX: N% ^; d& U# K- `
  370. CPX #RAM_Cln_1_Size
    7 W0 k% \9 t5 S, D% @
  371. BNE RAM_Clear_1, T' F* b$ [9 W
  372. LDX #$00. `& I  _8 V. p8 J5 s* W; u, o
  373. RAM_Clear_2! [9 M+ s) n* T7 K* Y
  374. STA RAM_Cln_2,X
    & z9 O5 _; W+ {
  375. INX
    ) @2 B, G2 J7 G4 b( S
  376. CPX #RAM_Cln_2_Size
    . V% t& {! ?8 [) D
  377. BNE RAM_Clear_2
    ! X( N. O0 l* f
  378. LDX #$00
    ; D2 V# N. p8 X5 }+ U- J$ c) X2 t  r# K
  379. RAM_Clear_3
    ; s. m: J) b* W4 m7 k( o
  380. STA RAM_Cln_3,X& a+ D) r. U6 K
  381. INX% {8 b2 e7 |8 e9 P& K+ D8 Q
  382. CPX #RAM_Cln_3_Size
    " ^: h' c) s: m; C! U( k5 i# O8 Z
  383. BNE RAM_Clear_3
    " x: c( s3 M% C; Z
  384. RTS. C& ]5 ?: f+ I6 ]9 @9 Z

  385. * ]7 A2 k- O; m' m
  386. ;==============================+ c- C' B; U: i3 y  H
  387. ;音乐切换1 b- n( t5 t( S, u) J
  388. Music_Switch! E( P. a% d6 s/ ?+ [
  389. JSR Key_Proc
    1 L' e2 _0 h# ]0 z
  390. LDA Key_Once" p# m: q# E# o& ?' {8 E  X  H
  391. CMP #$10* d7 K  R) W0 Q! a, J# w
  392. BNE Music_Start_SongStop. h) i  N% J- v. y' o, L
  393. JSR Music_ReSet5 j  ^- _" c  Y+ S
  394. $ q) J+ W" b) D2 ?( v. [
  395. ;音乐停止: \& O& b" S8 ^+ d/ a1 L8 f& h, l
  396. Music_Start_SongStop
    1 E3 C) L3 L5 |7 _
  397. LDA Key_Once
    # F+ d  u6 ]8 P: E, S1 ^; P0 }+ X
  398. CMP #$20
    6 N1 m: J% k+ k; Y9 w
  399. BNE Music_arrow
    9 |+ u3 ?% N9 Y9 Q4 ~4 {& t3 l
  400. LDA #$012 W1 I: b/ ~! S2 |7 O+ w
  401. STA Music_State
    6 m1 G) g/ L% L2 [1 t  u
  402. JSR Music_Bar_ReSet4 a( t$ d* s" Z0 d' \0 S9 z
  403. JSR Time_ReSet  c6 H/ h+ q# Q( x" I
  404. JSR RAM_Clear
    ! \! @7 B/ P9 [8 R3 P9 w
  405. JSR Sound_Clear
    6 Y) }2 f5 r7 h  u' K$ s: G) d
  406. JSR Music_Stata_Show# _4 C% V8 \6 K  G- G
  407. Music_arrow
    % Y7 s* U: I' i' b  \/ u2 \1 X
  408. LDA Key_Once
    4 e( k* j1 D5 V% Z8 g* `2 _* [
  409. AND #$CF
    $ N# c0 O" u0 g( V% r. t! o" s) @( F
  410. BEQ Music_Switch_End
    5 V, J3 N6 [6 l* r( S
  411. JSR Music_Number
    6 L3 c  E' J! c2 i6 a) Y
  412. JSR Music_ReSet" t" V( x; I; T8 l4 E
  413. JSR Music_Show
    % K5 n9 l# s) t$ s: Z$ f
  414. Music_Switch_End
    * k+ }  o+ O) v+ n
  415. RTS  H1 X" o: ~+ I" l; K

  416.   n4 u9 ?' z( }; U- v
  417. ;==============================
    6 _. H3 K" U$ w3 e: a
  418. ;音乐曲目切换% C; C) L. x7 O( J. F8 f
  419. Music_Number" E8 X3 r  H9 p2 U
  420. LDA Music_Cur
    $ M3 |: c: Y/ R6 m
  421. STA Music_Last! E/ r* T7 w" t) X/ T: ?, q
  422. Music_Decrease
    " w& [3 O: h+ s, ]. P" p( A# p( A
  423. LDA Key_Once' _; C- i4 Y2 B/ g/ J
  424. AND #$423 s4 x0 F7 s6 `, O: h
  425. BEQ Music_Increase7 c9 H. F# R+ J" ^6 T3 L# `
  426. LDA Music_Cur$ _/ m. e% ]5 e2 ]$ n  E, M
  427. BEQ Music_Increase5 K; r* |. k6 a2 G9 C5 b
  428. DEC Music_Cur! c! Y( `2 H8 H5 H; s( g
  429. Music_Increase6 o7 r8 P  K7 Y5 B3 v% n# n
  430. LDA Key_Once
    * D' }+ T7 O/ Y; L# u1 R
  431. AND #$81
    8 P; O: E2 y8 \; G% [2 e
  432. BEQ Music_Decrease_10; D+ K# n$ F7 [; y0 C7 F# l: q
  433. LDA Music_Cur
    ; ^' |$ ^! ~& |
  434. CMP #Music_Song_Total-013 z8 v& L( T% T+ ~1 |# c  i& |
  435. BCS Music_Decrease_10  a: W' k! O$ |* r# G  C
  436. INC Music_Cur, z1 C4 q( d: }1 J. c
  437. Music_Decrease_10
    $ H: I% w/ M: p
  438. LDA Key_Once  t3 q. D, m) u/ G
  439. CMP #$049 r0 i3 L& {3 Z# G( n! }8 _
  440. BNE Music_Increase_10- |1 {6 t! T# i# ]% c
  441. LDA Music_Cur
    ( _( Q2 I* f2 ^* d4 ^
  442. CMP #10$ P4 Y/ L6 J8 N
  443. BCC Music_Start_Song_Min( O" ?- Q% W3 q/ B0 d3 S/ h. }) K
  444. LDA Music_Cur  B7 M1 J# V4 ~( P3 ]7 ~% R) {
  445. SEC/ }0 n. K3 v/ e
  446. SBC #10
    # {" Z, q0 U* |$ _8 x* A
  447. STA Music_Cur
    " t0 Q+ i7 T. x! A6 h# o+ k
  448. LDA #$00
    : @$ d* R* t! `9 w  h1 G; \& j$ {5 Z
  449. BEQ Music_Increase_10
    % z" ^2 z/ E8 b1 n& m3 n
  450. Music_Start_Song_Min
    ; u5 n& {4 Y6 ]* c1 q8 F+ W8 ~7 V
  451. LDA #$003 Z1 s9 R: a8 s/ I+ _- F$ s! ]5 O
  452. STA Music_Cur: k/ t2 {- c6 v8 k. a  o: Y: g
  453. Music_Increase_10
      _# t. |! |+ r' E9 `
  454. LDA Key_Once
    & N* o1 R) d& V5 U. ^
  455. CMP #$08( d. @9 C1 V8 e4 a  m
  456. BNE Music_Number_End( y3 X0 |/ N9 I3 Z
  457. LDA Music_Cur. r# K1 ^! V0 Q
  458. CLC; T$ e( ^( q( F; \4 N
  459. ADC #105 k  k5 k$ Y  l' r9 w
  460. CMP #Music_Song_Total-01
    ' p7 j- D+ P$ ]# ^, o# A
  461. BCS Music_Start_Song_Max; P# {* ^' ^3 P; E$ o
  462. STA Music_Cur
    . f  a8 `% c9 P1 Z* x. F& d: f
  463. LDA #00' ~: h0 [9 [' Z; D
  464. BEQ Music_Number_End
    ( r7 i$ y; w' q7 A- X. {: c( q
  465. Music_Start_Song_Max
    4 z6 b- f' M6 i. P' |8 N! s
  466. LDA #Music_Song_Total-01& r# ?/ h' P( c4 q" p) r3 Y4 m; J
  467. STA Music_Cur8 x) K. _$ w) l* j" F) q; E
  468. Music_Number_End4 t( w& U& f' L6 b) {$ D5 n" Q
  469. RTS% l* d0 x% w+ Y% h9 L" L4 f3 G3 C
  470. * P, _9 G# M9 o. w
  471. ;==============================8 C* f; }0 y# m8 q1 b; u
  472. ;音乐重设
    $ a3 O' c! d2 E; s' D- ^
  473. Music_ReSet0 N7 w3 b6 F# o( N& ]$ f
  474. JSR RAM_Clear
    3 d5 A( L9 D. v- ]+ D2 I) O3 |3 E; f" ~
  475. JSR Sound_Clear0 D) o& J. j- x6 r' L$ n% v7 T
  476. LDA #$1F0 \$ c8 a/ H, k) j; l: P) p; M
  477. STA APU_STATUS/ y, ?7 [8 ~8 N$ o; W
  478. LDA Music_Cur
    ! T9 {3 C5 g  t/ m! s6 b0 Q
  479. JSR Sound_Init2 q5 j) n+ S( T' ]7 C  K8 R) Q& z2 L
  480. RTS* t, H2 [* Q- H. X3 P

  481. ! B. [) S7 P# V' C5 I3 M! S( A" X
  482. ;==============================, R! S: v4 c4 x
  483. ;音乐端口清除
    ' I+ g; ]4 u; d& h; z% ^0 I
  484. Sound_Clear
    * N8 m  N  j/ f8 \
  485. LDA #$00: \( H* d  g- F" r' M; h" a
  486. STA APU_STATUS
    5 Z" u6 A: R' Y# T
  487. LDX #$005 f0 t: w  T% l5 z
  488. Sound_Clear_Start  Q( ^4 T1 s% z1 |- O! ^2 K( r% b
  489. STA $4000,X1 E+ P) f9 d$ N/ U6 S
  490. INX
    3 r1 `- F  ?. e7 r
  491. CPX #$14
    4 z8 g; X- f! N* e) g% L: U
  492. BCC Sound_Clear_Start
    $ d' q# z/ X# `4 w/ H$ s
  493. RTS0 r% T9 D- M6 @0 a8 @. x! ]( d

  494. : S2 X) @( u7 r- B. r( n+ t4 `
  495. ;==============================, I5 M% {, D* U! U
  496. ;按键处理- \" O. j7 {0 Z- _
  497. Key_Proc
    6 ?9 q. ^4 _& E, y6 e1 G" n8 g3 @
  498. JSR Key_Scan
    . I! Q6 {& @7 r; ^
  499. LDA Key_Keep
      M6 B* |! G, a6 W% N! X7 Z
  500. STA Key_Temp9 g) h# J2 w4 d! x2 I2 K
  501. JSR Key_Scan
    * R$ f) y* S% z. Y
  502. LDA Key_Keep5 r9 o6 |- x0 e7 q1 `
  503. CMP Key_Temp
    # z% G( {' H% R. L% l' \
  504. BEQ Key_Get_Once# M7 }3 J: J0 N# a3 K2 S2 P
  505. LDA Key_Kemp
    ! m3 N2 l9 F' X) M3 S
  506. STA Key_Keep
    8 p! \2 }; t. C+ H
  507. Key_Get_Once( k2 u0 n" ?& U0 y
  508. TAY
    & v. }0 e$ R5 f8 v: W. |5 y" g
  509. EOR Key_Kemp
    & `+ o& u& Y3 r( q6 g
  510. AND Key_Keep. K0 D3 J( [" B$ @
  511. STA Key_Once% B1 G) B. a" s/ {' _5 \
  512. STY Key_Kemp# r; a1 N9 {5 _! A3 b4 B, S
  513. RTS
    3 O$ k" ~( ~  H# Z0 i
  514. ;------------------------------
    2 M, ~/ Y+ N$ u8 W
  515. ;按键扫描
    $ C8 c! J9 ]8 b1 n5 X
  516. Key_Scan( J/ n9 f. \  K$ p4 Q- s+ G
  517. LDX #$01- w) Z6 k2 c  }5 v
  518. STX JOY1_FRAME, ^" f3 W0 _' O- s' S/ c7 t: ]; m
  519. DEX
    9 J4 Q1 U. R6 m' `6 ]1 X
  520. STX JOY1_FRAME
    " E: ]9 m& g8 e8 Z1 J" ~
  521. LDX #$08
    ' |1 ~! a+ ]0 D- H# R' o2 r
  522. Key_Value+ o! z/ y3 i8 u  ]5 Q
  523. LDA JOY1_FRAME$ @$ ?. {6 C) P3 A: ]. ~
  524. STA Key_Getv
    2 k) \- Z2 W/ \4 A* E4 U2 U
  525. LSR A0 R  N/ x) r3 M6 P( }
  526. ORA Key_Getv
    . m, p! m3 [" g# j. l! z
  527. LSR A9 Y3 n8 p" D# T8 K$ u4 Q( X  s  b' s2 l
  528. ROL Key_Keep
    / D9 U! M4 \" t7 H9 A- V
  529. DEX" a$ g5 M  Y) W" Z' ~
  530. BNE Key_Value
    ; h, _* \' r" Y
  531. RTS
    5 \. f4 I* P: F" |4 |

  532. . p8 ~( |7 p& n+ M9 j
  533. ;==============================
    5 R4 s3 Q' o9 {& s7 i
  534. .IF SOUND_BAR_SHOW_ENABLE* ]# U) ]* H  w8 L2 J
  535. ;音乐条显示
    / l! x" i& R$ K" p( J5 k
  536. Music_Vision1 ^( p) i* P, T; y7 o
  537. JSR Music_Animation' @4 P+ F- M3 t/ x6 y: N: f
  538. JSR PPU_End* a  |) e" s1 P/ O/ }9 @
  539. RTS; {( U8 P1 Z5 a! ]6 ]5 t' D
  540. ;------------------------------
    9 E1 D& k+ d( ~: P
  541. ;音乐条显示处理& V% T4 _+ w) f" _9 e4 r
  542. Music_Animation
    , x4 k! d8 Y  A
  543. LDX PPU_Cur6 T9 b: b1 q- V( r  k9 c' ]) r5 N
  544. LDA #Mode_Line
    # m( e8 w  C; e) K& O4 D6 q
  545. STA PPU_Addr,X
    , f7 _! i. X3 O! I
  546. INX
    5 Y% j2 W3 s' P2 T, H: ]9 l
  547. LDA #HIGH(Sound_Bar_Pos)0 y# B( G' d5 Q! e
  548. STA PPU_Addr,X9 C2 ]' X9 j: b" P8 K. s
  549. INX
    1 H. L6 v" B3 V
  550. LDA #LOW(Sound_Bar_Pos)
    ! q+ k  i8 P% O! q
  551. STA PPU_Addr,X
    ' ^1 w" x7 q( L+ M- T$ p$ ?" |* \0 T
  552. INX2 W; `4 [6 z1 Z* g! d' D
  553. LDA Sound_Bar' R4 d( h0 D1 D0 A) l
  554. JSR Volume_Convert
    5 L% t6 F# V8 I: W
  555. JSR PPU_Return2 _6 j5 C% m* Y8 ^. ^
  556. LDA Sound_Bar+$4  }. k& g2 s3 {+ s$ l, c
  557. JSR Volume_Convert
    ' e( I: ?7 U3 ]! b* q( V) ]4 H
  558. JSR PPU_Return. p6 ]9 {9 n# y
  559. LDA Sound_Bar+$85 j' _- [+ s' R
  560. JSR Volume_Convert_Ex
    % j, k5 `" I4 W4 P$ O; f) n
  561. JSR PPU_Return- l* C0 v8 p( w! q5 E: X  b
  562. LDA Sound_Bar+$C6 z5 w! ^9 r& W8 j
  563. JSR Volume_Convert
    % N: L, b+ v' s2 b! _& m
  564. JSR PPU_Return
    * D5 W: G: E  [- H  l9 S6 @9 q
  565. LDY #$10
    ' N' w: h  X. ]! v
  566. LDA APU_STATUS( L9 r% L& G. r: ^9 D+ p
  567. AND #$10
    ! B; f& ]' D& A6 I$ k9 F7 l7 L
  568. BNE Volume_Count
    ! D1 w+ h$ J2 Y. u1 g
  569. LDY #$00
    , h! g9 n# e( H& |1 _
  570. BEQ Volume_Count6 h* J0 f8 T' q  ]- i8 @  S
  571. ;------------------------------
    ; U% S( _! Y5 |' D( s  c
  572. ;音乐条处理) B  g' n, p8 }) O; f
  573. Volume_Convert_Ex( c5 z6 ]# f4 q& R, v( d( |
  574. AND #$1F  L5 G8 L) P( ]2 P2 A- T# B4 J
  575. TAY- O" n* `3 E3 a3 m3 `1 K
  576. BNE Volume_Count/ F. Q. r6 x5 {% G! D1 E, J
  577. Volume_Convert4 b' s  F( t2 c. e
  578. AND #$0F
    # M, u" A  @  K2 C' ]- F1 ]
  579. TAY
    ( ]! H: n( `+ u. d8 p8 t
  580. Volume_Count1 }( p0 a5 @0 n) Z% v$ Y
  581. LDA #$08+ |- A" |' ], r" w1 P: h" J+ s
  582. STA Sound_Bar_Cnt; k2 c8 \' c. a. l3 O
  583. Volume_FILL
    " i* u8 y. Q. e  l
  584. DEY) B7 T/ ^& D8 w: i" X4 r% _
  585. BEQ Volume_Half
    7 S4 I0 _8 r( L2 v0 [2 c+ t# C
  586. BMI Volume_Empty5 }. D; \/ _6 j! O  q
  587. DEY7 B8 k0 o( E& X
  588. Volume_Full% X6 ~0 [1 o, |5 P
  589. LDA #$16
    2 g: Q  N7 o' x& _
  590. BNE Volume_PPU! \# F; x6 \; r1 Y* o( k9 L# p4 ?
  591. Volume_Half
    - W8 [; \. i& d/ b6 E' v* ^
  592. LDA #$15
    - Z$ Z! u  U( j2 w# c+ U# K2 f
  593. BNE Volume_PPU
    3 S. C; d; O' P% S; f8 `+ U
  594. Volume_Empty
    * [/ ^- z& j" M! `: X; s% j3 V& k: [
  595. LDA #$14
    1 N) g* M5 }) g" q3 G6 z9 {
  596. Volume_PPU
    - j: _0 w" P0 r4 k  f3 s! A! t
  597. STA PPU_Addr,X
    % p# V' s6 G4 P
  598. INX
    % z  S% u7 {. K1 T% {" ~2 w7 p
  599. DEC Sound_Bar_Cnt/ H( h  d; R% W: ^7 F  W
  600. BNE Volume_FILL0 f4 _' M9 T4 I: _1 m" @
  601. RTS- I6 w3 W1 l/ d
  602. - G+ W$ ^1 y2 T# P9 H7 c2 G/ t
  603. .ENDIF/ l" C2 |9 a5 @% S  |" y/ d4 U6 u
  604. 0 n' N6 |, _0 N- q7 A9 C
  605. ;==============================2 F1 s/ a. d+ e# D) u' @
  606. PPU_Addr_Set;PPU行开始" l& x$ D( @! e/ @) e6 N9 N
  607. LDX PPU_Cur0 M9 g9 ?1 w( K2 R
  608. LDA #Mode_Line
    . y- y1 u2 K- O2 x/ f  _6 E2 Z4 n, R
  609. STA PPU_Addr,X; i: E& _" K; G- |) X$ D
  610. INX( E, c! M3 `1 {1 P
  611. RTS
    % f7 N2 q7 D3 ?5 C) I7 M& ^+ {

  612. + \: f- A4 |6 {6 A1 ]
  613. PPU_Return;PPU转行; _2 A' s* N: G1 O$ S+ e9 J
  614. LDA #Flag_Over7 e% h7 ]5 D. a$ j  _" T; R: r
  615. STA PPU_Addr,X: R& u% e8 L, z/ I" D% D
  616. INX7 G. i5 u7 b: d4 Z. f
  617. LDA #Mode_Return
    - g4 P% |4 O" |  `. }/ A' |
  618. STA PPU_Addr,X
    - e& F8 O0 Z. R+ h; u
  619. INX$ @; ?1 ~7 X& @  T- g, J$ z# ]+ S
  620. RTS' z, w8 ~- ^' s5 F% v
  621. 0 B  e  k" _; C- U" k* P/ F7 E
  622. ;------------------------------
    : D# e/ H9 w: T+ N
  623. PPU_End;PPU结束7 _4 R* A2 z$ \  T+ q' w5 [# ^5 G
  624. LDA #Flag_Over
    / A% L  G% s7 @) R1 z. P* Y
  625. STA PPU_Addr,X
    3 [& W  ?6 m# n  u( Y; _# W
  626. INX' k. q8 K- a6 V  {5 w
  627. STX PPU_Cur
      a2 q$ ]9 W" {9 C
  628. RTS
    1 H) v: h7 \  U4 }. J
  629. ;==============================: X2 k' u* ^7 M
  630. Mode_Line     = $FD    ;新起行模式9 i1 W- L1 R& r) T2 g( k
  631. Mode_Return   = $FE    ;转下行模式
    6 M2 b3 N9 O9 Z3 L, l2 a1 M4 J
  632. Mode_Clear    = $FC    ;行清除
    / {/ e  J  S$ Y  C
  633. Mode_CntLine  = $FB    ;行计数写入6 z2 w" p% L1 Z2 M$ B! A! y
  634. Flag_Over     = $FF    ;行结束标志% F! U/ D- e' [2 I$ N3 L
  635. . \& J7 B( L( O9 n- K. Z
  636. ;------------------------------
    1 g! u1 _6 B9 _( s4 H9 n
  637. ;PPU处理
    / F2 H' |3 L; c- g3 G3 O& C
  638. PPU_Proc
    ; H/ j9 j4 {, q3 _9 O
  639. LDX PPU_Cur6 i  _  L( N4 K% c. O: l
  640. LDA #$00
    + i; g- K: w" E
  641. STA PPU_Cur
    - X( t: y& ?6 x/ ]: o2 n& a# w
  642. STA PPU_Addr,X% }0 |: r; b% E1 I  a( X" t0 h% i9 b
  643. LDA PPU_Addr
    ' ?2 l7 s: {  N" X% x" w
  644. BNE PPU_Proc_Beg3 O% Z. K; }) }! N, j
  645. PPU_Proc_Ret
    & t9 E3 V: O/ G  j  b
  646. RTS' v$ ^: ?: i4 H4 P
  647. ;------------------------------
    . n" B, o/ A/ q4 S
  648. PPU_Proc_Beg  ;处理开始
    . k! `# w$ }# H+ c) G
  649. LDX #$00" q' K; ]; p: K0 @
  650. STX PPU_MASK
    # C: P# R# u% Z- B! i) w3 E' `
  651. ;------------------------------
    ; C7 G% o. [# m6 Y  i: H
  652. PPU_Mode_Select  ;模式选择
    : K4 }7 `$ W3 A8 l  P
  653. LDA PPU_Addr,X5 ~! L2 }) z' |4 D% W9 @
  654. CMP #Mode_Line
    0 r$ K5 a8 d# _, V
  655. BEQ PPU_Mode_Newline6 Z: h+ T1 h3 Q; \; u
  656. CMP #Mode_Return: t+ v5 t5 Y, o8 l* D7 w, t4 p
  657. BEQ PPU_Mode_Return
    + O7 _* _, I) Z) R
  658. CMP #Mode_Clear& i' b: s! f  ~- C9 g" R
  659. BEQ PPU_Proc_Clear/ C4 f, A  i5 F/ R, h: q! E3 @
  660. CMP #Mode_CntLine
    8 l( t5 O  I- g
  661. BEQ PPU_Proc_Cnt_Line/ E5 b1 y* _/ g/ U1 O( h% B
  662. RTS
    $ C3 @* m* h) G1 E
  663. ;------------------------------$ k  o6 x6 X: r9 u/ }% ^6 K$ H
  664. PPU_Mode_Return  ;转下行模式3 O( o+ c* q7 j. D
  665. LDA PPU_Addr_L
    - f  K) q/ L! m
  666. CLC
    , \8 a" j% S6 g. w5 W; p) k% G
  667. ADC #$20
    ; S- X8 M. c4 `% \  o" x) |
  668. STA PPU_Addr_L
    * N$ y6 J3 n6 R0 Z/ w! x: U0 C
  669. BCC PPU_Return_End
    9 |8 g% G$ w9 l! l% J. Y4 }
  670. INC PPU_Addr_H
    / g( V) Z( a7 w4 p$ K- i
  671. PPU_Return_End0 C) f# |2 Q$ {  o5 N
  672. JMP PPU_Set_Increaser
    9 V+ T! Q, K# v2 v( y3 L2 P
  673. ;------------------------------1 w$ y- I+ d( X, F
  674. PPU_Mode_Newline  ;新起行模式
    ( ^9 r9 S* d- f4 r% _! P
  675. INX8 g' n- y2 p1 h9 D
  676. LDA PPU_Addr,X
    / O! N6 U( t( N
  677. STA PPU_Addr_H
    3 Z/ c; X9 t4 Z3 q# I4 V; W/ A" I( r
  678. INX
    ) W( X: G  h$ h
  679. LDA PPU_Addr,X9 H+ c2 o& ~) a
  680. STA PPU_Addr_L/ _3 C$ O5 `# A1 n6 b" q
  681. ;------------------------------
    8 T" n& S( `6 a- ]& g
  682. PPU_Set_Increaser   ;设置写入地址
    * Y; i# W# s. e& _0 j9 L
  683. LDA PPU_Addr_H8 D& h! ]* ^  l# g- P1 _. ]2 j
  684. STA PPU_ADDRESS. m# @% j6 ?0 W: h) W% Y
  685. LDA PPU_Addr_L
    , j8 u0 W. J3 x( w* A  S
  686. STA PPU_ADDRESS
    + [& N, L4 i" k# H# ^
  687. ;------------------------------
    2 {( Y$ Z3 q2 @9 R- [2 c3 k
  688. PPU_Write   ;写入数据! t0 ~% S% W* X1 j0 o6 M
  689. INX$ v) @5 R& i% k; y9 [" @7 m
  690. LDA PPU_Addr,X
    8 H7 R2 i7 c  [+ |; a
  691. CMP #Flag_Over. K, x4 V) A  S7 H# k
  692. BEQ PPU_Proc_End% S4 n0 z- M: s3 z6 i
  693. STA PPU_DATA
    9 Z  y* {/ B  I+ o, V
  694. JMP PPU_Write$ D5 a# h6 @) c& q5 Y& w" x/ @
  695. ;------------------------------
    : i& A6 ]) H+ u7 {
  696. PPU_Proc_End  ;单行写入结束
    * R, x  o% a% {0 w- `9 g; i+ k+ ?9 `3 C
  697. INX4 w( l( ?+ `" Y" i, w. O
  698. LDA PPU_Addr,X7 f  s' n: b1 _. B' T0 b
  699. BNE PPU_Mode_Select2 k: u2 N% O8 u. X+ p- H- ?9 }
  700. STA PPU_Addr
    ! l7 t, ~  U2 N/ |* ~7 u
  701. JSR Update_Palette_Color7 e# i9 @4 k8 e- A) E$ F0 S/ ?% U
  702. LDA #$00; n- z) z6 Y9 z8 `
  703. STA PPU_ADDRESS
    - E1 N2 ~# A& d- R0 z3 f9 N
  704. STA PPU_ADDRESS
    + n- k9 R; D5 N9 I9 q" X
  705. STA Show_Track_Name
    7 T# y# D% q) @
  706. LDA #Scroll_X- O5 ^0 h1 F! f( T
  707. STA PPU_SCROLL) j# m# e" s. t! H
  708. LDA #Scroll_Y
    + n  u0 Y6 i0 t1 r
  709. STA PPU_SCROLL
    + f* s! Z- i+ @' N& j& j5 y5 Z
  710. LDA Screen_State
    " ~3 ~) q  a" [9 [: c% e% s8 \
  711. STA PPU_MASK+ g1 t6 O& _, G+ D, I8 J
  712. RTS
    + m1 D! b% V( q; J3 [
  713. ! N' s  A% I+ A  v( R( d: t: o  p
  714. PPU_Proc_Clear
    . U: Q# f% B4 n  ?
  715. INX5 e* Z8 x. o' Z' V
  716. LDA PPU_Addr,X
    1 T6 t. K; F7 V/ h! b8 |1 \7 G
  717. STA PPU_ADDRESS, f9 l+ f) Z4 r+ V- D, s
  718. INX+ V4 i  B1 J8 U% q2 W
  719. LDA PPU_Addr,X- H* d, ?! l0 d/ P4 k9 l
  720. STA PPU_ADDRESS
    - y9 O/ v7 G9 m
  721. INX/ w. W. T9 T% M( q. n% z: N3 ]
  722. LDY PPU_Addr,X0 m' C8 q# Z: z8 c: H+ j
  723. LDA #$00
    0 \- \6 z: N: D" X2 a
  724. PPU_Proc_Clear_Write
    " I/ {3 ?! u/ z/ _  e5 d, H; f
  725. STA PPU_DATA
    . X4 q! U! W# V. e* E. q
  726. DEY
    % n7 |* T1 _5 m9 t% O2 U* E
  727. BNE PPU_Proc_Clear_Write
    6 O# s1 f! K% ^' N) a( D+ ?4 K
  728. JMP PPU_Proc_End
    : B) G/ e; M9 T0 f& v
  729. , m2 {! v% ^6 W1 b
  730. PPU_Proc_Cnt_Line
    ' C0 u1 v" Q% v' ?7 d0 R4 q
  731. INX$ p8 G- c) b* e/ ~1 v1 ]# K* {  R$ i
  732. LDA PPU_Addr,X
    , ~! k$ V2 o8 q" w' {
  733. STA PPU_ADDRESS
    - v1 I) i$ i9 k* }
  734. INX+ v9 a# h: K" Q3 g; Z$ Y' p6 U
  735. LDA PPU_Addr,X
    : L9 a- R- j/ `
  736. STA PPU_ADDRESS
    : ], W# V/ [/ @& U( z3 ?( N
  737. INX9 i$ \& j: T- P/ b3 S; m5 ^
  738. LDY PPU_Addr,X
    1 u9 I  u1 r+ `. {
  739. PPU_Proc_Cnt_Line_Write
    " x; [. g0 |5 L; {* X7 X- p2 P# Y
  740. INX
    : `, @: A$ Q* N: t
  741. LDA PPU_Addr,X
    " d- |+ ^4 s, L4 j4 {& L! E
  742. STA PPU_DATA
    # _# K& l0 G1 t6 P0 M. M
  743. DEY( h- x% {% D! O; C
  744. BNE PPU_Proc_Cnt_Line_Write; b+ W+ D, a  k5 A% m
  745. JMP PPU_Proc_End' L( O, B6 l6 Q/ K

  746. , O4 l, g6 H) m, m) T
  747. ;==============================
    # x; ?6 @( D- @+ h
  748. HEX_To_Dec;十六进制转十进制$ {8 ~* d$ j# \7 j# I9 B, [
  749. STA HEX_Data
    9 c; K! |8 _8 s' P
  750. PHA
    & }7 x6 H" X$ N" n, H
  751. TXA( W0 z8 L( y& S7 u* E+ b
  752. PHA3 M0 ^  `- ]6 I& j& L6 E
  753. LDX #$009 A7 b' j3 }* l- u' n' J; K
  754. LDA #$00
    ; [! M; p2 W3 Y( O, o
  755. HEX_Cln6 Y( `+ Y2 [  a6 U
  756. STA DEC_H,X6 h) |7 }; d1 Q# a
  757. INX
    3 s) k. ?( O5 u4 u0 ]& R
  758. CPX #$03
    $ ]; W! r6 _$ I! H% x' ~. C. }
  759. BCC HEX_Cln  O8 I/ s, N; g; [
  760. LDA HEX_Data
    2 Z8 U- a8 I2 Y* z
  761. ;------------------------------6 T% R. K2 r) m# I. j, B
  762. HEX_100
    1 N  _) u5 b7 p2 H. Y
  763. CMP #100
    , F5 j/ [9 }5 K$ G+ n" `3 M
  764. BCC HEX_106 g3 E) i3 {# _
  765. SEC
    ! D1 M" Y* _! n  J+ [; X; E
  766. SBC #100. x3 i: m5 z; |$ a2 \7 y! ~' M
  767. INC DEC_H8 B! f1 Q7 `4 k( a* V( ?" G
  768. BNE HEX_100
    & \; }+ u! l3 v' a) g
  769. ;------------------------------
    6 V0 a( u1 m9 z/ W9 g3 C
  770. HEX_10
    $ p/ s2 K! e& k6 |
  771. CMP #10
    . F! N2 C% r0 V8 T, w- _) I6 t
  772. BCC HEX_14 R% o' r, a: M
  773. SEC
    + L( b8 H' `$ [* D( c9 t
  774. SBC #10! w) r( @, o7 v. P
  775. INC DEC_T( r3 ]2 U4 A4 l) Y0 |+ d  V
  776. BNE HEX_10
    5 ]7 M5 }' ]7 H/ |0 j
  777. ;------------------------------
    9 k0 h2 X0 D9 S8 M  [
  778. HEX_1
    2 X5 |6 L, M% l8 d7 ~
  779. STA DEC_L
    7 l7 O! @- S5 ?  K. ?
  780. PLA" ]! @" p: z$ J9 I
  781. TAX) y! ?$ @  {; G
  782. PLA
      R: N5 o% O! w2 [' g  b% y
  783. RTS
    / S4 V; ^3 S$ L  Z3 O+ Q& R! B7 s' M1 @
  784. " ?! ?" g* i' a( _& V
  785. ;==============================4 m! J& U6 ?# c8 ^* t$ L* G
  786. ;音乐曲目显示
      S2 |5 I- C5 ~: W' x
  787. Music_Show- A6 m& X* k8 C5 a
  788. LDA Music_Cur2 W" d' x' f0 ~. U2 F
  789. CLC
    - ^+ O; X- b# U% Z4 Y
  790. ADC #$01
    / k% P3 N) e5 W! z+ H4 \  c
  791. JSR HEX_To_Dec
    ) M  a! n# N# W! ^! F6 Y* C: k
  792. LDX PPU_Cur
    ) V( v7 A& K- e7 ~3 w
  793. LDA #$FD
    : l" _) g% C8 \8 x# z; |+ U: t$ @
  794. STA PPU_Addr,X+ H7 Z' o# l# D. j6 d" r. w8 [
  795. INX
    4 Z# Q# B( ?5 {9 |3 R! i
  796. LDA #HIGH(Play_Index_Pos)
    0 V" }3 }1 X) g+ k* U
  797. STA PPU_Addr,X
    9 [' L' c& `. L3 Z" C- A) h  y; k
  798. INX- L, I5 |/ D: [7 l9 z
  799. LDA #LOW(Play_Index_Pos)
    3 J% _; K2 _: f1 J) p6 r; ]9 c' `
  800. STA PPU_Addr,X1 J3 f$ @  w, z5 b1 Y
  801. INX
    ( \0 G: I; Q7 ~! d& {! d
  802. 6 X7 [: w4 J( t1 A' t% c
  803. .IF Music_Song_Total > 99
    $ L8 {* ]8 M5 ^1 V; b. l7 w
  804. LDA DEC_H. ]% v! m# l" V" ?1 Z* H
  805. ORA #$30
      B. K( i$ |3 z" N  |
  806. STA PPU_Addr,X
    3 o# C8 K! F6 b8 b* L% v  ?
  807. INX# S2 x) e& u3 J" Y
  808. .ENDIF
    6 @/ M# z4 t/ n  x/ r+ {; P

  809. 3 C; Y& ]- D$ x# J
  810. .IF Music_Song_Total > 9
    & H: v9 z" H3 o& d+ e* L
  811. LDA DEC_T9 {& h# G$ j( x$ A
  812. ORA #$30
    $ g6 _) l# A& h9 h# ^( I
  813. STA PPU_Addr,X
    4 z, i/ w& `1 Q) n6 B3 k
  814. INX
    1 v1 i. L- e6 s+ Y3 C& U
  815. .ENDIF
    # A  x, v, Z$ F- A: p

  816. 3 _  M& h+ `$ U& B
  817. LDA DEC_L
    0 h" _& N1 R; I. B- t) Q7 s' K' v& @" i
  818. ORA #$30: C8 w3 o# }8 |1 x2 X" R0 L3 ]
  819. STA PPU_Addr,X
    $ j3 d$ I6 D/ ~" x$ }
  820. INX
    2 {( {: v2 n: d
  821. / z8 k# ^- i8 w' S# y* L" s# R
  822. LDA #'/'
    5 r' S$ a$ R2 M  d3 \
  823. STA PPU_Addr,X: s! A& }- P  F9 C# {
  824. INX, k1 c; }& o. ?- a
  825. Music_Show_Total0 a4 |+ Y5 @4 _
  826. LDA #Music_Song_Total
      Z: o$ T3 x7 h" B+ d6 M" v
  827. JSR HEX_To_Dec6 U. R; _$ n& S4 F3 Z" @/ q
  828. $ L" c0 B  f! T2 W  j! D7 S
  829. .IF Music_Song_Total > 99
    2 L- g( l1 g) p1 `" u
  830. LDA DEC_H! T/ Q! e/ b$ h8 F
  831. ORA #$30
    : m- ~# N0 H% V" W
  832. STA PPU_Addr,X  L, W3 f+ @8 C; h% Z! n9 i& A, J
  833. INX
    * v4 Q& R- I, \3 `" R* b/ B$ H  R7 U
  834. .ENDIF
    ( n& t( m9 ^; z4 t

  835. 2 r  n3 m! c9 l# o* @/ S. @( r1 I
  836. .IF Music_Song_Total > 9
    9 y$ I: t2 c! V' }( i" R) L9 ?
  837. LDA DEC_T
    / w, W4 a% U0 h% |1 Q2 p: q- _
  838. ORA #$309 F. n: r# M) C
  839. STA PPU_Addr,X  \; ?* U" \# z
  840. INX
    % c4 C, H7 `9 p
  841. .ENDIF+ \6 U' ]! z1 `7 Y6 |1 U- S

  842. - `$ j8 n) E  O. q$ x+ o
  843. LDA DEC_L
    8 |  S$ b+ l- O" X; V5 @, Y
  844. ORA #$30
    : M- ~8 m" U( h2 m; i0 Z7 y
  845. STA PPU_Addr,X! ]$ G7 Q; V" X, o, G
  846. INX
    ' Y( i& A' ~5 X1 g2 ?( c  s" x# V( f

  847.   J$ }' w% D$ @, u! a* D/ u9 Q
  848. JSR PPU_End
    8 k3 V+ u/ R2 F, @3 c& S
  849. Music_Show_End
    , B. B! }$ ^- t5 E
  850. RTS
    ) y7 `: ~7 p8 H9 r" g" D

  851. ; ^: P$ K: Q3 }
  852. ;==============================
    , D: q; _( b4 S$ _
  853. Time_Show;播放时间显示% D  s5 j- T/ q3 \8 y/ e! I/ M; B
  854. JSR PPU_Addr_Set; e# b( R( d1 i# c( T9 G5 J
  855. LDA #HIGH(Play_Time_Pos)
    ' {$ U" f9 f: A  C3 x  s1 ~% @/ U
  856. STA PPU_Addr,X) S1 O2 M* V$ `( Q* J! k5 O/ n
  857. INX4 }7 s. J3 m) y* |) Q
  858. LDA #LOW(Play_Time_Pos)9 f. j" r$ k2 E1 G5 A
  859. STA PPU_Addr,X
    * [' N( ^( ~7 C3 N3 I% e) i( k9 C
  860. INX% {3 ^8 f; ?' q# [5 _$ F7 `
  861. Time_Show_H' L7 {  J4 M( r* p! b1 Q- w
  862. LDA Time_H
    , z7 D# m8 k' B0 ]7 E6 k9 I" {
  863. JSR HEX_To_Dec
    7 O4 }% D0 Q7 h5 l
  864. JSR Time_Digit
    1 F; I7 u7 l! x! c4 E7 V
  865. LDA #':'0 ?3 V% j2 S4 Y4 ?; y
  866. STA PPU_Addr,X
      \' w' @6 `! y8 N* g8 Z
  867. INX; ~. o- v9 K* s  g+ I- g
  868. Time_Show_M# m) M$ i3 w' L: v, S
  869. LDA Time_M& p* G. L  B' D0 ^* n( ]5 x! E
  870. JSR HEX_To_Dec
    ) J9 q4 X- B' D, f
  871. JSR Time_Digit
    ( N. Y8 t. j' o% e" ]! L
  872. LDA #':'
    ! d5 R5 U! H1 x; c6 }' b6 u
  873. STA PPU_Addr,X
    - H8 s4 m% a& h! {! ~. G
  874. INX
    + m; \  L( K2 M" x0 K2 M
  875. Time_Show_S
    ! K7 W7 |0 J; a$ K
  876. LDA Time_S
    4 k6 `2 V+ q* M
  877. JSR HEX_To_Dec& @! K1 i3 E9 j8 x( s# B' p2 V" R0 Z
  878. JSR Time_Digit0 [2 m* d" u+ r+ i" f1 I- R
  879. JSR PPU_End+ c. o" x8 `) X0 g
  880. Time_Show_End! y/ r5 r! A1 S8 ~9 F
  881. RTS  t8 y$ m5 Y  g
  882. 5 n/ \5 o, H. p3 }+ D) s
  883. Time_Digit
    " H) U6 }: t3 j$ S4 L! ]6 L
  884. LDA DEC_T7 \/ P! K" f0 D# u# Z4 I0 M. h. X
  885. ORA #$30
    ; n2 H8 i# _8 V) h
  886. STA PPU_Addr,X
    & O7 r0 R& c: X- T& j
  887. INX' \0 \6 t4 ~# W( m
  888. LDA DEC_L
    + [% n) q# i) {; N9 e: X
  889. ORA #$30
      ~# a# K8 s4 |( k) y, F
  890. STA PPU_Addr,X% s' x" }8 T* l6 }3 Z
  891. INX
    * k! L- ^7 ]& c2 o  M
  892. RTS
    3 G" U# X2 G' j% |7 }+ g/ ]

  893. # u* \1 D! L. U! M( _8 i: o
  894. ;==============================' B! X) G# M- K& A* d) z! b: F2 n
  895. Time_Count;计时! C8 |3 E& D, g0 V- z
  896. LDA Music_State
    - {- P, Z1 S( M% X6 k
  897. ORA Time_Wait_Cnt2 E# K& V' q# e" B4 `
  898. BNE Time_Count_End9 z# Q4 c; m  I* ]
  899. INC Time_Cnt5 r$ K1 a: _: p3 p& C7 d# ^! X
  900. LDA Time_Cnt
    ; c! l! J) y8 ^0 n$ ]) W# p
  901. CMP #604 U& `, ^, c9 U- T" d
  902. BCC Time_Count_End
      [: e' V. g* Z! n
  903. LDA #00& r. e4 b% @9 v: w, z2 Y5 ]# _# d
  904. STA Time_Cnt& X" x$ G: P8 l+ m
  905. INC Time_S
    0 e- u2 z) E' q7 f7 `4 s; ?
  906. 7 F9 J& H. O& c; G3 V2 B
  907. Time_S_Cnt
    . J& D  D- `. j! c! z
  908. LDA Time_S! e) o, V2 v/ L4 G; R! n' Z0 W
  909. CMP #60
    ; W( q0 h2 g: B% h  {
  910. BCC Time_Count_End
    + F6 N# q$ Y2 r# }( G
  911. LDA #00
    $ K/ R+ e2 {+ |
  912. STA Time_S0 u5 o% A$ _# L' I) _" M
  913. INC Time_M
    8 y. z& J5 N- I- |4 d6 v: m
  914. ) k, h% p2 O7 Y9 n. Y
  915. Time_M_Cnt4 A& G, l0 R! P: H) o3 q) _6 U
  916. LDA Time_M
    ) z. r+ r2 M; O( w8 w! o
  917. CMP #60
    0 b0 l( S7 a, e, Q* M
  918. BCC Time_Count_End
    : ?/ Q  S0 w+ p6 ], e2 l, k7 H( N% \
  919. LDA #00+ p. ^" p9 E6 z0 A5 g
  920. STA Time_M
    2 n& J7 {" U; t1 B% f( t9 M) ]4 j
  921. INC Time_H
    ! u) R7 ~# x/ B- S9 A/ M

  922. & s4 M7 I, V( i
  923. Time_H_Cnt" O" S5 B# _4 ^& o0 O
  924. LDA Time_H4 y1 l6 c5 g: \) Z4 Z
  925. CMP #24
    ) s0 i+ ^/ z8 n' v
  926. BCC Time_Count_End
    5 `  U7 G2 C3 |
  927. LDA #00
    * T7 `( d' T% ~2 L% S/ x) s& U
  928. STA Time_H0 O, h) {8 g, m9 d# \7 I1 o

  929. & A. j( e$ Y; t% m& z. T$ k
  930. Time_Count_End$ L& {* K  @7 {) Z0 I# \1 Z# _9 n3 u
  931. RTS
    $ u  |+ X8 Q* s  N5 r3 B
  932. 0 m7 r" O* X# J
  933. ;==============================
    $ Q0 J2 C( h' c. k
  934. Time_ReSet;播放时间重置
    + i5 Z: D3 Z- Z# `
  935. LDA #$00* V8 a6 E# G8 Q5 B
  936. STA Time_S" O9 Q$ {( P! c* r+ Y+ O6 N2 T$ A$ s
  937. STA Time_M ! ~/ y# K& Y/ w& M' T
  938. STA Time_H
    3 i* i/ \- Q  d- d! [% Q3 ]; y
  939. STA Time_Cnt
    2 C/ ~& v+ C, |  A/ g7 _; @
  940. RTS5 l+ ]/ \; K% q2 L) M& h

  941. 5 o+ g3 h$ i. z3 B# k, @
  942. ;==============================$ \0 F) R( P  m$ K& ~# K' M! Z
  943. Music_Bar_ReSet;音乐条重置& l7 j' {; Z( H- J7 X9 j' S) `' `6 ~
  944. LDA #$00" z: u' \! y$ ]: _9 I0 v+ b
  945. LDX #$00) `1 r/ D9 ^/ @
  946. Music_Bar_ReSet_Set& D! J2 D2 c; y& C
  947. STA Sound_Bar,X
    & a7 t- A( Q- |- H2 v
  948. INX
    9 S2 l* z% F! r! v) |% \6 w: ~5 X( [
  949. CPX #$10
    $ {* n- N! X  a" a" i+ V
  950. BCC Music_Bar_ReSet_Set( }/ h+ a; S7 C: y- _+ N
  951. RTS4 A4 X% c5 B. M' j" k) ^) J: e
  952. - y7 y- }* f% h, \% }1 m/ U
  953. ;==============================& S# `7 f3 r5 A5 u( T! E
  954. PPU_Data;PPU数据写入: |. G$ L( o0 u' W
  955. STY Data_L: K" B) O) Z: P  k+ s) `# ~6 _
  956. STX Data_H. n$ U6 B  ~3 _4 W8 w
  957. LDY #$FF- A+ [/ W8 x8 ?3 r2 X8 Q5 `) p
  958. LDX PPU_Cur, Y8 l2 q; s, d  y: _4 ?2 K
  959. DEX5 O) H  R1 }" W; f( B' N) \$ q% _
  960. PPU_Data_Beg
    & a) B1 v$ P& q6 q1 k; h
  961. INX/ C7 L& f! L) d( \# h9 b
  962. INY
    " H3 ]- ^" K0 |3 s- s: |
  963. LDA [Data_L],Y/ p1 r* ~5 q9 M9 Q- L
  964. STA PPU_Addr,X
    3 Z1 V7 [6 _8 ]) ^/ q8 Q7 y6 B3 F
  965. BNE PPU_Data_Beg7 _* n* a  e4 [& d2 H
  966. STX PPU_Cur; F" _4 r3 g  m: t' Y1 n
  967. PPU_Data_End; z9 W& S; n  Z
  968. RTS
    4 v1 H% k* ]. O

  969. 1 ]" o) {5 M5 q: o$ ^( Z
  970. ;==============================8 l8 j- @* {4 A1 P; u
  971. Music_Stata_Show;播放状态显示
    0 Y. _2 i) }( T# c" `% \( W
  972. LDA Music_State3 c8 U2 e3 H2 s# ]' e) ~+ ^; M
  973. BEQ Music_Stata_Show_Play
    6 Q. v; E9 O4 h: J+ V  K/ H9 y
  974. Music_Stata_Show_Stop
    ; b6 A+ Q& e4 D4 S; X7 e" \- X
  975. LDY #LOW(Music_State_Stop)6 x& G+ }, S: P! s
  976. LDX #HIGH(Music_State_Stop)4 u6 R2 x5 c- f' |- }, A
  977. JSR PPU_Data
    ; U* r! V/ f$ o! s! u6 X
  978. RTS
    1 \2 X1 f. S- S% P1 g$ R
  979. Music_Stata_Show_Play
    - M& a6 Y" ?% a2 `% p
  980. LDY #LOW(Music_State_Play)  E$ K# @  r1 ^
  981. LDX #HIGH(Music_State_Play)/ |( P$ a2 V7 \; b
  982. JSR PPU_Data' {% g* x& N! s7 `: I
  983. RTS' P$ C* \, J( E8 ]0 D
  984. ( O0 h  l0 h( m  r% \9 x5 l
  985. .IF SOUND_BAR_SHOW_ENABLE
    4 Z3 Q7 [5 B4 X/ v
  986. ;==============================
    * }9 [5 l7 E6 s: ~
  987. Sound_Bar_Text_Set;标题与音乐条初始化
    3 N9 K- g! I1 q7 t! p
  988. LDY #LOW(Sound_Bar_Text_Data)/ o+ e6 B4 U2 f1 _
  989. LDX #HIGH(Sound_Bar_Text_Data)
    # c& B" y8 _- H5 [8 r2 U7 o
  990. JSR PPU_Data
    7 t; j8 ~+ O3 d) k
  991. RTS
    ! R6 a+ ^6 j4 e, Q5 q

  992. 3 ~5 A9 z' q: n' v4 l$ M
  993. .ENDIF" `0 H) j1 U% {; D

  994. : C( y. A5 U. e* _
  995. ;==============================' ~7 i3 R" h; k, e9 X& S: }
  996. Set_NameTable_Attributes;设置命名表属性
    ) z$ J( j3 N/ W9 f
  997. LDA PPU_STATUS
    9 `5 j. Z1 S" |- T7 W/ {' j( L
  998. LDA #$23- H& {7 Q. \& r9 W# n; l
  999. STA PPU_ADDRESS
    0 u3 P) ^- f% h! B8 k
  1000. LDA #$C0
    $ n4 w' F: K. q" E; w% t1 {$ {
  1001. STA PPU_ADDRESS0 I8 I+ j: X3 T: Z- \4 J
  1002. LDX #$00
    5 z8 z( L/ O" g! E3 P# o
  1003. Set_NameTable_Attributes_Write/ h/ O4 P2 _1 ], ]2 l
  1004. LDA Palette_Attributes,X: K5 g* |' o* g% O7 J; g
  1005. STA PPU_DATA8 M+ n+ v8 w! `! t1 `7 _4 ]" i
  1006. INX
    : m% _0 Y& y7 [8 M- @
  1007. CPX #$40
    - J. }5 K5 n7 j- y2 U1 k( m( z
  1008. BCC Set_NameTable_Attributes_Write" |% K) z% @7 O% N* w8 V1 |
  1009. RTS
    5 ?. M8 }2 z; Z2 t) C  j  u
  1010. ) {  e4 y& G1 [, i
  1011. ;==============================
    - x* y- E) ~3 W; A0 K' ]/ a
  1012. Set_Palette_Color;设置调色板数据7 T9 I( h5 Y; ?$ b; `
  1013. LDA PPU_STATUS
    - z/ r6 T. x  ?% S0 ~2 n
  1014. LDA #$3F
    * [+ g' T" `1 x8 `' t
  1015. STA PPU_ADDRESS) C1 P- ^! X. Z  x2 W. l3 P! N  O9 `
  1016. LDA #$00: _- b7 {* M% W( e2 G
  1017. STA PPU_ADDRESS
    * v4 r; Y( y. a
  1018. LDX #$00
    * {8 Q7 d6 K% V: |1 {; D
  1019. Set_Palette_Color_Write; `& \+ I% e6 V6 A. T( X3 k# ^
  1020. LDA Palette_Data,X  B$ _7 ~+ R+ M+ g
  1021. STA PPU_DATA( k- v6 X8 B" R) W; O
  1022. INX/ w# q* y0 g" E6 v: E' l
  1023. CPX #$20/ E7 Y+ j5 s+ N- s+ v9 @- o1 U' @
  1024. BCC Set_Palette_Color_Write
    : E( O# W6 P% D5 v& O& A
  1025. RTS/ i5 R; J; z0 _; ]4 o0 h. t

  1026. & Y$ c' E  P# y* b# \. P$ w
  1027. ;==============================5 H7 ~" i' x) u$ l- O# {
  1028. Init_Palette_Addr;初始化调色板数据' U. m" f. r( A1 L
  1029. LDX #$00
    % Z5 E. ]; D4 r" \9 m
  1030. Init_Palette_Addr_Write
    ( g) S4 z6 H# A3 M2 g
  1031. LDA Palette_Data,X
    ) `9 B9 E: ~+ P1 Y% F6 b$ Y# j
  1032. STA Palette_Addr,X
    / q, I3 e: F: ]) `6 A, l2 o) _8 \! @
  1033. INX8 w! S8 f3 _) g% ~# u: A& c! g
  1034. CPX #$20: T- G1 R1 Y" s$ Y
  1035. BCC Init_Palette_Addr_Write
    % B/ ~8 ^  ?, p* i
  1036. RTS" B4 @5 v/ F6 W/ Z7 F
  1037. . E. Z8 _- ^% y+ s
  1038. ;==============================
    & J" l6 S1 J7 w- y9 |# z) B
  1039. Update_Palette_Color;更新调色板颜色- d& e: _) [' _; N  E
  1040. LDA Show_Track_Name8 |: z! O4 O6 |& W9 ?4 w
  1041. BNE Update_Palette_Color_End) b) Y* [: ^$ T( M; \
  1042. LDA Palette_Update_Flag
    ; G% p$ A  j* @
  1043. BEQ Update_Palette_Color_End. I8 h8 L: x& N4 E$ U) y/ E# u
  1044. LDA #$3F
    $ K8 z, ]2 P; ~9 x- a# E, x7 t' Q
  1045. STA PPU_ADDRESS
    " J  |2 c5 x& r* t8 ^
  1046. LDA #$00
    . K" t+ \  c& I( `( m( m* ^+ u
  1047. STA PPU_ADDRESS
    5 ?: \. f9 _( e' [* `9 \
  1048. LDX #$00
      m4 a7 t3 I" N1 W: y% j6 E
  1049. Update_Palette_Color_Write
    8 z* d' l( o* ]
  1050. LDA Palette_Addr,X3 m* Q+ x8 d! M& Q
  1051. STA PPU_DATA
    * D1 P$ Z9 E5 O$ \+ s9 X9 @  s
  1052. INX
    4 g6 B9 d8 ?5 v- s5 ]* g/ x
  1053. CPX #$20
    3 ~# i+ S! A: ^, z
  1054. BCC Update_Palette_Color_Write( O: e% J7 R* ?
  1055. LDA #$00
    / ]7 J! E0 P, m' Y8 ^+ Y0 ?
  1056. STA Palette_Update_Flag
    + R- T$ Y/ m0 p( ^3 ^4 S4 S
  1057. Update_Palette_Color_End
    & a2 q( b$ b$ ^
  1058. RTS8 a4 D3 q2 R2 t' c8 T
  1059. 7 K# ~/ ~: f$ m3 b
  1060. ;==============================5 G- {9 q2 w8 D" \
  1061. Update_Palette_Data;更新调色板数据' j' I$ x' j, Z: Y5 ?- _
  1062. LDA Show_Track_Name
    0 J) v2 a8 L, V5 n% \5 ]
  1063. BNE Update_Palette_Data_End
    $ `1 ^) W# I6 G+ n3 Y* \5 y. X
  1064. LDA Music_State
    2 W6 G" v2 m# _1 A0 o% J( J
  1065. BNE Update_Palette_Data_End3 T. S5 s( C: J. [& a# v
  1066. Update_Palette_Data_Check
    ! x' z& r* L; P, D
  1067. LDA Palette_Wait_Cnt  C  k. y% }4 ~. X8 C
  1068. BPL Update_Palette_Data_Check_Over  t# B% I6 l, s8 J
  1069. LDA #Palette_Update_Interval
    ( i2 S$ A: U( H6 s$ L( T
  1070. STA Palette_Wait_Cnt7 ?0 v9 B$ w5 T( N0 X( D& H7 F: A
  1071. Update_Palette_Data_Check_Over
    $ x- \& A$ z* c0 X3 x
  1072. DEC Palette_Wait_Cnt
    % p' ?1 ]% z, A( a6 q7 m
  1073. BNE Update_Palette_Data_End
    " L2 f% H, }+ a; n0 n2 F
  1074. INC Palette_Update_Flag. B4 a* @. z' w0 W
  1075. LDA #Palette_Update_Interval8 A6 x5 V7 _$ s& c# W
  1076. STA Palette_Wait_Cnt3 V+ E& l* y, D" ?( X
  1077. LDA Palette_Update_Addr
    # H' _* T0 {1 j% Y8 ^; C+ i6 j
  1078. CMP #Palette_Update_Max6 U$ o8 O4 h" e* p& ~; Z
  1079. BNE Update_Palette_Data_Set6 z8 C8 r9 y4 @; o5 a0 Q4 d0 @
  1080. LDA #Palette_Update_Min - 1
    $ z, a  w: T1 n' O; x) A: O% U
  1081. STA Palette_Update_Addr
    ' S: P. h* n2 ^2 J- K2 X( _' I
  1082. Update_Palette_Data_Set
    $ A  ?' F' O. \) r' ~3 o6 J3 u
  1083. INC Palette_Update_Addr
    ; C& P/ d) @- e! d7 ~) S! s! N
  1084. Update_Palette_Data_End  w, Q0 B5 K; D9 Z% J" g; E
  1085. RTS# A+ v/ ^3 h( `- }$ x4 o
  1086. 3 [% x$ _9 x! F% }% Q& f; c/ e; M6 J
  1087. ;==============================5 k9 S6 S/ ~# E; M
  1088. Show_Music_Text;显示静态文本9 q0 H: T9 f2 }2 g5 N  ^, E
  1089. LDX #$00
    2 Z9 \  E. a1 i- N& S3 [0 k
  1090. Show_Music_Text_Set
    2 g2 H# p7 t( Q) ]7 H  g+ Y
  1091. LDA Static_Text_Data,X
    * E9 L3 |2 p" V8 L; }# }9 l
  1092. STA Data_L
    8 i& p5 H; z. ^+ j
  1093. INX
    % L: C6 W, U3 L+ H5 b
  1094. LDA Static_Text_Data,X3 A5 L3 r& b, c( y; p% q
  1095. STA Data_H
    6 n2 [- @1 Y# ]: `0 j: G1 q( Z- r$ ~
  1096. INX
    2 |; y. _; n2 ]. F0 [% {$ O6 s, h) T+ J
  1097. LDY #$004 R9 K0 J7 }3 r$ k( H& \
  1098. LDA [Data_L],Y# y- P% r- n/ ~
  1099. STA Data_Cnt- u3 k6 @0 r) G; i0 t
  1100. DEX( q" m& }9 d% h! W
  1101. DEX; ^8 H' m% V+ o
  1102. LDA Static_Text_Pos,X
      G" \4 _: m. _2 m$ Q
  1103. STA PPU_ADDRESS+ Y4 X! s- h8 D: X. ^
  1104. INX+ q. E+ A& E! {
  1105. LDA #$20
    + {( O$ t6 v$ Z2 m, ]; u& ~
  1106. SEC# J( K8 @  p* _2 Z
  1107. SBC Data_Cnt) Q$ h4 Z4 f6 p9 V# _4 y
  1108. LSR A2 n1 r$ x: d1 ?7 B  ~- H
  1109. STA Data_Buf
    ! B/ e* K- K/ o- x
  1110. LDA Static_Text_Pos,X3 b4 f4 H( T' c: }* N) }9 v$ Z
  1111. AND #$E01 u& f8 F7 j" N0 A+ a( A2 ?
  1112. CLC
      z2 d6 A$ Z- y6 f% Y1 a5 s7 `
  1113. ADC Data_Buf* L9 h# |8 B9 h/ ]3 W  G
  1114. STA PPU_ADDRESS! h, l3 n/ O' o' ^! M: C4 }
  1115. INX
    6 t% [9 O" j4 F# T
  1116. Show_Music_Text_Set_Write% Z% @, F& q  F) N1 w, w
  1117. INY. Z+ V  S8 s: D$ b; t( _5 d. o& y
  1118. LDA [Data_L],Y/ ^& S: t) T, p9 s5 T
  1119. STA PPU_DATA- T# j+ T: E+ s. g6 {2 K
  1120. DEC Data_Cnt, E$ L% p) v1 A/ W' Q% l' h5 A
  1121. BNE Show_Music_Text_Set_Write
    4 _7 d6 Z  o# }( E' N
  1122. CPX #Static_Text_Pos_End - Static_Text_Pos
    ; E0 E) B9 n5 V( d6 c% ^
  1123. BCC Show_Music_Text_Set
    3 e" p/ S8 {# O- r- {5 D5 {* n. ^
  1124. RTS* U& F; Z) G% b/ V' C4 B
  1125.   ~; I+ N! [) C5 q
  1126. ;==============================1 \  X% k+ G- g0 U- g
  1127. .IF Track_Name_Pos;显示曲目信息
    $ M$ Z- J; s1 g9 d# }
  1128. Show_Track_Info9 d( L, _' B! @- r' I
  1129. INC Show_Track_Name9 x: z! ~5 }3 d/ S% F
  1130. Show_Track_Info_Clear
    9 `- ~8 S( C, v( e+ m2 e
  1131. LDX PPU_Cur' K0 k, u' F$ ]! y1 w
  1132. LDA #Mode_Clear
    / w% l( ?; f1 r- Y
  1133. STA PPU_Addr,X
    , H) V6 R" d8 }+ x; T8 F; C' ]: y
  1134. INX
    ) Q' |& G4 _/ V2 y; k  l! E3 c; i
  1135. # h+ Y; u/ }( Y$ v9 i! N
  1136. LDA Music_Last
    8 e. Q" `6 @! _1 o' _7 q$ z2 T
  1137. JSR Show_Get_Track_Name_Center_Pos
    + `7 u3 H6 e; x
  1138. Show_Track_Info_Write_Cur& l# J; [3 p8 _$ N
  1139. LDA #Mode_CntLine( {! V" N. {- m' q+ [4 P. m" O/ O
  1140. STA PPU_Addr,X; k6 v7 |9 @$ w
  1141. INX
    5 x3 ?; i# \0 {" r- M' h& R+ @

  1142. 3 i) o8 m. ^! k9 O
  1143. LDA Music_Cur' x1 S" i) f$ h  p
  1144. JSR Show_Get_Track_Name_Center_Pos- A, e0 }7 Q2 L2 T" @1 ~+ s

  1145. ) X+ a3 q" P/ O/ j7 @% u
  1146. Show_Track_Info_Write_Cur_Data
    9 N7 W! I6 c2 L
  1147. INY- f. c) ]* x) d1 U: D+ m1 [6 ~" H- U
  1148. LDA [Data_L],Y! D6 [& H! Q- E8 G0 H$ }
  1149. STA PPU_Addr,X! j* Y$ W7 Q4 Q! P, j( m% L
  1150. INX
    * a8 n; a' g: d, L8 S
  1151. DEC Data_Cnt4 r* n- u8 H! g+ r# o% @' C& u
  1152. BNE Show_Track_Info_Write_Cur_Data+ g' k$ _0 ?% o% ^6 o+ W. v" |3 H
  1153. Show_Track_Info_End+ K7 V! k# }4 @4 k9 H
  1154. STX PPU_Cur! j% E: R% L* Q% c- L* [7 ?
  1155. RTS
    - u8 ]! u. I  ]4 e& N8 h0 M9 r9 j7 I
  1156. 6 X  G) h) B9 [
  1157. ;==============================4 U( w/ M+ |4 w! x
  1158. Show_Get_Track_Name_Center_Pos;获取中间位置
    7 j3 ?( b( n$ Q
  1159. ASL A
    9 |2 d0 G1 l1 f& l/ R; a( f
  1160. TAY$ k1 Q2 Y  y5 J% K1 Y
  1161. LDA Track_Name_Addr,Y* v- \5 M# |  h+ U
  1162. STA Data_L
    0 S& j7 q. ]2 E6 E6 n  x7 N
  1163. INY
    6 j0 Z- n# S7 \/ E6 ~: a
  1164. LDA Track_Name_Addr,Y
    ; K' ]  {5 P+ m5 @8 S8 v
  1165. STA Data_H, r( e9 y& O! Y6 N4 S. P
  1166. LDY #$00
      I1 u8 X5 s( m2 N$ T$ R& v$ L
  1167. LDA [Data_L],Y
    / Y! o9 Z$ P, h2 P$ ?$ H$ @
  1168. STA Data_Cnt
    & N8 f; w  r% V
  1169. LDA #$20
    - g& k6 r8 t8 [; X% f
  1170. SEC$ `6 S! N- k# i& ^
  1171. SBC Data_Cnt8 G) n6 P' }; o3 H9 \# m5 s4 z
  1172. LSR A0 |  @& F' C; F2 T( q& H
  1173. STA Data_Buf8 W: O% W8 P% ^8 C
  1174. LDA #HIGH(Track_Name_Pos)1 W" ^0 b" V8 k7 h/ G4 M
  1175. STA PPU_Addr,X
    : M1 }6 h; |: p9 C
  1176. INX
    5 N, I1 k8 X2 A  Y
  1177. LDA #LOW(Track_Name_Pos)! }( X5 `5 k4 {0 @3 X, ]9 x
  1178. AND #$E0. v, n( `6 h9 W  t
  1179. CLC2 ]% k3 z6 `% I( d; `
  1180. ADC Data_Buf
    ( q5 F* C: Q& [3 R
  1181. STA PPU_Addr,X7 U. u# M+ ^# d" k6 a+ z
  1182. INX& J) R% i7 @) G" }
  1183. LDA Data_Cnt
    # B4 m& _; @/ d8 \- y5 ]: S
  1184. STA PPU_Addr,X
    + X! M9 b2 P/ a1 w- J
  1185. INX! a5 |' X% r# j3 ~2 {* i" K- ~. A
  1186. Show_Get_Pos_Center_End" E- M0 f! |4 Z8 [
  1187. RTS
    4 m+ ~6 v( i4 O; S: h5 {
  1188. .ENDIF
    9 i2 N' V* k1 Y6 q' l5 S5 N; z

  1189. & _& r6 r; k8 q8 y8 g$ r( Q6 X5 s
  1190. ;------------------------------
    6 T6 ]" a2 D, ]5 k% Q
  1191. ;命名表数据
    5 S( T" W7 x" D+ v* ]. e& O
  1192. Palette_Attributes0 l( l1 T  Z- A6 F, t
  1193. .IF SOUND_BAR_SHOW_ENABLE+ @) E: g7 f5 }' @
  1194. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
    % @( M2 ^% ]. q& P$ V; i
  1195. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$BB,$AA,$AA,$AA9 B& |9 Z9 V, R$ O
  1196. .DB $0F,$0F,$0F,$0F,$0B,$0A,$0A,$0A,$55,$55,$55,$55,$55,$55,$55,$55
    - G+ _4 L! Q2 ^( h( G& u
  1197. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55; h) k& N  ^! t6 M  B
  1198. .ELSE  A% o, J& V( g1 Z
  1199. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00" Q9 Q! n; r6 T8 {2 y
  1200. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF* P& J* S. S9 P6 |5 r$ a
  1201. .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$55,$55,$55,$55,$55,$55,$55,$55
    / E; P+ s: h( f2 Y
  1202. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
    7 ~4 |- P4 Y# c$ a" _
  1203. .ENDIF3 [+ ~% t; M2 ?; d+ ?
  1204. 2 a0 I- w, X9 U$ J! B0 l! E
  1205. ;------------------------------% {- x4 O! z3 w9 f! }
  1206. ;调色板数据
    # w6 K+ C6 j0 J6 _
  1207. Palette_Data6 m7 A$ G) ?. ]" E$ z* v
  1208. .DB $0F,$27,$20,$0F,$0F,$24,$20,$0F,$0F,$21,$20,$0F,$0F,$25,$20,$0F4 M& {: n' f0 g
  1209. .DB $0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F
    ( V( @" J6 l) s4 M

  1210. " K6 }) Q/ p% i' a
  1211. ;------------------------------8 y$ v. H0 V# L4 h. j
  1212. Static_Text_Data
    . ~% r( {5 B$ A# y
  1213. .WORD Static_Text_Title_Data' u9 j8 s  x3 k- _+ B
  1214. .WORD Static_Text_Author_Data; y. B- w% x% G) q& X, q
  1215. .WORD Static_Text_Date_Data
    3 E  L0 \  ^8 |3 S
  1216. Static_Text_Data_End
    . z, P, Q/ U" V  S. r
  1217. 2 T5 n3 b7 ?" J% J+ `" |
  1218. ;------------------------------
    " G; j, F  P+ d3 g. e4 }
  1219. Static_Text_Pos
    / r3 K4 S- N- s8 u/ J7 F
  1220. .DB HIGH(Title_Text_Pos),LOW(Title_Text_Pos)
    . E# k/ V/ O( n- ^! S
  1221. .DB HIGH(Author_Info_Pos),LOW(Author_Info_Pos)
    & k- \1 y' y6 f" D2 ^! f
  1222. .DB HIGH(Date_Info_Pos),LOW(Date_Info_Pos)% q  ~2 R0 N  M( C5 u' \9 @; U) Q
  1223. Static_Text_Pos_End
    0 M2 z4 v7 Z7 u  Z
  1224. ( [+ a) v0 l3 X8 |4 R( j8 m1 f  _
  1225. ;------------------------------+ [: s  V& w3 E6 k& H! z) Y
  1226. Music_State_Stop
    ' S* _4 M% G5 J& \" |! a6 n
  1227. .IF SOUND_BAR_SHOW_ENABLE
      c# u, p# B2 V0 C* L
  1228. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"STOPED ",$FF,$00. Y% N- Q8 g; l* [2 N
  1229. ELSE4 W1 P2 O) t$ y* [( H( E
  1230. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos)," STOPED",$FF,$00% O2 R; D" y+ |1 F
  1231. .ENDIF
    6 V0 u" X5 m; i% F7 M
  1232. Music_State_Play
    7 n9 w1 ]" \, W& {8 f9 y
  1233. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"PLAYING",$FF,$00
    2 ~! P3 d. z7 W3 H4 y0 U
  1234. & B8 L7 g4 N  O3 k# U* c2 q: s
  1235. ;------------------------------# k, c0 M# o% u/ u
  1236. Sound_Bar_Text_Data;声音类型文本
    8 q7 W) [, `! V6 D% ?6 y+ @% [
  1237. .DB $FD,HIGH(Sound_Track_Pos),LOW(Sound_Track_Pos)
    # Z  p/ M0 z8 M1 Y6 A% F" D, C3 m
  1238. .DB "SQ1-",$FF
    ' f7 Z  t) a8 p6 m
  1239. .DB $FE,"SQ2-",$FF( n& p3 C" R. ]2 S! [2 V) D
  1240. .DB $FE,"TRI-",$FF
    % q& m. v  A/ C- l4 A( [+ V9 W
  1241. .DB $FE,"NOI-",$FF
    ' F# W& Z& W8 M' H  @5 R( C6 i
  1242. .DB $FE,"DMC-",$FF,$00$ ?, f: h2 L& [  S7 A: o9 U% g
  1243.   U9 H0 N7 z! I) _
  1244. .IF Track_Name_Pos
    2 @6 o, u& h+ m* f/ l# ]
  1245. ;------------------------------, \4 k2 B) j3 }3 ~
  1246. Track_Name_Addr;曲目名地址索引
    3 \, z' l: c, P
  1247. .WORD Trackr_01
    ' J0 Z5 s7 ]9 R3 B" x4 O/ I( Y# u
  1248. .WORD Trackr_02
    5 n8 `) Q6 Y  ]) f% N1 f, @
  1249. .WORD Trackr_03- g3 Z. \$ q! z0 A/ s$ {
  1250. .WORD Trackr_04
      y, \# g3 Z. w& i: Y- G
  1251. .WORD Trackr_05
    * V8 M4 E  ]( V+ i- I  |0 Z
  1252. .WORD Trackr_06
    8 O1 |  U0 g0 x! k
  1253. .WORD Trackr_07* r6 E) B8 k% p* H, r0 W$ s
  1254. .WORD Trackr_08
    ; y! v9 H! m: o. \- u
  1255. .WORD Trackr_09
    " c, E# M4 W# D8 R- K, o
  1256. .WORD Trackr_10, p1 \; k9 c) [7 m4 j
  1257. .WORD Trackr_11. Z4 y4 f4 w3 g) ^
  1258. .WORD Trackr_12  q# }. J) q8 O7 {
  1259. .WORD Trackr_13- Q) O" [6 _( O# V. u' g3 T
  1260. .WORD Trackr_14: ~' x7 E, {& ?2 _( W& Z
  1261. .WORD Trackr_15
    , K( m1 r& n! Y% V' M2 W
  1262. .WORD Trackr_16
    ) @' a' E# L& v& _4 y
  1263. .WORD Trackr_17% h6 s- F& _% i; Q) T
  1264. .WORD Trackr_18
    . s- E( i3 f9 [  W
  1265. .WORD Trackr_19
    , ]  ^4 X; ^: S1 M8 C0 c
  1266. .WORD Trackr_202 x2 B% S  y' s5 E
  1267. .WORD Trackr_21% m( a$ b6 u% ]( e: v( L! O
  1268. .WORD Trackr_22
    6 Q* _" d6 g! Z+ \* _# f& k
  1269. .WORD Trackr_232 _+ A$ @8 y: E# p, u7 }
  1270. .WORD Trackr_24
    - [( K: v- N  q; J& q& Z- Y# K: ?6 i) c, @
  1271. .WORD Trackr_257 a" ^9 Q8 z2 J9 Z" c) c& u" w% R  d
  1272. .WORD Trackr_26
      U& O! H+ X) ~, w% f: g. ]
  1273. .WORD Trackr_278 ?. u% W2 e  V$ G; G
  1274. .WORD Trackr_28. G+ Y9 N. Z0 C, \  i: V
  1275. .WORD Trackr_29& E4 {4 b( s. _6 V. G3 G8 ^, E
  1276. .WORD Trackr_30" [+ C; y  _  a
  1277. .WORD Trackr_31
    8 Q2 O0 j( O: A+ D+ x# Y
  1278. .WORD Trackr_32' U0 Q2 b% m" M; P
  1279. .WORD Trackr_33
    2 v$ a( Y; P  S' y
  1280. .WORD Trackr_34
    : |. e  n0 [8 Y
  1281. .WORD Trackr_35
    3 \1 O7 ^6 V7 R4 @5 C8 C
  1282. .WORD Trackr_36
    5 g8 w/ `. k- {. k
  1283. .WORD Trackr_37" h, ?  I& o8 ~$ i- x
  1284. .WORD Trackr_38/ J$ V6 {  U' o" }/ ?! Z! ]- h
  1285. .WORD Trackr_39
    # h; C. V4 i6 h6 w; m  L
  1286. % k4 w5 B4 q! p& i
  1287. ;------------------------------
    1 @3 A0 l4 x$ \, z
  1288. Trackr_Name_Data+ x4 |4 |: r. G- c. a4 }1 d. E
  1289. Trackr_01 .DB $05,"BGM 1"0 U3 n2 j; }& [/ d" E: x
  1290. Trackr_02 .DB $05,"BGM 2"
    $ X# V% M, O: ?+ B- E' e' q
  1291. Trackr_03 .DB $05,"BGM 3"
    . O7 n) \/ V, a
  1292. Trackr_04 .DB $05,"BGM 4"
    * _# Z$ a$ @/ M8 M0 S' d
  1293. Trackr_05 .DB $05,"BGM 5"! Q3 A) i$ T) P) l  W7 r1 x
  1294. Trackr_06 .DB $05,"BGM 6". z# {2 H* w  ?
  1295. Trackr_07 .DB $05,"BGM 7", A) p: Q( Q/ g6 d0 A2 z( T
  1296. Trackr_08 .DB $05,"GREAT"6 I2 U  J. k: t7 C
  1297. Trackr_09 .DB $08,"BOSS BOM"
    9 U) O8 h0 z) x# n* U! l8 p
  1298. Trackr_10 .DB $08,"BOSS2BGM"
    3 y* `4 P+ h3 [0 V) x  x
  1299. Trackr_11 .DB $07,"P CLEAR"/ b9 @( S) H7 |5 L: ?( ]
  1300. Trackr_12 .DB $07,"A CLEAR"
    : V6 I  r/ C( f, ?( q+ X" B* J% d
  1301. Trackr_13 .DB $04,"OVER"# p+ }' n9 O0 X# O8 l  v" V, J
  1302. Trackr_14 .DB $06,"ENDING"
    1 f2 ?" V" K& J5 a
  1303. Trackr_15 .DB $04,"SUTA"
    & U; |) l3 a$ T% \+ P9 W
  1304. Trackr_16 .DB $07,"THUNDER"" s0 D) K. A' ~. Z/ s  ]
  1305. Trackr_17 .DB $04,"SHOT"6 _2 ]7 H7 ?& z  w0 t! D' e
  1306. Trackr_18 .DB $05,"LASER"
    & y. M( S" G) ~$ j, Z0 A( A6 R
  1307. Trackr_19 .DB $06,"SPREAD"0 h% l5 H+ J5 W) y
  1308. Trackr_20 .DB $04,"FIRE"
    ' N! R8 j) _) R0 l. p" v6 g
  1309. Trackr_21 .DB $06,"B SHOT"% k% |4 G% n! o7 a
  1310. Trackr_22 .DB $08,"T DAMEGE"! l8 v/ b6 U& z
  1311. Trackr_23 .DB $07,"HARETSU"
      ^" k6 y& q# d
  1312. Trackr_24 .DB $05,"T OUT"
    1 D* Z0 Y1 l' n- A! Z2 Y8 H: d
  1313. Trackr_25 .DB $05,"Z OUT"
    * n9 _0 ~' F* C# F
  1314. Trackr_26 .DB $05,"A OUT"
    # i. V2 v; j/ Y& W# B0 s( A
  1315. Trackr_27 .DB $04,"ROLL"! V: }0 J  x/ R6 A& |2 {
  1316. Trackr_28 .DB $06,"APPEAR"1 [+ x6 n* s' ]3 p/ U$ g9 Y
  1317. Trackr_29 .DB $05,"POWER"  y9 Y+ q% s+ c+ m% O
  1318. Trackr_30 .DB $07,"BOKK BK"
    $ T) P5 u2 f1 R8 B/ W+ i7 N* A/ R
  1319. Trackr_31 .DB $08,"BAKUHA 1"
    * u7 T9 C* Y( `
  1320. Trackr_32 .DB $08,"BAKUHA 2"
    9 g- a4 B7 @8 }8 b
  1321. Trackr_33 .DB $05,"ARUKU"7 `2 {5 F4 N; b& S
  1322. Trackr_34 .DB $06,"JIWARE"
    ) u( E" k& S% q9 ~% j( f8 x
  1323. Trackr_35 .DB $05,"SILEN", B3 I  m& L2 J- J
  1324. Trackr_36 .DB $05,"P 1UP"; G( j, Q( q! R+ \
  1325. Trackr_37 .DB $05,"P OUT"* A6 x; ]: g, q
  1326. Trackr_38 .DB $05,"B OUT"
    - G: S$ g7 C& ~* R8 W$ H
  1327. Trackr_39 .DB $05,"PAUSE"( t) f% w! ?2 L
  1328. . K9 R( K/ p- s: m, m
  1329. .ENDIF
    - W; @) P1 Y* b1 X
  1330. & r: Q* s- ?; x# p/ e  \
  1331. ;------------------------------" z6 x. i  a+ C- \7 Z" @
  1332. Static_Text_Title_Data;静态文本数据; _; [$ y+ `* }4 V
  1333. .DB 12* @! b7 W8 ^, d
  1334. .DB "SUPER CONTRA"3 P* [% S& a! e& H; q
  1335. Static_Text_Author_Data
    : O7 _6 F* `. w% J+ ~# ~- Z
  1336. .DB 23
    * _5 F$ i( }- v6 n4 J/ W
  1337. .DB "EXTRACT BY FLAMECYCLONE"
    & S; `6 K" p+ F$ r% D/ y
  1338. Static_Text_Date_Data
    9 I2 I8 S: w0 O' f3 u
  1339. .DB 10
    ) `8 L* W* B# u2 S6 K1 D  x
  1340. .DB "2023.07.11"
    " U8 ~# p* ~/ P# G7 s7 V! J7 j

  1341. 8 {! S7 Z3 D( A& a' q
  1342. .BANK RESET_BANK & BANK_DATA_MASK
      t/ F- c8 M- Z! \/ ]* M8 k6 Z
  1343. .ORG RESET_ADDR
    4 y, S% x5 `1 q' w7 P2 r% L

  1344. 2 H7 K2 T3 V/ {/ i1 a7 i1 C

  1345. 0 v; C- Z! ^- D  X# ?- X8 o
  1346. ;==================================================! c6 m* o8 R: L7 K
  1347. ;切到主程序bank
    : z* j! F; H( l/ u3 d) \5 p
  1348. SwitchMainBank
    9 X0 y, T$ t9 |* x# l4 M
  1349. LDA #PROGRAM_BANK & BANK_DATA_MASK9 k3 L9 C9 J  h  E6 V
  1350. JSR SwitchBank8000
    $ n! J/ x5 r* ?$ s5 P9 q9 E$ h
  1351. RTS
    , j' _" n- G: s- g4 U2 a2 z

  1352. $ Y8 w5 D3 V4 P0 l% }( x% `' r
  1353. ;==================================================
    ' e8 E  H, J9 R6 o5 f: p
  1354. SwitchBank8000;切换bank到8000-9FFF
    + R$ `* Z2 \# l& n& B! y  k
  1355. PHA
    2 \3 _& z+ K: W0 w7 E  p
  1356. LDA #$06
    , d& ?/ k3 M: V5 p: X& Z
  1357. STA MMC3_BANK_CTRL' x. d! S/ o1 R% F+ q! h
  1358. PLA$ V" w( L' M; q+ R0 {9 D! {" b  S5 _
  1359. STA MMC3_BANK_DATA
    4 `. A% e; O1 b% W0 x
  1360. RTS
    " N- `. G/ b' G6 Q

  1361. : M3 x1 d5 H6 ]' ~
  1362. ;==================================================
    6 b" j2 v  h3 t& E/ K
  1363. SwitchBankA000;切换bank到A000-BFFF
    , z, Z0 `+ Z! E0 O8 Q3 c. [
  1364. PHA
    # O( B) G9 [# b* U5 }
  1365. LDA #$072 S$ O' i! z! Y) ~+ l' v
  1366. STA MMC3_BANK_CTRL
    & ~$ i8 l. |* r# X, ?
  1367. PLA
    9 w3 k: e. O( q: q. n  C% b
  1368. STA MMC3_BANK_DATA
    1 V) m* ]# H. p9 p4 T
  1369. RTS
    5 N$ j0 J! y( w  }9 x
  1370. ( h6 n, A% ^: K$ F5 j
  1371. ;==================================================6 O3 C% [5 r& @/ G
  1372. Sund_Bank_Init;音乐bamk初始化
    0 H4 f9 {2 `& i  m) N
  1373. LDA #SOUND_DATA_BANK_0 & BANK_DATA_MASK* x: k% ~- P4 B9 r
  1374. STA Music_Bank_8000
    & }% C2 y$ K  {4 J$ H( p
  1375. LDA #SOUND_DATA_BANK_1 & BANK_DATA_MASK5 h( V, T1 Y0 F& Z/ I8 P
  1376. STA Music_Bank_A000
    - h* G9 Q3 p2 l) F% V, v
  1377. RTS) F0 h9 A, p' W+ T" q( q
  1378. 3 P$ v  D  o- K7 G
  1379. ;==================================================! G3 L) U8 f  ?( {, t3 H$ `' N
  1380. Sund_Bank_Set;切换音乐bank, M4 s- P' t& p' w* B9 M
  1381. LDA Music_Bank_8000
      F1 g( h' h4 n3 o
  1382. JSR SwitchBank8000$ h7 A, T: V3 t5 ~6 N: J
  1383. LDA Music_Bank_A000
    * ~0 ^# a$ p% r+ O( _# H# s7 w# b
  1384. JSR SwitchBankA0001 Q8 Y# W3 Z  q6 t. _' _
  1385. RTS1 u* R' I: I% e. N. t

  1386. % L  S3 a7 n  ]% v0 R
  1387. ;==================================================6 A7 o$ `& r  L# s. ]
  1388. Sound_Init;音乐初始化
      |! i7 q3 j, }& y8 o. e
  1389. PHA
      F5 i4 e- H& J3 t8 H
  1390. JSR Sund_Bank_Set2 o1 }- b4 T! J
  1391. PLA5 H% N5 f/ k- H+ H1 E" V
  1392. JSR Music_Init_Addr
    6 l8 f- U/ g) ]/ J" u
  1393. JSR SwitchMainBank
    / u7 v( h+ n3 K0 J5 F

  1394. 8 n0 r% S8 U, u7 t8 X# o
  1395. JSR Music_Bar_ReSet1 w3 A% G) u$ Y6 p
  1396. JSR Time_ReSet9 d0 ^" l* C" n9 m
  1397. LDA #$00
    . U" ]& D# d6 J0 n
  1398. STA Music_State8 `4 @8 c& P; A
  1399. JSR Music_Stata_Show
    * P* p' A" j; A# ?5 l* [9 H) V
  1400. .IF Track_Name_Pos# ~4 u, F6 V& p+ i8 F3 c
  1401. JSR Show_Track_Info
    7 L  e6 ]5 ?2 }3 o& T7 t2 x/ y# s
  1402. .ENDIF: B- e, G) I: P* R

  1403. 6 _4 P/ P& B* k/ I# R
  1404. RTS4 H7 G8 f5 x- U( U4 {

  1405. ' K$ V6 ~  \4 {  S( O5 K$ d
  1406. ;==================================================
    / b3 P& H6 u4 M2 G* s( w! X9 w5 i7 `
  1407. Sound_Play;音乐播放+ M. c$ @8 [2 s3 a
  1408. PHA
    # H/ b# F+ F+ U: `1 ?) V7 O
  1409. JSR Sund_Bank_Set
    $ Z7 q) o0 u' c5 R7 V
  1410. PLA
    ' f4 g) |* ~2 n5 f* H$ Q8 |9 x
  1411. LDA Music_State
    ; w$ {8 N6 M. k( ]* V
  1412. BNE Sound_Play_End- c, l1 L& R) k: M- Q
  1413. JSR Music_Play_Addr
    / f% ?  C* K% B7 B
  1414. Sound_Play_End
    3 K1 R; m# M$ {, J& L, p. C
  1415. JSR SwitchMainBank
    2 v4 n$ e/ z9 Y' W$ @  i2 a0 p) L: |
  1416. RTS
    6 y1 C! N$ d8 A! u1 i7 l8 t5 U

  1417. . A+ Y. z( B) W$ ]' ~
  1418. ;==================================================$ K: N4 y6 J. m/ P/ ?" @- l6 M
  1419. .IF Music_Reset_Addr" z$ G8 n( Y! d0 v
  1420. Sound_Reset;音乐重设(如果有的话)/ Y3 v+ j9 C+ i$ X3 h. z, G
  1421. JSR Sund_Bank_Set1 w9 E5 L1 r0 L4 C# d
  1422. JSR Music_Reset_Addr
    ( c3 K4 t6 r# w3 d2 @8 A
  1423. JSR SwitchMainBank) }$ D$ x+ J- r! a% B
  1424. RTS
    5 p5 C5 _4 E* o5 h) ^
  1425. .ENDIF! u1 G0 K! ~% P: n9 c1 j
  1426. / Y2 q) ~9 `6 G( p, }' s5 m
  1427. ;==================================================% w, f; n- k. S
  1428. MainLoop;死循环9 q# x# ?2 j" f' f
  1429. JMP MainLoop
    / }, G9 J( j8 ~- S5 N  a: @: U( g
  1430. 7 ]) P3 q2 V1 W& D
  1431. ;==================================================
    3 d& w; x0 _( v/ j# s
  1432. NmiProgram;Nmi中断处理
    ) N! z( _# j4 \
  1433. PHA* B  L/ H9 W* p! c, X* h+ q8 {7 J7 S& c
  1434. TXA
    $ d2 ], q  X$ r& w
  1435. PHA" v/ F) O) {+ A% O
  1436. TYA
    " T/ l  f- Z' K+ V' w
  1437. PHA) u+ K0 q5 n* }
  1438. 1 Y0 X* O3 l& y
  1439. LDA PPU_STATUS
    6 k( W3 j% ~3 j0 A# j# M1 H
  1440. LDA #$00
    * x+ D; t( V9 F2 _2 j- c  g
  1441. STA PPU_CTRL; s4 O  x- }3 ?6 C5 k
  1442. + S5 q) Y. J$ P! I7 Q* \" C5 k
  1443. ;切换主程序bank' C3 c& _  {$ x1 Z
  1444. JSR SwitchMainBank5 m6 J8 s9 |0 l0 `* b
  1445. - l& `) Y3 v" N% f
  1446. ;NMI处理
    2 G* N. l$ ]: e# ~: Y4 C7 F
  1447. JSR NmiProgramProcess
    : G: p& L* |) V5 E, U! w

  1448. 1 c+ u) }: K/ X
  1449. Nmi_Proc_End
    * w' K) Q. D' s; Z
  1450. PLA
    3 d* y& c# @, z9 x8 ^7 M
  1451. TAY
    " ]  A& ^" j+ ]- C; I, T
  1452. PLA3 L3 D9 g( a0 u  s; a! `% u
  1453. TAX  Z) u( b* G( M$ k
  1454. PLA
    ) @  Q* m9 i/ x8 h* g5 i5 \% b

  1455. & h) A+ ?& ], F2 w" y1 \
  1456. RTI
    0 L8 F( H4 h* U; J- f5 R( y
  1457. $ {' c" h9 g7 X
  1458. ;==================================================
    . n, d3 h# a5 k. E; Y* D3 A
  1459. ResetProgram;重置中断处理
    6 d( T3 u: P7 J6 t1 p( e; |
  1460. SEI+ Z: Q/ _; D. f5 ^$ ]
  1461. CLD
    $ L6 l1 }2 \% c  y3 l
  1462. LDA #$002 z: P: |' R2 F# ]* w/ B9 Y: R
  1463. STA PPU_CTRL8 z1 f2 M! t) |. j
  1464. STA PPU_MASK5 u# f  s% w/ L
  1465. # m2 S* `  \+ t' u7 J
  1466. JSR SwitchMainBank6 w* U9 T3 {' b
  1467. JMP ProgramBegin7 o  l& c+ Q- h' R3 O

  1468. 6 M$ X: X$ b: x, ~
  1469. ;==================================================
    1 ?: K5 J0 X6 N, [. s/ l7 K' l
  1470. IrqProgram;Irq中断处理7 I! A. ~. c9 M$ E, n( E6 s2 Y, [
  1471. RTI
    ( \: G' C1 n2 k6 A! I2 Y7 t2 E6 A+ M
  1472. ! G6 \* m' }0 k4 H$ X% [0 N
  1473. .IF SOUND_BAR_SHOW_ENABLE
    " N: [. ?5 L) F% A2 A/ \. s, u9 ^
  1474. .ORG $FF80
    0 T" R% K8 P* o8 @, C
  1475. STA $4000,X
    6 t& @$ U  c$ d: h5 w
  1476. STA Sound_Bar + $00,X
    9 B3 H1 [. A( [3 ?
  1477. RTS
    / }# a3 M# J3 O
  1478. 7 k# T) b' g4 |8 M
  1479. .ORG $FF88
    - X/ G% n# r6 V: c% j
  1480. STA $4000,Y7 }4 w$ S8 P$ h* m% A; I
  1481. STA Sound_Bar + $00,Y, o0 G6 F8 F7 i9 |
  1482. RTS3 E% F5 d% p; i" X, l, j, U- G
  1483. : y$ F4 m5 B5 y# q3 ]. c: g
  1484. .ORG $FF90" a5 u3 U! a5 s$ ]  u8 g
  1485. STA $4004,X/ `) L6 j% h$ @
  1486. STA Sound_Bar + $04,X
    7 y5 ]& s8 V' }3 }9 L1 V2 t" t1 I( ~
  1487. RTS
    * n, w' n6 {" w
  1488. + r+ B6 c) F! K  f
  1489. .ORG $FF988 Z7 r& z& j9 D" I
  1490. STA $4004,Y0 F3 d% k2 c) D3 z, S* `! Q
  1491. STA Sound_Bar + $04,Y- D0 u+ R, x. W% \3 ^5 q% S+ ^
  1492. RTS- K6 ]; {2 f6 N3 D
  1493. 8 b3 c+ ~' n5 R: d
  1494. .ORG $FFA0: H/ g) O. n1 K3 C+ {
  1495. STA $4008,X$ Z! {1 q3 K7 o- j' [
  1496. STA Sound_Bar + $08,X
    ) _7 L& w$ o# o9 r
  1497. RTS
    , {3 k6 ~- I; [, e! v' O6 s- O9 T

  1498. ( V0 Q+ `$ a6 Q5 Z/ s4 f
  1499. .ORG $FFA8
    * w$ a0 V; i9 K( `: `  t
  1500. STA $4008,Y
    ' f. X, {3 Z- c
  1501. STA Sound_Bar + $08,Y9 i5 F% I6 i( Y: ?5 |
  1502. RTS% L2 D5 {( V2 s# f. |2 a

  1503. / O. F  s- j& Y9 ^5 d3 L3 R: t
  1504. .ORG $FFB0
    ; C- u( v5 w# h8 {4 o6 @
  1505. STA $400C,X6 c! w1 ?8 f# U$ R9 ~) I
  1506. STA Sound_Bar + $0C,X
    5 D* D4 J6 p; R; M$ w: h4 j# T' _+ m
  1507. RTS2 h0 {9 h" k  x% D& N

  1508.   ]8 G. ~  [, Y7 [; Q9 H
  1509. .ORG $FFB8, f' x% e$ y; z5 L* T
  1510. STA $400C,Y' |% ~( z1 c5 }; v
  1511. STA Sound_Bar + $0C,Y. z* {& ]6 H! ?/ |
  1512. RTS0 c0 R5 Q8 `# ]
  1513. 7 s" ?4 ?$ @0 @. }/ c: W1 m
  1514. .ORG $FFC07 P0 H# i' B$ q* Q2 U- q3 r
  1515. STA $4000
    # o! H' k% n3 ^4 {+ C& m
  1516. STA Sound_Bar + $00" W- a% r9 e# g( |2 ?4 w
  1517. RTS
    & \* K- E# S; N( F
  1518. / w  Q+ m" ]! ^6 C* Z
  1519. .ORG $FFC8& Z% A1 h8 u" N7 X
  1520. STA $4004- k7 t# i; e1 T: @
  1521. STA Sound_Bar + $04
    ; y  u  y/ C) U; t5 n
  1522. RTS! j7 G  n4 s. {. v6 M7 T
  1523. 6 D: h9 b) G/ s/ U: q
  1524. .ORG $FFD0
    6 a! h* j  X  a1 C5 O& }. Z3 U- k
  1525. STA $4008
    ; k: b$ H2 w0 {8 |( d/ Q
  1526. STA Sound_Bar + $08
    / R3 L+ i% O0 g) F/ |( x# P0 W+ k3 o
  1527. RTS
    2 w% o# {. y; ^6 l3 v7 p

  1528. ' A) ~* o. `) F  V3 o/ l! Q# W
  1529. .ORG $FFD8: x9 r  Q3 m3 b
  1530. STA $400C
    9 ?* k! {4 `' a) I2 {/ E. b# B" F
  1531. STA Sound_Bar + $0C+ Y: Q, {* Q' n" A- d. p
  1532. RTS
    3 D' Q# {# f2 \! m7 x4 m& ^( {. T

  1533. 7 w: E+ J4 p2 s. l; V; `
  1534. .ENDIF
    & B6 r- l/ Q6 U4 ?8 A
  1535. 5 g7 K; ?0 ~8 f* p, f' P
  1536. .ORG $FFFA
    5 i% [) G' x/ m8 {) I
  1537. .WORD NmiProgram
    ( G" v: y0 s0 P: |# ~& u5 `
  1538. .WORD ResetProgram  \2 A2 o* {* T- {  U
  1539. .WORD IrqProgram
复制代码

5 ?5 V7 |: o" z# O8 ]- h) t+ J3 }  j  E( }
游客,如果您要查看本帖隐藏内容请回复

本帖子中包含更多资源

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

x

评分

1

查看全部评分

签到天数: 1113 天

[LV.10]以坛为家III

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

使用道具 举报

签到天数: 3087 天

[LV.Master]伴坛终老

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-20 11:02 , Processed in 1.084961 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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