|
;[FC][忍者神龟3代标题选关程序]
& O+ R4 d C1 j" A9 Z! {% D;作者:FlameCyclone 2017.4.1
+ E8 t! ~ t \ v5 l! t/ |
1 ?) |3 h; x K% T3 k* L8 M! o( Q$ v9 ^' E% }/ N3 X* n$ a% _
;配置数据
1 O( m/ z0 c# t9 l) ~+ O- A) YKEY_ADDR = $F8 ;按键地址3 f/ r! w @# o/ p
STAGE_TEMP = $6010 ;关卡临时地址6 i; G0 n E; O" W* `1 w0 x$ T% {' Z
STAGE_MAX = $0E ;最大关卡数% H8 c! {& Y) {; k1 k6 T
TITLE_A = $20 ;标题条件A
5 B2 J0 ~) `: ETITLE_A_ON = $02 ;标题条件A有效状态判定3 v3 ]# w4 N3 v2 j$ d" t
TITLE_B = $21 ;标题条件B
8 F0 T4 [& ?5 i+ D2 t9 uTITLE_B_ON = $03 ;标题条件B有效状态判定
$ h5 @, U1 U% P/ r: u% e! HPPU_END = $FF ;PPU结束符1 t2 p0 W) c& j8 O
TIME_LAY = $4A ;标题显示延时地址
6 L; d3 o# I1 K8 {5 yBUTTON_DEC = $42 ;关卡减少按键
" ]/ G ~5 f+ l! w, cBUTTON_INC = $81 ;关卡增加按键% o8 B% v6 @! |. Y) n$ c% p
NUMBER_A = $06 ;数字A距离STAGE偏移量
& L4 F: }; E' v$ y6 `/ r9 z* C# ~NUMBER_B = $08 ;数字B距离STAGE偏移量
7 ~3 {4 `' a5 F4 Y" V! M/ J0 sPPU_ADDR_H = $23 ;STAGE写入地址高位
! }6 P" B4 v0 M% O7 x# [ Q. H. DPPU_ADDR_L = $8C ;STAGE写入地址低位9 p z8 b2 a2 W1 y% t* m
CHAR_S = $A2 ;字符'S'
5 o" |9 s- E8 E3 v) {CHAR_T = $A3 ;字符'T'
8 Y, w1 l% r& e) |CHAR_A = $90 ;字符'A'4 n% }. C/ Q& Y6 _9 ~/ Y
CHAR_G = $96 ;字符'G'# U/ ?# W! N, I
CHAR_E = $94 ;字符'E'7 L" ?/ ^) t; D. E7 E
CHAR_SPA = $00 ;字符空格- K/ D) [/ c3 K1 m& Z2 ~+ a# O
CHAR_LIN = $AE ;字符'-'
( I, ]2 M2 z" ^! t. jCHAR_O = $9E ;字符'o'
0 M8 J8 m/ d% W4 A, n" Q' r6 RNUM_1 = $81 ;数字'1'
6 x. A: S4 l" ~( ?: PNUM_2 = $82 ;数字'2'
0 k$ M8 H, a9 f4 i1 eNUM_3 = $83 ;数字'3'
; `6 A/ Z" D( y- y; fNUM_4 = $84 ;数字'4'
8 b: }# [/ t0 L- w- rNUM_5 = $85 ;数字'5'
) c; d' P$ ~4 D$ KNUM_6 = $86 ;数字'6'; f0 N& g. d' `
NUM_7 = $87 ;数字'7'6 a; E6 U ~ J% y
NUM_8 = $88 ;数字'8'" Z/ z+ X% l+ x, A2 _3 k
NUM_9 = $89 ;数字'9'
: y" C' n. x7 s/ b$ J" eNUM_0 = $80 ;数字'0'
; a; h/ b7 l2 T; b2 T O; A4 ^% @9 h7 x2 N. B# I- q ]$ D4 B2 V$ z" s
.ORG $F82A* j1 D8 }& I& A$ U0 y
JSR $E700
0 n1 A. {; V" K! H9 e& |" \, [ 0 ~6 d; S( s# @# A1 S
+ Q* W9 A4 T( j' A .ORG $E7009 [$ A" E$ U( B
6 H) j* V5 S0 s e: @ STY $4014 ;补上覆盖的精灵写入指令# c7 S+ \2 @) p3 I
PROTECT_DATA: ;数据保护
6 ?2 D, h! Q/ D4 E/ L& R PHA ;数据保护开始
4 p) v# H. @& C/ k$ L! D" v: O2 ^& M3 w2 ? TXA3 X6 u: i1 \# [& h6 `
PHA8 e) m1 F5 _3 K& [( o7 ~2 A/ x
TYA. Y# w: o* I7 W& e [
PHA ;数据保护结束
! ]0 [. S9 B/ w: O) d3 _ LDA TITLE_A3 l5 w5 _% C, O! I" Z" I- W0 w
CMP #TITLE_A_ON ;比较是否为标题画面6 x& Y* O9 ?4 o5 O
BNE RET8 Y; a0 B" P- K' ^
LDA TITLE_B
. r: A! Z: j' B) q; J$ c CMP #TITLE_B_ON ;比较是否为标题画面 p8 c$ ]( q. {( m* R& v" ^+ t
BEQ PPU_STAGE2 r9 g1 @% {* m% O/ \) X
RET: ;恢复数据
% _6 P, s/ e4 L9 r: G PLA ;恢复数据开始$ D* ?4 ^+ @ Z' p9 _
TAY/ u4 Y- [* `* X( |& E2 ?
PLA9 X9 p4 N$ ]; p. B$ ~8 w4 ^* K
TAX! l- z; t( n0 }* M
PLA ;恢复数据结束3 c2 ]9 Z$ S0 R7 ]( M
RTS ;返回
9 @7 s' X, T5 fPPU_STAGE: ;字符STAGE写入程序
( i! u @9 d1 U5 ? LDA #PPU_ADDR_H
4 w/ j. c9 H2 } STA $2006 ;设置PPU字符写入高位地址! F1 b, B& N( e5 P9 C
LDA #PPU_ADDR_L
E: k) u/ C) }8 A n5 r. h STA $2006 ;设置PPU字符写入低位地址
3 N: P5 I3 e2 n4 G# K1 F; E- k LDX #$00
! C) d- Y q0 ^: WPPU_STAGE_WROTE: ;写入STAGE字模
6 N' Q y$ H y: s" Q LDA STAGE_DATA,X" ^* W, D" h) G
CMP #PPU_END ;判断是否写入结束
- F7 d6 n* {! n# L. K BEQ STAGE_CMP
& ^, e5 |5 _6 E STA $2007
; G8 i6 B) t7 E1 e# x8 m1 Y7 M INX$ w; h/ }; X- ]$ {1 _) R8 k0 Q( X
BCC PPU_STAGE_WROTE
; i) x0 L+ A r' SSTAGE_CMP: ;选关操作
) J z7 W6 a/ C$ f, |: P LDA STAGE_TEMP
3 G3 e7 d5 h$ ?! s4 ? CMP #$FF ;关卡数据初始化条件判断
* {8 P: k0 K- o# m9 D( ]0 P4 Q BNE KEY_B9 h& R$ y2 o1 d, D3 c6 g
LDA #$00
- B( J0 m5 y5 f STA STAGE_TEMP ;关卡数据初始化
' i. N: z, T. p7 M$ X) `KEY_B: ;关卡减少/ x) j/ i8 w7 K
LDA KEY_ADDR
. ~' ^- ^' @$ v- O AND #BUTTON_DEC ;按键B或左减关
7 M/ V: \1 |4 E2 c! r" b7 V BEQ KEY_A
) w* j9 K$ E, B/ O$ W! z LDA #$FF
8 @/ Z1 K$ S3 s& e2 S- a. A STA TIME_LAY ;重设标题延时
4 a& H6 L7 m' Z/ ] LDA STAGE_TEMP# Q1 `5 q# s, W1 p7 C
CMP #$00 ;关卡比较. N2 ^3 D9 v0 \; G% j0 b
BEQ KEY_A& Q# K; s) k' i% U, ]/ |7 n, \
DEC STAGE_TEMP ;减关- o( W1 t$ A* O
JSR MUSIC ;按键音效
3 S# q: D# a, x$ JKEY_A: ;关卡增加$ z0 @5 h& A% f! e
LDA KEY_ADDR
- ]8 q; I* h' P: |$ L8 x( w; S AND #BUTTON_INC ;按键A或右加关; Z& C. l5 [% n, U2 ^! A
BEQ PPU_NUM_WRITE# d/ K6 I1 E r* O5 ^
LDA #$FF& p0 P' r0 a- [3 f* l7 p
STA TIME_LAY ;重设标题延时4 j; g& K3 R& k! P3 u* S. z
LDA STAGE_TEMP
0 R- @: r5 R3 ~2 D CMP #STAGE_MAX ;关卡比较
8 n3 z) R( Q- o- L: K BEQ PPU_NUM_WRITE) M7 o" ^+ j9 N# U. O+ c
INC STAGE_TEMP ;加关! o" a1 V/ |$ {
JSR MUSIC ;按键音效
2 @& V; O- J" u7 xPPU_NUM_WRITE: ;关卡数字写入地址
6 h9 l% t7 w' l1 b LDA #PPU_ADDR_H: n! ^1 \# A# S' N F' [% B. w
STA $2006 ;设置PPU数字写入高位地址
. Q5 B5 k) j( K8 b" H7 H LDA #PPU_ADDR_L& P+ _7 U- I: C2 q
CLC
6 D; f/ j e* P4 d' g; [6 H/ Y ADC #NUMBER_A/ m' Z/ C( D) _9 E+ }
STA $2006 ;设置PPU字符写入低位地址- [. z1 Q5 f7 r9 z
LDA STAGE_TEMP! \4 a, y$ R6 ~
TAX
9 y- i& I- N, L" v. f$ p LDA STAGE_D1,X ;写入数字( H6 S- O5 F0 L
STA $2007
) l) B) Z" ^8 N, K0 a1 \ LDA #PPU_ADDR_H) Z. S+ W) ?/ {. A7 h& y
STA $2006 ;设置PPU数字写入高位地址
( e8 l$ U% U7 k) T, O$ f LDA #PPU_ADDR_L# k2 v- z- Z$ g# d: u- i% Y4 k" Q
CLC
' ] V3 K" b/ [' O$ b |( F ADC #NUMBER_B0 t# N+ y% }. M( {0 g7 L
STA $2006 ;设置PPU字符写入低位地址2 h- V3 d7 n- I; {# x/ G
LDA STAGE_TEMP
* A& o9 k2 {5 A" s; K ^2 D' G, u% { TAX9 K3 v- C! z1 g4 L5 j
LDA STAGE_D2,X ;写入数字
8 R/ `, ^& X# ]0 V9 \ STA $2007
1 ]7 \8 q2 U d- L9 g- a2 D& KSTAHE_WRITE:! M! V" P4 c2 {5 K0 T C- P* Z
LDA STAGE_TEMP( Q2 z0 H6 }5 O+ p* w
STA $2D ;初始关卡写入5 F" f! s3 P2 @6 E+ }
PPU_RTS: ;恢复数据
^- G% t$ n, A6 \0 H PLA
* n7 b) S V$ z7 @ TAY7 [7 s; z a. i
PLA
/ h- f: K" C- h/ B TAX+ `' F+ |/ ?$ W
PLA
0 {/ ~: G9 C- i( }1 S) Z3 N/ y7 f RTS
- }5 i$ ] C0 d. }2 d! E) [1 I 6 W( Q% z* r! [1 s
STAGE_DATA: ;关卡文字S,T,A,G,E,X,-,X字模数据
2 P# l8 q7 p/ T: K. D7 w3 W .BYTE CHAR_S,CHAR_T,CHAR_A,CHAR_G,CHAR_E,CHAR_SPA,CHAR_SPA,CHAR_LIN,CHAR_SPA,CHAR_SPA,PPU_END
4 h1 i: Y- A6 |$ {5 t3 J
9 p3 h) b- L ~' A6 \2 Q0 G7 XSTAGE_D1: ;关卡数字6 C" J. |" M# r, g9 i
.BYTE NUM_1,NUM_2,NUM_2,NUM_3,NUM_4,NUM_4,NUM_5,NUM_5,NUM_6,NUM_6,NUM_7,NUM_7,NUM_8,NUM_8,NUM_8+ V) W7 {6 Y& L
( {* _6 E* |* |/ g2 n( P0 eSTAGE_D2: ;场景数字; a2 V" h# c! p {! i
.BYTE NUM_1,NUM_1,NUM_2,NUM_1,NUM_1,NUM_2,NUM_1,NUM_2,NUM_1,NUM_2,NUM_1,NUM_2,NUM_1,NUM_2,NUM_3
' _- d/ B$ S# V" F) l) P( r, U0 v * j& M# O4 h5 s, L
+ K, ]3 C9 Q1 r" M
MUSIC: ;按键音效
. D- d. S% z2 u) e' s LDA #$3B ;音乐号. v, |, C! i& d7 l3 x- f
JSR $919E ;系统音乐调用
) J' Y- y) p3 S# w: g; V RTS |
|