;************************************************************************
;*									*
;*	title name	: "yossy"					*
;*	proccess	: hlder						*
;*	file name	: ys_hmap					*
;*									*
;************************************************************************
;
;
		SALL
;
		include		ys_header.inc
		include		ys_color.h
		include		../union/ys_mapobj.h
		include		ys_presno.h
;
		XALL
;
;
;------------------------------------------------------------------------
;-		global symbol						-
;------------------------------------------------------------------------
;
		GLB	MAP_WINDOWS,UN_MPWINDCLOS
		GLB	UN_AICONDEMO_COL,UN_AICONSET_SUB
		GLB	UN_ICNVRMST,HOLDERINIT
		GLB	UN_HISCORE,BIGYS_COL_CHG,UN_BIGYS_COLST
		GLB	UN_MONO_COL_CHK,MAKIMONO
;
		GLB	MPCURSOL_MIN,MPCSLSET_DAT,HLDRSLCT_DAT
		GLB	CMODE_DAT1,AICON_DTAD,AICON_ATR0,WORLD_CORS
		GLB	AICON_BFAD,HOLDER_NO1M,HOLDER_NO1D
;
		GLB	UN_HISCR_DM,UN_HISCR_END,UN_ICNCLS
		GLB	UN_HISCORE_SET,UN_HISCORE_SUB
;
;
;------------------------------------------------------------------------
;-		extern symbol						-
;------------------------------------------------------------------------
;
;-------------< ys_main >-----------------------------------------------
		EXT	ENRAMCLR,OAMDXCLR,HMPCOLSET
		EXT	SOUND_3_ON
;
		EXT	HMPCHRST_SCR,HMPCHRST_BGCHR
;
		EXT	HMPIN,MINIT,HMPDM
;
;-------------< ys_save >-----------------------------------------------
		EXT	AICONBF_dat
;
;-------------< ys_enmy3 >----------------------------------------------
		EXT	YOSHI_COLOR
;
;-------------< ys_init >-----------------------------------------------
		EXT	VRAMDX_ST,UNCOMPRES_X,UNCOMPRES
;
;-------------< ys_rpro >------------------------------------------------
		EXT	CHIPON
;
;-------------< ys_hmap >------------------------------------------------
		EXT	UN_SCRSETS
;
;-------------< ys_mapdt >-----------------------------------------------
		EXT	BNSGM
;
;-------------< ys_chr >-------------------------------------------------
		EXT	ADDSTART
;
;------------------------------------------------------------------------
;-		define symbol						-
;------------------------------------------------------------------------
;
;
;
;************************************************************************
;*									*
;*		program start						*
;*									*
;************************************************************************
;
;
;
		EXTEND
;
;
		MEM8
		IDX8
;
Group_17	GROUP	Hlder_pro
Hlder_pro	SECT	REL
;
;----------------------------------------------------------------
;
;
;
;****************************************************************
;*								*
;*		ホルダー イニシャル セット ルーチン		*
;*								*
;****************************************************************
HOLDERINIT	EQU	$
		M16			; memory 16bit mode
		JSR	HLDER_BUF_CLS
;
HOLDERINIT_010	EQU	$
		STZ	!ICONGO_X
		M8			; memory 8bit mode
;
;--------------- アイコン バッファ セット -----------------------
		JSR	AICNBFINT
;
		LDA	!MPTYPE
		LSR	A
		TAX
		LDA	!MAPOINT
		SEC
		SBC	MPCURSOL_MIN,X
		INC	A
		M16			; memory 16bit mode
		AND	#000FFH
		STA	<WORK0
		JSR	AICNSRCH	; アイコン サーチ
		TYA
		AND	#0000FH
		ASL	A
		TAX
		LDA	!NTHLDRFG	; コースクリアによる
		AND	#000FFH		;	次のホルダーセットか ?
		BEQ	HOLDERINIT_050	;	NO -> HOLDERINIT_050
		ASL	A
		TAX
		LDA	HLDRSLCT_DAT+2,X
		BRA	HOLDERINIT_058
HOLDERINIT_050	EQU	$
		LDA	MPCSLSET_DAT,X
HOLDERINIT_058	EQU	$
		STA	!ICONMV_X
		M8			; memory 8bit mode
		STY	!CORSLPT	; カーソルポイントセット
;
		STZ	!HLDRFLG
		STZ	!HLDRMODE
		STZ	!ICONMODE
		STZ	!MVCRSLFG
		STZ	!ICNOVRMV
		STZ	!MVORMVCT
		STZ	!KIRIFLG
		STZ	!KIRICNT
		STZ	!KIRICNT+1
;
		LDA	#001H
		STA	!HOLDERFG
		INC	!HLDRMODE
		STZ	!HOLDERFG
		STZ	!HLDRMODE
;
		JSR	HOLDERSET	; ホルダー セット ルーチン
		STZ	!NTHLDRFG
;
		RTL
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+		ホルダー表示用バッファクリア		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		MEM16
HLDER_BUF_CLS	EQU	$
		LDX	#000H
		LDA	#019BFH
HOLDERINIT_000	EQU	$
		STA	!HOLDERBF0+000H,X
		STA	!HOLDERBF1+000H,X
		STA	!HOLDERBF0+100H,X
		STA	!HOLDERBF1+100H,X
		STA	!HOLDERBF0+200H,X
		STA	!HOLDERBF1+200H,X
		STA	!HOLDERBF0+280H,X
		STA	!HOLDERBF1+280H,X
		DEX
		DEX
		BNE	HOLDERINIT_000
		RTS
		MEM8
;
;
;****************************************************************
;*								*
;*		ＢＩＧヨッシー ＯＢＪカラー セット		*
;*								*
;****************************************************************
YSC0	EQU	000H
YSC1	EQU	YSC0+1
YSC2	EQU	YSC1+1
YSC3	EQU	YSC2+1
YSC4	EQU	YSC3+1
YSC5	EQU	YSC4+1
YSC6	EQU	YSC5+1
YSC7	EQU	YSC6+1
;
BIGYS_COL_DT0	EQU	$
		BYTE	YSC2,YSC5,YSC0,YSC4,YSC1,YSC3,YSC6,YSC7 ; 1
		WORD	00000H,00000H
		BYTE	YSC2,YSC5,YSC0,YSC4,YSC1,YSC3,YSC6,YSC7 ; 2
		WORD	00000H,00000H
		BYTE	YSC2,YSC5,YSC0,YSC4,YSC1,YSC3,YSC6,YSC7 ; 3
		WORD	00000H,00000H
		BYTE	YSC2,YSC5,YSC0,YSC4,YSC1,YSC3,YSC6,YSC7 ; 4
		WORD	00000H,00000H
		BYTE	YSC2,YSC5,YSC0,YSC4,YSC1,YSC3,YSC6,YSC7 ; 5
		WORD	00000H,00000H
		BYTE	YSC2,YSC5,YSC0,YSC4,YSC1,YSC3,YSC6,YSC2 ; 6
;
BIGYS_COL_DT	EQU	$
		WORD	COL_ADDRESS+BIGYSCOL_0
		WORD	COL_ADDRESS+BIGYSCOL_1
		WORD	COL_ADDRESS+BIGYSCOL_2
		WORD	COL_ADDRESS+BIGYSCOL_3
		WORD	COL_ADDRESS+BIGYSCOL_4
		WORD	COL_ADDRESS+BIGYSCOL_5
		WORD	COL_ADDRESS+BIGYSCOL_6
		WORD	COL_ADDRESS+BIGYSCOL_7
		WORD	COL_ADDRESS+BIGYSCOL_8
		WORD	COL_ADDRESS+BIGYSCOL_9
;
BIGYS_COLST	EQU	$
		LDA	#BANK COL_ADDRESS
		STA	<WORK2
		STA	<WORK5
		MI16			; memory , index 16bit mode
		LDX	!MAPOINT
BIGYS_COL_SUB	EQU	$
		LDA	BIGYS_COL_DT0,X
		AND	#000FFH
		ASL	A
		TAY
		LDA	BIGYS_COL_DT,Y
		STA	<WORK0
		LDA	BIGYS_COL_DT0+1,X
		AND	#000FFH
		ASL	A
		TAY
		LDA	BIGYS_COL_DT,Y
		STA	<WORK3
;
		LDX	#00000H
BIGYS_COL_LOP	EQU	$
		TXY
		LDA	[<WORK0],Y
		STA	>DATACOL+00CH*020H+00DH*2,X
		LDA	[<WORK3],Y
		STA	>DATACOL+00DH*020H+00DH*2,X
		INX
		INX
		CPX	#00003H*2
		BCC	BIGYS_COL_LOP
		MI8			; memory , index 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	ＢＩＧヨッシー ＯＢＪカラー セット (hmapよりコール)	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
BIGYS_COL_CHG	EQU	$
		LDA	#BANK COL_ADDRESS
		STA	<WORK2
		STA	<WORK5
		PHX
		MI16			; memory , index 16bit mode
		LDA	!YOSHIPOS
		AND	#000FFH
		STA	<WORK0
		LDX	!MPTYPE
		LDA	WORLD_CORS,X
		CLC
		ADC	<WORK0
		TAX
;
		JSR	BIGYS_COL_SUB
		MEM8
		IDX8
;
		PLX
		RTL
;
;****************************************************************
;*								*
;*	赤ちゃんの乗っている ヨッシー カラー チェンジ		*
;*								*
;****************************************************************
UN_BIGYS_COLST	EQU	$
		PHP
		PHB
		PHK
		PLB
;
		MI8			; memory , index 8bit mode
		JSR	BIGYS_COLST
;
		PLB
		PLP
		RTL
;
;
;****************************************************************
;*								*
;*		ＭＡＰ−ＷＩＮＤＯＷＳ	Ｖ３．１		*
;*								*
;****************************************************************
MAP_WINDOWS	EQU	$
;
		STZ	!OBJ16CHR
		LDA	#0B7H
		STA	!SUBADF
;
		LDA	!MN_HLDR_MD
		BEQ	MP_WINDOWS_200
		ASL	A
		TAX
		JSR	(MINI_HLDR_ADR,X)
		JMP	MP_WINDOWS_858
;
MP_WINDOWS_200	EQU	$
		LDA	!HLDRMODE
		CMP	#CNFG		; コンフィグ モードＯＮ ?
		BCC	MP_WINDOWS_300	;	NO -> MP_WINDOWS_300
		ASL	A
		TAX
		STA	!OBJ16CHR
		JSR	(HLDRCHNG,X)
		JMP	MP_WINDOWS_900
;
;-------------- course in check -------------------------
MP_WINDOWS_300	EQU	$
		LDA	MPSTART		; course in ?
		BNE	MP_WINDOWS_405	;	YES -> MP_WINDOWS_405
		LDA	!MVORMVCT
		AND	#0F0H
		BNE	MP_WINDOWS_450
		LDA	<KEYC1
		AND	#00FH
		BNE	MP_WINDOWS_450
		STZ	!MVORMVCT
		BRA	MP_WINDOWS_450
;
;-------------- course in !! ----------------------------
MP_WINDOWS_405	EQU	$
		LDA	!KAITENMD
		ASL	A
		TAX
		JSR	(KAITENADR,X)
;
		LDA	!SMZOMCT
		CMP	#020H		; 回転縮小が 点になったか ?
		BCS	MP_WINDOWS_410	;	NO -> MP_WINDOWS_410
		LDA	!KMRCLSIDX
		CMP	#012
		BCS	MP_WINDOWS_408
		JSR	ICONKCLS	; アイコン けむり消える
		BRA	MP_WINDOWS_410
;
MP_WINDOWS_408	EQU	$
		LDA	#80H
		STA	MPGOTYPE	;go to game play fade !!
		INC	!MPFADFG
;
MP_WINDOWS_410	EQU	$
		LDA	!SMZOMCT
		ORA	!SMZOMCT+1
		BEQ	MP_WINDOWS_900
		JSR	AICONOBJ	; アイコンオブジェ セット
		BRA	MP_WINDOWS_900
;
MP_WINDOWS_450	EQU	$
		LDA	!HLDRMODE	; ホルダー チェンジ ?
		BEQ	MP_WINDOWS_500	;	NO -> MP_WINDOWS_500
		ASL	A
		TAX
		JSR	(HLDRCHNG,X)
		BRA	MP_WINDOWS_900
;
MP_WINDOWS_500	EQU	$
;;;;K;;;;		LDA	!ICONMODE	; アイコン移動 ?
;;;;K;;;;		BEQ	MP_WINDOWS_700	;	NO -> MP_WINDOWS_700
;;;;K;;;;		ASL	A
;;;;K;;;;		TAX
;;;;K;;;;		JSR	(AICONMOVE,X)
;;;;K;;;;		LDA	!ICONMODE
;;;;K;;;;		CMP	#002H
;;;;K;;;;		BCC	MP_WINDOWS_900
;;;;K;;;;MP_WINDOWS_550 EQU	$
;;;;K;;;;		JSR	AICONOBJ	; アイコンオブジェ セット
;;;;K;;;;		BRA	MP_WINDOWS_900
;
MP_WINDOWS_700	EQU	$
		LDA	!HLDRFLG
		BEQ	MP_WINDOWS_800
;
;-------------- ホルダー セレクト -----------------------
		LDA	!ICONGO_X
		ORA	!ICONGO_Y
		BNE	MP_WINDOWS_850
		JSR	HLDRSLCT
		BRA	MP_WINDOWS_830
;
MP_WINDOWS_800	EQU	$
		LDA	!ICNOVRMV
		BEQ	MP_WINDOWS_810
		JSR	AICNOVR
MP_WINDOWS_810	EQU	$
;
;-------------- map cursol move -------------------------
		LDA	!ICONGO_X
		ORA	!ICONGO_Y
		BNE	MP_WINDOWS_850
		JSR	MPCURSOL
;
MP_WINDOWS_830	EQU	$
		JSR	NEXTPTST	; ＮＥＸＴ カーソル ポイント セット
;
MP_WINDOWS_850	EQU	$
		LDA	!ICONGO_X
		CMP	#02CH
		BEQ	MP_WINDOWS_855
		CMP	#0CCH
		BNE	MP_WINDOWS_858
MP_WINDOWS_855	EQU	$
		LDA	!MVORMVCT
		AND	#00FH
		STA	!MVORMVCT
MP_WINDOWS_858	EQU	$
		JSR	CURSOLPT
;
MP_WINDOWS_900	EQU	$
;
;-------------- マップカーソル オブジェセット -----------
		JSR	MPCSLSET
;
		RTL
;
;
;
HLDRCHNG	EQU	$-2
		WORD	HLDRCHNG_0000,HLDRCHNG_0100
		WORD	HLDRCHNG_0200,HLDRCHNG_0300
		WORD	HLDRCHNG_0400,HLDRCHNG_0500
		WORD	HLDRCHNG_0600,HLDRCHNG_0700
HLDRCHNG_TNSU	EQU	$
		WORD	HLDRCHNG_0700,HLDRCHNG_789
		WORD	HLDRCHNG_0800,HLDRCHNG_789
		WORD	HLDRCHNG_0900,HLDRCHNG_789
		WORD	HLDRCHNG_0B00
		WORD	HLDRCHNG_0C00,HLDRCHNG_0D00
		WORD	HLDRCHNG_0E00,HLDRCHNG_0F00
		WORD	HLDRCHNG_1000,HLDRCHNG_1100
		WORD	HLDRCHNG_1200
		WORD	HLDRCHNG_1700
HLDRCHNG_SCORE	EQU	$
		WORD	HISCRE_PUSH_000,HISCRE_PUSH_100
		WORD	HISCRE_PUSH_200
		WORD	HISCORE_000,HISCORE_100
		WORD	HISCORE_200,HISCORE_300
		WORD	HISCORE_400
		WORD	HISCRE_PUSH_000,HISCRE_PUSH_100
		WORD	HISCRE_PUSH_200,HISCRE_PUSH_300
		WORD	HISCORE_500,HISCORE_600
		WORD	HISCORE_700,HISCORE_800
HLDRCHG_ADR	EQU	$
		WORD	AICNPUSH_0000,AICNPUSH_0100
		WORD	AICNPUSH_0200,AICNPUSH_0300
		WORD	AICNPUSH_0400,AICNPUSH_0500
		WORD	AICNPUSH_0600
HLDRCHG_ADR_CHK EQU	$
		WORD	AICNPUSH_0700
AICNPUSH_08_CK	EQU	$
		WORD	AICNPUSH_0800
AICNPUSH_09_CK	EQU	$
		WORD	AICNPUSH_0900,AICNPUSH_0A00
		WORD	AICNPUSH_0B00,AICNPUSH_0C00
		WORD	AICNPUSH_0D00,AICNPUSH_0E00
		WORD	AICNPUSH_0F00
AICNPUSH_10_CK	EQU	$
		WORD	AICNPUSH_1000,AICNPUSH_1100
		WORD	AICNPUSH_1200
;
TNSU		EQU	(HLDRCHNG_TNSU-HLDRCHNG)/2
SCRE		EQU	(HLDRCHNG_SCORE-HLDRCHNG)/2
;
CNFG		EQU	(HLDRCHG_ADR-HLDRCHNG)/2
OBJAICN_CMP	EQU	(HLDRCHG_ADR_CHK-HLDRCHNG)/2
AICNPUSH_08	EQU	(AICNPUSH_08_CK-HLDRCHNG)/2
AICNPUSH_09	EQU	(AICNPUSH_09_CK-HLDRCHNG)/2
AICNPUSH_10	EQU	(AICNPUSH_10_CK-HLDRCHNG)/2
;
AICONMOVE	EQU	$-2
;
KAITENADR	EQU	$
		WORD	KAITEN_000,KAITEN_100,KAITEN_200
;
MINI_HLDR_ADR	EQU	$-2
		WORD	MINI_HLDR_0000,MINI_HLDR_1000
		WORD	MINI_HLDR_2000,MINI_HLDR_3000
		WORD	MINI_HLDR_4000,MINI_HLDR_5000
		WORD	MINI_HLDR_6000,MINI_HLDR_7000
		WORD	MINI_HLDR_8000,MINI_HLDR_9000
MINI_HLDR_BACK	EQU	$
		WORD	MINI_HLDR_A000,MINI_HLDR_1000
		WORD	MINI_HLDR_2000,MINI_HLDR_3000
		WORD	MINI_HLDR_B000
MINI_HLDR_NEXT	EQU	$
		WORD	MINI_HLDR_C000,MINI_HLDR_D000
		WORD	MINI_HLDR_E000,MINI_HLDR_F000
;
MN_BACK		EQU	(MINI_HLDR_BACK-MINI_HLDR_ADR)/2
MN_NEXT		EQU	(MINI_HLDR_NEXT-MINI_HLDR_ADR)/2
;
;
;****************************************************************
;*								*
;*		アイコン バッファ イニシャルセット		*
;*								*
;****************************************************************
AICNBFINT	EQU	$
		M16			; memory 16bit mode
		STZ	<WORK4
		STZ	<WORK6
		M8			; memory 8bit mode
		LDA	#BANK AICONBF_dat
		STA	<WORK12
		LDA	#BANK AICONBF1
		STA	<WORKF
AICNBFINT_000	EQU	$
		M16			; memory 16bit mode
		LDA	<WORK4
		ASL	A
		TAX
		LDA	>AICONBF_dat,X
		STA	<WORK10
		LDA	#00001H
		STA	<WORK2
		M8			; memory 8bit mode
;
AICNBFINT_100	EQU	$
		LDY	<WORK6		; アイコン ナンバー セット
		LDA	!MPCLRTBL,Y
		BEQ	AICNBFINT_400
		AND	#080H
		ORA	<WORK2
		STA	<WORK0
;
		LDY	#000H
AICNBFINT_250	EQU	$
		M16			; memory 16bit mode
		LDA	[<WORK10],Y
		STA	<WORKD
		M8			; memory 8bit mode
		LDA	[<WORKD]
		AND	#07FH
		CMP	<WORK2		; すでにクリアーしたコースか?
		BEQ	AICNBFINT_300	;	YES -> HOLDERINIT_300
		INY
		INY
		CPY	#008*2
		BCC	AICNBFINT_250
;
		LDY	#000
AICNBFINT_280	EQU	$
		M16			; memory 16bit mode
		LDA	[<WORK10],Y
		STA	<WORKD
		M8			; memory 8bit mode
		LDA	[<WORKD]	; アイコンバッファ
		BEQ	AICNBFINT_350	;	空きエリアサーチ
		CMP	#0FFH
		BEQ	AICNBFINT_400
		INY
		INY
		CPY	#008*2
		BCC	AICNBFINT_280
		BRA	AICNBFINT_400
;
AICNBFINT_300	EQU	$
		LDA	[<WORKD]	; 中間ポイントのデータか?
		AND	#080H		;	NO -> HOLDERINIT_400
		BEQ	AICNBFINT_400
AICNBFINT_350	EQU	$
		LDA	<WORK0
		STA	[<WORKD]
;
AICNBFINT_400	EQU	$
		INC	<WORK6		; コースクリアー テーブルインデックス
		INC	<WORK2
		LDA	<WORK2
		CMP	#008+1
		BCC	AICNBFINT_100
		INC	<WORK6		; コースクリアー
		INC	<WORK6		;	テーブル
		INC	<WORK6		;	  インデックス
		INC	<WORK6		;
		INC	<WORK4
		LDA	<WORK4
		CMP	#006
		BCC	AICNBFINT_000
;
		RTS
;
;
AICNBFINT_DAT	EQU	$
		WORD	AICONBF1,AICONBF2,AICONBF3,AICONBF4
		WORD	AICONBF5,AICONBF6
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	アイコン ヌキ キャラクター セット		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICNNUK		EQU	$
		MI16			; memory , index 16bit mode
		LDX	!MPTYPE
		LDA	AICNNUK_ATL,X
		STA	<WORKE
;
		STZ	<WORK8
		LDX	#00000H
		LDA	!HOLDERFG
		AND	#000FFH
		BEQ	AICNNUK_100
		LDA	#HOLDERBF1-HOLDERBF0
		STA	<WORK8
AICNNUK_100	EQU	$
		LDA	#AICNNUK_DT0
		STA	<WORK0
		LDA	#AICNNUK_DT1
		STA	<WORK2
		LDA	#AICNNUK_DT2
		STA	<WORK4
		LDA	AICON_BFAD,X
		CLC
		ADC	<WORK8
		STA	<WORK10
		CLC
		ADC	#00040H
		STA	<WORK12
		CLC
		ADC	#00040H
		STA	<WORK14
		INX
		INX
		CPX	#00009*2	; セット終了 ?
		BCS	AICNNUK_END	;	YES -> AICNNUK_END
;
		CPX	#00004*2
		BEQ	AICNNUK_150
		CPX	#00008*2
		BNE	AICNNUK_200
AICNNUK_150	EQU	$
		LDA	#SIRONUKI_DT0
		STA	<WORK0
		LDA	#SIRONUKI_DT1
		STA	<WORK2
		LDA	#SIRONUKI_DT2
		STA	<WORK4
;
AICNNUK_200	EQU	$
		LDY	#00000H
AICNNUK_250	EQU	$
		LDA	(<WORK0),Y
		ORA	<WORKE
		STA	(<WORK10),Y
		LDA	(<WORK2),Y
		ORA	<WORKE
		STA	(<WORK12),Y
		LDA	(<WORK4),Y
		ORA	<WORKE
		STA	(<WORK14),Y
		INY
		INY
		CPY	#00003*2
		BCC	AICNNUK_250
		BRA	AICNNUK_100
;
AICNNUK_END	EQU	$
		MI8			; memory , index 8bit mode
		RTS
;
AICNNUK_DT0	EQU	$
		WORD	02187H,02188H,06187H
;
AICNNUK_DT1	EQU	$
		WORD	02189H,0218EH,06189H
;
AICNNUK_DT2	EQU	$
		WORD	0A187H,0A188H,0E187H
;
SIRONUKI_DT0	EQU	$
		WORD	021F5H,021F5H,021F5H
;
SIRONUKI_DT1	EQU	$
		WORD	021F7H,021F7H,021F7H
;
SIRONUKI_DT2	EQU	$
		WORD	021F7H,021F6H,021F7H
;
;
AICNNUK_ATL	EQU	$
		WORD	00C00H,01000H,01400H,00000H
		WORD	00400H,00800H
;
;
;****************************************************************
;*								*
;*		アイコン けむり消える				*
;*								*
;****************************************************************
ICONKCLS	EQU	$
		DEC	!KMRCLSCT
		BNE	ICONKCLS_100
		LDX	!KMRCLSIDX
		LDA	ICONKCLS_TIM,X
		STA	!KMRCLSCT
		INC	!KMRCLSIDX
ICONKCLS_100	EQU	$
		LDA	!KMRCLSIDX
		CMP	#012
		BCC	ICONKCLS_200
ICONKCLS_150	EQU	$
		JMP	ICONKCLS_900
ICONKCLS_200	EQU	$
		CMP	#008
		BEQ	ICONKCLS_150
		ASL	A
		MI16			; memory , index 16bit mode
		AND	#000FFH
		TAX
		LDA	ICONKCLS_XPS,X	;Ｘ座標 セット
		STA	<WORK0
		LDY	!OAMIDX
		LDA	!ICONMV_X
		AND	#000FFH
		STA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+0+0,Y
		INC	<WORK0
		INC	<WORK0
		LDA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+0+8,Y
		INC	<WORK0
		INC	<WORK0
		LDA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+0+16,Y
		INC	<WORK0
		INC	<WORK0
		LDA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+0+24,Y
		INC	<WORK0
		INC	<WORK0
		LDA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+0+32,Y
		INC	<WORK0
		INC	<WORK0
		LDA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+0+40,Y
;
		LDA	ICONKCLS_YPS,X	;Ｙ座標 セット
		STA	<WORK0
		LDA	!ICONMV_Y
		AND	#000FFH
		SEC
		SBC	#00005H
		STA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+2+0,Y
		INC	<WORK0
		INC	<WORK0
		LDA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+2+8,Y
		INC	<WORK0
		INC	<WORK0
		LDA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+2+16,Y
		INC	<WORK0
		INC	<WORK0
		LDA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+2+24,Y
		INC	<WORK0
		INC	<WORK0
		LDA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+2+32,Y
		INC	<WORK0
		INC	<WORK0
		LDA	<WORK2
		CLC
		ADC	(<WORK0)
		STA	!SOAM_DX+2+40,Y
;
		LDA	ICONKCLS_DAT,X
		STA	!SOAM_DX+4+0,Y	;キャラＮＯ. セット
		STA	!SOAM_DX+4+8,Y
		STA	!SOAM_DX+4+16,Y
		STA	!SOAM_DX+4+24,Y
		STA	!SOAM_DX+4+32,Y
		STA	!SOAM_DX+4+40,Y
;
		LDA	ICONKCLS_SIZ,X
		STA	!SOAM_DX+6+0,Y	;サイズ ＆ ＯＢＪ優先順位 セット
		STA	!SOAM_DX+6+8,Y
		STA	!SOAM_DX+6+16,Y
		STA	!SOAM_DX+6+24,Y
		STA	!SOAM_DX+6+32,Y
		STA	!SOAM_DX+6+40,Y
;
		TYA
		CLC
		ADC	#00048
		STA	!OAMIDX
		MI8			; memory , index 8bit mode
ICONKCLS_900	EQU	$
		RTS
;
;
ICONKCLS_TIM	EQU	$
		HEX	001H,002H,002H,003H,002H,003H,004H
		HEX	008H,004H,004H,004H
;
ICONKCLS_XPS	EQU	$
		WORD	ICONKCLS_XPS0,ICONKCLS_XPS1,ICONKCLS_XPS2
		WORD	ICONKCLS_XPS3,ICONKCLS_XPS4,ICONKCLS_XPS5
		WORD	ICONKCLS_XPS6,ICONKCLS_XPS7,00000H
		WORD	ICONKCLS_XPS8,ICONKCLS_XPS9,ICONKCLS_XPSA
;
ICONKCLS_YPS	EQU	$
		WORD	ICONKCLS_YPS0,ICONKCLS_YPS1,ICONKCLS_YPS2
		WORD	ICONKCLS_YPS3,ICONKCLS_YPS4,ICONKCLS_YPS5
		WORD	ICONKCLS_YPS6,ICONKCLS_YPS7,00000H
		WORD	ICONKCLS_YPS8,ICONKCLS_YPS9,ICONKCLS_YPSA
;
ICONKCLS_DAT	EQU	$
		WORD	037C4H,031C5H,035C6H
		WORD	033C8H,033C8H,035C6H
		WORD	031C5H,037C4H,00000H
		WORD	031D4H,031D5H,071D4H
;
ICONKCLS_SIZ	EQU	$
		WORD	00000H,00000H,00002H
		WORD	00002H,00002H,00002H
		WORD	00000H,00000H,00000H
		WORD	00000H,00000H,00000H
;
;
ICONKCLS_XPS0	EQU	$
		WORD	00000H,00000H,0FFFCH,0FFF8H,0FFF8H,0FFFCH
;
ICONKCLS_XPS1	EQU	$
		WORD	00004H,00004H,0FFFCH,0FFF4H,0FFF4H,0FFFCH
;
ICONKCLS_XPS2	EQU	$
		WORD	0FFF8H,0FFF8H,0FFEDH,0FFEDH,00003H,00003H
;
ICONKCLS_XPS3	EQU	$
		WORD	0FFF8H,0FFF8H,00006H,00006H,0FFEAH,0FFEAH
;
ICONKCLS_XPS4	EQU	$
		WORD	0FFE3H,0FFE3H,0000DH,0000DH,0FFF8H,0FFF8H
;
ICONKCLS_XPS5	EQU	$
		WORD	0FFF8H,0FFF8H,0000DH,0000DH,0FFE3H,0FFE3H
;
ICONKCLS_XPS6	EQU	$
		WORD	0FFE7H,0FFFCH,00011H,00011H,0FFFCH,0FFE7H
;
ICONKCLS_XPS7	EQU	$
		WORD	0FFFCH,00011H,00011H,0FFFCH,0FFE7H,0FFE7H
;
ICONKCLS_XPS8	EQU	$
		WORD	0FFFCH,00011H,0FFE7H,0FFE7H,00011H,0FFFCH
;
ICONKCLS_XPS9	EQU	$
		WORD	0FFE7H,0FFE7H,0FFFCH,00011H,00011H,0FFFCH
;
ICONKCLS_XPSA	EQU	$
		WORD	0FFFCH,00011H,0FFE7H,0FFE7H,00011H,0FFFCH
;
;
ICONKCLS_YPS0	EQU	$
		WORD	0FFFAH,0FFFEH,00000H,0FFFEH,0FFFAH,0FFF8H
;
ICONKCLS_YPS1	EQU	$
		WORD	0FFF8H,00000H,00004H,00000H,0FFF8H,0FFF4H
;
ICONKCLS_YPS2	EQU	$
		WORD	00003H,0FFEDH,0FFFEH,0FFF2H,0FFFEH,0FFF2H
;
ICONKCLS_YPS3	EQU	$
		WORD	0FFE7H,00009H,00001H,0FFEFH,0FFEFH,00001H
;
ICONKCLS_YPS4	EQU	$
		WORD	00005H,0FFEBH,0FFEBH,00005H,00010H,0FFE0H
;
ICONKCLS_YPS5	EQU	$
		WORD	00010H,0FFE0H,0FFEBH,00005H,00005H,0FFEBH
;
ICONKCLS_YPS6	EQU	$
		WORD	00009H,00014H,00009H,0FFEFH,0FFE4H,0FFEFH
;
ICONKCLS_YPS7	EQU	$
		WORD	0FFE4H,0FFEFH,00009H,00014H,00009H,0FFEFH
;
ICONKCLS_YPS8	EQU	$
		WORD	00014H,00009H,00009H,0FFEFH,0FFEFH,0FFE4H
;
ICONKCLS_YPS9	EQU	$
		WORD	0FFEFH,00009H,00014H,00009H,0FFEFH,0FFE4H
;
ICONKCLS_YPSA	EQU	$
		WORD	00014H,00009H,00009H,0FFEFH,0FFEFH,0FFE4H
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				（ＢＧ書き換え）		*
;****************************************************************
HLDRCHNG_0000	EQU	$
		JSR	HOLDERSET	; ホルダー セット ルーチン
		INC	!HLDRMODE
;
MINI_HLDR0	EQU	$
		MI16			; memory , index 16bit mode
		LDA	!HOLDERFG
		AND	#00001H
		ASL	A
		TAY
		LDA	#BANK HOLDERBF0
		STA	<WORK1		;(WK1) <-- 転送元アドレス（Ｂ）
		LDA	HLDRCHNG_DAT00,Y
		TAX			;(X)   <-- 転送元アドレス（Ｌ，Ｈ）
		LDY	#01C00H+00220H	;(Y)   <-- ＶＲＡＭアドレス
		LDA	#00380H		;(A)   <-- 転送バイト数
		JSL	>VRAMDX_ST
		MI8			; memory , index 8bit mode
		RTS
;
HLDRCHNG_DAT00	EQU	$
		WORD	HOLDERBF1,HOLDERBF0
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*			（キャラクター ＤＭＡ転送 ＮＯ．１）	*
;****************************************************************
HLDRCHNG_0100	EQU	$
MINI_AICN_DMA0	EQU	$		; ミニゲームアイコン用
		MI16			; memory , index 16bit mode
		LDA	!HOLDERFG
		AND	#00001H
		ASL	A
		TAY
		LDX	#WOB7CHR	;(X) <-- 転送元アドレス（Ｌ，Ｈ）
		LDA	#BANK WOB7CHR
		STA	<WORK1		;(WK1) <-- 転送元アドレス（Ｂ）
		LDA	HLDRCHNG_010,Y
		TAY			;(Y) <-- ＶＲＡＭアドレス
		LDA	#00800H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
		MI8			; memory , index 8bit mode
;
		INC	!HLDRMODE
		RTS
;
HLDRCHNG_010	EQU	$
		WORD	02800H,02000H
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*			（ウィンドゥ オープン イニシャルセット）*
;*			（キャラクター ＤＭＡ転送 ＮＯ．２）	*
;****************************************************************
HLDRCHNG_0200	EQU	$
MINI_AICN_DMA1	EQU	$		; ミニゲームアイコン用
		MI16			; memory , index 16bit mode
		LDA	!HOLDERFG
		AND	#00001H
		ASL	A
		TAY
		LDX	#WOB7CHR+0800H ;(X) <-- 転送元アドレス（Ｌ，Ｈ）
		LDA	#BANK WOB7CHR
		STA	<WORK1		;(WK1) <-- 転送元アドレス（Ｂ）
		LDA	HLDRCHNG_020,Y
		TAY			;(Y) <-- ＶＲＡＭアドレス
		LDA	#00800H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
		I8			; index 8bit mode
;
		LDA	#0FF00H
		STA	>MPHDMABF5+000H
		STA	!MKMN_CLS
		STZ	!HLDRWDW
		M8			; memory 8bit mode
;
		LDA	#001H
		STA	!WMANSL
		INC	!HLDRMODE
		RTS
;
HLDRCHNG_020	EQU	$
		WORD	02C00H,02400H
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+	ホルダー入れ替え ウィンドゥ クローズ セット	+
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		MEM16
MPWINDCLOS	EQU	$
		PHB
		LDY	#BANK MPHDMABF5
		PHY
		PLB
		LDY	#000H
		LDA	#000FFH
MPWINDCLOS_LOP	EQU	$
		STA	!MPHDMABF5+000H,Y	; クローズデータセット
		STA	!MPHDMABF5+060H,Y
		DEY
		DEY
		BNE	MPWINDCLOS_LOP
		PLB
		RTS
;
;
UN_MPWINDCLOS	EQU	$
		JSR	MPWINDCLOS
		RTL
;
;
		MEM8
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ウィンドゥ オープン		*
;*								*
;****************************************************************
HLDRCHNG_0300	EQU	$
		JSR	KAITEN_200
MINI_HLDR3	EQU	$		; ミニゲームアイコン用
		MI16			; memory , index 16bit mode
		LDA	!HLDRWDW
		AND	#000FFH
		ASL	A
		ASL	A
		TAX
		LDA	#0EF10H
		LDY	#00000H
HLDRCHNG_0350	EQU	$
		STA	>MPHDMABF5+004H,X
		INX
		INX
		INX
		INX
		INY
		CPY	#00004H
		BCC	HLDRCHNG_0350
		MI8			; memory , index 8bit mode
		LDA	!HLDRWDW
		CLC
		ADC	#004H
		STA	!HLDRWDW
		CMP	#054H
		BCC	HLDRCHNG_0390
;
;--------------------------------------- ＢＧ２→ＢＧ１
		MI16			; memory , index 16bit mode
		LDA	!HOLDERFG
		AND	#00001H
		ASL	A
		TAY
		LDA	#BANK HOLDERBF0
		STA	<WORK1		;(WK1) <-- 転送元アドレス（Ｂ）
		LDA	HLDRCHNG_DAT00,Y
		TAX			;(X)   <-- 転送元アドレス（Ｌ，Ｈ）
		LDY	#01C00H+00020H	;(Y)   <-- ＶＲＡＭアドレス
		LDA	#0380H		;(A)   <-- 転送バイト数
		JSL	>VRAMDX_ST
		MI8			; memory , index 8bit mode
;
		INC	!HLDRMODE
HLDRCHNG_0390	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				(ウィンドゥ 閉じる)		*
;****************************************************************
HLDRCHNG_0400	EQU	$
MINI_HLDR4	EQU	$		; ミニゲームアイコン用
		M16			; memory 16bit mode
		JSR	MPWINDCLOS
		M8			; memory 8bit mode
		LDA	#017H
		STA	!WMANSL
		STZ	!WIND30
		INC	!HLDRMODE
		RTS
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				（カラーフェード イン）		*
;****************************************************************
HLDRCHNG_0500	EQU	$
		INC	!MKMN_MV
		INC	!MPFADR
		INC	!MPFADG
		INC	!MPFADB
		LDA	!MPFADB
		CMP	#01FH
		BCC	HLDRCHNG_0550
		INC	!HLDRMODE
		M16			; memory 16bit mode
		LDA	!MPTYPE
		STA	!SCHMPTYP
		M8			; memory 8bit mode
HLDRCHNG_0550	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				マップ カラーセット		*
;****************************************************************
HLDRCHNG_0600	EQU	$
		JSL	>ENRAMCLR
		JSL	>OAMDXCLR
		MI16			; memory , index 16bit mode
		STZ	!YOSHIPOS
		JSL	>UN_SCRSETS
		MI16			; memory , index 16bit mode
		JSL	>HMPCOLSET
		MI8			; memory , index 8bit mode
		JSR	BIGYS_COLST
		INC	!HLDRMODE
		RTS
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ１マップ スクリーン 転送	*
;****************************************************************
HLDRCHNG_0700	EQU	$
		MI16			; memory , index 16bit mode
		LDA	#00000H
		LDX	#000
		BRA	HLDRCHNG_0789
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ２マップ スクリーン 転送	*
;****************************************************************
HLDRCHNG_0800	EQU	$
		MI16			; memory , index 16bit mode
		LDA	#00800H
		LDX	#001
		BRA	HLDRCHNG_0789
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ３マップ スクリーン 転送	*
;****************************************************************
HLDRCHNG_0900	EQU	$
		MI16			; memory , index 16bit mode
		LDA	#01400H
		LDX	#002
;
HLDRCHNG_0789	EQU	$
		STA	<WORKE
		STX	<WORK0
		LDA	!MPTYPE
		ASL	A
		ADC	<WORK0
		TAX
		LDA	>HMPCHRST_SCR,X
		AND	#000FFH
		STA	<WORKC
		ASL	A
		ADC	<WORKC
		TAX
		LDA	>ADDSTART+(NO_PRES*3),X
		STA	R9		;(R9)  <-- pless data address(L,H)
		LDA	>ADDSTART+(NO_PRES*3)+2,X
		AND	#000FFH
		STA	R4		;(R4)  <--	    "        (B)
		LDA	#WOB7CHR
		STA	R10		;(R10) <-- data store address
;
		I8			; index 8bit mode
;
		M_CHIP	DT_UNCOMPRESS
;
		I16			; index 16bit mode
;
		JSR	HLDRCHNG_VRM
		MI8			; memory , index 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	ＶＲＡＭＤＸ セット サブルーチン		+
;+			in				+
;+			WORKE,F <- ＶＲＡＭアドレス	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		MEM16
		IDX16
HLDRCHNG_VRM	EQU	$
		LDX	#WOB7CHR	; 転送元アドレス（Ｌ，Ｈ)
		LDA	#BANK WOB7CHR
		STA	<WORK1		;	"       （Ｂ)
		LDY	<WORKE		; ＶＲＡＭアドレス
		LDA	#00800H		; 転送バイト数
		JSL	>VRAMDX_ST
		INC	!HLDRMODE
		RTS
		MEM8
		IDX8
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				マップ スクリーン 転送 (後半)	*
;****************************************************************
HLDRCHNG_789_DT EQU	$-1
		WORD	00400H,00C00H,01800H
;			 B1SCR	B2SCR  B3SCR
;
;
HLDRCHNG_789	EQU	$
		LDA	!HLDRMODE
		SEC
		SBC	#TNSU
		MI16			; memory , index 16bit mode
		AND	#000FFH
		TAY
		LDX	#WOB7CHR+800H	; 転送元アドレス（Ｌ，Ｈ)
		LDA	#BANK WOB7CHR
		STA	<WORK1		;	"       （Ｂ)
		LDA	HLDRCHNG_789_DT,Y
		TAY			; ＶＲＡＭアドレス
		LDA	#00800H		; 転送バイト数
		JSL	>VRAMDX_ST
		MI8			; memory , index 8bit mode
		INC	!HLDRMODE
		RTS
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ１,２キャラクター 転送 ０	*
;****************************************************************
HLDRCHNG_0B00	EQU	$
		MI16			; memory , index 16bit mode
		LDX	#04000H
		LDY	#00000H
		BRA	HLDRCHNG_BGCHR
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ１,２キャラクター 転送 １	*
;****************************************************************
HLDRCHNG_0C00	EQU	$
		MI16			; memory , index 16bit mode
		LDX	#04400H
		LDY	#00001H
		BRA	HLDRCHNG_BGCHR
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ１,２キャラクター 転送 ２	*
;****************************************************************
HLDRCHNG_0D00	EQU	$
		MI16			; memory , index 16bit mode
		LDX	#04800H
		LDY	#00002H
		BRA	HLDRCHNG_BGCHR
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ１,２キャラクター 転送 ３	*
;****************************************************************
HLDRCHNG_0E00	EQU	$
		MI16			; memory , index 16bit mode
		LDX	#04C00H
		LDY	#00003H
		BRA	HLDRCHNG_BGCHR
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ１,２キャラクター 転送 ４	*
;****************************************************************
HLDRCHNG_0F00	EQU	$
		MI16			; memory , index 16bit mode
		LDX	#05000H
		LDY	#00004H
		BRA	HLDRCHNG_BGCHR
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ１,２キャラクター 転送 ５	*
;****************************************************************
HLDRCHNG_1000	EQU	$
		MI16			; memory , index 16bit mode
		LDX	#05400H
		LDY	#00005H
		BRA	HLDRCHNG_BGCHR
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ１,２キャラクター 転送 ６	*
;****************************************************************
HLDRCHNG_1100	EQU	$
		MI16			; memory , index 16bit mode
		LDX	#05800H
		LDY	#00006H
		BRA	HLDRCHNG_BGCHR
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				ＢＧ１,２キャラクター 転送 ７	*
;****************************************************************
HLDRCHNG_1200	EQU	$
		MI16			; memory , index 16bit mode
		LDX	#05C00H
		LDY	#00007H
;
;
HLDRCHNG_BGCHR	EQU	$
		STX	<WORKE
		STY	<WORK0
		LDA	!MPTYPE
		ASL	A
		ASL	A
		ADC	<WORK0
		TAX
		LDA	>HMPCHRST_BGCHR,X
		AND	#000FFH
		STA	<WORKC
		ASL	A
		ADC	<WORKC
		TAX
		LDA	#00020H
		JSR	HLDRCHNG_CHR_SB
		MI8			; memory , index 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+	キャラクター ＤＭＡ セット			+
;+			in				+
;+			A <- pless data No.		+
;+			workE,F <- ＶＲＡＭアドレス	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		MEM16
		IDX16
HLDRCHNG_CHR_SB EQU	$
		STA	R3		;R3 <-- pless data line
		LDA	>ADDSTART+((NO_PRES+CHR10)*3),X
		STA	R1		;R1 <- pless data address(L,H)
		LDA	>ADDSTART+((NO_PRES+CHR10)*3)+2,X
		AND	#000FFH
		STA	R0		;R0 <--		 "        (B)
;
		I8			; index 8bit mode
		M_CHIP	DEF_CHR
		I16			; index 16bit mode
;
		JSR	HLDRCHNG_VRM
		RTS
		MEM8
		IDX8
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+							+
;+		ＯＢＪキャラクター 転送			+
;+					各バンクの後半	+
;+				in			+
;+				Y <- ＶＲＡＭアドレス	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		MEM16
		IDX16
HLDRCHNG_13456	EQU	$
		LDX	#WOB7CHR+800H	; 転送元アドレス（Ｌ，Ｈ)
		LDA	#BANK WOB7CHR
		STA	<WORK1		;	"       （Ｂ)
		LDA	#00800H		; 転送バイト数
		JSL	>VRAMDX_ST
		INC	!HLDRMODE
		MI8			; memory , index 8bit mode
		RTS
		MEM8
		IDX8
;
;
;****************************************************************
;*								*
;*		ホルダー入れ替え				*
;*				（カラーフェード アウト）	*
;****************************************************************
HLDRCHNG_1700	EQU	$
		DEC	!MKMN_MV
		DEC	!MPFADR
		DEC	!MPFADG
		DEC	!MPFADB
		BNE	HLDRCHNG_1710
		STZ	!MKMN_MV
		STZ	!HLDRMODE
		LDA	#010H
		STA	!WIND30
		STZ	!WMANSL
HLDRCHNG_1710	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア アイコン ＰＵＳＨ			*
;*					イニシャル セット	*
;****************************************************************
HISCRE_NO	EQU	010*2
;
;
HISCRE_PUSH_000 EQU	$
		LDX	#HISCRE_NO
		JSR	HISCRE_PUSH_DMA
		LDA	#036H
		JSL	>SOUND_3_ON	; sound set!! [♪]
		STZ	!HLDRWDW
		LDA	#HISCRE_NO/2	; スコア アイコン ＮＯ.
		JSR	HISCRE_PUSH_SUB
		INC	!HLDRMODE
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア アイコン ＰＵＳＨ			*
;*						(縮小)		*
;****************************************************************
HISCRE_PUSH_100 EQU	$
		LDA	#HISCRE_NO/2	; スコア アイコン ＮＯ.
		JSR	HISCRE_PUSH_SUB
		LDA	!HLDRWDW
		CLC
		ADC	#008
		STA	!HLDRWDW
		CMP	#040H
		BCC	HISCRE_PUSH_190
		INC	!HLDRMODE
HISCRE_PUSH_190 EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア アイコン ＰＵＳＨ			*
;*						(拡大)		*
;****************************************************************
HISCRE_PUSH_200 EQU	$
		LDA	!HLDRWDW
		SEC
		SBC	#008
		STA	!HLDRWDW
		BPL	HISCRE_PUSH_290
		STZ	!HLDRWDW
		INC	!HLDRMODE
HISCRE_PUSH_290 EQU	$
		LDA	#HISCRE_NO/2	; スコア アイコン ＮＯ.
		JSR	HISCRE_PUSH_SUB
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア アイコン ＰＵＳＨ			*
;*				元にもどす イニシャル セット	*
;****************************************************************
HISCRE_PUSH_300 EQU	$
		JSR	HISCRE_PUSH_OBJ
		M16			; memory 16bit mode
		LDA	AICON_DTAD+HISCRE_NO
		ORA	#01800H
		STA	<WORK0		; アイコン キャラ データ
;
		LDX	#HISCRE_NO
		LDA	AICON_BFAD,X
		LDY	!HOLDERFG
		BNE	HISCRE_PUSH_310
		PHA
		LDA	<WORK0
		ORA	#00080H
		STA	<WORK0		; アイコン キャラＮＯ. 変換
		PLA
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
HISCRE_PUSH_310 EQU	$
		STA	<WORKA
		CLC
		ADC	#00040H
		STA	<WORKC
		CLC
		ADC	#0040H
		STA	<WORKE
		JSR	AICONSET_SUB
;
		LDA	#01C00H+00020H
		STA	<WORK4
		JSR	HISCORE_DMA
		M8			; memory 8bit mode
		STZ	!HLDRWDW
		INC	!HLDRMODE
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+	アイコン ＰＵＳＨ スクリーン 書き換え		+
;+				in			+
;+				X <- アイコン Ｎｏ.	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HISCRE_PUSH_DMA EQU	$
		M16			; memory 16bit mode
		LDA	AICON_BFAD,X
		LDY	!HOLDERFG
		BNE	HISCORE_PUSH_10
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
HISCORE_PUSH_10 EQU	$
		STA	<WORK0
		CLC
		ADC	#00040H
		STA	<WORK2
		CLC
		ADC	#00040H
		STA	<WORK4
;
		LDY	#00000H
		LDA	#0398EH
HISCORE_PUSH_50 EQU	$
		STA	(<WORK0),Y
		STA	(<WORK2),Y
		STA	(<WORK4),Y
		INY
		INY
		CPY	#006H
		BCC	HISCORE_PUSH_50
;
		LDA	#01C00H+00020H
		STA	<WORK4
		JSR	HISCORE_DMA
		M8			; memory 8bit mode
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+	アイコン ＰＵＳＨ ＤＭＡ セット			+
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HISCRE_PUSH_SUB EQU	$
		M16			; memory 16bit mode
		AND	#000FFH
		STA	R3
		LDA	#015H
		STA	R1		; ＣＭＯＤＥ ＮＯ.
		LDA	!HLDRWDW
		AND	#000FFH
		STA	<WORK0
		LDA	#00100H
		SEC
		SBC	<WORK0
		STA	R6		; 倍率
;
		M_CHIP	MPAICNZM
;
		JSR	AICONDEMO_COL
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+	アイコン ＰＵＳＨ ＯＢＪ セット			+
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HISCRE_PUSH_OBJ EQU	$
		MI16			; memory , index 16bit mode
		LDY	!OAMIDX
		LDA	!ICONMV_X
		AND	#000FFH
		SEC
		SBC	#00010H		;Ｘ座標
		STA	!SOAM_DX+0,Y
		STA	!SOAM_DX+16,Y
		CLC
		ADC	#00016
		STA	!SOAM_DX+8,Y
		STA	!SOAM_DX+24,Y
;
		LDA	!ICONMV_Y
		AND	#000FFH
		SEC
		SBC	#00016H		;Ｙ座標
		STA	!SOAM_DX+2,Y
		STA	!SOAM_DX+10,Y
		CLC
		ADC	#00016
		STA	!SOAM_DX+18,Y
		STA	!SOAM_DX+26,Y
;
		STZ	<WORK0
		LDA	!MN_HLDR_MD
		BNE	HISCRE_PUSH_PAS
		LDA	!HLDRMODE
		CMP	#AICNPUSH_09
		BCS	HISCRE_PUSH_PAS
		LDA	#00600H
		STA	<WORK0
;
HISCRE_PUSH_PAS EQU	$
		LDA	#031CCH		;キャラＮＯ.
		ORA	<WORK0
		STA	!SOAM_DX+4,Y
		INC	A
		INC	A
		STA	!SOAM_DX+12,Y
		LDA	#031ECH
		ORA	<WORK0
		STA	!SOAM_DX+20,Y
		INC	A
		INC	A
		STA	!SOAM_DX+28,Y
;
		LDA	#04002H		;サイズ ＆ ＯＢＪ優先順位
		STA	!SOAM_DX+6,Y
		STA	!SOAM_DX+14,Y
		STA	!SOAM_DX+22,Y
		STA	!SOAM_DX+30,Y
;
		TYA
		CLC
		ADC	#00032
		STA	!OAMIDX
		MI8			; memory , index 8bit mode
		LDA	#020H
		STA	!OBJ16CHR
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICONDEMO_COL	EQU	$		; アイコンデモ モードのコール用
		MI16			; memory , index 16bit mode
		LDA	#BANK WOB7CHR
		STA	<WORK1		;(WK1) <-- 転送元アドレス（Ｂ）
		LDY	#07CC0H		;(Y) <-- ＶＲＡＭアドレス
		LDX	#WOB7CHR	;(X) <-- 転送元アドレス (Ｌ,Ｈ)
		LDA	#00080H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
;
		LDY	#07DC0H		;(Y) <-- ＶＲＡＭアドレス
		LDX	#WOB7CHR+200H	;(X) <-- 転送元アドレス (Ｌ,Ｈ)
		LDA	#00080H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
;
		LDY	#07EC0H		;(Y) <-- ＶＲＡＭアドレス
		LDX	#WOB7CHR+400H	;(X) <-- 転送元アドレス (Ｌ,Ｈ)
		LDA	#00080H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
;
		LDY	#07FC0H		;(Y) <-- ＶＲＡＭアドレス
		LDX	#WOB7CHR+600H	;(X) <-- 転送元アドレス (Ｌ,Ｈ)
		LDA	#00080H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
		MI8			; memory , index 8bit mode
		RTS
;
;
UN_AICONDEMO_COL	EQU	$
		JSR	AICONDEMO_COL
		RTL
;
;
;****************************************************************
;*								*
;*		ハイスコア 表示 イニシャルセット		*
;*								*
;****************************************************************
HISCORE_NK_UP	EQU	$
		WORD	021ABH,021ACH,021ACH,061ABH
;
HISCORE_NK_MID0 EQU	$
		WORD	021ADH,021AEH,021AEH,061ADH
;
HISCORE_NK_MID1 EQU	$
		WORD	021ADH,0218AH,0218BH,061ADH
;
HISCORE_NK_DOWN EQU	$
		WORD	0A1ABH,0A1ACH,0A1ACH,0E1ABH
;
HISCORE_ADR0	EQU	$
		WORD	AICONBF00+000H,AICONBF01+000H,AICONBF02+000H
		WORD	AICONBF03+000H,AICONBF04+000H,AICONBF05+000H
		WORD	AICONBF06+000H,AICONBF07+000H,AICONBF08+000H
;
HISCORE_ADR1	EQU	$
		WORD	AICONBF00+040H,AICONBF01+040H,AICONBF02+040H
		WORD	AICONBF03+040H,AICONBF04+040H,AICONBF05+040H
		WORD	AICONBF06+040H,AICONBF07+040H,AICONBF08+040H
;
HISCORE_ADR2	EQU	$
		WORD	AICONBF00+080H,AICONBF01+080H,AICONBF02+080H
		WORD	AICONBF03+080H,AICONBF04+080H,AICONBF05+080H
		WORD	AICONBF06+080H,AICONBF07+080H,AICONBF08+080H
;
HISCORE_ADR3	EQU	$
		WORD	AICONBF00+0C0H,AICONBF01+0C0H,AICONBF02+0C0H
		WORD	AICONBF03+0C0H,AICONBF04+0C0H,AICONBF05+0C0H
		WORD	AICONBF06+0C0H,AICONBF07+0C0H,AICONBF08+0C0H
;
;
HISCORE_000	EQU	$
		JSR	HISCRE_PUSH_OBJ
HISCORE_0_SB	EQU	$
		MI16			; memory , index 16bit mode
		LDY	#00000H
		LDA	!HOLDERFG
		AND	#000FFH
		TAX
		BEQ	HISCORE_050
		LDX	#HOLDERBF1-HOLDERBF0
HISCORE_050	EQU	$
		STX	<WORKA
		LDA	#019BFH
HISCORE_053	EQU	$
		STA	!HOLDERBF0+000H,X
		STA	!HOLDERBF0+100H,X
		STA	!HOLDERBF0+200H,X
		STA	!HOLDERBF0+280H,X
		INX
		INX
		INY
		CPY	#00080H
		BCC	HISCORE_053
;
		STZ	<WORKE
HISCORE_054	EQU	$
		LDY	<WORKE
		LDA	HISCORE_ADR0,Y
		STA	<WORK0
		LDA	HISCORE_ADR1,Y
		STA	<WORK2
		LDA	HISCORE_ADR2,Y
		STA	<WORK4
		LDA	HISCORE_ADR3,Y
		STA	<WORK6
		LDA	#00C00H		; カラーＮＯ. セット !!
		STA	<WORKC
		LDX	!MPTYPE
		TYA
		LSR	A
		CLC
		ADC	WORLD_CORS,X
		TAY
		LDA	!HISCEBF,Y
		AND	#000FFH
		CMP	#00030		; ３０点以上か ?
		BCS	HISCORE_055	;	YES -> HISCORE_055
		LDA	<WORKE
		CMP	#00010H		; スペシャルアイコン点数チェック ?
		BNE	HISCORE_055_20	;	NO -> HISCORE_055_20
		LDA	!HISCEBF,Y
		AND	#000FFH
		BEQ	HISCORE_055
HISCORE_055_20	EQU	$
		LDA	!MPCLRTBL,Y
		AND	#0007FH		; コース クリア しているか ?
		BEQ	HISCORE_055	;	NO -> HISCORE_055
		LDA	#01000H
		STA	<WORKC
HISCORE_055	EQU	$
		LDX	#00000H
		LDY	<WORKA
HISCORE_058	EQU	$
		LDA	HISCORE_NK_UP,X
		ORA	<WORKC
		STA	(<WORK0),Y
		LDA	HISCORE_NK_MID0,X
		ORA	<WORKC
		STA	(<WORK2),Y
		LDA	HISCORE_NK_MID1,X
		ORA	<WORKC
		STA	(<WORK4),Y
		LDA	HISCORE_NK_DOWN,X
		ORA	<WORKC
		STA	(<WORK6),Y
		INY
		INY
		INX
		INX
		CPX	#00004*2
		BCC	HISCORE_058
		INC	<WORKE
		INC	<WORKE
		LDA	<WORKE
		CMP	#HISCORE_ADR1-HISCORE_ADR0
		BCS	HISCORE_060
		JMP	HISCORE_054
;
HISCORE_060	EQU	$
		I8			; index 16bit mode
		LDA	#01C00H+00220H
		STA	<WORK4
		LDA	!HOLDERFG
		EOR	#00001H
		STA	!HOLDERFG
		JSR	HISCORE_DMA
		LDA	!HOLDERFG
		EOR	#00001H
		STA	!HOLDERFG
		M8			; memory 8bit mode
;
		LDA	#004H
		STA	<SCCH2
		LDA	#084H
		STA	<SCCV2
		STZ	!COSSCRE
		STZ	!SCRECNT
		STZ	!SCREBOD
		LDA	#000H
		STA	>MPHDMA4+1	; ウィンドゥＯＦＦ !!
		INC	!HLDRMODE
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア 表示					*
;*				ホルダーのアイコン部分を消す	*
;****************************************************************
HISCORE_100	EQU	$
		JSR	HISCRE_PUSH_OBJ
HISCORE_1_SB	EQU	$
		JSR	ICNCLS
;
		LDA	#036H
		JSL	>SOUND_3_ON	; sound set!!
		INC	!HLDRMODE
;
		JMP	HISCORE_2_SB
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ICNCLS		EQU	$
		LDA	!COSSCRE
		ASL	A
		TAX
		M16			; memory 16bit mode
		LDA	AICON_BFAD,X
		LDY	!HOLDERFG
		BNE	ICNCLS_100
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
ICNCLS_100	EQU	$
		STA	<WORK0
		CLC
		ADC	#00040H
		STA	<WORK2
		CLC
		ADC	#00040H
		STA	<WORK4
;
		LDY	#00000H
		LDX	!MPTYPE
		LDA	AICNNUK_ATL,X
		STA	<WORK6
ICNCLS_200	EQU	$
		LDA	!COSSCRE
		AND	#000FFH
		CMP	#00004-1
		BEQ	ICNCLS_220
		CMP	#00008-1
		BEQ	ICNCLS_220
		JSR	AICNNUKI_CLS
		BRA	ICNCLS_230
ICNCLS_220	EQU	$
		JSR	AICNBETA_CLS
ICNCLS_230	EQU	$
		INY
		INY
		CPY	#006H
		BCC	ICNCLS_200
;
		LDA	#01C00H+00020H
		STA	<WORK4
		JSR	HISCORE_DMA
		M8			; memory 8bit mode
		RTS
;
		MEM16
;
;++++++++++++++++++++++++++++++++++++++++
;+		ヌキクリア		+
;++++++++++++++++++++++++++++++++++++++++
AICNNUKI_CLS	EQU	$
		LDA	AICNNUK_DT0,Y
		ORA	<WORK6
		STA	(<WORK0),Y
		LDA	AICNNUK_DT1,Y
		ORA	<WORK6
		STA	(<WORK2),Y
		LDA	AICNNUK_DT2,Y
		ORA	<WORK6
		STA	(<WORK4),Y
		RTS
;
;++++++++++++++++++++++++++++++++++++++++
;+		ベタクリア		+
;++++++++++++++++++++++++++++++++++++++++
AICNBETA_CLS	EQU	$
		LDA	SIRONUKI_DT0,Y
		ORA	<WORK6
		STA	(<WORK0),Y
		LDA	SIRONUKI_DT1,Y
		ORA	<WORK6
		STA	(<WORK2),Y
		LDA	SIRONUKI_DT2,Y
		ORA	<WORK6
		STA	(<WORK4),Y
		RTS
;
		MEM8
;
;
;
UN_ICNCLS	EQU	$
		PHB
		PHK
		PLB
		JSR	ICNCLS
		PLB
		RTL
;
;
;****************************************************************
;*								*
;*		ハイスコア 表示					*
;*				(表が見えている間)		*
;****************************************************************
HISCORE_200	EQU	$
		JSR	HISCRE_PUSH_OBJ
HISCORE_2_SB	EQU	$
		JSR	HISCORE_SUB
		LDA	!SCRECNT
		CLC
		ADC	#010H
		STA	!SCRECNT
		JSR	SCREAICON
		LDA	!SCRECNT
		BPL	HISCORE_290
		INC	!SCREBOD
		INC	!HLDRMODE
HISCORE_290	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア 表示					*
;*				(裏が見えている間)		*
;****************************************************************
HISCORE_300	EQU	$
		JSR	HISCRE_PUSH_OBJ
		LDA	!SCRECNT
		SEC
		SBC	#010H
		STA	!SCRECNT
		BMI	HISCORE_310
		JSR	HISCORE_SUB
		BRA	HISCORE_390
;
HISCORE_310	EQU	$
		JSR	HISCORE_SET	; ハイスコア セット !!
		STZ	!SCRECNT
		LDA	!MPTYPE
		LSR	A
		TAX
HISCORE_350	EQU	$
		INC	!COSSCRE
		LDA	!COSSCRE
		CMP	#009
		BCS	HISCORE_380
		CLC
		ADC	MPCURSOL_MIN,X
		TAY
		LDA	!AICONBF1,Y
		BEQ	HISCORE_350
		CMP	#0F0H
		BEQ	HISCORE_380
		STZ	!SCREBOD
		DEC	!HLDRMODE
		DEC	!HLDRMODE
		BRA	HISCORE_395
HISCORE_380	EQU	$
		DEC	!COSSCRE
		INC	!HLDRMODE
		BRA	HISCORE_395
HISCORE_390	EQU	$
		JSR	SCREAICON
HISCORE_395	EQU	$
		RTS
;
;
HISCORE_3_SB	EQU	$
		LDA	!SCRECNT
		SEC
		SBC	#010H
		STA	!SCRECNT
		BMI	HISCORE_3_SB_10
		JSR	HISCORE_SUB
		BRA	HISCORE_3_SB_90
;
HISCORE_3_SB_10 EQU	$
		JSR	HISCORE_SET	; ハイスコア セット !!
		INC	!HLDRMODE
HISCORE_3_SB_90 EQU	$
		JSR	SCREAICON
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+		ハイスコア 表示				+
;+			ＶＲＡＭセット			+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HISCORE_SUB	EQU	$
		M16			; memory 16bit mode
		LDY	!MPTYPE
		LDA	CMODE_DATA,Y
		STA	<WORK0
		LDA	!MPTYPE
		LSR	A
		TAY
		PHY
		LDA	MPCURSOL_MIN,Y
		CLC
		ADC	!COSSCRE
		AND	#000FFH
		TAX
		LDA	!AICONBF1,X
		DEC	A
		AND	#0007FH
		TAY
		LDA	(<WORK0),Y
		AND	#000FFH
		STA	R1
		LDA	!SCREBOD
		AND	#000FFH		;裏アイコン セット ?
		BEQ	HISCORE_SUB_20	;	NO -> HISCORE_SUB_20
		LDA	#00015H
		STA	R1
		LDA	#06490H
HISCORE_SUB_20	EQU	$
		STA	CCWORK0
		LDA	!SCRECNT
		AND	#000FFH
		STA	R2
		PLY
		LDA	!AICONBF1,X
		CLC
		ADC	MPCURSOL_MIN,Y
		DEC	A
		AND	#0007FH
		STA	R3
		LDA	#00100H
		STA	R11
;
		M_CHIP	AICONHKAITEN
;
		JSR	HISCORE_COL
;
		M8			; memory 8bit mode
		RTS
;
;
UN_HISCORE_SUB	EQU	$
		PHB
		PHK
		PLB
		JSR	HISCORE_SUB
		PLB
		RTL
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+		ハイスコア セット			+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HISCORE_SET_DT0 EQU	$
		WORD	021A8H,021A0H,021A2H,021A2H,021A3H
		WORD	021A4H,021A5H,021A6H,021A7H,0E1B5H
		WORD	021A9H,021AAH
;
HISCORE_SET_DT1 EQU	$
		WORD	021B8H,021B0H,021B1H,021B2H,021B3H
		WORD	021B4H,021B5H,021B6H,021B7H,0E1A5H
		WORD	021B9H,021BAH
;
;
HISCORE_SET	EQU	$
		LDY	!COSSCRE
		M16			; memory 16bit mode
		LDX	!MPTYPE
		TYA
		CLC
		ADC	WORLD_CORS,X
		AND	#000FFH
		STA	<WORK10
		TAY
		LDA	#00010
		STA	<WORK0
		INC	A
		STA	<WORK2
		LDA	!HISCEBF,Y
		AND	#000FFH
		CMP	#00100		; ハイスコア = 100 ?
		BCS	HISCORE_SET_40	;	YES -> HISCORE_SET_40
		STZ	<WORK0
HISCORE_SET_10	EQU	$
		CMP	#00010		; ハイスコア < 10 ?
		BCC	HISCORE_SET_20	;	YES -> HISCORE_SET_20
		SBC	#00010
		INC	<WORK0
		BRA	HISCORE_SET_10
HISCORE_SET_20	EQU	$
		STA	<WORK2
;
HISCORE_SET_40	EQU	$
		LDA	!COSSCRE	; ハイスコア表示 バッファ
		AND	#000FFH		;	ポジション セット
		ASL	A
		TAY
		LDA	AICON_BFAD,Y
		PHA
		LDX	!HOLDERFG
		BEQ	HISCORE_SET_45
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
HISCORE_SET_45	EQU	$
		CLC
		ADC	#00042H
		STA	<WORKA
		CLC
		ADC	#00040H
		STA	<WORKC
;
		LDA	#00C00H		; カラーＮＯ. セット !!
		STA	<WORK4
		LDY	<WORK10
		LDA	!HISCEBF,Y
		AND	#000FFH
		CMP	#00030		; ３０点以上か ?
		BCS	HISCORE_SET_60	;	YES -> HISCORE_SET_60
		LDA	#01000H
		STA	<WORK4
;
HISCORE_SET_60	EQU	$
		ASL	<WORK0
		ASL	<WORK2
		LDX	!MPTYPE
		LDA	WORLD_CORS,X
		STA	<WORK8
		LDY	#000H
		LDA	<WORK0		; 十の位 = 0 ?
		BNE	HISCORE_SET_65	;	NO -> HISCORE_SET_65
HISCORE_SET_63	EQU	$
		LDA	!COSSCRE
		AND	#000FFH
		CLC
		ADC	<WORK8
		TAX
		LDA	!COSSCRE
		AND	#000FFH
		CMP	#00008		; スペシャルアイコン点数チェック ?
		BNE	HISCORE_SET_635	;	NO -> HISCORE_SET_635
		LDA	!HISCEBF,X
		AND	#000FFH
		BEQ	HISCORE_SET_64
HISCORE_SET_635	EQU	$
		LDA	!MPCLRTBL,X
		AND	#0007FH		; コース クリア しているか ?
		BEQ	HISCORE_SET_64	;	NO -> HISCORE_SET_64
		LDA	#021AEH
		ORA	<WORK4
		STA	(<WORKA)
		STA	(<WORKC)
HISCORE_SET_64	EQU	$
		INC	<WORKA
		INC	<WORKA
		INC	<WORKC
		INC	<WORKC
		INY
		INY
HISCORE_SET_65	EQU	$
		LDA	!COSSCRE
		AND	#000FFH
		CLC
		ADC	<WORK8
		TAX
		LDA	!COSSCRE
		AND	#000FFH
		CMP	#00008		; スペシャルアイコン点数チェック ?
		BNE	HISCORE_SET_655	;	NO -> HISCORE_SET_655
		LDA	!HISCEBF,X
		AND	#000FFH
		BEQ	HISCORE_SET_68
HISCORE_SET_655	EQU	$
		LDA	!MPCLRTBL,X
		AND	#0007FH		; コース クリア しているか ?
		BEQ	HISCORE_SET_68	;	NO -> HISCORE_SET_68
		LDX	<WORK0,Y
		LDA	HISCORE_SET_DT0,X
		ORA	<WORK4
		STA	(<WORKA)
		LDA	HISCORE_SET_DT1,X
		ORA	<WORK4
		STA	(<WORKC)
HISCORE_SET_68	EQU	$
		CPY	#002
		BCC	HISCORE_SET_64
;
		LDA	#01C00H+00220H
		STA	<WORK4
		LDA	!HOLDERFG
		EOR	#00001H
		STA	!HOLDERFG
		JSR	HISCORE_DMA
		LDA	!HOLDERFG
		EOR	#00001H
		STA	!HOLDERFG
;
;--------------- ＢＧ１のホルダーのアイコン部分を消す -----------
		PLA
		LDX	!HOLDERFG
		BNE	HISCORE_SET_75
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
HISCORE_SET_75	EQU	$
		STA	<WORK0
		CLC
		ADC	#00040H
		STA	<WORK2
		CLC
		ADC	#00040H
		STA	<WORK4
;
		LDY	#000H
		LDA	#021BFH
HISCORE_SET_85	EQU	$
		STA	(<WORK0),Y
		STA	(<WORK2),Y
		STA	(<WORK4),Y
		INY
		INY
		CPY	#006H
		BCC	HISCORE_SET_85
;
		LDA	#01C00H+00020H
		STA	<WORK4
		JSR	HISCORE_DMA
;
		M8			; memory 8bit mode
		RTS
;
;
UN_HISCORE_SET	EQU	$
		PHB
		PHK
		PLB
		JSR	HISCORE_SET
		PLB
		RTL
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	ハイスコア スクリーン ＤＭＡ セット		+
;+			in				+
;+			work4,5 <- ＶＲＡＭアドレス	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		MEM16
HISCORE_DMA	EQU	$
		I16			; index 16bit mode
		LDA	#BANK HOLDERBF0
		STA	<WORK1		;(WK1) <- 転送元アドレス（Ｂ)
		LDA	!HOLDERFG
		AND	#00001H
		ASL	A
		TAY
		LDA	HLDRCHNG_DAT00,Y
		TAX			;(X)   <- 転送元アドレス（Ｌ，Ｈ)
		LDY	<WORK4		;(Y)   <- ＶＲＡＭアドレス
		LDA	#00380H		;(A)   <- 転送バイト数
		JSL	>VRAMDX_ST
		I8			; index 8bit mode
		RTS
		MEM8
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+		１００点 点滅				+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HI_FRSH_DAT	EQU	$
		WORD	00C00H,01000H
;
;
HISCRE_FRASH	EQU	$
		LDA	<FRCNT
		AND	#004
		LSR	A
		TAX
HI_FRASH_END	EQU	$
		M16			; memory 16bit mode
		STZ	<WORKE
		LDA	!HOLDERFG
		EOR	#00001
		STA	!HOLDERFG
		BNE	HI_FRASH_000
		LDA	#HOLDERBF1-HOLDERBF0
		STA	<WORKE
;
HI_FRASH_000	EQU	$
		LDA	HI_FRSH_DAT,X
		STA	<WORK10
		LDY	!MPTYPE
		LDA	WORLD_CORS,Y
		TAY
		LDX	#000
HI_FRASH_030	EQU	$
		LDA	!HISCEBF,Y
		AND	#000FFH
		CMP	#00100
		BNE	HI_FRASH_050
		JSR	HI_FRASH_CHG
HI_FRASH_050	EQU	$
		INY
		INX
		INX
		CPX	#009*2
		BNE	HI_FRASH_030
;
		LDA	#01E00H+00020H
		STA	<WORK4
		JSR	HISCORE_DMA
;
		M8				; memory 8bit mode
		LDA	!HOLDERFG
		EOR	#001
		STA	!HOLDERFG
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+		カラーチェンジ			+
;++++++++++++++++++++++++++++++++++++++++++++++++
		MEM16
HI_FRASH_CHG	EQU	$
		PHY
		LDA	AICON_BFAD,X
		CLC
		ADC	<WORKE
		STA	<WORK0
		CLC
		ADC	#00040H
		STA	<WORK2
		CLC
		ADC	#00040H
		STA	<WORK4
		CLC
		ADC	#00040H
		STA	<WORK6
		LDY	#000
HI_FH_CHG_020	EQU	$
		LDA	(<WORK0),Y
		AND	#0E3FFH
		ORA	<WORK10
		STA	(<WORK0),Y
		LDA	(<WORK2),Y
		AND	#0E3FFH
		ORA	<WORK10
		STA	(<WORK2),Y
		LDA	(<WORK4),Y
		AND	#0E3FFH
		ORA	<WORK10
		STA	(<WORK4),Y
		LDA	(<WORK6),Y
		AND	#0E3FFH
		ORA	<WORK10
		STA	(<WORK6),Y
		INY
		INY
		CPY	#004*2
		BCC	HI_FH_CHG_020
		PLY
		RTS
		MEM8
;
;
;****************************************************************
;*								*
;*		ハイスコア 表示					*
;*				キー入力待ち			*
;****************************************************************
HISCORE_400	EQU	$
		JSR	HISCRE_PUSH_OBJ
;
		JSR	HISCRE_FRASH
;
		LDA	<KEYC2L
		AND	#0C0H
		ORA	<KEYC2
		AND	#0D0H		; "A,B,X,Y,START" key ON ?
		BEQ	HISCORE_450
		INC	!HLDRMODE
		LDX	#000
		JSR	HI_FRASH_END
HISCORE_450	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア 表示					*
;*			アイコンを元にもどす イニシャル セット	*
;****************************************************************
HISCORE_500	EQU	$
		JSR	HISCRE_PUSH_OBJ
		STZ	!COSSCRE
HISCORE_5_SB	EQU	$
		INC	!HLDRMODE
		STZ	!SCRECNT
		JSR	BODAICON
		JSR	SCREAICON
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア 表示					*
;*				裏が見えている間		*
;****************************************************************
HISCORE_600	EQU	$
		JSR	HISCRE_PUSH_OBJ
HISCORE_6_SB	EQU	$
		JSR	HISCORE_SUB
		JSR	SCREAICON
		LDA	!SCRECNT
		CLC
		ADC	#010H
		STA	!SCRECNT
		BPL	HISCORE_690
		STZ	!SCREBOD
		INC	!HLDRMODE
HISCORE_690	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア 表示					*
;*				表が見えている間		*
;****************************************************************
HISCORE_700	EQU	$
		JSR	HISCRE_PUSH_OBJ
HISCORE_7_SB	EQU	$
		JSR	SCREAICON
		LDA	!SCRECNT
		SEC
		SBC	#010H
		STA	!SCRECNT
		BPL	HISCORE_750
		INC	!HLDRMODE
		BRA	HISCORE_790
HISCORE_750	EQU	$
		JSR	HISCORE_SUB
HISCORE_790	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア 表示					*
;*				ＥＮＤ処理			*
;****************************************************************
HISCORE_800	EQU	$
		JSR	HISCRE_PUSH_OBJ
		JSR	AICON_CANBAK
		STZ	!SCRECNT
		LDA	!MPTYPE
		LSR	A
		TAX
HISCORE_850	EQU	$
		INC	!COSSCRE
		LDA	!COSSCRE
		CMP	#009
		BCS	HISCORE_880
		CLC
		ADC	MPCURSOL_MIN,X
		TAY
		LDA	!AICONBF1,Y
		BEQ	HISCORE_850
		CMP	#0F0H
		BEQ	HISCORE_880
		INC	!SCREBOD
		DEC	!HLDRMODE
		DEC	!HLDRMODE
		JSR	HISCORE_SUB
		JSR	BODAICON
		JSR	SCREAICON
		BRA	HISCORE_890
HISCORE_880	EQU	$
		LDA	#080H		; ハイスコア 表示 終了 !!
		STA	<SCCV2		;
		STZ	<SCCH2		;
		STZ	!HLDRMODE	;
		LDA	#032H
		STA	>MPHDMA4+1	; ウィンドゥ ＯＮ !!
HISCORE_890	EQU	$
		RTS
;
;
HISCORE_8_SB	EQU	$
		JSR	AICON_CANBAK
		STZ	!SCRECNT
		LDA	#080H		; ハイスコア 表示 終了 !!
		STA	<SCCV2		;
		STZ	<SCCH2		;
		INC	!HLDRMODE
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+	白黒カラー チェック ＆ セット			+
;+				in			+
;+				wrk10 : カーソルポイント+
;+				out			+
;+				wrk10 : ＡＴＲ Ｎｏ.	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MONO_COL_CHK	EQU	$
		PHP
		MI16			; memory , index 16bit mode
		PHX
		LDX	!MPTYPE
		LDA	WORLD_CORS,X
		CLC
		ADC	<WORK10
		TAX
		LDA	!MPCLRTBL,X
		AND	#00080H
		BEQ	MONO_COL_CHK_99
		LDA	#01400H
MONO_COL_CHK_99 EQU	$
		STA	<WORK10
		PLX
		PLP
		RTS
		MEM8
		IDX8
;
UN_MONO_COL_CHK EQU	$
		JSR	MONO_COL_CHK
		RTL
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+	アイコンをホルダーにセットしなおす		+
;+				in			+
;+				A <- アイコンＮＯ.	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICON_CANBAK	EQU	$
		M16			; memory 16bit mode
		LDX	!MPTYPE
		LDA	AICON_ATR,X
		STA	<WORK2
		LDA	!COSSCRE
		AND	#000FFH
		TAY
		ASL	A
		TAX
		PHX
		LDA	!AICONBF1,Y
		DEC	A
		AND	#000FFH
		STA	<WORK10
		ASL	A
		TAY
		JSR	MONO_COL_CHK
		LDA	<WORK10
		BNE	AICON_CANBAK_30
		LDA	(<WORK2),Y
AICON_CANBAK_30 EQU	$		; アイコン
		ORA	AICON_DTAD,Y	;   キャラクターＮＯ. セット
		LDX	!HOLDERFG	;
		BNE	AICON_CANBAK_40 ;
		ORA	#00080H		;
AICON_CANBAK_40 EQU	$		;
		STA	<WORK0		;
		PLX
		LDA	AICON_BFAD,X
		LDX	!HOLDERFG
		BNE	AICON_CANBAK_50
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
AICON_CANBAK_50 EQU	$
		STA	<WORKA
		CLC
		ADC	#00040H
		STA	<WORKC
		CLC
		ADC	#00040H
		STA	<WORKE
		JSR	AICONSET_SUB
;
		LDA	#01C00H+00020H
		STA	<WORK4
		JSR	HISCORE_DMA
		M8			; memory 8bit mode
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+						+
;+	ボード アイコン セット			+
;+						+
;++++++++++++++++++++++++++++++++++++++++++++++++
BODAICON	EQU	$
		M16			; memory 16bit mode
		LDA	!COSSCRE
		ASL	A
		TAY
		LDA	AICON_BFAD,Y
		LDX	!HOLDERFG
		BNE	BODAICON_100
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
BODAICON_100	EQU	$
		STA	<WORK0
		CLC
		ADC	#00040H
		STA	<WORK2
		CLC
		ADC	#00040H
		STA	<WORK4
;
		LDX	!MPTYPE
		LDA	AICNNUK_ATL,X
		STA	<WORK6
		LDY	#000H
BODAICON_210	EQU	$
		LDA	!COSSCRE
		CMP	#00004-1
		BEQ	BODAICON_220
		CMP	#00008-1
		BEQ	BODAICON_220
		JSR	AICNNUKI_CLS
		BRA	BODAICON_230
BODAICON_220	EQU	$
		JSR	AICNBETA_CLS
BODAICON_230	EQU	$
		INY
		INY
		CPY	#00003*2
		BCC	BODAICON_210
;
		LDA	#01C00H+00020H
		STA	<WORK4
		JSR	HISCORE_DMA
		M8			; memory 8bit mode
		LDA	#036H
		JSL	>SOUND_3_ON	; sound set!!
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+	ハイスコア 表示用 回転アイコン オブジェセット	+
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SCREAICON	EQU	$
		MI16			; memory , index 16bit mode
		LDX	!OAMIDX
		LDA	!COSSCRE
		AND	#000FFH
		ASL	A
		TAY
		LDA	MPCSLSET_DAT,Y	;アドレス セット
		AND	#000FFH
		SEC
		SBC	#00010H
		STA	!SOAM_DX+0,X
		STA	!SOAM_DX+16,X
		CLC
		ADC	#00010H
		STA	!SOAM_DX+8,X
		STA	!SOAM_DX+24,X
		LDA	MPCSLSET_DAT+1,Y
		AND	#000FFH
		SEC
		SBC	#00016H
		STA	!SOAM_DX+2,X
		STA	!SOAM_DX+10,X
		CLC
		ADC	#00010H
		STA	!SOAM_DX+18,X
		STA	!SOAM_DX+26,X
;
		STZ	<WORK2
		LDY	!MPTYPE
		PHY
		LDA	!COSSCRE
		AND	#000FFH
		CLC
		ADC	WORLD_CORS,Y
		TAY
		LDA	!HISCEBF,Y
		AND	#000FFH
		CMP	#00030		; ３０点以上の得点か ?
		BCS	SCREAICON_130	;	YES -> SCREAICON_130
		LDA	!COSSCRE
		AND	#000FFH
		CMP	#00008		;スペシャルアイコン点数チェック ?
		BNE	SCREAICON_120	;	NO -> SCREAICON_120
		LDA	!HISCEBF,Y
		AND	#000FFH
		BEQ	SCREAICON_130
SCREAICON_120	EQU	$
		LDA	!MPCLRTBL,Y
		AND	#0007FH		; コースクリア しているか ?
		BEQ	SCREAICON_130	;	NO -> SCREAICON_130
		INC	<WORK2
;
SCREAICON_130	EQU	$
		PLY
		LDA	AICON_ATR,Y
		STA	<WORK0
		LDA	!COSSCRE
		AND	#000FFH
		TAY
		LDA	AICONBF1,Y
		DEC	A
		AND	#000FFH
		STA	<WORK10
		ASL	A
		TAY
		LDA	!SCREBOD
		AND	#000FFH		; アイコン裏側セット ?
		BEQ	SCREAICON_150	;	NO -> SCREAICON_150
		PHX
		LDX	#031E0H
		LDA	<WORK2
		BEQ	SCREAICON_140
		LDX	#033E0H
SCREAICON_140	EQU	$
		TXA
		PLX
		BRA	SCREAICON_160
;
SCREAICON_150	EQU	$		; アイコンの
		JSR	MONO_COL_CHK	;	アトリビュート セット
		LDA	<WORK10		;
		BNE	SCREAICON_155	;
		LDA	(<WORK0),Y	;
SCREAICON_155	EQU	$		;
		LSR	A		;
		SEC
		SBC	#00600H
		ORA	#031E0H
SCREAICON_160	EQU	$		;キャラクター セット
		STA	!SOAM_DX+4,X
		INC	A
		INC	A
		STA	!SOAM_DX+12,X
		INC	A
		INC	A
		STA	!SOAM_DX+20,X
		INC	A
		INC	A
		STA	!SOAM_DX+28,X
;
		LDA	#04002H		;サイズ
		STA	!SOAM_DX+6,X	;  ＯＢＪ優先順位
		STA	!SOAM_DX+14,X
		STA	!SOAM_DX+22,X
		STA	!SOAM_DX+30,X
;
		TXA
		CLC
		ADC	#00032
		STA	!OAMIDX
;
		MI8			; memory , index 8bit mode
		RTS
;
;
;****************************************************************
;*								*
;*		ハイスコア表示 デモ用				*
;*				in				*
;*				X <- データ インデックス	*
;****************************************************************
UN_HISCORE_ADR	EQU	$
		WORD	HISCORE_0_SB,HISCORE_1_SB
		WORD	HISCORE_2_SB,HISCORE_3_SB
UN_HISCORE_DM	EQU	$-2
		WORD	HISCORE_5_SB,HISCORE_6_SB
		WORD	HISCORE_7_SB,HISCORE_8_SB
UN_HISCORE_END	EQU	$
;
UN_HISCR_DM	EQU	(UN_HISCORE_DM-UN_HISCORE_ADR)
UN_HISCR_END	EQU	(UN_HISCORE_END-UN_HISCORE_ADR)
;
;
UN_HISCORE	EQU	$
		PHB
		PHK
		PLB
		JSR	(UN_HISCORE_ADR,X)
		PLB
		RTL
;
;
;****************************************************************
;*								*
;*		ホルダー セット ルーチン			*
;*								*
;*				HOLDERFG <- 0 : BG1		*
;*					    1 : BG2		*
;****************************************************************
HOLDERSET	EQU	$
		LDX	#000H		; ホルダーアイコン
		TXY			;	バッファ セット
HOLDERSET_000	EQU	$
		M16			; memory 16bit mode
		LDA	!MPCLRTBL+00H,Y
		ORA	!MPCLRTBL+02H,Y
		ORA	!MPCLRTBL+04H,Y
		ORA	!MPCLRTBL+06H,Y
		STA	<WORK0
		M8			; memory 8bit mode
		LDA	<WORK0
		ORA	<WORK1
		STA	!WORK10,X
		TYA
		CLC
		ADC	#00012
		TAY
		INX
		CPX	#007
		BCC	HOLDERSET_000
;
		LDX	!NTHLDRFG
		INC	!WORK10,X
;
		MI16			; memory , index 16bit mode
		LDX	#00000H
		LDA	#019BFH
HOLDERSET_080	EQU	$
		STA	!HOLDERBF0+(20H*2),X
		STA	!HOLDERBF1+(20H*2),X
		INX
		INX
		CPX	#00020H*2
		BCC	HOLDERSET_080
;
		STZ	!CLR_WOLD
		LDX	#00000H
		TXY
HOLDERSET_100	EQU	$		; ホルダーアイコン セット
		LDA	!WORK10,Y
		AND	#000FFH
		BEQ	HOLDERSET_150
		INC	!CLR_WOLD
		LDA	HOLDER_TOP0+0,X
		STA	!HOLDERBF0+(20H*2)+(04H*2)+0,X
		STA	!HOLDERBF1+(20H*2)+(04H*2)+0,X
		LDA	HOLDER_TOP0+2,X
		STA	!HOLDERBF0+(20H*2)+(04H*2)+2,X
		STA	!HOLDERBF1+(20H*2)+(04H*2)+2,X
		LDA	HOLDER_TOP0+4,X
		STA	!HOLDERBF0+(20H*2)+(04H*2)+4,X
		STA	!HOLDERBF1+(20H*2)+(04H*2)+4,X
		LDA	HOLDER_TOP0+6,X
		STA	!HOLDERBF0+(20H*2)+(04H*2)+6,X
		STA	!HOLDERBF1+(20H*2)+(04H*2)+6,X
HOLDERSET_150	EQU	$
		INY
		TXA
		CLC
		ADC	#00008
		TAX
		CPX	#HOLDER_NO1U-HOLDER_TOP0
		BNE	HOLDERSET_100
;
;----------------------------------------------------------------
HOLDERSET_190	EQU	$
		LDX	!MPTYPE
		LDA	HOLDER_DAT0,X	; up data address set
		STA	<WORK0
		LDA	AICNNUK_ATL,X	; アトリビュート セット
		STA	<WORK2
		LDX	#00000H
		TXY
		LDA	!HOLDERFG	; buffer address set
		AND	#00001H
		BEQ	HOLDERSET_200
		LDX	#HOLDERBF1-HOLDERBF0
HOLDERSET_200	EQU	$
		STX	<WORK10
HOLDERSET_220	EQU	$
		LDA	(<WORK0),Y	; up data set
		STA	!HOLDERBF0+(20H*2)*2,X
;
		LDA	HOLDER_NO1D,Y	; down data set
		ORA	<WORK2
		STA	!HOLDERBF0+(20H*2)*12,X
;
		INX
		INX
		INY
		INY
		CPY	#00040H
		BCC	HOLDERSET_220
;
		LDA	#00009		; mid data set
		STA	<WORKE
HOLDERSET_300	EQU	$
		LDY	#00000H
HOLDERSET_350	EQU	$
		LDA	HOLDER_NO1M,Y
		ORA	<WORK2
		STA	!HOLDERBF0+80H,X
		INX
		INX
		INY
		INY
		CPY	#00040H
		BCC	HOLDERSET_350
		DEC	<WORKE
		BNE	HOLDERSET_300
;
;--------------- 白ベタ セット ---------------------------------
		LDX	<WORK10
		LDY	#00000
HOLDERSET_430	EQU	$
		LDA	SIRO_BETA0,Y
		STA	!HOLDERBF0+(040H*7)+(14H*2),X
		LDA	SIRO_BETA1,Y
		STA	!HOLDERBF0+(040H*8)+(14H*2),X
		STA	!HOLDERBF0+(040H*9)+(14H*2),X
		STA	!HOLDERBF0+(040H*10)+(14H*2),X
		LDA	SIRO_BETA2,Y
		STA	!HOLDERBF0+(040H*11)+(14H*2),X
		INX
		INX
		INY
		INY
		CPY	#SIRO_BETA1-SIRO_BETA0
		BCC	HOLDERSET_430
;
;--------------- "―" セット -----------------------------------
		LDA	#021F9H
		ORA	<WORK2
		STA	!HOLDERBF0+004*40H+007H*2
		STA	!HOLDERBF1+004*40H+007H*2
		STA	!HOLDERBF0+004*40H+00BH*2
		STA	!HOLDERBF1+004*40H+00BH*2
		STA	!HOLDERBF0+004*40H+017H*2
		STA	!HOLDERBF1+004*40H+017H*2
		STA	!HOLDERBF0+004*40H+01BH*2
		STA	!HOLDERBF1+004*40H+01BH*2
		STA	!HOLDERBF0+009*40H+003H*2
		STA	!HOLDERBF1+009*40H+003H*2
;
;--------------- アイコン ＮＯ. セット -------------------------
		LDX	#00000H
		LDY	#AICON_NOAD0
		LDA	!HOLDERFG
		AND	#00001H
		BEQ	HOLDERSET_520
		LDY	#AICON_NOAD1
HOLDERSET_520	EQU	$
		STY	<WORK0
		LDY	!MPTYPE
HOLDERSET_530	EQU	$
		LDA	(<WORK0)	; １〜８ セット
		STA	<WORK4
		INC	A
		INC	A
		STA	<WORK6
		INC	A
		INC	A
		STA	<WORK8
		LDA	HOLDER_NO,Y
		ORA	<WORK2
		STA	(<WORK4)
		LDA	#0218DH
		ORA	<WORK2
		STA	(<WORK6)
		LDA	HOLDER_NO,X
		ORA	<WORK2
		STA	(<WORK8)
		INC	<WORK0
		INC	<WORK0
		INX
		INX
		CPX	#AICON_NOAD1-AICON_NOAD0
		BCC	HOLDERSET_530
;
;--------------- ボスコース アイコン ワク セット ----------------
		LDX	<WORK10
		LDY	#00000
HOLDERSET_550	EQU	$
		LDA	!MPTYPE
		CMP	#(00003-1)*2
		BEQ	HOLDERSET_560
		CMP	#(00004-1)*2
		BEQ	HOLDERSET_570
		LDA	BOS_AICN_DT00,Y
		BRA	HOLDERSET_580
HOLDERSET_560	EQU	$
		LDA	BOS_AICN_DT02,Y
		BRA	HOLDERSET_580
HOLDERSET_570	EQU	$
		LDA	BOS_AICN_DT03,Y
HOLDERSET_580	EQU	$
		ORA	<WORK2
		STA	!AICONBF03-(1*2+1*40H),X
		LDA	BOS_AICN_DT01,Y
		ORA	<WORK2
		STA	!AICONBF07-(1*2+1*40H),X
		LDA	BOS_AICN_DT1,Y
		ORA	<WORK2
		STA	!AICONBF03-1*2+0*40H,X
		STA	!AICONBF07-1*2+0*40H,X
		LDA	BOS_AICN_DT20,Y
		ORA	<WORK2
		STA	!AICONBF03-1*2+1*40H,X
		LDA	BOS_AICN_DT21,Y
		ORA	<WORK2
		STA	!AICONBF07-1*2+1*40H,X
		LDA	BOS_AICN_DT3,Y
		ORA	<WORK2
		STA	!AICONBF03-1*2+2*40H,X
		STA	!AICONBF07-1*2+2*40H,X
		LDA	BOS_AICN_DT40,Y
		ORA	<WORK2
		STA	!AICONBF03-1*2+3*40H,X
		LDA	BOS_AICN_DT41,Y
		ORA	<WORK2
		STA	!AICONBF07-1*2+3*40H,X
		INX
		INX
		INY
		INY
		CPY	#BOS_AICN_DT01-BOS_AICN_DT00
		BCC	HOLDERSET_550
;
		LDX	<WORK10
		LDA	!MPTYPE
		LSR	A
		ORA	#021E0H
		ORA	<WORK2
		STA	!AICONBF03+3*40H,X
		STA	!AICONBF07+3*40H,X
;
;--------------- ？マーク セット -------------------------------
		LDX	<WORK10
		LDY	#00000
HOLDERSET_650	EQU	$
		LDA	Q_DATA+0*2,Y
		ORA	<WORK2
		STA	!AICONBF08+0*40H,X
		STA	!AICONBF09+0*40H,X
		LDA	Q_DATA+3*2,Y
		ORA	<WORK2
		STA	!AICONBF08+1*40H,X
		STA	!AICONBF09+1*40H,X
		LDA	Q_DATA+6*2,Y
		ORA	<WORK2
		STA	!AICONBF08+2*40H,X
		STA	!AICONBF09+2*40H,X
		INX
		INX
		INY
		INY
		CPY	#003*2
		BCC	HOLDERSET_650
;
;--------------- オール１００点チェック ------------------------
		LDA	!MODENO
		CMP	#HMPDM
		BCS	HOLDERSET_790
		LDX	!MPTYPE
		LDA	>WORLD_CORS,X
		TAX
		STA	<WORK2
		LDA	!AICONBF1+8,X	; すでにスペシャルアイコンが
		CMP	#00A09H		;	でているか ?
		BEQ	HOLDERSET_790	;	YES -> HOLDERSET_790
		LDY	#008
		STZ	<WORK0
HOLDERSET_750	EQU	$
		LDA	!HISCEBF,X
		AND	#000FFH
		CLC
		ADC	<WORK0
		STA	<WORK0
		INX
		DEY
		BNE	HOLDERSET_750
		LDA	<WORK0
		CMP	#00100*8
		BCC	HOLDERSET_790
		LDX	<WORK2
		LDA	#00A09H
		STA	!AICONBF1+8,X
		LDA	#00101H
		STA	!MPCLRTBL+8,X
;
HOLDERSET_790	EQU	$
		I8			; index 8bit mode
;
		LDA	!MPTYPE		; キャラクター
		STA	R9		;	ＶＲＡＭ セット
		TAX
		LDA	#BANK CMODE_DATA
		STA	!CCWORK0
		LDA	CMODE_DATA,X
		STA	!CCWORK1
		M_CHIP	MPCHRVRMST
;
		LDA	#00015H
		STA	R0
		LDX	!CONFIGFG
		LDA	CNFG_ADR,X
		STA	R10
		M_CHIP	CNFGAICN
		M8			; memory 8bit mode
;
;
;****************************************************************
;*								*
;*		アイコン セット ルーチン			*
;*								*
;****************************************************************
AICONSET	EQU	$
		JSR	AICNNUK		; ヌキアイコン セット
;
		LDA	!MPTYPE
		LSR	A
		TAX
		LDA	MPCURSOL_MIN,X
		TAY
;
		M16			; memory 16bit mode
		LDA	!AICONBF1+8,Y
		CMP	#00A09H
		BEQ	SPL_AICN_PS
		LDA	#0F0F0H
		STA	!AICONBF1+8,Y
;
SPL_AICN_PS	EQU	$
		LDX	!MPTYPE
		LDA	AICON_ATR,X	;アイコン アトリビュート
		STA	<WORK4		;	データ アドレス セット
		LDA	#0000CH
		STA	<WORK8
		STZ	<WORK6
AICONSET_100	EQU	$
		LDA	!AICONBF1,Y
		AND	#000FFH
		CMP	#000F0H		; 点線を書くか ?
		BEQ	AICONSET_150	;	NO -> AICONSET_150
		AND	#0007FH		; アイコンあるか ?
		BEQ	AICONSET_150	;	NO -> AICONSET_150
		DEC	A
		STA	<WORK10
		ASL	A
		TAX
		PHY
		LDA	AICON_DTAD,X
		LDY	!HOLDERFG
		BEQ	AICONSET_110
		ORA	#00080H
AICONSET_110	EQU	$
		STA	<WORK0
		LDA	<WORK10
		CMP	#00008		; コース アイコン セット ?
		BCS	AICONSET_115	;	NO -> AICONSET_115
		JSR	MONO_COL_CHK
		LDA	<WORK10
		BNE	AICONSET_118
AICONSET_115	EQU	$
		TXY
		LDA	(<WORK4),Y
AICONSET_118	EQU	$
		ORA	<WORK0
		STA	<WORK0
		LDX	<WORK6
		LDA	AICON_BFAD,X	; アイコン セット アドレス
		LDY	!HOLDERFG
		BEQ	AICONSET_120
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
AICONSET_120	EQU	$
		STA	<WORKA
		CLC
		ADC	#00040H
		STA	<WORKC
		CLC
		ADC	#00040H
		STA	<WORKE
		JSR	AICONSET_SUB	; アイコン セット サブルーチン
		PLY
AICONSET_150	EQU	$
		INC	<WORK6
		INC	<WORK6
		INY
		DEC	<WORK8
		BNE	AICONSET_100
;
		M8			; memory 8bit mode
		LDA	!HOLDERFG
		EOR	#00001H
		AND	#00001H
		STA	!HOLDERFG
		RTS
;
CMODE_DATA	EQU	$
		WORD	CMODE_DAT1,CMODE_DAT2,CMODE_DAT3
		WORD	CMODE_DAT4,CMODE_DAT5,CMODE_DAT6
;
CMODE_DAT1	EQU	$
		HEX	011H,011H,011H,011H,011H,011H	;1
		HEX	011H,011H,011H,015H,015H,015H
;
CMODE_DAT2	EQU	$
		HEX	011H,011H,011H,011H,011H,011H	;2
		HEX	011H,011H,011H,015H,015H,015H
;
CMODE_DAT3	EQU	$
		HEX	011H,011H,011H,011H,011H,011H	;3
		HEX	011H,011H,011H,015H,015H,015H
;
CMODE_DAT4	EQU	$
		HEX	011H,011H,011H,011H,011H,011H	;4
		HEX	011H,011H,011H,015H,015H,015H
;
CMODE_DAT5	EQU	$
		HEX	015H,015H,015H,015H,015H,015H	;5
		HEX	015H,015H,015H,015H,015H,015H
;
CMODE_DAT6	EQU	$
		HEX	015H,015H,015H,015H,015H,015H	;6
		HEX	015H,015H,015H,015H,015H,015H
;
CMODE_DAT7	EQU	$
		HEX	011H,011H,011H,011H,011H,011H	; コンフィグ用
		HEX	011H,011H,011H,011H,011H,015H
;
CNFG_ADR	EQU	$	;コンフィグ タイプ別 アイコン アドレス
		WORD	0643CH
		WORD	06458H
		WORD	06474H
;
;
;--------------------------------------------------------
;-		アイコン セット サブルーチン		-
;-			in				-
;-			work0,1 <- アイコン データ	-
;-			    a,b <- アイコン		-
;-			    c,d <-   データ セット	-
;-			    e,f <-	アドレス	-
;--------------------------------------------------------
		MEM16
AICONSET_SUB	EQU	$
		LDY	#00000H
AICONSUB_LOP	EQU	$
		TYA
		LSR	A
		CLC
		ADC	<WORK0
		STA	(<WORKA),Y
		INC	A
		INC	A
		INC	A
		STA	(<WORKC),Y
		INC	A
		INC	A
		INC	A
		STA	(<WORKE),Y
		INY
		INY
		CPY	#006H
		BCC	AICONSUB_LOP
		RTS
;
;
UN_AICONSET_SUB EQU	$
		JSR	AICONSET_SUB
		RTL
;
;
		MEM8
;
;
AICON_DTAD	EQU	$
		WORD	02000H,02009H,02012H,0201BH,02024H,0202DH,02036H
		WORD	0203FH,02048H,02051H,0205AH,02070H,0206CH,02075H
;
AICON_ATR	EQU	$
		WORD	AICON_ATR0,AICON_ATR1,AICON_ATR2,AICON_ATR3
		WORD	AICON_ATR4,AICON_ATR5
;
AICON_ATR0	EQU	$	; 1 world
		WORD	00C00H,01000H,01000H,00C00H,00C00H,00C00H
		WORD	01000H,01000H,00C00H,00C00H,01800H,01800H
;
AICON_ATR1	EQU	$	; 2 world
		WORD	00C00H,01000H,01000H,01000H,00C00H,01000H
		WORD	00C00H,00C00H,00C00H,00C00H,01800H,01800H
;
AICON_ATR2	EQU	$	; 3 world
		WORD	01000H,00C00H,00C00H,00C00H,00C00H,00C00H
		WORD	01000H,01000H,00C00H,00C00H,01800H,01800H
;
AICON_ATR3	EQU	$	; 4 world
		WORD	00C00H,01000H,00C00H,00C00H,01000H,00C00H
		WORD	00C00H,00C00H,00C00H,00C00H,01800H,01800H
;
AICON_ATR4	EQU	$	; 5 world
		WORD	00C00H,01000H,00C00H,01000H,00C00H,00C00H
		WORD	01000H,00C00H,00C00H,00C00H,01800H,01800H
;
AICON_ATR5	EQU	$	; 6 world
		WORD	00C00H,00C00H,01000H,01000H,00C00H,00C00H
		WORD	01000H,00C00H,00C00H,00C00H,01800H,01800H
;
HOLDER_NO	EQU	$
		WORD	02190H,02191H,02192H,02193H,02194H,02195H
		WORD	02196H,02197H
;
AICON_BFAD	EQU	$
		WORD	AICONBF00,AICONBF01,AICONBF02,AICONBF03
		WORD	AICONBF04,AICONBF05,AICONBF06,AICONBF07
		WORD	AICONBF08,AICONBF09,AICONBF0A,AICONBF0B
;
AICON_NOAD0	EQU	$
		WORD	AICNOPS00,AICNOPS01,AICNOPS02,AICNOPS03
		WORD	AICNOPS04,AICNOPS05,AICNOPS06,AICNOPS07
;
AICON_NOAD1	EQU	$
		WORD	AICNOPS10,AICNOPS11,AICNOPS12,AICNOPS13
		WORD	AICNOPS14,AICNOPS15,AICNOPS16,AICNOPS17
;
HOLDER_DAT0	EQU	$
		WORD	HOLDER_NO1U,HOLDER_NO2U,HOLDER_NO3U
		WORD	HOLDER_NO4U,HOLDER_NO5U,HOLDER_NO6U
;
;--------------------------------------- ホルダー トップ データ
HOLDER_TOP0	EQU	$
		WORD	02D86H,02D8FH,02D80H,06D86H,03186H,0318FH
		WORD	03181H,07186H,03586H,0358FH,03582H,07586H
		WORD	02186H,0218FH,02183H,06186H,02586H,0258FH
		WORD	02584H,06586H,02986H,0298FH,02985H,06986H
;
;--------------------------------------- ホルダー ＮＯ.１ データ
HOLDER_NO1U	EQU	$
		WORD	039BFH,039BFH,0AD99H,02D8FH,02D8EH,02D8EH,02D8EH,02D8EH
		WORD	02D8FH,02D8FH,02D8FH,02D8FH,02D8FH,02D8FH,02D8FH,02DE2H
		WORD	02DE3H,02DE3H,02DE3H,06DE2H,02D8FH,02D8FH,02D8FH,02D8FH
		WORD	02D8FH,02D8FH,02D8FH,02D8FH,02D8FH,0ED99H,039BFH,039BFH
;
HOLDER_NO1M	EQU	$
		WORD	039BFH,039BFH,02198H,0218EH,0218EH,0218EH,0218EH,0218EH
		WORD	0218EH,0218EH,0218EH,0218EH,0218EH,0218EH,0218EH,0218EH
		WORD	0218EH,0218EH,0218EH,0218EH,0218EH,0218EH,0218EH,0218EH
		WORD	0218EH,0218EH,0218EH,0218EH,0218EH,06198H,039BFH,039BFH
;
HOLDER_NO1D	EQU	$
		WORD	039BFH,039BFH,021A1H,021AFH,021AFH,021AFH,021AFH,021AFH
		WORD	021AFH,021AFH,021AFH,021AFH,021AFH,021AFH,021AFH,021AFH
		WORD	021AFH,021AFH,021AFH,021AFH,021AFH,021AFH,021AFH,021AFH
		WORD	021AFH,021AFH,021AFH,021AFH,021AFH,061A1H,039BFH,039BFH
;
;--------------------------------------- ホルダー ＮＯ.２ データ
HOLDER_NO2U	EQU	$
		WORD	039BFH,039BFH,0B199H,0318FH,0318FH,0318FH,0318FH,0318FH
		WORD	0318EH,0318EH,0318EH,0318EH,0318FH,0318FH,0318FH,031E2H
		WORD	031E3H,031E3H,031E3H,071E2H,0318FH,0318FH,0318FH,0318FH
		WORD	0318FH,0318FH,0318FH,0318FH,0318FH,0F199H,039BFH,039BFH
;
;--------------------------------------- ホルダー ＮＯ.３ データ
HOLDER_NO3U	EQU	$
		WORD	039BFH,039BFH,0B599H,0358FH,0358FH,0358FH,0358FH,0358FH
		WORD	0358FH,0358FH,0358FH,0358FH,0358EH,0358EH,0358EH,035E4H
		WORD	035E3H,035E3H,035E3H,075E2H,0358FH,0358FH,0358FH,0358FH
		WORD	0358FH,0358FH,0358FH,0358FH,0358FH,0F599H,039BFH,039BFH
;
;--------------------------------------- ホルダー ＮＯ.４ データ
HOLDER_NO4U	EQU	$
		WORD	039BFH,039BFH,0A199H,0218FH,0218FH,0218FH,0218FH,0218FH
		WORD	0218FH,0218FH,0218FH,0218FH,0218FH,0218FH,0218FH,021E2H
		WORD	021E5H,021E5H,021E5H,061E4H,0218FH,0218FH,0218FH,0218FH
		WORD	0218FH,0218FH,0218FH,0218FH,0218FH,0E199H,039BFH,039BFH
;
;--------------------------------------- ホルダー ＮＯ.５ データ
HOLDER_NO5U	EQU	$
		WORD	039BFH,039BFH,0A599H,0258FH,0258FH,0258FH,0258FH,0258FH
		WORD	0258FH,0258FH,0258FH,0258FH,0258FH,0258FH,0258FH,025E2H
		WORD	025E3H,025E3H,025E3H,065E2H,0258EH,0258EH,0258EH,0258EH
		WORD	0258FH,0258FH,0258FH,0258FH,0258FH,0E599H,039BFH,039BFH
;
;--------------------------------------- ホルダー ＮＯ.６ データ
HOLDER_NO6U	EQU	$
		WORD	039BFH,039BFH,0A999H,0298FH,0298FH,0298FH,0298FH,0298FH
		WORD	0298FH,0298FH,0298FH,0298FH,0298FH,0298FH,0298FH,029E2H
		WORD	029E3H,029E3H,029E3H,069E2H,0298FH,0298FH,0298FH,0298FH
		WORD	0298EH,0298EH,0298EH,0298EH,0298FH,0E999H,039BFH,039BFH
;
SIRO_BETA0	EQU	$
		WORD	0399FH,0398FH,0398FH,0398FH,0398FH
		WORD	0398FH,0398FH,0398FH,0799FH
;
SIRO_BETA1	EQU	$
		WORD	03998H,0398EH,0398EH,0398EH,0398EH
		WORD	0398EH,0398EH,0398EH,07998H
;
SIRO_BETA2	EQU	$
		WORD	0B99FH,0B98FH,0B98FH,0B98FH,0B98FH
		WORD	0B98FH,0B98FH,0B98FH,0F99FH
;
Q_DATA		EQU	$
		WORD	02187H,021F0H,06187H
		WORD	021F1H,021F2H,021F3H
		WORD	0A187H,021F4H,0E187H
;
BOS_AICN_DT00	EQU	$
		WORD	021E8H,021E9H,021EAH,061E9H,061E8H
;
BOS_AICN_DT01	EQU	$
		WORD	021EBH,021ECH,021EDH,061ECH,061EBH
;
BOS_AICN_DT02	EQU	$
		WORD	021EBH,021E9H,021EAH,061E9H,061E8H
;
BOS_AICN_DT03	EQU	$
		WORD	021E8H,021FAH,021FBH,061FAH,061EBH
;
BOS_AICN_DT1	EQU	$
		WORD	021EFH,021F5H,021F5H,021F5H,061EFH
;
BOS_AICN_DT20	EQU	$
		WORD	061F8H,021F7H,021F7H,021F7H,021F8H
;
BOS_AICN_DT21	EQU	$
		WORD	061F8H,021F7H,021F7H,021F7H,061EFH
;
BOS_AICN_DT3	EQU	$
		WORD	021EFH,021F7H,021F6H,021F7H,061EFH
;
BOS_AICN_DT40	EQU	$
		WORD	021EEH,021E0H,021E6H,021E3H,061EEH
;
BOS_AICN_DT41	EQU	$
		WORD	021EEH,021E0H,021E6H,021E7H,061EEH
;
;
;****************************************************************
;*								*
;*	マップカーソル 移動ルーチン				*
;*								*
;****************************************************************
MPCURSOL	EQU	$
		LDA	!KEYA1
		AND	#00100000B		; セレクトキー ＯＮ ?
		BEQ	MPCURSOL_000_00		;	NO --> MPCURSOL_000_00
		JMP	MPCURSOL_400		;	YES -> MPCURSOL_400
;
MPCURSOL_000_00 EQU	$
		LDA	<KEYC2L
		AND	#0C0H
		ORA	<KEYC2		; "A" or "B" or "START"
		AND	#0D0H		; "X" or "Y" キーＯＮ ?
		BEQ	MPCURSOL_000	;	NO -> MPCURSOL_000
		LDA	!CORSLPT
		CMP	#010		; カーソル位置 スコア ?
		BNE	MPCURSOL_000_1	;	NO -> MPCURSOL_000_1
		LDA	#SCRE		; ハイスコア表示
		STA	!HLDRMODE	;	モード ＯＮ!!
		JMP	MPCURSOL_900
;
MPCURSOL_000_1	EQU	$
		CMP	#011		; カーソル位置 コンフィグ ?
		BNE	MPCURSOL_000	;	NO -> MPCURSOL_000
		LDA	#CNFG
		STA	!HLDRMODE
		JMP	MPCURSOL_900
;
MPCURSOL_000	EQU	$
		LDA	<KEYC2L
		AND	#0C0H
		ORA	<KEYC2		; "A" or "B" or "START"
		AND	#0D0H		; "X" or "Y" キーＯＮ ?
		BEQ	MPCURSOL_100	;	NO -> MPCURSOL_100
;;;;K;;;;MPCURSOL_050	EQU	$
;;;;K;;;;		LDA	<KEYC2
;;;;K;;;;		AND	#090H		; "B"or"start" key ON ?
;;;;K;;;;		BNE	MPCURSOL_050	;	YES -> MPCURSOL_050
;;;;K;;;;		LDA	<KEYC2L
;;;;K;;;;		AND	#080H		; "A" key ON ?
;;;;K;;;;		BEQ	MPCURSOL_100	;	NO -> MPCURSOL_100
;;;;K;;;;MPCURSOL_050	EQU	$
		STA	!MPSTART
		LDA	!MPTYPE
		LSR	A
		TAX
		LDA	MPCURSOL_MIN,X
		CLC
		ADC	!CORSLPT
		TAY
		LDA	!AICONBF1,Y	; アイコン あるか ?
		BEQ	MPCURSOL_100	;	NO -> MPCURSOL_100
		CMP	#0FFH
		BEQ	MPCURSOL_100
		AND	#07FH
		DEC	A
		CLC
		ADC	MPCURSOL_MIN,X
		STA	!MAPOINT
		LDA	#002H
		STA	!KMRCLSCT
		STZ	!KMRCLSIDX
		LDA	#05DH
		JSL	>SOUND_3_ON	;sound set !!
		BRA	MPCURSOL_195
;
MPCURSOL_100	EQU	$
		STZ	!MPSTART
		LDA	<MPSCFG
		BNE	MPCURSOL_102
		LDA	<KEYC2L
		AND	#030H		; 両肩ボタン ＯＮ ?
		BEQ	MPCURSOL_103
MPCURSOL_102	EQU	$
		JMP	MPCURSOL_300
;
MPCURSOL_103	EQU	$
		LDA	!MVORMVCT
		BEQ	MPCURSOL_105
		INC	A
		CMP	#010H
		BCC	MPCURSOL_105
		LDA	<KEYC1
		AND	#003H		;左右連続キー ON ?
		BEQ	MPCURSOL_200	;	NO -> MPCURSOL_200
		BRA	MPCURSOL_108
MPCURSOL_105	EQU	$
		STA	!MVORMVCT
		LDA	<KEYC2
		AND	#003H		;左右トリガーキー ON ?
		BEQ	MPCURSOL_200	;	NO -> MPCURSOL_200
		INC	!MVORMVCT
MPCURSOL_108	EQU	$
		TAX
		LDA	#05CH
		JSL	>SOUND_3_ON	;sound set !!
		LDA	!CORSLPT
		STA	<WORK0
		CLC
		ADC	MPCURSOL_INC0,X
		BPL	MPCURSOL_110
		LDA	#011
MPCURSOL_110	EQU	$
		CMP	#012
		BCC	MPCURSOL_120
		LDA	#000
MPCURSOL_120	EQU	$
		TAX
		CLC
		ADC	<WORK0
		CMP	#011
		BEQ	MPCURSOL_190
		JSR	H_MOVE_CHECK
		JMP	MPCURSOL_900
MPCURSOL_190	EQU	$
		LDA	!MVORMVCT
		INC	A
		AND	#01FH
		BEQ	MPCURSOL_195
		LDA	<KEYC1
		AND	#003H
		STA	!ICNOVRMV	; オーバー移動 モードＯＮ
		STA	!MVORMVCT
MPCURSOL_195	EQU	$
		JMP	MPCURSOL_900
;
MPCURSOL_200	EQU	$
		LDA	<KEYC2
		AND	#00CH		;上下キー ON ?
		BEQ	MPCURSOL_300	;	NO -> MPCURSOL_300
		LSR	A
		LSR	A
		TAX
		LDA	#05CH
		JSL	>SOUND_3_ON	; sound set!!
		LDA	!CORSLPT
		CLC
		ADC	MPCURSOL_INC1,X ; ホルダー セレクト ?
		BMI	MPCURSOL_210	;	YES -> MPCURSOL_210
		CMP	#000		;
		BCC	MPCURSOL_210	;
		CMP	#012
		BCC	MPCURSOL_250
		BRA	MPCURSOL_280
MPCURSOL_210	EQU	$
		LDA	!MPTYPE
		ASL	A
		ASL	A
		ORA	!CORSLPT
		TAX
		LDA	HLDRSLCT_DT,X
		EOR	#003H
		STA	!MVCRSLFG
		LDA	!MPTYPE
		INC	A
		INC	A
		STA	!HLDRFLG
		BRA	MPCURSOL_900
;
MPCURSOL_250	EQU	$
		TAY
		LDX	!MPTYPE
		M16			; memory 16bit mode
		LDA	AICNBFINT_DAT,X
		STA	<WORK10
		M8			; memory 8bit mode
		LDA	(<WORK10),Y
		AND	#00FH
		BEQ	MPCURSOL_280
		STY	!CORSLPT
		BRA	MPCURSOL_900
;
MPCURSOL_280	EQU	$
		LDA	<KEYC2
		AND	#00CH
		STA	!ICNOVRMV	; オーバー移動 モードＯＮ
		LDA	#042H
		JSL	>SOUND_3_ON	;sound set !!
		BRA	MPCURSOL_900
;
MPCURSOL_300	EQU	$
;
MPCURSOL_400	EQU	$
		LDA	!KEYA1
		AND	#00100000B		; セレクトキー ＯＮ ?
		BEQ	MPCURSOL_900		;	NO -> MPCURSOL_900
		LDX	!SPL_KEY_CHK
		M16				; memory 16bit mode
		LDA	<KEYC2L
		AND	#0C0C0H
		BEQ	MPCURSOL_990
		CMP	MN_HLDR_CHK,X
		BNE	MPCURSOL_450
		M8				; memory 8bit mode
		LDA	!SPL_KEY_CHK
		INC	A
		INC	A
		STA	!SPL_KEY_CHK
		CMP	#MN_HLDR_CHK_E-MN_HLDR_CHK
		BCC	MPCURSOL_990
		INC	!MN_HLDR_MD
		LDA	#095H
		STA	<SOUND_3
		BRA	MPCURSOL_990
MPCURSOL_450	EQU	$
		M8				; memory 8bit mode
		LDA	#090H
		STA	<SOUND_3
;
MPCURSOL_900	EQU	$
		STZ	!SPL_KEY_CHK
MPCURSOL_990	EQU	$
		RTS
;
;
MPCURSOL_INC0	EQU	$-1
		BYTE	001H,0FFH
;			 右   左
MPCURSOL_INC1	EQU	$-1
		BYTE	006H,0FAH
;			 下   上
MPCURSOL_MIN	EQU	$
		BYTE	000,012,024,036,048,060,072
;
MN_HLDR_CHK	EQU	$
		WORD	0000000001000000B
		WORD	0000000001000000B
		WORD	0100000000000000B
		WORD	1000000000000000B
		WORD	0000000010000000B
MN_HLDR_CHK_E	EQU	$
;
WORLD_CORS	EQU	$
		WORD	00000,00012,00024
		WORD	00036,00048,00060,00072
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+		カーソル 横移動チェック			+
;+				in			+
;+				X : カーソルポイント	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
H_MOVE_CHECK	EQU	$
		STX	!CORSLPT
		LDY	!MPTYPE
		M16			; memory 16bit mode
		LDA	AICNBFINT_DAT,Y
		STA	<WORK10
		M8			; memory 8bit mode
		TXY
		LDA	<KEYC1
		AND	#003
		TAX
H_MOVE_000	EQU	$
		LDA	(<WORK10),Y
		AND	#00FH		; アイコン あるか ?
		BNE	H_MOVE_050	;	YES -> H_MOVE_050
		TYA
		CLC
		ADC	MPCURSOL_INC0,X
		TAY
		BRA	H_MOVE_000
;
H_MOVE_050	EQU	$
		CPY	!CORSLPT
		BEQ	H_MOVE_090
		STY	!CORSLPT
		TYA
		ASL	A
		TAY
		M16			; memory 16bit mode
		LDA	MPCSLSET_DAT,Y
		STA	!ICONMV_X
		M8			; memory 8bit mode
;
H_MOVE_090	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		ＮＥＸＴ カーソル ポイント セット		*
;*								*
;****************************************************************
NEXTPTST	EQU	$
		LDA	!CORSLPT
		ASL	A
		TAY
		M16			; memory 16bit mode
		LDA	!HLDRFLG
		AND	#000FFH
		BEQ	NEXTPTST_010
		TAY
		LDA	HLDRSLCT_DAT,Y
		STA	!ICONMV_X
		BRA	NEXTPTST_020
NEXTPTST_010	EQU	$
		LDA	MPCSLSET_DAT,Y
NEXTPTST_020	EQU	$
		STA	!ICONGO_X
		M8			; memory 8bit mode
		RTS
;
;
;****************************************************************
;*								*
;*		カーソル ポイント セット			*
;*								*
;****************************************************************
CURSOLPT	EQU	$
		LDY	#000H
		LDA	!ICONGO_X
		BEQ	CURSOLPT_040
		CMP	!ICONMV_X
		BEQ	CURSOLPT_035
		BPL	CURSOLPT_030
		INY
CURSOLPT_030	EQU	$
		LDA	!MVCRSLFG	; ホルダーチェンジモード ＯＮ ?
		BEQ	CURSOLPT_033	;	NO -> CURSOLPT_033
		M16			; memory 16bit mode
		LDA	!ICONGO_X
		STA	!ICONMV_X
		STZ	!ICONGO_X
		M8			; memory 8bit mode
		BRA	CURSOLPT_100
;;;K;;;		TAY
;
CURSOLPT_033	EQU	$
		LDA	!ICONMV_X
		CLC
		ADC	MPCSLSET_DT,Y
		STA	!ICONMV_X
		BRA	CURSOLPT_040
CURSOLPT_035	EQU	$
		STZ	!ICONGO_X
		STZ	!MVCRSLFG
;
CURSOLPT_040	EQU	$
		LDY	#000H
		LDA	!ICONGO_Y
		BEQ	CURSOLPT_100
		CMP	!ICONMV_Y
		BEQ	CURSOLPT_055
		BPL	CURSOLPT_050
		INY
CURSOLPT_050	EQU	$
		LDA	!ICONMV_Y
		CLC
		ADC	MPCSLSET_DT,Y
		STA	!ICONMV_Y
		BRA	CURSOLPT_100
CURSOLPT_055	EQU	$
		STZ	!ICONGO_Y
;
CURSOLPT_100	EQU	$
		RTS
;
;
MPCSLSET_DT	EQU	$
		BYTE	004H,0FCH,004H
;
MPCSLSET_DAT	EQU	$
		BYTE	02CH,032H
		BYTE	04CH,032H
		BYTE	06CH,032H
		BYTE	08CH,032H
		BYTE	0ACH,032H
		BYTE	0CCH,032H
;
		BYTE	02CH,05AH
		BYTE	04CH,05AH
		BYTE	06CH,05AH
		BYTE	08CH,05AH
		BYTE	0B4H,05AH
		BYTE	0D4H,05AH
;
HLDRSLCT_DAT	EQU	$-2
		BYTE	034H,016H
		BYTE	054H,016H
		BYTE	074H,016H
		BYTE	094H,016H
		BYTE	0B4H,016H
		BYTE	0D4H,016H
;
;
;****************************************************************
;*								*
;*	マップカーソル オブジェセット ルーチン			*
;*								*
;****************************************************************
MPCSLSET	EQU	$
		MI16			; memory , index 16bit mode
		LDX	!OAMIDX
		LDA	!ICONMV_X	;アドレス
		AND	#000FFH
		STA	!SOAM_DX+0,X
		LDA	!ICONMV_Y
		AND	#000FFH
		STA	!SOAM_DX+2,X
;
		LDY	#033C0H
		LDA	!HLDRMODE
		AND	#000FFH		; ホルダーチェンジモード ＯＮ ?
		BNE	MPCSLSET_080	;	YES -> MPCSLSET_080
		LDA	!ICONMODE
		AND	#0000FH		; アイコン 移動モード ＯＮ ?
		BNE	MPCSLSET_080	;	YES -> MPCSLSET_080
		LDA	!MPSTART
		AND	#000FFH
		BEQ	MPCSLSET_100
;
MPCSLSET_080	EQU	$
		LDA	!OBJ16CHR
		AND	#000FFH		; スコア アイコン ＰＵＳＨ ?
		BEQ	MPCSLSET_090	;	NO -> MPCSLSET_090
		AND	#00080H
		BNE	MPCSLSET_100
		LDA	!HLDRWDW
		AND	#000FFH		; スコア アイコン ＰＵＳＨ中 ?
		BEQ	MPCSLSET_100	;	YES -> MPCSLSET_100
MPCSLSET_090	EQU	$
		INY
		INY
MPCSLSET_100	EQU	$
		TYA
		STA	!SOAM_DX+4,X	;キャラクター セット
;
		LDA	#00002H
		STA	!SOAM_DX+6,X	;サイズ ＆ ＯＢＪ優先順位
;
		TXA
		CLC
		ADC	#00008
		STA	!OAMIDX
;
		MI8			; memory , index 8bit mode
		RTS
;
;
;****************************************************************
;*								*
;*		巻物の両側 オブジェセット			*
;*								*
;****************************************************************
MKMN_X		EQU	00000H
MKMN_Y		EQU	00030H
;
MKMN_DAT0	EQU	$
		WORD	00C00H,00C20H,00C40H,00C60H,02C24H,02C24H
		WORD	02C44H,0AC60H,0AC40H,0AC20H,02C04H
;
MKMN_DAT1	EQU	$
		WORD	00C08H,00C28H,00C48H,00C68H,0AC44H,0AC44H
		WORD	0AC24H,0AC68H,0AC48H,0AC28H,02C64H
;
MKMN_DAT	EQU	$
		WORD	MKMN_DAT0,MKMN_DAT1
;
;
		MEM16
		IDX16
;
MAKIMONO	EQU	$
		LDA	!MKMN_MV
		CMP	#00018H
		BCC	MKMN_010
		AND	#00018H
MKMN_010	EQU	$
		PHA
		ASL	A
		ASL	A
		STA	<WORK0
;
		M8			; memory 8bit mode
;;;;K;;;;		LDA	#000H
;;;;K;;;;		SEC
;;;;K;;;;		ADC	<WORK0
;;;;K;;;;		INC	A
;;;;K;;;;		STA	!MKMN_CLS
;;;;K;;;;		LDA	#0FFH
;;;;K;;;;		CLC
;;;;K;;;;		SBC	<WORK0
;;;;K;;;;		DEC	A
;;;;K;;;;		STA	!MKMN_CLS+1
		LDA	#000H
		CLC
		ADC	<WORK0
		STA	!MKMN_CLS
		LDA	#0FFH
		SEC
		SBC	<WORK0
		STA	!MKMN_CLS+1
		M16			; memory 16bit mode
;
		LDX	!OAMIDX
		LDA	#MKMN_X+00010H*0
		CLC
		ADC	<WORK0
		JSR	MKMN_X_SET
		LDA	#MKMN_X+00010H*1
		CLC
		ADC	<WORK0
		JSR	MKMN_X_SET
		LDA	#MKMN_X+00010H*14
		SEC
		SBC	<WORK0
		JSR	MKMN_X_SET
		LDA	#MKMN_X+00010H*15
		SEC
		SBC	<WORK0
		JSR	MKMN_X_SET
;
		LDX	!OAMIDX
		LDA	#MKMN_Y+00010H*0
		JSR	MKMN_Y_SET
		LDA	#MKMN_Y+00010H*1
		JSR	MKMN_Y_SET
		LDA	#MKMN_Y+00010H*2
		JSR	MKMN_Y_SET
		LDA	#MKMN_Y+00010H*3
		JSR	MKMN_Y_SET
		LDA	#MKMN_Y+00010H*4
		JSR	MKMN_Y_SET
		LDA	#MKMN_Y+00010H*5
		JSR	MKMN_Y_SET
		LDA	#MKMN_Y+00010H*6
		JSR	MKMN_Y_SET
		LDA	#MKMN_Y+00010H*7
		JSR	MKMN_Y_SET
		LDA	#MKMN_Y+00010H*8
		JSR	MKMN_Y_SET
		LDA	#MKMN_Y+00010H*9
		JSR	MKMN_Y_SET
		LDA	#MKMN_Y+00010H*10
		JSR	MKMN_Y_SET
;
		PLA
		BEQ	MKMN_060
		AND	#00004
		BRA	MKMN_070
MKMN_060	EQU	$
		LDA	<SCCH3
		AND	#00008
		LSR	A
MKMN_070	EQU	$
		LSR	A
		TAX
		LDA	MKMN_DAT,X
		STA	<WORK0
		STZ	<WORK8
		LDX	!OAMIDX
		LDY	#00000H
		JSR	MKMN_CHR_SET
		INC	<WORK8
		INC	<WORK8
		LDY	#00000H
		JSR	MKMN_CHR_SET
		LDA	#04002H
		STA	<WORK8
		LDY	#00000H
		JSR	MKMN_CHR_SET
		DEC	<WORK8
		DEC	<WORK8
		LDY	#00000H
		JSR	MKMN_CHR_SET
;
		LDX	!OAMIDX
		INX
		INX
		INX
		INX
		INX
		INX
		LDA	#00002H
		TAY
		JSR	MKMN_X_SET
		TYA
		JSR	MKMN_X_SET
		TYA
		JSR	MKMN_X_SET
		TYA
		JSR	MKMN_X_SET
;
		LDA	!OAMIDX
		CLC
		ADC	#00008H*(11*4)
		STA	!OAMIDX
;
		RTL
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+		Ｘ軸セット			+
;++++++++++++++++++++++++++++++++++++++++++++++++
MKMN_X_SET	EQU	$
		STA	!SOAM_DX+8*00+0,X
		STA	!SOAM_DX+8*01+0,X
		STA	!SOAM_DX+8*02+0,X
		STA	!SOAM_DX+8*03+0,X
		STA	!SOAM_DX+8*04+0,X
		STA	!SOAM_DX+8*05+0,X
		STA	!SOAM_DX+8*06+0,X
		STA	!SOAM_DX+8*07+0,X
		STA	!SOAM_DX+8*08+0,X
		STA	!SOAM_DX+8*09+0,X
		STA	!SOAM_DX+8*10+0,X
		TXA
		CLC
		ADC	#00008*11
		TAX
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+		Ｙ軸セット			+
;++++++++++++++++++++++++++++++++++++++++++++++++
MKMN_Y_SET	EQU	$
		STA	!SOAM_DX+8*00+2,X
		STA	!SOAM_DX+8*11+2,X
		STA	!SOAM_DX+8*22+2,X
		STA	!SOAM_DX+8*33+2,X
		TXA
		CLC
		ADC	#00008*1
		TAX
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+		キャラクターＮｏ.セット		+
;++++++++++++++++++++++++++++++++++++++++++++++++
MKMN_CHR_SET	EQU	$
		STX	<WORK2
MKMN_CHR_LOOP	EQU	$
		LDA	(<WORK0),Y
		ORA	<WORK8
		STA	!SOAM_DX+8*00+4,X
		TXA
		CLC
		ADC	#00008
		TAX
		INY
		INY
		CPY	#MKMN_DAT1-MKMN_DAT0
		BCC	MKMN_CHR_LOOP
;
		LDA	<WORK2
		CLC
		ADC	#00008H*11
		TAX
		RTS
;
		MEM8
		IDX8
;
;
;****************************************************************
;*								*
;*		ホルダー キー入力待ち ルーチン			*
;*								*
;****************************************************************
HLDRSLCT	EQU	$
		LDA	<KEYC2
		AND	#003H		; 左右キー ON ?
		BEQ	HLDRSLCT_100	;	NO -> HLDRSLCT_100
		TAX
		LDA	!HLDRFLG
HLDRSLCT_020	EQU	$
		CLC
		ADC	MPCURSOL_INC0,X
		CLC
		ADC	MPCURSOL_INC0,X
		TAY
		BEQ	HLDRSLCT_050
		CMP	#010H
		BCS	HLDRSLCT_050
		STA	<WORK0
		LSR	A
		TAY
		LDA	MPCURSOL_MIN-1,Y
		TAY
		M16			; memory 16bit mode
		LDA	!MPCLRTBL+00H,Y
		ORA	!MPCLRTBL+02H,Y
		ORA	!MPCLRTBL+04H,Y
		ORA	!MPCLRTBL+06H,Y
		STA	<WORK2
		M8			; memory 8bit mode
		LDA	<WORK2
		ORA	<WORK3		; ホルダー が あるか ?
		BNE	HLDRSLCT_040	;	YES -> HLDRSLCT_040
		LDA	<WORK0
		BRA	HLDRSLCT_020
;
HLDRSLCT_040	EQU	$
		LDA	<WORK0
		STA	!HLDRFLG
		LDA	#05CH
		BRA	HLDRSLCT_055
HLDRSLCT_050	EQU	$
		LDA	#042H
HLDRSLCT_055	EQU	$
		JSL	>SOUND_3_ON	; sound set!!
		BRA	HLDRSLCT_900
;
HLDRSLCT_100	EQU	$
		LDA	<KEYC2
		AND	#004H		; 下キー ON ?
		BEQ	HLDRSLCT_200	;	NO -> HLDRSLCT_200
		LDA	!HLDRFLG
		DEC	A
		DEC	A
		ASL	A
		ASL	A
		ORA	!CORSLPT
		TAX
		LDA	HLDRSLCT_DT,X
		STA	!MVCRSLFG
		STZ	!HLDRFLG
		STZ	!HLDRMODE
		LDA	#05CH
		JSL	>SOUND_3_ON	; sound set!!
		BRA	HLDRSLCT_900
;
HLDRSLCT_200	EQU	$
		LDA	<KEYC2L
		ORA	<KEYC2
		AND	#0C0H		; "A,B,X,Y" key ON ?
		BEQ	HLDRSLCT_900	;	NO -> HLDRSLCT_900
		LDA	!HLDRFLG
		DEC	A
		DEC	A
		CMP	!MPTYPE
		BEQ	HLDRSLCT_900
;
		STA	!MPTYPE
		LSR	A
		TAX
		LDA	MPCURSOL_MIN,X
		STA	!MAPOINT
		STZ	!CORSLPT
		STZ	!AICONPT
		STZ	!BAKPOS
		INC	!HLDRMODE
		LDA	#019H
		JSL	>SOUND_3_ON	; sound set !!
;
HLDRSLCT_900	EQU	$
		RTS
;
HLDRSLCT_DT	EQU	$
		BYTE	002H,002H,002H,002H,002H,002H,000H,000H ;1
		BYTE	001H,002H,002H,002H,002H,002H,000H,000H ;2
		BYTE	001H,001H,002H,002H,002H,002H,000H,000H ;3
		BYTE	001H,001H,001H,002H,002H,002H,000H,000H ;4
		BYTE	001H,001H,001H,002H,002H,002H,000H,000H ;5
		BYTE	001H,001H,001H,001H,002H,002H,000H,000H ;6
		BYTE	001H,001H,001H,001H,001H,002H,000H,000H ;7
;
;
;****************************************************************
;*								*
;*		アイコンオブジェ セット				*
;*								*
;****************************************************************
AICONOBJ	EQU	$
		MI16			; memory , index 16bit mode
		LDX	!OAMIDX
		LDA	!ICONMV_X	;Ｘ座標
		AND	#000FFH
		SEC
		SBC	#00010H
		STA	!SOAM_DX+0,X
		STA	!SOAM_DX+16,X
		CLC
		ADC	#00010H
		STA	!SOAM_DX+8,X
		STA	!SOAM_DX+24,X
;
		LDA	!ICONMV_Y	;Ｙ座標
		AND	#0000FFH
		SEC
		SBC	#00016H
		STA	!SOAM_DX+2,X
		STA	!SOAM_DX+10,X
		CLC
		ADC	#00010H
		STA	!SOAM_DX+18,X
		STA	!SOAM_DX+26,X
;
		LDY	!MPTYPE
		LDA	AICON_ATR,Y
		STA	<WORK4
		LDA	!AICONDAT
		AND	#000FFH		; ズーム モード ?
		BNE	AICONOBJ_500	;	YES -> AICONOBJ_500
		TAY
		AND	#000FFH
		LSR	A
		TAY
		LDA	MPCURSOL_MIN,Y
		CLC
		ADC	!CORSLPT
		AND	#000FFH
		TAY
		LDA	!AICONBF1,Y
		AND	#0007FH
AICONOBJ_500	EQU	$		;キャラクター ＮＯ.
		DEC	A
		STA	<WORK10
		AND	#0000FH
		ASL	A
		TAY
		JSR	MONO_COL_CHK
		LDA	<WORK10
		BNE	AICONOBJ_550
		LDA	(<WORK4),Y
AICONOBJ_550	EQU	$
		LSR	A
		SEC
		SBC	#00600H
		ORA	#031E0H
		STA	!SOAM_DX+4,X
		INC	A
		INC	A
		STA	!SOAM_DX+12,X
		INC	A
		INC	A
		STA	!SOAM_DX+20,X
		INC	A
		INC	A
		STA	!SOAM_DX+28,X
;
		LDA	#04002H		;サイズ
		STA	!SOAM_DX+6,X	;  ＯＢＪ優先順位
		STA	!SOAM_DX+14,X
		STA	!SOAM_DX+22,X
		STA	!SOAM_DX+30,X
;
		TXA
		CLC
		ADC	#00032
		STA	!OAMIDX
;
		MI8			; memory , index 8bit mode
AICONOBJ_900	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン移動					*
;*			(ＢＧアイコン クリア)			*
;*			(拡大キャラクター ＶＲＡＭセット)	*
;****************************************************************
AICONMOVE_000	EQU	$
;;;;K;;;;		INC	!ICONMODE
;;;;K;;;;		LDA	!MPTYPE
;;;;K;;;;		LSR	A
;;;;K;;;;		TAX
;;;;K;;;;		LDA	!CORSLPT
;;;;K;;;;		CLC
;;;;K;;;;		ADC	MPCURSOL_MIN,X
;;;;K;;;;		TAX
;;;;K;;;;		LDA	!AICONBF1,X
;;;;K;;;;		STA	!AICONDAT
;;;;K;;;;		LDA	#000H
;;;;K;;;;		STA	!AICONBF1,X
;;;;K;;;;		JSR	AICONMOVE_100
;
AICONMOVE_005	EQU	$		; コースインモードからのコール用
		LDA	!CORSLPT
		STA	!AICONPT
		ASL	A
		TAX
		M16			; memory 16bit mode
		LDA	AICON_BFAD,X	; アイコン アドレス ポイント
		LDY	!HOLDERFG
		BNE	AICONMOVE_010
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
AICONMOVE_010	EQU	$
		STA	<WORK0
		CLC
		ADC	#040H
		STA	<WORK2
		CLC
		ADC	#040H
		STA	<WORK4
		LDY	!MPTYPE
		LDA	AICNNUK_ATL,Y
		STA	<WORK6
		LDY	#000H
AICONMOVE_020	EQU	$		; clear BG data set !!
		LDA	!CORSLPT
		AND	#000FFH
		CMP	#00004-1
		BEQ	AICONMOVE_022
		CMP	#00008-1
		BEQ	AICONMOVE_022
		JSR	AICNNUKI_CLS
		BRA	AICONMOVE_023
AICONMOVE_022	EQU	$
		JSR	AICNBETA_CLS
AICONMOVE_023	EQU	$
		INY
		INY
		CPY	#003H*2
		BCC	AICONMOVE_020
;
;------------------------------------------------
;-		アイコン ＤＭＡセット		-
;------------------------------------------------
ICNVRMST	EQU	$
		MI16			; memory , index 16bit mode
		LDA	!HOLDERFG
		AND	#00001H
		ASL	A
		TAY
		LDA	#BANK HOLDERBF0
		STA	<WORK1		;(WK1) <-- 転送元アドレス (Ｂ)
		LDA	HLDRCHNG_DAT00,Y
		CLC
		ADC	#000C0H
		TAX			;(X) <-- 転送元アドレス (Ｌ，Ｈ)
		LDY	#01C00H+00080H	;(Y) <-- ＶＲＡＭアドレス
		LDA	#00200H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
		MI8			; memory , index 8bit mode
		RTS
;
;
UN_ICNVRMST	EQU	$
		JSR	ICNVRMST
		RTL
;
;
;
;****************************************************************
;*								*
;*		アイコン移動					*
;*			(拡大キャラクター ＶＲＡＭセット)	*
;****************************************************************
AICONMOVE_100	EQU	$
;;;;K;;;;		JSR	AICONMOVE_SUB
;;;;K;;;;;
;;;;K;;;;		LDA	!HLDRWDW
;;;;K;;;;		CMP	#050H
;;;;K;;;;		BCC	AICONMOVE_150
;;;;K;;;;		INC	!ICONMODE
;;;;K;;;;		LDA	#050H
;;;;K;;;;		STA	!HLDRWDW
;;;;K;;;;;
;;;;K;;;;AICONMOVE_150	EQU	$
;;;;K;;;;		LDA	!HLDRWDW
;;;;K;;;;		CLC
;;;;K;;;;		ADC	#004H
;;;;K;;;;		STA	!HLDRWDW
;;;;K;;;;AICONMOVE_190	EQU	$
;;;;K;;;;		RTS
;
;--------------------------------------------------------
;-   アイコンキャラクター ＶＲＡＭセット サブルーチン	-
;--------------------------------------------------------
AICONMOVE_SUB	EQU	$
		M16			; memory 16bit mode
		LDX	!MPTYPE
		LDA	CMODE_DATA,X
		STA	<WORK0
		LDA	!CORSLPT
		AND	#000FFH
		TAY
		LDA	(<WORK0),Y
		AND	#000FFH
		STA	R1
		LDA	!AICONDAT
		AND	#0007FH
		DEC	A
		CLC
		ADC	WORLD_CORS,X
		STA	R3
		LDA	!HLDRWDW
		AND	#000FFH
		CLC
		ADC	#00100H
		STA	R6
;
		M_CHIP	MPAICNZM
;
AICONMOVE_COL	EQU	$		; アイコン回転モードのコール用
HISCORE_COL	EQU	$		; ハイスコア表示用
MINI_COL	EQU	$		; ミニゲームホルダー用
		I16			; index 16bit mode
		LDA	#BANK WOB7CHR
		STA	<WORK1		;(WK1) <-- 転送元アドレス（Ｂ）
		LDY	#07E00H		;(Y) <-- ＶＲＡＭアドレス
		LDX	#WOB7CHR	;(X) <-- 転送元アドレス (Ｌ,Ｈ)
		LDA	#00080H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
;
		LDY	#07F00H		;(Y) <-- ＶＲＡＭアドレス
		LDX	#WOB7CHR+200H	;(X) <-- 転送元アドレス (Ｌ,Ｈ)
		LDA	#00080H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
;
		LDY	#07E40H		;(Y) <-- ＶＲＡＭアドレス
		LDX	#WOB7CHR+400H	;(X) <-- 転送元アドレス (Ｌ,Ｈ)
		LDA	#00080H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
;
		LDY	#07F40H		;(Y) <-- ＶＲＡＭアドレス
		LDX	#WOB7CHR+600H	;(X) <-- 転送元アドレス (Ｌ,Ｈ)
		LDA	#00080H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
		MI8			; memory , index 8bit mode
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン オーバー横移動				*
;*								*
;****************************************************************
AICNOVR_ADR	EQU	$
		WORD	AICNOVR_000,AICNOVR_100
;
;
AICNOVR		EQU	$
		LDX	#000H
		LDA	!ICNOVRMV
		AND	#00FH
		BEQ	AICNOVR_900
		AND	#00CH
		BEQ	AICNOVR_850
		LSR	A
		LSR	A
		TAY
		INX
		INX
AICNOVR_850	EQU	$
		JSR	(AICNOVR_ADR,X)
AICNOVR_900	EQU	$
		STZ	!ICNOVRMV
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+		ＮＥＸＴ Ｘ-ポイント			+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICNOVR_000	EQU	$
		LDA	#011
		LDY	!ICONMODE
		BNE	AICNOVR_030
		SEC
		SBC	!CORSLPT
		STA	!CORSLPT
		TAY
		LDX	!MPTYPE
		M16			; memory 16bit mode
		LDA	AICNBFINT_DAT,X
		STA	<WORK0
		M8			; memory 8bit mode
AICNOVR_015	EQU	$
		LDA	(<WORK0),Y
		AND	#00FH
		BNE	AICNOVR_020
		INY
		BRA	AICNOVR_015
AICNOVR_020	EQU	$
		TYA
		STA	!CORSLPT
		BRA	AICNOVR_050
;
AICNOVR_030	EQU	$
		SEC
		SBC	!AICONPT
		STA	!AICONPT
AICNOVR_050	EQU	$
		ASL	A
		TAY
		M16			; memory 16bit mode
		LDA	MPCSLSET_DAT,Y
		STA	!ICONMV_X
		M8			; memory 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+		Ｙ軸 オーバー横移動			+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICNOVR_DAT	EQU	$-1
		BYTE	008H,0F8H
;
;
AICNOVR_100	EQU	$
		LDA	!ICONMV_Y
		CLC
		ADC	AICNOVR_DAT,Y
		STA	!ICONGO_Y
		RTS
;
;
;****************************************************************
;*								*
;*		コースイン アイコン回転 イニシャルセット	*
;*								*
;****************************************************************
KAITEN_000	EQU	$
		LDX	MAPOINT		;待ってるヨッシーカラーセット
		LDA	>YOSHI_COLOR,X
		STA	P_COLOR		;ヨッシーカラータイプセット
		JSR	AICONMOVE_005	; アイコンＢＧクリアー
		INC	!KAITENMD
;
		M16			; memory 16bit mode
		STZ	!KAITENCT
		LDA	#00100H
		STA	!SMZOMCT
;
;
;****************************************************************
;*								*
;*		コースイン アイコン回転 セット			*
;*								*
;****************************************************************
KAITEN_100	EQU	$
		LDX	!MPTYPE
		M16			; memory 16bit mode
		LDA	CMODE_DATA,X
		STA	<WORK0
;
		LDX	!MPTYPE
		LDA	WORLD_CORS,X
		CLC
		ADC	!CORSLPT
		AND	#000FFH
		TAY
		LDA	!AICONBF1,Y
		AND	#0007FH
		DEC	A
		TAY
		CLC
		ADC	WORLD_CORS,X
		STA	R3		; コース ＮＯ.
		LDA	(<WORK0),Y
		AND	#000FFH
		STA	R1		; CMODE NO.
		LDA	!KAITENCT
		AND	#000FFH
		STA	R5		; 角度 (0〜FFH)
		LDA	!SMZOMCT
		BEQ	KAITEN_190
		STA	R6		; 倍率 (100H = 1.0)
;
BNS_AICN_KITN	EQU	$		; ボーナス ホルダー の コール用
		M_CHIP	CSINROLSM
;
		JSR	AICONMOVE_COL
;
		M16			; memory 16bit mode
		LDA	!KAITENCT
		CLC
		ADC	#00008H
		STA	!KAITENCT
		LDA	!SMZOMCT
		SEC
		SBC	#00002H
		CMP	#00014H
		BCS	KAITEN_150
		M8			; memory 8bit mode
;
		LDA	#0F1H
		STA	<SOUND_0	;[♪] ＢＧＭストップ !!
;
		LDA	#043H
		JSL	>SOUND_3_ON	; sound set!!
;
		M16			; memory 16bit mode
		LDA	#00000H
KAITEN_150	EQU	$
		STA	!SMZOMCT
KAITEN_190	EQU	$
		M8			; memory 8bit mode
		RTS
;
;
;****************************************************************
;*								*
;*		コースイン アイコン回転				*
;*					(霧を消す)		*
;****************************************************************
KAITEN_200	EQU	$
		LDA	!KIRIFLG	; 霧フラグ ＯＮ ?
		BEQ	KAITEN_240	;	NO -> KAITEN_240
;
		LDA	!MPFADR
		DEC	A
		BPL	KAITEN_210
		LDA	#000H
KAITEN_210	EQU	$
		STA	!MPFADR
;
		LDA	!MPFADG
		DEC	A
		BPL	KAITEN_220
		LDA	#000H
KAITEN_220	EQU	$
		STA	!MPFADG
;
		LDA	!MPFADB
		DEC	A
		DEC	A
		BPL	KAITEN_230
		LDA	#000H
KAITEN_230	EQU	$
		STA	!MPFADB
;
		LDA	!MPFADR
		ORA	!MPFADG
		ORA	!MPFADB
		BNE	KAITEN_240
		STZ	!KIRIFLG
		STZ	!SMZOMCT
		STZ	!SMZOMCT+1
KAITEN_240	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+		アイコンデータサーチ			+
;+			in				+
;+			work0,1 <- sarch data		+
;+			out				+
;+			Y <- アイコン バッファ		+
;+				アドレス インデックス	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		MEM16
AICNSRCH	EQU	$
		LDY	!MPTYPE
		LDA	AICNBFINT_DAT,Y
		STA	<WORKA
		LDY	#000H
		M8			; memory 8bit mode
AICNSRCH_000	EQU	$
		LDA	(<WORKA),Y
		AND	#00FH
		CMP	<WORK0
		BEQ	AICNSRCH_100
		INY
		CPY	#012
		BCC	AICNSRCH_000
		LDY	#000H
AICNSRCH_100	EQU	$
		M16			; memory 16bit mode
		RTS
;
;
		MEM8
;
;---------------------------------------------------------------
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+		コンフィグ ホルダー セット		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HLDRCHG_SET_2_1 EQU	$
		WORD	02D86H,02D65H,02D66H,02D67H,02D68H
		WORD	02D25H,02D26H,02D27H,06D86H
;
HLDRCHG_SET_2_2 EQU	$
		WORD	03186H,03175H,03176H,03177H,03178H
		WORD	03125H,03126H,03127H,07186H
;
HLDRCHG_SET_3	EQU	$
		WORD	00C00H,01000H
;
HLDRCHG_ADD	EQU	$
		WORD	00004H*2,0000DH*2
;
HLDRCHG_SET_8_0 EQU	$
		WORD	03920H,03921H,03922H,03923H,03924H
HLDRCHG_SET_8_1 EQU	$
		WORD	03905H,03906H,03907H,03908H,03928H
;
HLDRCHG_SET_8	EQU	$
		WORD	HLDRCHG_SET_8_0,HLDRCHG_SET_8_1
;
;
HLDRCHG_SET	EQU	$
		MI16			; memory , index 16bit mode
		LDX	#000FEH
		LDA	#021BFH
HLDRCHG_SET_10	EQU	$
		STA	!HOLDERBF0+000H,X
		STA	!HOLDERBF1+000H,X
		STA	!HOLDERBF0+100H,X
		STA	!HOLDERBF1+100H,X
		STA	!HOLDERBF0+200H,X
		STA	!HOLDERBF1+200H,X
		STA	!HOLDERBF0+280H,X
		STA	!HOLDERBF1+280H,X
		DEX
		DEX
		BPL	HLDRCHG_SET_10
;
;;;;K;;;;		LDA	!CONFIGFG
		LDA	!CNFG_BF
		AND	#00001H
		ASL	A
		TAX
		LDA	HLDRCHG_SET_3,X
		STA	<WORK0
;
		LDX	#00000H
		TXY
		LDA	!HOLDERFG
		AND	#00001H
		BEQ	HLDRCHG_SET_23
		LDX	#HOLDERBF1-HOLDERBF0
HLDRCHG_SET_23	EQU	$
		STX	<WORKE
HLDRCHG_SET_25	EQU	$
		LDA	HLDRCHG_SET_2_1,Y
		STA	!HOLDERBF0+(1*40H)+(04H*2),X
		LDA	HLDRCHG_SET_2_2,Y
		STA	!HOLDERBF0+(1*40H)+(0DH*2),X
		INX
		INX
		INY
		INY
		CPY	#HLDRCHG_SET_2_2-HLDRCHG_SET_2_1
		BCC	HLDRCHG_SET_25
;
		LDY	#00000H
		LDX	<WORKE
HLDRCHG_SET_33	EQU	$
		LDA	HOLDER_NO1M,Y
		ORA	<WORK0
		STA	!HOLDERBF0+(3*40H),X
		STA	!HOLDERBF0+(4*40H),X
		STA	!HOLDERBF0+(5*40H),X
		STA	!HOLDERBF0+(6*40H),X
		STA	!HOLDERBF0+(7*40H),X
		STA	!HOLDERBF0+(8*40H),X
		STA	!HOLDERBF0+(9*40H),X
		STA	!HOLDERBF0+(10*40H),X
		STA	!HOLDERBF0+(11*40H),X
		STA	!HOLDERBF0+(12*40H),X
		LDA	HOLDER_NO1D,Y
		ORA	<WORK0
		STA	!HOLDERBF0+(13*40H)-40H,X
		INX
		INX
		INY
		INY
		CPY	#00040H
		BCC	HLDRCHG_SET_33
;
		LDX	<WORKE
		LDY	#00000H
		LDA	#0A199H		; 上角
		ORA	<WORK0
		STA	!HOLDERBF0+(2*40H)+(02H*2),X
		ORA	#04000H
		STA	!HOLDERBF0+(2*40H)+(1DH*2),X
		LDA	#0218FH
		ORA	<WORK0
HLDRCHG_SET_35	EQU	$
		STA	!HOLDERBF0+(2*40H)+(03H*2),X
		INX
		INX
		INY
		CPY	#00026
		BCC	HLDRCHG_SET_35
;
		LDA	!CNFG_BF
		AND	#0000FH
		ASL	A
		TAY
		LDA	HLDRCHG_ADD,Y
		CLC
		ADC	<WORKE
		TAX
		LDY	#00009H
		LDA	#0218EH
		ORA	<WORK0
HLDRCHG_SET_38	EQU	$
		STA	!HOLDERBF0+(2*40H),X
		INX
		INX
		DEY
		BNE	HLDRCHG_SET_38
;
;--------------- ボタンの絵 セット ------------------------------
		LDY	#00000H
		LDX	<WORKE
		LDA	#03909H
HLDRCHG_SET_45	EQU	$
		PHA
		STA	!CNFGBUF04+0*40H,X
		CLC
		ADC	#00010H
		STA	!CNFGBUF04+1*40H,X
		CLC
		ADC	#00010H
		STA	!CNFGBUF04+2*40H,X
		CLC
		ADC	#00010H
		STA	!CNFGBUF04+3*40H,X
		CLC
		ADC	#00010H
		STA	!CNFGBUF04+4*40H,X
		CLC
		ADC	#00010H
		STA	!CNFGBUF04+5*40H,X
		CLC
		ADC	#00010H
		STA	!CNFGBUF04+6*40H,X
		CLC
		ADC	#00010H
		STA	!CNFGBUF04+7*40H,X
		PLA
		INC	A
		INX
		INX
		INY
		CPY	#00007
		BCC	HLDRCHG_SET_45
;
		LDA	#0B90FH
		STA	!CNFGBUF04+7*40H-2,X
;
;--------------- 各ボタンの機能説明の枠 -------------------------
		LDX	<WORKE
		LDY	#00000H
HLDRCHG_SET_55	EQU	$
		LDA	#02135H
		ORA	<WORK0
		STA	!CNFGBUF00+2,X
		STA	!CNFGBUF02+2,X
		STA	!CNFGBUF03+2,X
		ORA	#08000H
		STA	!CNFGBUF00+2+(3*40H),X
		STA	!CNFGBUF02+2+(3*40H),X
		STA	!CNFGBUF03+2+(3*40H),X
;
		LDA	#02145H
		ORA	<WORK0
		STA	!CNFGBUF01+2,X
		LDA	#02155H
		ORA	<WORK0
		STA	!CNFGBUF01+2+(3*40H),X
		INX
		INX
		INY
		CPY	#00005H
		BCC	HLDRCHG_SET_55
		LDA	#02148H
		ORA	<WORK0
		STA	!CNFGBUF01+2,X
		LDA	#02156H
		ORA	<WORK0
		STA	!CNFGBUF01+2+(3*40H),X
;
		LDX	<WORKE
		LDA	#02137H
		ORA	<WORK0
		STA	!CNFGBUF00+(1*40H),X
		STA	!CNFGBUF00+(2*40H),X
		STA	!CNFGBUF02+(1*40H),X
		STA	!CNFGBUF02+(2*40H),X
		STA	!CNFGBUF03+(1*40H),X
		ORA	#04000H
		STA	!CNFGBUF00+(2*40H)+(06H*2),X
		STA	!CNFGBUF02+(2*40H)+(06H*2),X
		STA	!CNFGBUF03+(1*40H)+(06H*2),X
		STA	!CNFGBUF03+(2*40H)+(06H*2),X
		LDA	#06136H
		ORA	<WORK0
		STA	!CNFGBUF00+(1*40H)+(06H*2),X
		STA	!CNFGBUF02+(1*40H)+(06H*2),X
		EOR	#0C000H
		STA	!CNFGBUF03+(2*40H),X
;
		LDA	#02146H
		ORA	<WORK0
		STA	!CNFGBUF01+(1*40H),X
		LDA	#0A147H
		ORA	<WORK0
		STA	!CNFGBUF01+(2*40H),X
		LDA	#02157H
		ORA	<WORK0
		STA	!CNFGBUF01+(1*40H)+(06H*2),X
		STA	!CNFGBUF01+(2*40H)+(06H*2),X
		LDA	#02148H
		ORA	<WORK0
		STA	!CNFGBUF01+(0*40H)+(06H*2),X
		ORA	#04000H
		STA	!CNFGBUF01+(0*40H)+(00H*2),X
		ORA	#08000H
		STA	!CNFGBUF01+(3*40H)+(00H*2),X
;
;--------------- 照準ロック ＆ ジャンプ ＆ たべる／はく---------
		LDA	#03960H
		STA	<WORK10
		LDA	#03140H
		STA	<WORK12
		LDA	#02D00H
		STA	<WORK14
		LDX	<WORKE
		LDY	#00005H
HLDRCHG_SET_65	EQU	$
		LDA	<WORK10
		STA	!CNFGBUF00+(1*40H)+(01H*2),X
		ORA	#00010H
		STA	!CNFGBUF00+(2*40H)+(01H*2),X
		LDA	<WORK12
		STA	!CNFGBUF03+(1*40H)+(01H*2),X
		ORA	#00010H
		STA	!CNFGBUF03+(2*40H)+(01H*2),X
		LDA	<WORK14
		STA	!CNFGBUF02+(1*40H)+(01H*2),X
		ORA	#00010H
		STA	!CNFGBUF02+(2*40H)+(01H*2),X
		INC	<WORK10
		INC	<WORK12
		INC	<WORK14
		INX
		INX
		DEY
		BNE	HLDRCHG_SET_65
;
;--------------- 決定アイコンのワク -----------------------------
		LDX	<WORKE
		LDA	#0399FH
		STA	!CNFGBUF05-(01H*2)-(1*40H),X
		PHA
		ORA	#08000H
		STA	!CNFGBUF05-(01H*2)+(3*40H),X
		PLA
		ORA	#04000H
		STA	!CNFGBUF05+(03H*2)-(1*40H),X
		ORA	#08000H
		STA	!CNFGBUF05+(03H*2)+(3*40H),X
;
		LDA	#0398FH
		STA	!CNFGBUF05+(00H*2)-(1*40H),X
		STA	!CNFGBUF05+(01H*2)-(1*40H),X
		STA	!CNFGBUF05+(02H*2)-(1*40H),X
		ORA	#08000H
		STA	!CNFGBUF05+(00H*2)+(3*40H),X
		STA	!CNFGBUF05+(01H*2)+(3*40H),X
		STA	!CNFGBUF05+(02H*2)+(3*40H),X
;
		LDA	#03998H
		STA	!CNFGBUF05-(01H*2)+(0*40H),X
		STA	!CNFGBUF05-(01H*2)+(1*40H),X
		STA	!CNFGBUF05-(01H*2)+(2*40H),X
		ORA	#04000H
		STA	!CNFGBUF05+(03H*2)+(0*40H),X
		STA	!CNFGBUF05+(03H*2)+(1*40H),X
		STA	!CNFGBUF05+(03H*2)+(2*40H),X
;
;--------------- 決定アイコン -----------------------------------
		LDA	!HOLDERFG
		AND	#00001H
		XBA
		LSR	A
		STA	<WORK1E
		LDA	#02C63H
		ORA	<WORK1E
		STA	<WORK10
		LDA	#02C66H
		ORA	<WORK1E
		STA	<WORK12
		LDA	#02C69H
		ORA	<WORK1E
		STA	<WORK14
		LDX	<WORKE
		LDY	#00003H
HLDRCHG_SET_75	EQU	$
		LDA	<WORK10
		STA	!CNFGBUF05+(0*40H),X
		LDA	<WORK12
		STA	!CNFGBUF05+(1*40H),X
		LDA	<WORK14
		STA	!CNFGBUF05+(2*40H),X
		INC	<WORK10
		INC	<WORK12
		INC	<WORK14
		INX
		INX
		DEY
		BNE	HLDRCHG_SET_75
;
;--------------- たべる ｏｒ なげる -----------------------------
		LDX	<WORKE
		LDA	!CNFG_BF
		AND	#000FFH
		ASL	A
		TAY
		LDA	HLDRCHG_SET_8,Y
		STA	<WORK0
		LDY	#00000H
HLDRCHG_SET_85	EQU	$
		LDA	(<WORK0),Y
		STA	!CNFGBUF01+40H+(01H*2),X
		ORA	#00010H
		STA	!CNFGBUF01+40H+(01H*2)+40H,X
		INX
		INX
		INY
		INY
		CPY	#HLDRCHG_SET_8_1-HLDRCHG_SET_8_0
		BCC	HLDRCHG_SET_85
;
		MI8			; memory , index 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+		プッシュ アイコン ＤＭＡ転送		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICNPUSH_3_DT	EQU	$
		WORD	HOLDERBF0,HOLDERBF1
;
;
AICNPUSH_HD_DMA EQU	$
		MI16			; memory , index 16bit mode
		LDA	!HOLDERFG
		AND	#00001H
		ASL	A
		TAY
		LDA	#BANK HOLDERBF0
		STA	<WORK1		;(WK1) <- 転送元アドレス（Ｂ)
		LDA	AICNPUSH_3_DT,Y
		TAX			;(X)   <- 転送元アドレス（Ｌ,Ｈ)
		LDY	#01C00H+00220H	;(Y)   <-- ＶＲＡＭアドレス
		LDA	#00380H		;(A)   <-- 転送バイト数
		JSL	>VRAMDX_ST
		MI8			; memory , index 8bit mode
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ イニシャル セット		*
;*								*
;****************************************************************
AICNPUSH_0000	EQU	$
		STZ	!OBJ16CHR
AICNPUSH_00_SB	EQU	$
		M16			; memory 16bit mode
		LDA	#0000EH
		STA	R9
		LDA	#BANK CMODE_DAT7
		STA	!CCWORK0
		LDA	#CMODE_DAT7
		STA	!CCWORK1
		M_CHIP	MPCHRVRMST
;
AICNPUSH_0050	EQU	$
		I16			; index 16bit mode
		LDA	!HOLDERFG
		AND	#00001H
		EOR	#00001H
		ASL	A
		TAY
		LDX	#WOB7CHR+0800H	; X <- 転送元アドレス（Ｌ，Ｈ)
		LDA	#BANK WOB7CHR
		STA	<WORK1		; WK1 <- 転送元アドレス（Ｂ)
		LDA	HLDRCHNG_020,Y
		TAY			; Y <- ＶＲＡＭアドレス
		LDA	#00800H		; A <- 転送バイト数
		JSL	>VRAMDX_ST
		MI8			; memory , index 8bit mode
		INC	!HLDRMODE
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*				(キャラクター転送 ＮＯ.１)	*
;****************************************************************
CNFG_BIT_ADR	EQU	$
		WORD	012*6+000,012*6+001,012*6+002
;
;
AICNPUSH_0100	EQU	$
		LDX	#011*2
		JSR	HISCRE_PUSH_DMA
		LDA	#032H
		JSL	>SOUND_3_ON	; sound set!!
		STZ	!HLDRWDW
		LDX	!CONFIGFG	; コンフィグ アイコン Ｎｏ.
		LDA	CNFG_BIT_ADR,X
		JSR	HISCRE_PUSH_SUB
		STZ	!OBJ16CHR
		INC	!HLDRMODE
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*				(キャラクター転送 ＮＯ.２)	*
;****************************************************************
AICNPUSH_0200	EQU	$
		JSR	AICNPUSH_0700
;
		STZ	!CONFIGFG+1
		LDA	!CONFIGFG
		LSR	A
		STA	!CNFG_BF
;
		BRA	AICNPUSH_0400
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*				(ホルダースクリーン転送)	*
;****************************************************************
AICNPUSH_0300	EQU	$
		JSR	HLDRCHG_SET	; ホルダー セット ルーチン
		INC	!HLDRMODE
		JSR	AICNPUSH_HD_DMA
		LDA	!HOLDERFG
		EOR	#001H
		AND	#001H
		STA	!HOLDERFG
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*					(縮小)			*
;****************************************************************
AICNPUSH_0400	EQU	$
		LDX	!CONFIGFG	; コンフィグ アイコン Ｎｏ.
		LDA	CNFG_BIT_ADR,X
		TAX
AICNPUSH_04_CL	EQU	$
		M16			; memory 16bit mode
		LDA	!HLDRWDW
		CLC
		ADC	#00008
		STA	!HLDRWDW
		M8			; memory 8bit mode
		CMP	#040H
		BCC	AICNPUSH_0490
		INC	!HLDRMODE
AICNPUSH_0490	EQU	$
		TXA
		JSR	HISCRE_PUSH_SUB
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*					(拡大)			*
;****************************************************************
AICNPUSH_0500	EQU	$
		LDX	!CONFIGFG	; コンフィグ アイコン Ｎｏ.
		LDA	CNFG_BIT_ADR,X
		TAX
AICNPUSH_05_CL	EQU	$
		M16			; memory 16bit mode
		LDA	!HLDRWDW
		SEC
		SBC	#00008
		STA	!HLDRWDW
		M8			; memory 8bit mode
		LDA	!HLDRWDW
		BPL	AICNPUSH_0590
		INC	!HLDRMODE
		LDA	#013H
		STA	!WMANSL
		LDA	#082H
		STA	!WIND25
		STZ	!HLDRWDW
		M16			; memory 16bit mode
		LDA	#0FF00H
		STA	>MPHDMABF5+000H
		M8			; memory 8bit mode
AICNPUSH_0590	EQU	$
		TXA
		JSR	HISCRE_PUSH_SUB
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*					(ウィンドゥ オープン)	*
;*				書き換え(ＢＧ２→ＢＧ１)	*
;****************************************************************
AICNPUSH_0600	EQU	$
		MI16			; memory , index 16bit mode
		LDA	!HLDRWDW
		AND	#000FFH
		ASL	A
		ASL	A
		TAX
		LDA	#0EF11H
		STA	>MPHDMABF5+4+00,X
		STA	>MPHDMABF5+4+04,X
		STA	>MPHDMABF5+4+08,X
		STA	>MPHDMABF5+4+12,X
		MI8			; memory , index 8bit mode
		LDA	!HLDRWDW
		CLC
		ADC	#004
		STA	!HLDRWDW
		CMP	#050H
		BCC	AICNPUSH_0650
		INC	!HLDRMODE
		STZ	!HLDRWDW
		LDA	#000
		STA	!WMANSL
		LDA	#080H
		STA	!WIND25
		M16			; memory 16bit mode
		LDA	#OKPOS
		STA	!ICONMV_X	; カーソル初期値 セット
		M8			; memory 16bit mode
AICNPUSH_06_CL	EQU	$
		MI16			; memory , index 16bit mode
		LDA	!HOLDERFG
		EOR	#00001H
		AND	#00001H
		ASL	A
		TAY
		LDA	#BANK HOLDERBF0
		STA	<WORK1		;(WK1) <- 転送元アドレス（Ｂ)
		LDA	AICNPUSH_3_DT,Y
		TAX			;(X)   <- 転送元アドレス（Ｌ,Ｈ)
		LDY	#01C00H+00020H	;(Y)   <-- ＶＲＡＭアドレス
		LDA	#00380H		;(A)   <-- 転送バイト数
		JSL	>VRAMDX_ST
		MI8			; memory , index 8bit mode
		BRA	AICNPUSH_0690
AICNPUSH_0650	EQU	$
		LDA	!HLDRMODE
		CMP	#AICNPUSH_10
		BCS	AICNPUSH_0690
		JSR	HISCRE_PUSH_OBJ
		LDA	#080H
		STA	!OBJ16CHR
AICNPUSH_0690	EQU	$
		RTS
;
OKPOS		EQU	04AD4H
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*				(ウィンドゥ ＯＦＦ セット)	*
;****************************************************************
AICNPUSH_0700	EQU	$
		PHB
		LDA	#BANK MPHDMABF5
		PHA
		PLB
		LDY	#000H
		M16			; memory 16bit mode
		LDA	#000FFH
AICNPUSH_0750	EQU	$
		STA	!MPHDMABF5+000H,Y
		STA	!MPHDMABF5+080H,Y
		DEY
		DEY
		BNE	AICNPUSH_0750
		M8			; memory 8bit mode
		PLB
		INC	!HLDRMODE
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*								*
;****************************************************************
AICNPUSH_08_DT	EQU	$
		WORD	0175BH,017A3H
;
;
AICNPUSH_0800	EQU	$
		LDA	<KEYC2L
		AND	#080H		; "A"
		ORA	<KEYC2		; "B"
		AND	#090H		; "start" key ON ?
		BEQ	AICNPUSH_0820	;	NO -> AICNPUSH_0820
		LDA	#008H
		JSL	>SOUND_3_ON	; sound set!!
		LDA	#011+012*7	; 決定アイコン Ｎｏ.
		JSR	HISCRE_PUSH_SUB
		LDA	#AICNPUSH_09
		STA	!HLDRMODE
		BRA	AICNPUSH_0890
;
AICNPUSH_0820	EQU	$
		LDA	<KEYC2
		AND	#008		; 上キー ON ?
		BEQ	AICNPUSH_0890	;	NO -> AICNPUSH_0890
		LDA	!CONFIGFG
		TAX
		LSR	A
		STA	!CNFG_BF
		M16			; memory 16bit mode
		LDA	AICNPUSH_08_DT,X
		STA	!ICONMV_X
		M8			; memory 8bit mode
		LDA	#AICNPUSH_10
		STA	!HLDRMODE
		LDA	#05CH
		JSL	>SOUND_3_ON	; sound set!!
;
AICNPUSH_0890	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*				(決定アイコン 縮小 イニシャル ) *
;****************************************************************
AICNPUSH_0900	EQU	$
		MI16			; memory , index 16bit mode
		LDX	#00000H
		LDA	!HOLDERFG
		AND	#000001
		BNE	AICNPUSH_0910
		LDX	#HOLDERBF1-HOLDERBF0
AICNPUSH_0910	EQU	$
		LDA	#0398EH
		LDY	#00000H
AICNPUSH_0915	EQU	$
		STA	!CNFGBUF05+(0*40H),X
		STA	!CNFGBUF05+(1*40H),X
		STA	!CNFGBUF05+(2*40H),X
		INX
		INX
		INY
		CPY	#00003
		BCC	AICNPUSH_0915
;
		LDA	#00100H
		STA	!HLDRWDW
;
		JSR	AICNPUSH_06_CL
		MI8			; memory , index 8bit mode
		INC	!HLDRMODE
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*					(決定アイコン 縮小)	*
;****************************************************************
AICNPUSH_0A00	EQU	$
		LDX	#011+012*7	; 決定アイコン Ｎｏ.
		JSR	AICNPUSH_04_CL
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*					(決定アイコン 拡大)	*
;*			(ファイル セレクト ホルダー セット)	*
;****************************************************************
AICNPUSH_0B00	EQU	$
		LDX	#011+012*7	; 決定アイコン Ｎｏ.
		JSR	AICNPUSH_05_CL
		LDA	!HLDRWDW
		BPL	AICNPUSH_0B50
;
		M16			; memory 16bit mode
		LDA	#OKPOS
		STA	!ICONMV_X
		M8			; memory 8bit mode
AICNPUSH_0B50	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*					( ホルダー セット)	*
;*				( アイコン キャラクター セット) *
;****************************************************************
AICNPUSH_0C00	EQU	$
		JSR	HLDRCHNG_0000
		JSR	HLDRCHNG_0100
		DEC	!HLDRMODE
		JSR	HISCRE_PUSH_OBJ
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*				( アイコン キャラクター セット) *
;****************************************************************
AICNPUSH_0D00	EQU	$
		LDA	!HOLDERFG
		AND	#001
		EOR	#001
		STA	!HOLDERFG
		M16			; memory 16bit mode
		JSR	AICNPUSH_0050
		MEM8
		LDA	!HOLDERFG
		AND	#001
		EOR	#001
		STA	!HOLDERFG
;
		JSR	HISCRE_PUSH_OBJ
		LDA	#013H
		STA	!WMANSL
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*					(ウィンドゥ オープン)	*
;*				書き換え(ＢＧ２→ＢＧ１)	*
;****************************************************************
AICNPUSH_0E00	EQU	$
		JSR	AICNPUSH_0600
		LDA	!HLDRWDW
		BNE	AICNPUSH_0E50
		M16			; memory 16bit mode
		LDA	MPCSLSET_DAT+11*2
		STA	!ICONMV_X
		M8			; memory 8bit mode
AICNPUSH_0E50	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*				(ウィンドゥ ＯＦＦ セット)	*
;****************************************************************
AICNPUSH_0F00	EQU	$
		JSR	AICNPUSH_0700
		LDA	#000
		STA	!WMANSL
		STZ	!HLDRMODE
		STZ	!CNFG_BF
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*			コンフィグ ホルダー 入れ替えチェック	*
;****************************************************************
AICNPUSH_1000	EQU	$
		LDA	<KEYC2
		AND	#004		; 下キー ＯＮ ?
		BEQ	AICNPUSH_1010	;	NO -> AICNPUSH_1010
		LDA	#AICNPUSH_08
		STA	!HLDRMODE
		M16			; memory 16bit mode
		LDA	#OKPOS
		STA	!ICONMV_X
		M8			; memory 16bit mode
		BRA	AICNPUSH_1080
;
AICNPUSH_1010	EQU	$
		LDA	<KEYC2
		AND	#003		; 左右キー ＯＮ ?
		BEQ	AICNPUSH_1020	;	NO -> AICNPUSH_1020
		TAX
		LDA	!CNFG_BF
		CLC
		ADC	MPCURSOL_INC0,X
		BMI	AICNPUSH_1020
		CMP	#002
		BCS	AICNPUSH_1020
		STA	!CNFG_BF
		ASL	A
		TAX
		M16			; memory 16bit mode
		LDA	AICNPUSH_08_DT,X
		STA	!ICONMV_X
		M8			; memory 8bit mode
		BRA	AICNPUSH_1080
;
AICNPUSH_1020	EQU	$
		LDA	<KEYC2L		; "A","X"
		ORA	<KEYC2		; "B","Y"
		AND	#0C0H		;	key ON ?
		BEQ	AICNPUSH_1090
		LDA	!CNFG_BF
		ASL	A
		CMP	!CONFIGFG
		BEQ	AICNPUSH_1090
		STA	!CONFIGFG
		JSR	HLDRCHG_SET
		JSR	AICNPUSH_HD_DMA
		JSR	AICNPUSH_00_SB
		LDA	!HOLDERFG
		EOR	#001H
		AND	#001H
		STA	!HOLDERFG
		STZ	!HLDRWDW
		LDA	#004H
		JSL	>SOUND_3_ON	; sound set!!
		M16			; memory 16bit mode
		LDA	#0FF00H
		STA	>MPHDMABF5
		M8			; memory 8bit mode
		LDA	#001
		STA	!WMANSL
		BRA	AICNPUSH_1090
;
AICNPUSH_1080	EQU	$
		LDA	#05CH
		JSL	>SOUND_3_ON	; sound set!!
AICNPUSH_1090	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*					(ウィンドゥ オープン)	*
;*				書き換え(ＢＧ２→ＢＧ１)	*
;****************************************************************
AICNPUSH_1100	EQU	$
		JSR	AICNPUSH_0600
		LDA	!HLDRWDW
		BNE	AICNPUSH_1150
		LDA	!CNFG_BF
		ASL	A
		TAX
		M16			; memory 16bit mode
		LDA	AICNPUSH_08_DT,X
		STA	!ICONMV_X
		M8			; memory 8bit mode
		BRA	AICNPUSH_1190
AICNPUSH_1150	EQU	$
		LDA	#020H
		STA	!OBJ16CHR
AICNPUSH_1190	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*		アイコン プッシュ セット			*
;*				(ウィンドゥ ＯＦＦ セット)	*
;****************************************************************
AICNPUSH_1200	EQU	$
		JSR	AICNPUSH_0700
		LDA	#AICNPUSH_10
		STA	!HLDRMODE
		RTS
;
;
;-------------- ミニゲームホルダー -----------------------------
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー イニシャル セット			*
;*								*
;****************************************************************
MN_HLDER_TOP0	EQU	$
		WORD	02D86H,02D8FH,02DDBH,02DDCH
		WORD	02DDDH,02DDEH,02D8FH,06D86H
;
MN_HLDER_TOP1	EQU	$
		WORD	02DBFH,02DBFH,0AD99H,02D8FH,02D8EH,02D8EH,02D8EH,02D8EH
		WORD	02D8EH,02D8EH,02D8EH,02D8EH,02D8FH,02D8FH,02D8FH,02D8FH
		WORD	02D8FH,02D8FH,02D8FH,02D8FH,02D8FH,02D8FH,02D8FH,02D8FH
		WORD	00D8FH,02D8FH,02D8FH,02D8FH,02D8FH,0ED99H,02DBFH,02DBFH
MN_HLDER_TOP_E	EQU	$
;
MN_NAME_DAT0	EQU	$
		WORD	02DC0H,02DC1H,02DC2H,02DC3H,02DC4H
MN_NAME_DAT1	EQU	$
		WORD	02DC0H,02DC1H,02DC2H,02DC3H,02DC5H
MN_NAME_DAT2	EQU	$
		WORD	02DC6H,02DC7H,02DC8H,02DC9H,02DCAH
MN_NAME_DAT3	EQU	$
		WORD	02DD0H,02DD1H,02DD2H,02DD3H,02DD4H
MN_NAME_DAT4	EQU	$
		WORD	02DD5H,02DD6H,02DD7H,02DD8H,02DD9H
MN_NAME_DAT5	EQU	$
		WORD	02DC6H,02DC7H,02DC8H,02DCBH,02DCCH
MN_NAME_DAT6	EQU	$
		WORD	02DD0H,02DD1H,02DD2H,02DD3H,02DD4H
;
MN_VS_DAT	EQU	$
		WORD	02DFCH,02DFDH,02DFDH,02DFDH,02DFDH
		WORD	02DDFH,02DCDH,02DCEH,02DCFH,06DDFH
		WORD	02DFDH,02DFDH,02DFDH,02DFDH,06DFCH
MN_VS_DAT_E	EQU	$
;
MN_SIRO_DAT0	EQU	$
		WORD	0399FH,0398FH,0398FH,0398FH,0799FH
MN_SIRO_DAT1	EQU	$
		WORD	03998H,0398EH,0398EH,0398EH,07998H
MN_SIRO_DAT2	EQU	$
		WORD	0B99FH,0B98FH,0B98FH,0B98FH,0F99FH
;
MN_BUFF_ADR	EQU	$
		WORD	MNACNPS00,MNACNPS01,MNACNPS02,MNACNPS03
		WORD	MNACNPS04,MNACNPS05,MNACNPS06,MNACNPS07
MN_BUFF_ADR_E	EQU	$
;
MN_AICN_ATR	EQU	$
		WORD	00C00H,00C00H,00C00H,00C00H
		WORD	01000H,00C00H,00C00H,00C00H
;
MN_CMODENO	EQU	$
		HEX	015H,015H,015H,015H,015H,015H
		HEX	015H,015H,015H,015H,015H,015H
;
MINI_ATR	EQU	00C00H
;
;
MINI_HLDR_0000	EQU	$
		MI16			; memory , index 16bit mode
		STZ	!SPL_KEY_CHK
;
		LDX	#00000
		LDA	!HOLDERFG
		AND	#00001
		BEQ	MN_HLDR_0050
		LDX	#HOLDERBF1-HOLDERBF0
MN_HLDR_0050	EQU	$
		STX	<WORK20
;
		LDY	#00020H
		LDA	#001BFH
MN_HLDR_0110	EQU	$
		STA	!HOLDERBF0+(1*40H),X
		INX
		INX
		DEY
		BNE	MN_HLDR_0110
;
		LDX	<WORK20
		LDY	#00000
MN_HLDR_0120	EQU	$
		LDA	MN_HLDER_TOP0,Y
		STA	!HOLDERBF0+(1*40H)+(004H*2),X
		INX
		INX
		INY
		INY
		CPY	#MN_HLDER_TOP1-MN_HLDER_TOP0
		BCC	MN_HLDR_0120
;
		LDY	#00000
		LDX	<WORK20
MN_HLDR_0140	EQU	$			; 基本ホルダー
		LDA	MN_HLDER_TOP1,Y
		STA	!HOLDERBF0+(02*40H),X
		LDA	HOLDER_NO1M,Y
		ORA	#MINI_ATR
		STA	!HOLDERBF0+(03*40H),X
		STA	!HOLDERBF0+(04*40H),X
		STA	!HOLDERBF0+(05*40H),X
		STA	!HOLDERBF0+(06*40H),X
		STA	!HOLDERBF0+(07*40H),X
		STA	!HOLDERBF0+(08*40H),X
		STA	!HOLDERBF0+(09*40H),X
		STA	!HOLDERBF0+(10*40H),X
		STA	!HOLDERBF0+(11*40H),X
		LDA	HOLDER_NO1D,Y
		ORA	#MINI_ATR
		STA	!HOLDERBF0+(12*40H),X
		INX
		INX
		INY
		INY
		CPY	#MN_HLDER_TOP_E-MN_HLDER_TOP1
		BCC	MN_HLDR_0140
;
		LDY	#00000
		LDX	<WORK20
MN_HLDR_0160	EQU	$			; 各ミニゲームの名前
		LDA	MN_NAME_DAT0,Y
		STA	!MNACNPS00+3*40H-2,X
		LDA	MN_NAME_DAT1,Y
		STA	!MNACNPS01+3*40H-2,X
		LDA	MN_NAME_DAT2,Y
		STA	!MNACNPS02+3*40H-2,X
		LDA	MN_NAME_DAT3,Y
		STA	!MNACNPS03+3*40H-2,X
		LDA	MN_NAME_DAT4,Y
		STA	!MNACNPS04+3*40H-2,X
		LDA	MN_NAME_DAT5,Y
		STA	!MNACNPS05+3*40H-2,X
		LDA	MN_NAME_DAT6,Y
		STA	!MNACNPS06+3*40H-2,X
		INX
		INX
		INY
		INY
		CPY	#MN_NAME_DAT1-MN_NAME_DAT0
		BCC	MN_HLDR_0160
;
		LDY	#00000
		LDX	<WORK20
MN_HLDR_0180	EQU	$
		LDA	MN_VS_DAT,Y
		STA	!HOLDERBF0+(7*40H)+008H*2,X
		INX
		INX
		INY
		INY
		CPY	#MN_VS_DAT_E-MN_VS_DAT
		BCC	MN_HLDR_0180
;
		LDX	<WORK20
		LDA	#02DFEH
		STA	!HOLDERBF0+(08*40H)+008H*2,X
		STA	!HOLDERBF0+(09*40H)+008H*2,X
		STA	!HOLDERBF0+(10*40H)+008H*2,X
		ORA	#04000H
		STA	!HOLDERBF0+(08*40H)+016H*2,X
		STA	!HOLDERBF0+(09*40H)+016H*2,X
		STA	!HOLDERBF0+(10*40H)+016H*2,X
;
		LDA	#02DDAH
		STA	!HOLDERBF0+(11*40H)+009H*2,X
		ORA	#04000H
		STA	!HOLDERBF0+(11*40H)+015H*2,X
		LDA	#0EDFCH
		STA	!HOLDERBF0+(11*40H)+016H*2,X
;
		LDY	#00000
		LDX	<WORK20
MN_HLDR_01A0	EQU	$			; 白ベタ セット
		LDA	MN_SIRO_DAT0,Y
		STA	!MNACNPS07-(40H+2),X
		LDA	MN_SIRO_DAT1,Y
		STA	!MNACNPS07+(0*40H)-2,X
		STA	!MNACNPS07+(1*40H)-2,X
		STA	!MNACNPS07+(2*40H)-2,X
		LDA	MN_SIRO_DAT2,Y
		STA	!MNACNPS07+(3*40H)-2,X
		INX
		INX
		INY
		INY
		CPY	#MN_SIRO_DAT1-MN_SIRO_DAT0
		BCC	MN_HLDR_01A0
;
		I8			; index 8bit mode
;
		STZ	<WORK10
		LDX	!HOLDERFG
		BEQ	MN_HLDR_0210
		LDA	#00080H
		STA	<WORK10
MN_HLDR_0210	EQU	$
		LDX	#000
MN_HLDR_0220	EQU	$			; アイコン セット
		LDA	AICON_DTAD,X
		ORA	<WORK10
		ORA	MN_AICN_ATR,X
		STA	<WORK0
		LDA	MN_BUFF_ADR,X
		CLC
		ADC	<WORK20
		STA	<WORKA
		CLC
		ADC	#00040H
		STA	<WORKC
		CLC
		ADC	#00040H
		STA	<WORKE
		JSR	AICONSET_SUB
		INX
		INX
		CPX	#MN_BUFF_ADR_E-MN_BUFF_ADR
		BCC	MN_HLDR_0220
;
		LDA	#00008*2
		STA	R9
		LDA	#BANK MN_CMODENO
		STA	!CCWORK0
		LDA	#MN_CMODENO
		STA	!CCWORK1
		M_CHIP	MPCHRVRMST
		M8				; memory 8bit mode
;
		LDA	!HOLDERFG
		EOR	#001
		AND	#001
		STA	!HOLDERFG
;
		JSR	MINI_HLDR0
;
		INC	!MN_HLDR_MD
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*			アイコンキャラクター作成 ＆ ＤＭＡ転送	*
;*						その１		*
;****************************************************************
MINI_HLDR_1000	EQU	$
		JSR	MINI_AICN_DMA0
		BRA	MINI_HLDR_1_2
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*			アイコンキャラクター ＤＭＡ転送		*
;*						その２		*
;****************************************************************
MINI_HLDR_2000	EQU	$
		JSR	MINI_AICN_DMA1
		LDA	#011H
		STA	!WMANSL
MINI_HLDR_1_2	EQU	$
		STZ	!HLDRMODE
		INC	!MN_HLDR_MD
		BRA	MINI_HLDR_3900
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				ウィンドゥ オープン		*
;****************************************************************
MINI_HLDR_3000	EQU	$
		JSR	MINI_HLDR3
		LDA	!HLDRMODE
		BEQ	MINI_HLDR_3900
		INC	!MN_HLDR_MD
		M16				; memory 16bit mode
		LDA	!MN_HLDR_MD
		CMP	#MN_BACK
		BCC	MINI_HLDR_3050
		LDA	!CORSLPT
		ASL	A
		TAX
		LDA	MPCSLSET_DAT,X
		BRA	MINI_HLDR_3090
MINI_HLDR_3050	EQU	$
		LDA	#05ACCH
		STA	!ICONGO_X
MINI_HLDR_3090	EQU	$
		STA	!ICONMV_X
		M8				; memory 8bit mode
		BRA	MINI_HLDR_3990
MINI_HLDR_3900	EQU	$
		LDA	!MN_HLDR_MD
		CMP	#MN_BACK
		BCC	MINI_HLDR_3990
		JSR	HISCRE_PUSH_OBJ
MINI_HLDR_3990	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				ウィンドゥ 閉じる		*
;****************************************************************
MINI_HLDR_4000	EQU	$
		JSR	MINI_HLDR4
		STZ	!HLDRMODE
		INC	!MN_HLDR_MD
		M16				; memory 16bit mode
		LDA	#00007
		STA	!MN_CRSL
		M8				; memory 8bit mode
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				ミニゲーム セレクト		*
;****************************************************************
MN_HLDR_5_DT	EQU	$
		HEX	034H,032H
		HEX	064H,032H
		HEX	094H,032H
		HEX	0C4H,032H
		HEX	034H,05AH
		HEX	064H,05AH
		HEX	094H,05AH
		HEX	0CCH,05AH
;
MN_LR_CMP0	EQU	$-1
		BYTE	004*2,007*2
MN_LR_CMP1	EQU	$-1
		BYTE	000*2,003*2
;
MN_UD_DAT	EQU	$-1
		HEX	004H,0FCH
;			 下   上
;
;
MINI_HLDR_5000	EQU	$
		LDA	!ICONGO_X
		ORA	!ICONGO_Y
		BNE	MINI_HLDR_5990
;
		LDA	<KEYC2
		AND	#003			; 左右キー ON ?
		BEQ	MINI_HLDR_5100		;	NO -> MINI_HLDR_5100
		TAX
		LDA	!MN_CRSL
		CLC
		ADC	MPCURSOL_INC0,X
		BPL	MINI_HLDR_5020
		LDA	#007
MINI_HLDR_5020	EQU	$
		CMP	#008
		BCC	MINI_HLDR_5040
		LDA	#000
MINI_HLDR_5040	EQU	$
		STA	!MN_CRSL
		ASL	A
		TAY
		M16				; memory 16bit mode
		LDA	MN_HLDR_5_DT,Y
		STA	!ICONGO_X
		M8				; memory 8bit mode
		TYA
		CMP	MN_LR_CMP0,X
		BEQ	MINI_HLDR_5060
		CMP	MN_LR_CMP1,X
		BNE	MINI_HLDR_5080
MINI_HLDR_5060	EQU	$
		M16				; memory 16bit mode
		LDA	!ICONGO_X
		STA	!ICONMV_X
		M8				; memory 8bit mode
MINI_HLDR_5080	EQU	$
		BRA	MINI_HLDR_5190
;
MINI_HLDR_5100	EQU	$
		LDA	<KEYC2
		AND	#00CH			; 上下キー ON ?
		BEQ	MINI_HLDR_5200		;	NO -> MINI_HLDR_5200
		LSR	A
		LSR	A
		TAX
		LDA	!MN_CRSL
		CLC
		ADC	MN_UD_DAT,X
		BMI	MINI_HLDR_5200
		CMP	#008
		BCS	MINI_HLDR_5200
		STA	!MN_CRSL
		ASL	A
		TAX
		M16				; memory 16bit mode
		LDA	MN_HLDR_5_DT,X
		STA	!ICONGO_X
		M8				; memory 8bit mode
MINI_HLDR_5190	EQU	$
		LDA	#05CH
		JSL	>SOUND_3_ON		; sound set!!
		BRA	MINI_HLDR_5990
;
MINI_HLDR_5200	EQU	$
		LDA	<KEYC2L
		AND	#11000000B
		ORA	<KEYC2			; "A" or "B" or "START"
		AND	#11010000B		; "X" or "Y" キーＯＮ ?
		BEQ	MINI_HLDR_5300		;	NO -> MINI_HLDR_5300
		INC	!MN_HLDR_MD
		BRA	MINI_HLDR_5990
;
MINI_HLDR_5300	EQU	$
;
MINI_HLDR_5990	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				プッシュ アイコン チェック	*
;****************************************************************
MINI_HLDR_6000	EQU	$
		LDA	!MN_CRSL
		CMP	#007
		BNE	MINI_HLDR_6100
		INC	!MN_HLDR_MD
		LDA	#008
		BRA	MINI_HLDR_6900
;
MINI_HLDR_6100	EQU	$
		LDA	#MN_NEXT
		STA	!MN_HLDR_MD
		LDA	#05DH
;
MINI_HLDR_6900	EQU	$
		JSL	>SOUND_3_ON	; sound set!!
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*			プッシュ アイコン イニシャルセット	*
;****************************************************************
BACK_MAP	EQU	008*00CH+7
;
MINI_HLDR_7000	EQU	$
		M16				; memory 16bit mode
		LDA	#MNACNPS07
		LDX	!HOLDERFG
		BNE	MINI_HLDR_7050
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
MINI_HLDR_7050	EQU	$
		STA	<WORK0
		CLC
		ADC	#00040H
		STA	<WORK2
		CLC
		ADC	#00040H
		STA	<WORK4
;
		LDY	#00000
		LDA	#0398EH
MINI_HLDR_7080	EQU	$
		STA	(<WORK0),Y
		STA	(<WORK2),Y
		STA	(<WORK4),Y
		INY
		INY
		CPY	#006
		BCC	MINI_HLDR_7080
;
		LDA	#01C00H+00020H
		STA	<WORK4
		JSR	HISCORE_DMA
;
		STZ	!HLDRWDW
		LDA	#BACK_MAP
		JSR	HISCRE_PUSH_SUB
;
		INC	!MN_HLDR_MD
		M8				; memory 8bit mode
		JSR	HISCRE_PUSH_OBJ
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				プッシュ アイコン 縮小		*
;****************************************************************
MINI_HLDR_8000	EQU	$
		LDA	#BACK_MAP
		JSR	HISCRE_PUSH_SUB
		LDA	!HLDRWDW
		CLC
		ADC	#008
		STA	!HLDRWDW
		CMP	#040H
		BCC	MINI_HLDR_8090
		INC	!MN_HLDR_MD
;
MINI_HLDR_8090	EQU	$
		JSR	HISCRE_PUSH_OBJ
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				プッシュ アイコン 拡大		*
;****************************************************************
MINI_HLDR_9000	EQU	$
		LDA	!HLDRWDW
		SEC
		SBC	#008
		STA	!HLDRWDW
		BPL	MINI_HLDR_9090
		STZ	!HLDRWDW
		INC	!MN_HLDR_MD
MINI_HLDR_9090	EQU	$
		LDA	#BACK_MAP
		JSR	HISCRE_PUSH_SUB
		JSR	HISCRE_PUSH_OBJ
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				元にもどすイニシャルセット	*
;****************************************************************
MINI_HLDR_A000	EQU	$
		JSR	HLDRCHNG_0000
		STZ	!HLDRMODE
		INC	!MN_HLDR_MD
		JSR	HISCRE_PUSH_OBJ
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				ウィンドゥ 閉じる		*
;****************************************************************
MINI_HLDR_B000	EQU	$
		JSR	MINI_HLDR4
		STZ	!HLDRMODE
		STZ	!MN_HLDR_MD
		LDA	#010H
		STA	!WIND30
		STZ	!WMANSL
		M16				; memory 16bit mode
		STZ	!ICONGO_X
		LDA	!CORSLPT
		ASL	A
		TAX
		LDA	MPCSLSET_DAT,X
		STA	!ICONMV_X
		M8				; memory 8bit mode
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*			ミニゲーム スタート イニシャル セット	*
;****************************************************************
MINI_HLDR_C000	EQU	$
		INC	!MN_HLDR_MD
		LDA	!MN_CRSL
		ASL	A
		TAX
		M16				; memory 16bit mode
		LDA	MN_BUFF_ADR,X
		LDX	!HOLDERFG
		BNE	MINI_HLDR_C020
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
MINI_HLDR_C020	EQU	$
		STA	<WORK0
		CLC
		ADC	#00040H
		STA	<WORK2
		CLC
		ADC	#00040H
		STA	<WORK4
;
		LDY	#000
MINI_HLDR_C040	EQU	$
		LDA	AICNNUK_DT0,Y
		ORA	#MINI_ATR
		STA	(<WORK0),Y
		LDA	AICNNUK_DT1,Y
		ORA	#MINI_ATR
		STA	(<WORK2),Y
		LDA	AICNNUK_DT2,Y
		ORA	#MINI_ATR
		STA	(<WORK4),Y
		INY
		INY
		CPY	#006H
		BCC	MINI_HLDR_C040
;
		LDA	#01C00H+00020H
		STA	<WORK4
		JSR	HISCORE_DMA
;
		STZ	!KAITENCT
		LDA	#00100H
		STA	!SMZOMCT
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				ミニゲーム スタート セット	*
;****************************************************************
MINI_HLDR_D000	EQU	$
		M16				; memory 16bit mode
		LDX	!MN_CRSL
		LDA	MN_CMODENO,X
		AND	#000FFH
		STA	R1		; CMODE NO.
		TXA
		AND	#000FFH
		CLC
		ADC	#008*00CH
		STA	R3		; コース ＮＯ.
		LDA	!KAITENCT
		AND	#000FFH
		STA	R5		; 角度 (0〜FFH)
		LDA	!SMZOMCT
		STA	R6		; 倍率 (100H = 1.0)
;
		M_CHIP	CSINROLSM
;
		JSR	MINI_COL
;
		M16				; memory 16bit mode
		LDA	!KAITENCT
		CLC
		ADC	#00008
		STA	!KAITENCT
		LDA	!SMZOMCT
		DEC	A
		DEC	A
		STA	!SMZOMCT
;
		CMP	#00014H
		BCS	MINI_HLDR_D250
;
		M8				; memory 8bit mode
		LDA	#0F1H
		STA	<SOUND_0	;[♪] ＢＧＭストップ !!
		LDA	#043H
		JSL	>SOUND_3_ON	; sound set!!
		M16				; memory 16bit mode
		STZ	!SMZOMCT
		INC	!MN_HLDR_MD
		LDA	#002
		STA	!KMRCLSCT
;
MINI_HLDR_D250	EQU	$
		I16			; index 16bit mode
		LDX	!OAMIDX
		LDA	!ICONMV_X	;Ｘ座標
		AND	#000FFH
		SEC
		SBC	#00010H
		STA	!SOAM_DX+0,X
		STA	!SOAM_DX+16,X
		CLC
		ADC	#00010H
		STA	!SOAM_DX+8,X
		STA	!SOAM_DX+24,X
;
		LDA	!ICONMV_Y	;Ｙ座標
		AND	#0000FFH
		SEC
		SBC	#00016H
		STA	!SOAM_DX+2,X
		STA	!SOAM_DX+10,X
		CLC
		ADC	#00010H
		STA	!SOAM_DX+18,X
		STA	!SOAM_DX+26,X
;
		LDA	!MN_CRSL
		ASL	A
		TAY
		LDA	MN_AICN_ATR,Y
		LSR	A
		SEC
		SBC	#00600H
		ORA	#031E0H
		STA	!SOAM_DX+4,X
		INC	A
		INC	A
		STA	!SOAM_DX+12,X
		INC	A
		INC	A
		STA	!SOAM_DX+20,X
		INC	A
		INC	A
		STA	!SOAM_DX+28,X
;
		LDA	#04002H		;サイズ
		STA	!SOAM_DX+6,X	;  ＯＢＪ優先順位
		STA	!SOAM_DX+14,X
		STA	!SOAM_DX+22,X
		STA	!SOAM_DX+30,X
;
		TXA
		CLC
		ADC	#00032
		STA	!OAMIDX
;
		MI8			; memory , index 8bit mode
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				アイコン けむり消える		*
;****************************************************************
MINI_HLDR_E000	EQU	$
		JSR	ICONKCLS
		LDA	!KMRCLSIDX
		CMP	#ICONKCLS_XPS-ICONKCLS_TIM
		BCC	MINI_HLDR_E090
		INC	!MN_HLDR_MD
MINI_HLDR_E090	EQU	$
		RTS
;
;
;****************************************************************
;*								*
;*	ミニゲームホルダー					*
;*				ミニゲーム スタート チェック	*
;****************************************************************
MINI_HLDR_F_DAT EQU	$
		BYTE	000H*2,002H*2,006H*2,009H*2
		BYTE	004H*2,00BH*2,00AH*2
;
;
MINI_HLDR_F000	EQU	$
		STZ	!MN_HLDR_MD
		LDX	!MN_CRSL
		LDA	MINI_HLDR_F_DAT,X
		STA	!MINIMD
		LDA	#MINIT
		STA	!MODENO
		LDA	#0FFH
		STA	!MINI_SVBUF
		RTS
;
;
;
;
;
;
		MEM8
		IDX8
;
;
;
;
;
;
		END
