|
;[FC][忍者神龟3代标题选关程序]; \# G9 M3 x8 Y9 i/ g6 `
;作者:FlameCyclone 2017.4.1
7 [% x& s* C% Q7 @3 l$ |1 @! [
0 A' M0 `! s6 c' r: Y9 {& ?2 y
: Z T$ C" `' ^;配置数据$ O9 Y: {9 C p8 \5 o
KEY_ADDR = $F8 ;按键地址
9 P s$ j# W2 V8 K5 q6 Y5 YSTAGE_TEMP = $6010 ;关卡临时地址0 w" @6 S: i! Y! c9 [3 e
STAGE_MAX = $0E ;最大关卡数2 S' u6 s. [1 k# f. h
TITLE_A = $20 ;标题条件A/ m) Y: O9 P! I1 t
TITLE_A_ON = $02 ;标题条件A有效状态判定; C3 R8 ]3 P0 v
TITLE_B = $21 ;标题条件B& j1 L+ F0 @- C/ x9 S8 e5 X, G
TITLE_B_ON = $03 ;标题条件B有效状态判定
/ w+ S$ v7 ~9 tPPU_END = $FF ;PPU结束符: m \+ l; ^4 i. \/ i/ }
TIME_LAY = $4A ;标题显示延时地址, U3 `' k& o: L5 e+ s1 J; v- J
BUTTON_DEC = $42 ;关卡减少按键. d% L, D: I) l. t, Z
BUTTON_INC = $81 ;关卡增加按键
- H2 ^, R( W. _3 x- v- P A7 J" oNUMBER_A = $06 ;数字A距离STAGE偏移量; |9 `+ _, e; ^0 [) W) u
NUMBER_B = $08 ;数字B距离STAGE偏移量
) V4 r& n" [) ?5 @# \) w6 J$ HPPU_ADDR_H = $23 ;STAGE写入地址高位
; `$ e. @! l! k' p2 J3 ]2 qPPU_ADDR_L = $8C ;STAGE写入地址低位
: w; e6 U2 M# h( z$ ACHAR_S = $A2 ;字符'S'2 C) f6 T) {5 }' T; H
CHAR_T = $A3 ;字符'T'" |* \4 _' b9 m) X8 |
CHAR_A = $90 ;字符'A'
3 j6 Y0 z, l/ D( p3 FCHAR_G = $96 ;字符'G'( z' f* d* q) G8 p: n
CHAR_E = $94 ;字符'E'3 J/ ~" ]$ w" Q; m
CHAR_SPA = $00 ;字符空格4 p2 r- Y* Y$ N% y: `
CHAR_LIN = $AE ;字符'-'* [. s, J% p4 S1 ?: G. u
CHAR_O = $9E ;字符'o'
& G2 R- b( L- k0 G s# lNUM_1 = $81 ;数字'1'9 J) i" D0 R3 w& p8 u6 l7 h+ j+ W
NUM_2 = $82 ;数字'2'
$ B* N/ j$ _" x' E3 c, hNUM_3 = $83 ;数字'3'4 }# V) r$ S) ~1 B4 g
NUM_4 = $84 ;数字'4'
6 l& m G! p* N2 d* h8 F$ jNUM_5 = $85 ;数字'5'
- y" z y0 C; ~- D& |4 }- e: `NUM_6 = $86 ;数字'6': w8 _" R, ]' t/ c4 _1 Y, U$ K
NUM_7 = $87 ;数字'7'
1 R ]# r" U" INUM_8 = $88 ;数字'8'# Z3 c8 x3 U- j. K+ U
NUM_9 = $89 ;数字'9'
# I- Q4 q! P5 [4 K: ~NUM_0 = $80 ;数字'0') W* K! z0 \8 s$ H$ x
' w8 n5 f* J% R6 [% F .ORG $F82A! k3 V6 w, ?# b3 g2 `- C9 _
JSR $E700
0 j5 a3 a. G& ? $ n8 z" I9 B6 U+ f. C
& s4 |5 I" v( e2 e/ e/ p .ORG $E700' m. o7 d; f$ r% u4 j+ {
: B. d) y4 h7 t3 N, J; g
STY $4014 ;补上覆盖的精灵写入指令0 j+ e; X6 d O0 ?: x
PROTECT_DATA: ;数据保护
; I! ]$ T& R |+ W! l Y PHA ;数据保护开始
1 n! w! u' d& u$ y1 s. L1 l% h8 R TXA
% s# q! y$ {0 o! m PHA
: H# k7 X2 F8 I0 ~8 t- Z: s TYA$ s6 K d- n7 I& i2 n" A
PHA ;数据保护结束1 p, N1 H( p# m$ e5 ^+ B+ H
LDA TITLE_A
2 ]" x; X, r7 @ CMP #TITLE_A_ON ;比较是否为标题画面
" _1 m, Y+ ?0 H/ H BNE RET
+ t0 W' o6 b# | Y4 ~5 e8 y- i LDA TITLE_B
- _9 m% X$ z" {/ w( u2 R CMP #TITLE_B_ON ;比较是否为标题画面
$ ~" x9 ], W; u" J+ t4 P% u BEQ PPU_STAGE
8 t9 R! F) w7 P3 A0 [ q3 ?4 [5 ORET: ;恢复数据- H2 j. g! d6 t
PLA ;恢复数据开始
! A e1 G) t5 Y0 R7 O TAY
; W' g2 t+ f! O9 x PLA. K7 D. N1 }% d* R8 N+ f/ ^
TAX7 c6 H2 n7 D U& ^/ ^
PLA ;恢复数据结束0 R/ s) j e" V: ~8 G
RTS ;返回# R! I0 ?; `1 v
PPU_STAGE: ;字符STAGE写入程序$ F* F2 c/ O" W- U
LDA #PPU_ADDR_H
* ?8 h3 A' v: k7 g2 r STA $2006 ;设置PPU字符写入高位地址
! }0 j) U# |! a1 N3 s; z, D, z LDA #PPU_ADDR_L
0 i* o" c" n$ F5 o6 u! t+ } STA $2006 ;设置PPU字符写入低位地址
. L* ]8 V% M& \# X& F LDX #$00
3 [: k3 [' A5 j. l$ X6 t0 Z/ ~7 MPPU_STAGE_WROTE: ;写入STAGE字模* x/ z5 {; J$ J4 H' a$ Y o. C
LDA STAGE_DATA,X$ E) q# e( u! {0 F% `7 G( S
CMP #PPU_END ;判断是否写入结束% o0 i. [) k V7 C4 y: ~
BEQ STAGE_CMP V2 |8 `4 `* t8 w! M: M1 H
STA $2007
* H( m: r' h9 L0 i7 r INX
$ `2 s& L" W6 L! F# g) F N BCC PPU_STAGE_WROTE& h0 m8 q/ C5 L0 S+ J( Z
STAGE_CMP: ;选关操作
! k& O4 {( z# E v1 U LDA STAGE_TEMP
0 S5 I' S5 J' j+ h: r1 S CMP #$FF ;关卡数据初始化条件判断
4 P3 i+ i3 A, k N! e8 W& Q BNE KEY_B
; t! T2 o$ v+ I) i7 i; _8 J LDA #$00: l# j1 s. O6 g$ c+ R3 z7 I
STA STAGE_TEMP ;关卡数据初始化
1 Q2 [/ F$ b; O4 Q+ i" F) DKEY_B: ;关卡减少
& O9 {% z# Z2 |) { LDA KEY_ADDR& Z3 G$ f3 ~7 \' A! r) Y
AND #BUTTON_DEC ;按键B或左减关
$ J" C+ j+ L3 N q BEQ KEY_A
! m/ @! f# G/ q* D LDA #$FF
& h( y$ \2 U' N0 F9 ~ STA TIME_LAY ;重设标题延时# B( |+ V2 A$ L' x) \
LDA STAGE_TEMP% N0 C1 t- ] O$ P6 H
CMP #$00 ;关卡比较0 ]' ]( N+ z% d! x+ C) M/ O- O3 }, J
BEQ KEY_A
& s* a1 `6 ^+ b1 k9 U: S DEC STAGE_TEMP ;减关. b6 e9 ?# W* _* `: p; N
JSR MUSIC ;按键音效% k( C2 [- t* r8 S! P7 i A
KEY_A: ;关卡增加
# Q* L+ D) O- n1 z6 F3 C9 h LDA KEY_ADDR
6 K+ w4 V& B V9 c! ~2 O$ g( d AND #BUTTON_INC ;按键A或右加关0 W; b( d( T0 Y! m+ [
BEQ PPU_NUM_WRITE. d' P; P/ ?8 M1 |& d' ^ K: B5 V
LDA #$FF
2 k6 T& N# F4 ~4 B0 K9 u1 M$ f STA TIME_LAY ;重设标题延时. U4 U4 I6 J; q G& s1 K7 z
LDA STAGE_TEMP# R9 U2 V7 u! L9 i' l
CMP #STAGE_MAX ;关卡比较
, G; O6 B& B' |! P6 e* E p' C8 ?/ x6 B BEQ PPU_NUM_WRITE. a% h; x8 I1 `8 k
INC STAGE_TEMP ;加关
- A% C H/ ] |2 R% b; c8 O6 w7 G JSR MUSIC ;按键音效8 F- ?/ D' x# v, z6 u
PPU_NUM_WRITE: ;关卡数字写入地址
& u" L7 k8 A( G9 H" m ?/ Q5 V LDA #PPU_ADDR_H" d& J2 M2 m+ D# O& K
STA $2006 ;设置PPU数字写入高位地址
0 Q4 t9 H- M9 p LDA #PPU_ADDR_L
0 c q5 o3 v# C0 a& m& x( t J CLC, ~2 F/ R4 Q9 j$ w
ADC #NUMBER_A
- N2 M3 S; E" }8 |/ Y: [ STA $2006 ;设置PPU字符写入低位地址
' V( @, E0 K- e, ]7 D4 C) k LDA STAGE_TEMP q9 X) ^: a1 o/ g
TAX
2 X/ T7 q/ `5 [. q) d& S6 t. U LDA STAGE_D1,X ;写入数字: J' m3 p# p' Z6 ]) n1 u3 F/ W8 Q
STA $2007
; l \0 l* {( E0 E LDA #PPU_ADDR_H- O) p' `# C& O
STA $2006 ;设置PPU数字写入高位地址
3 _# S6 k: _, Q% h2 w LDA #PPU_ADDR_L
" A9 }3 T9 R7 d9 H: n0 Y5 n/ m CLC
) M2 @/ c! T% C& Y ADC #NUMBER_B
* Y+ [" v0 B1 \6 O( U" C STA $2006 ;设置PPU字符写入低位地址" T7 V+ V7 C1 E. i
LDA STAGE_TEMP7 I5 X# k1 V! q& E
TAX. m+ }% ~/ @5 [9 i: ]: d4 p
LDA STAGE_D2,X ;写入数字 }0 A9 `& B4 c
STA $2007
# j$ _- c' d! B, o5 c9 _) jSTAHE_WRITE:
/ z6 |& Z) D7 l LDA STAGE_TEMP
4 g o- |8 ` V# y8 m- b' g STA $2D ;初始关卡写入
8 d" [/ b1 K; r( u# m3 I9 D! y1 O" ePPU_RTS: ;恢复数据
) `# g A0 g3 x7 e PLA
; p& h$ G, k/ t! W0 U& Q TAY5 o' L& w2 c" x6 O5 G6 g5 K. |# u7 }
PLA
0 e3 M- [0 z; ?6 p( T$ O: n: R# C TAX6 H" M! W& m4 \
PLA
; l1 \# i1 j* Q$ z RTS
+ E V+ I, f* } e3 W: Q" O ! u9 f) @( D* K1 t6 {" S
STAGE_DATA: ;关卡文字S,T,A,G,E,X,-,X字模数据
/ x, N) T y. U .BYTE CHAR_S,CHAR_T,CHAR_A,CHAR_G,CHAR_E,CHAR_SPA,CHAR_SPA,CHAR_LIN,CHAR_SPA,CHAR_SPA,PPU_END8 J3 l3 o! I4 q
" G, l; Q d% k, v$ Y$ q( iSTAGE_D1: ;关卡数字$ l( ?& A4 A* o3 m, ]0 @% E
.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
; ^0 T7 Y- N6 |/ D8 T& `- L; Z! \2 [1 q @9 `' z2 C' ~$ ?, X
STAGE_D2: ;场景数字
% Q" P* ~) c2 f! C .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
7 s% |0 l/ _, c6 e. B2 ]
+ \2 X# Z. U x5 d) a9 Y3 H1 Y5 @ & p1 \8 }8 E7 |* R; J8 @
MUSIC: ;按键音效' ^: g2 t1 ]2 Q0 @4 e* `
LDA #$3B ;音乐号( N/ N" w0 S: B
JSR $919E ;系统音乐调用1 O2 N1 _* n* L7 Z- G$ L
RTS |
|