|
本帖最后由 yandagui 于 2017-3-30 21:03 编辑 0 R' W# ]& x8 a
' p) u+ m4 z5 X5 r得益于修改思路的进一步优化,原本是通过文件的Trainer在7000-71FF固化程序,让程序的精灵端口跳转到7000执行关卡选择的程序(包括显示STAGE),Trainer在ROM载入时就把Trainer的512字节载入到7000-71FF了,本来想通过按键跳转的切BANK程序里面把原本Trainer的数据复制到7000-71FF,这样ROM就不需要Trainer就可以让7000-71FF充满我写的选关程序了,然而,ROM运行时首先运行的是精灵写入程序,那时候按键程序都还没有开始执行,此时7000-71FF一片空白,跳转到7000只能死机喽.: [2 W: T8 S* B; {
然而,今天想到一个思路.+ V) i* }) c( f9 ~
1.找一个大约20字节的空间A,把精灵写入指令改为跳转到A写上: 7000-71FF是否已经写有数据(71FF为FE即可),有的话跳转到7000执行,否则执行原来的精灵写入程序后回去., u' v: U1 U' _; e
2.按键部分加上数据复制功能: 判断71FF是否为FE(是的话数据写完了,跳过写入程序,不是就复制数据块)没有复制完数据的话就把Trainer数据块复制到7000-71FE,复制完将71FF写入FE
/ G+ y8 z5 }5 z3.这样一来就可以完美地使用空间6000-7FFF来写更多程序了(数据可以写入到6000-7FFF).. k- m' s. t7 K& e
: [! I9 K5 e% |8 R0 @$ a; h* V
; g- S; k" H! a# `8 f: Q;[FC][最终任务KEY][END]
2 M x2 c6 ^. D5 v6 ebutton = $04 ;单次按键$ N1 y2 ` ^, }. P! O
flag = $6000 ;功能开关标志1 O, ?% o6 @* N1 x
pause = $000E ;暂停地址
% K1 L$ ?5 Z P9 R
4 n) F3 x/ i/ l$ s) z4 e; G8 { .ORG $8000( p+ z: v/ D/ ~* w) \
LDY #$08 ;自带的按键程序
1 l/ L/ C1 u) [; a: }4 a9 PADDR8002:5 X+ ~* ^3 }4 {: e2 h9 U
LDA $4016,X' b& l8 O3 G6 N" T
LSR
: V F* h* j$ L6 ~# e7 x: m) @ ROL $0021
) [- f# @# D6 x* e. k! q* k LSR4 e1 C2 e& H3 r% z/ `
ROL $0029
/ z0 P( P' {; x2 c) [ DEY p2 P, c: A& ~) d
BNE $8002$ C, `9 Q) k; z3 a0 r5 l4 @' T* K1 B
LDA $0021. x: P3 ]+ H0 N# B9 I- P& O% u
ORA $00299 V7 n9 b# v+ z& v
STA $0021
9 d) Q" E: A6 b% R9 ^- t& r, v LDA $0020& x9 j# [6 E+ q; p: T. p% l
AND $0021
6 U+ Z- B% d' e a; P STA $0020
6 t. h( X- W' B4 |, x' i! ?/ m LDA $06,X
; h2 h* v# R& g( h- j5 i( P: s EOR $0020$ P; @. Y1 y2 N0 M) f
AND $0020
# m) R4 n$ G6 S( @2 C" @; S3 O, c+ a STA $04,X
% \1 ^4 A4 G! K) A/ x3 C* s" _' { LDA $0020* a$ I/ \7 N& F7 {" r) Q
STA $06,X
9 C, K8 _& [, ?7 e0 w JSR KEY_OPERATE
3 V6 l/ v: X1 R& f% {/ X6 g$ Y JSR Function ;功能调用5 W9 |( _- _. m6 q3 }* u
JSR Weapon ;武器切换调用: P( l+ `3 P) F4 h0 n% @- n. H4 H
JSR Power ;威力调用1 Z, O- w; Z; `2 A) `: G6 o0 `6 Y8 q, E
JSR BULLET_NUM ;子弹数目, U/ \$ ?: g( ?: B$ e: U" P
JSR BULLET ;副武器类型
7 ]3 I2 K v9 c. m# P" v6 f- r RTS* O* t" x; f& v0 f$ o
- k! t$ X6 N M
7 ~0 |6 {) l: U0 ]& O
5 W& e# W$ l e) b! R7 K .ORG $8050% _+ N6 g4 `# t, ]$ H/ e
Function: ;功能7 P3 y$ {8 p- T! z
WUDI: ;无敌
3 m; M# n% k( q+ p6 B LDA $6000,X
8 d* s/ w$ K- Q: x0 e AND #$08 ;开关判断
& q: j8 m% r$ i/ q& n BEQ LIFE
* F+ [' O- F/ p/ q4 d& C LDA #$057 W& @5 M: Q& R+ J; f, X) A
STA $05DC,X ;无敌锁定
1 ~4 h; `- @7 a" C8 j! E: T) `LIFE: ;生命
8 H- a9 \$ f/ _ LDA $6000,X
7 H* l" R( P: j: D f AND #$04 ;开关判断6 m+ R1 i3 d. z! g8 ?
BEQ FUNRTS) @ @9 d# X- @$ d& k' ?
LDA #$05! J) `! q, B7 i' z+ f: {0 K' [
STA $1C,X ;生命赋值
2 ?. S6 a6 C- _- uFUNRTS:
% D3 f' Y+ y- z) B( G RTS2 `; y7 Q, B7 O: z0 {
/ x3 e9 B7 o8 u- X; aWeapon: ;武器切换
+ F" i/ j4 L3 ^3 Q. Y5 P8 J! k. u; H LDA pause ;暂停状态判断$ k9 w% _- t. P& W/ {, z8 U
BNE WEARTS# L8 j: p: Z$ o4 L. b
LDA $04,X
3 Q0 U' z# r, a2 S, Y k2 g# d CMP #$20 ;选择键判断
$ P! [8 p( r$ Z# E BNE WEARTS# k" ^/ w& V, @% C% j
LDA $12,X3 F/ o, W/ b5 x9 J
CMP #$03 ;武器值判断; H5 A: v! V3 V5 ~$ H; f+ n% m- Q
BCC WEAINC
" x3 U c M1 f2 z& H/ { LDA #$FF5 [+ C p9 u3 J% A; f1 T6 t. R: m8 A
STA $12,X ;武器重置$ W% D! w$ L; o* G
WEAINC:
" R* Z' C7 C) [0 _& ]+ `, y INC $12,X ;武器增加
- h1 V6 E: U2 G8 r: ?% Z6 b . ^6 ~% d; G9 p( x$ a8 F
WEARTS:
: J% B7 p8 S, Z+ [% b* B! m: l RTS
1 r$ S: n7 K# F1 |# ~* Z
' c& ]% i; W: n; C* ]. yPower: ;威力# y3 W) S% |0 V, H
LDA pause ;暂停状态判断+ T j3 |0 c7 h* B' L2 O
BEQ SPERTS
! S+ S5 N0 @* J$ U7 DBUT_LEFT:
) x0 v* d* E9 i7 h# A. O" k LDA $04,X
5 `5 u/ H+ q/ {2 b* ~/ |7 z CMP #$02 ;左按键判断
; c; |. \/ ]( l) [+ s3 @ BNE BUT_RIGHT
$ g0 @6 \) e* G- |6 Y LDA $88,X) J# v4 W8 w' q3 A7 B
CMP #$00 ;威力判断3 _/ s0 i0 M3 q! Q" v, Y7 x) i. t9 N
BEQ SPERTS. @, H' R. ?8 L, ~
SPEDEC; {1 s% I% U4 c$ k- j
LDA $88,X ;读取武器值& P/ h% B! {, W
SEC
4 A2 ?) Y2 f7 s& E% h: {9 a$ e+ [ SBC #$08) ]% @) [, f2 ]3 d, Y: G
STA $88,X ;威力减小% u" x+ l/ H& g/ K, Z' m
BUT_RIGHT:
" a% T$ W+ J4 M J/ H% Y LDA $04,X( g3 _6 ^2 j! q3 H
CMP #$01 ;右按键判断
. c4 ]; X" x: J! g7 B1 J: f BNE SPERTS
# W) }( I+ W$ q; y/ i* S8 P5 Y LDA $88,X9 ~0 Q9 O- U+ ^. h8 T5 u
CMP #$10 ;威力判断
5 g% Q4 H Z* @( v5 H BEQ SPERTS( j8 z4 a- H- y4 J/ u9 I
SPEINC:
, ]* k0 [/ v5 _4 D1 ? LDA $88,X ;读取武器值
' v2 S" F" Q4 z' G! Y. B CLC
) i2 x4 ~: I4 y' D* o w4 X$ |; i ADC #$084 O3 I7 l7 Z3 u
STA $88,X ;威力增大* q. v* Y5 a' w6 r" s
8 \( M% V& j- N' T/ n$ \SPERTS:+ c" f/ H# s1 c7 \' F
RTS
% p% ^$ K- D$ I& j; E8 o, `3 Z0 W. q
4 _# K1 d) M6 ~% gBULLET_NUM: ;子弹数目" @* }/ t- ^8 C' D3 B# g
LDA pause ;暂停状态判断3 B8 f" _" g. {; {9 o
BEQ BULRTS
3 i" f% g, L9 _5 {3 y" }+ c' S CPX #$00 ;主机玩家判断8 g1 w; p( E+ Q$ Z. {: J
BNE BULRTS
0 d" V0 U1 @4 p6 K2 w- } LDA $04,X ;主机玩家判断
( p4 F: T" r" O% ^/ V$ n Q AND #$80 ;按键A比较; B5 F1 n( X! q. i9 s! c
BEQ BULRTS
5 c8 {! y/ B- ~: r LDA $87 ;状态判断
$ U: u& f+ I/ G" C% a BEQ BUL_2/ v- @- f7 ]/ v( z4 A1 ?
BUL_1:8 l8 u! Z5 @4 D
LDA #$008 z4 Z* K+ p& ^
STA $87 ;1发子弹+ r7 L/ j" K M
BEQ BULRTS
/ E( u5 |, R" S3 }: o h3 KBUL_2:
0 J9 X6 U/ N0 X, I7 {$ Q5 q LDA #$012 D6 A/ c7 a8 L5 l4 r& A# [' P
STA $87 ;2发子弹- A9 {' U, \% k9 ~7 {, D" G# }
2 c. D4 G7 c4 K- b- u# }BULRTS:4 W1 i3 s* R/ l2 T. E( O/ t
RTS5 @$ Y5 W$ S3 e7 _9 B0 R- t3 u
% \$ [2 r8 f* r# [4 m4 S
9 s+ z$ j* q' t% n2 |& D
BULLET:
! S/ s: n! p( N8 s N: m LDA pause ;判断暂停状态
! N. X4 v h4 ?) h' _' t" s BEQ BULLETRTS
/ M. P; ]6 O2 I0 p LDA $04,X
8 v f; E7 H: j P CMP #$40 ;按键B比较# W# i; P" {" d5 D4 H/ H- P8 ~% k; O) X
BNE BULLETRTS4 U6 z5 _+ c( X: H
LDA $6002,X ;读取副武器
0 ~7 f* K' u d; S9 W CMP #$03$ |. v" _& d+ B. N4 q
BCC BULLETADD
5 D1 r2 h: X' Z" } LDA #$FF: O! H& F* @. b* u' A5 b# m
STA $6002,X
7 |3 q5 C+ o9 d0 F. h/ o- t" [BULLETADD:2 r" q7 }7 J, J# j9 Y! _* V
INC $6002,X
/ S) _ _9 T+ `1 Z ! U3 ?1 `- R& k: v/ H$ A2 g1 K" v7 P
BULLETRTS:
4 }2 \4 ?1 [: j: t; p4 x5 t LDA $6002,X% G" d6 A6 g* C1 C
TAY
+ G3 q, A2 h% C4 K4 z4 z LDA BULLET_DATA,Y+ W; t6 G. P7 K4 O
STA $6004,X ;写入副武器数据; h4 G2 U" C& S
RTS8 } f' Y! t( a: }# a
; L7 d7 Q! l& S' x, O2 X6 f 4 D7 s& {* c$ E$ F, x0 [! n3 W
BULLET_DATA:
" l( r7 A9 B! D .BYTE $06,$02,$03,$048 L% u4 y K3 u. R
l5 h, k: }# b" U2 g5 H4 ^+ ^6 }* P $ e- C) @0 J5 V/ C
* H/ ]2 w+ Z7 @& ^8 i$ B! t; Y# H9 mKEY_OPERATE: ;按键开关操作
1 w' y" _% i2 qdata_protect: ;数据保护
, o1 ]' R) E1 w PHA! n6 X# C p2 U& Q
TXA$ M) m2 c$ Q( y7 Z$ n
PHA
! ?- N5 J, h& Z+ q. J TYA r) |$ C3 p `6 ]; [
PHA
% z* }+ B7 [# I, q& U& B/ u3 h0 n8 T8 @7 T! q! h1 G( N: P
FLAG_INI: ;开关标志初始化 R7 c# r& N8 `& [9 c
( r- f. a& K. G$ I LDA $600F
2 ?' U$ g9 w v$ f, H4 Y CMP #$01* x. n. n# K& Z' w( d
BEQ pause_cmp- g4 i* ~7 L @/ X7 a0 K9 Z, Y3 k. j
LDA #$00
; A: |* R: h+ @4 w( V' r! s q& d STA $60006 Q' {% B1 ~* [0 ]% [6 n
STA $60011 d& ~0 V/ G) L \1 m
STA $60023 }. |+ u( x2 Z
STA $60037 {1 u2 b' _9 P/ _
STA $6004
) I2 ~! ]& ~% ]* a STA $6005
+ A s9 }: r# i3 j8 U LDA #$01
% {6 @1 n% h3 Y STA $600F) k9 v: B% M" v5 p: w
& \8 {4 {/ B" D. X
pause_cmp: ;判断暂停状态
% v# r" S. {6 r/ E) u& a. ^2 G LDA pause
' H/ `5 f# ]4 k* } CMP #$01 ;判断暂停状态
7 t, r0 g ~+ x BEQ button_press9 C# A; Y: `( |9 t
PLA. p9 c4 ~) G8 `0 z+ y1 i1 s) d
TAY
. D, J9 }+ {' W; R PLA
" r6 ?% ~7 [1 E$ k TAX
" A' ?6 A! D. b+ m PLA5 L9 K* q- _7 x) L! ?
RTS
V+ d3 D" t( ?3 s) }" n. N$ F( \' v3 H. r0 D7 D
button_press: ;按压操作) D7 b$ v' L* q' y. |
ini_Y: L% u# A& \2 \5 V, n
LDY #$00
3 T" z4 ]) o# `/ F$ _button_cmp:
( R& Y) \4 b v$ f4 u" z! \ LDA button,X5 i7 Z5 G9 w. ]: f, O/ Q8 @8 v
CMP ora_data,Y4 |* q2 \4 N+ X
BNE count_Y_cmp
& Z' T3 m2 M: [7 f2 yflag_cmp:7 j" Q6 r7 g. _/ q* |+ a3 s/ f
LDA flag,X( r$ Y+ d. w; Q/ h- s7 ?
AND ora_data,Y8 S6 d0 ?# |, l6 g5 c8 W: t6 D
BNE flag_and
) ?9 E$ H& s. Dflag_ora:
3 Z; H$ B {1 n! v* R; W8 G LDA flag,X
6 a6 e( C/ H9 G ORA ora_data,Y, P% J1 H: G9 }6 j: t0 R0 R/ d) _
STA flag,X
5 e* Q. p7 E6 k& j: F BNE count_Y_cmp
: @5 Y x' Y4 n C/ W& }( x* Fflag_and:) T3 \( f# Z& A9 u- @
LDA flag,X% S, M) w/ K: n7 `# Q8 f3 L
AND and_data,Y
; i9 ~! ?9 @' b" l8 X STA flag,X' a1 L% v' U. I# B9 O9 [
count_Y_cmp:
7 R' T7 E7 a. M$ Y0 u9 A INY
Q9 t% u. l+ _; a S3 I: A# q. u. ^ CPY #$081 K9 r8 \! Z* \0 Q6 S
BCC button_cmp
) G; }$ E( Z& E) Y; L & ~' e( y; B* }7 |! z
data_extract: ;数据恢复) c* j8 y$ r/ {* w
PLA {9 L4 _( Q) ^/ c3 D
TAY7 ?/ i5 r) c+ B$ z( S( ~6 V
PLA
3 M. ^% ~! ^8 m% S! C TAX
2 P3 ~% ?" {- K+ G1 U- x PLA- e/ F. N3 f) n0 }! N' V5 N) `
( b& @( v# b, vreturn:' }1 [, A7 |* M W- o
RTS3 |% Z- g' e' A m+ ~
! q% n- U. T5 p
ora_data: ;按键相或数据
; u" U5 ?0 i, i, ^( q .BYTE $08,$04,$02,$01,$80,$40,$20,$10" x- `, H+ u$ @9 b1 _
and_data: ;按键相与数据
% w8 o* `% K5 M4 e3 X2 Q1 T" i .BYTE $F7,$FB,$FD,$FE,$7F,$BF,$DF,$EF( ?% E5 A. V. B- }
c/ P1 {6 J1 X5 p6 Z8 L+ K3 E
" C- D1 w5 Q+ `: B
# K, m7 b0 Q' v+ m4 x* |& h
;FC数据搬移程序 BY FlameCyclone" n# @6 ~* h7 Q. t* F
.ORG $8200# }% L8 N. S6 \
JMP DATA_COPY_PROTECT
1 P, S- A* s% y! u/ m$ S$ g% |/ X8 ^
) P: D# O7 Q$ m) E- M; JADDR_DATA_TO = $40 ;目的地址' H5 s; v' w+ ^2 j0 B' [
ADDR_FROM_START = $42 ;源开始地址2 a- m) n. E# `- v1 `) l o/ h4 c( l+ M
ADDR_FROM_END = $44 ;源结束地址+ k: i1 M+ x( r, ?+ X( B- H
0 |. s3 B6 @$ A: W3 p: EADDR_TO: ;目的地址# l! {0 d A5 E! @. c+ M( J
.BYTE $00,$70
* K5 D( q' L9 rADDR_BEGIN: ;源开始地址3 b$ {- d) q& i9 p9 t$ L, U" F J
.BYTE $00,$836 n2 }; u% d6 ~; a2 f- r7 {6 \
ADDR_END: ;源结束地址
4 r* h- j; a; {6 W: u, {5 m .BYTE $FE,$843 \4 ~* f% Z% C8 h! y+ H
5 y; e/ p, v7 i. L* m& Q& nINT_ADDR = $08 ;中断地址
( F2 T; K2 Q6 c$ eFLAG_OVER = $71FF ;完成标志: Y0 l6 h0 M1 X: o5 H, X5 m
7 H/ j$ I1 d' a" h. f# p; G6 p; T" Z$ c% [7 [
DATA_COPY_PROTECT: ;保护数据8 Q9 s! ^" C# l% O- E
PHP7 H" Q- y/ R9 ^3 X" j8 Y, F$ S2 t! ~8 x7 x
PHA
" Q5 j6 K% f+ |/ f. Q+ i& l TXA' ]" v! _: d/ M9 a* ]! B& {
PHA t6 o; n) X' \
TYA
! ?7 {3 T& z! g5 | PHA/ x0 B: x; N- n* g% U& S- k* S
LDA ADDR_DATA_TO5 B; k$ N9 B5 f; r/ e
PHA
+ q3 s5 h( y t/ a7 d LDA ADDR_DATA_TO+11 J- s* q8 P( [2 ~$ p
PHA' l6 v: |3 O$ C* {( ~- H2 c
LDA ADDR_FROM_START
( b; v9 W* }* U* v+ H6 x4 t PHA) B: s+ c5 e0 e& a$ d& v
LDA ADDR_FROM_START+1
' Z3 A7 g& E5 S; b0 W. r PHA
4 m6 V5 y. v# R5 r) X* q LDA ADDR_FROM_END3 G- g3 e: }0 X' H- P
PHA+ [( B' X/ V. G. m' i
LDA ADDR_FROM_END+1
" c" S/ u; k* s3 s ^ s PHA4 Q# P, q: E; i
1 q V3 q/ q, i0 C( a6 y" X% }
OFF_INT: ;屏蔽中断
( ^9 e* q/ L# S0 n! Z8 q: [ LDA INT_ADDR
- {5 X- e! Q! D* I AND #$7F! Y S0 H6 I9 @2 }4 ?5 j6 a* O
STA $2000 ;屏蔽中断- S7 |3 Z5 m1 m$ E# I4 k4 e. z+ h
6 F. S. E* i5 h2 ]( C
N8 k; B7 s6 }
SET_DATA_ADDR_START: ;设置复制起始地址6 L/ i% y+ F! r( O/ `: v
LDA ADDR_BEGIN, m! z2 y0 o3 m4 v. C9 y
STA ADDR_FROM_START ;设置复制起始地址低位9 i- E5 t2 r+ t( R d( e/ d; l
LDA ADDR_BEGIN+14 _( M/ ~: I: r; {9 ~* A
STA ADDR_FROM_START+1 ;设置复制起始地址高位1 [4 O% |5 J2 v) q9 g
# f3 X- M) g. E- b& [' l4 W* \SET_DATA_ADDR_END: ;设置复制结束地址5 a. d4 b, U5 w1 c. ^9 x, w
LDA ADDR_END
3 Z' O& e {/ U1 F( T* ]& Z STA ADDR_FROM_END ;设置复制结束地址低位, }/ {6 c6 Y1 u$ t
LDA ADDR_END+1- C* Q* y5 P' b# q- P3 b. n
STA ADDR_FROM_END+1 ;设置复制结束地址高位) b3 R: y0 @! N7 k" F, z6 z& }
, D6 [2 m# O- F6 e3 lSET_DATA_COPY_START: ;设置目的起始地址. q K7 F. \$ K9 a3 A
LDA ADDR_TO
' K+ \' ?6 X* ^9 u STA ADDR_DATA_TO ;设置目的起始地址低位
5 E8 ]) f9 I2 c: h N, b8 T2 \ LDA ADDR_TO+1
4 S* m0 D5 E$ Z; Q1 W8 M STA ADDR_DATA_TO+1 ;设置目的起始地址高位& t6 F& E& F+ u) d+ G# ^
: m1 J8 ?! G- V* f" @1 \8 COVER_COPY_CMP: ;复制完成比较
( w1 |. V, Z: P1 q0 K LDA FLAG_OVER
- Q0 s4 \2 r+ V CMP #$FE ;复制完成标志比较
, W5 K1 F" J; _; X BEQ DATA_COPY_EXACT
) g: y. T: |2 b( ]8 C& c# `6 y, X: v q
INI_XY_COUNT: ;计数器初始化% m7 i' F" i! U4 \2 S' J
LDX #$00
! B5 H7 d+ p& }; y+ _, l LDY #$00, l# G: J( {- z7 H5 `1 t
0 N2 v7 g, ~% W r+ sCOPY_OVER_CMP: ;地址比较
: {) N; ~- C) E3 a0 k- V LDA ADDR_FROM_START
& B. A; }3 R# W CMP ADDR_FROM_END
' o8 {: l) z0 o) f BNE COPY_START
' m% M4 A6 j! a# H* O% j. X LDA ADDR_FROM_START+1$ J2 Q5 O' w3 o
CMP ADDR_FROM_END+1. |" @2 Q4 d. K
BEQ COPY_OVER
+ o! X6 d5 C6 s ~7 B, @& J
- u1 a7 Q m7 Y& |COPY_START: ;数据复制开始
8 Z: G w8 k) E/ C- n. v( j LDA (ADDR_FROM_START),Y ;读取源地址
) G' F% ~* z: r9 D STA (ADDR_DATA_TO),Y ;写入目的地址
% j. R7 M4 G- {8 ^! {" h INC ADDR_FROM_START ;源地址低位递增7 N/ t* @% c% [$ L9 O/ E6 [$ K5 g
INC ADDR_DATA_TO ;目的地址低位递增* l' W+ e, }' a$ n1 |/ t( P( ?, J
BNE COPY_JMP0 M; v" m" s4 O; J' x3 e
INC ADDR_FROM_START+1 ;源地址高位递增
1 w3 m/ K+ H9 T1 F: V INC ADDR_DATA_TO+1 ;目的地址高位递增. D- p0 @' o4 A2 g" T
+ d& j6 V7 P2 a7 G$ s* T
COPY_JMP:
+ ^. U5 |$ V- P; K1 @6 z JMP COPY_OVER_CMP
8 w. d1 z5 b9 a. ]$ R4 ]
! z6 x+ C+ \4 v! w1 @, U0 jCOPY_OVER: ;复制完成/ a8 k! ?- K4 g& `, P
LDA #$FE) x4 C- \4 ~% H& {3 W& \
STA FLAG_OVER ;写入完成标志
3 L# I0 u; s6 T8 m% g* uFINAL_BYTE:
+ ]3 I' u0 \3 V, a) i/ L& k LDA (ADDR_FROM_START),Y ;读取最后一个字节
. ^! F+ O( i: k( `6 Q) p STA (ADDR_DATA_TO),Y ;写入最后一个字节
% g* L/ c. @# X, m- D" v! @# s! t" w
; N+ x. v4 l( Q9 dDATA_COPY_EXACT: ;恢复数据
9 _9 Q3 O7 a; ^- G O+ f# J0 V LDA INT_ADDR/ O8 r9 M3 I$ M; ^8 O' W
STA $2000 ;恢复中断
: A7 {* s' M6 H ?0 w* h PLA
# O8 Z9 `6 ]! \5 M% H$ \ STA ADDR_FROM_END+1
' V+ W7 Q0 g& v1 u PLA
9 F# ]6 M+ S4 W: |! U+ V* y. m STA ADDR_FROM_END
% q& h9 \# v% b6 ?/ L PLA7 h1 p3 f$ w2 Z3 g9 I' ~
STA ADDR_FROM_START+1
( n. y3 {; p+ n6 Q2 Z5 Y PLA" W# {5 k3 ] Q" C {, a* O7 v
STA ADDR_FROM_START
/ n4 A0 G/ E4 a3 Z/ _% { PLA
1 q$ B0 o# z0 N STA ADDR_DATA_TO+13 M3 T) d: U+ |/ ?" _
PLA5 W6 K" [' ^3 x1 R0 O
STA ADDR_DATA_TO
6 i8 U4 j/ K. ^ PLA' B( l5 r( T( ?0 j1 P. I
TAY
: D2 s2 n" y% G$ H5 | PLA
# L! f4 a( I7 v5 i# {; E TAX+ _) W% _% i8 P# s, h2 k# A
PLA
: _& M9 S L1 M, O* A2 Y" V PLP
+ o/ g5 F, G, k2 D2 m* A % U7 b8 j- t5 p+ K+ u0 r \* X+ p
& E( I* J; [+ C) I I6 { 7 c- H; ~* c* k! S' E
DATA_COPY_RETURN:
+ b+ @- T# U; S5 [+ ~7 h! v RTS
9 e: l$ B4 d* z7 H ) j' e6 G2 ?( ]
.ORG $C056 ;精灵指令覆盖 d+ x2 p; }3 W( R0 n9 Q
JSR $FFB55 s5 h }/ N {, I
, r3 Y. w O& O% b% q4 Z .ORG $FFB5 ;
: A' V4 c n' y1 G; T PHA
b6 C0 ?& K5 \3 a5 \% C7 j TXA
4 Q- ^" J4 i; ^ R PHA
6 b0 ^$ Z% `1 E1 S TYA2 W ^3 }5 n0 H
PHA7 m% @ A* c% @$ [) I
LDA $71FF ;比较7000-71FE数据是否完成复制
8 w R1 y7 n. S, ?5 i CMP #$FE$ k: G" x& O1 j5 E
BNE ADDR_FFCA
+ w1 r4 T4 v9 ? f. ] PLA+ g9 U% u& h7 @, D. Z/ W
TAY# v) R) t0 B: x D+ z9 H+ {6 C
PLA
6 ]. R# a+ ^, t" y( Y8 }( W TAX3 o0 U% S* R x+ _+ m
PLA
7 ~5 F, ^4 r# [, Q, { JSR $7000 ;跳转到自写程序
' J1 P7 |/ L- ~9 p, Z v RTS9 ~7 c; ~/ Q8 a2 `$ D/ _
ADDR_FFCA:$ Q' N+ L5 H6 e% g
PLA
. z, B: [* n' O, }( X TAY
7 _. X% M0 @8 G8 P w: ?* X PLA
A1 H: s. G$ M3 }2 f8 j+ f TAX
$ c, N# E8 ^1 O- K" l ^* A PLA Q8 ~4 ^! h) V0 g" v; [/ B0 m
RTS0 t8 u$ ?2 C: s; f3 ]: p
" `0 \ P8 q/ W4 ]" k9 w
2 V7 N3 ^9 u+ J4 f7 f: T9 o
' M6 y0 T- C+ N .ORG $C264 ;自定义的MAPPER2切页程序
5 }2 ]0 K' ^, ~6 @: @ PHA
% y. v+ u! b8 x! R/ A TXA) d4 p. M. K( [9 h$ x
PHA+ \3 ~7 V. F. I6 @* [# W
LDA $0066
3 E; A7 z8 r7 t+ M0 w BNE ADDRC280
7 x# h3 I# D! s6 B) f3 ` LDA #$07
) Y% X% _, x% v2 H. b LDX #$03
. L" U, s! c- O4 i* f1 R JSR $CD9B ;自带的切bank方法7 `! ~' F% b6 R; m1 U
PLA8 J" D2 x" E$ I
TAX
( C4 ?. d. l6 U PLA
' A9 G+ Y! s% h) S, Z, }( t5 z JSR $8000
. B) b5 f* t3 P LDA #$06
+ e) z3 e" V6 ~8 O( m LDX #$03+ q. U, v( f L! R4 y
JSR $CD9B ;切回原该切得bank(可以不用)
0 D# J5 w9 _. o8 C! S RTS6 G( K5 g" N, d7 e; C
ADDRC280:( D* b2 t4 U* v9 n
PLA- k8 u; _6 G2 l2 f" W
TAX% j5 P, n& N6 Q6 U. _8 r# {
PLA6 p/ G# X7 f$ H, H3 y
RTS8 X5 E6 j+ C3 O$ e& A
2 w- b9 f3 @5 J% z k
$ h. _0 g, B) s& g# A! h B' p: m;[FC][最终任务PPU][END]
9 O, j( p8 V+ y8 y .ORG $C056 ;跳转到PPU重写程序
* b" L& K9 m& H7 ~ JSR $7000
& d- b- W, ~! t& S* V) w, [7 V. b& |+ `" m5 \5 h% e8 I7 N8 H6 z) c# B
.ORG $CEBF( A" C, l/ a7 j: G% v' j
JSR STAGE_DATA_WRITE ;跳转到关卡数据写入
. J& ?! a1 \1 F 4 Q/ s! V% i% X( ]
.ORG $E460
; ~1 C2 H7 R* ~! {5 p1 f# C; w9 J JSR BULLET_DATA_WRITE ;跳转到副武器数据写入, ]+ s& c F. e. q) R0 a6 Q" U) K
' u: d" ~+ X& ]5 X. m
.ORG $71F0
. |" Z5 ]3 G2 C9 s* YSTAGE_DATA_WRITE:+ F. f, d- E* G! \( s$ {' ] O$ M- d
LDA $6010
+ G. ~7 L! T" ]* ~- B STA $1E ;关卡写入+ }( o" R; ?# E! H8 \
LDA #$00
& W- @4 ^8 z, P5 j) y- S RTS
1 x. L, v" U1 B" b0 K* C7 r .ORG $71C00 W2 |$ ]1 ]1 r2 r2 r' B) u
BULLET_DATA_WRITE: ;副武器数据写入$ b7 U0 j# d! N% D; G2 \) j& \
CPX #$0E
1 |1 g* I' y" B BCS P2_BUL0 B9 Q; f7 R, Q+ `; h, r1 K/ o
P1_BUL:
{& E# t. ^0 T8 F% M1 i LDA $60046 w' p. y) J/ [
JSR $D7D0 ;P1副武器数据写入5 y" o: ^8 {1 k: H# G( f( A
RTS
" M1 H2 j# C% N; D7 KP2_BUL:' a' q+ G$ q m" ]& m& x. B
LDA $6005
( D4 n* q) e8 f JSR $D7D0 ;P2副武器数据写入/ h$ C5 t, S7 P; s/ O& o) U
RTS
5 [: O- e! U: H; @& u# c( c! M/ l% H
. Q v2 S! G6 j* }" Q" A1 c- P3 [
.ORG $7000- F; K* r6 h# \7 b
4 P+ ^9 K4 g4 e6 |
STY $4014 ;补上覆盖的精灵写入指令
* l2 N$ D) {9 K8 W% t PHA
) f1 Z* y n1 ^ TXA
$ R( ?/ E6 t# w( A PHA/ c& o3 ?% H. K, c$ \
TYA8 y/ U/ `- t6 \; t: K r
PHA
9 j/ c/ J' k+ z# \- I, c LDA $0C1 h: E9 G5 U# c9 j+ Z5 y
CMP #$01 ;比较是否为标题画面
6 ?! _. }2 Z, T: r BEQ PPU_STAGE8 h7 B! a$ V$ x9 m, E" m- o
PLA
" \" D$ H e" j' t1 E- w2 N TAY
6 `; V: D( Z5 l- t4 i; [ PLA
* `+ U$ K% ^# W1 B7 |; ?2 \ TAX! c8 h) p: W' }* {3 \' y
PLA) P J- ]& ~6 Y1 {
RTS
- [) W* k5 M" k1 R. ?PPU_STAGE: ;STAGE显示程序
- b2 R% n( G, e0 L8 f' p; S LDA PPU_ADDR_DATA+ b2 Z k; {: d/ v$ N' A# d
STA $2006
9 H) B# \& ?1 w* A' P9 N1 m) I: | LDA PPU_ADDR_DATA+1
8 _) [$ N8 M4 ]7 C1 e c STA $2006 ;坐标设置
% v, H- k% {3 F! u6 _* r LDX #$00/ E1 l% U( X k1 H% Q
PPU_STAGE_WROTE: ;写入STAGE字模# Z* A- E3 k; i, ~4 j
LDA STAGE_DATA,X
( W _' T6 K/ o" X STA $20074 I0 H1 |$ @( G, a5 j- ?* t$ d x
INX
9 {) w# z' ~. e |! _ CPX #$06( H& _" g* G/ @ q5 W& t
BCC PPU_STAGE_WROTE$ r- x$ R% s8 q, C/ j. q
LDA $60107 }% ]& k( I: p! {* `0 J. l
CMP #$FF ;关卡数据初始化条件判断& b) [$ C+ b+ v. n& @, \' y1 r$ d
BNE KEY_B
5 b5 C1 y3 C) n2 _5 E' x+ `; ~ LDA #$00$ k7 B ?+ F( f4 ]
STA $6010 ;关卡数据初始化6 \9 t* u. s- U$ |
KEY_B: ;关卡减少( j. O$ G1 X. J2 j( r
LDA $04
: j; F& B# l# m. M& V J/ [ AND #$42 ;按键B或左减关& }; a# M# ]0 l$ j/ C
BEQ KEY_A6 {: b+ r/ @+ }
LDA $6010# T! z5 e! x- h
CMP #$00 ;关卡比较4 t9 r$ S/ p! X3 d1 `3 Y
BEQ KEY_A
1 P$ G* B$ ?. n7 @5 c$ O7 S% h* K0 }, f DEC $6010 ;减关
& V; o3 @% f s* f# x9 u" ?8 eKEY_A: ;关卡增加
/ y T+ C# Y( V5 K2 E. C7 } LDA $04
( b' X$ w# K0 _ AND #$81 ;按键A或右加关
- U# G0 g0 n/ s* K2 D BEQ PPU_NUM_WRITE( _$ o2 k; t7 q$ ~, X
LDA $6010
# D/ G0 S' p$ f/ E9 f CMP #$04 ;关卡比较
" f. |% c% r6 P3 Z7 Y8 m! {" s BEQ PPU_NUM_WRITE
1 ^; u7 d' H( b INC $6010 ;加关# i& V4 ^. L7 B3 O. z! v
PPU_NUM_WRITE:
~; Y, Y- @6 w" A; J1 C LDA $6010
5 _) j: N, B/ v8 a TAX
$ s( a( J$ k( j& G6 f0 |; W LDA STAGE_NUM,X ;写入数字
# q* U- N5 Y% j! l, f1 w STA $2007
W$ `+ [) ]6 i& e0 lPPU_RTS:
9 Q2 d# O5 p3 f5 f PLA
) b, T% W" i s- L TAY/ t3 [, J5 j _
PLA
5 ^7 N" |6 A( @5 o$ L/ S TAX& |) }4 U& s5 i6 B) o
PLA
* h8 X. R( l: v) d/ Z6 H) U$ F RTS% f9 i4 K, N1 ^! Y% U
2 U) x# S! H( v5 h8 M
. p3 i" m8 o2 z/ @0 w5 n# gSTAGE_DATA: ;关卡文字S,T,A,G,E,字模数据
! ~' Z1 b0 ]- S9 u5 v# q& f6 G* K .BYTE $EC,$ED,$DA,$E0,$DE,00
, E% A$ z, |. ESTAGE_NUM: ;关卡数字1,2,3,4,5字模数据
3 Q3 ]$ Z6 B- @% O/ s3 ] .BYTE $D1,$D2,$D3,$D4,$D57 P- a- ]0 D) T% [8 \2 o
/ a3 L5 s$ P# r$ |. ?( m+ \2 q
PPU_ADDR_DATA:" a7 A: k# [/ _$ o, F& |; b
.BYTE $23,$0C
1 X$ V- @: Q& |; z
# U& g k8 G4 ~6 ^: N4 } |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|