EMU618社区

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

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

[复制链接]

签到天数: 39 天

[LV.5]常住居民I

发表于 2023-7-11 19:08:59 | 显示全部楼层 |阅读模式
本帖最后由 yandagui 于 2023-7-11 21:32 编辑   Q* J  h# T  h1 p0 h( X& d
; B; ~) a( W% i9 y5 _
1.魂斗罗: {( k# L/ M! \# M1 ^
2.超级魂斗罗' G- h7 |$ I0 F2 V
3.赤影战士$ _* Y  Z( }9 [7 {/ }8 n
4.忍者龙剑传2+ e+ k5 K& ~  c0 {7 P9 Q

" x' X5 Y  F2 d% w1 {' G+ t' }* ?

3 v# Y: o* B* Q$ i
7 v+ `. O1 `6 s5 W源码:( s1 l! z6 Q# |
  1. ;[FC音乐][播放器模板]
    - y2 H6 o7 S4 P( V4 C
  2. ;FlameCyclone 20230710
    : t; u- n; g5 r4 K3 x: T3 x8 ?: v$ X
  3. 8 o) c! n+ H( R# u1 v
  4. ;文件头
    2 e. R3 `: i" R! g3 I
  5. ;======================================================================" \+ `  X4 Y  j9 u2 l% H( P1 |
  6. .INESPRG 4                                              ;16KB PRG 数量
    " u' j! a$ r2 k' R
  7. .INESCHR 0                                               ;8KB CHR 数量% W+ Z% ~; J4 G& k3 {+ b% A8 w
  8. .INESMAP 4                                                   ;mapper 4
    + W( Z) S4 g  P6 ]2 p/ a, p% P2 @0 h
  9. .INESMIR 1                                   ;命名表镜像 0水平 1垂直5 L6 E- ]4 U8 y( K' k

  10. 2 V' [) {: R+ F, g4 p; G: a
  11. ;==================================================3 M9 U* |4 {$ J# I1 W5 P
  12. SOUND_BAR_SHOW_ENABLE       = 1$ s1 r6 }0 n0 E7 ]
  13. ;==================================================- v  s* ~2 H* N0 }3 i. @9 B! M$ ]% r
  14. BANK_DATA_MASK              = $073 b( s/ q& I4 Q; n
  15. ;==================================================
    4 d) W8 f: N+ m' v
  16. SOUND_DATA_BANK_0           = $00
    / O0 k( R4 [- U. l, S9 L3 I: L" B
  17. SOUND_DATA_BANK_1           = $01
    # ^) h* k+ U) W: w
  18. SOUND_DATA_BANK_2           = $02: x; D3 c& k/ `3 U- d1 N/ ?
  19. SOUND_DATA_BANK_C000        = $068 \! Y* V+ z; E; r0 n
  20. : g7 j7 A/ M% O2 W2 R
  21. ;-------------------------------------------------; f/ ^1 R# j, P2 H
  22. CHR_DATA_BANK               = $04- [9 g: {) c% |3 t
  23. CHR_DATA_ADDR               = $A000
    3 x$ u& H' M4 u- g) M4 ]
  24. ;-------------------------------------------------
    2 G1 `7 E# i  \# k/ I+ m* H
  25. PROGRAM_BANK                = $05
    9 x) {9 \# N4 ]
  26. PROGRAM_ADDR                = $8000
    5 `* e4 x/ v1 e/ T. M. M
  27. ;-------------------------------------------------2 o! [* ]; `9 C5 R
  28. RESET_BANK                  = $07% R/ [5 m) j! I+ O' H9 F
  29. RESET_ADDR                  = $FE00
    3 v2 Y/ o4 a0 x+ d8 b8 B
  30. ;==================================================
    . G$ [6 p, K4 k$ F* H! G
  31. Music_Init_Addr             = $DFF0 ;音乐初始化地址
    & G$ c  h" }% ?3 `; @* S, {  \
  32. Music_Play_Addr             = $813C ;音乐播放地址* \5 C/ y, s& H) h5 T
  33. Music_Reset_Addr            = $0000 ;音乐重设数据地址1 w" e+ b6 D, G) U0 b
  34. ;==================================================6 n) Q( B; k( w
  35. Music_Song_Total            = 039  ;全部曲目总数. Q& p8 i; F+ Z, K& n* h
  36. Music_Start_Song            = 007  ;初始播放曲目3 B( S# a5 ]1 p, x- |) b4 u' T1 b7 ~
  37. ;==================================================
    & K/ U2 g6 M, S9 F. g4 E" u) r
  38. % e2 U6 i9 l2 i; ]& g
  39. ;==================================================
    9 }- v0 i+ G4 f" @- ^
  40. Title_Text_Pos      = $210D ;标题文本位置
    / _2 D+ t: R: R- ?
  41. Author_Info_Pos     = $2284 ;作者文本位置
      \" Q; \% K' J$ \; V
  42. Date_Info_Pos       = $22CB ;日期文本位置; o! `' l% j& M$ F8 x
  43. ;------------------------------; @( Y1 N0 \( i3 {& p6 z
  44. ;------------------------------
    $ C9 u$ C* ^" x4 T2 a; Q7 A; E
  45. .IF SOUND_BAR_SHOW_ENABLE$ W$ [2 w3 @5 z; w: }$ k
  46. Play_Index_Pos      = $21B3 ;当前曲目位置% K' |2 V8 |5 {7 u! K3 G4 i$ r
  47. Play_Time_Pos       = $21F3 ;播放时间位置
    4 r/ L/ ^; }4 U, ^
  48. Play_State_Pos      = $2233 ;播放状态位置8 ]5 Z  a5 m+ ]" H* ]* l
  49. .ELSE
    5 Q' P8 Y& i( ]; e

  50. - p, [; l9 {; a3 x0 U2 E6 \
  51. .IF Music_Song_Total > 99* R0 P4 ?+ K) ~+ U5 f
  52. Play_Index_Pos      = $21AC ;当前曲目位置
    * I6 U' d! [$ j* s9 c7 X. _
  53. .ELSE
    $ G. q/ c, b4 L7 n

  54. 7 B- [4 T" N+ I6 m$ l
  55. .IF Music_Song_Total > 9
      `* m; E( v8 Z6 K: j( q
  56. Play_Index_Pos      = $21AD ;当前曲目位置
    ' [  y6 ^% n+ A# h4 z
  57. .ELSE
    / f" f. y3 f# p% u+ F8 h) E
  58. Play_Index_Pos      = $21AE ;当前曲目位置; G: A% B5 x0 Z6 X% A% ]% e: K/ p0 S
  59. .ENDIF- ?& J0 H+ J5 S& l9 ^# z

  60. 3 H; T) T  v. q+ T" w0 s/ X
  61. .ENDIF; J' m( W/ g6 M! y6 g, S+ @

  62. 6 M1 b( x) i* |( U

  63. $ r2 z6 C2 v0 z9 g
  64. Play_Time_Pos       = $21EC ;播放时间位置
    ' w4 G/ ^5 ?" W, X" s5 I3 v, B! W" b
  65. Play_State_Pos      = $222C ;播放状态位置
    , ^7 |$ J4 q/ c( [8 X
  66. .ENDIF& c0 C2 G& y6 w8 Z8 |' R) g( ~6 o
  67. ;------------------------------
    , u2 p+ X! ^) g' j6 ^: ?
  68. Track_Name_Pos      = $216B ;曲目文本位置5 o8 J* i) K/ \$ k+ v
  69. Sound_Track_Pos     = $21A5 ;声道文本位置, p6 U8 C* T( e- @; U+ ?
  70. Sound_Bar_Pos       = $21A9 ;音乐条位置
    ! y! I8 {: h+ M2 u" j. w2 ]& [
  71. ;==================================================/ G$ w6 Q( l8 d
  72. Scroll_X = $00
    % D6 x' \5 p  T. M1 n* }) E
  73. Scroll_Y = $06
    & N7 ]9 |5 H1 x& l& {( Q
  74. ;==================================================
    1 v% y8 ?* O; i% s/ [8 S, A6 \
  75. RAM_Cln_1       = $01001 q* @. E$ b& W
  76. RAM_Cln_1_Size  = $80
    $ N9 }' F* X+ n1 M$ y1 b
  77. RAM_Cln_2       = $00E0
    ! u  k$ C8 n5 N0 f, f
  78. RAM_Cln_2_Size  = $20
    ; c! Q4 O% P' w
  79. RAM_Cln_3       = $00E0
    0 k4 |$ L4 V/ `% e& ~. N
  80. RAM_Cln_3_Size  = $20
    0 @. Y: V4 m8 w: J. y

  81. ; E4 z7 X8 T" U/ s
  82. ;==================================================
    # t: h: j8 B; S6 J5 \
  83. PPU_CTRL                =   $2000   ;PPU控制寄存器
    3 P4 Z9 Q8 [$ ?6 P; f+ h# g
  84. PPU_MASK                =   $2001   ;PPU掩码寄存器" [2 R% M" ~" o
  85. PPU_STATUS              =   $2002   ;PPU状态寄存器:读取后PPU_SCROLL和PPU_ADDRESS被复位,下一个写到PPU_SCROLL的数据是水平的,写到PPU_ADDRESS的数据是高位
    ! E; |! H+ A  M- K5 g; x" \" W* J
  86. PPU_OAM_ADDR            =   $2003   ;精灵RAM地址:用来设置通过PPU_OAM_DATA访问的256字节精灵RAM地址。每次访问PPU_OAM_DATA后该地址增加1( d# x; C2 |! @& s
  87. PPU_OAM_DATA            =   $2004   ;精灵RAM数据:用来读/写精灵内存。地址通过PPU_OAM_ADDR来设置,每次访问后地址增加1
    / h, V2 ~( f- [) p) \  V+ C
  88. PPU_SCROLL              =   $2005   ;屏幕滚动偏移:第一个写的值会进入垂直滚动寄存器(若>239,被忽略)。第二个值出现在水平滚动寄存器
    & I0 c/ b4 N& F
  89. PPU_ADDRESS             =   $2006   ;VRAM地址:设置PPU_DATA访问的VRAM地址。第一个写地址的高6位。第二个写低8位。每次访问PPU_DATA后地址增加
    1 K8 v; N8 l$ B1 ?' G# r' s
  90. PPU_DATA                =   $2007   ;VRAM数据:用来访问VRAM数据,通过PPU_ADDRESS设置的地址在每次访问之后会增加1或32
    & y; K' v) h' Z# C2 s5 G  r
  91. OAM_DMA                 =   $4014   ;DMA访问精灵RAM:通过写一个值xx到这个端口,引起CPU内存地址为$xx00-$xxFF的区域传送到精灵内存) U2 E+ f+ [! ]1 R
  92. APU_STATUS              =   $4015   ;声音通道切换. _, s4 q1 B! Y" W' l: s" `
  93. JOY1_FRAME              =   $4016   ;手柄1 + 选通, d9 a' {& b* f, {( k
  94. JOY2_FRAME              =   $4017   ;手柄2 + 选通/ x( H! J4 S# W0 o$ W2 v
  95. ;==================================================
    - y% S# U& x* A: |% t1 p( ]! ~
  96. MMC3_BANK_CTRL          =   $8000& o5 r; ^" V5 w$ ^, b6 f4 v
  97. MMC3_BANK_DATA          =   $8001
    " N" m4 N' Z2 [7 S' P( N: [) @. R
  98. MMC3_MIRRORING          =   $A0003 `$ |/ X0 c" G8 L1 k: H
  99. MMC3_PRG_RAM_PROTECT    =   $A0014 u  B2 J( ^  _
  100. MMC3_IRQ_LATCH          =   $C000
      \4 N* a3 `2 I  s
  101. MMC3_IRQ_RELOAD         =   $C001+ t9 D" ~4 Y7 O; |6 h! s1 E% `
  102. MMC3_IRQ_DISABLE        =   $E000$ c; p% \" ]4 x# \( J3 @+ s
  103. MMC3_IRQ_ENABLE         =   $E001
    6 H) b5 h. r/ f# o7 q5 {
  104. 5 t; u6 `: ~4 N4 k4 }
  105. ;音乐数据块
    ) V: p+ j* x7 J! u$ L
  106. 5 T$ u3 f+ Y! I0 s, R
  107. ;======================================================================
    5 G- C- I2 h9 e& E4 j6 `$ j
  108. .IF SOUND_BAR_SHOW_ENABLE
    " [' O/ F1 _9 L2 B
  109. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK
    - N: s/ `! O% Q
  110. .INCBIN "sound_bank_bar/music_data_0.bank"9 F% D# v, M/ J- m. y
  111. ( }- v( y5 j% S* u0 E- P' `; h
  112. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK. p) ^! D. E8 a4 E' Q
  113. .INCBIN "sound_bank_bar/music_data_1.bank"
    1 K' I7 x: @1 V+ f

  114. 8 b( M$ j& o/ R: O, [& g3 d+ l- I
  115. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK* h2 j, u: h7 L3 W4 G
  116. .INCBIN "sound_bank_bar/music_data_2.bank"
    1 v8 m% K4 S4 W6 f
  117. 0 C" X9 g& R* f3 |
  118. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK7 B& _, X; y5 G! j9 E' Q
  119. .INCBIN "sound_bank_bar/music_data_3.bank"
    # j9 Y3 ]! h$ C' a8 _, Z
  120. 0 Q+ s) ~# W! a8 X
  121. .ELSE
    ; C. v; P5 J+ I$ o6 P5 f# M
  122. .BANK SOUND_DATA_BANK_0 & BANK_DATA_MASK7 I# r7 C' E: Q5 ~* X
  123. .INCBIN "sound_bank/music_data_0.bank"
    / e; Y2 q% ?; t% i1 }8 P

  124. * {" C/ x% v' q; ^; L5 O) K
  125. .BANK SOUND_DATA_BANK_1 & BANK_DATA_MASK
    5 I! D* _  U! W
  126. .INCBIN "sound_bank/music_data_1.bank"  Y" ]+ t& P1 V3 Q7 p( b- b/ P
  127. ; A( L) |3 C2 b1 \. ~( p
  128. .BANK SOUND_DATA_BANK_2 & BANK_DATA_MASK" K% t. \' u6 A7 b7 {; \7 j7 b
  129. .INCBIN "sound_bank/music_data_2.bank"7 U$ d( ~1 M# G  ~# Y" X

  130. ( r' J9 M( e& v8 z2 x) ]/ k
  131. .BANK SOUND_DATA_BANK_C000  & BANK_DATA_MASK+ j) S" M% L: c9 d( {# ?8 J7 i+ c
  132. .INCBIN "sound_bank/music_data_3.bank"% k* m5 z$ {  s
  133. .ENDIF0 H8 ~, f6 W0 W

  134. # p4 }, B4 {6 J- P$ X) c0 I
  135. ;CHR图形数据' f% e# k# x" _* x5 e1 T( h5 g
  136. ;======================================================================. j7 o2 t  \4 u! P% E: X
  137. .BANK CHR_DATA_BANK
    ! ^: {, F* c+ W/ a8 _( ]7 [
  138. .INCBIN "chr_bank/chr_data.chr") U+ J" a, Z* l3 m

  139. / a) a% c* i4 t0 [$ v$ \# C) ~
  140. ;==================================================
    * W* _7 M+ n1 b* J6 x. P8 D+ |
  141. PPU_Addr        = $0300
    ; y8 }8 h8 f# ~5 S/ H4 `" g
  142. Palette_Addr    = $03C0
    8 o) {& ?$ M' N3 f, C% q; ~/ Q
  143. Sound_Bar       = PPU_Addr+$E0- q1 d/ D; Q5 T
  144. ;==================================================
    . y/ ]' @/ ]5 a# H; w
  145. Palette_Update_Addr     = Palette_Addr+$0D7 _* B/ }6 a, p9 ^8 I8 r& M
  146. Palette_Update_Max      = $2C
    ! d/ {9 m+ l, B" I: L. F) X
  147. Palette_Update_Min      = $21; x; n. c7 @, Q2 R
  148. Palette_Update_Interval = 60: h) O* ?. Q& v4 U# i  u/ l7 |2 v
  149. ;==================================================' G8 g" v2 ], ?; z/ ~3 U
  150. Sound_Bar_Cnt       = PPU_Addr+$F0& x3 @( O4 H0 s6 w9 v1 I
  151. Screen_State        = Sound_Bar_Cnt+$01& t  c) p: L; r% W- g0 b) I. _
  152. PPU_Cur             = Sound_Bar_Cnt+$02
    # W+ r) j4 S8 X1 R1 z. M$ N
  153. PPU_Addr_H          = Sound_Bar_Cnt+$03
    . c, n% q2 z$ _/ d9 o3 p% ?3 h- e: Y
  154. PPU_Addr_L          = Sound_Bar_Cnt+$04
    $ P+ E$ g( |, W
  155. ;==================================================
    1 Z! t6 T, n* G. W
  156. Data_L              = $70
    ; M7 R3 o; _% V) Q/ H
  157. Data_H              = Data_L + $01
    3 S+ S2 {# s2 I, n
  158. Data_Cnt            = Data_L + $02) U. X! N0 y4 s8 m  ?+ o
  159. Data_Buf            = Data_L + $03" x( E6 f) D) Q6 W) M
  160. Time_Wait_Cnt       = Data_L + $047 l6 U( \- y% p- t! c. z! H6 _
  161. Palette_Wait_Cnt    = Data_L + $05
    + J+ r" _& o* F! C7 g3 C9 B, ^
  162. Palette_Update_Flag = Data_L + $06
    8 `$ H: ?3 E' B5 T+ E$ F
  163. Show_Track_Name     = Data_L + $07
    8 k# @7 E2 v4 Z6 @0 `: Z
  164. ;==================================================
    : u6 U# p" S+ w% F7 f1 |
  165. Key_Keep            = Show_Track_Name + 1
    % ~9 c$ x7 c" {  d5 a
  166. Key_Once            = Key_Keep+$01
    . a6 w. U5 X2 k; m
  167. Key_Kemp            = Key_Keep+$02
    * v2 ^; w* P3 R- j. \6 c5 r5 T* |/ ~
  168. Key_Temp            = Key_Keep+$03
    ; S0 h, ]% l& F- K
  169. Key_Getv            = Key_Keep+$04
    8 Z6 _/ h' l6 a% K
  170. ;==================================================5 L% W: |6 d5 Q" d
  171. Music_Cur           = Key_Getv+$011 ?4 e8 m* J  B( {- x
  172. Music_Last          = Music_Cur+$01
    ' g' D- s) T5 a& J7 f" `+ a
  173. Music_State         = Music_Cur+$02" U4 J& I7 ~3 Y$ r1 G, W
  174. ;==================================================7 F+ x! Y( s; p* j, q/ `+ U
  175. HEX_Data            = Music_State+$01
    4 z  R6 I! F, \! ~+ c) U, c" W, J
  176. DEC_H               = HEX_Data+$01
    - D3 \9 F' i+ I
  177. DEC_T               = HEX_Data+$02
    8 o, e" J3 L6 f8 D
  178. DEC_L               = HEX_Data+$03: }1 o' D# \: T, H4 A7 {$ z
  179. ;==================================================
    8 a  E' u0 T6 w! s/ p8 Y
  180. Time_S              = DEC_L+$01$ O9 [" w0 n- H7 |
  181. Time_M              = Time_S+$01
    3 E- ?2 p, {2 q4 D1 h( H8 p! v* E
  182. Time_H              = Time_S+$02
    * P# m9 T  |' r' |3 H' B9 l0 V
  183. Time_Cnt            = Time_S+$03  Q$ ~0 R0 H9 P, J- _7 Y( s

  184. ; ^' h0 U/ N. L" u/ A- z7 v! P
  185. ;==================================================1 U2 `" c% X; Z: m% Z2 \7 ]1 u& k' I
  186. Music_Bank_8000 = Time_Cnt + 1
    6 H6 J/ y" q% I' s
  187. Music_Bank_A000 = Music_Bank_8000 + 1
    9 h5 l9 M% i% {
  188. ;==================================================4 \+ X9 O  a% J$ B% }& ], n

  189. 3 k2 x+ e8 Q9 n3 J, M/ u
  190. ;======================================================================) f- t/ S# G% B( t# |
  191. .BANK PROGRAM_BANK8 v8 G) f8 W5 }1 N7 z! k! c. w+ _
  192. .ORG PROGRAM_ADDR
    - p* Z' b- M* o. W, ~2 L

  193. - Q" z1 N" [' T. i
  194. ;==================================================
    * L! Q$ `# `$ b
  195. NmiProgramProcess;NMI中断程序处理+ d: ~2 b. Q" j
  196. ;处理PPU图像
    # K5 v, D8 \& H& p- [
  197. JSR PPU_Proc
    1 M0 k4 V4 Q) H8 S4 ^3 Y$ s
  198. 8 P# R6 Q' T* K
  199. ;启用NMI中断4 n0 x% N& B% p; O* q% x" `+ C
  200. LDA #$80% Z7 s- H8 |' A0 t) s$ a
  201. STA PPU_CTRL+ x1 M, _- p# J1 U* h$ h7 }4 Z1 _

  202. ; Q  k& C+ y. M1 e
  203. ;更新调色板
    * h  c. X: i; D7 i. t; t$ ~
  204. JSR Update_Palette_Data
    6 d8 c& V. @9 T; I& q' k
  205.   X6 _) T. l" j' r9 o3 a! [+ Z4 D" _+ x
  206. ;显示时间(缓冲)4 H; n# q' m. b# K0 w
  207. JSR Time_Show
    1 O* K6 T, ~3 _( N9 ]3 ^( u3 l
  208. # x' i0 T3 e# U% m9 y3 H  A3 b
  209. ;播放计时
    % U+ G# s1 B3 d* V$ `9 S& L
  210. JSR Time_Count# k1 y1 o& i+ L3 A# x

  211. % h' j/ b: O+ \; a; D
  212. ;播放声音
    " @. o- E# k# ?( P6 d
  213. JSR Sound_Play: H' I( h, i3 x: |) r: g; g

  214. ' j5 A  T$ k( N# _4 z1 `+ Z/ u
  215. ;切换音乐(手柄触发)" A5 ]: v5 m, W( ^, o; I1 e
  216. JSR Music_Switch- R7 Q6 k# o8 |: U

  217. $ f9 k4 ^# ^8 v
  218. ;音乐显示(缓冲)! ~4 t$ H" f% @6 S% g, O# T6 N
  219. .IF SOUND_BAR_SHOW_ENABLE0 U8 Z3 u8 A0 a3 t! a
  220. JSR Music_Vision
    , X/ L% F# D2 a  g
  221. .ENDIF3 w- T2 h. b/ v
  222. / \8 ~) x, e$ K) m7 V& ~
  223. LDA Time_Wait_Cnt4 y7 S, Y* u8 D" O
  224. BEQ NmiProgramProcessEnd8 V, G# N% ]* J, u* K
  225. DEC Time_Wait_Cnt
    * N% _4 [& ^/ `7 V/ `! r* m2 N+ y
  226. NmiProgramProcessEnd, D! b2 G# Y5 _4 e  @& x9 ^
  227. RTS2 w) s* F8 \+ E2 B( {

  228. 8 g# q' ?+ Y1 O5 v6 h4 T
  229. ;==================================================
    1 E" U7 d7 @3 P
  230. ProgramBegin;主程序# X2 G, F. A+ l4 u7 _& s' ]5 E
  231. LDA #$007 |" I1 l! x% z" A7 m
  232. STA PPU_CTRL+ `! m& s- F" Q' q. g
  233. STA PPU_STATUS
    & S. S2 B# s( `
  234. STA PPU_MASK
      [3 Y4 B. w7 U9 l
  235. STA APU_STATUS
    : f  J! C6 b" ~2 t. o' |
  236. STA PPU_SCROLL1 A) E2 }. r% C" v& W8 `; I
  237. STA PPU_SCROLL
    8 E: H: p2 L0 ^% G
  238. LDA #$C0
    * O) i- h" ^( }; G( ^
  239. STA JOY2_FRAME2 b3 z- F$ F, G! ]7 ^
  240. 7 ~4 E8 _! Q5 V- r, s3 c; I( \8 @
  241. LDX #$FF
    & h. j8 N! |; ?* ?
  242. TXS2 V5 p9 k5 v+ B% `
  243. LDA #$000 i% Y3 ^4 i" `) Q# @7 a" }' C4 e" Z
  244. STA PPU_CTRL2 h6 g. L8 j* d9 R
  245. STA PPU_MASK
    # t) M3 q/ O  `- R% P
  246. STA MMC3_IRQ_DISABLE
    * @- A7 a: J: p( X" m. e2 v" Y& F
  247. 6 y, l$ p5 J3 H; `; P( c+ s% N$ ?/ n
  248. ;==============================
    - H' ^. ]. q' u: w/ ]
  249. ;调色板清空! ]' b! Y# G# Z# M3 }1 \  v: x
  250. LDA #$3F
    3 L' a6 Z$ p* Z+ a2 M" M
  251. STA PPU_ADDRESS( z) ?. F3 G) b
  252. LDA #$00
    ! Q: `1 T1 D2 [+ X. _" ?
  253. STA PPU_ADDRESS
    1 u6 B% L% J4 w) F8 U
  254. LDA #$0F
    # E$ |) P) R% G
  255. Palette_Clear# N2 z! F+ K" L% ?# j0 o$ ?
  256. STA PPU_DATA
    ; M' V+ T( X% O, I, |( C, F
  257. INX
    ! k( A0 q3 j9 g: ~
  258. CPX #$20
    ( k) y$ e, d) ~# j2 G1 C5 P
  259. BCC Palette_Clear
    : j% @8 e6 @# w+ }+ E% J6 [" r
  260. LDA #$00, {; J$ C  k* k4 B
  261. STA APU_STATUS
    7 ?8 H8 Y1 c8 H. P
  262. ;==============================) A+ w6 s. f. w. v" Z7 l
  263. ;初始化背景调色板
    5 a. s3 B: O2 j/ f/ o  X
  264. JSR Set_Palette_Color
    8 Y3 K8 n7 t% h# G' \+ s
  265. JSR Set_NameTable_Attributes
    2 t7 y2 _* H1 s! c! k( V. B

  266. $ P- K, F2 M5 c2 m$ C" B* Q# p8 h
  267. ;==============================
    3 O7 ~2 {( V; v$ w7 C. M. P
  268. ;RAM初始化1 b! a6 f! h7 x  n) F1 S# R
  269. RAM_Clear_All3 f! c. `/ \. k, ^; X
  270. LDX #$00
    1 m; A/ s( f  L2 j2 o3 p8 G
  271. LDA #$00" E9 R* H, P5 A/ t# ?
  272. RAM_Clear_All_Start
    # c" N$ y$ K. @1 `5 b# O
  273. STA $00,X
    ; e- a0 P, i# X7 W3 E
  274. STA $0100,X* b: j+ F' I( \2 F; Y
  275. STA $0200,X( y) ?8 a8 c& B+ \
  276. STA $0300,X! j& R0 n$ A, f6 B6 s& Y- e
  277. STA $0400,X
    3 M% C. i  q4 C9 X! o8 C
  278. STA $0500,X
    8 H) f7 X) n( L/ [6 C& h/ `# T
  279. STA $0600,X
    8 F3 j% n# A( l0 |6 O; {% C
  280. STA $0700,X
    : F* V0 [. g. a! s5 s( Q
  281. INX3 f( s3 J2 ^7 u8 K3 C0 K9 x
  282. BNE RAM_Clear_All_Start" ^- r; F! \- \4 u3 z2 l) i& n3 ~

  283. ; r( S& e* J! t8 ?2 j. ?; ]
  284. JSR VramInit
    : @) B( X6 G5 y9 S$ n# U
  285. JSR Init_Palette_Addr
    $ W( f$ j8 M% P* I; J) g: [/ C

  286. 7 N2 E  F1 Z1 R$ B
  287. .IF Music_Reset_Addr* a( u# k8 b; S) Z4 v
  288. JSR Sound_Reset
    ! @: D: f+ }+ A- X
  289. .Endif5 H( g4 a: [" D+ n5 R, d
  290. ; {# P* }& t2 r" q+ Z0 x
  291. LDA #Music_Start_Song-$019 b8 N9 U" F5 e; D: w$ h0 p. T
  292. STA Music_Cur, x+ ]7 `5 Y! Z
  293. + }& ^( P; d8 W
  294. JSR Show_Music_Text
    3 O$ `7 U% Y7 r
  295. 4 x! S( B8 z8 t1 u# [6 c" F7 B1 S
  296. .IF SOUND_BAR_SHOW_ENABLE# P5 Z9 Y& b) {  k$ @
  297. JSR Sound_Bar_Text_Set
    % @9 c& R4 |) z5 a/ s3 E6 ]
  298. .ENDIF8 A! W& I& c) Q  K9 |
  299. : y7 a9 I4 q9 V8 L
  300. .IF Track_Name_Pos1 q1 T$ e& b9 h2 N0 p& V. P$ G: \
  301. JSR Show_Track_Info
    - ?1 J5 i3 d$ e; x
  302. .ENDIF
    8 G4 F) ^- _, X% J" x

  303. ; S' O5 P: b& u  y4 f) R
  304. JSR PPU_Proc/ @& w* {* A9 N8 {5 ?: Y

  305. 9 c+ e$ i) l! N/ z
  306. LDA #$0E7 W; [1 i0 [2 S2 t# G( Z! V
  307. STA Screen_State
    " w; z, q/ u( r6 ~# l

  308. % Y! ]- `& A- ~2 I! b* Q, z+ b
  309. JSR Sund_Bank_Init1 i9 J# m, s- |( k' w; R) M! n
  310. , @1 S+ _  H: ]6 m8 m, V9 g
  311. JSR Music_Show/ y* S4 B; k+ H( ^" M
  312. JSR Time_Show& j4 i7 l6 x1 H4 A
  313. JSR Music_Stata_Show
    8 z( {3 i8 ?2 l' W0 }3 Y, x
  314. JSR Time_Delay# ?# O3 }; R% v  ~/ N
  315. # I( j* [# ]9 h- R
  316. 0 n; \; W$ Y) H% R/ V
  317. LDA #$80
    . z) i4 L1 }7 G/ Y4 {( g0 S1 \
  318. STA PPU_CTRL
    ) |* f2 H* G$ B  {8 L" l

  319. : w) ~& |1 u: Z# r
  320. LDA #$205 ?3 d2 P' _% w. r
  321. STA Time_Wait_Cnt
    , e  _7 u. S# a. X- S8 l$ y

  322. 1 a# T8 N- S0 w/ \- E8 k% w
  323. Wait_Time_Over" r' s0 T( }7 @* g
  324. LDA Time_Wait_Cnt2 h; X# b9 K6 p! x0 {
  325. BNE Wait_Time_Over7 x9 H  _2 ?+ O' |, D# G7 q, i: ~
  326. ; M4 W% h' Z0 d
  327. LDA #$1F
    ) V0 V. ?7 b4 d6 J& M; x
  328. STA APU_STATUS; z. x) V* a5 y+ l* _: h
  329. LDA Music_Cur3 |7 `/ j) J* p# ~& @* L
  330. JSR Sound_Init6 l* ?9 y# z& [

  331. 0 K1 O+ [; g% f9 P+ `8 ^
  332. JMP MainLoop3 j% O5 T, @. O. f

  333. % Y  i; k* t: z) c
  334. ;==============================/ Z  \( P! f' p2 k; `
  335. Time_Delay;延时等待* O- Y* u4 g4 |4 N  e" E3 t
  336. LDA PPU_STATUS
    : f0 v2 i  Y8 n3 E8 _  d
  337. BPL Time_Delay- J6 J1 M3 Y5 Q7 g' D3 k2 H
  338. RTS
    , Z! l, b. @# o; G: M2 w2 W6 h
  339. - f4 Z/ Z8 y  _; O1 U: _7 U
  340. ;==============================
    2 @8 _" g! [# D; u; _. R
  341. VramInit;初始化图形内存
    $ ~6 O0 ~+ T: @# C0 u3 k, q5 K1 X
  342. LDA #CHR_DATA_BANK& v- R! V* i9 O1 E
  343. JSR SwitchBankA000
    ) G$ J( T+ S3 g: |1 N1 x7 m
  344. LDA #LOW(CHR_DATA_ADDR)
    : {4 ~$ q5 n" _
  345. STA <Data_L8 E! U0 p! J0 A( A
  346. LDA #HIGH(CHR_DATA_ADDR)8 G# }3 X3 N3 f0 u. I
  347. STA <Data_H) v: [3 ^' o) `. [
  348. LDY #$00
    : Q1 ?) v+ X. j
  349. LDX #$209 D( q+ x  Q9 I- \4 z% s3 T/ t! b
  350. LDA #$00
    4 r1 J& C9 l) U
  351. STA PPU_ADDRESS& q$ W- v( ?0 D5 E- b/ E& a' c' @
  352. STA PPU_ADDRESS& N! ]5 X1 B: `; G) u
  353. VramInitWrite
    / b8 W+ k: _9 T9 ^. p7 P
  354. LDA [Data_L],Y
    1 e8 ~1 m+ f! c5 V& f! v3 I
  355. STA PPU_DATA( s8 M) {' g5 V$ o- g  e& T
  356. INY
    0 r8 a2 j4 M% y# ~
  357. BNE VramInitWrite
    4 o7 }; Y" ^0 C" l4 [# I* _, `, S7 m
  358. INC Data_H
    1 l7 ~% r& M- L
  359. DEX
      v7 p' l* E' i
  360. BNE VramInitWrite
    8 z  P9 D" s3 S* `5 d
  361. RTS* R# r6 h+ a8 v
  362.   g3 E  B9 X5 z& F0 c, T2 y
  363. ;==============================  ?7 p5 A- z5 [
  364. RAM_Clear;RAM清除; H0 z6 x# G- `3 h3 n
  365. LDX #$008 V/ _4 ?1 y* Y. g
  366. LDA #$00& P$ y) |' ^9 ~$ f2 w* i9 f
  367. RAM_Clear_1
    ' B" Y# g9 f0 z& d2 h
  368. STA RAM_Cln_1,X
    8 `, `5 k# _" R
  369. INX
    7 ]  J/ P1 a! t
  370. CPX #RAM_Cln_1_Size% F* a" [9 T1 B( O. n* R# B4 S! e
  371. BNE RAM_Clear_1. D" J1 U; l7 N5 D/ }% F/ m# `0 i  x
  372. LDX #$00
    5 I& A  v$ \- {7 Z' l
  373. RAM_Clear_2
    4 r* x) a+ @3 e- M, F$ L: w
  374. STA RAM_Cln_2,X) b8 j* g* H1 v  Q5 `
  375. INX
    " N0 P; q" W+ [0 h# H& e9 C$ L9 g
  376. CPX #RAM_Cln_2_Size5 C) S- c7 \: Y( v$ D% x
  377. BNE RAM_Clear_2
    - D+ H6 b4 i% v: [
  378. LDX #$00
    5 L$ }3 }8 p% F: H, y
  379. RAM_Clear_3$ S3 }: t. G" `/ t$ d# N1 T
  380. STA RAM_Cln_3,X' W4 O' F& e( v1 G
  381. INX7 t. d. B( Z) u% [  n1 I  I
  382. CPX #RAM_Cln_3_Size: _. ~& S7 s! ?
  383. BNE RAM_Clear_3
    3 \. U4 C6 }% C) t8 p) ~# T
  384. RTS
    / Z. e' H' B1 n  `8 _
  385. % p! b8 y6 ]' K' t) R/ s
  386. ;==============================# D4 {1 w! |2 j0 f2 z, J
  387. ;音乐切换
    6 L  r% T, ?; _, w) Q' X
  388. Music_Switch
    " l- ]$ l: q9 Z
  389. JSR Key_Proc
    % \  M! G8 e$ k( c! m/ g8 R. g- k* F
  390. LDA Key_Once
    , t8 @2 j4 K! M! H5 w  o& Z
  391. CMP #$10
    8 G9 H! R, t/ x8 b
  392. BNE Music_Start_SongStop) J+ v& D' M- n6 A( v8 ~. z
  393. JSR Music_ReSet' T( I9 _& n3 c8 V. b( U8 F

  394. ! H8 B) B8 v  R: b/ O" k
  395. ;音乐停止
    ) z; b6 D0 e. w: |) y1 Y$ O
  396. Music_Start_SongStop( Q/ w: x) {- S$ `" N
  397. LDA Key_Once" }8 Y$ F/ H0 w9 N1 s  L" d
  398. CMP #$20
    + o: b+ f1 N% k+ b+ r* d! {' D
  399. BNE Music_arrow1 ^0 H% }3 K$ m+ |% C
  400. LDA #$01
    " }9 I- B7 ?+ I
  401. STA Music_State
    + r! H( ~8 }# w0 p! Y
  402. JSR Music_Bar_ReSet
    9 R# K$ o0 L* H+ g& X1 z5 |" ^7 z
  403. JSR Time_ReSet, [6 x! u6 x. x$ ^. [: w
  404. JSR RAM_Clear" c5 ^/ R- Z5 t; v$ L% Z
  405. JSR Sound_Clear  }; {" B  U% ~, K& r0 [
  406. JSR Music_Stata_Show
    / i4 t" P) `) g1 K7 W' O
  407. Music_arrow# t* ^$ f. a8 {
  408. LDA Key_Once% V8 l# D5 U; ~4 A5 J+ f) j
  409. AND #$CF0 _! q2 B! o4 ^+ i
  410. BEQ Music_Switch_End# h- W2 D: J: @$ y0 f/ d; {
  411. JSR Music_Number4 Y( S; s3 N$ {4 c
  412. JSR Music_ReSet
    # Z& \3 w& t8 J; z
  413. JSR Music_Show1 Z: Z( U; S9 ^: m
  414. Music_Switch_End
    0 g+ y6 x- X. _) F1 U- t
  415. RTS4 t% m/ {. f5 o+ \

  416. 9 C9 m- p1 a" m- V% f
  417. ;==============================" W0 M5 J  |. M9 [" O# M& B' t* |
  418. ;音乐曲目切换
    ' R  @2 ]* h& ?
  419. Music_Number. B, B' f. |  ?) D! P" j% a
  420. LDA Music_Cur
    / `. W! k& @" t- p: k, @
  421. STA Music_Last: P7 h, X5 e8 q. w' D- ]0 {
  422. Music_Decrease3 E# X! j: w& V: u
  423. LDA Key_Once
    & b7 ]% O# [! x! f* H% r
  424. AND #$42
    5 j: S0 z1 u, o8 o1 }, ~$ ]% o
  425. BEQ Music_Increase; r2 e5 v9 y- l7 g! x; ]
  426. LDA Music_Cur5 y+ t  h& C8 A# M, E* r5 x
  427. BEQ Music_Increase1 M% g) Z8 _0 j) u
  428. DEC Music_Cur1 J# _. Q* c+ L8 S  ~- l' t
  429. Music_Increase
    3 K/ y) J, O3 J  s6 @% Q4 _) O' {
  430. LDA Key_Once, j4 y  }0 M- [4 @, v( s
  431. AND #$810 X. [: |' _! A2 t5 k$ s
  432. BEQ Music_Decrease_100 d+ W7 y2 h" y* f  U# ~6 C) M
  433. LDA Music_Cur/ {8 [8 z. X# {9 R1 V$ ^4 k6 d! ^
  434. CMP #Music_Song_Total-01' c& M$ `: z$ j1 V3 O+ w% ~1 _
  435. BCS Music_Decrease_10
    5 z( Z, B7 f4 C1 w
  436. INC Music_Cur0 _% O7 U; \7 `2 ?8 C+ c# `
  437. Music_Decrease_10
    , P2 a2 F1 B2 ?& o) P
  438. LDA Key_Once
    : x: W3 ^2 u9 ]' m7 n/ R
  439. CMP #$04' T1 ^" y# P( Y4 M) G1 O
  440. BNE Music_Increase_10! m' S8 h8 |2 |
  441. LDA Music_Cur
    * Q; z  H  E" e- C5 q* n
  442. CMP #10$ {3 @4 J6 o1 P8 _; d+ c8 R6 N
  443. BCC Music_Start_Song_Min
    1 M* u  t) e" `6 Z0 k2 I# D
  444. LDA Music_Cur5 ^# {8 U1 r! G+ r" L: Q0 d
  445. SEC
    7 w8 W9 O* ~! t  `
  446. SBC #108 f$ t8 k! Q! r7 _7 A
  447. STA Music_Cur+ ^9 o$ m/ X/ j% @: m: r$ _! ]
  448. LDA #$00* ?# f1 ]- v6 b3 @8 {5 C5 g* o
  449. BEQ Music_Increase_10
    ! \0 u8 |& z! @$ v7 x
  450. Music_Start_Song_Min+ r6 j" [9 Q7 r2 O
  451. LDA #$00
    1 `" [% _8 N1 D1 @6 \$ u
  452. STA Music_Cur
    1 R# r0 \2 e7 z4 K! M7 \+ `
  453. Music_Increase_10/ E  e7 r. |3 m% g
  454. LDA Key_Once
    3 R& T  f% S3 t
  455. CMP #$08
    2 \' d2 d( I: X, h3 t
  456. BNE Music_Number_End
    7 _1 d3 Q! a/ ^/ w
  457. LDA Music_Cur/ Y/ j* x9 M# P: C9 X6 F; F5 C9 N
  458. CLC1 P' \4 P( U" M  M
  459. ADC #10
    ; Z* Y# s0 E: w- u8 Q5 S6 N
  460. CMP #Music_Song_Total-01
    ) B6 D# h' I' ^8 s
  461. BCS Music_Start_Song_Max8 d0 L) t. @* }" M* ]) n' x3 k
  462. STA Music_Cur
    7 A5 K- `3 X9 {
  463. LDA #009 T* A9 H0 a8 w, w
  464. BEQ Music_Number_End# \1 H3 a! u7 i* G5 Q7 e' ^
  465. Music_Start_Song_Max+ K& ]5 z; j) X5 l& {
  466. LDA #Music_Song_Total-01
    , F  ^5 ~3 l9 z0 @9 s4 w6 S
  467. STA Music_Cur
    # T6 P  Q' t3 T$ q2 |) x3 Z( B
  468. Music_Number_End
    ( J2 ?9 u6 S* O
  469. RTS" d  p$ O- }; o' C

  470. + g6 `/ M; j. o% K, g3 _$ E
  471. ;==============================
    % _9 |6 }/ _6 Q# A" T) C/ f0 F$ D
  472. ;音乐重设
    ! s$ [# W) ~* Y7 N
  473. Music_ReSet; N  X$ H( h" K4 t- p' T2 m+ f
  474. JSR RAM_Clear
    . e* V' `8 Z4 c2 a: P6 x
  475. JSR Sound_Clear6 G, ?9 B: d; F( X0 y
  476. LDA #$1F2 t! Q0 Q8 q$ k2 W5 ~. I
  477. STA APU_STATUS( I$ [# }* ]) n
  478. LDA Music_Cur. }7 q/ H2 `, ^5 l  T/ C
  479. JSR Sound_Init
    $ Q8 y" k  N  V% F
  480. RTS
    9 I9 I2 g3 D1 A! |! r( j4 a

  481. $ F6 g" i9 k- ~% b! y
  482. ;==============================4 k; l1 y; D( }( a/ X
  483. ;音乐端口清除/ s0 M8 M: v; M
  484. Sound_Clear  R0 K. W+ b7 D2 D* Y# ?
  485. LDA #$00
    % F0 T% M* i1 a% R2 H( g$ _4 U
  486. STA APU_STATUS
    ' }# H; ^6 G9 l( c6 v
  487. LDX #$00
    ! `1 `2 F# f% C' G( ?, u7 D
  488. Sound_Clear_Start
    & d3 X4 f8 r4 l3 |+ x# L$ ~
  489. STA $4000,X
    ) S& o% x. v2 }/ i
  490. INX
    * A7 W1 @7 P! ~1 P
  491. CPX #$14
    7 T$ a9 p' g2 l" z+ q9 R
  492. BCC Sound_Clear_Start
    5 Q8 w0 W- d! I4 G+ t& ~: x+ r9 G
  493. RTS# G# N$ l+ h% ^) t$ K
  494. $ K2 K5 q4 E; y8 \. P! Q
  495. ;==============================5 |' s: G6 E  d& a. W
  496. ;按键处理
    0 x1 W5 N  k, A5 k) h
  497. Key_Proc
    7 N5 P% t1 E! o# J
  498. JSR Key_Scan: U) ]8 t& g% x  i0 n  a0 S
  499. LDA Key_Keep
    / y/ J+ ^; [- \  ^7 r" z0 l
  500. STA Key_Temp
    5 Q8 @# _/ l6 b1 |' l3 ?( g
  501. JSR Key_Scan. i- [) E9 p& M
  502. LDA Key_Keep
    7 d1 w# X& Q3 z" t
  503. CMP Key_Temp
    + I! P' m/ S- _  \" X
  504. BEQ Key_Get_Once
    ( }& P  C. U" \
  505. LDA Key_Kemp) L6 B) i' x- j
  506. STA Key_Keep) j) a+ j5 Z; j
  507. Key_Get_Once% e5 R  ?! h3 W8 `3 C9 I& Y
  508. TAY8 X) c6 t' s0 h
  509. EOR Key_Kemp
    $ F1 D: d7 B& f" i' K: V6 }
  510. AND Key_Keep
    4 E* z$ K6 D. P7 X/ n
  511. STA Key_Once
    / D- V7 \. g6 ]
  512. STY Key_Kemp
    5 w6 V% g; p: B! A) u
  513. RTS" ^0 T8 N# l3 m1 s! I  d! }
  514. ;------------------------------
    . U8 V) {. P1 X2 h5 U
  515. ;按键扫描3 o& n" S- y" n4 u+ w3 S
  516. Key_Scan
    4 [( I$ o, [: L# r8 q
  517. LDX #$010 [, \. g* `% L/ [. m  S- T) U
  518. STX JOY1_FRAME" J, X9 L/ \) k8 q
  519. DEX
    % p; U1 e9 x0 H& o  M0 f: q5 ]
  520. STX JOY1_FRAME8 B9 F: y) ?" u5 ?4 E- R! p. G8 [
  521. LDX #$08
    0 P* z; Q8 [4 K& C
  522. Key_Value6 Z$ J9 h. J. Z
  523. LDA JOY1_FRAME, J1 h& r4 S" G/ k$ d* i
  524. STA Key_Getv1 d# p; S" A+ ~
  525. LSR A) x+ w3 }: s1 I0 [4 W
  526. ORA Key_Getv
    , S4 y) T! x# P4 a8 P/ C
  527. LSR A2 U; o; o, V) c# J
  528. ROL Key_Keep5 F, m0 D4 \6 T' W) j
  529. DEX
    ) ^: I$ V+ C  o! P
  530. BNE Key_Value
    ' N( E3 n) _. f$ R
  531. RTS
    + j$ l+ _3 I: g' i  [# q# F

  532. 9 c" {9 d% d) k2 H( k$ Y- o
  533. ;==============================" i$ R  V6 }; V# i5 }6 U3 H' S
  534. .IF SOUND_BAR_SHOW_ENABLE
    1 g9 e3 i3 C4 g5 p. k
  535. ;音乐条显示5 {4 ~8 B2 _, M- E+ Q6 w/ Q
  536. Music_Vision0 ^  R& Y$ H" l/ g  O' i
  537. JSR Music_Animation% t" k. V) ^" Y( E8 d/ K
  538. JSR PPU_End  S% A, {% ~/ r, ^. Y3 ]
  539. RTS
    - R, f. q! `8 Z4 q
  540. ;------------------------------
    - T  Y! ?2 P1 A* m3 f/ V
  541. ;音乐条显示处理. `0 a3 j3 B1 a3 R
  542. Music_Animation  M# u- V9 K4 ~" g, P* B
  543. LDX PPU_Cur
    5 D' E3 P6 r) V7 b0 k; q( t0 h& D* N
  544. LDA #Mode_Line. c3 o/ L; n9 m! A* g! `& K
  545. STA PPU_Addr,X& L5 x! G7 I2 l6 s# A2 p6 i: s! T
  546. INX/ W; E* f  r3 W6 \$ J6 Y7 \4 A
  547. LDA #HIGH(Sound_Bar_Pos)
    6 O; J/ j* v3 K
  548. STA PPU_Addr,X1 ?  u/ ]% N6 {) P+ F5 t
  549. INX
    ) L: |, G% c4 F5 |% y) e2 |* M
  550. LDA #LOW(Sound_Bar_Pos)
    $ H, p7 Z& _  U  H2 h1 j; ^" ]! ?. ~
  551. STA PPU_Addr,X" L2 C7 X/ y, Y$ U4 q- {
  552. INX
    7 S4 v7 m2 T+ _
  553. LDA Sound_Bar3 c% _0 o  ~" w
  554. JSR Volume_Convert7 X2 y; J& N9 H! v3 o
  555. JSR PPU_Return
    ; l  \; g( T% `# Y
  556. LDA Sound_Bar+$4
    $ v9 c& v! T4 G  S' w
  557. JSR Volume_Convert
    # r* p. o& c8 V& u: c( i
  558. JSR PPU_Return- x' s: d" i% w  X; Y7 v1 ~
  559. LDA Sound_Bar+$88 O- g2 P6 q2 E
  560. JSR Volume_Convert_Ex
    7 M: I2 l$ r6 @2 J
  561. JSR PPU_Return/ W, d# i; ]0 c7 Y
  562. LDA Sound_Bar+$C# y+ g8 K" p9 B8 k  S6 V! X
  563. JSR Volume_Convert! {! \# b4 n5 o7 Q7 w% ^8 I2 K$ j9 y
  564. JSR PPU_Return
    : o7 l* Y( u3 G- ~
  565. LDY #$104 ]1 U0 g& h8 Z5 j6 K( O4 Z& Y8 a; R
  566. LDA APU_STATUS
    3 n$ w+ l, H7 r% z' Z+ ~
  567. AND #$106 s& N& l( n- z: h3 V- x% q7 F* }) ~. s
  568. BNE Volume_Count
    3 `4 Y7 H. a% t/ w4 H
  569. LDY #$00  T; b7 v, y; Q; ?  l
  570. BEQ Volume_Count
    2 h. e0 X  |! ]% W9 g4 e
  571. ;------------------------------6 e- s* n5 Z! h0 d) H: h) c' O# Z
  572. ;音乐条处理, C8 k- D. V1 t. i0 x; |
  573. Volume_Convert_Ex
    2 a+ O, j4 W% N* A* [8 H" ^7 k
  574. AND #$1F
    , A/ s! q& X$ k* x! x
  575. TAY
    ) q; w# |1 z7 X, u, _( h  \
  576. BNE Volume_Count
    ) ^. U3 N: r0 {! c4 U, V
  577. Volume_Convert
    + P4 k1 p, Q+ a
  578. AND #$0F
    4 B3 k9 m, f; n1 `' d
  579. TAY9 U5 D$ _& h: V3 Y- D+ c% O
  580. Volume_Count0 m5 d2 x1 K5 S+ b5 j8 X' {
  581. LDA #$08
    9 k2 W2 q: a4 {5 e" v( V
  582. STA Sound_Bar_Cnt
    1 i' e( G/ g+ R/ L- `$ s  H0 s
  583. Volume_FILL' e# G4 |+ I8 `  \
  584. DEY
    # y$ D) w. i" R
  585. BEQ Volume_Half
    % ~" P0 j4 i$ b( m
  586. BMI Volume_Empty3 j7 B: n$ q6 |/ e+ d
  587. DEY! K5 F  \9 G; c
  588. Volume_Full& {* V4 D& v# r4 S
  589. LDA #$16( u$ z- e& K7 G9 T' T+ q2 a
  590. BNE Volume_PPU
    4 ?) C9 E: f9 ?. d9 K4 U" V% ~
  591. Volume_Half: E  h. N; E, R  R
  592. LDA #$155 O4 q. `7 Q/ c, V" o
  593. BNE Volume_PPU) g+ Z8 l* u: t9 L7 U
  594. Volume_Empty; P; y3 s/ e+ |$ Q
  595. LDA #$14
    4 Z: e8 E* ^, C6 h! a( a
  596. Volume_PPU
    + A6 T1 G- |8 p1 ]  l% B7 v) G
  597. STA PPU_Addr,X' E- {5 y; _) p4 m0 _- a
  598. INX4 o' ~: s+ y$ a$ r0 [: a2 F
  599. DEC Sound_Bar_Cnt
    % n4 K+ Q1 P! k
  600. BNE Volume_FILL9 T7 f; W( o1 B; L
  601. RTS
    9 p" l3 ^7 J5 Q8 D5 M* k

  602. ( K+ C& j. F/ }! N3 Q) C) H
  603. .ENDIF
      K, t% Z* V- {0 U" e3 O; o

  604. 7 R. ?5 w. Y5 r% f# e3 D1 N
  605. ;==============================
    , y; M5 Q3 A8 u. C
  606. PPU_Addr_Set;PPU行开始2 B7 l0 N5 G6 k6 Y: K* F
  607. LDX PPU_Cur3 r, O6 p0 n2 l
  608. LDA #Mode_Line
    ; b9 o2 m# O5 {" n
  609. STA PPU_Addr,X
    ( _, ?/ D! \' _9 R0 I* R7 ^! V
  610. INX- i- L8 v+ g7 i( F$ @
  611. RTS
    ( b# u2 x, b4 v" N- x
  612. 0 Q9 t9 x- ]" N! Z' k
  613. PPU_Return;PPU转行
    % k6 I/ j$ X; X. y, E& E
  614. LDA #Flag_Over
    3 |! v* M8 r* f! G3 F
  615. STA PPU_Addr,X
    8 H' J$ Z( C/ L' p+ g, z" m, M& I
  616. INX
    ) R/ u: _' m! y! H
  617. LDA #Mode_Return
    : G/ j4 s% A# A  O5 m( |
  618. STA PPU_Addr,X4 m6 w; A+ b4 U) m* k% Q
  619. INX
    . f5 h' \/ q5 \4 B! f
  620. RTS
    8 i& X; i6 c4 B; F% t, R

  621. 6 j, J: n& t6 \' I+ v6 w
  622. ;------------------------------5 e/ P$ y" U% p& n! r
  623. PPU_End;PPU结束; n( A, A' s/ j  V4 c1 j! F: ~
  624. LDA #Flag_Over
    . w2 X' |% b1 q# K' h2 D" _
  625. STA PPU_Addr,X# \' t" Q6 }1 D  p; p8 Z; k' x
  626. INX
    $ z$ _& X0 M2 R+ G6 e. M8 d3 P
  627. STX PPU_Cur9 |6 D+ u/ a% {% g( a
  628. RTS
    ) O3 D; ?3 b. n+ m
  629. ;==============================
    3 g$ v: W' L8 W$ d1 r
  630. Mode_Line     = $FD    ;新起行模式
      H7 v: F8 Q! P) C2 X/ s1 l
  631. Mode_Return   = $FE    ;转下行模式* E+ [. f  [( X
  632. Mode_Clear    = $FC    ;行清除
    ) n/ X2 o% p8 b" z
  633. Mode_CntLine  = $FB    ;行计数写入+ w" \  M7 f: B0 V/ N8 ]+ K
  634. Flag_Over     = $FF    ;行结束标志9 I$ \* s  c2 F4 N% ]
  635. / ^! u* G9 o* `; E2 L. j% J& Q; O
  636. ;------------------------------4 H7 X0 Y% s" u/ c! [* `
  637. ;PPU处理
    & @+ J/ l+ c0 l  H  j' F9 n8 U' A
  638. PPU_Proc
    9 i) l/ @/ |5 ^* a
  639. LDX PPU_Cur
    : L; D. \) R0 s+ o/ ?
  640. LDA #$00
    : B9 x8 r0 t1 F
  641. STA PPU_Cur
    ! {% q4 E: ]2 ^# F" v
  642. STA PPU_Addr,X
    ; c3 b* p" U" b8 E& g( Y) S
  643. LDA PPU_Addr
    4 g. W. _5 G; x  f
  644. BNE PPU_Proc_Beg8 i" `5 E  |3 E# i+ f7 i
  645. PPU_Proc_Ret
    ; Z7 S; C# ~! N# O2 O
  646. RTS
    9 Z' R: `3 I* T6 `
  647. ;------------------------------, q. p: U* w! p6 |7 z
  648. PPU_Proc_Beg  ;处理开始
    & H& d. ^$ n8 i# D  O5 E% {
  649. LDX #$00
    , M$ |" O1 C  ?; ~1 M
  650. STX PPU_MASK
    - B/ y* @' l9 W5 u7 \
  651. ;------------------------------& d2 }3 N7 ?6 K' T  c2 `. @3 a0 t
  652. PPU_Mode_Select  ;模式选择0 i* p  ?2 O! a. A
  653. LDA PPU_Addr,X
    : D" C; m9 z4 s; w  z2 J; ]2 p
  654. CMP #Mode_Line: t! w# J2 _6 U5 E! R
  655. BEQ PPU_Mode_Newline
    ! \3 P; N1 V: z' S/ J3 i
  656. CMP #Mode_Return% Y3 ?1 x$ {7 E& j) i9 T
  657. BEQ PPU_Mode_Return/ N* {8 C4 Y+ {- G5 m4 t, C! [
  658. CMP #Mode_Clear
    # x) g7 ?# K# q0 [, ^
  659. BEQ PPU_Proc_Clear
    0 g, N* @5 ]. i1 p$ Y2 P4 u) v
  660. CMP #Mode_CntLine: g# o" w& L; B2 E2 ~
  661. BEQ PPU_Proc_Cnt_Line
    7 X: {* Y+ g- {' l. S# ~; {. u$ W
  662. RTS
    5 P  `8 ~# L' K' Z5 \& z- ^2 {
  663. ;------------------------------
    0 ~. Z. D: g- q! f
  664. PPU_Mode_Return  ;转下行模式3 e# k# w) g" P9 W2 ]
  665. LDA PPU_Addr_L
    - |! H/ D4 ]" W- n$ t8 b7 N
  666. CLC
    2 T4 W* ?* {( [- N+ F, Q6 f3 X
  667. ADC #$204 E2 K" u7 M: B& S
  668. STA PPU_Addr_L0 D9 y9 {  i2 m9 l9 D1 i/ W$ a
  669. BCC PPU_Return_End
    ' b( j4 Q1 H' k( N; r
  670. INC PPU_Addr_H8 K: e. d" B. b# j
  671. PPU_Return_End
    % x: u" g7 n, l8 B8 I3 ~- ~: C
  672. JMP PPU_Set_Increaser- m1 A2 N! Z1 b9 u8 q& e
  673. ;------------------------------1 U! q* c/ _- {
  674. PPU_Mode_Newline  ;新起行模式
    4 H' i5 C1 N1 z
  675. INX
    - |, f! W! e+ M
  676. LDA PPU_Addr,X
    4 X/ U& q, b8 B% z! W) P
  677. STA PPU_Addr_H5 B* X  ^. E9 n- x
  678. INX
    / X: E0 s: ]3 A1 G
  679. LDA PPU_Addr,X9 W: W6 d  u" y6 t) u1 f( V
  680. STA PPU_Addr_L9 L1 ]: ?7 t, `% C
  681. ;------------------------------* m; @) i; {: h+ z# s/ x
  682. PPU_Set_Increaser   ;设置写入地址1 H2 z6 N" W( u
  683. LDA PPU_Addr_H
    9 V& ~: y- d$ V0 T
  684. STA PPU_ADDRESS8 s2 z7 ]; X# w
  685. LDA PPU_Addr_L
    2 G2 U( h: j1 i% P5 A+ a! a  |, s
  686. STA PPU_ADDRESS9 o0 R# R8 g% i0 n5 ^: @6 J
  687. ;------------------------------/ ^( x) m7 z/ o* {" K
  688. PPU_Write   ;写入数据) s9 A6 c0 S+ z* Z# m4 c9 A9 E. f
  689. INX
    " [" Z" {3 `7 z9 e9 U
  690. LDA PPU_Addr,X: c7 I) ~* h& z; P" B/ C* B, j
  691. CMP #Flag_Over. c3 Y. H+ d) F2 V" t. E8 j* b
  692. BEQ PPU_Proc_End
    1 r' `# f2 U( o* J( m" P5 P
  693. STA PPU_DATA! e2 w6 H6 C* Y" l& {
  694. JMP PPU_Write# J/ P3 h  x" |- z. k
  695. ;------------------------------4 O! v! T3 y  N8 H
  696. PPU_Proc_End  ;单行写入结束
    ( P! P1 N& R- v1 T
  697. INX
    ; h$ S; W3 \3 y8 g6 w' W! o) n
  698. LDA PPU_Addr,X
    # s4 [7 g3 M1 v
  699. BNE PPU_Mode_Select( z& p. b2 g1 S' ]0 T. r, \
  700. STA PPU_Addr
    8 p6 o; J% u4 h
  701. JSR Update_Palette_Color
    + z8 w6 Q/ F- B. I) n# s
  702. LDA #$00+ G7 U1 U9 x" \' I/ D, t
  703. STA PPU_ADDRESS
    % I3 G7 R( Q6 Y
  704. STA PPU_ADDRESS$ |+ b% ^, m9 A4 N- I7 Z- B, L
  705. STA Show_Track_Name4 c' q7 q0 |1 B; p3 d+ ^, X$ n
  706. LDA #Scroll_X
    7 D. f* E" \# `; c, i+ ]- g% X
  707. STA PPU_SCROLL
    8 d: j0 H8 N. G  h+ u; C2 I7 \
  708. LDA #Scroll_Y) Q$ \* k4 g) ~& Y$ J/ f% N
  709. STA PPU_SCROLL! b* V8 ^3 D) H( B6 [
  710. LDA Screen_State" ~: ^. A6 ^% {- e0 k0 j) Y: I: ?
  711. STA PPU_MASK3 n( g; I1 S9 i3 j+ N+ q) K
  712. RTS
    * w3 K; K6 n, Z, H* s5 w* [
  713. 4 D1 I& ~- A' Q4 j8 F
  714. PPU_Proc_Clear
    + O" j; \( t3 f+ `+ k% A
  715. INX
    ) n7 [, ]) L9 @/ `9 ^
  716. LDA PPU_Addr,X( `+ P: z- C( q' |
  717. STA PPU_ADDRESS+ V- M% C7 P; ]2 L# P
  718. INX
    6 o- J% P  @) E
  719. LDA PPU_Addr,X
    ( D- T; x6 l9 i9 e" P0 i  x1 w; q
  720. STA PPU_ADDRESS' C0 d3 N5 z0 h/ G! l6 b2 y
  721. INX* s5 Y/ w0 Q% D  H) `* ]* H
  722. LDY PPU_Addr,X
    0 a9 |# S# {9 @9 h, E$ I
  723. LDA #$001 I9 Y  O3 d2 T" [" @
  724. PPU_Proc_Clear_Write7 }. j- L" O# @2 S9 ?3 f
  725. STA PPU_DATA
    ; ~" L, M7 h2 B, W4 \$ _. L# K/ Z
  726. DEY5 v# Y1 g$ D8 g% S
  727. BNE PPU_Proc_Clear_Write
    8 i' {; Z, X0 x7 f4 {. ^) E3 M* u
  728. JMP PPU_Proc_End
    ' V, E4 t6 W) m% o$ S1 S( n7 M8 m/ r
  729. # q' k9 K; v5 D' J# P
  730. PPU_Proc_Cnt_Line0 a. x9 q) |+ X+ c/ ]
  731. INX
      U) a; U# U; Z7 Q! @
  732. LDA PPU_Addr,X
    & G/ @2 _2 @# p! f$ P/ {& v  O
  733. STA PPU_ADDRESS
    ) q6 N8 J8 }- F
  734. INX6 Y: y- R* K/ a  x/ B6 H& z( P5 h
  735. LDA PPU_Addr,X
    . F7 }1 K2 _4 u( s# _
  736. STA PPU_ADDRESS) ]; f, K: I& Y  Z0 H
  737. INX
    4 o3 E8 i7 u0 ~! f4 S, a9 d: J. i
  738. LDY PPU_Addr,X
    9 R& @; Z# x! ]* b. j0 U' Q
  739. PPU_Proc_Cnt_Line_Write
    7 h4 A* C# X9 s
  740. INX) p/ J, S: r" _3 F; X7 t6 m
  741. LDA PPU_Addr,X
    $ x9 K$ i9 p$ J9 t
  742. STA PPU_DATA* [! p9 n8 W7 P: X! t
  743. DEY
    5 X6 ]% P  O9 n0 _
  744. BNE PPU_Proc_Cnt_Line_Write/ N6 q- B& N6 j( X5 G  R1 t! L6 H
  745. JMP PPU_Proc_End
    5 q; X5 G& O' Z: V: R) y3 c

  746. * T6 @! {- b! P, k1 @' Q1 V
  747. ;==============================6 |/ c. y8 o- k. r* T2 |$ e; q$ [
  748. HEX_To_Dec;十六进制转十进制4 [8 S, A1 n, o1 r) F9 d
  749. STA HEX_Data: T/ Z- `, y5 D7 ~
  750. PHA
    % h  U1 Q: D; X$ f# u( P
  751. TXA
    ; s7 d" ?* N5 |/ {
  752. PHA+ F/ ^1 Z, }1 m, m2 \- Q
  753. LDX #$00
    - a4 w7 \' [. Q0 X3 v
  754. LDA #$00
    7 s0 c  t8 j# D
  755. HEX_Cln
    * _- N+ L$ z3 z& W! B* Z) }4 F
  756. STA DEC_H,X$ J1 b& _$ x1 J7 I
  757. INX
    $ T1 b; A5 Q% r" V0 o  R
  758. CPX #$03
      M7 [! z- G- @- U
  759. BCC HEX_Cln' r( l" A8 l9 O& k' X/ }
  760. LDA HEX_Data
    : a6 C% I' \+ }. j/ L. O! z( D
  761. ;------------------------------
    ) @' {/ E# ?" X% j" Y! L9 c6 t
  762. HEX_100
    7 r' y( a4 _4 s# g2 _" I& m2 R: I) p
  763. CMP #100
    0 N5 k' o4 S: \8 V1 X' S
  764. BCC HEX_10
    % M% B$ @' x7 f3 t' z' r! }) g
  765. SEC
    6 D' r8 I. x" W5 N$ i. p8 {& @
  766. SBC #100
    & i: Y3 q8 X- H+ l5 q2 b
  767. INC DEC_H* S- u0 q& @, W8 M; T
  768. BNE HEX_1008 C. C# n. Z" H- h
  769. ;------------------------------
    3 G; c, l1 Z$ t
  770. HEX_10" \+ x7 g( A  i7 H3 T
  771. CMP #10. ~$ ^) M5 {; u
  772. BCC HEX_1
    ) ]! I- H2 s4 n
  773. SEC2 D( ?9 g; _8 x6 W$ e7 N8 C
  774. SBC #10# L/ L- @7 e( F3 |) ?8 {
  775. INC DEC_T
    2 ?# m1 O) t3 n: x% x  ?
  776. BNE HEX_10
    ) O- M" h& N" w4 l" G, G3 n! J
  777. ;------------------------------
    7 H$ x% w6 j7 F- g/ z$ T
  778. HEX_10 a, N3 j1 p9 Z" y' C  T
  779. STA DEC_L
    ) X2 U2 x5 B% @/ U3 O; n+ \- U
  780. PLA* I( i4 S, g2 f/ Y/ _' x  e5 U" Q
  781. TAX3 ^( g* p9 r0 G+ K: r
  782. PLA
    9 n+ F) R. J" Q9 N! k
  783. RTS( ^( A! Q3 Q# d; E; r

  784. # F: I9 u4 c' _8 d$ B/ Y
  785. ;==============================
    ; e* L/ R7 a  |% S/ a( G# m3 u
  786. ;音乐曲目显示6 h( C0 S8 o; e8 f
  787. Music_Show$ N( i# e- G( v2 p' B7 V. k
  788. LDA Music_Cur2 A6 @6 ~8 {) m! J1 e- K7 z( @3 A3 ^2 |3 c
  789. CLC
    ) ?4 V# v- z" U, p
  790. ADC #$01
    % R5 B1 [8 F/ k$ p/ x
  791. JSR HEX_To_Dec9 p1 V; h) S' C% x7 }
  792. LDX PPU_Cur) F. o9 ?3 Y1 x* p, m% R' E4 y
  793. LDA #$FD7 T  u: _3 E/ k  H. `. D" q5 C
  794. STA PPU_Addr,X
    8 H! j0 Q% y8 U& B2 x
  795. INX
    4 n0 j8 z1 X* K5 U
  796. LDA #HIGH(Play_Index_Pos)7 t0 {1 M  V/ q6 b1 g
  797. STA PPU_Addr,X. l6 P+ O0 e! _; t% m
  798. INX4 s/ _+ I, f+ }+ G, U- [- r4 n
  799. LDA #LOW(Play_Index_Pos); Z' ]- a3 O, r" c) Y9 I" G# [
  800. STA PPU_Addr,X
    : A: M( P7 U7 f; J2 w; d
  801. INX5 h  O$ z: E: K: z6 V

  802. " m+ Z  A* ~: O& S& [1 z
  803. .IF Music_Song_Total > 99
      m! ]. j' u6 y& j- s. |: y( R
  804. LDA DEC_H
    + P0 K$ w: k3 i. H* q: R* ]" z
  805. ORA #$30$ b, d1 _5 c) ?
  806. STA PPU_Addr,X
    ' Z/ q% ]8 P2 U1 K- Q) a- }7 t" G
  807. INX" g' i3 j# O. r. l, m% u# |
  808. .ENDIF
    7 F" d1 B2 O! W# t( h
  809. . R5 x/ F4 z3 }- F
  810. .IF Music_Song_Total > 90 w5 \+ q" z& S" D- a$ p9 C7 J
  811. LDA DEC_T
    $ H' A+ l9 \0 Y" I: O
  812. ORA #$30, o. l( f0 t1 [" |( h5 Q3 k
  813. STA PPU_Addr,X
    - d  ~' |, J# n
  814. INX% v' z) e  p  q  R4 K- Y/ B
  815. .ENDIF
    & i( B( m- f4 D, B" J7 O
  816. - `8 C, ?( F6 V  B3 ?$ b8 P5 q
  817. LDA DEC_L  M& O* }! r: \8 Q
  818. ORA #$30. @$ \* ?3 R+ t# f5 Y* M
  819. STA PPU_Addr,X
    . n; ~* O0 g  M, M5 }# U
  820. INX" O4 [4 E, r& O3 ~4 P
  821. 2 Z0 k  r8 {( N: e0 D
  822. LDA #'/'
    & {: J, w& \' w4 R( i( w6 m; y
  823. STA PPU_Addr,X* r" R* G4 v, n* |9 ]4 {1 R3 v
  824. INX
    4 W/ A, C. @5 k3 \' Q) e% K
  825. Music_Show_Total% m8 L+ j* e3 [* |
  826. LDA #Music_Song_Total+ N3 p4 B& b3 j% V7 Q' C# D
  827. JSR HEX_To_Dec, W! b7 P+ R4 J" t
  828. 2 g/ x3 f; q$ C( u, Y8 i9 ~
  829. .IF Music_Song_Total > 991 P0 o# }' X* r  M
  830. LDA DEC_H
    9 M, ]! {8 z; C/ _+ Z  y( O
  831. ORA #$305 H# g% D- n' i
  832. STA PPU_Addr,X- D+ X8 D1 |4 Q
  833. INX
    * N7 r+ X/ ]7 U6 {1 M( a9 F
  834. .ENDIF
    4 W2 M8 S! R  N& }

  835. * A) n" K% G4 E4 X/ n  Y1 o
  836. .IF Music_Song_Total > 9
    ) V3 J, \2 q8 A9 g7 i- @$ d
  837. LDA DEC_T0 n, C8 z8 k, [* N, v" n
  838. ORA #$302 u* l& i5 L, P, E3 n
  839. STA PPU_Addr,X% F  v  n  ]# v& j; p5 O
  840. INX  Q: _& ?- y$ ?* P
  841. .ENDIF
    ' G# y  b. F. [( a" B

  842. , H0 H' g4 P2 o6 f8 ]* I5 i& p
  843. LDA DEC_L
    + x3 Y( x+ d! Z
  844. ORA #$30. a9 c) S; G3 F
  845. STA PPU_Addr,X
    * d4 U& e6 d0 h
  846. INX
    " a  X$ [6 w8 a0 y" [) M/ G

  847. 9 T  g  j- S/ y. W3 Z9 N- E
  848. JSR PPU_End8 `7 `8 a: ^8 W) t7 ^2 s
  849. Music_Show_End6 T4 X* R6 `% S0 v  V6 z
  850. RTS
    : s+ f6 N1 E. H' e5 P

  851. ) L( w6 B  \9 C
  852. ;==============================1 |  r, o8 [% ?+ \
  853. Time_Show;播放时间显示; C5 E0 Q; p) o7 M/ }+ W& e6 m& v+ a
  854. JSR PPU_Addr_Set
    $ b8 ^& B$ ]* O' e: u' `( p
  855. LDA #HIGH(Play_Time_Pos)
    / `. v3 @8 S8 `# C2 D
  856. STA PPU_Addr,X+ \  v/ C* w$ {; v( s
  857. INX6 Q6 b2 v  h; z4 d
  858. LDA #LOW(Play_Time_Pos)# S7 [7 L# l. ^+ k6 D
  859. STA PPU_Addr,X
    / k4 h8 w1 x4 E: C! y; A
  860. INX% g0 K  l. M6 C! I) r* y' R* P
  861. Time_Show_H4 y3 p9 m& t% P+ K( O# a
  862. LDA Time_H
    9 j# x& `; ~" l* b8 A
  863. JSR HEX_To_Dec
    4 n; @5 F, N( Z, U. n. D4 s
  864. JSR Time_Digit/ z) X: U7 P3 n& Y0 s3 f
  865. LDA #':'
    1 Z0 u7 Q: z$ N9 ?  m7 p) J# l
  866. STA PPU_Addr,X
    # B( C* m% }/ p" c* }6 ?
  867. INX
    , f/ G$ S1 ]& H7 Y( a) }
  868. Time_Show_M
    : H* x* q; {# ^1 c- X- @
  869. LDA Time_M
    9 F0 G9 x- a4 `& R6 {: s" \9 a
  870. JSR HEX_To_Dec0 O/ P, ^+ T! k! R
  871. JSR Time_Digit$ h8 p7 S* v6 Q8 M
  872. LDA #':'7 ]# Q3 j3 @8 z2 }+ D
  873. STA PPU_Addr,X4 u# [# w( n. K+ n; _  K
  874. INX
    9 s& x; |* Z- c6 O/ a' ~
  875. Time_Show_S
    ; L7 `3 z4 T3 k/ m  u% `
  876. LDA Time_S2 ^7 c" j; l' _2 x, x$ u7 s, _
  877. JSR HEX_To_Dec
    & P+ l! J4 e; E0 _* C9 E! j
  878. JSR Time_Digit* r- [' A$ A; I0 b. o. k/ z8 Q
  879. JSR PPU_End
    * F/ h6 [2 ~. s7 u6 t9 U" |
  880. Time_Show_End
    3 [; c$ x+ T* o' n" T$ N  U
  881. RTS1 [% R/ @* h5 H# B# I

  882. ) {) e, a( T$ C7 {4 f  J! o6 Z" n+ g
  883. Time_Digit2 X) \9 K5 Y' r! Z0 m& o: o5 n: m) q
  884. LDA DEC_T
    9 ]5 }" M( u0 r6 Q6 O: @% Q
  885. ORA #$30
    4 l/ X4 P% ?; l* p
  886. STA PPU_Addr,X
    9 z+ w* g# q; }8 L
  887. INX5 K2 }3 N9 s9 m
  888. LDA DEC_L5 K; L5 y2 g' I( e# f5 U
  889. ORA #$309 I# t) M& I: H% l* e
  890. STA PPU_Addr,X
    1 ~! N9 i  W+ z/ Z% |
  891. INX) k. `2 L% v8 `5 p+ L' H+ a
  892. RTS4 S+ s9 d: l+ w# W1 {# V

  893. . ~/ N' j6 s5 M0 }: e
  894. ;==============================! ^* |: J/ G7 F: a9 O
  895. Time_Count;计时. u5 L) z: s( D, ^
  896. LDA Music_State
    ; O2 Z- [( @9 {; e
  897. ORA Time_Wait_Cnt+ o" m/ x3 |( [$ I* g! ]9 h: Y
  898. BNE Time_Count_End& _# A4 }  L* W; ^- K
  899. INC Time_Cnt$ Z7 E% X9 A9 h3 O6 U
  900. LDA Time_Cnt# x- Z* `; m, n' B
  901. CMP #60
    7 P( D, Y" P' s! [* y8 h5 l
  902. BCC Time_Count_End
    7 L! u  \. g; |
  903. LDA #00
    : N2 T' N6 ]+ {  u( X
  904. STA Time_Cnt
    : z2 F4 ~& }! z/ T9 r2 U$ y; |
  905. INC Time_S! G# O/ D. V/ H

  906. : ]! H9 m/ Q3 ^7 z6 _$ |
  907. Time_S_Cnt1 `- x! o0 v9 w5 }, I
  908. LDA Time_S& {! m: x' ]7 M6 Q
  909. CMP #60
    + H' F) d# x5 }7 E0 t: [, S
  910. BCC Time_Count_End1 ?* z8 }6 z! C
  911. LDA #00
    4 b  a5 H) |8 M$ J2 w3 r
  912. STA Time_S
    . M# q( Q; ?! }5 D0 Z
  913. INC Time_M- f: h7 S8 R! O

  914. 4 y- {4 @; v# |9 W) x4 z
  915. Time_M_Cnt
    / s3 m' M( I/ y( O
  916. LDA Time_M- l. I, p9 z+ N1 C
  917. CMP #609 N3 N: m+ [/ K
  918. BCC Time_Count_End! D& V  u# s$ U6 F4 M8 k
  919. LDA #00
    5 N- u* \/ B/ ?# o3 E5 z' Q
  920. STA Time_M
    ; \! U% v" r: T. ?4 P
  921. INC Time_H
    ) R& p# R, ~) x: c# u" F
  922. : y. Z- S6 ]% m6 H3 V& ~8 R
  923. Time_H_Cnt
    * g0 T2 k4 ^9 H9 v- k$ I- a
  924. LDA Time_H8 T  }& I" i3 w( f) H
  925. CMP #24
    - e; _9 v& h% M) _/ y1 u* O
  926. BCC Time_Count_End
    ) a" [  r$ C6 `4 C) F) a. b
  927. LDA #00
    5 A% I9 ^5 O0 p3 p+ g  v  A
  928. STA Time_H
    ' }1 z6 L/ Q3 X3 O

  929. . M/ |9 `# A6 Z7 u
  930. Time_Count_End
    0 H, B, b+ d/ J7 Y: R$ o4 v
  931. RTS
    : l8 _% u* x* g9 q* R/ y

  932. % o* y& T& W0 G3 S8 g3 q
  933. ;==============================2 ~$ p1 ]+ m: ]/ Y6 b2 K( q$ t2 [
  934. Time_ReSet;播放时间重置
    6 M6 o  i6 U" |8 x
  935. LDA #$00
    # k  q) _# j% f9 J% C5 O$ s5 B
  936. STA Time_S
    $ ~% P/ p8 a( u
  937. STA Time_M + d( P- m! M. G2 R; O; i+ _' T
  938. STA Time_H% x$ z, Q7 S! Z7 f  g0 K0 R
  939. STA Time_Cnt
    9 A5 N- x: w' D' Q; S5 b7 N+ q) q+ s* y
  940. RTS+ c8 p* l! i( r; t3 m

  941. 9 [! M& P% l8 [! W. V& z  a8 V$ y2 Y  n
  942. ;==============================8 g+ F; X; }! m  n3 L4 j" [; P! ^
  943. Music_Bar_ReSet;音乐条重置
    : p" B) n' A$ H( E& Q- D
  944. LDA #$00! x8 \' B2 Z$ f; f/ s0 W( b3 X
  945. LDX #$00
    & A% p$ _; q. W' [8 L0 E
  946. Music_Bar_ReSet_Set5 W6 E- P0 i( S' w7 i8 e
  947. STA Sound_Bar,X. G! f' v3 M: ^. l" N' L
  948. INX
    0 ~3 S$ a, Q# l# z" m* E
  949. CPX #$10$ ]$ T) T1 `: r( V; j# s
  950. BCC Music_Bar_ReSet_Set
    0 \) x" y4 n8 L0 [! W4 b
  951. RTS0 x( s. |6 c' \8 P0 ^* c" I

  952. $ `3 Y4 \2 j6 H. F( {
  953. ;==============================
    2 ~4 C. d& P. D1 T
  954. PPU_Data;PPU数据写入
    , Q7 `7 m8 n" k" }. J+ Y1 O% ]
  955. STY Data_L
    " {5 b5 T! M( v3 g
  956. STX Data_H0 ^( C0 a! |  @# \& t
  957. LDY #$FF
    5 c7 j& N1 Z# [( \
  958. LDX PPU_Cur
    % `3 ~" w. K0 S$ H! q
  959. DEX
    ' U; x3 ?) e4 v' V
  960. PPU_Data_Beg
    * c% O( d5 ?4 r8 j; d8 Z, x) m- W* R7 L+ R
  961. INX
    ! }; \; P4 J9 J; O- a; Q
  962. INY
    $ i- x% }0 @3 C: F6 o
  963. LDA [Data_L],Y
    # \0 i, p+ u& E
  964. STA PPU_Addr,X
    5 E9 @% q2 S& m( U$ Z2 |
  965. BNE PPU_Data_Beg
    $ r4 T' H" S: _( i" p
  966. STX PPU_Cur
    % x( s# h5 ^* v! Q, Y/ {  ^  ^
  967. PPU_Data_End( X# U! _+ b+ `4 `( ^8 r
  968. RTS9 x" r8 P8 C3 ]% B+ q. h- H

  969. ! D5 P$ G  F. f6 m: Q
  970. ;==============================
    + O/ h# A  g( B8 {+ t; }
  971. Music_Stata_Show;播放状态显示
    ! q: t- E4 q" l' z6 l" |
  972. LDA Music_State
    5 G  \8 N( X% b: D; y+ Y6 ~: a
  973. BEQ Music_Stata_Show_Play
    ) P$ O: ]2 b! T3 b# b: V7 u
  974. Music_Stata_Show_Stop9 L+ q, h" `. ?. B
  975. LDY #LOW(Music_State_Stop)0 h$ o9 n& I. b5 t, t
  976. LDX #HIGH(Music_State_Stop)7 e& n% P6 X( P( a
  977. JSR PPU_Data& o. P# h8 {+ Z: I- n' n9 C/ k
  978. RTS' h: U" l$ @8 c( G* r
  979. Music_Stata_Show_Play
    % a; i0 t$ V" d5 y
  980. LDY #LOW(Music_State_Play)% z" W  O; l; W+ @8 I/ W) ]- l
  981. LDX #HIGH(Music_State_Play)5 e+ |$ Z8 f) Q6 A+ j' u4 X
  982. JSR PPU_Data+ T* V0 E! Y4 Q( P: _5 B5 U$ h
  983. RTS
    ) d5 X3 e, ^/ S! L
  984. # G( f! t- u" C, p
  985. .IF SOUND_BAR_SHOW_ENABLE  P- A( o+ p, f/ g- _, g- E
  986. ;==============================
    : w% O" p- ~9 D) W/ \0 o$ O
  987. Sound_Bar_Text_Set;标题与音乐条初始化
    * B3 l: M! J/ X
  988. LDY #LOW(Sound_Bar_Text_Data)
    1 C) H; w8 L2 U. w
  989. LDX #HIGH(Sound_Bar_Text_Data)
    * V; `; F" a  E
  990. JSR PPU_Data) A# c$ y9 q2 h3 z
  991. RTS
    # g/ J* s' Q6 R$ X2 D; q; H
  992. ) P2 l, p  y3 u5 e/ y$ i7 `
  993. .ENDIF! I' Z. H" _  U& F* @% N' u

  994. 5 w4 M9 o( h, w  u' V! w
  995. ;==============================0 L( X$ o& D5 ?) j0 N' M& t* [
  996. Set_NameTable_Attributes;设置命名表属性4 a5 K; B9 r6 v0 x3 G7 q
  997. LDA PPU_STATUS$ l/ M0 o/ c7 ?5 I. s/ }
  998. LDA #$23
    4 Q% k2 \3 ?, T  J  g8 _2 x
  999. STA PPU_ADDRESS
    " o0 q. Q% h* ]8 ]6 ]" G6 d' Z& O
  1000. LDA #$C0, A9 T; i5 _, g: L& u. a
  1001. STA PPU_ADDRESS
    6 K% b, T/ x+ B: U3 f
  1002. LDX #$00
    , z4 C% {# J: E4 v4 N' `
  1003. Set_NameTable_Attributes_Write5 _  s1 G/ c8 M7 Z+ k/ b
  1004. LDA Palette_Attributes,X  ]8 N  g: Q1 @+ ^* u
  1005. STA PPU_DATA1 T7 }3 \- K' m1 e" a6 A( N6 [
  1006. INX, P3 u; V3 j! N  H% c& e+ s4 e" u
  1007. CPX #$40
    - h! S" A/ |; p& T! r
  1008. BCC Set_NameTable_Attributes_Write
    + |3 C- [9 y' G
  1009. RTS
    / n1 ?& S9 R/ t, a
  1010. ; v$ G2 p) {6 K, m) A
  1011. ;==============================
    0 u3 z6 O1 |  J
  1012. Set_Palette_Color;设置调色板数据
    # h" y2 `1 \( s  ]4 j
  1013. LDA PPU_STATUS
    % B% @- b" f1 x
  1014. LDA #$3F) O" P& b! x6 x7 T
  1015. STA PPU_ADDRESS
    + H8 F, a2 V- E$ T) `8 ^% H" Q6 `
  1016. LDA #$00
    7 r/ u; `* {2 Z# L3 k( B; z6 t
  1017. STA PPU_ADDRESS
    3 J# P" d; M, u; Z) e1 Q, M
  1018. LDX #$00
    7 u. c5 P2 }2 v" ]2 @' e
  1019. Set_Palette_Color_Write
      b" _6 N3 |0 J# y7 \9 w5 a
  1020. LDA Palette_Data,X
    8 a; A2 i3 p, Z( _2 U
  1021. STA PPU_DATA
    ( T$ M& z- Y' M' S) \) ^
  1022. INX$ O" s0 ~8 A% `0 J
  1023. CPX #$20
    4 a& a" Y7 N" ^* }& C5 j( P
  1024. BCC Set_Palette_Color_Write  Z, t7 c) t2 D
  1025. RTS
    9 V2 A  Q' w/ K6 B4 }

  1026. # l" A+ U8 Z2 d
  1027. ;==============================
    5 S7 x& K5 u9 d
  1028. Init_Palette_Addr;初始化调色板数据  f6 K9 @2 X  H- ~
  1029. LDX #$00
    1 U& S; l6 ^4 n5 i( Q  Q) B0 s4 z# j
  1030. Init_Palette_Addr_Write
    ' n' x( d8 O/ f* i/ p. W
  1031. LDA Palette_Data,X
    / k. Y2 V/ `% h
  1032. STA Palette_Addr,X7 E* ~4 M# t7 Q# R
  1033. INX) w5 H4 _, }# l: O1 L
  1034. CPX #$20: R9 N& ^3 V8 l) [' q! a
  1035. BCC Init_Palette_Addr_Write# O6 e- r2 q7 V# k
  1036. RTS
    8 J4 s( f+ H' u" O. e& S

  1037. ' J. J6 c) |" [$ z% d. o
  1038. ;==============================6 a% W$ M9 ^! ^( s: Q+ g
  1039. Update_Palette_Color;更新调色板颜色
    " j- u/ p) N) W& \1 E7 `
  1040. LDA Show_Track_Name
    # b: e0 I/ ~" W
  1041. BNE Update_Palette_Color_End* ^$ O, ?( ^7 A
  1042. LDA Palette_Update_Flag
    ) X) C! k4 i% S9 T: b
  1043. BEQ Update_Palette_Color_End
    4 v* H  C5 L3 ?/ w3 b
  1044. LDA #$3F( v  g0 R! L' P/ U8 k
  1045. STA PPU_ADDRESS
      r& h# L3 @) Y0 m2 o" M
  1046. LDA #$00$ R. U- Z- S& K: i
  1047. STA PPU_ADDRESS3 Z; U: P5 t$ \6 W0 O: c
  1048. LDX #$00
    % Q* A5 T: L7 w9 C/ B( ~" u4 i
  1049. Update_Palette_Color_Write
    / B( N& S5 {' y- n
  1050. LDA Palette_Addr,X9 d" ^# q; v% C% R% V/ u
  1051. STA PPU_DATA1 R) Q- ~1 A& q
  1052. INX1 Q+ e  _, g$ q5 R
  1053. CPX #$20
    ' e; G; @# L" K& T* T, Y
  1054. BCC Update_Palette_Color_Write% g6 O' U, P; S4 d) |. H
  1055. LDA #$00
    . v$ S5 w* H% [+ b0 H
  1056. STA Palette_Update_Flag
    * a) u3 z6 P! H! i  \# R
  1057. Update_Palette_Color_End
    7 G2 u" n& M! M% c( `/ Q
  1058. RTS
    ) J8 W/ Q. m3 O# P. a
  1059. ( \/ \: c8 D% y0 g6 i; @9 [5 }1 ^
  1060. ;==============================8 T7 R; n/ V6 ^2 V6 {3 U" J, q
  1061. Update_Palette_Data;更新调色板数据( M  D! I: ]' c# i* Y) H; ^0 ^
  1062. LDA Show_Track_Name4 C. q5 T4 Q  h, G8 S8 d
  1063. BNE Update_Palette_Data_End  B8 B' o- X; W: w
  1064. LDA Music_State
    2 {7 Q( m' K+ O8 H0 G% T
  1065. BNE Update_Palette_Data_End
    / L0 x! ?/ R1 U5 @' b9 @  C* J& g
  1066. Update_Palette_Data_Check! b, D+ l! Y+ G- \' a2 G* ^
  1067. LDA Palette_Wait_Cnt, n$ i  ]& \7 N& D) E
  1068. BPL Update_Palette_Data_Check_Over
    2 ^) I) E: k  b
  1069. LDA #Palette_Update_Interval
    9 x  r+ u/ t& b4 t9 Q6 I& o3 C( i
  1070. STA Palette_Wait_Cnt8 L/ T% h5 W2 j6 g# y& I! V
  1071. Update_Palette_Data_Check_Over/ [1 o! v. C' _( ^% I. Q
  1072. DEC Palette_Wait_Cnt5 V) j  P2 g2 J0 O1 o
  1073. BNE Update_Palette_Data_End7 i( w, z' b+ C. o8 V
  1074. INC Palette_Update_Flag- E8 c7 U& I* d5 [! E% }
  1075. LDA #Palette_Update_Interval
    3 _( j( E1 w: k* U' D8 `
  1076. STA Palette_Wait_Cnt
    : q1 i/ H( f( _7 [. z5 s
  1077. LDA Palette_Update_Addr0 h8 d0 g% w! W" _2 O
  1078. CMP #Palette_Update_Max
    " e( Z. I5 [0 |' y
  1079. BNE Update_Palette_Data_Set0 T+ M. A: M% B9 n0 C0 j
  1080. LDA #Palette_Update_Min - 1  v4 z. Y9 F! a5 |2 d
  1081. STA Palette_Update_Addr
      k% n) W, F# f5 M8 f: G
  1082. Update_Palette_Data_Set- V$ f3 ?: h/ d% V3 h7 b
  1083. INC Palette_Update_Addr$ p6 x. o- d+ L
  1084. Update_Palette_Data_End& D) i7 m% {. t
  1085. RTS# v/ ?: G) H) H  B3 a# N/ w! U

  1086. 1 q5 r- K: [$ U& r/ y* ], c
  1087. ;==============================$ @, x; u. k8 t7 f
  1088. Show_Music_Text;显示静态文本
    , g  _% u% h7 K& T  I6 z
  1089. LDX #$00
    - \& |! w5 o5 U* g: R
  1090. Show_Music_Text_Set$ }# z& n/ A: o, G) b
  1091. LDA Static_Text_Data,X# ]/ H+ K5 p  A. }8 z  y2 [
  1092. STA Data_L6 q' N' M6 ?# H7 P
  1093. INX9 c% v$ K( F! ?, q" K& R- d
  1094. LDA Static_Text_Data,X& o0 n( k2 K8 S. D! I- _  A, J. E
  1095. STA Data_H! K- k) O2 b: z( ~7 p- X. L
  1096. INX
    3 H6 h* G( _3 c4 u. F
  1097. LDY #$00- M* U- q+ D9 R" s: w* U
  1098. LDA [Data_L],Y/ i% w7 f% E$ ]
  1099. STA Data_Cnt. O6 W  P. l# @! |  S
  1100. DEX
    ) d0 p3 v. W8 B& O# y
  1101. DEX' t  l0 i) A3 b4 \# I
  1102. LDA Static_Text_Pos,X
      {. f9 r* L& j. r. V5 s1 |
  1103. STA PPU_ADDRESS1 H! L) O2 g# ^2 }; p* S* b0 e1 _
  1104. INX6 \' }/ Y3 k7 _9 Y& l: y; a: z
  1105. LDA #$20$ K% x& z# s9 \! L" W
  1106. SEC
    7 D3 f: e8 x3 n, `! C3 Q/ u
  1107. SBC Data_Cnt
    * u8 D; D3 B; B6 q; w3 v; n
  1108. LSR A
    / \$ b1 c6 g! o- W) C+ X# `% W2 A
  1109. STA Data_Buf
    4 ~% `: _$ r0 ]+ d' V
  1110. LDA Static_Text_Pos,X: \4 B4 c# N& Q" l
  1111. AND #$E0" n8 u# K3 b! a4 ?% e
  1112. CLC+ g* M0 R9 c: M$ R
  1113. ADC Data_Buf! z- Y9 b6 V# ?8 ~
  1114. STA PPU_ADDRESS) V: S# H* R; a- v
  1115. INX0 R) `) v: }6 Z7 i& p: z
  1116. Show_Music_Text_Set_Write) @3 R: v) V7 D; m/ j& l7 U
  1117. INY
    % F6 q' [- c$ s! u
  1118. LDA [Data_L],Y
    , X  U1 m7 g9 w* n3 a  F8 `, `
  1119. STA PPU_DATA7 J9 n5 j8 F; ]2 r
  1120. DEC Data_Cnt7 g. N0 H2 K) x7 v' z: Y2 x; E, U
  1121. BNE Show_Music_Text_Set_Write
    9 p, n7 \& @: @4 T" \8 x4 _( T
  1122. CPX #Static_Text_Pos_End - Static_Text_Pos8 w* n+ ?8 p& i4 Q: K: a7 ~9 U- M
  1123. BCC Show_Music_Text_Set
    6 b) o' T( w& i6 x3 h
  1124. RTS
    ) r+ s' V! M: n* ^. t6 O8 H

  1125. ' Z% [' ?) j; p( O& j* Z
  1126. ;==============================" z. _% `8 H8 \4 D
  1127. .IF Track_Name_Pos;显示曲目信息) o- G$ l; X" W
  1128. Show_Track_Info8 T) I% ^, {% _6 [+ V
  1129. INC Show_Track_Name) v! }) X. t) h. `
  1130. Show_Track_Info_Clear
    + B% p; a1 i: r
  1131. LDX PPU_Cur3 O5 U: z1 T& {5 \
  1132. LDA #Mode_Clear4 n* s# f# r& u, l) g# J* ~
  1133. STA PPU_Addr,X2 e2 ^5 [! C; \; D0 A
  1134. INX' K, ]8 X7 T& l' [7 p8 k

  1135. 4 G/ N- x/ X; z' y# I! o8 L( v
  1136. LDA Music_Last
    " ]! R1 b7 Z4 `7 |  I
  1137. JSR Show_Get_Track_Name_Center_Pos
    9 k: T+ }/ u% ~- W. ~3 s2 e& c
  1138. Show_Track_Info_Write_Cur
    4 o6 H  q: G7 U( T4 ~; J. l- r
  1139. LDA #Mode_CntLine: n5 v. v# j( h
  1140. STA PPU_Addr,X
    ! U& o, X! V# I: A/ m- e) |$ V
  1141. INX
    " D4 a$ R/ \* [* {# y, U/ y
  1142. 8 ]% M& E8 M& L
  1143. LDA Music_Cur! t1 \- a( D: A  Z/ U
  1144. JSR Show_Get_Track_Name_Center_Pos3 M; U7 x' P* x% ~- u0 n2 F. [

  1145. , N- b. }- P# n
  1146. Show_Track_Info_Write_Cur_Data, Q0 p& D; G$ ^: v0 I! ?7 k
  1147. INY
    3 t5 _. ^0 N" M6 ]- F9 T! D
  1148. LDA [Data_L],Y
    5 D" S, ?- v* V: j% t
  1149. STA PPU_Addr,X! v1 u- x, T3 ^0 F
  1150. INX
    0 D3 S. h8 s& B% H4 n( B1 @* _! A
  1151. DEC Data_Cnt
    / |: l1 B. V1 Q' n
  1152. BNE Show_Track_Info_Write_Cur_Data) h) w0 t# S3 F3 A0 |+ u! O9 g
  1153. Show_Track_Info_End: f3 r! A) x" U( T) h
  1154. STX PPU_Cur* E7 X5 ^- _8 I& T6 x+ @
  1155. RTS3 |2 ~% }. p/ m) j0 E* X
  1156. & O# a4 e6 |, @6 K6 d5 h
  1157. ;==============================3 {- _/ c9 b$ ?6 T$ m& j
  1158. Show_Get_Track_Name_Center_Pos;获取中间位置
    $ e5 ?$ _" y! ?
  1159. ASL A
    * x6 b& M/ A6 E9 X. _1 w/ R" c
  1160. TAY0 U2 L) W0 U3 `8 E- I: O7 u
  1161. LDA Track_Name_Addr,Y
    ' O8 A+ V, U- p/ D
  1162. STA Data_L; q, d  d/ M  P  C6 @1 h. I
  1163. INY
    ; x& }# |. ^# M! K8 T' F' _) r5 L
  1164. LDA Track_Name_Addr,Y* x2 E  o, h5 L. Y9 x
  1165. STA Data_H% c  g1 P  a2 E" ~# e7 B! |
  1166. LDY #$00
    " ^- m, D9 S  l4 N% E# U; i/ W
  1167. LDA [Data_L],Y4 E# k3 r: P7 P
  1168. STA Data_Cnt9 u3 q9 O# |2 P# H% Y/ h
  1169. LDA #$20! a' C( [" u$ ^, _
  1170. SEC" i# T% _- V9 c
  1171. SBC Data_Cnt) ^& \+ p, u9 D" K0 C& h6 w! D4 J
  1172. LSR A
    ) W  v# j8 ~5 o2 J! E2 u8 H9 [
  1173. STA Data_Buf3 @4 z' Q+ ~, a! N6 T# i
  1174. LDA #HIGH(Track_Name_Pos)
    0 I$ n/ |+ |2 z. {' K1 q1 }
  1175. STA PPU_Addr,X- V$ Y: Q8 p# v. S/ ~  y
  1176. INX9 E* n& U; p; ~& o  H  l
  1177. LDA #LOW(Track_Name_Pos)3 j+ Z, Y( X. Q4 L
  1178. AND #$E0
    5 k6 }& t" f. y1 l+ b
  1179. CLC
    : ]5 o/ H4 x/ ~6 ?/ K. C+ r
  1180. ADC Data_Buf* Q' p0 \0 {2 D  T( q) u
  1181. STA PPU_Addr,X" K: u( k2 g1 X
  1182. INX3 f4 O0 U% L& v* S0 M; r1 z# ]7 F
  1183. LDA Data_Cnt
    0 L( z* y' V  e; \
  1184. STA PPU_Addr,X
    2 t* i* J0 z3 F+ x1 E
  1185. INX
    , Z( M- C2 o3 @: W5 [
  1186. Show_Get_Pos_Center_End
    # f3 g5 j3 z% ^/ ~  h8 O
  1187. RTS9 V$ k1 r6 }9 |- c. M  |
  1188. .ENDIF& k2 q5 Z. }% Z
  1189. 7 G! q5 C; n) M* o9 T
  1190. ;------------------------------' l* u" C0 J! B+ t
  1191. ;命名表数据
    # r4 ]! N+ m: n+ P4 {" B
  1192. Palette_Attributes* r0 x6 x( D/ O
  1193. .IF SOUND_BAR_SHOW_ENABLE: l) H$ _' s) E/ |0 A
  1194. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00$ L- x  ^$ V$ W
  1195. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$BB,$AA,$AA,$AA8 k0 g2 s/ j. Z  L6 d) W
  1196. .DB $0F,$0F,$0F,$0F,$0B,$0A,$0A,$0A,$55,$55,$55,$55,$55,$55,$55,$55
    ' J6 `# D" @6 C, L4 Y* v
  1197. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
      o3 N' P* n8 K: N, P  \* [
  1198. .ELSE
    , Z% {# V+ _, d6 R7 V2 r
  1199. .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00! @! A  m2 w; H' I3 `0 q7 k5 ~
  1200. .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF8 R/ k; f, |0 f  V9 N5 ]$ ]
  1201. .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$55,$55,$55,$55,$55,$55,$55,$55
    # G1 c% Y5 B9 Z2 m
  1202. .DB $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
    1 Y+ }, I# \! H' S
  1203. .ENDIF
    5 p; j" E$ x# J
  1204. 7 Q$ T+ ]$ S& d0 _' n
  1205. ;------------------------------
    ; D8 c/ J) x: q
  1206. ;调色板数据
    ) f! Q7 Q2 s0 b9 P; i- q, o: R
  1207. Palette_Data; ]. p7 V5 F0 X5 k2 P/ ~+ v$ Y
  1208. .DB $0F,$27,$20,$0F,$0F,$24,$20,$0F,$0F,$21,$20,$0F,$0F,$25,$20,$0F! ]8 _. D1 c* U& ?
  1209. .DB $0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F,$0F,$24,$20,$0F* q; I' v4 V. {$ l

  1210. 6 |  j8 f/ o- N) z
  1211. ;------------------------------
    ' J4 D4 {3 U/ i6 W, {8 [
  1212. Static_Text_Data9 I4 L( G( G! k
  1213. .WORD Static_Text_Title_Data
      `  k: P9 ~) U, {9 n
  1214. .WORD Static_Text_Author_Data
    : |! [# b6 ^3 E: |, C
  1215. .WORD Static_Text_Date_Data
    4 D7 ]# o" _' H' v# e+ b$ I/ f6 I0 i
  1216. Static_Text_Data_End
    5 r) y8 @/ i# u( K4 C7 z

  1217. , G% X* J; F! T
  1218. ;------------------------------. S$ U! g1 }( ?; K2 \
  1219. Static_Text_Pos) M, a7 O  }5 ^
  1220. .DB HIGH(Title_Text_Pos),LOW(Title_Text_Pos)* n. q7 N: q2 R6 `5 M0 H
  1221. .DB HIGH(Author_Info_Pos),LOW(Author_Info_Pos)
    ; G7 w  m5 |4 u# ^9 `4 v0 O* Z  n9 x# b
  1222. .DB HIGH(Date_Info_Pos),LOW(Date_Info_Pos)
    1 L. k2 {2 n5 D8 U6 L9 n
  1223. Static_Text_Pos_End
    . a. s: R0 [9 T; h
  1224. * e8 {+ u. z" r' t5 L# N
  1225. ;------------------------------
    5 W% X8 V6 @: s$ G
  1226. Music_State_Stop9 b" ^2 M! E/ e6 m5 X
  1227. .IF SOUND_BAR_SHOW_ENABLE: N0 X! j1 O5 L6 R1 `) r' t
  1228. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"STOPED ",$FF,$00" ?* q3 L. K0 [' @; u
  1229. ELSE
    8 p  v% |9 o( l7 C1 c2 u- X7 s" W
  1230. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos)," STOPED",$FF,$00
    % ^3 Y. H% M2 F. [
  1231. .ENDIF- j2 a, M5 `1 L% |: E
  1232. Music_State_Play
    ' s, ~+ ]- ?" z2 l# z
  1233. .DB $FD,HIGH(Play_State_Pos),LOW(Play_State_Pos),"PLAYING",$FF,$002 c: M6 _5 r% E) a1 \$ }
  1234. # `8 s' r" c  M2 U
  1235. ;------------------------------# T! T: |" s, z0 X0 E8 {
  1236. Sound_Bar_Text_Data;声音类型文本
    6 G% t/ D: W; g% z  K7 r
  1237. .DB $FD,HIGH(Sound_Track_Pos),LOW(Sound_Track_Pos)  d+ `! S' E( K5 w: J) r% s  h
  1238. .DB "SQ1-",$FF
    4 {+ m6 ?7 ?  b: B0 |" q
  1239. .DB $FE,"SQ2-",$FF3 ~* u3 M% G* ~' f- \
  1240. .DB $FE,"TRI-",$FF! q- }. }; S4 C" h& N2 n1 P
  1241. .DB $FE,"NOI-",$FF+ i5 Z, V/ h7 V- d$ D( S/ q# a8 a
  1242. .DB $FE,"DMC-",$FF,$00
    2 v% @4 E( I$ U

  1243. 4 m' i  r3 H+ z# A7 x
  1244. .IF Track_Name_Pos
    - l+ a: t' G) J0 G7 R4 g* K
  1245. ;------------------------------
    ! T: T# r* l: A1 N8 M
  1246. Track_Name_Addr;曲目名地址索引$ k) \  m( L) A/ Y' T; p
  1247. .WORD Trackr_019 g) j* ^6 h7 Q4 m$ t/ U
  1248. .WORD Trackr_02
    * L9 r9 W9 l# J; l. |
  1249. .WORD Trackr_03
    5 Q! f0 o; q8 {  c
  1250. .WORD Trackr_04
    1 z, G  b4 _, z6 n/ c
  1251. .WORD Trackr_05$ n. ?& _. x2 ^& d8 o
  1252. .WORD Trackr_06
    $ }* p, A- J. C8 A$ A
  1253. .WORD Trackr_073 B9 B# R8 y1 ]% y
  1254. .WORD Trackr_08, H3 t9 G/ y- h$ F8 h+ x
  1255. .WORD Trackr_091 q8 x( i, C( k; O5 |& _8 t
  1256. .WORD Trackr_10
    ! B+ i2 I/ q- o
  1257. .WORD Trackr_11
    3 I# g% c/ ?  u! h5 q4 U8 J
  1258. .WORD Trackr_12# Y; M$ p9 q; G6 N! B0 d
  1259. .WORD Trackr_132 a# u8 s+ }* p6 l; o" @
  1260. .WORD Trackr_14! `2 w5 u- C! ^% C" d
  1261. .WORD Trackr_15; k0 p  \, F1 n) H
  1262. .WORD Trackr_16$ p, R9 a3 l: i5 |- G. I! S: A
  1263. .WORD Trackr_175 N3 O' i& e3 L: L0 E
  1264. .WORD Trackr_180 _, V& f: V9 h2 z
  1265. .WORD Trackr_19$ u$ u' M, q  R( `
  1266. .WORD Trackr_20
    3 n! A* |6 b1 {: h; \+ E& K+ U
  1267. .WORD Trackr_217 A0 u; Q; G; t
  1268. .WORD Trackr_22
    9 Y" }' k! K' B
  1269. .WORD Trackr_23' Y" |0 z9 Z% r8 p/ ]  H
  1270. .WORD Trackr_24
    ! A, T& U0 `9 ^% @( k3 d
  1271. .WORD Trackr_25# u2 M0 R! ^# I" G: O0 k
  1272. .WORD Trackr_26% q! E2 q1 b, O( y/ D/ l! L' G6 D# G
  1273. .WORD Trackr_27
    * S- [: k9 i9 ~
  1274. .WORD Trackr_28
    , h) Q2 ^. b0 ~" t, `/ f
  1275. .WORD Trackr_29
    3 x( \9 ?2 o! Z4 a$ S
  1276. .WORD Trackr_30
    / D- z* Z7 G8 E" b+ S! R7 P1 i
  1277. .WORD Trackr_31! z; @1 k2 E' ?1 m1 L8 Q
  1278. .WORD Trackr_32
    ; c, D( ^  L( r4 i& B( d' O9 f) x; Q
  1279. .WORD Trackr_331 q* v# Z7 h' R' R' o
  1280. .WORD Trackr_340 D4 ^% V# e& l
  1281. .WORD Trackr_35
    # S* H0 f+ k8 u% J0 Y# z
  1282. .WORD Trackr_36
    1 d" g- f3 j! h( P% K& ~
  1283. .WORD Trackr_37
    , X9 r* I) x6 e2 U0 o
  1284. .WORD Trackr_38+ k& B' |' \5 Z1 {# T& E; p/ s, v
  1285. .WORD Trackr_395 D( O6 }3 ]$ n; F  g* t

  1286. 2 Z& {6 s8 f: ]6 c4 _' ?( n5 k8 f
  1287. ;------------------------------+ v+ `4 z3 y! S" [7 m3 l
  1288. Trackr_Name_Data
    1 g% F# Q3 k! ?- w9 w
  1289. Trackr_01 .DB $05,"BGM 1"3 o6 a8 W5 R2 X" k8 X9 c: |
  1290. Trackr_02 .DB $05,"BGM 2"
    8 }# I8 h$ s  D1 ]' {
  1291. Trackr_03 .DB $05,"BGM 3"
    . V6 d* Q2 \- v  b, [
  1292. Trackr_04 .DB $05,"BGM 4"6 S/ @- R" `- k7 o
  1293. Trackr_05 .DB $05,"BGM 5"( o  W) s2 A  Z
  1294. Trackr_06 .DB $05,"BGM 6"$ {4 e  z4 ]' N& j$ n' j0 D
  1295. Trackr_07 .DB $05,"BGM 7"2 V- c& T2 R6 {# X
  1296. Trackr_08 .DB $05,"GREAT"
    + s& N2 U& O: `/ O5 }0 W+ V: c1 w; b
  1297. Trackr_09 .DB $08,"BOSS BOM"! R3 Q, d& c3 A: p4 A) T
  1298. Trackr_10 .DB $08,"BOSS2BGM"
    % N. y5 X3 j5 Z1 w: h3 ^9 W3 h
  1299. Trackr_11 .DB $07,"P CLEAR"8 f* l' B& f' y; r1 y
  1300. Trackr_12 .DB $07,"A CLEAR"* _5 C: q! q4 h& z! `7 C& ~, {
  1301. Trackr_13 .DB $04,"OVER"! |' k/ B) s6 S$ O$ [
  1302. Trackr_14 .DB $06,"ENDING"
    : g" W% a: W! G' I5 x2 ], c
  1303. Trackr_15 .DB $04,"SUTA") U" `5 R1 d7 }2 {4 s+ z3 i; v
  1304. Trackr_16 .DB $07,"THUNDER"
    ( @+ M' ~5 [$ z: {& z, E% n
  1305. Trackr_17 .DB $04,"SHOT"* a- H" |0 @5 S6 R* U
  1306. Trackr_18 .DB $05,"LASER"
    , H; T4 W9 t, ]  @- M5 m% Y
  1307. Trackr_19 .DB $06,"SPREAD"
    , D5 E/ S' x; f; _& ?9 M4 D# P
  1308. Trackr_20 .DB $04,"FIRE"6 v9 f& ?# I$ e
  1309. Trackr_21 .DB $06,"B SHOT"9 K4 B' ~; Z) h  g+ M
  1310. Trackr_22 .DB $08,"T DAMEGE"
    4 {, X: q0 m+ n& r% D1 {* f
  1311. Trackr_23 .DB $07,"HARETSU"
    0 k! v9 e" L1 D+ f- X6 X
  1312. Trackr_24 .DB $05,"T OUT"
    6 _9 r6 T% }4 ^3 X9 m5 g4 H: M" ~
  1313. Trackr_25 .DB $05,"Z OUT"6 P" ?0 y- \* K" w' t# m9 O* f: s1 U
  1314. Trackr_26 .DB $05,"A OUT") z9 e- y: E2 p6 f
  1315. Trackr_27 .DB $04,"ROLL": Z3 w. U3 g0 ]: x. V! U
  1316. Trackr_28 .DB $06,"APPEAR"9 Q- k+ J8 O8 f$ V
  1317. Trackr_29 .DB $05,"POWER"; l5 ^2 |# j: M' y* f. ^" W
  1318. Trackr_30 .DB $07,"BOKK BK"
    " ?* j. R# j" \' o0 a+ b% V
  1319. Trackr_31 .DB $08,"BAKUHA 1"2 J0 D% x: r3 T% N4 g
  1320. Trackr_32 .DB $08,"BAKUHA 2"
    - b" V# H, s2 D. V
  1321. Trackr_33 .DB $05,"ARUKU"
    ; M8 k" W5 s# N  x# w
  1322. Trackr_34 .DB $06,"JIWARE"# g# B  W. I; c2 l( \
  1323. Trackr_35 .DB $05,"SILEN"
    , @- m% i+ Q5 }* W. U9 }& W
  1324. Trackr_36 .DB $05,"P 1UP"- l; q# W5 C9 D) ~1 e# f6 D+ j0 P. ~
  1325. Trackr_37 .DB $05,"P OUT"( E) B5 X$ z+ E7 c+ B# C; u, W
  1326. Trackr_38 .DB $05,"B OUT"
      A+ {7 w1 P4 f' Z' z
  1327. Trackr_39 .DB $05,"PAUSE"
    ' K; \, @8 h7 m0 P0 ~8 \

  1328. - e. t% x' r- I5 v, R! ?% r) y. e
  1329. .ENDIF
    2 c! K$ @( U* W: b1 W

  1330. + p2 ~5 Q0 U8 }7 H
  1331. ;------------------------------& @1 S. b4 P1 p5 J* m) G) B& K
  1332. Static_Text_Title_Data;静态文本数据- a4 |' a- Z" A: S' c- ~1 W
  1333. .DB 12
    9 A* X& W/ k3 P: V0 U9 ]
  1334. .DB "SUPER CONTRA". N& o  H9 g, o/ V( ~! o8 c
  1335. Static_Text_Author_Data  A" @) ~9 |- e$ g$ s
  1336. .DB 23
    8 r: t. L) }, q: t& E5 E
  1337. .DB "EXTRACT BY FLAMECYCLONE"7 s4 x" g" J- r: u
  1338. Static_Text_Date_Data+ y6 a, r; L7 y$ v
  1339. .DB 10  n" P$ h( u/ _  Z8 a, M
  1340. .DB "2023.07.11"
    0 x# b! P6 S6 ~4 h( {
  1341. 5 ]$ ~- E) b" @6 D1 H
  1342. .BANK RESET_BANK & BANK_DATA_MASK& q7 U  Z+ f- a8 M5 K( t; |& ~0 J
  1343. .ORG RESET_ADDR  z1 h, K+ h# p! d3 `2 S
  1344. 5 Z1 _1 N5 V$ m5 v7 Q9 h
  1345. ! z' T" q- T' Q& Y) k! z& Q
  1346. ;==================================================" P, _7 x: M9 p# h, w
  1347. ;切到主程序bank
    ; q  K5 u( d2 h- T. H& ]4 j1 g
  1348. SwitchMainBank2 ]% D! Z8 k+ P8 j
  1349. LDA #PROGRAM_BANK & BANK_DATA_MASK. k' J( n6 S1 m# v
  1350. JSR SwitchBank8000
    2 Q. u& u9 h5 w9 x  ^1 j
  1351. RTS1 K$ g, h& W9 w7 q

  1352. $ q2 z  J8 A1 ]+ M4 H5 @- l5 }
  1353. ;==================================================
    . g0 B8 d/ z% ]+ e1 N
  1354. SwitchBank8000;切换bank到8000-9FFF) }# u( X& F+ [* }* N
  1355. PHA
    ' [' J4 l9 p. D" S% }
  1356. LDA #$06
    2 V2 W& s9 B- @
  1357. STA MMC3_BANK_CTRL+ }! D9 e; ^8 i+ ^( c
  1358. PLA
    ; H' \+ g( ~* S6 o
  1359. STA MMC3_BANK_DATA
    , d! y* {* J& D4 y) ~4 y% f3 Q: q
  1360. RTS
    9 e- |7 B& u2 _. P: b. [8 a1 ?
  1361. 4 H! q, N+ k# c' p
  1362. ;==================================================
    $ ?9 v7 `7 r  i( Q# g6 e( l
  1363. SwitchBankA000;切换bank到A000-BFFF
    1 y8 G1 x7 U* P
  1364. PHA' U: S: d) g+ X
  1365. LDA #$07  H. `, v* ?3 ?/ s2 G$ v7 o/ Z
  1366. STA MMC3_BANK_CTRL* \; q' \, v, j; ~9 \
  1367. PLA
    7 \5 z6 C. E, V( I
  1368. STA MMC3_BANK_DATA2 _( @$ c; Q' b+ ~6 J- P1 Y
  1369. RTS5 G* j. b( r, e. A

  1370. 8 a2 K2 U- z0 g: Q5 W7 ?' l0 T  P- l7 f
  1371. ;==================================================. h7 a- u/ T' D
  1372. Sund_Bank_Init;音乐bamk初始化* E& C* |; V1 `" |% W
  1373. LDA #SOUND_DATA_BANK_0 & BANK_DATA_MASK4 I/ w# N; K$ P' W
  1374. STA Music_Bank_8000
    5 B) ?7 X* _# ]# _5 e3 c, A
  1375. LDA #SOUND_DATA_BANK_1 & BANK_DATA_MASK: y. d5 N' r) D1 x2 P5 W: p
  1376. STA Music_Bank_A000+ x& {0 E* _; N, j# L2 H
  1377. RTS
    2 K* O9 I2 C2 Q
  1378. # i" G( `  _, B# P6 q5 I4 l3 g) K
  1379. ;==================================================
    % c" T+ \, ?: A4 K) W: \
  1380. Sund_Bank_Set;切换音乐bank
    $ d* D0 p) @# e3 J; h& t' i: }
  1381. LDA Music_Bank_8000  f: I3 C0 M. u2 x, ]  s: G+ z  v
  1382. JSR SwitchBank8000
    4 D( s6 g7 l- g) T0 B; o2 e4 h
  1383. LDA Music_Bank_A0009 L$ F, W) L7 e' z. d
  1384. JSR SwitchBankA000
    / k6 g* a: Y1 w
  1385. RTS# p7 |2 \* `/ D

  1386. " A8 t8 W- }% g
  1387. ;==================================================$ }; M, O( `1 ^
  1388. Sound_Init;音乐初始化# o% r/ X5 Y8 b8 e" l% i7 ]. ^' I
  1389. PHA" t& D/ C4 ]8 |( _# J$ A
  1390. JSR Sund_Bank_Set
    , i0 I' G4 R) d
  1391. PLA
    - ~& q- d& J6 ]4 ~; y
  1392. JSR Music_Init_Addr( }2 R, S( X5 L5 [- S+ M3 B
  1393. JSR SwitchMainBank
    2 D/ X7 `8 Q+ k" u5 d. \4 |- B

  1394. % \3 Y9 d+ W, T7 H
  1395. JSR Music_Bar_ReSet+ b3 P  y% |+ Q
  1396. JSR Time_ReSet; N& c) f' a( Q( f
  1397. LDA #$003 I# G4 d2 Q8 a7 y# o) l
  1398. STA Music_State9 ]  J" a% U* \9 u7 D( z
  1399. JSR Music_Stata_Show
    " E+ P4 _  {4 H
  1400. .IF Track_Name_Pos% G* E7 w; Q7 z. {5 e. V# W/ g8 T
  1401. JSR Show_Track_Info4 O4 g) ^, \' `2 m, V* S* D' C$ Z3 a; K
  1402. .ENDIF# s* {1 r2 J9 s

  1403. ! c6 t! n7 y( Z6 q1 Q
  1404. RTS
    * p1 P9 M; {# \, }# |. L
  1405. 8 B7 A3 b- y' b/ Y; \
  1406. ;==================================================$ K7 G* x, _7 ~
  1407. Sound_Play;音乐播放( P* I* `6 V  o
  1408. PHA, _, Z. f  w# f" O/ Q& @& j
  1409. JSR Sund_Bank_Set9 @7 W+ i) o3 ]
  1410. PLA+ h, c; D) v$ D1 [
  1411. LDA Music_State+ H3 v' a7 w" P0 H8 f' g
  1412. BNE Sound_Play_End- V7 f8 X. n" Q2 w# C1 B
  1413. JSR Music_Play_Addr
    4 R$ w; [7 I$ {- V7 [% \
  1414. Sound_Play_End
      I0 E! n" e/ t2 D9 O+ }6 ]
  1415. JSR SwitchMainBank
    * ?- f) K' D* `" P2 a" j
  1416. RTS5 e4 P" V0 h# ^# ?6 J: n1 Z
  1417. $ D0 Z3 J- c' u, Z4 v
  1418. ;==================================================
    $ j" \4 C+ S; B& I  G
  1419. .IF Music_Reset_Addr- d, {5 a8 t  l% N4 H* c
  1420. Sound_Reset;音乐重设(如果有的话)- L9 d+ d' u) g* H/ j
  1421. JSR Sund_Bank_Set* n, Y2 l: {6 ~3 C. ]' Y
  1422. JSR Music_Reset_Addr( W7 O0 }1 q; H  C& ?, ?$ p6 h
  1423. JSR SwitchMainBank
    + _# W8 d; Z  ^' S
  1424. RTS
    ; ?! M2 t: h7 c2 k. y3 ~3 ?- B
  1425. .ENDIF
    # h( o& r+ q! T( q  d6 E

  1426. $ o) p% D3 W" n% [3 W
  1427. ;==================================================
    * O( C' d- i& V& d" f5 |& Y
  1428. MainLoop;死循环
    * A. c8 M2 J8 \. z
  1429. JMP MainLoop$ @7 l' O- B# X0 G2 V

  1430. 7 Z0 l; F3 ~4 _# K; ?1 X
  1431. ;==================================================/ {8 N2 L( k! q* \
  1432. NmiProgram;Nmi中断处理, n$ O/ S8 m' n. \5 F
  1433. PHA0 E- s) e* p! K
  1434. TXA
    0 B# `% k9 Q) P& h" P" ^. G9 c
  1435. PHA
    % N' F1 X2 e- _# z( @
  1436. TYA+ o2 R' r; w$ X; m  m
  1437. PHA
    9 d; ~& R% O+ B6 R
  1438. 9 ~7 {6 T. Z( w" T* d# l
  1439. LDA PPU_STATUS3 B  `' e  P8 K
  1440. LDA #$00' `( C$ W( }+ O; ^' l
  1441. STA PPU_CTRL
    2 G0 C9 j) y$ O7 z/ a- i

  1442. ( P2 ?1 J1 j( y" X+ k$ d8 S3 A
  1443. ;切换主程序bank. k: Y1 v4 h* m6 z% O  p- H3 v: h
  1444. JSR SwitchMainBank
    . `, u+ f- i/ F! ~( w9 D) @( @
  1445. 0 K+ i- A: o0 [- k+ H/ K+ r
  1446. ;NMI处理, ~9 c1 j* K( s1 n
  1447. JSR NmiProgramProcess& H& w$ z0 }% `% V9 X

  1448. * {! B4 J! J. h0 h  z+ X
  1449. Nmi_Proc_End- v2 {+ @, V3 f0 w& d: _$ x3 d/ o
  1450. PLA5 R! v$ Z( o+ Q4 L8 ~
  1451. TAY8 t. K& f( C  o8 L4 F  r0 ?0 w; O5 i+ x: n
  1452. PLA  v! y- Q2 r) C
  1453. TAX# L& n& A: _2 p+ e( d
  1454. PLA4 E/ A2 O9 V4 k& K! m
  1455. 8 c6 d9 u: r- b
  1456. RTI
    ' r4 {0 P) F: P2 N+ {% J

  1457. " @. D$ @  k1 ~- }1 P1 z
  1458. ;==================================================
    ) v3 @' t5 {2 t  M. z9 c4 a
  1459. ResetProgram;重置中断处理2 D" V# y( g6 t! m/ o5 R( J
  1460. SEI+ s) b" \  k# p0 H* a/ M; x. i8 D
  1461. CLD7 k8 T: j) g5 R
  1462. LDA #$00) e" Y4 n9 m8 g  G
  1463. STA PPU_CTRL  a9 q" ]) T4 ]0 n# H
  1464. STA PPU_MASK6 M" Z# \3 |* P  M& V

  1465. : v4 n' F: J  |
  1466. JSR SwitchMainBank
    7 [9 J6 d  M7 t6 @- x* `  l: ^. }  x
  1467. JMP ProgramBegin
    / w- R1 R) O/ X0 c! n% I3 M2 S2 h

  1468. ; v7 [9 {, _: q. U
  1469. ;==================================================
    6 }9 n! \4 F: y7 i; m
  1470. IrqProgram;Irq中断处理8 `) d# }9 I+ A5 ~( ?, R8 W# h! Y* e
  1471. RTI( b5 \& V  ]# O" Y2 w2 Z: M

  1472. 0 Q0 c: I2 p7 J$ L( ~, B
  1473. .IF SOUND_BAR_SHOW_ENABLE7 @8 Q2 _: R& B& o5 B
  1474. .ORG $FF805 o& O& w/ |' Q9 S& J( V3 P
  1475. STA $4000,X
      r8 t8 k' [* p) ]' T1 r1 U  Q
  1476. STA Sound_Bar + $00,X
    2 E1 z+ K# q% O% u- }: _1 n0 X
  1477. RTS
    + v6 R  ], b, Q8 P- J/ }' t6 X0 x

  1478. / P6 V4 d" h- E! W  T9 F2 F
  1479. .ORG $FF882 b+ R# q, y0 f% p7 i3 R4 X
  1480. STA $4000,Y" a5 H$ N& M! Y) V
  1481. STA Sound_Bar + $00,Y
    # o5 V. G1 L! d1 g7 x- H1 ~1 c: B: H
  1482. RTS
    ) D3 O' o3 `3 o) ]: P* a5 s' l) w
  1483. ) B3 `/ [) |4 |/ k' M
  1484. .ORG $FF90
    # Y5 e3 X/ r) g$ i4 M+ h
  1485. STA $4004,X: P  v1 y' }* V- I1 c& n
  1486. STA Sound_Bar + $04,X; n" X6 B' H* v  _' ~1 W+ v8 Y, t
  1487. RTS
    & U- P* _! d' W9 Z8 o  t
  1488. , _$ D/ o" `) F7 F$ }6 v. G/ c
  1489. .ORG $FF98
    1 j% M% G: n0 D! g, u
  1490. STA $4004,Y) `5 Z+ G5 `- g8 I
  1491. STA Sound_Bar + $04,Y
    5 F) _* _/ M/ ^9 D
  1492. RTS
    0 f4 J3 K; z8 W: r" B/ X* Y

  1493. . w# ~+ w1 @% N; G( c: X* B/ O
  1494. .ORG $FFA0. N* ~7 X/ }4 C  ]
  1495. STA $4008,X
    7 C; p) E& J4 g/ ~
  1496. STA Sound_Bar + $08,X- i# ~, x# s4 ^' a, O; }
  1497. RTS
    % v% x1 z( O+ @6 }
  1498. 5 l8 I: m! A3 k, `( `
  1499. .ORG $FFA8
    2 z; ?- U9 U1 M" r
  1500. STA $4008,Y
    + C; j4 @0 I3 _) _" g
  1501. STA Sound_Bar + $08,Y' N) g7 X# H$ b1 D6 }7 F7 _+ }  x
  1502. RTS
    + c, I& _1 k5 I* I$ A3 X/ d: }" T
  1503. 7 h9 n3 H' N* J+ }# R8 N
  1504. .ORG $FFB0! l6 ]/ `5 o9 _2 a
  1505. STA $400C,X2 Y: m1 G2 u* C. H/ ?. [' v
  1506. STA Sound_Bar + $0C,X
    # {0 c. L- G1 J: ]) d0 X1 P) B" \! B
  1507. RTS
    3 D3 o, w4 A) s7 y# s6 h
  1508. 1 X& X+ C- @! h, Q5 k- K' ~& e
  1509. .ORG $FFB8
    ) V& W, Z* [3 J/ {8 `- w
  1510. STA $400C,Y8 D# m1 G0 K  _, }9 i/ d
  1511. STA Sound_Bar + $0C,Y
    2 ~- k2 W; h5 L" Z4 b; Q0 O/ x
  1512. RTS- F% T9 d2 m0 e5 t

  1513. ) I* J, G  l# T2 D( y; S
  1514. .ORG $FFC0& c, \/ b) }& @
  1515. STA $4000
    ; U0 j+ O& D( v- ~( i
  1516. STA Sound_Bar + $00
    . C5 k2 C5 Q. n% ~
  1517. RTS& V& |% L8 O& T/ r( G

  1518. ; l  ^. Q3 N: H
  1519. .ORG $FFC8( f  J. S0 D. v% [1 {+ O
  1520. STA $40040 h& I/ C$ K6 X; s. F8 m& P/ m3 L
  1521. STA Sound_Bar + $046 `- w, k5 M; [% M7 a; p
  1522. RTS" E0 B3 q: j9 ~) R8 v
  1523. 0 m7 B, u( q  j9 T+ r
  1524. .ORG $FFD04 C, O7 w7 S; e% m7 n' Y. R
  1525. STA $4008
    5 b: e( h4 V; j6 Y5 H1 e- q# C1 c
  1526. STA Sound_Bar + $08
    & d' G2 A$ a3 r9 `: O3 H: a% |
  1527. RTS
    % z" k* T; N- N/ V

  1528. : s" s- {% q- w4 z  x
  1529. .ORG $FFD8
      f9 M9 i/ V" x: M" y
  1530. STA $400C
    % ~! f( `* h( V" u
  1531. STA Sound_Bar + $0C6 Y( P7 u) l& j! b
  1532. RTS
    0 g  c5 X* J# q7 o& ]3 W

  1533. ( @0 R# A' X: J, V
  1534. .ENDIF3 Y" q5 p$ \5 k9 p9 m

  1535.   L" y3 x# t! Q) E6 \. T9 K5 z4 J
  1536. .ORG $FFFA
    + m5 V) d+ L  G3 R  W* z
  1537. .WORD NmiProgram
    5 e9 r7 U- d5 `# A6 b; A
  1538. .WORD ResetProgram" d7 `$ Q; u; n8 N% Z( E$ U
  1539. .WORD IrqProgram
复制代码
, R/ l4 W* F+ s* v* p+ d2 E9 h

. [# z5 |' T8 b/ Z* X
游客,如果您要查看本帖隐藏内容请回复

本帖子中包含更多资源

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

x

评分

1

查看全部评分

签到天数: 1059 天

[LV.10]以坛为家III

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

使用道具 举报

签到天数: 3024 天

[LV.Master]伴坛终老

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-18 16:55 , Processed in 1.094727 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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