This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

use mapper 52 make multicart

use mapper 52 make multicart
by on (#197198)
This is my multicart make 6502 asm
Code:
;[FC忍龙3合1汉化版][合卡菜单][忍龙2音乐][mapper52]
 ;FlameCyclone 2017.6.2

SEL_NUM = $40    ;节目序号
MUSIC_PAGE = $41    ;菜单页开关
PRG_TMP = $42    ;PRG起始位置
CHR_TMP = $43    ;CHR起始位置
PRG_BLK = $44    ;PRG块大小
CHR_BLK = $45    ;CHR块大小
CHR_SIZE_TEM =$46    ;CHR容量大小
ROM_LOCK = $47    ;合卡锁定

 .ORG $C000
MENU:
 SEI
 CLD
 LDA #$00
 STA $2000
 LDX #$FF
 TXS

 LDA #$80
 STA $A001
 
 
SET_BANK:    ;初始化处理
;********************************************************
RAM_CLEARN:    ;内存清除
 LDX #$00
 LDA #$00
RAM_CLEARN_S:
 STA $0000,X
 STA $0100,X
 STA $0200,X
 STA $0300,X
 STA $0400,X
 STA $0500,X
 STA $0600,X
 STA $0700,X
 INX
 BNE RAM_CLEARN_S
 
;********************************************************
CHR_SWITCH:
 LDA #$00    ;初始化水平镜像
 STA $A000
 LDA #$00    ;初始图形库0000-07FF
 STA $8000
 LDA #$00
 STA $8001
 LDA #$01    ;初始图形库0800-0FFF
 STA $8000
 LDA #$02
 STA $8001
MUXIC_BANK_SWITCH:
 LDA #$06
 STA $8000
 LDA #$00
 STA $8001
 LDA #$07
 STA $8000
 LDA #$01
 STA $8001

;********************************************************
 LDX #$00
COPY_SELECT:    ;复制切换节目程序到RAM
 LDA $D000,X
 STA $0400,X
 INX
 CPX #$FF
 BCC COPY_SELECT
 
TIME_DELAY:    ;延时
 JSR TIMEDELAY
 STA $2001
 JSR SPARITE_CLEARN
 JSR SCROLL_SET
 JSR PPU_DATA_CLEARN
 JSR PPU_PL_CLEARN
 JSR PPU_LAYOUT
 JSR PPU2_LAYOUT
 JSR TIMEDELAY

;********************************************************
SCREEN:    ;标题绘制
 JSR SPARITE_LAYOUT
 JSR PPU_GAME_TITLE
 JSR PPU_GAME_TITLE2
 
GAME_NAME:    ;画面节目绘制
 JSR PPU_GAME_G01
 JSR PPU_GAME_G02
 JSR PPU_GAME_G03
GAME_NAME_END:
 JSR PPU_GAME_MADE
 JSR PPU_GAME_MADE2
 JSR PPU_GAME_SOUND
 JSR TIMEDELAY
 JSR PPU_PL_CLEARN
 JSR SOUND_CLEARN
 LDA #$01
 STA $0700
 JSR SOUND
 LDA #$06
 STA $0300
 JSR MUSIC_PLAY
 JSR PPU_GAME_SOUND
 JSR SCROLL_SET
 LDA #$09
 STA $0700
 JSR TIMEDELAY
 
 JSR BPALETTES3
 JSR SCROLL_SET
 
 LDA #$01
 JSR SECONDDELAY
 
 LDA #$1E
 STA $2001
 
 LDA #$02
 JSR SECONDDELAY
 
 JSR BPALETTES2
 JSR SCROLL_SET
 
 LDA #$02
 JSR SECONDDELAY
 
 JSR BPALETTES
 JSR SCROLL_SET
 
 JSR SPARITE_WRITE
 JSR SPARITE_SET
 JSR SPARITE_LAYOUT
 JSR SCROLL_SET
 JSR SOUND

;********************************************************
 
MENU_START:    ;循环部分开始
 LDA $E5
 CMP #$20
 BNE RESTART
 LDA $0303
 BNE OPENSOUND
OFFSOUND:
 JSR SOUND_OFF
 JMP RESTART
OPENSOUND:
 JSR SOUND_ON
RESTART:
 JSR PAGE_SWITCH
 JSR PRO_GAME_NUMBER
 JSR BUTTON
 JSR MUSIC_CHANGE
 JSR SPARITE_MOVE
 JSR SPARITE_SET
 JSR SOUND
 JSR TIMEDELAY
 JSR SCROLL_SET
 
;***************************************************************************************************************
SELECT_OVER:
 LDA $E5
 AND #$10
 BEQ ROMMENU
 INC $0202
 JSR SPARITE_SET
 LDA #$01
 STA $0700
 JSR SOUND
 LDA #$30
 STA $0700
 JSR SOUND
 LDA #$0A
 JSR MUSICDELAY
 
TIMEOUT:
 LDA #$02
 JSR SECONDDELAY
 JSR BPALETTES2
 JSR SCROLL_SET
 
 INC $0202
 JSR SPARITE_SET
 
 LDA #$02
 JSR SECONDDELAY
 JSR BPALETTES3
 JSR SCROLL_SET
 
 INC $0202
 JSR SPARITE_SET
 

 LDA #$02
 JSR SECONDDELAY
 JSR PPU_DATA_CLEARN
 JSR PPU_PL_CLEARN
 JSR SCROLL_SET
 LDA #$00
 STA $4015
 LDA #$00
 STA $2001
 LDA #$00
 STA $41
 JMP $0400
;***************************************************************************************************************
ROMMENU:   
 JMP MENU_START
 
;***************************************************************************************************************
TIMEDELAY:    ;延时
 LDA $2002
 BPL TIMEDELAY
 RTS
;********************************************************
SECONDDELAY:    ;延时
 STA $52
 LDA #$06
 STA $51
SECOND_S:
 JSR TIMEDELAY
 DEC $51
 BNE SECOND_S
 LDA #$06
 STA $51
 DEC $52
 BNE SECOND_S
SECONDRTS:
 RTS
;********************************************************
MUSICDELAY:    ;延时
 STA $54
 LDA #$06
 STA $53
MUSICDELAY_S:
 JSR TIMEDELAY
 JSR SOUND
 DEC $53
 BNE MUSICDELAY_S
 LDA #$06
 STA $53
 DEC $54
 BNE MUSICDELAY_S
MUSICDELAYRTS:
 RTS

;********************************************************
SOUND_SET:    ;音效
 STA $0700
 RTS

SOUND:
 LDA $0300
 TAX
 LDA #$07
 STA $8000
 LDA MUSIC_BANK,X
 STA $8001
 JSR $8000
 RTS

SOUND_ON:
 JSR MUSIC_PLAY
 LDA #$00
 STA $0303
SOUND_ON_RTS:
 RTS

SOUND_OFF:
 LDA #$01
 STA $0700
 LDA #$FF
 STA $0303
SOUND_OFF_RTS:
 RTS
;********************************************************
MUSIC_CHANGE:
 LDA $E5
 CMP #$40
 BNE MUSIC_ADD
 LDA $0300
 CMP #$00
 BEQ MUSIC_ADD
 DEC $0300
 LDA $0303
 BNE MAAD2
 JSR MUSIC_PLAY
MAAD2
 JSR PPU_GAME_SOUND
 JSR SCROLL_SET
MUSIC_ADD:
 
 LDA $E5
 CMP #$80
 BNE MUSIC_RTS
 LDA $0300
 TAX
 LDA MUSIC_NUMBER+1,X
 CMP #$FF
 BEQ MUSIC_RTS
 INC $0300
 LDA $0303
 BNE MAAD
 JSR MUSIC_PLAY
MAAD:
 JSR PPU_GAME_SOUND
 JSR SCROLL_SET
MUSIC_RTS:
 RTS
;********************************************************
MUSIC_PLAY:
 LDA $0300
 TAX
 LDA MUSIC_NUMBER,X
 STA $0700
 RTS
;********************************************************
BUTTON:    ;按键扫描处理
 JSR BUTTON_SCAN
 LDA $D4
 STA $D0
 LDA $D5
 STA $D1
 JSR BUTTON_SCAN
 LDX #$01
STE_BUTTON_A:
 LDA $D4,X
 CMP $D0,X
 BEQ STE_BUTTON_B
 LDA $E9,X
 STA $D4,X
STE_BUTTON_B:
 DEX
 BPL STE_BUTTON_A
 LDA $9D
 AND #$04
 BNE STE_X
 LDA $D4
 ORA $D5
 STA $D4
STE_X:
 LDX #$01
BUTTON_ADDR:
 LDA $D4,X
 TAY
 EOR $E9,X
 AND $D4,X
 STA $E5,X
 STY $E1,X
 STY $E9,X
 DEX
 BPL BUTTON_ADDR
 RTS
BUTTON_SCAN:    ;按键扫描
 LDX #$01
 STX $4016
 DEX
 STX $4016
 LDY #$08
BUTTON_SCAN_START:     ;按键扫描开始
 LDA $4016
 STA $D7
 LSR
 ORA $D7
 LSR
 ROL $D4
 LDA $4017
 STA $D7
 LSR
 ORA $D7
 LSR
 ROL $D5
 DEY
 BNE BUTTON_SCAN_START
 RTS

;********************************************************
SPARITE_SET:   ;精灵块设置
 LDA SEL_NUM
 CMP NUMBER_PAGE
 BCC SET_V
 LDA SEL_NUM
 SEC
 SBC NUMBER_PAGE
SET_V:
 ASL
 ASL
 ASL
 ASL
 CLC
 ADC SPARITE_DATA
 STA $0200
 LDA #$02
 STA $4014
SPARITE_RTS:
 RTS

SPARITE_WRITE:
 LDX #$00
 LDA #$00
 STA SEL_NUM
SPARITE_WRITE_DATA:
 LDA SPARITE_DATA,X
 STA $0200,X
 INX
 CPX #$04
 BCC SPARITE_WRITE_DATA
 RTS
 

;********************************************************
SPARITE_MOVE:    ;光标移动
SPA_UP:
 LDA $E5
 CMP #$08
 BNE SPA_DN
 LDA SEL_NUM
 CMP #$00
 BNE UP1
 LDA MULTCARTTYPE
 STA SEL_NUM
 INC SEL_NUM
UP1:
 DEC SEL_NUM
 LDA #$53
 JSR SOUND_SET
SPA_DN:
 LDA $E5
 CMP #$04
 BNE SPA_INC_RTS
 LDA SEL_NUM
 CMP MULTCARTTYPE
 BNE DN1
 LDA #$FF
 STA SEL_NUM
DN1:
 INC SEL_NUM
 LDA #$53
 JSR SOUND_SET
SPA_INC_RTS:
 RTS

;********************************************************
PRO_GAME_NUMBER:
 LDA SEL_NUM
 CMP MULTCARTTYPE
 BCC PRO_NUMBER_RTS
 BEQ PRO_NUMBER_RTS
 LDA MULTCARTTYPE
 STA SEL_NUM
PRO_NUMBER_RTS:
 RTS


;********************************************************
PAGE_SWITCH:
SPA_LT:
 LDA $E5
 CMP #$02
 BNE SPA_RG
 LDA #$53
 JSR SOUND_SET
 LDA SEL_NUM
 CMP NUMBER_PAGE
 BCC LT_ADD
 LDA SEL_NUM
 SEC
 SBC NUMBER_PAGE
 STA SEL_NUM
 RTS
LT_ADD:
 LDA #$00
 STA SEL_NUM
 RTS
 
SPA_RG:
 LDA $E5
 CMP #$01
 BNE PAGE_RTS
 LDA #$53
 JSR SOUND_SET
 LDA SEL_NUM
 CMP NUMBER_PAGE
 BCC RG_ADD
 LDA SEL_NUM
 SEC
 SBC NUMBER_PAGE
 STA SEL_NUM
 RTS
RG_ADD:
 LDA MULTCARTTYPE
 STA SEL_NUM
 RTS
PAGE_RTS:
 RTS
;********************************************************
SCROLL_SET:   ;滚动重设
 LDA SEL_NUM
 CMP MULTCARTTYPE
 BEQ SCROLL_SET_S
 BCC SCROLL_SET_S
 LDA MULTCARTTYPE
 STA SEL_NUM
SCROLL_SET_S:
 LDA SEL_NUM
 CMP NUMBER_PAGE
 BCS SCROLL_NT2
SCROLL_NT1:
 JSR PPU_GAME_SOUND
 LDA $2002
 LDA #$20
 STA $2006
 LDA #$00
 STA $2006
 LDA #$00
 STA $2005
 STA $2005
 RTS
SCROLL_NT2:
 JSR PPU_GAME_SOUND
 LDA $2002
 LDA #$24
 STA $2006
 LDA #$00
 STA $2006
 LDA #$00
 STA $2005
 STA $2005
 RTS
 
;********************************************************
SPARITE_LAYOUT:    ;精灵调色板设置
 LDA #$3F
 STA $2006
 LDA #$10
 STA $2006
 LDX #$00
SPD_WRITE:   
 LDA SPD1,X
 STA $2007
 INX
 CPX #$10
 BNE SPD_WRITE
 RTS

;********************************************************
BPALETTES:    ;背景调色板1设置
 LDA #$3F
 STA $2006
 LDA #$00
 STA $2006
 LDX #$00
BPS_WRITE:
 LDA BPD,X
 STA $2007
 INX
 CPX #$10
 BNE BPS_WRITE
 RTS
;********************************************************
BPALETTES2:    ;背景调色板1设置
 LDA #$3F
 STA $2006
 LDA #$00
 STA $2006
 LDX #$00
BPS2_WRITE:
 LDA BPD2,X
 STA $2007
 INX
 CPX #$10
 BNE BPS2_WRITE
 RTS
;********************************************************
BPALETTES3:    ;背景调色板1设置
 LDA #$3F
 STA $2006
 LDA #$00
 STA $2006
 LDX #$00
BPS3_WRITE:
 LDA BPD3,X
 STA $2007
 INX
 CPX #$10
 BNE BPS3_WRITE
 RTS

;********************************************************
PPU_LAYOUT:    ;调色板布局配置
 LDA #$23
 STA $2006
 LDA #$C0
 STA $2006
 LDX #$00
PPU_PL_WRITE:
 LDA PPU_LAYOUT_DATA,X
 STA $2007
 INX
 CPX #$40
 BNE PPU_PL_WRITE
 RTS
 
;********************************************************
PPU2_LAYOUT:    ;调色板布局配置
 LDA #$27
 STA $2006
 LDA #$C0
 STA $2006
 LDX #$00
PPU2_PL_WRITE:
 LDA PPU_LAYOUT_DATA,X
 STA $2007
 INX
 CPX #$40
 BNE PPU2_PL_WRITE
 RTS

;********************************************************
PPU_PL_CLEARN:    ;调色板清空
 LDA #$3F
 STA $2006
 LDA #$00
 STA $2006
 LDX #$00
PPU_PL_S:
 LDA #$0F
 STA $2007
 INX
 CPX #$00
 BNE PPU_PL_S
 RTS



;********************************************************
SPARITE_CLEARN:    ;精灵清除
 LDX #$00
SPARITE_CLEARN_START:
 LDA #$F8
 STA $0200,X
 INX
 LDA #$00
 STA $0200,X
 INX
 STA $0200,X
 INX
 STA $0200,X
 INX
 CPX #$00
 BNE SPARITE_CLEARN_START
 RTS

;********************************************************
SOUND_CLEARN:    ;音效清除
 LDX #$00
 LDA #$00
CLEARN_00_0F:
 STA $00,X
 INX
 CPX #$10
 BCC CLEARN_00_0F
SOUND_CLEARN_START:
 LDA #$01
 STA $0700
 RTS

;********************************************************
 
PPU_ADDR_PROGRAM:    ;PPU地址处理程序
 LDA $71
 CLC
 ADC SCREEN_L
 STA $71
 LDA $70
 ADC SCREEN_H
 STA $70
 LDA $70
 STA $2006
 LDA $71
 STA $2006
 RTS
 
;********************************************************
PPU_GAME_TITLE:    ;标题
 LDA TITLE_ADDR
 STA $2006
 LDA TITLE_ADDR+1
 STA $2006
 LDX #$00
TITLE_WRITE:
 LDA TITLE_DATA,X
 CMP #$FF
 BEQ TITLE_RTS
 STA $2007
 INX
TITLE_RTS
 BCC TITLE_WRITE
 RTS

PPU_GAME_TITLE2:    ;标题
 LDA TITLE_ADDR2
 STA $2006
 LDA TITLE_ADDR2+1
 STA $2006
 LDX #$00
TITLE2_WRITE:
 LDA TITLE_DATA,X
 CMP #$FF
 BEQ TITLE2_RTS
 STA $2007
 INX
TITLE2_RTS
 BCC TITLE2_WRITE
 RTS

 
PPU_GAME_G01:    ;节目1
 LDA G01_ADDR_DATA
 STA $70
 LDA G01_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G01_ADDR:
 LDA G01_PPU_DATA,X
 CMP #$FF
 BEQ G01_RTS
 STA $2007
 INX
 BCC PPU_GAME_G01_ADDR
G01_RTS:
 RTS
 

 
 
PPU_GAME_G02:    ;节目2
 LDA G02_ADDR_DATA
 STA $70
 LDA G02_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G02_ADDR:
 LDA G02_PPU_DATA,X
 CMP #$FF
 BEQ G02_RTS
 STA $2007
 INX
G02_RTS:
 BCC PPU_GAME_G02_ADDR
 RTS
 
 
 
 
PPU_GAME_G03:   ;节目3
 LDA G03_ADDR_DATA
 STA $70
 LDA G03_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G03_ADDR:
 LDA G03_PPU_DATA,X
 CMP #$FF
 BEQ G03_RTS
 STA $2007
 INX
G03_RTS:
 BCC PPU_GAME_G03_ADDR
 RTS

PPU_GAME_G04:    ;节目4
 LDA G04_ADDR_DATA
 STA $70
 LDA G04_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G04_ADDR:
 LDA G04_PPU_DATA,X
 CMP #$FF
 BEQ G04_RTS
 STA $2007
 INX
G04_RTS:
 BCC PPU_GAME_G04_ADDR
 RTS
 
PPU_GAME_G05:    ;节目5
 LDA G05_ADDR_DATA
 STA $70
 LDA G05_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G05_ADDR:
 LDA G05_PPU_DATA,X
 CMP #$FF
 BEQ G05_RTS
 STA $2007
 INX
G05_RTS:
 BCC PPU_GAME_G05_ADDR
 RTS
 
PPU_GAME_G06:    ;节目6
 LDA G06_ADDR_DATA
 STA $70
 LDA G06_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G06_ADDR:
 LDA G06_PPU_DATA,X
 CMP #$FF
 BEQ G06_RTS
 STA $2007
 INX
G06_RTS:
 BCC PPU_GAME_G06_ADDR
 RTS

PPU_GAME_G07:    ;节目7
 LDA G07_ADDR_DATA
 STA $70
 LDA G07_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G07_ADDR:
 LDA G07_PPU_DATA,X
 CMP #$FF
 BEQ G07_RTS
 STA $2007
 INX
G07_RTS:
 BCC PPU_GAME_G07_ADDR
 RTS

PPU_GAME_G08:    ;节目8
 LDA G08_ADDR_DATA
 STA $70
 LDA G08_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G08_ADDR:
 LDA G08_PPU_DATA,X
 CMP #$FF
 BEQ G08_RTS
 STA $2007
 INX
G08_RTS:
 BCC PPU_GAME_G08_ADDR
 RTS

PPU_GAME_G09:    ;节目9
 LDA G09_ADDR_DATA
 STA $70
 LDA G09_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G09_ADDR:
 LDA G09_PPU_DATA,X
 CMP #$FF
 BEQ G09_RTS
 STA $2007
 INX
G09_RTS
 BCC PPU_GAME_G09_ADDR
 RTS

PPU_GAME_G10:    ;节目10
 LDA G10_ADDR_DATA
 STA $70
 LDA G10_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G10_ADDR:
 LDA G10_PPU_DATA,X
 CMP #$FF
 BEQ G10_RTS
 STA $2007
 INX
G10_RTS
 BCC PPU_GAME_G10_ADDR
 RTS
 
PPU_GAME_G11:    ;节目11
 LDA G11_ADDR_DATA
 STA $70
 LDA G11_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G11_ADDR:
 LDA G11_PPU_DATA,X
 CMP #$FF
 BEQ G11_RTS
 STA $2007
 INX
G11_RTS:
 BCC PPU_GAME_G11_ADDR
 RTS
 
PPU_GAME_G12:    ;节目12
 LDA G12_ADDR_DATA
 STA $70
 LDA G12_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G12_ADDR:
 LDA G12_PPU_DATA,X
 CMP #$FF
 BEQ G12_RTS
 STA $2007
 INX
G12_RTS:
 BCC PPU_GAME_G12_ADDR
 RTS
 
PPU_GAME_G13:    ;节目13
 LDA G13_ADDR_DATA
 STA $70
 LDA G13_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G13_ADDR:
 LDA G13_PPU_DATA,X
 CMP #$FF
 BEQ G13_RTS
 STA $2007
 INX
G13_RTS:
 BCC PPU_GAME_G13_ADDR
 RTS
 
PPU_GAME_G14:    ;节目14
 LDA G14_ADDR_DATA
 STA $70
 LDA G14_ADDR_DATA+1
 STA $71
 JSR PPU_ADDR_PROGRAM
 LDX #$00
PPU_GAME_G14_ADDR:
 LDA G14_PPU_DATA,X
 CMP #$FF
 BEQ G14_RTS
 STA $2007
 INX
G14_RTS:
 BCC PPU_GAME_G14_ADDR
 RTS
 
PPU_GAME_MADE:    ;制作者
 LDA MADE_ADDR_DATA
 STA $2006
 LDA MADE_ADDR_DATA+1
 STA $2006
 LDX #$00
PPU_GAME_MADE_ADDR:
 LDA MADE_PPU_DATA,X
 CMP #$FF
 BEQ MADE_RTS
 STA $2007
 INX
MADE_RTS:
 BCC PPU_GAME_MADE_ADDR
 RTS
 
PPU_GAME_MADE2:    ;制作者
 LDA MADE_ADDR2_DATA
 STA $2006
 LDA MADE_ADDR2_DATA+1
 STA $2006
 LDX #$00
PPU_GAME_MADE2_ADDR:
 LDA MADE_PPU_DATA,X
 CMP #$FF
 BEQ MADE2_RTS
 STA $2007
 INX
MADE2_RTS:
 BCC PPU_GAME_MADE2_ADDR
 RTS

PPU_GAME_SOUND:    ;TEXT_SOUND
 LDA SEL_NUM
 CMP NUMBER_PAGE
 BCS PPU_SOUND_PAGE2
PPU_SOUND_PAGE1:
 LDA TEXT_SOUND_ADDR
 STA $2006
 LDA TEXT_SOUND_ADDR+1
 STA $2006
 LDX #$00
 JMP PPU_GAME_SOUND_ADDR
PPU_SOUND_PAGE2:
 LDA TEXT_SOUND_ADDR
 CLC
 ADC #$04
 STA $2006
 LDA TEXT_SOUND_ADDR+1
 STA $2006
 LDX #$00
 JMP PPU_GAME_SOUND_ADDR
PPU_GAME_SOUND_ADDR:
 LDA TEXT_SOUND_DATA,X
 CMP #$FF
 BEQ SOUND_RTS
 STA $2007
 INX
SOUND_RTS:
 BCC PPU_GAME_SOUND_ADDR
 LDA $0300
 STA $0302
 JSR HEX_TO_DEC
 LDA $0301
 ADC #$30
 STA $2007
 LDA $0302
 ADC #$30
 STA $2007
 RTS

;********************************************************
HEX_TO_DEC:
 LDA #$00
 STA $0301
 LDA $0302
HEX_CMP:
 CMP #$0A
 BCC HEX_TO
 SBC #$0A
 INC $0301
 BNE HEX_CMP
HEX_TO:
 STA $0302
 RTS

;********************************************************
ADDR_DATA_TO = $A0    ;目的读取地址
ADDR_FROM_START = $A2    ;源开始读取地址
ADDR_FROM_END = $A4    ;源结束读取地址
DATA_OVER = $7F

ADDR_TO:    ;目的写入地址
 .BYTE $00,$20    ;想要复制到的地方
ADDR_BEGIN:    ;源开始数据地址
 .BYTE $00,$20    ;想要从何处开始复制
ADDR_END:    ;源结束数据地址
 .BYTE $FF,$27    ;想要从何处结束复制


PPU_DATA_CLEARN:    ;PPU数据清除
DATA_COPY_PROTECT:    ;保护数据
 LDA #$00
 STA $2001
 PHA
 TXA
 PHA
 TYA
 PHA
 LDA ADDR_DATA_TO
 PHA
 LDA ADDR_DATA_TO+1
 PHA
 LDA ADDR_FROM_START
 PHA
 LDA ADDR_FROM_START+1
 PHA
 LDA ADDR_FROM_END
 PHA
 LDA ADDR_FROM_END+1
 PHA

 
SET_DATA_ADDR_START:    ;设置复制起始地址
 LDA ADDR_BEGIN
 STA ADDR_FROM_START    ;设置复制起始地址低位
 LDA ADDR_BEGIN+1
 STA ADDR_FROM_START+1    ;设置复制起始地址高位
 
SET_DATA_ADDR_END:    ;设置复制结束地址
 LDA ADDR_END
 STA ADDR_FROM_END    ;设置复制结束地址低位
 LDA ADDR_END+1
 STA ADDR_FROM_END+1    ;设置复制结束地址高位
 
SET_DATA_COPY_START:   ;设置目的起始地址
 LDA #$20
 STA $2006   ;设置目的起始地址低位
 LDA #$00
 STA $2006   ;设置目的起始地址高位

INI_XY_COUNT:   ;计数器初始化
 LDX #$00
 LDY #$00
 
COPY_OVER_CMP:    ;地址比较
 LDA ADDR_FROM_START
 CMP #$00
 BNE COPY_START
 LDA ADDR_FROM_START+1
 CMP #$28
 BEQ COPY_OVER
 
COPY_START:    ;数据复制开始
 LDA #$00    ;读取源地址
 STA $2007    ;写入目的地址
 INC ADDR_FROM_START   ;源地址低位递增
 BNE H_INC
 INC ADDR_FROM_START+1   ;目的地址低位递增
H_INC:
 INC ADDR_DATA_TO   ;源地址高位递增
 BNE COPY_JMP
 INC ADDR_DATA_TO+1   ;目的地址高位递增
COPY_JMP:   
 JMP COPY_OVER_CMP
 
COPY_OVER:
FINAL_BYTE:
 LDA #$00    ;读取最后一个字节
 STA $2007    ;写入最后一个字节
 
DATA_COPY_EXACT:    ;恢复数据
 PLA
 STA ADDR_FROM_END+1
 PLA
 STA ADDR_FROM_END
 PLA
 STA ADDR_FROM_START+1
 PLA
 STA ADDR_FROM_START
 PLA
 STA ADDR_DATA_TO+1
 PLA
 STA ADDR_DATA_TO
 PLA
 TAY
 PLA
 TAX
 PLA
 
DATA_COPY_RETURN:
 RTS


;********************************************************
TITLE_ADDR:    ;标题文字数据
 .BYTE $20,$64
TITLE_ADDR2:
 .BYTE $24,$64
TITLE_DATA:
 .BYTE $4E,$49,$4E,$4A,$41,$20,$47,$41,$49,$44,$45,$4E,$20,$45,$4E,$44,$20,$30,$33,$20,$49,$4E,$20,$31,$FF

G01_ADDR_DATA:
 .BYTE $20,$60
G01_PPU_DATA:
 .BYTE $30,$31,$2E,$4E,$49,$4E,$4A,$41,$20,$47,$41,$49,$44,$45,$4E,$20,$31,$FF

G02_ADDR_DATA:
 .BYTE $20,$A0
G02_PPU_DATA:
 .BYTE $30,$32,$2E,$4E,$49,$4E,$4A,$41,$20,$47,$41,$49,$44,$45,$4E,$20,$32,$FF

G03_ADDR_DATA:
 .BYTE $20,$E0
G03_PPU_DATA:
 .BYTE $30,$33,$2E,$4E,$49,$4E,$4A,$41,$20,$47,$41,$49,$44,$45,$4E,$20,$33,$FF

G04_ADDR_DATA:
 .BYTE $21,$20
G04_PPU_DATA:
 .BYTE $30,$34,$2E,$43,$4F,$4E,$54,$52,$41,$FF

G05_ADDR_DATA:
 .BYTE $21,$60
G05_PPU_DATA:
 .BYTE $30,$35,$2E,$53,$55,$50,$45,$52,$20,$43,$4F,$4E,$54,$52,$41,$FF

G06_ADDR_DATA:
 .BYTE $21,$A0
G06_PPU_DATA:
 .BYTE $30,$36,$2E,$43,$4F,$4E,$54,$52,$41,$20,$46,$4F,$52,$43,$45,$FF

G07_ADDR_DATA:
 .BYTE $21,$E0
G07_PPU_DATA:
 .BYTE $30,$37,$2E,$4B,$41,$47,$45,$FF

G08_ADDR_DATA:
 .BYTE $24,$60
G08_PPU_DATA:
 .BYTE $30,$38,$2E,$46,$49,$4E,$41,$4C,$20,$4D,$49,$53,$53,$49,$4F,$4E,$FF

G09_ADDR_DATA:
 .BYTE $24,$A0
G09_PPU_DATA:
 .BYTE $30,$39,$2E,$44,$4F,$55,$42,$4C,$45,$20,$44,$52,$41,$47,$4F,$4E,$20,$31,$FF

G10_ADDR_DATA:
 .BYTE $24,$E0
G10_PPU_DATA:
 .BYTE $31,$30,$2E,$44,$4F,$55,$42,$4C,$45,$20,$44,$52,$41,$47,$4F,$4E,$20,$32,$FF

G11_ADDR_DATA:
 .BYTE $25,$20
G11_PPU_DATA:
 .BYTE $31,$31,$2E,$44,$4F,$55,$42,$4C,$45,$20,$44,$52,$41,$47,$4F,$4E,$20,$33,$FF

G12_ADDR_DATA:
 .BYTE $25,$60
G12_PPU_DATA:
 .BYTE $31,$32,$2E,$4D,$49,$47,$48,$54,$59,$20,$46,$49,$4E,$41,$4C,$20,$46,$49,$47,$48,$54,$FF

G13_ADDR_DATA:
 .BYTE $25,$A0
G13_PPU_DATA:
 .BYTE $31,$33,$2E,$43,$48,$49,$50,$20,$54,$4F,$20,$44,$41,$4C,$45,$20,$31,$FF

G14_ADDR_DATA:
 .BYTE $25,$E0
G14_PPU_DATA:
 .BYTE $31,$34,$2E,$43,$48,$49,$50,$20,$54,$4F,$20,$44,$41,$4C,$45,$20,$32,$FF



MADE_ADDR_DATA:    ;作者文字数据
 .BYTE $23,$42
MADE_ADDR2_DATA:
 .BYTE $27,$42
MADE_PPU_DATA:
 .BYTE $4D,$41,$44,$45,$20,$42,$59,$20,$46,$4C,$41,$4D,$45,$43,$59,$43,$4C,$4F,$4E,$45,$20,$49,$4E,$20,$32,$30,$31,$37,$FF

 
TEXT_SOUND_ADDR:
 .BYTE $23,$08
TEXT_SOUND_DATA:
 .BYTE $4D,$55,$53,$49,$43,$20,$4E,$55,$4D,$42,$45,$52,$20,$FF


PPU_LAYOUT_DATA:    ;属性表数据
 .BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$5A,$5A,$5A,$5A,$5A,$5A,$5A,$5A
 .BYTE $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
 .BYTE $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
 .BYTE $00,$00,$C0,$F0,$F0,$30,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 
BPD:    ;背景调色板数据
 .BYTE $0F,$24,$24,$24,$0F,$20,$20,$20,$0F,$27,$27,$27,$0F,$16,$16,$16
 
BPD2:
 .BYTE $0F,$14,$14,$14,$0F,$10,$10,$10,$0F,$17,$17,$17,$0F,$06,$06,$06
 
BPD3:
 .BYTE $0F,$04,$04,$04,$0F,$00,$00,$00,$0F,$07,$07,$07,$0F,$07,$07,$07
 
SPD1:    ;精灵调色板数据
 .BYTE $0F,$2C,$2C,$2C,$0F,$27,$27,$27,$0F,$17,$17,$17,$0F,$07,$07,$07

MUSIC_NUMBER:
 .BYTE $19,$05,$06,$07,$04,$08,$09,$0A,$0B,$46,$8E,$8F,$B8,$B5,$9C
 .BYTE $AE,$90,$9B,$92,$91,$98,$93,$9A,$95,$97,$96,$9D,$1E,$FF

MUSIC_BANK:
 .BYTE $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$02,$02,$02,$02,$02
 .BYTE $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$01

MULTCARTTYPE:    ;节目数量(0=1个节目,1=2个节目,0F=16个节目)
 .BYTE $02

NUMBER_PAGE:
 .BYTE $03
 
SCREEN_H:    ;节目名字纵向偏移(粗调)
 .BYTE $01
 
SCREEN_L:    ;节目名字纵向偏移(微调)
 .BYTE $07
 
SPARITE_DATA:    ;光标数据
 .BYTE $58,$8F,$00,$2E


SELF_ROM:    ;合卡节目所在位置
 .BYTE $00
 
 
;[mapper52][存储块选择]
;FlameCyclone 2017.6.2

 .ORG $0400
 
SEL_NUM = $40    ;节目序号
MUSIC_PAGE = $41    ;菜单页开关
PRG_TMP = $42    ;PRG起始位置
CHR_TMP = $43    ;CHR起始位置
PRG_BLK = $44    ;PRG块大小
CHR_BLK = $45    ;CHR块大小
CHR_SIZE_TEM =$46    ;CHR容量大小
ROM_SEL = $47
ROM_LOCK = $48    ;合卡锁定

ROM_START:    ;选择块开始
 LDA MUSIC_PAGE
 BNE ROM_SELECT
 LDA SEL_NUM
 CMP SELF_ROM
 BCC ROM_SELECT
 INC SEL_NUM
ROM_SELECT:   ;子节目选择
 JSR PRG_SUM
 JSR CHR_SUM
 JSR PRG_BLK_ORA
 JSR CHR_BLK_ORA
 JSR LOCK
 
 LDA PRG_TMP  ;wmcc sBpp
 ASL
 CLC
 ADC CHR_TMP
 LSR
 LSR
 LSR
 LSR
 LSR
 AND #$04
 STA ROM_SEL
 
 LDA PRG_TMP  ;wmcc sBPP
 LSR
 LSR
 LSR
 AND #$03
 ORA ROM_SEL
 STA ROM_SEL
 
 LDA CHR_TMP  ;wmCC sBPP
 AND #$30
 ORA ROM_SEL
 STA ROM_SEL
 
 LDA PRG_BLK  ;wmCC SBPP
 ORA ROM_SEL
 STA ROM_SEL
 
 LDA CHR_BLK  ;wMCC SBPP
 ORA ROM_SEL
 STA ROM_SEL
 
 LDA ROM_LOCK  ;WMCC SBPP
 ORA ROM_SEL
 STA ROM_SEL
 
 LDA ROM_SEL
 STA $6000
 JMP ($FFFC)



PRG_SUM:    ;PRG起始位置累加计算
 LDA #$00
 STA PRG_TMP
 LDA SEL_NUM
 BEQ PRG_SUM_E
 LDX #$00
PRG_SUM_S:
 LDA PRG_TMP
 CLC
 ADC PRG_SIZE,X
 STA PRG_TMP
 INX
 CPX SEL_NUM
 BCC PRG_SUM_S
PRG_SUM_E:
 RTS

CHR_SUM:    ;CHR起始位置累加计算
 LDA #$00
 STA CHR_TMP
 LDA SEL_NUM
 BEQ CHR_SUM_E
 LDX #$00
CHR_SUM_S:
 LDA CHR_TMP
 CLC
 ADC CHR_SIZE,X
 STA CHR_TMP
 INX
 CPX SEL_NUM
 BCC CHR_SUM_S
CHR_SUM_E:
 RTS

PRG_BLK_ORA:    ;PRG块大小计算
 LDX SEL_NUM
 LDA #$08
 STA PRG_BLK
PRG_BLK_ORA_S:
 LDA PRG_SIZE,X
 CMP #$10
 BNE PRG_BLK_ORA_E
 LDA #$00
 STA PRG_BLK
PRG_BLK_ORA_E:
 RTS

CHR_BLK_ORA:    ;CHR块大小计算
 LDX SEL_NUM
 LDA #$40
 STA CHR_BLK
CHR_BLK_ORA_S:
 LDA CHR_SIZE,X
 CMP #$20
 BNE CHR_BLK_ORA_E
 LDA #$00
 STA CHR_BLK
CHR_BLK_ORA_E:
 RTS

LOCK:    ;合卡锁定位置
 LDA #$00
 STA ROM_LOCK
 LDX SEL_NUM
LOCK_S:
 LDA LOCK_DATA,X
 BEQ LOCK_E
 LDA #$80
 STA ROM_LOCK
LOCK_E:
 RTS




PRG_SIZE:    ;16KB PRG块容量
 .BYTE $10,$10,$10,$10

CHR_SIZE:    ;8KB CHR块容量
 .BYTE $20,$20,$20,$20
 
LOCK_DATA:    ;合卡锁定ROM
 .BYTE $00,$01,$01,$01
 
SELF_ROM:    ;当前菜单位置
 .BYTE $00
Re: use mapper 52 make multicart
by on (#197210)
It is a violation of the forums' rules if your ROMs contain commercial games. You better remove the attachments or else forums mods will do that for you.
Re: use mapper 52 make multicart
by on (#197224)
I notice the post has been edited. Does the attachment still contain games? If so, which?
Re: use mapper 52 make multicart
by on (#197234)
Now the attachment only contains a menu with ripped NSF music. It previously contained three different working multicart roms.
Re: use mapper 52 make multicart
by on (#197289)
Never downloaded the original attachments, but as indicated by the original content lists and each of them was about 1MB zipped they most likely contained games. I think it's settled now.