[FC][忍者神龟格斗][最佳可视化][Final]
时间:2023.12.22
作者:FlameCyclone
内容:
1.可视化功能菜单 ??
? ? (1)菜单按键操作
? ? ? ? 1.上下键: 移动选项
? ? ? ? 2.左右键: 翻页
? ? ? ? 3.选择键: 翻转功能开关
? ? ? ? 4.开始键: 退出菜单
? ? ? ? 5.B键: 启用功能
? ? ? ? 6.A键: 禁用功能
? ??
? ? (2)功能列表
? ? ? ? ?1.时间锁定: 剩余时间不减
? ? ? ? ?2.击杀玩家1: 玩家1被击败
? ? ? ? ?3.击杀玩家2: 玩家2被击败
? ? ? ? ?4.血量锁定: 剩余血量不减
? ? ? ? ?5.快捷技能: B/A + 选择键释放技能
? ? ? ? ?6.拥有能量球: 保持拥有能量球状态, 选择键发射
2.其他
? ? (1)进入可视化菜单后背景音乐将会继续播放
? ? (2)翻页, 移动光标, 启用禁用功能, 翻转功能时均有音效
? ? (3)进入可视化菜单时光标将保持上次退出时的位置
? ? (4)故事模式下可选所有角色
工程总览:
编译环境(Visual Code):
运行效果:
程序主要逻辑(6502汇编)
[FC][BestVisible][Main].asm
;[FC][BestVisible]
;FlameCyclone
;20231207
.INCLUDE "[FC][BestVisible][Config].asm"
.INCLUDE "[FC][BestVisible][Data].asm"
.ORG $0000
.BASE $00
.HEX 4E 45 53 1A
.DB NES_16KB_PRG_SIZE, NES_8KB_CHR_SIZE
.DB ((Mapper & $F) << 4) | Trainer | FourScreen | Battery_backed | Mirroring
.DB (Mapper & $F)
;==================================================
;程序开始地址
BANK_ORG PROGRAM_BANK, PROGRAM_ADDR
;==================================================
;程序入口
VisibleProcess
;非暂停状态直接结束
LDA Rom_Pause_Addr
AND #Rom_Pause_Val
BEQ .VisibleProcess_End
;未按下选择键直接结束
LDA Rom_Gamepad_Once
CMP #GAMEPAD_SELECT
BNE .VisibleProcess_End
PHA
TXA
PHA
TYA
PHA
MACRO_PRG_RAM_ENABLE;启用 PRG RAM
LDA #$80
STA PPU_CTRL;仅启用NMI中断
LDA #$00
STA PPU_MASK;关闭显示
JSR Init_Menu_Memory;菜单内存初始化
;备份栈, 防止栈深度过大导致异常
TSX
STX FC_Stack_Last
.Back_Stack
LDA $0100,X
STA Stack_Bak_Addr,X
INX
BNE .Back_Stack
LDX #$FF
TXS
;备份占用的几个地址
LDA FC_PPU_Status
PHA
LDA Rom_Ppu_Mask
PHA
;设置菜单标记
LDA #MENU_MODE_FLAG
STA Rom_Ppu_Mask
JSR Backup_Data;备份数据
;载入上次的页起始索引与功能选项索引
LDA FC_Page_Index_Last
STA FC_Page_Cur
LDA FC_Item_Index_Last
STA FC_Select_Index
JSR Program_Begin;可视化菜单开始
;记录本次的页起始索引与功能选项索引
LDA FC_Select_Index
STA FC_Item_Index_Last
LDA FC_Page_Cur
STA FC_Page_Index_Last
JSR Recovery_Data;恢复数据
;恢复占用的几个地址
PLA
STA Rom_Ppu_Mask
PLA
STA FC_PPU_Status
;恢复栈
LDX FC_Stack_Last
.Recovery_Stack
LDA Stack_Bak_Addr,X
STA $0100,X
INX
BNE .Recovery_Stack
LDX FC_Stack_Last
TXS
;防止触发开始键
LDA #GAMEPAD_START
STA Rom_Gamepad_Keep
LDA #$00
STA Rom_Gamepad_Once
;恢复屏幕显示控制
LDA Rom_Ppu_Ctrl
STA PPU_CTRL
PLA
TAY
PLA
TAX
PLA
.VisibleProcess_End
RTS
;==================================================
;菜单内存初始化
Init_Menu_Memory
LDA FC_Menu_Init_Flag
CMP #MENU_INIT_FLAG
BEQ Init_Menu_Memory.End
LDX #$00
TXA
Init_Menu_Memory.Write
STA FC_Menu_Used_Addr,X
INX
BNE Init_Menu_Memory.Write
LDA #MENU_INIT_FLAG
STA FC_Menu_Init_Flag
Init_Menu_Memory.End
RTS
;==================================================
;备份数据
Backup_Data
JSR Backup_Zero_Page_RAM;备份零页内存(3597周期)
JSR Backup_PPU_Buf_Used;备份PPU缓冲占用内存(3597周期)
JSR Clear_PPU_Palette;调色板清理(399周期)
JSR VBlank_Palette_Enable;启用调色板(20周期)
JSR Wait_For_VBlank_Finished;等待VBlank处理完毕
JSR Init_Zero_Page_RAM;初始化零页占用内存(289周期)
JSR Backup_PPU_2000_23FF;备份命名表(15461周期)
JSR Wait_For_VBlank_Finished;等待VBlank处理完毕
JSR Init_OAM_RAM;初始化精灵内存(2323周期)
JSR Clear_PPU_2000_23FF;清空命名表(9273周期)
RTS
;==================================================
;恢复数据
Recovery_Data
LDA #$00
STA FC_PPU_Status;关闭显示
STA FC_NMI_Proc_Flag;不处理任何任务
JSR Recovery_PPU_Palette;恢复调色板(525周期)
JSR VBlank_Palette_Enable;启用调色板
JSR Wait_For_VBlank_Finished;等待VBlank处理完毕
JSR Recovery_PPU_2000_23FF;恢复命名表(14565周期)
JSR Recovery_PPU_Buf_Used;恢复PPU缓冲占用内存(3633周期)
JSR Recovery_Zero_Page_RAM;恢复零页备份(3632周期)
RTS
;==================================================
;清空命名表
Clear_PPU_2000_23FF
JSR Set_PPU_Name_Table_Addr
LDX #$00
LDY #$04
TXA
Clear_PPU_2000_23FF.Write
STA PPU_DATA
DEX
BNE Clear_PPU_2000_23FF.Write
DEY
BNE Clear_PPU_2000_23FF.Write
RTS
;==================================================
;设置PPU命名表地址
Set_PPU_Name_Table_Addr
;LDA PPU_STATUS
LDA #$20
STA PPU_ADDRESS
LDA #$00
STA PPU_ADDRESS
RTS
;==================================================
;设置PPU调色板地址
Set_PPU_Palette_Addr
;LDA PPU_STATUS
LDA #$3F
STA PPU_ADDRESS
LDA #$00
STA PPU_ADDRESS
RTS
;==================================================
Get_Name_Table_Bak_Addr_And_Size
LDA #<PPU_Name_Table_Bak_Addr
STA FC_Data_L
LDA #>PPU_Name_Table_Bak_Addr
STA FC_Data_H
LDY #$00
LDX #$04
RTS
;==================================================
;备份PPU命名表
Backup_PPU_2000_23FF
JSR Set_PPU_Name_Table_Addr
JSR Get_Name_Table_Bak_Addr_And_Size
LDA PPU_DATA
Backup_PPU_2000_23FF.Write
LDA PPU_DATA
STA (FC_Data_L),Y
INY
BNE Backup_PPU_2000_23FF.Write
INC FC_Data_H
DEX
BNE Backup_PPU_2000_23FF.Write
RTS
;==================================================
;恢复PPU命名表
Recovery_PPU_2000_23FF
JSR Set_PPU_Name_Table_Addr
JSR Get_Name_Table_Bak_Addr_And_Size
Recovery_PPU_2000_23FF.Write
LDA (FC_Data_L),Y
STA PPU_DATA
INY
BNE Recovery_PPU_2000_23FF.Write
INC FC_Data_H
DEX
BNE Recovery_PPU_2000_23FF.Write
RTS
;==================================================
;备份零页占用RAM
Backup_Zero_Page_RAM
LDX #$00
Backup_Zero_Page_RAM.Write
LDA $00,X
STA Zero_Page_Bak_Addr,X
INX
BNE Backup_Zero_Page_RAM.Write
RTS
;==================================================
;恢复零页占用RAM
Recovery_Zero_Page_RAM
LDX #$00
Recovery_Zero_Page_RAM.Write
LDA Zero_Page_Bak_Addr,X
STA $00,X
INX
BNE Recovery_Zero_Page_RAM.Write
RTS
;==================================================
;初始化零页占用RAM
Init_Zero_Page_RAM
LDX #USE_RAM_SIZE - 1
LDA #$00
Init_Zero_Page_RAM.Write
STA Use_Ram_Begin,X
DEX
BNE Init_Zero_Page_RAM.Write
STA Use_Ram_Begin,X
RTS
;==================================================
;备份PPU缓冲占用
Backup_PPU_Buf_Used
LDX #$00
Backup_PPU_Buf_Used.Write
LDA FC_PPU_Buffer,X
STA PPU_Used_Bak_Addr,X
INX
BNE Backup_PPU_Buf_Used.Write
RTS
;==================================================
;恢复PPU缓冲占用
Recovery_PPU_Buf_Used
LDX #$00
Recovery_PPU_Buf_Used.Write
LDA PPU_Used_Bak_Addr,X
STA FC_PPU_Buffer,X
INX
BNE Recovery_PPU_Buf_Used.Write
RTS
;==================================================
;初始化精灵内存
Init_OAM_RAM
LDX #$00
STX PPU_OAM_ADDR
LDA #$F8
Init_OAM_RAM.Write
STA PPU_OAM_DATA
INX
BNE Init_OAM_RAM.Write
RTS
;==================================================
;恢复调色板
Recovery_PPU_Palette
LDX #$00
Recovery_PPU_Palette.Write
LDA Rom_Pal_Addr,X
STA FC_PPU_Palette,X
INX
CPX #$20
BCC Recovery_PPU_Palette.Write
RTS
;==================================================
;初始化调色板
Init_PPU_Palette
LDX #$00
Init_PPU_Palette.Write
LDA Palette_Data,X
STA FC_PPU_Palette,X
INX
CPX #$20
BCC Init_PPU_Palette.Write
RTS
;==================================================
;清空调色板
Clear_PPU_Palette
LDX #$00
LDA #$0F
Clear_PPU_Palette.Write
STA FC_PPU_Palette,X
INX
CPX #$20
BCC Clear_PPU_Palette.Write
RTS
;==================================================
;设置CHR图形
Init_CHR_Bank
LDX #$05
Init_CHR_Bank.Write
STX $8000
LDA CHR_Data,x
STA $8001
DEX
BPL Init_CHR_Bank.Write
RTS
.INCLUDE "[FC][BestVisible][Cursor].asm"
.INCLUDE "[FC][BestVisible][Function].asm"
.INCLUDE "[FC][BestVisible][PPU].asm"
.INCLUDE "[FC][BestVisible][Gamepad].asm"
.INCLUDE "[FC][BestVisible][Page].asm"
.INCLUDE "[FC][BestVisible][Text].asm"
;==================================================
;程序开始
Program_Begin
JSR Init_CHR_Bank;初始化图形Bank
JSR Init_PPU_Palette;设置调色板
JSR VBlank_Palette_Enable
JSR Wait_For_VBlank_Finished
;设置页选项缓冲数量
LDA #FC_PAGE_INIT_BUF_SIZE
STA FC_Page_Update_Max
JSR VBlank_Text_Enable
;开启显示
LDA #$0E
STA FC_PPU_Status
JSR Page_Text_Update;更新页选项内容
;禁用触发选择键与开始键
LDA #GAMEPAD_SELECT | GAMEPAD_START
STA FC_Gamepad_Buf
JSR VBlank_Gamepad_Enable;启用输入
;==================================================
;循环等待(直到按下开始键)
Main_Loop
LDA FC_NMI_Proc_Flag
AND #FC_NMI_PROC_TYPE_EXIT
BEQ Main_Loop
RTS
;==================================================
;NMI中断处理
NMI_Process
LDA #$00
STA PPU_MASK
PPU_Text_Process_With_Flag;PPU文本处理检查
LDA FC_NMI_Proc_Flag
AND #FC_NMI_PROC_TYPE_TEXT
BEQ .PPU_Text_Process_With_Flag_End
JSR FC_PPU_Text_Process;PPU文本处理
.PPU_Text_Process_With_Flag_End
PPU_Palette_Process_With_Flag;PPU调色板处理检查
LDA FC_NMI_Proc_Flag
AND #FC_NMI_PROC_TYPE_PALETTE
BEQ .PPU_Palette_Process_With_Flag_End
JSR FC_PPU_Palette_Process;PPU文本处理
.PPU_Palette_Process_With_Flag_End
JSR Show_Select_Cursor;光标显示
LDA #$00
STA FC_PPU_Buffer
STA PPU_ADDRESS
STA PPU_ADDRESS
STA PPU_SCROLL
STA PPU_SCROLL
LDA FC_PPU_Status
STA PPU_MASK
MACRO_ROM_SOUND_CHECK;取消音乐暂停
;==================================================
;输入处理检查
Gamepad_Process_With_Flag
LDA FC_NMI_Proc_Flag
AND #FC_NMI_PROC_TYPE_GAMEPAD
BEQ .Gamepad_Process_With_Flag_End
JSR Gamepad_Process;按键处理
.IF FC_GAMEPAD_BURSTS
JSR Gamepad_Bursts;按键超时连发处理
.ENDIF
LDA FC_Gamepad_Once
.IF 0 == FC_DOUBLE_PLAYERS
ORA FC_Gamepad_Once + 1
.ENDIF
STA FC_Gamepad_Merge
.Gamepad_Process_With_Flag_End
;==================================================
;功能处理检查
.Function_Process_With_Flag
LDA FC_NMI_Proc_Flag
AND #FC_NMI_PROC_TYPE_GAMEPAD
BEQ .Function_Process_With_Flag_End
JSR Check_For_Exit;退出检查
JSR Select_Item_Proc;选择选项处理
JSR Function_State_Proc;功能状态处理
.Function_Process_With_Flag_End
JSR Music_Play;音乐播放
;清除VBlank标记
LDA FC_NMI_Proc_Flag
AND #FC_NMI_PROC_TYPE_VBLANK ^ $FF
STA FC_NMI_Proc_Flag
JMP Rom_Nmi_Proc_End
;==================================================
;播放选项变化音乐
Play_Music_For_Item_Change
LDA #FC_ITEM_CHANGE_SOUND
JSR Music_Select
RTS
;==================================================
;播放翻页变化音乐
Play_Music_For_Page_Change
LDA #FC_PAGE_CHANGE_SOUND
JSR Music_Select
RTS
;==================================================
;播放功能翻转音乐
Play_Music_For_Function_Flip
LDA #FC_FUNCTION_FLIP_SOUND
JSR Music_Select
RTS
;==================================================
;播放功能启用音乐
Play_Music_For_Function_Enable
LDA #FC_FUNCTION_ON_SOUND
JSR Music_Select
RTS
;==================================================
;播放功能禁用音乐
Play_Music_For_Function_Disable
LDA #FC_FUNCTION_OFF_SOUND
JSR Music_Select
RTS
;==================================================
;退出检查
Check_For_Exit
LDA FC_Gamepad_Keep
CMP FC_Gamepad_Once
BNE .End
LDA FC_Gamepad_Keep + 1
CMP FC_Gamepad_Once + 1
BNE .End
LDA FC_Gamepad_Once
ORA FC_Gamepad_Once + 1
CMP #GAMEPAD_START
BNE .End
LDA FC_NMI_Proc_Flag
ORA #FC_NMI_PROC_TYPE_EXIT
STA FC_NMI_Proc_Flag
.End
RTS
;==================================================
;等待VBlank处理完毕
Wait_For_VBlank_Finished
LDA FC_NMI_Proc_Flag
ORA #FC_NMI_PROC_TYPE_VBLANK
STA FC_NMI_Proc_Flag
.Wait
LDA FC_NMI_Proc_Flag
AND #FC_NMI_PROC_TYPE_VBLANK
BNE .Wait
RTS
;==================================================
;启用文本处理
VBlank_Text_Enable
LDA FC_NMI_Proc_Flag
ORA #FC_NMI_PROC_TYPE_TEXT
STA FC_NMI_Proc_Flag
RTS
;==================================================
;禁用文本处理
VBlank_Text_Disable
LDA FC_NMI_Proc_Flag
AND #FC_NMI_PROC_TYPE_TEXT ^ $FF
STA FC_NMI_Proc_Flag
RTS
;==================================================
;启用调色板处理
VBlank_Palette_Enable
LDA FC_NMI_Proc_Flag
ORA #FC_NMI_PROC_TYPE_PALETTE
STA FC_NMI_Proc_Flag
RTS
;==================================================
;禁用调色板处理
VBlank_Palette_Disable
LDA FC_NMI_Proc_Flag
AND #FC_NMI_PROC_TYPE_PALETTE ^ $FF
STA FC_NMI_Proc_Flag
RTS
;==================================================
;启用输入处理
VBlank_Gamepad_Enable
LDA FC_NMI_Proc_Flag
ORA #FC_NMI_PROC_TYPE_GAMEPAD
STA FC_NMI_Proc_Flag
RTS
;==================================================
;禁用输入处理
VBlank_Gamepad_Disable
LDA FC_NMI_Proc_Flag
AND #FC_NMI_PROC_TYPE_GAMEPAD ^ $FF
STA FC_NMI_Proc_Flag
RTS
;==================================================
;选择选项处理
Select_Item_Proc
.Pre_Page;上一页
LDA FC_Gamepad_Merge
AND #GAMEPAD_LEFT
BEQ .Next_Page
JSR Play_Music_For_Page_Change
JSR Switch_To_Pre_Page
.Next_Page;下一页
LDA FC_Gamepad_Merge
AND #GAMEPAD_RIGHT
BEQ .Pre_Item
JSR Play_Music_For_Page_Change
JSR Switch_To_Next_Page
.Pre_Item;前一项
LDA FC_Gamepad_Merge
AND #GAMEPAD_UP
BEQ .Next_Item
JSR Play_Music_For_Item_Change
JSR Switch_To_Pre_Item
.Next_Item;后一项
LDA FC_Gamepad_Merge
.IF FC_DOUBLE_PLAYERS
AND #GAMEPAD_DOWN
.ELSE
AND #GAMEPAD_SELECT | GAMEPAD_DOWN
.ENDIF
BEQ Select_Item_Proc.End
JSR Play_Music_For_Item_Change
JSR Switch_To_Next_Item
Select_Item_Proc.End
RTS
;==================================================
;功能状态处理
Function_State_Proc
LDX #$01
.Start
.Enable;启用功能
.IF FC_DOUBLE_PLAYERS
LDA FC_Gamepad_Once,X
.ELSE
LDA FC_Gamepad_Merge
.ENDIF
CMP #GAMEPAD_B
BNE .Disable
JSR Play_Music_For_Function_Enable
JSR Function_State_Enable
JSR Function_State_Show
JSR VBlank_Text_Enable
.Disable;禁用功能
.IF FC_DOUBLE_PLAYERS
LDA FC_Gamepad_Once,X
.ELSE
LDA FC_Gamepad_Merge
.ENDIF
CMP #GAMEPAD_A
BNE .Flip
JSR Play_Music_For_Function_Disable
JSR Function_State_Disable
JSR Function_State_Show
JSR VBlank_Text_Enable
.Flip;翻转功能状态
.IF FC_DOUBLE_PLAYERS
LDA FC_Gamepad_Once,X
CMP #GAMEPAD_SELECT
BNE .Next
JSR Play_Music_For_Function_Flip
JSR Function_State_Flip
JSR Function_State_Show
JSR VBlank_Text_Enable
.ENDIF
.Next
DEX
BPL .Start
Function_State_Proc.End
RTS
;==============================
;可视化功能初始化
Visible_Init
LDA #$00
STA PPU_CTRL
;清空栈数据
TSX
LDA #$00
.Init_Stack;初始化栈
STA $0100,X
DEX
BNE .Init_Stack
STA $0100,X
MACRO_PRG_RAM_ENABLE;启用 PRG RAM
.Init_PRG_RAM;初始化PRG RAM
LDA #$60
STA $01
LDA #$00
STA $00
TAY
LDX #$20
.Write_Data;写入数据
STA ($00),Y
INY
BNE .Write_Data
INC $01
DEX
BNE .Write_Data
LDX #$02
.Wait_For_VBlank;等待VBlank
LDA PPU_STATUS
BPL .Wait_For_VBlank
DEX
BNE .Wait_For_VBlank
LDA Rom_Ppu_Ctrl
STA PPU_CTRL
RTS
.INCLUDE "[FC][BestVisible][Static].asm"
.INCLUDE "[FC][BestVisible][Game].asm"
[FC][BestVisible][Game].asm
;==================================================
INIT_VISIBLE_MEM = 1;启用初始化程序
INSTRUCTION_OPTIMIZATION = 1;指令优化
;==================================================
;暂停时按开始键中转
BANK_ORG PRG_BANK_C000, $D30C
JSR VisibleMenu
NOP
;==================================================
;重启时初始化内存
BANK_ORG PRG_BANK_E000, $F1FA
.IF INIT_VISIBLE_MEM
JSR Init_Function_Mem
.ENDIF
;==================================================
;NMI中断中转
BANK_ORG PRG_BANK_E000, Rom_Nmi_Addr
JMP NmiProgram
;==================================================
;时间不减
BANK_ORG PRG_BANK_E000, $EABF
JSR Function_Lock_Time
;==================================================
;血量不减
BANK_ORG $02, $803E
JSR Function_Lock_Blood
;==================================================
;功能实现跳转
BANK_ORG $02, $9D1F
JSR Function_Implement
;==================================================
;故事模式可选全角色
Story_Mode_Select_All_Role
BANK_ORG $06, $8112
.DB $F0, $07
BANK_ORG $06, $81E7
LDY #$01
NOP
;==================================================
;全角色最终boss处理
BANK_ORG PRG_BANK_E000, $E24A
JMP All_Role_Final_Boss_Process
;==================================================
;可视化处理入口
BANK_ORG PRG_BANK_E000, $EF61
VisibleMenu
LDA Rom_Pause_Addr
BEQ VisibleMenu.End
PHP
SEI
JSR Switch_Main_Bank ;切换到可视化程序 bank
JSR VisibleProcess ;可视化处理
JSR $F65F
PLP
VisibleMenu.End
MACRO_ROM_VISIBLE_RETURN
RTS
;--------------------------------------------------
;初始化 可视化 所需内存
Init_Function_Mem
.IF INIT_VISIBLE_MEM
JSR Switch_Main_Bank ;切换到可视化程序 bank
JSR Visible_Init ;可视化初始化
.IF INSTRUCTION_OPTIMIZATION
JMP $F2C6
.ELSE
JSR $F2C6
RTS
.ENDIF
.ENDIF
;--------------------------------------------------
;选择音乐
Music_Select
JSR $F690
JMP Switch_Main_Bank
;--------------------------------------------------
;播放音乐
Music_Play
JSR $F659 ;切换音乐Bank
;--------------------------------------------------
;切换到主程序
Switch_Main_Bank
LDA #$06
STA $8000
LDA #PROGRAM_BANK | $30
STA $8001
RTS
;==================================================
;NMI中断处理
NmiProgram
;读取清除Vblank标志, 防止重复进入
LDA PPU_STATUS
;检查是否为菜单NMI
LDA Rom_Ppu_Mask
CMP #MENU_MODE_FLAG
BEQ .Visible_NMI
;宿主 ROM NMI处理
JMP Rom_Nmi_Proc_Beg
;菜单NMI处理
.Visible_NMI
JMP NMI_Process
;全角色最终boss处理
All_Role_Final_Boss_Process
LDA <$A3
CMP #$07
BCC All_Role_Final_Boss_Process.End
LDA #$06
STA <$A3
STA <$9E
All_Role_Final_Boss_Process.End
JMP $DC25
;--------------------------------------------------
;时间不减
Function_Lock_Time
LDA $6012
AND #$01
BNE Function_Lock_Time.End
DEC $0674
Function_Lock_Time.End
RTS
;--------------------------------------------------
;血量不减
Function_Lock_Blood
LDA $6010,X
AND #$01
BNE Function_Lock_Blood.End
DEC $0590,X
Function_Lock_Blood.End
RTS
;==================================================
BANK_ORG PRG_BANK_E000, $FF00
;功能实现
Function_Implement
;杀死玩家
Function_Kill_Player
;奖励关卡检测
LDA $95
CMP #$19
BNE Function_Kill_Player_1
LDA $6012
AND #$06 ^ $FF
STA $6012
Function_Kill_Player_1
LDA $6012
AND #$02
BEQ Function_Kill_Player_2
LDA $6012
AND #$02 ^ $FF
STA $6012
LDA #$00
STA $0520
STA $0521
LDA #$04
STA $0530
Function_Kill_Player_2
LDA $6012
AND #$04
BEQ Function_Kill_Player.End
LDA $6012
AND #$04 ^ $FF
STA $6012
LDA #$00
STA $0520
STA $0521
LDA #$04
STA $0531
Function_Kill_Player.End
;--------------------------------------------------
;快捷技能
Function_Skill_Fast
LDA $6010,X
AND #$02
BEQ Function_Skill_Fast.End
LDA $0520,X
BNE Function_Skill_Fast.End
LDA <$FA,X
CMP #$60
BNE Label_0
LDA #$08
STA $0520,X
LDA #$00
STA $04A0,X
Label_0
LDA <$FA,X
CMP #$A0
BNE Label_1
LDA #$08
STA $0520,X
LDA #$01
STA $04A0,X
Label_1
LDA <$FA,X
CMP #$20
BNE Function_Skill_Fast.End
LDA $0536
CMP #$04
BEQ Function_Skill_Fast.End
LDA $0600,X
BEQ Function_Skill_Fast.End
LDA #$05
STA $0520,X
Function_Skill_Fast.End
;--------------------------------------------------
;拥有能量球
Power_Ball
LDA $6010,X
AND #$04
BEQ Power_Ball.End
LDA #$80
STA $0600,X
Power_Ball.End
LDA $0600,X
RTS
源码资源(使用VS code安装 ZG Assembler 插件编译)