;************************************************************************
;*									*
;*	title name	: "yossy"					*
;*	proccess	: hmap						*
;*	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	HMAPINIT,HMAPPLAY,HMAPDEMO
		GLB	HMAPHIDEMO,HMPWLDCLRDEMO
		GLB	UN_SCRSETS
;
		GLB	WINAREA
;
		GLB	sagi21
;
;------------------------------------------------------------------------
;-		extern symbol						-
;------------------------------------------------------------------------
;
;-------------< ys_main >------------------------------------------------
		EXT	BLNKOFF,VRAMCL,SOUND_TR_2,URAMCLR,VRAMCL2
		EXT	ENRAMCLR,OAMDXCLR,FADEST_SUB,SOUND_3_ON
;
		EXT	GMIN,HMPIN,HMPPL,HMPDM,BNSGM,DMCL
		EXT	HMPHIDM,HMPWDCRDM,MPIN,MINIT,BNSIN,DMIN
		EXT	MAP_SOUND
;
;-------------< ys_save >------------------------------------------------
		EXT	SVDTSV
		EXT	AICONBF_dat
;
;-------------< ys_init >------------------------------------------------
		EXT	GMMDST,VRAMDX_ST,UNCOMPRES_X
		EXT	HMPCHRST,HMPCOLSET,DIVDTST
		EXT	HMPMD
;
;-------------< ys_enmy >------------------------------------------------
		EXT	ENCSET_DM
;
;-------------< ys_rpro >------------------------------------------------
		EXT	CHIPON,NEWVMADL
;
;-------------< ys_hlder >------------------------------------------------
		EXT	MAP_WINDOWS,UN_MPWINDCLOS
		EXT	UN_AICONDEMO_COL,UN_AICONSET_SUB
		EXT	UN_ICNVRMST,HOLDERINIT
		EXT	UN_HISCORE,BIGYS_COL_CHG,UN_BIGYS_COLST
		EXT	UN_MONO_COL_CHK,MAKIMONO
;
		EXT	MPCURSOL_MIN,MPCSLSET_DAT,HLDRSLCT_DAT
		EXT	CMODE_DAT1,AICON_DTAD,AICON_ATR0,WORLD_CORS
		EXT	AICON_BFAD
;
		EXT	UN_HISCR_DM,UN_HISCR_END,UN_ICNCLS
		EXT	UN_HISCORE_SET,UN_HISCORE_SUB
;
;;;;K;;;;		EXT	BNS_HLDER_INT,BNS_HLDER
;
;-------------< ys_mapdt >-----------------------------------------------
		EXT	MPSTATBL,MPSTATUS
;
;-------------< ys_mpen >------------------------------------------------
;;;;K;;;;		EXT	MAP_OBJ_INIT,MAP_OBJ
;
;------------------------------------------------------------------------
;-		define symbol						-
;------------------------------------------------------------------------
;
;
;
;************************************************************************
;*									*
;*		program start						*
;*									*
;************************************************************************
;
;
;
		EXTEND
;
;
		MEM8
		IDX8
;
Group_17	GROUP	Hmap_pro
Hmap_pro	SECT	REL
;
;----------------------------------------------------------------
;
;
;****************************************************************
;*								*
;*	横スクロールマップ イニシャル セット			*
;*								*
;****************************************************************
HMAPINIT_DT0	EQU	$
		BYTE	00001001B	; DMA control parameter
		BYTE	007H		; B bus address
		LWORD	MPHDMA0		; A bus address (B,H,L)
;
HMAPINIT_DT0_S	EQU	$
		BYTE	6CH+00H
		HEX	01C,01C
		BYTE	74H+00H
		HEX	001,009
		HEX	000		; end code
;
;-------< ＢＧ１ スクロール値 コントロール >---------------------
HMAPINIT_DT1	EQU	$
		BYTE	00000011B	; DMA control parameter
		BYTE	00DH		; B bus address
		LWORD	MPHDMA1		; A bus address (B,H,L)
;
HMAPINIT_DT1_S	EQU	$
		BYTE	6CH+00H
		WORD	00000H,00000H
		BYTE	74H+00H
		WORD	00000H,00000H
		HEX	000		; end code
;
;-------< ＢＧ２ スクロール値 コントロール >---------------------
HMAPINIT_DT2	EQU	$
		BYTE	00000011B	; DMA control parameter
		BYTE	00FH		; B bus address
		LWORD	MPHDMA2		; A bus address (B,H,L)
;
HMAPINIT_DT2_S	EQU	$
		BYTE	6CH+00H
		WORD	00000H,00000H
		BYTE	74H+00H
		WORD	00000H,00000H
		HEX	000		; end code
;
;-------< ウィンドウ　ＯＮ／ＯＦＦ　スイッチ >-------------------
HMAPINIT_DT3	EQU	$
		BYTE	00001000B	; DMA control parameter
		BYTE	023H		; B bus address
		LWORD	MPHDMA3		; A bus address (B,H,L)
;
HMAPINIT_DT3_S	EQU	$
		BYTE	6AH+00H
		HEX	032H
		BYTE	76H+00H
		HEX	033H
		HEX	000H		; end code
;
HMAPINIT_DT4	EQU	$
		BYTE	00001001B	; DMA control parameter
		BYTE	024H		; B bus address
		LWORD	MPHDMA4		; A bus address (B,H,L)
;
HMAPINIT_DT4_S	EQU	$
		BYTE	30H+00H
		HEX	000H,000H
		BYTE	3AH+00H
		HEX	003H,002H
		BYTE	76H+00H
		HEX	003H,003H
		HEX	000H		; end code
;
;------- ウィンドウ ---------------------------------------------
HMAPINIT_DT5	EQU	$
		BYTE	01000100B	; DMA control parameter
		BYTE	026H		; B bus address
		LWORD	MPHDMA5		; A bus address (B,H,L)
;
HMAPINIT_DT5_S	EQU	$
		BYTE	18H+00H
		WORD	MPHDMABF5
		BYTE	52H+80H
		WORD	MPHDMABF5+4
		BYTE	76H+00H
		WORD	MPHDMABF51
		HEX	000		; end code
;
HMAPINIT_DT6	EQU	$
		BYTE	00001000B	; DMA control parameter
		BYTE	031H		; B bus address
		LWORD	MPHDMA6		; A bus address (B,H,L)
;
HMAPINIT_DT6_S	EQU	$
		BYTE	6AH+00H
		HEX	0A6H
		BYTE	76H+00H
		HEX	0B7H
		HEX	000		; end code
;
HMAPINIT_DT_END EQU	$
;
;
WINAREA		EQU	$
		HEX	FF,FF,FF,FF,FF,FF,FF,FF
		HEX	FF,FF,FF,FF,FF,FF,FF,FF
		HEX	FE,FE,FE,FE,FE,FE,FE,FE
		HEX	FE,FE,FE,FE,FD,FD,FD,FD
		HEX	FD,FD,FD,FD,FC,FC,FC,FC
		HEX	FC,FC,FC,FB,FB,FB,FB,FB
		HEX	FA,FA,FA,FA,FA,F9,F9,F9
		HEX	F9,F9,F8,F8,F8,F8,F7,F7
		HEX	F7,F7,F6,F6,F6,F5,F5,F5
		HEX	F5,F4,F4,F4,F3,F3,F3,F2
		HEX	F2,F2,F1,F1,F1,F0,F0,F0
		HEX	EF,EF,EF,EE,EE,ED,ED,ED
		HEX	EC,EC,EB,EB,EB,EA,EA,E9
		HEX	E9,E8,E8,E7,E7,E7,E6,E6
		HEX	E5,E5,E4,E4,E3,E3,E2,E2
		HEX	E1,E0,E0,DF,DF,DE,DE,DD
		HEX	DD,DC,DB,DB,DA,DA,D9,D8
		HEX	D8,D7,D6,D6,D5,D4,D4,D3
		HEX	D2,D2,D1,D0,D0,CF,CE,CD
		HEX	CD,CC,CB,CA,CA,C9,C8,C7
		HEX	C7,C6,C5,C4,C3,C2,C2,C1
		HEX	C0,BF,BE,BD,BC,BB,BA,B9
		HEX	B9,B8,B7,B6,B5,B4,B3,B2
		HEX	B1,AF,AE,AD,AC,AB,AA,A9
		HEX	A8,A7,A5,A4,A3,A2,A1,9F
		HEX	9E,9D,9C,9A,99,98,96,95
		HEX	94,92,91,8F,8E,8C,8B,89
		HEX	88,86,84,83,81,7F,7D,7C
		HEX	7A,78,76,74,72,70,6E,6C
		HEX	6A,68,65,63,61,5E,5C,59
		HEX	56,53,50,4D,4A,47,43,3F
		HEX	3B,37,32,2D,27,20,17,00
;
;
HLDRCLAER	EQU	$
		WORD	001BFH
;
;
;
HMAPINIT	EQU	$
		JSL	>VRAMCL		; V-ram clear !!
		JSL	>URAMCLR	; use RAM clear
		LDA	#DMCL
		JSL	>VRAMCL2	; VRAM clear
		JSL	>DIVDTST	; div data set sub !!
		JSL	>ENRAMCLR	; enemy RAM clear
		JSL	>OAMDXCLR	;OAM clear
;
;-------------- モード セット -----------------------------------
		LDX	#HMPMD
		JSL	>GMMDST
;
		LDA	#00000011B
		STA	OBJSEL
		STA	2101H
		STZ	FADMK
;
;-------------- ホルダー スクリーン クリア ----------------------
		M16			; memory 16bit mode
		LDX	#00000000B
		STX	2115H		; inc mode set
		LDA	#01C00H
		STA	2116H		; VRAM address
		LDA	#00001001B+(18H*100H)
		STA	4300H		; DMA paramer & B bus address
		LDA	#HLDRCLAER
		STA	4302H		; A bus address(L,H) set
		LDX	#BANK HLDRCLAER
		STX	4304H		;	"       (B) set
		LDA	#00800H
		STA	4305H		; number of byte set
		LDY	#00000001B
		STY	420BH		; DMA ON!!
;
		LDX	#10000000B
		STX	2115H		; inc mode set
		LDA	#01C00H
		STA	2116H		; VRAM address
		LDA	#00001001B+(19H*100H)
		STA	4300H		; DMA paramer & B bus address
		LDA	#HLDRCLAER+1
		STA	4302H		; A bus address(L,H) set
		LDA	#00800H
		STA	4305H		; number of byte set
		STY	420BH		; DMA ON!!
		M8			; memory 8bit mode
;
;-------------- キャラクター セット -----------------------------
		JSL	>HMPCHRST
;
;-------------- カラー セット -----------------------------------
		MI16			; memory,index 16 bit mode
		STZ	!P_COLOR
;
		JSL	>HMPCOLSET
;
;;;;;;;;		MI8			; memory,index 8bit mode
		MEM8
		IDX8
;
		M16			; memory 16bit mode
		JSL	>UN_MPWINDCLOS
		M8			; memory 8bit mode
;
;-------------- Ｈ−ＤＭＡ パラメータ セット --------------------
		LDX	#004
HMAPINIT_500	EQU	$
		LDA	HMAPINIT_DT0,X
		STA	4370H,X
		LDA	HMAPINIT_DT1,X
		STA	4360H,X
		LDA	HMAPINIT_DT2,X
		STA	4350H,X
		LDA	HMAPINIT_DT3,X
		STA	4340H,X
		LDA	HMAPINIT_DT4,X
		STA	4330H,X
		LDA	HMAPINIT_DT5,X
		STA	4320H,X
		LDA	HMAPINIT_DT6,X
		STA	4310H,X
		DEX
		BPL	HMAPINIT_500
;
		LDA	#BANK MPHDMABF5 ; ウィンドゥ バッファ
		STA	4327H		;	バンク セット
;
		LDX	#HMAPINIT_DT5-HMAPINIT_DT4_S-1
HMAPINIT_520	EQU	$
		LDA	HMAPINIT_DT0_S,X
		STA	>MPHDMA0,X
		LDA	HMAPINIT_DT1_S,X
		STA	>MPHDMA1,X
		LDA	HMAPINIT_DT2_S,X
		STA	>MPHDMA2,X
		LDA	HMAPINIT_DT3_S,X
		STA	>MPHDMA3,X
		LDA	HMAPINIT_DT4_S,X
		STA	>MPHDMA4,X
		LDA	HMAPINIT_DT5_S,X
		STA	>MPHDMA5,X
		LDA	HMAPINIT_DT6_S,X
		STA	>MPHDMA6,X
		DEX
		BPL	HMAPINIT_520
;
		LDA	#000H
		STA	!MKMN_CLS
		DEC	A
		STA	!MKMN_CLS+1
;
;-------------- 赤ちゃんの乗っている ヨッシー カラー チェンジ ---
		LDX	!MPTYPE
		LDA	!MAPOINT
		PHA
		SEC
		SBC	>WORLD_CORS,X
		CMP	#008
		BCC	HMAPINIT_530
		LDA	>WORLD_CORS,X
		STA	!MAPOINT
		LDA	!000
HMAPINIT_530	EQU	$
		STA	!YOSHIPOS
;
		JSL	>UN_BIGYS_COLST
		PLA
		STA	!MAPOINT
;
;-------------- コース クリア チェック --------------------------
HMAPINIT_550	EQU	$
		JSR	CORSCLRCK
;
		LDA	#BANK AICONBF_dat
		STA	<WORK2
		M16			; memory 16bit mode
		LDA	#00C0BH
		STA	!AICONBF1+10
		STA	!AICONBF2+10
		STA	!AICONBF3+10
		STA	!AICONBF4+10
		STA	!AICONBF5+10
		STA	!AICONBF6+10
;
		LDX	!BAKPOS
		CPX	#009
		BCC	HMAPINIT_580
		LDX	!MPTYPE
		LDA	>AICONBF_dat,X
		STA	<WORK0
;
		LDX	#000
HMAPINIT_570	EQU	$
		LDA	[<WORK0]
		STA	<WORK4
		LDA	(<WORK4)
		AND	#000FH
		BEQ	HMAPINIT_575
		INC	<WORK0
		INC	<WORK0
		INX
		CPX	#009
		BCC	HMAPINIT_570
HMAPINIT_575	EQU	$
		DEX
;
HMAPINIT_580	EQU	$
		TXA
		AND	#000FFH
		STA	!BAKPOS
		LDA	!MAPOINT
		STA	!BAKCORS	;前に行った コースＮＯ.
;
;-------------- オール１００点チェック ---------------------------
		LDX	!MPTYPE
		STZ	!MANTEN_MD
		LDA	>WORLD_CORS,X
		TAX
		LDA	!AICONBF1+8,X	; すでにスペシャルアイコンが
		CMP	#00A09H		;	でているか ?
		BEQ	HMAPINIT_700	;	YES -> HMAPINIT_700
		LDA	#0F0F0H
		STA	!AICONBF1+8,X
		LDY	#008
		STZ	<WORK0
HMAPINIT_650	EQU	$
		LDA	!HISCEBF,X
		AND	#000FFH
		CLC
		ADC	<WORK0
		STA	<WORK0
		INX
		DEY
		BNE	HMAPINIT_650
		LDA	<WORK0
		CMP	#00100*8
		BCC	HMAPINIT_700
		INC	!MANTEN_MD
;
;-------------- ホルダー イニシャル セット ----------------------
HMAPINIT_700	EQU	$
		M8			; memory 8bit mode
		JSL	>HOLDERINIT
;

HMAPINIT_709	EQU	$
		M16			; memory 16 bit mode
		LDA	!MPTYPE
		STA	!SCHMPTYP
;
;-------------- マップ　プレイヤー　イニシャル　セット --------------
		I16				; index 16bit mode
		LDA	#00009
		STA	<P_TIME
;
;-------------- スクロール値 セット -----------------------------
		STZ	<SCCH1
		STZ	<SCCV1
		STZ	<SCCH2
		LDA	#00080H
		STA	<SCCV2
;
;;;;;;;;		STZ	<SCCH3
		STZ	<SCCV3
		LDA	#002D0H
		STA	<MPSCH1
		LDA	#00000H
		STA	<MPSCV1
;;;;;;;;		STZ	<MPSCH2
		STZ	<MPSCV2
;
		LDA	SCHMPTYP
		ASL	A
		ASL	A
		ORA	BAKPOS
		ASL	A
		ASL	A
		ASL	A
		STA	<MPMVCT		; map player move pointer set !!
;
		LDX	#00001
		LDA	MODENO
		CMP	#HMPDM
		BEQ	HMAPINIT_750
;
		DEX
;
HMAPINIT_750	EQU	$
		STX	<PLPOUS
;
		LDA	BAKPOS
		STA	<BEFRPT
		LDA	SCHMPTYP
		ASL	A
		ASL	A
		ORA	BAKPOS
		INC	A
		ASL	A
		TAY
		LDA	!YPINTDT,Y
		SEC
		SBC	#00004
		STA	<N_YPOS
		LDA	!XPINTDT,Y
		SEC
		SBC	#00008
		STA	<N_XPOS
;
		JSR	SCRSETS		; scroll set sub !!
;
		MEM8
		IDX8
;
;-------------- ホルダースクリーン ＆--------------
		M16			; memory 16bit mode
		LDX	#10000000B
		STX	2115H		; inc mode set
		LDA	#01C00H+00020H
		STA	2116H		; VRAM address
		LDA	#00000001B+(18H*100H)
		STA	4300H		; DMA paramer & B bus address
		LDA	#HOLDERBF0
		STA	4302H		; A bus address(L,H) set
		LDX	#BANK HOLDERBF0
		STX	4304H		;	"       (B) set
		LDA	#00380H
		STA	4305H		; number of byte set
		LDY	#00000001B
		STY	420BH		; DMA ON!!
;
		LDA	#2000H
		STA	2116H		; VRAM address
		LDA	#WOB7CHR
		STA	4302H		; A bus address(L,H) set
		LDX	#BANK WOB7CHR
		STX	4304H		;	"       (B) set
		LDA	#1000H
		STA	4305H		; number of byte set
		STY	420BH		; DMA ON!!
;
		MI8			; memory,index 8bit mode
;
;-------------- マップ敵イニシャル ------------------------------
;
		JSL	>NEWVMADL
;
;-------------- サウンドプログラム転送 (マップ) -----------------
		LDX	#MAP_SOUND    ;(X) <-- サウンドプログラム転送テーブルＮｏ．
		JSL	>SOUND_TR_2
;
;-------------- マップ サウンドフラグ ＯＮ ----------------------
		LDA	GM_SOUND_0
		BNE	HMAPINIT_800	;サウンドフラグセットＯＫ？ ( no:HMAPINIT_800 )
;
		LDA	#008
		CLC
		ADC	!CLR_WOLD
		STA	<SOUND_0
		CMP	#009
		BEQ	HMAPINIT_900
		LDA	!MPCLRTBL+12*(6-1)+7
		AND	#07FH			; エンディングまで行ったか ?
		BEQ	HMAPINIT_800		;	NO -> HMAPINIT_800
		INC	<SOUND_0
;
HMAPINIT_800	EQU	$
		LDA	!MODENO
		CMP	#HMPWDCRDM
		BCC	HMAPINIT_900
		DEC	<SOUND_0
;
HMAPINIT_900	EQU	$
		JSL	>BLNKOFF	;blanking "OFF"
;
		LDA	#11111110B
		STA	!HD420C
;
		JMP	HMAPDEMO_900
;
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	SCRSETS ( scroll set sub )			x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
		MEM16
		IDX16
;
SCRSETS		EQU	$
		LDX	#00000
		LDA	SCHMPTYP
		ASL	A
		ASL	A
		ORA	BAKPOS
		ASL	A
		STA	<POSPOT
;;;;;;;;		LDA	SCHMPTYP
;;;;;;;;		ASL	A
;;;;;;;;		CLC
;;;;;;;;		ADC	SCHMPTYP
;;;;;;;;		ASL	A
;;;;;;;;		CLC
;;;;;;;;		ADC	BAKPOS
;;;;;;;;		ASL	A
;;;;;;;;		STA	<POSPOT
		TAY
		LDA	!SCRCHDT,Y
		STA	<WINDMK
		LDA	!YPINTDT,Y
		SEC
		SBC	#00004
		STA	<P_YPOS		; player Y position set !!
		STA	<WINYPS		; window Y position set !!
		LDA	!XPINTDT,Y
		SEC
		SBC	#00008
		STA	<P_XPOS		; player X position set !!
		STA	<WINXPS		; window X position set !!
		SEC
		SBC	#00074H
		BMI	SCR050
;
		TAX
		CMP	#00100H
		BCC	SCR050
;
		LDX	#00100H
;
SCR050		EQU	$
		TXA
		STA	<MPSCH1
		STA	ESCCH1
		STA	<MPSCH2
		STA	<MOKUSR
		STA	<SCCH3
;
		JMP	MPOAMST		; map OBJ OAM set !!
;
;
UN_SCRSETS	EQU	$
		JSR	SCRSETS
		RTL
;
;
		MEM8
		IDX8
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		コース クリア チェック				+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CORSCLRCK	EQU	$
		STZ	!NTHLDRFG
		STZ	!BKHISCRE
		LDA	#HMPPL
		STA	!MODENO		; モードＮＯ. セット
		STZ	!AICNDEM
		JSR	BAKPOSSET
		LDA	!CORSCLR	; コース クリア ?
		BEQ	CORSCLRCK_200	;	NO -> CORSCLRCK_200
;
CORSCLRCK_100	EQU	$
		LDX	!MAPOINT
		LDA	#001
		STA	!MPCLRTBL,X
;
		INC	!AICNDEM	; アイコン デモ モード ＯＮ !!
;
		MI16			; memory , index 16bit mode
		TXA
		AND	#000FFH
		ASL	A
		TAX
		LDA	>MPSTATBL,X
		TAX
		LDA	>MPSTATUS+3,X	; go to next point NO. set
		MI8			; memory , index 8bit mode
		TAY
		LDA	!MPCLRTBL,Y
		BNE	CORSCLRCK_300
		STY	!MAPOINT
		LDX	#0FFH
		TYA
CORSCLRCK_150	EQU	$
		INX
		SEC
		SBC	#012
		BPL	CORSCLRCK_150
		MI16			; memory , index 16bit mode
		TXA
		AND	#000FFH
		ASL	A
		STA	!MPTYPE		;マップ タイプ セット
		MI8			; memory , index 8bit mode
		JSL	>SVDTSV		; セーブデータ ＳＡＶＥ
		LDA	#HMPDM
		STA	!MODENO		; デモ モードＮＯ. セット
		LDA	!MPTYPE
		LSR	A
		TAX
		LDA	!MAPOINT
		CMP	MPCURSOL_MIN,X
		BNE	CORSCLRCK_300
		STX	!NTHLDRFG
		DEC	!MPTYPE
		DEC	!MPTYPE
		JSR	BAKPOSSET
		LDA	#HMPWDCRDM
		STA	!MODENO		; ワールド クリア デモＮＯ. セット
		LDA	#007
		STA	!YOSHIPOS
CORSCLRCK_200	EQU	$
		BRA	CORSCLRCK_900
;
CORSCLRCK_300	EQU	$
		LDA	!CORSCLR
		BPL	CORSCLRCK_900
		AND	#07FH
		STA	!BKHISCRE
		JSL	>SVDTSV		; セーブデータ ＳＡＶＥ その２
		LDA	#HMPHIDM
		STA	!MODENO		; スコアデモ モードＮＯ. セット
;
CORSCLRCK_900	EQU	$
		STZ	!CORSCLR
CORSCLRCK_990	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	前のポイント ｏｒ 現在のポイントセット		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
BAKPOSSET	EQU	$
		M16			; memory 16bit mode
		LDX	!MPTYPE
		LDA	!MAPOINT
		SEC
		SBC	WORLD_CORS,X
		STA	!BAKPOS
		M8			; memory 8bit mode
		RTS
;
;
;************************************************************************
;*									*
;*		ワールド クリア デモ					*
;*									*
;************************************************************************
WLDCLR_ADR	EQU	$-2
		WORD	WLDCLR_WAIT
		WORD	WLDCLR_000
WLDCLR_ADR_STT	WORD	WLDCLR_100
		WORD	WLDCLR_200,WLDCLR_300
;
;;;;K;;;;WLDCLR_ADR_WIT WORD	WLDCLR_WAIT2
WLDCLR_ADR_WIT	WORD	SPECIAL_DEMO
;
WLDCLR_ADR_END	WORD	WLDCLR_400,WLDCLR_500
		WORD	WLDCLR_600,WLDCLR_700
WLDCLR_ADR_MAP	WORD	WLDCLR_WAIT
		WORD	WLDCLR_800
;
WDCR_AR_ST	EQU	(WLDCLR_ADR_STT-WLDCLR_ADR)/2
WDLR_AR_WT	EQU	(WLDCLR_ADR_WIT-WLDCLR_ADR)/2
WDCR_AR_ED	EQU	(WLDCLR_ADR_END-WLDCLR_ADR)/2
WDCR_AR_MP	EQU	(WLDCLR_ADR_MAP-WLDCLR_ADR)/2
;
;
HMPWLDCLRDEMO	EQU	$
		JSL	>OAMDXCLR
;
		LDA	!AICNDEM
		BEQ	HMPWLDCLR_400
		ASL	A
		TAX
		JSR	(WLDCLR_ADR,X)
		STZ	!HLDRMODE
;
HMPWLDCLR_400	EQU	$
		MI16			; memory , index 16bit mode
		JMP	HMAPDEMO_800
;
		MEM8
		IDX8
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+	ワールド クリア スコア表示デモ イニシャル セット	+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_000	EQU	$
		LDX	#000
		BRA	WLDCLR_SET
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		ワールド クリア スコア表示デモ			+
;+				(ホルダーのアイコン部分を消す)	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_100	EQU	$
		LDX	#002
		BRA	WLDCLR_SET
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		ワールド クリア スコア表示デモ			+
;+					(表が見えている間)	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_200	EQU	$
		LDX	#004
		BRA	WLDCLR_SET
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		ワールド クリア スコア表示デモ			+
;+					(裏が見えている間)	+
;+					(ホルダーにセット)	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_300	EQU	$
		LDX	#006
		JSL	>UN_HISCORE
		LDA	!HLDRMODE
		BEQ	WLDCLR_350
		LDA	#WDCR_AR_ST
		STA	!AICNDEM
		STZ	!SCRECNT
		STZ	!SCREBOD
		INC	!COSSCRE
		LDA	!COSSCRE
		CMP	#008
		BCC	WLDCLR_350
		LDA	#WDLR_AR_WT
		STA	!AICNDEM
		STZ	!COSSCRE
;
		LDA	!MANTEN_MD	; スペシャルアイコン出現
		BEQ	WLDCLR_330	;	NO -> WLDCLR_330
		LDA	#SPL_NXT0
		STA	!MANTEN_MD
		LDA	#020
		STA	!DMWITMR
;
WLDCLR_330	EQU	$
		LDX	!MPTYPE
		LDA	WORLD_CORS,X
		TAX
		LDY	#008
;
WLDCLR_350	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		ワールド クリア スコア表示デモ			+
;+				(アイコンを元にもどす)		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_400	EQU	$
		LDX	#008
		STX	!SCREBOD
		BRA	WLDCLR_SET
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		ワールド クリア スコア表示デモ			+
;+					(裏が見えている間)	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_500	EQU	$
		LDX	#010
		BRA	WLDCLR_SET
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		ワールド クリア スコア表示デモ			+
;+					(表が見えている間)	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_600	EQU	$
		LDX	#012
;
WLDCLR_SET	EQU	$
		JSL	>UN_HISCORE
		LDA	!HLDRMODE
		BEQ	WLDCLR_PASS
		INC	!AICNDEM
WLDCLR_PASS	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		ワールド クリア スコア表示デモ			+
;+					(ホルダーにセット)	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_700	EQU	$
		LDX	#014
		JSL	>UN_HISCORE
		LDA	!HLDRMODE
		BEQ	WLDCLR_750
		LDA	#004H
		STA	<SCCH2
		LDA	#084H
		STA	<SCCV2
		LDA	#WDCR_AR_ED
		STA	!AICNDEM
		INC	!SCREBOD
		JSL	>UN_HISCORE_SUB
		INC	!COSSCRE
		LDA	!COSSCRE
		CMP	#008
		BCC	WLDCLR_750
		LDA	#WDCR_AR_MP
		STA	!AICNDEM
WLDCLR_750	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		ワールド クリア スコア表示デモ			+
;+				マップモード 再スタート!!	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_800	EQU	$
		INC	!MPTYPE
		INC	!MPTYPE
		LDA	!MPTYPE
		LSR	A
		TAY
		LDX	MPCURSOL_MIN,Y
		LDA	#080H
		STA	!MPCLRTBL,X
		LDA	#0FFH
		STA	!TITLEFG
		LDA	#MPIN
		STA	!MODENO
		STZ	!WLD6_FLG
		STZ	!WLD6_FLG+1
		RTS
;
;
;************************************************************************
;*									*
;*		ハイスコア更新デモ					*
;*									*
;************************************************************************
HMAPHIDEMO_ADR	EQU	$-002
		WORD	OLD_NEW_CHG
		WORD	HI_DEMO_100
		WORD	HI_DEMO_200,HI_DEMO_300
		WORD	WLDCLR_WAIT2
		WORD	HMPHDM_000
HMAPHIDEMO_OBJ	EQU	$
		WORD	HMPHDM_100,HMPHDM_200
		WORD	HMPHDM_300
		WORD	HMPHDM_800
HMAPHIDEMO_PAS	EQU	$
		WORD	SPECIAL_DEMO
;;;;K;;;;		WORD	WLDCLR_WAIT2
		WORD	HMPHDM_900
;
HMPHDM_OBJ	EQU	(HMAPHIDEMO_OBJ-HMAPHIDEMO_ADR)/2
HMPHDM_PAS	EQU	(HMAPHIDEMO_PAS-HMAPHIDEMO_ADR)/2
;
;
HMAPHIDEMO	EQU	$
		JSL	>OAMDXCLR
;
		LDA	!AICNDEM
		BEQ	HMAPHIDEMO_50
		ASL	A
		TAX
		JSR	(HMAPHIDEMO_ADR,X)
		LDA	!AICNDEM
		CMP	#HMPHDM_OBJ
		BCC	HMAPHIDEMO_30
		CMP	#HMPHDM_PAS
		BCS	HMAPHIDEMO_30
		STA	!SCREBOD
		JSR	DMAICONOBJ
;
HMAPHIDEMO_30	EQU	$
		STZ	!HLDRMODE
		BRA	HMAPHIDEMO_80
;
HMAPHIDEMO_50	EQU	$
		LDA	!KNRTMD
		BEQ	HMAPHIDEMO_80
		JSR	SCOR_MODE
;
HMAPHIDEMO_80	EQU	$
		MI16			; memory,index 16 bit mode !!
		JMP	HMAPDEMO_800
;
		MEM8
		IDX8
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		新旧ハイスコア入れ替え				+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
OLD_NEW_CHG	EQU	$
		JSR	WLDCLR_WAIT
		LDA	!DMWITMR
		BNE	OLD_NEW_CHG_90
		LDY	!MAPOINT
		LDA	!HISCEBF,Y
		PHA
		LDA	!BKHISCRE
		STA	!HISCEBF,Y
		PLA
		STA	!BKHISCRE
		LDA	!MPTYPE
		LSR	A
		TAY
		LDA	!MAPOINT
		SEC
		SBC	MPCURSOL_MIN,Y
		STA	!COSSCRE
;
		JSR	HI_DEMO_000
		DEC	!AICNDEM
;
OLD_NEW_CHG_90	EQU	$
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+		デモ  ＷＡＩＴタイマー			+
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_WAIT	EQU	$
		INC	!DMWITMR
		LDA	!DMWITMR
		CMP	#020
		BCC	WLDCLR_WAIT_PAS
		INC	!AICNDEM
		STZ	!DMWITMR
WLDCLR_WAIT_PAS EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		デモ  ＷＡＩＴタイマー２			+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
WLDCLR_WAIT2	EQU	$
		INC	!DMWITMR
		LDA	!DMWITMR
		CMP	#050H
		BCC	WLDCLR_WAIT2_PAS
		INC	!AICNDEM
		STZ	!DMWITMR
WLDCLR_WAIT2_PAS	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		点数アイコン縮小 イニシャルセット		+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HMPHDM_000	EQU	$
		JSL	>UN_ICNCLS	;アイコン部分を消す
;
		M16			; memory 16bit mode
		LDA	#00100H
		STA	!SMZOMCT
		M8			; memory 8bit mode
		LDA	#015H
		STA	<SOUND_3	    ;[♪]
		INC	!AICNDEM
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		点数アイコン縮小				+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HMPHDM_100	EQU	$
		M16			; memory 16bit mode
		LDA	!SMZOMCT
		SEC
		SBC	#00008
		STA	!SMZOMCT
		M8			; memory 8bit mode
		CMP	#020H
		BCS	HMPHDM_150
		INC	!AICNDEM
		LDX	!MAPOINT
		LDA	!BKHISCRE	; ハイスコアもどす
		STA	!HISCEBF,X
		STZ	!BKHISCRE
		LDA	#005
		STA	<SOUND_3
;
HMPHDM_150	EQU	$
		M16			; memory 16bit mode
		LDX	#00011
		JSR	AICONDEMO_SBSB
		M8			; memory 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		点数アイコン拡大				+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HMPHDM_200	EQU	$
		M16			; memory 16bit mode
		LDA	!SMZOMCT
		CLC
		ADC	#00008
		STA	!SMZOMCT
		M8			; memory 8bit mode
		LDA	!SMZOMCT+1
		BEQ	HMPHDM_250
		STZ	!SMZOMCT
		INC	!AICNDEM
;
HMPHDM_250	EQU	$
		M16			; memory 16bit mode
		LDX	#00011
		JSR	AICONDEMO_SBSB
		M8			; memory 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		点数アイコン スコアボード セット		+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HMPHDM_300	EQU	$
		LDX	#00000H
		JSL	>UN_HISCORE
		LDA	!MPTYPE
		LSR	A
		TAX
		LDA	!MAPOINT
		SEC
		SBC	MPCURSOL_MIN,X
		STA	!COSSCRE
		INC	!AICNDEM
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		点数アイコン 新スコア表示			+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HMPHDM_800	EQU	$
		JSL	>UN_HISCORE_SET
		INC	!AICNDEM
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		点数アイコン ＥＮＤ処理				+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HMPHDM_900	EQU	$
		STZ	!AICNDEM
		INC	!KNRTMD
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+								+
;+		スペシャルアイコン出現 デモ			+
;+								+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_ADR	EQU	$-2
		WORD	SPECIAL_000
		WORD	DEMO_SPL_WAIT
SPECIAL_LOOP0	EQU	$
		WORD	SPECIAL_100
		WORD	SPECIAL_200,SPECIAL_300
SPECIAL_NEXT0	EQU	$
		WORD	PERFECT_000
HI_FRASH_START	EQU	$
		WORD	PERFECT_100
PRFCT_COL_STAT	EQU	$
		WORD	PERFECT_200
		WORD	SPECIAL_400,SPECIAL_500
		WORD	SPECIAL_600,SPECIAL_500
		WORD	SPECIAL_600,SPECIAL_500
		WORD	SPECIAL_700,PERFECT_200
		WORD	SPECIAL_800,SPECIAL_500
		WORD	SPECIAL_600,SPECIAL_500
		WORD	SPECIAL_600,SPECIAL_500
		WORD	SPECIAL_900,PERFECT_200
SPECIAL_LOOP1	EQU	$
		WORD	SPECIAL_A00,SPECIAL_B00
		WORD	SPECIAL_C00,SPECIAL_D00
SPECIAL_NEXT1	EQU	$
		WORD	PERFECT_300,PERFECT_400
		WORD	SPECIAL_E00
;
SPL_LOP0	EQU	(SPECIAL_LOOP0-SPECIAL_ADR)/2
SPL_NXT0	EQU	(SPECIAL_NEXT0-SPECIAL_ADR)/2
SPL_LOP1	EQU	(SPECIAL_LOOP1-SPECIAL_ADR)/2
SPL_NXT1	EQU	(SPECIAL_NEXT1-SPECIAL_ADR)/2
PRFCT_COL_STT	EQU	(PRFCT_COL_STAT-SPECIAL_ADR)/2
PRFCT_COL_END	EQU	SPL_NXT1
HI_FH_STT	EQU	(HI_FRASH_START-SPECIAL_ADR)/2
HI_FH_END	EQU	SPL_LOP1
;
;
SPECIAL_DEMO	EQU	$
		STZ	!HLDRMODE
		LDA	!MANTEN_MD
;;;;K;;;;		BRA	SPECIAL_PASS
		BEQ	SPECIAL_PASS
		ASL	A
		TAX
		JSR	(SPECIAL_ADR,X)
		LDA	!MANTEN_MD
		CMP	#HI_FH_STT
		BCC	SPECIAL_END
		CMP	#HI_FH_END
		BCS	SPECIAL_END
		JSR	HI_FRASH_COL
		BRA	SPECIAL_END
;
SPECIAL_PASS	EQU	$
		JSR	WLDCLR_WAIT2
SPECIAL_END	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+	１００点 点滅 カラー アニメーション	+
;++++++++++++++++++++++++++++++++++++++++++++++++
HI_FRASH_COL_DT EQU	$
		WORD	02281H,0095DH
;
;
HI_FRASH_COL	EQU	$
		LDA	<FRCNT
		AND	#004
		LSR	A
		TAX
HI_FRASH_COL_E	EQU	$
		LDA	HI_FRASH_COL_DT,X
		STA	>DATACOL+00003H*20H+00004H*2
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			イニシャルセット		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_000	EQU	$
		LDA	!COSSCRE
		STA	!CORSNO_BK	; クリアしたコースＮｏ.の退避
		LDA	#060
		STA	!DMWITMR
		LDX	#000
		JSR	SPECIAL_JMP
		M16			; memory 16bit mode
		LDA	!CORSNO_BK
		ASL	A
		TAX
		LDA	AICON_BFAD,X
		LDX	!HOLDERFG
		BEQ	SPECIAL_050
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
SPECIAL_050	EQU	$
		CLC
		ADC	#00042H
		STA	<WORKA
		CLC
		ADC	#00040H
		STA	<WORKC
		LDY	#000
		LDA	#021A9H+00C00H
		STA	(<WORKA),Y
		LDA	#021B9H+00C00H
		STA	(<WORKC),Y
		INY
		INY
		LDA	#021AAH+00C00H
		STA	(<WORKA),Y
		LDA	#021BAH+00C00H
		STA	(<WORKC),Y
		M8			; memory 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			ＷＡＩＴタイマー		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DEMO_SPL_WAIT	EQU	$
		M16			; memory 16bit mode
		DEC	!DMWITMR
		LDA	!DMWITMR
		BNE	SPL_WAIT_PAS
		INC	!MANTEN_MD
SPL_WAIT_PAS	EQU	$
		M8			; memory 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			ホルダーのアイコン部分を消す	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_100	EQU	$
		LDA	!COSSCRE
		CMP	!CORSNO_BK	; すでにめくれているか ?
		BNE	SPECIAL_150	;	NO -> SPECIAL_150
		INC	A
		CMP	#008		; ８コース分めくれたか ?
		BCS	SPECIAL_310	;	YES -> SPECIAL_310
		STA	!COSSCRE
SPECIAL_150	EQU	$
		LDX	#002
		BRA	SPECIAL_JMP
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			表が見えている間		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_200	EQU	$
		LDX	#004
SPECIAL_JMP	EQU	$
		JSL	>UN_HISCORE
		LDA	!HLDRMODE
		BEQ	SPECIAL_290
		INC	!MANTEN_MD
SPECIAL_290	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			裏が見えている間		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_300	EQU	$
		LDX	#006
		JSL	>UN_HISCORE
		LDA	!HLDRMODE
		BEQ	SPECIAL_390
SPECIAL_310	EQU	$
		STZ	!SCRECNT
		STZ	!SCREBOD
		LDX	#SPL_LOP0
		INC	!COSSCRE
		LDA	!COSSCRE
		CMP	#008		; ８コース分めくれたか ?
		BCC	SPECIAL_340	;	NO -> SPECIAL_340
		LDA	#020
		STA	!DMWITMR
		STZ	!COSSCRE
		LDX	#SPL_NXT0
SPECIAL_340	EQU	$
		STX	!MANTEN_MD
;
SPECIAL_390	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	"ＰＥＲＦＥＣＴ" 文字デモ			+
;+				イニシャル セット	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PERFECT_000	EQU	$
		LDA	#097H
		JSL	>SOUND_3_ON	; sound set!!
		M16			; memory 16bit mode
		JSR	PRFCT_BF_CLR
;
		I16			; index 16bit mode
		LDA	#BANK WOB7CHR
		STA	<WORK1		;(WK1) <-- 転送元アドレス（Ｂ)
		LDY	#06800H		;(Y) <-- ＶＲＡＭアドレス
		LDX	#WOB7CHR	;(X) <-- 転送元アドレス (Ｌ,Ｈ)
		LDA	#01000H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
		I8			; index 8it mode
;
		LDX	#006*2
		STZ	<WORK0
		LDA	#00028H+00018H
		STA	<WORK2
PERFECT_050	EQU	$
		STZ	!PRFCT_ZOM,X
		LDA	<WORK0
		STA	!PRFCT_FRCT,X
		CLC
		ADC	#00010
		STA	<WORK0
		LDA	<WORK2
		STA	!PRFCT_XPOS,X
		CLC
		ADC	#00018H
		STA	<WORK2
		DEX
		DEX
		BPL	PERFECT_050
		INC	!PRFCT_FRCT+6*2
		MI8			; memory ,index8bt mode
		INC	!MANTEN_MD
		RTS
;
;++++++++++++++++++++++++++++++++++++++++
;+	バッファクリア			+
;++++++++++++++++++++++++++++++++++++++++
		MEM16
PRFCT_BF_CLR	EQU	$
		LDA	#WOB7CHR
		STA	R0		; 転送先アドレス
		LDA	#002
		STA	R1		; 転送先アドレス加算データ
		STZ	R2		; 転送データ
		LDA	#01000H/2
		STA	R12		; 転送ワード数
		M_CHIP	MRAM_FILL
		RTS
		MEM8
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	"ＰＥＲＦＥＣＴ" 文字デモ			+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PRFCT_FRCT_DT	EQU	$
		WORD	00001H,00001H,00001H,00001H
		WORD	00002H,00002H,00002H,00002H
		WORD	00002H,00003H,00003H,00003H
		WORD	00003H
PRFCT_CLS_FRCT	EQU	$
		WORD	00003H,00002H,00002H,00001H
PRFCT_FRCT_DT_E EQU	$
;
PRFCT_ZOOM_DT	EQU	$
		WORD	00030H,00030H,00030H,00030H,00030H
		WORD	0FFD0H,0FFD0H,0FFD0H,0FFD0H
PRFCT_FLIP	EQU	$
		WORD	00000H,00030H,00030H,00030H
;
PRFCT_X_MV_DT	EQU	$-2
		WORD	00003H,00003H,00002H,00002H
		WORD	00002H,00002H,00002H,00002H
		WORD	00001H,00001H,00001H,00001H
		WORD	00001H
;
;
PERFECT_100	EQU	$
		M16			; memory 16bit mode
		LDY	#006*2
PERFECT_120	EQU	$
		LDA	!PRFCT_FRCT,Y
		DEC	A
		STA	!PRFCT_FRCT,Y	; パターンチェンジ ?
		BNE	PERFECT_150	;	NO -> PERFECT_150
		LDX	!PRFCT_CNT,Y
		LDA	PRFCT_FRCT_DT,X
		STA	!PRFCT_FRCT,Y
;
		LDA	!PRFCT_ZOM,Y	; 次のズームサイズセット
		CLC			;
		ADC	PRFCT_ZOOM_DT,X ;
		STA	!PRFCT_ZOM,Y	;
;
		INX
		INX
		CPX	#PRFCT_CLS_FRCT-PRFCT_FRCT_DT	; パターンチェンジ終了 ?
		BCS	PERFECT_140			;	YES -> PERFECT_150
		TXA
		STA	!PRFCT_CNT,Y
		LDA	!PRFCT_XPOS,Y
		SEC
		SBC	PRFCT_X_MV_DT,X
		STA	!PRFCT_XPOS,Y
		BRA	PERFECT_150
;
PERFECT_140	EQU	$
		LDA	#00100H
		STA	!PRFCT_ZOM,Y
;
PERFECT_150	EQU	$
		DEY
		DEY
		BPL	PERFECT_120
;
		LDX	#006*2
		LDA	#00000H
PERFECT_180	EQU	$
		CLC
		ADC	!PRFCT_ZOM,X
		DEX
		DEX
		BPL	PERFECT_180
		CMP	#00100H*7	; 文字表示セット終了 ?
		BNE	PERFECT_190	;	NO -> PERFECT_190
;
		INC	!MANTEN_MD
		LDA	#00070H
		STA	!DMWITMR
PERFECT_190	EQU	$
		JSR	PERFECT_DMA
		JSR	PERFECT_OBJ
		JSR	KRKR_OBJ_NO1
		M8			; memory 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+	"ＰＥＲＦＥＣＴ" 文字 ＤＭＡ転送	+
;++++++++++++++++++++++++++++++++++++++++++++++++
PRFCT_CHR_ADR	EQU	$
		WORD	CHR11A+4000H+410H*8+001H	;Ｐ
		WORD	CHR11A+4000H+414H*8+001H	;Ｅ
		WORD	CHR11A+4000H+418H*8+001H	;Ｒ
		WORD	CHR11A+4000H+41CH*8+001H	;Ｆ
		WORD	CHR11A+4000H+414H*8+001H	;Ｅ
		WORD	CHR11A+4000H+010H*8+001H	;Ｃ
		WORD	CHR68+00000H+418H*8+000H	;Ｔ
;
PRFCT_CHR_BANK	EQU	$
		BYTE	BANK CHR11A
		BYTE	BANK CHR11A
		BYTE	BANK CHR11A
		BYTE	BANK CHR11A
		BYTE	BANK CHR11A
		BYTE	BANK CHR11A
		BYTE	BANK CHR68
;
PRFCT_BTMP_X	EQU	$
		BYTE	000H,020H,040H,060H
		BYTE	000H,020H,040H
;
PRFCT_BTMP_Y	EQU	$
		BYTE	000H,000H,000H,000H
		BYTE	020H,020H,020H
;
;
		MEM16
PERFECT_DMA	EQU	$
		JSR	PRFCT_BF_CLR
;
		I16			; index 16bit mode
		LDX	#006*2
		STX	<WORK0
		STZ	<WORK2
PRFCT_DMA_150	EQU	$
		LDX	<WORK0
		LDY	<WORK2
		LDA	!PRFCT_ZOM,X
		BEQ	PRFCT_DMA_160
		LDA	#00100H
		STA	R6		; 倍率（１００Ｈ＝１．０)
		LDA	#(4*8)/2
		STA	R8		; 中心＿Ｘ
		STA	R9		;   " ＿Ｙ
		LDA	!PRFCT_ZOM,X
		STA	R11		; Ｙ倍率セット
		LDA	PRFCT_CHR_ADR,Y
		STA	R12		; キャラクターアドレス（Ｌ，Ｈ)
		TYA
		LSR	A
		TAY
		LDA	PRFCT_BTMP_Y,Y
		AND	#000FFH
		STA	R2		; ビットマップ座標＿Ｙ
		LDA	PRFCT_BTMP_X,Y
		AND	#000FFH
		STA	R3		;	"         ＿Ｘ
		LDA	PRFCT_CHR_BANK,Y
		AND	#000FFH
		STA	R13		;	"                (Ｂ）
		I8			; index 8bit mode
		M_CHIP	C_32_ZOOM_XY
		I16			; index 16bit mode
PRFCT_DMA_160	EQU	$
		INC	<WORK2
		INC	<WORK2
		DEC	<WORK0
		DEC	<WORK0
		BPL	PRFCT_DMA_150
;
		LDA	#BANK WOB7CHR
		STA	<WORK1		;(WK1) <-- 転送元アドレス（Ｂ)
		LDY	#06800H		;(Y) <-- ＶＲＡＭアドレス
		LDX	#WOB7CHR+000H	;(X) <-- 転送元アドレス (Ｌ,Ｈ)
		LDA	#01000H		;(A) <-- 転送バイト数
		JSL	>VRAMDX_ST
;
		I8			; index 8bit mode
		RTS
		MEM8
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+	"ＰＥＲＦＥＣＴ" 文字 ＯＢＪ セット	+
;++++++++++++++++++++++++++++++++++++++++++++++++
PRFCT_OBJ_NO	EQU	$
		WORD	03EC8H,03EC4H,03EC0H,03E8CH
		WORD	03E88H,03E84H,03E80H
;
FLIP		EQU	PRFCT_FLIP-PRFCT_ZOOM_DT
;
PRFCT_YPOS	EQU	00028H
;
;
		MEM16
PERFECT_OBJ	EQU	$
		I16			; index 16bit mode
		LDX	#006*2
		LDY	!OAMIDX
;
PRFCT_OBJ_200	EQU	$
		LDA	!PRFCT_ZOM,X		; ＯＢＪ セット ＯＫ ?
		BNE	PRFCT_OBJ_210		;	YES -> PRFCT_OBJ_210
		JMP	PRFCT_OBJ_290
PRFCT_OBJ_210	EQU	$
		LDA	!PRFCT_XPOS,X
		STA	!SOAM_DX+8*0+0,Y	; Ｘ座標
		STA	!SOAM_DX+8*1+0,Y
		CLC
		ADC	#00010H
		STA	!SOAM_DX+8*2+0,Y
		STA	!SOAM_DX+8*3+0,Y
		STA	!SOAM_DX+8*4+0,Y
		STA	!SOAM_DX+8*5+0,Y
;
		LDA	#08000H
		STA	<WORK0
		LDA	!PRFCT_CNT,X
		CMP	#FLIP
		BCC	PRFCT_OBJ_240
		STZ	<WORK0
		LDA	#PRFCT_YPOS
		STA	!SOAM_DX+8*0+2,Y	; Ｙ座標
		PHA
		CLC
		ADC	#00010H
		STA	!SOAM_DX+8*1+2,Y
		PLA
		STA	!SOAM_DX+8*2+2,Y
		CLC
		ADC	#00008H
		STA	!SOAM_DX+8*3+2,Y
		CLC
		ADC	#00008H
		STA	!SOAM_DX+8*4+2,Y
		CLC
		ADC	#00008H
		STA	!SOAM_DX+8*5+2,Y
		BRA	PRFCT_OBJ_250
PRFCT_OBJ_240	EQU	$
		LDA	#PRFCT_YPOS
		STA	!SOAM_DX+8*1+2,Y	; Ｙ座標
		PHA
		CLC
		ADC	#00010H
		STA	!SOAM_DX+8*0+2,Y
		PLA
		STA	!SOAM_DX+8*5+2,Y
		CLC
		ADC	#00008H
		STA	!SOAM_DX+8*4+2,Y
		CLC
		ADC	#00008H
		STA	!SOAM_DX+8*3+2,Y
		CLC
		ADC	#00008H
		STA	!SOAM_DX+8*2+2,Y
;
PRFCT_OBJ_250	EQU	$
		LDA	PRFCT_OBJ_NO,X
		ORA	<WORK0
		STA	!SOAM_DX+8*0+4,Y	; キャラＮＯ.
		PHA
		ORA	#00020H
		STA	!SOAM_DX+8*1+4,Y
		PLA
		INC	A
		INC	A
		STA	!SOAM_DX+8*2+4,Y
		CLC
		ADC	#00010H
		STA	!SOAM_DX+8*3+4,Y
		CLC
		ADC	#00010H
		STA	!SOAM_DX+8*4+4,Y
		CLC
		ADC	#00010H
		STA	!SOAM_DX+8*5+4,Y
;
		LDA	#00002H
		STA	!SOAM_DX+8*0+6,Y	;サイズ ＆ ＯＢＪ優先順位
		STA	!SOAM_DX+8*1+6,Y
		LDA	#00000H
		STA	!SOAM_DX+8*2+6,Y
		STA	!SOAM_DX+8*3+6,Y
		STA	!SOAM_DX+8*4+6,Y
		STA	!SOAM_DX+8*5+6,Y
;
		TYA
		CLC
		ADC	#00008*6
		TAY
PRFCT_OBJ_290	EQU	$
		DEX
		DEX
		BMI	PRFCT_OBJ_990
		JMP	PRFCT_OBJ_200
;
PRFCT_OBJ_990	EQU	$
		STY	!OAMIDX
		JSR	PRFCT_COL_SET
		I8			; index 8bit mode
		RTS
		MEM8
;
;++++++++++++++++++++++++++++++++++++++++
;+	キラキラ ＯＢＪ セット その１	+
;++++++++++++++++++++++++++++++++++++++++
KRKR_NO1_DT0	EQU	$
		BYTE	011H,012H,013H,014H
		BYTE	015H,080H,00FH,010H
		BYTE	011H,012H,013H,080H
		BYTE	080H,080H
;
KRKR_NO1_DT1	EQU	$
		BYTE	080H,080H,080H,080H
		BYTE	011H,012H,013H,014H
		BYTE	080H,080H,080H,080H
		BYTE	080H,080H
;
KRKR_NO1_CHR	EQU	$
		WORD	03FCBH,03FDBH,03FCBH,03FDAH
		WORD	03FCAH,03FCBH,03FCBH,03FDBH
		WORD	03FCBH,03FDAH,03FCAH,03FCBH
		WORD	03FCBH,03FCBH
;
;
		MEM16
KRKR_OBJ_NO1	EQU	$
		I16			; index 16bit mode
		LDX	#006*2
		LDA	!OAMIDX
		STA	<WORK0
KRKR_NO1_100	EQU	$
		LDA	!PRFCT_CNT,X
		BEQ	KRKR_NO1_900
		TAY
		PHA
		LDA	KRKR_NO1_CHR,Y
		STA	<WORK4
		PLA
		LSR	A
		TAY
		LDA	KRKR_NO1_DT0,Y
		AND	#000FFH
		CMP	#00080H
		BCS	KRKR_NO1_500
		LDY	#PRFCT_YPOS
		STY	<WORK2
		JSR	KRKR_SET_SB
;
KRKR_NO1_500	EQU	$
		LDA	!PRFCT_CNT,X
		TAY
		PHA
		LDA	KRKR_NO1_CHR,Y
		STA	<WORK4
		PLA
		LSR	A
		TAY
		LDA	KRKR_NO1_DT1,Y
		AND	#000FFH
		CMP	#00080H
		BCS	KRKR_NO1_900
		LDY	#PRFCT_YPOS+010H
		STY	<WORK2
		JSR	KRKR_SET_SB
;
KRKR_NO1_900	EQU	$
		DEX
		DEX
		BPL	KRKR_NO1_100
		LDA	<WORK0
		STA	!OAMIDX
		I8			; index 8bit mode
		RTS
		MEM8
;
;++++++++++++++++++++++++++++++++
;+	キラキラ セット サブ	+
;+	in			+
;+	 A   : Ｘの量		+
;+	wrk0 : index		+
;+	wrk2 : Ｙ座標		+
;+	wrk4 : キャラＮＯ.	+
;++++++++++++++++++++++++++++++++
		MEM16
		IDX16
KRKR_SET_SB	EQU	$
		LDY	<WORK0
		ADC	!PRFCT_XPOS,X
		STA	!SOAM_DX+0,Y		; Ｘ座標
		LDA	<WORK2
		STA	!SOAM_DX+2,Y		; Ｙ座標
		LDA	<WORK4
		STA	!SOAM_DX+4,Y		; キャラＮＯ.
		LDA	#04000H
		STA	!SOAM_DX+6,Y		; サイズ ＆ ＯＢＪ優先順位
		LDA	<WORK0
		CLC
		ADC	#00008
		STA	<WORK0
		RTS
;
;++++++++++++++++++++++++++++++++++++++++
;+	ＰＥＲＦＥＣＴ 文字		+
;+		カラーアニメーション	+
;++++++++++++++++++++++++++++++++++++++++
PRFCT_COL_DT	EQU	$
		WORD	COL_ADDRESS+PRFCT_COL0
		WORD	COL_ADDRESS+PRFCT_COL1
		WORD	COL_ADDRESS+PRFCT_COL2
		WORD	COL_ADDRESS+PRFCT_COL3
		WORD	COL_ADDRESS+PRFCT_COL4
		WORD	COL_ADDRESS+PRFCT_COL5
		WORD	COL_ADDRESS+PRFCT_COL6
		WORD	COL_ADDRESS+PRFCT_COL7
;
PRFCT_COL_CMP	EQU	$
		WORD	00010H,00006H,00006H,00006H
		WORD	00006H,00006H,00006H,00006H
;
;
PRFCT_COL_SET	EQU	$
		LDA	!MANTEN_MD		;
		CMP	#PRFCT_COL_STT		; カラーアニメーション ＯＫ ?
		BCC	PRFCT_COL_090		;	NO -> PRFCT_COL_090
		CMP	#PRFCT_COL_END		;
		BCS	PRFCT_COL_090
;
		INC	!PRFCT_COL_CT
		LDX	!PRFCT_COL_NO
		LDA	!PRFCT_COL_CT
		CMP	PRFCT_COL_CMP,X
		BCC	PRFCT_COL_050
		STZ	!PRFCT_COL_CT
		INX
		INX
		CPX	#PRFCT_COL_CMP-PRFCT_COL_DT
		BCC	PRFCT_COL_020
		LDX	#00000
PRFCT_COL_020	EQU	$
		STX	!PRFCT_COL_NO

;
PRFCT_COL_050	EQU	$
		LDA	PRFCT_COL_DT,X
		STA	<WORK0
		LDA	#BANK COL_ADDRESS
		STA	<WORK2
;
		LDY	#00000
PRFCT_COL_080	EQU	$
		TYX
		LDA	[<WORK0],Y
		STA	>DATACOL+020H*15+00DH*2,X
		INY
		INY
		CPY	#003H*2
		BCC	PRFCT_COL_080
;
PRFCT_COL_090	EQU	$
		RTS

		MEM8
		IDX8
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			左のアイコン出現 イニシャル	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_400	EQU	$
		INC	!MANTEN_MD
		LDX	!MPTYPE
		LDA	>WORLD_CORS,X
		CLC
		ADC	#008
		STA	!SPL_NO
		TAX
		LDA	#001
		STA	!MPCLRTBL,X
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		LDA	#010H
		STA	!SMZOMCT
		JSR	AICONDEMO_SBSB
		M8			; memory 8bit mode
		LDA	#005H
		STA	<SOUND_3	; sound set!!
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+				アイコンの拡大		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_500	EQU	$
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		LDX	!DMZMMK
		LDA	!SMZOMCT
		CLC
		ADC	AICONDEMO_DAT0,X
		CMP	AICONDEMO_DAT1,X
		BCC	SPECIAL_520
		INC	!MANTEN_MD
		INC	!DMZMMK
		INC	!DMZMMK
		LDA	AICONDEMO_DAT1,X
SPECIAL_520	EQU	$
		BRA	SPECIAL_620
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+				アイコンの縮小		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_600	EQU	$
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		LDX	!DMZMMK
		LDA	!SMZOMCT
		SEC
		SBC	AICONDEMO_DAT0,X
		CMP	AICONDEMO_DAT1,X
		BCS	SPECIAL_620
		INC	!MANTEN_MD
		INC	!DMZMMK
		INC	!DMZMMK
SPECIAL_620	EQU	$
		STA	!SMZOMCT
		LDX	!SPL_NO
		JSR	AICONDEMO_SBSB
		M8			; memory 8bit mode
		LDX	!MPTYPE
		LDA	!SPL_NO
		SEC
		SBC	>WORLD_CORS,X
		JSR	DMAICONOBJ_SB
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			左のアイコン セット		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_700	EQU	$
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		LDA	#00030
		STA	!DMWITMR
		INC	!MANTEN_MD
;
		LDY	#008*2
		LDX	!MPTYPE
		LDA	!SPL_NO
		ASL	A
		TAX
		LDA	>AICON_DTAD+8*2
		ORA	>AICON_ATR0,X
		STA	<WORK0
		JMP	AICNDM_SET_SUB
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			右のアイコン出現 イニシャル	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_800	EQU	$
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		M8			; memory 8bit mode
		INC	!MANTEN_MD
		INC	!SPL_NO
		LDA	!SPL_NO
		TAX
		LDA	#001
		STA	!MPCLRTBL,X
		M16			; memory 16bit mode
		STZ	!DMZMMK
		LDA	#010H
		STA	!SMZOMCT
		JSR	AICONDEMO_SBSB
		M8			; memory 8bit mode
		LDA	#005H
		STA	<SOUND_3	; sound set!!
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			右のアイコン セット		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_900	EQU	$
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		LDA	#00030
		STA	!DMWITMR
		INC	!MANTEN_MD
;
		LDY	#009*2
		LDX	!MPTYPE
		LDA	!SPL_NO
		ASL	A
		TAX
		LDA	>AICON_DTAD+9*2
		ORA	>AICON_ATR0,X
		STA	<WORK0
		JMP	AICNDM_SET_SUB
;
		MEM8
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			アイコンを元にもどす		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_A00	EQU	$
		LDX	#000
		JSR	HI_FRASH_COL_E
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		M8			; memory 8bit mode
		LDX	#008
		STX	!SCREBOD
		JMP	SPECIAL_JMP
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			裏が見えている間		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_B00	EQU	$
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		M8			; memory 8bit mode
		LDX	#010
		JMP	SPECIAL_JMP
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			表が見えている間		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_C00	EQU	$
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		M8			; memory 8bit mode
		LDX	#012
		JMP	SPECIAL_JMP
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			ホルダーにセット		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_D00	EQU	$
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		M8			; memory 8bit mode
		LDX	#014
		JSL	>UN_HISCORE
		LDA	!HLDRMODE
		BEQ	SPECIAL_D90
		LDA	#004H
		STA	<SCCH2
		LDA	#084H
		STA	<SCCV2
		INC	!SCREBOD
		JSL	>UN_HISCORE_SUB
		LDX	#SPL_LOP1
		INC	!COSSCRE
		LDA	!COSSCRE
		CMP	#008			; ８コース分めくれたか ?
		BCC	SPECIAL_D50		;	NO -> SPECIAL_D50
		LDX	#SPL_NXT1
SPECIAL_D50	EQU	$
		STX	!MANTEN_MD
;
SPECIAL_D90	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	"ＰＥＲＦＥＣＴ" 文字デモ			+
;+				ＷＡＩＴタイマー	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PERFECT_200	EQU	$
		JSR	DEMO_SPL_WAIT
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		M8			; memory 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	"ＰＥＲＦＥＣＴ" 文字デモ			+
;+				消滅イニシャルセット	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PERFECT_300	EQU	$
		M16			; memory 16bit mode
		JSR	PERFECT_OBJ
		INC	!MANTEN_MD
		LDX	#006*2
		LDA	#00000
PERFECT_350	EQU	$
		STA	!PRFCT_FRCT,X
		CLC
		ADC	#00010
		DEX
		DEX
		BPL	PERFECT_350
		INC	!PRFCT_FRCT+006*2
		M8			; memory 8bit mode
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	"ＰＥＲＦＥＣＴ" 文字デモ			+
;+				消滅			+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PERFECT_400	EQU	$
		MI16			; memory , index 16bit mode
		LDY	#006*2
PERFECT_420	EQU	$
		LDA	!PRFCT_ZOM,Y	; 消滅したか ?
		BEQ	PERFECT_450	;	YES -> PERFECT_450
		LDA	!PRFCT_FRCT,Y
		DEC	A
		STA	!PRFCT_FRCT,Y	; パターンチェンジ ?
		BNE	PERFECT_450	;	NO -> PERFECT_450
		LDX	!PRFCT_CNT,Y
		LDA	PRFCT_FRCT_DT,X
		STA	!PRFCT_FRCT,Y
;
		LDA	!PRFCT_ZOM,Y	; 次のズームサイズセット
		SEC			;
		SBC	#00030H		;
		STA	!PRFCT_ZOM,Y	;
;
		INX
		INX
		CPX	#PRFCT_FRCT_DT_E-PRFCT_FRCT_DT
		BCC	PERFECT_440
		LDA	#00000
		STA	!PRFCT_ZOM,Y
		STA	!PRFCT_FRCT,Y
		STA	!PRFCT_CNT,Y
		BRA	PERFECT_450
PERFECT_440	EQU	$
		TXA
		STA	!PRFCT_CNT,Y
;
PERFECT_450	EQU	$
		DEY
		DEY
		BPL	PERFECT_420
;
		LDA	!PRFCT_ZOM	;すべての文字が消えたか ?
		BNE	PERFECT_490	;	NO -> PERFECT_490
		LDA	!PRFCT_CNT
		CMP	#PRFCT_STR_CMP	; 星のアニメーション終了 ?
		BCC	PERFECT_490	;	NO -> PERFECT_490
		INC	!MANTEN_MD
		MI8			; memory , index 8bit mode
		BRA	PERFECT_490_90
;
		MEM16
		IDX16
PERFECT_490	EQU	$
		JSR	PERFECT_STAR
		I8			; index 8bit mode
		JSR	PERFECT_DMA
		JSR	PERFECT_OBJ
		M8			; memory 8bit mode
		LDX	#006*2
PERFECT_490_00	EQU	$
		LDA	!PRFCT_CNT,X
		BNE	PERFECT_490_50
		LDA	!PRFCT_FRCT,X
		DEC	A
		BNE	PERFECT_490_50
		LDA	#036H
		JSL	>SOUND_3_ON	; sound set!!
PERFECT_490_50	EQU	$
		DEX
		DEX
		BPL	PERFECT_490_00
PERFECT_490_90	EQU	$
		RTS
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+	"ＰＥＲＦＥＣＴ" 文字デモ		+
;+				消滅 星セット	+
;++++++++++++++++++++++++++++++++++++++++++++++++
PRFCT_STR_FRCP	EQU	$
		WORD	00004H,00004H,00004H,00004H,00004H,00004H
;
PRFCT_STR_XDT0	EQU	$
		BYTE	004H,008H,010H,014H,014H,014H
;
PRFCT_STR_XDT1	EQU	$
		BYTE	004H,001H,000H,0FCH,0FCH,0FCH
;
PRFCT_STR_XDT2	EQU	$
		BYTE	00CH,00DH,010H,014H,014H,014H
;
PRFCT_STR_XDT3	EQU	$
		BYTE	014H,018H,020H,024H,024H,024H
;
PRFCT_STR_YDT0	EQU	$
		BYTE	002H,004H,006H,00AH,00AH,00AH
;
PRFCT_STR_YDT3	EQU	$
		BYTE	002H,004H,006H,00AH,00AH,00AH
;
PRFCT_STR_CMP	EQU	PRFCT_STR_XDT0-PRFCT_STR_FRCP
;
PRFCT_STR_CHR	EQU	$
		WORD	03FCBH,03FDBH,03FCBH,03FDAH,03FCAH,03FCAH
;
;
		MEM16
		IDX16
PERFECT_STAR	EQU	$
		LDX	#006*2
		LDY	!OAMIDX
		STY	<WORK0
;
PRFCT_STR_200	EQU	$
		LDA	!PRFCT_ZOM,X		; ＯＢＪ セット ＯＫ ?
		BEQ	PRFCT_STR_210		;	YES -> PRFCT_STR_210
		JMP	PRFCT_STR_280
PRFCT_STR_210	EQU	$
		INC	!PRFCT_FRCT,X
		LDA	!PRFCT_CNT,X
		TAY
		CPY	#PRFCT_STR_CMP		; アニメーション終了 ?
		BCC	PRFCT_STR_220		;	NO -> PRFCT_STR_220
		JMP	PRFCT_STR_280
PRFCT_STR_220	EQU	$
		LDA	!PRFCT_FRCT,X
		CMP	PRFCT_STR_FRCP,Y	; パターンチェンジ ?
		BCC	PRFCT_STR_230		;	NO -> PRFCT_STR_230
		INC	!PRFCT_CNT,X
		INC	!PRFCT_CNT,X
		LDA	#00000
		STA	!PRFCT_FRCT,X
PRFCT_STR_230	EQU	$
		TYA
		LSR	A
		TAY
		LDA	PRFCT_STR_XDT0,Y
		AND	#000FFH
		STA	<WORK10
		LDA	PRFCT_STR_XDT1,Y
		AND	#000FFH
		STA	<WORK12
		LDA	PRFCT_STR_XDT2,Y
		AND	#000FFH
		STA	<WORK14
		LDA	PRFCT_STR_XDT3,Y
		AND	#000FFH
		STA	<WORK16
		LDA	PRFCT_STR_YDT0,Y
		AND	#000FFH
		STA	<WORK18
		LDA	PRFCT_STR_YDT3,Y
		AND	#000FFH
		STA	<WORK1A
		TYA
		ASL	A
		TAY
		LDA	PRFCT_STR_CHR,Y
		STA	<WORKE
;
		LDY	<WORK0
		LDA	!PRFCT_XPOS,X		; Ｘ座標
		PHA
		SEC
		SBC	<WORK10
		STA	!SOAM_DX+8*0+0,Y
		PLA
		PHA
		CLC
		ADC	<WORK12
		STA	!SOAM_DX+8*1+0,Y
		PLA
		PHA
		CLC
		ADC	<WORK14
		STA	!SOAM_DX+8*2+0,Y
		PLA
		CLC
		ADC	<WORK16
		STA	!SOAM_DX+8*3+0,Y
;
		LDA	#PRFCT_YPOS		; Ｙ座標
		STA	!SOAM_DX+8*1+2,Y
		STA	!SOAM_DX+8*2+2,Y
		CLC
		ADC	<WORK18
		STA	!SOAM_DX+8*0+2,Y
		LDA	#PRFCT_YPOS
		CLC
		ADC	<WORK1A
		STA	!SOAM_DX+8*3+2,Y
;
		LDA	<WORKE			; キャラＮＯ.
		STA	!SOAM_DX+8*0+4,Y
		STA	!SOAM_DX+8*1+4,Y
		STA	!SOAM_DX+8*2+4,Y
		STA	!SOAM_DX+8*3+4,Y
;
		LDA	#04000H			; サイズ ＆ ＯＢＪ優先順位
		STA	!SOAM_DX+8*0+6,Y
		STA	!SOAM_DX+8*1+6,Y
		STA	!SOAM_DX+8*2+6,Y
		STA	!SOAM_DX+8*3+6,Y
;
		TYA
		CLC
		ADC	#00008*4
		STA	<WORK0
;
PRFCT_STR_280	EQU	$
		DEX
		DEX
		BMI	PRFCT_STR_290
		JMP	PRFCT_STR_200
;
PRFCT_STR_290	EQU	$
		LDA	<WORK0
		STA	!OAMIDX
		RTS
		MEM8
		IDX8
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+	スペシャルアイコン出現				+
;+			終了チェック			+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPECIAL_E00	EQU	$
		LDA	#008
		STA	!CORSLPT
		ASL	A
		TAX
		M16			; memory 16bit mode
		LDA	MPCSLSET_DAT,X
		STA	ICONMV_X
		STZ	<SCCH2
		LDA	#00080H
		STA	<SCCV2
		LDX	!MPTYPE
		LDA	>WORLD_CORS,X
		TAY
		LDA	#00A09H
		STA	!AICONBF1+8,Y
		M8			; memory 8bit mode
		JSL	>SVDTSV
		LDX	#HMPPL+1
		LDA	!MODENO
		CMP	#HMPWDCRDM+1
		BCC	SPECIAL_E50
		TAX
		LDA	#WDCR_AR_MP
		STA	!AICNDEM
SPECIAL_E50	EQU	$
		STX	!MODENO
		RTS
;
		MEM8
		IDX8
;
;
;************************************************************************
;*									*
;*		横スクロールマップ デモ					*
;*									*
;************************************************************************
HMAPDEMO	EQU	$
		JSL	>OAMDXCLR
;
		LDA	!KNRTMD
		BNE	HMAPDEMO_100
		MI16			; memory,index 16 bit mode !!
		JSR	PLAYMOV
		BRA	HMAPDEMO_600
		MEM8
		IDX8
;
;-------------- アイコン デモ -------------------------------------------
HMAPDEMO_100	EQU	$
		LDA	!AICNDEM
		BEQ	HMAPDEMO_500
		JSR	AICONDEMO
		BRA	HMAPDEMO_600
;
HMAPDEMO_500	EQU	$
		LDA	!KNRTMD
		BEQ	HMAPDEMO_600
		JSR	SCOR_MODE
HMAPDEMO_600	EQU	$
		MI16			; memory , index 16bit mode
;
HMAPDEMO_800	EQU	$
		JSR	MPOAMST
;
		MEM8
		IDX8
;
HMAPDEMO_900	EQU	$
		M16			; memory 16 bit mode !!
;
		LDA	<MPSCH2
		STA	ESCCH1
;
		M_CHIP	DX_OAM		;OAM convert
;
		M8
;
		PLB
		RTL
;
;
;****************************************************************
;*								*
;*		ヨッシー カラーデータ 入れ替え			*
;*								*
;****************************************************************
BIGYS_DM_COL	EQU	$
		PHP
		MI8			; memory , index 8bit mode
		PHB
		LDA	#BANK DATACOL
		PHA
		PLB
;
		M16			; memory 16bit mode
		LDX	#000
BIGYS_DM_CL_LP	EQU	$
		LDA	!DATACOL+00CH*020H+00DH*2,X
		STA	<WORK0
		LDA	!DATACOL+00DH*020H+00DH*2,X
		STA	!DATACOL+00CH*020H+00DH*2,X
		LDA	<WORK0
		STA	!DATACOL+00DH*020H+00DH*2,X
		INX
		INX
		CPX	#003H*2
		BCC	BIGYS_DM_CL_LP
		M8			; memory 8bit mode
;
		PLB
		PLP
		RTS
;
;
;************************************************************************
;*									*
;*		横スクロールマップ セット				*
;*									*
;************************************************************************
HMAPMV		EQU	$
		WORD	SCRLSET,PLAYSCR,MAPSCRL,MAPSCR1
;
;
HMAPPLAY	EQU	$
		JSL	>OAMDXCLR
;
HMAPPLAY_050	EQU	$
		JSL	>MAP_WINDOWS
;
;-------------------------------------------- test TEST
sagi21		equ	$
		jmp	testTEST_900
		lda	!SVFILEIDX
		cmp	#02H*2
		bne	testTEST_100
;
		lda	!KEYB2
		and	#020h
		beq	testTEST_000
		lda	#0ffh
		sta	!TITLEFG
		inc	!MPTYPE
		inc	!MPTYPE
		lda	#MPIN
		sta	!MODENO
		bra	testTEST_900
;
testTEST_000	equ	$
		lda	!KEYB2L
		cmp	#080h
		bne	testTEST_100
		lda	#HMPIN
		sta	!MODENO
		lda	#080h+100
		sta	!CORSCLR
		M16
		lda	#06464h
		sta	!HISCEBF+0
		sta	!HISCEBF+2
		sta	!HISCEBF+4
		sta	!HISCEBF+6
		lda	#0f0f0h
		sta	!AICONBF1+8
		M8
		bra	testTEST_900
;
testTEST_100	EQU	$
		LDA	!KEYB2L
		AND	#00110000B
		BEQ	testTEST_200
		LDA	#DMIN
		STA	!MODENO
testTEST_200	EQU	$
;
testTEST_900	EQU	$
;-------------------------------------------- test TEST
;
HMAPPLAY_100	EQU	$
		LDX	#000H
		LDA	HLDRMODE
		BNE	HMAPPLAY_120	; フォルダー　スコアー　？
;					; No !!
		LDA	<KEYC2
		ORA	<KEYC1
		AND	#00FH		; キーＯＮ ?
		BEQ	HMAPPLAY_120	;	NO -> HMAPPLAY_120
		LDA	!CORSLPT	;カーソルが
		CMP	#008		;  コースアイコン上に あるか ?
		BCS	HMAPPLAY_120	;	NO -> HMAPPLAY_120
		STA	!YOSHIPOS
		JSL	>BIGYS_COL_CHG
		INX
		INX
HMAPPLAY_120	EQU	$
		LDA	<KEYC1L
		AND	#00110000B
		BEQ	HMAPPLAY_130
;
		LDX	#004
		BRA	HMAPPLAY_150
;
HMAPPLAY_130	EQU	$
		LDA	<MPSCFG
		BEQ	HMAPPLAY_150
;
		LDX	#006
;
HMAPPLAY_150	EQU	$
		JSR	(HMAPMV,X)
;
;----------------------------------------------------------------
;-		fade in/out					-
;----------------------------------------------------------------
HMAPPLAY_200	EQU	$
		LDA	!MPFADFG	; fade in/out end check ?
		BEQ	HMAPPLAY_900	;	NO -> HMAPPLAY_900
;
		DEC	!FADNO		;フェード イン ＯＫ ?
		BNE	HMAPPLAY_900	;	NO -> HMAPPLAY_900
;
		LDA	!FADMK
		EOR	#01H
		STA	!FADMK
		STZ	!FADNO
		STZ	!WIND30
;
;-------------- プレイヤー初期データセット --------------
		LDA	#58H
		STA	!TIMCNT
		STZ	!FRWR_P		; フラワー ポイント
		STZ	!FRWR_P+1	;	クリア !!
;
		M16			; memory 16bit mode
		LDA	!MAPOINT
		CMP	!BAKCORS	; 同じコースに行くのか ?
		BEQ	HMAPPLAY_850	;	YES -> HMAPPLAY_850
		STZ	!PLDNCT
		STZ	!PLUPCT
HMAPPLAY_850	EQU	$
		M8			; memory 8bit mode
		TAY
		LDA	!HISCEBF,Y
		STA	!GOAL_TTL_PT
		LDY	#GMIN+1
		STY	!MODENO		;go to next mode !!
;
		LDA	!MPTYPE
		LSR	A
		TAX
		LDA	!MAPOINT
		CMP	GOTO_BONUS,X	; ボーナス ゲーム へ ?
		BNE	HMAPPLAY_900	;	NO -> HMAPPLAY_900
;
		LDA	#BNSIN
		STA	!MODENO
		TXA
		ASL	A
		STA	!BONUSNO
;
HMAPPLAY_900	EQU	$
		JMP	HMAPDEMO_900
;
;
GOTO_BONUS	EQU	$
		BYTE	009H+12*0,009H+12*1,009H+12*2
		BYTE	009H+12*3,009H+12*4,009H+12*5
		BYTE	009H+12*6,009H+12*7,009H+12*8
;
;
;****************************************************************
;*								*
;*		アイコン デモ					*
;*								*
;****************************************************************
AICONDEMO_ADR	EQU	$-2
		WORD	HI_DEMO_000,HI_DEMO_100
		WORD	HI_DEMO_200,HI_DEMO_300
		WORD	AICONDEMO_000
AICONDEMO_NXT	EQU	$
		WORD	AICNDM_ZOM_SND
		WORD	AICONDEMO_100,AICONDEMO_200
		WORD	AICNDM_ZOM_SND
		WORD	AICONDEMO_100,AICONDEMO_200
		WORD	AICONDEMO_100
		WORD	AICONDEMO_300
		WORD	AICONDEMO_400,AICONDEMO_500
		WORD	HI_DEMO_900
;
AICN_NXT	EQU	(AICONDEMO_NXT-AICONDEMO_ADR)/2
;
;
AICONDEMO	EQU	$
		LDA	!AICNDEM
		BEQ	AICONDEMO_0500
		ASL	A
		TAX
		JSR	(AICONDEMO_ADR,X)
		LDA	!AICNDEM
		CMP	#AICN_NXT
		BCC	AICONDEMO_0500
		LDA	!SCREBOD
		PHA
		STZ	!SCREBOD
		JSR	DMAICONOBJ
		PLA
		STA	!SCREBOD
AICONDEMO_0500	EQU	$
		STZ	!HLDRMODE
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+	ハイスコア表示デモ イニシャル セット		+
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HI_DEMO_000	EQU	$
		DEX
		DEX
		JSL	>UN_HISCORE
		LDA	!BAKPOS
		STA	!COSSCRE
		INC	!AICNDEM
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+		ハイスコア表示デモ			+
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HI_DEMO_100	EQU	$
HI_DEMO_200	EQU	$
HI_DEMO_300	EQU	$
		DEX
		DEX
		JSL	>UN_HISCORE
		LDA	!HLDRMODE
		BEQ	HI_DEMO_123_PS
		INC	!AICNDEM
HI_DEMO_123_PS	EQU	$
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+		ハイスコア表示デモ ＥＮＤ処理		+
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HI_DEMO_900	EQU	$
		LDA	#080H
		STA	<SCCV2
		STZ	<SCCH2
		LDA	#032H
		STA	>MPHDMA4+1	;ウィンドゥ ＯＮ !!
		INC	!AICNDEM
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+		アイコン デモ				+
;+			イニシャル セット		+
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICONDEMO_000	EQU	$
		INC	!AICNDEM
		M16			; memory 16bit mode
		LDA	#00010H
		STA	!SMZOMCT
		JSR	AICONDEMO_SUB
		M8			; memory 8bit mode
		STZ	!DMZMMK
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+		ズーム音セット				+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICNDM_ZOM_SND	EQU	$
		LDA	#015H
		JSL	>SOUND_3_ON	;[♪]
		INC	!AICNDEM
		BRA	AICONDEMO_100
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+		アイコン デモ				+
;+				アイコンの拡大		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICONDEMO_DAT0	EQU	$
		WORD	00008H,00006H,00006H,00004H,00004H
;
AICONDEMO_DAT1 EQU	$
		WORD	000F0H,000C0H,00150H,000F0H,00100H
;
;
AICONDEMO_100	EQU	$
		LDX	!DMZMMK
		M16			; memory 16bit mode
		LDA	!SMZOMCT
		CLC
		ADC	AICONDEMO_DAT0,X
		STA	!SMZOMCT
		CMP	AICONDEMO_DAT1,X
		BCC	AICONDEMO_150
		LDA	!AICONDEMO_DAT1,X
		STA	!SMZOMCT
		INC	!AICNDEM
		INC	!DMZMMK
		INC	!DMZMMK
AICONDEMO_150	EQU	$
		JSR	AICONDEMO_SUB
AICONDEMO_190	EQU	$
		M8			; memory 8bit mode
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+		アイコン デモ				+
;+				アイコンの縮小		+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICONDEMO_200	EQU	$
		LDX	!DMZMMK
		M16			; memory 16bit mode
		LDA	!SMZOMCT
		SEC
		SBC	AICONDEMO_DAT0,X
		STA	!SMZOMCT
		CMP	AICONDEMO_DAT1,X
		BCS	AICONDEMO_250
		INC	!AICNDEM
		INC	!DMZMMK
		INC	!DMZMMK
		BRA	AICONDEMO_290
AICONDEMO_250	EQU	$
		JSR	AICONDEMO_SUB
AICONDEMO_290	EQU	$
		M8			; memory 8bit mode
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+		アイコン デモ				+
;+			アイコンを ホルダーに セット	+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICONDEMO_300	EQU	$
		M16			; memory 16bit mode
		LDA	#00100H
		STA	!SMZOMCT
		JSR	AICONDEMO_SUB
		M8			; memory 8bit mode
		JSR	AICNDM_SET
		LDA	!MPTYPE
		LSR	A
		TAX
		LDY	!MAPOINT
		LDA	#080H
		STA	!MPCLRTBL,Y
		PHY
		TYA
		INC	A
		SEC
		SBC	MPCURSOL_MIN,X
		STA	!AICONBF1,Y
		PLA
		SEC
		SBC	MPCURSOL_MIN,X
		STA	!CORSLPT	; カーソル ポイント セット
		ASL	A
		TAX
		LSR	A
		STA	!BAKPOS
		M16			; memory 16bit mode
		LDA	!MPCSLSET_DAT,X
		STA	!ICONMV_X
		M8			; memory 8bit mode
		INC	!AICNDEM
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+		アイコン デモ				+
;+				霧発生イニシャル セット +
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICONDEMO_400	EQU	$
		INC	!AICNDEM
		STZ	!KIRIFLG
		STZ	!KIRIFLG
		STZ	!AICNDEM
		M16			; meory 16bit mode
		STZ	!MPFADR
		STZ	!MPFADG
		STZ	!MPFADB
		M8			; meory 8bit mode
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+		アイコン デモ				+
;+				霧発生			+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AICONDEMO_500	EQU	$
		STZ	!SMZOMCT
		STZ	!SMZOMCT+1
		STZ	!AICNDEM
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+						+
;+	アイコン デモ ズーム セット		+
;+						+
;++++++++++++++++++++++++++++++++++++++++++++++++
		MEM16
AICONDEMO_SUB	EQU	$
		LDX	!MAPOINT
AICONDEMO_SBSB	EQU	$
		LDA	>CMODE_DAT1,X
		STA	R1
		TXA
		AND	#000FFH
		STA	R3
		LDA	!SMZOMCT
		STA	R6
;
		M_CHIP	MPAICNZM
;
		JSL	>UN_AICONDEMO_COL
;
		RTS
		MEM8
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++
;+						+
;+	アイコンを ホルダーに セット		+
;+						+
;++++++++++++++++++++++++++++++++++++++++++++++++
AICNDM_SET	EQU	$
		M16			; memory 16bit mode
		LDA	!MAPOINT
		ASL	A
		TAX
		LDY	!MPTYPE
		LDA	!MAPOINT
		SEC
		SBC	WORLD_CORS,Y
		STA	<WORK10
		ASL	A
		TAY
		LDA	#01400H
		ORA	AICON_DTAD,Y
		STA	<WORK0		; アイコン キャラＮＯ. セット
;
AICNDM_SET_SUB	EQU	$			; １００点満点デモ用
		LDA	AICON_BFAD,Y
		LDY	!HOLDERFG
		BNE	AICNDM_SET_50
		CLC
		ADC	#HOLDERBF1-HOLDERBF0
AICNDM_SET_50	EQU	$
		STA	<WORKA
		CLC
		ADC	#00040H
		STA	<WORKC
		CLC
		ADC	#00040H
		STA	<WORKE
		JSL	>UN_AICONSET_SUB	; アイコン セット サブルーチン
;
		JSL	>UN_ICNVRMST	; アイコン ＤＭＡセット
		M8			; memory 8bit mode
		RTS
;
;
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+							+
;+	ズーム アイコン オブジェ セット			+
;+							+
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DMAICONOBJ	EQU	$
		LDA	!MPTYPE
		LSR	A
		TAY
		LDA	!MAPOINT
		SEC
		SBC	MPCURSOL_MIN,Y
DMAICONOBJ_SB	EQU	$
		ASL	A
		TAX
		LDA	MPCSLSET_DAT,X
		STA	<WORK0
		STZ	<WORK1
		LDA	MPCSLSET_DAT+1,X
		STA	<WORK2
		STZ	<WORK3
;
		MI16			; memory ,index 16bit mode
		LDX	!MPTYPE
		LDA	>WORLD_CORS,X
		CLC
		ADC	#00008
		STA	<WORK10
		LDX	!OAMIDX
		LDA	<WORK0		;Ｘ座標
		SEC
		SBC	#00010H
		STA	!SOAM_DX+000+00,X
		STA	!SOAM_DX+016+00,X
		CLC
		ADC	#00010H
		STA	!SOAM_DX+008+00,X
		STA	!SOAM_DX+024+00,X
;
		LDA	<WORK2		;Ｙ座標
		SEC
		SBC	#00016H
		STA	!SOAM_DX+000+02,X
		STA	!SOAM_DX+008+02,X
		CLC
		ADC	#00010H
		STA	!SOAM_DX+016+02,X
		STA	!SOAM_DX+024+02,X
;
		LDA	!SCREBOD
		BEQ	DMAICONOBJ_030
		STZ	<WORK0
		LDY	!MAPOINT
		LDA	!HISCEBF,Y
		AND	#000FFH
		CMP	#00030		; ３０点以上 ?
		BCS	DMAICONOBJ_029	;	YES -> DMAICONOBJ_029
		CPY	<WORK10		; スペシャル アイコン デモ ?
		BNE	DMAICONOBJ_028	;	NO -> DMAICONOBJ_028
		TAY
		BEQ	DMAICONOBJ_029
DMAICONOBJ_028	EQU	$
		LDA	#00200H
		STA	<WORK0
DMAICONOBJ_029	EQU	$
		LDA	<WORK0
		BRA	DMAICONOBJ_035
;
DMAICONOBJ_030	EQU	$
		LDA	!MANTEN_MD
		BEQ	DMAICONOBJ_033
		LDY	!MPTYPE
		LDA	!SPL_NO
		ASL	A
		TAY
		LDA	AICON_ATR0,Y
		LSR	A
		SEC
		SBC	#00600H
		BRA	DMAICONOBJ_035
DMAICONOBJ_033	EQU	$
		LDA	#(01400H>>1)-00600H
DMAICONOBJ_035	EQU	$
		ORA	#031CCH
		PHA
		STA	!SOAM_DX+000+04,X
		INC	A
		INC	A
		STA	!SOAM_DX+008+04,X
		PLA
		CLC
		ADC	#00020H
		STA	!SOAM_DX+016+04,X
		INC	A
		INC	A
		STA	!SOAM_DX+024+04,X
;
		LDA	#04002H		;サイズ ＆ ＯＢＪ優先順位
		STA	!SOAM_DX+000+006,X
		STA	!SOAM_DX+008+006,X
		STA	!SOAM_DX+016+006,X
		STA	!SOAM_DX+024+006,X
;
		TXA
		CLC
		ADC	#00032
		STA	!OAMIDX
;
		MI8			; memory , index 8bit mode
		RTS
;
;
;****************************************************************
;*								*
;*		回転スコア もどすデモ				*
;*								*
;****************************************************************
SCOR_MODE	EQU	$
		LDA	!KNRTMD
		BEQ	SCOR_MODE_PAS
		ASL	A
		CLC
		ADC	#UN_HISCR_DM
		TAX
		CMP	#UN_HISCR_END
		BCS	SCOR_MODE_PAS
		JSL	>UN_HISCORE
		LDA	!HLDRMODE
		BEQ	SCOR_MODE_END
		INC	!KNRTMD
		BRA	SCOR_MODE_END
;
SCOR_MODE_PAS	EQU	$
		LDA	#HMPPL+1
		STA	!MODENO
		STZ	!KNRTMD
		LDA	#032H
		STA	>MPHDMA4+1	; ウィンドゥ ＯＮ !!
SCOR_MODE_END	EQU	$
		STZ	!HLDRMODE
		RTS
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	PLAYMOV ( 目的地　スクロール値 sub )		x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;
XMOVPDT		EQU	$
;-------------- world 1 --------------
		WORD	00038H,00000H,00000H,00000H	; [1]
		WORD	00070H,00076H,00000H,00000H	; [2]
		WORD	000A6H,00000H,00000H,00000H	; [3]
		WORD	000E0H,000EEH,00000H,00000H	; [4]
		WORD	00100H,00106H,00000H,00000H	; [5]
		WORD	00146H,00000H,00000H,00000H	; [6]
		WORD	00180H,00190H,00198H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
;-------------- world 2 --------------
		WORD	0003CH,00000H,00000H,00000H	; [1]
		WORD	00076H,00000H,00000H,00000H	; [2]
		WORD	000A8H,000AEH,00000H,00000H	; [3]
		WORD	000E0H,000EEH,00000H,00000H	; [4]
		WORD	0012EH,00000H,00000H,00000H	; [5]
		WORD	00166H,00000H,00000H,00000H	; [6]
		WORD	0019EH,00000H,00000H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
;-------------- world 3 --------------
		WORD	00038H,0004EH,00000H,00000H	; [1]
		WORD	00078H,0007EH,00000H,00000H	; [2]
		WORD	000A4H,000A6H,00000H,00000H	; [3]
		WORD	000E8H,000F6H,00000H,00000H	; [4]
		WORD	00128H,00136H,00000H,00000H	; [5]
		WORD	00176H,00000H,00000H,00000H	; [6]
		WORD	001A8H,001AEH,00000H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
;-------------- world 4 --------------
		WORD	00050H,00000H,00000H,00000H	; [1]
		WORD	0007EH,00000H,00000H,00000H	; [2]
		WORD	000A6H,00000H,00000H,00000H	; [3]
		WORD	000F6H,00000H,00000H,00000H	; [4]
		WORD	00130H,00136H,00000H,00000H	; [5]
		WORD	00170H,00000H,00000H,00000H	; [6]
		WORD	001A8H,00000H,00000H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
;-------------- world 5 --------------
		WORD	0003EH,00000H,00000H,00000H	; [1]
		WORD	00070H,0007EH,00000H,00000H	; [2]
		WORD	000AEH,00000H,00000H,00000H	; [3]
		WORD	000F6H,00000H,00000H,00000H	; [4]
		WORD	00128H,00136H,00000H,00000H	; [5]
		WORD	0016EH,00000H,00000H,00000H	; [6]
		WORD	001A6H,00000H,00000H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
;-------------- world 6 --------------
		WORD	00040H,00046H,00000H,00000H	; [1]
		WORD	00076H,00000H,00000H,00000H	; [2]
		WORD	000A6H,00000H,00000H,00000H	; [3]
		WORD	000F6H,00000H,00000H,00000H	; [4]
		WORD	00128H,0012EH,00000H,00000H	; [5]
		WORD	0015EH,00000H,00000H,00000H	; [6]
		WORD	00196H,00196H,00000H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
YMOVPDT		EQU	$
;-------------- world 1 --------------
		WORD	00078H,00000H,00000H,00000H	; [1]
		WORD	000A0H,000A0H,00000H,00000H	; [2]
		WORD	000A4H,00000H,00000H,00000H	; [3]
		WORD	000A4H,00090H,00000H,00000H	; [4]
		WORD	00084H,00070H,00000H,00000H	; [5]
		WORD	00088H,00000H,00000H,00000H	; [6]
		WORD	00088H,00088H,0008CH,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
;-------------- world 2 --------------
		WORD	00090H,00000H,00000H,00000H	; [1]
		WORD	00098H,00000H,00000H,00000H	; [2]
		WORD	0009CH,0008CH,00000H,00000H	; [3]
		WORD	0008CH,00098H,00000H,00000H	; [4]
		WORD	00098H,00000H,00000H,00000H	; [5]
		WORD	00088H,00000H,00000H,00000H	; [6]
		WORD	00084H,00000H,00000H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
;-------------- world 3 --------------
		WORD	000A0H,00090H,00000H,00000H	; [1]
		WORD	00094H,00080H,00000H,00000H	; [2]
		WORD	00098H,000A0H,00000H,00000H	; [3]
		WORD	000AEH,000A0H,00000H,00000H	; [4]
		WORD	00098H,00080H,00000H,00000H	; [5]
		WORD	000A4H,00000H,00000H,00000H	; [6]
		WORD	000A0H,0008EH,00000H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
;-------------- world 4 --------------
		WORD	000A0H,00000H,00000H,00000H	; [1]
		WORD	00088H,00000H,00000H,00000H	; [2]
		WORD	000AEH,00000H,00000H,00000H	; [3]
		WORD	000A0H,00000H,00000H,00000H	; [4]
		WORD	0009EH,000A2H,00000H,00000H	; [5]
		WORD	00098H,00000H,00000H,00000H	; [6]
		WORD	0008AH,00000H,00000H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
;-------------- world 5 --------------
		WORD	00078H,00000H,00000H,00000H	; [1]
		WORD	00090H,00088H,00000H,00000H	; [2]
		WORD	0007CH,00000H,00000H,00000H	; [3]
		WORD	00070H,00000H,00000H,00000H	; [4]
		WORD	00088H,00088H,00000H,00000H	; [5]
		WORD	00080H,00000H,00000H,00000H	; [6]
		WORD	00078H,00000H,00000H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
;-------------- world 6 --------------
		WORD	000A4H,000A0H,00000H,00000H	; [1]
		WORD	00090H,00000H,00000H,00000H	; [2]
		WORD	00090H,00000H,00000H,00000H	; [3]
		WORD	00098H,00000H,00000H,00000H	; [4]
		WORD	00094H,00098H,00000H,00000H	; [5]
		WORD	00088H,00000H,00000H,00000H	; [6]
		WORD	0009CH,000A4H,00000H,00000H	; [7]
		WORD	00000H,00000H,00000H,00000H	; [8]
;
SPEEDAT		EQU	$
;-------------- world 1 --------------
		WORD	00080H,00080H,00080H,00000H ; [1]
		WORD	00080H,00080H,00080H,00080H ; [2]
		WORD	00080H,00080H,00080H,00000H ; [3]
		WORD	00080H,00080H,00000H,00000H ; [4]
		WORD	00080H,00080H,00080H,00000H ; [5]
		WORD	00080H,08080H,00080H,00080H ; [6]
		WORD	08080H,00080H,00080H,00080H ; [7]
		WORD	00000H,00000H,00000H,00000H ; [8]
;
;-------------- world 2 --------------
		WORD	00080H,00080H,00080H,00000H ; [1]
		WORD	00080H,00080H,00080H,00080H ; [2]
		WORD	00080H,00080H,00080H,00000H ; [3]
		WORD	00080H,00080H,00000H,00000H ; [4]
		WORD	00080H,00080H,00080H,00000H ; [5]
		WORD	00080H,08080H,00080H,00080H ; [6]
		WORD	08080H,00080H,00080H,00080H ; [7]
		WORD	00000H,00000H,00000H,00000H ; [8]
;
;-------------- world 3 --------------
		WORD	00080H,00080H,00080H,00000H ; [1]
		WORD	00080H,00080H,00080H,00080H ; [2]
		WORD	00080H,00080H,00080H,00000H ; [3]
		WORD	00080H,00080H,00000H,00000H ; [4]
		WORD	00080H,00080H,00080H,00000H ; [5]
		WORD	00080H,08080H,00080H,00080H ; [6]
		WORD	08080H,00080H,00080H,00080H ; [7]
		WORD	00000H,00000H,00000H,00000H ; [8]
;
;-------------- world 4 --------------
		WORD	00080H,00080H,00080H,00000H ; [1]
		WORD	00080H,00080H,00080H,00080H ; [2]
		WORD	00080H,00080H,00080H,00000H ; [3]
		WORD	00080H,00080H,00000H,00000H ; [4]
		WORD	00080H,00080H,00080H,00000H ; [5]
		WORD	00080H,08080H,00080H,00080H ; [6]
		WORD	08080H,00080H,00080H,00080H ; [7]
		WORD	00000H,00000H,00000H,00000H ; [8]
;
;-------------- world 5 --------------
		WORD	00080H,00080H,00080H,00000H ; [1]
		WORD	00080H,00080H,00080H,00080H ; [2]
		WORD	00080H,00080H,00080H,00000H ; [3]
		WORD	00080H,00080H,00000H,00000H ; [4]
		WORD	00080H,00080H,00080H,00000H ; [5]
		WORD	00080H,08080H,00080H,00080H ; [6]
		WORD	08080H,00080H,00080H,00080H ; [7]
		WORD	00000H,00000H,00000H,00000H ; [8]
;
;-------------- world 6 --------------
		WORD	00080H,00080H,00080H,00000H ; [1]
		WORD	00080H,00080H,00080H,00080H ; [2]
		WORD	00080H,00080H,00080H,00000H ; [3]
		WORD	00080H,00080H,00000H,00000H ; [4]
		WORD	00080H,00080H,00080H,00000H ; [5]
		WORD	00080H,08080H,00080H,00080H ; [6]
		WORD	08080H,00080H,00080H,00080H ; [7]
		WORD	00000H,00000H,00000H,00000H ; [8]
;
;
		MEM16
		IDX16
;
;
PLAYMOV		EQU	$
		LDA	<MPMVFG
		ASL	A
		TAX
		JMP	(!PLAYADR,X)
;
PLAYMOV_050	EQU	$
;;;;		    LDA	    #028H
;;;;		    STA	    <SOUND0	    ;[♪]
		INC	!KNRTMD
		INC	<POSPOT
		INC	<POSPOT
;
PLAYMOV_100	EQU	$
		RTS
;

;
;
PLAYADR		EQU	$
		WORD	WALKMOV		; プレイヤー歩く処理
BABMV		WORD	BABYMV0		; 赤ちゃん投げポーズ処理
		WORD	BABYMV1		; 赤ちゃん投げ処理
		WORD	BABYMV2		; 赤ちゃん受取ポーズ処理
;
;
BBMV		EQU	(BABMV-PLAYADR)/2
;
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	WALKMOV ( プレイヤー歩く処理 )			x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
WALKMOV		EQU	$
		LDY	<MPMVCT
		LDA	!XMOVPDT,Y
		STA	R1		; 目標Ｘ座標
		LDA	!YMOVPDT,Y
		STA	R2		; 目標Ｙ座標
		LDA	<P_XPOS
		STA	R3		; 現在Ｘ座標
		LDA	<P_YPOS
		STA	R4		; 現在Ｙ座標
		LDA	!SPEEDAT,Y
		AND	#07FFFH
		STA	R6		; 移動スピード
;
		PHY
;
		I8			; index 8 bit mode !!
;
		M_CHIP	SEARCH_SPEED
;
		I16			; index 16 bit mode !!
;
		PLY
;
		LDX	#00000
		LDA	R1
		BPL	WALKMOV_050	; X speed plas ?
;					; No !!
		DEX
;
WALKMOV_050	EQU	$
		CLC
		ADC	P_XSDR
		STA	<WORK0
		TXA
		ADC	P_XPOS+1
		STA	<WORK2
;
		LDX	#00000
		LDA	R2
		BPL	WALKMOV_100	; Y speed plas ?
;					; No !!
		DEX
;
WALKMOV_100	EQU	$
		CLC
		ADC	P_YSDR
		STA	<WORK4
		TXA
		ADC	P_YPOS+1
		STA	<WORK6
;
		LDX	#00000
		LDA	<WORK1
		SEC
		SBC	!XMOVPDT,Y
		BCC	WALKMOV_150	; 目標Ｘ座標オーバー　？
;					; Yes !!
		EOR	R1
		BMI	WALKMOV_150	; X point over ?
;					; Yes !!
		LDA	!XMOVPDT,Y
		XBA
		STA	<WORK8
		AND	#0FF00H
		STA	<WORK0
		LDA	<WORK8
		AND	#000FFH
		STA	<WORK2
		INX
;
WALKMOV_150	EQU	$
		LDA	<WORK0
		STA	P_XSDR		; プレイヤーＸ（Ｌ）ポジションセット
		LDA	<WORK2
		STA	P_XPOS+1	; プレイヤーＸ（Ｈ）ポジションセット
;
		LDA	<WORK5
		SEC
		SBC	!YMOVPDT,Y
		BCC	WALKMOV_200	; 目標Ｙ座標オーバー　？
;					; Yes !!
		EOR	R2
		BMI	WALKMOV_200	; Y point over ?
;					; Yes !!
		LDA	!YMOVPDT,Y
		XBA
		STA	<WORK8
		AND	#0FF00H
		STA	<WORK4
		LDA	<WORK8
		AND	#000FFH
		STA	<WORK6
		INX
;
WALKMOV_200	EQU	$
		LDA	<WORK4
		STA	P_YSDR		; プレイヤーＹ（Ｌ）ポジションセット
		LDA	<WORK6
		STA	P_YPOS+1	; プレイヤーＹ（Ｈ）ポジションセット
;
		CPX	#00002
		BNE	WALKMOV_350	; next pointer ?
;					; Yes !!
		INY
		INY
		STY	<MPMVCT
		TYA
		AND	#00007H
		BEQ	WALKMOV_300	; next pointer end ?
;					; No !!
		LDA	!XMOVPDT,Y
		ORA	!YMOVPDT,Y
		BNE	WALKMOV_350	; map player move end ?
;					; Yes !!
WALKMOV_300	EQU	$
		LDA	#BBMV
		STA	<MPMVFG
		LDA	#00002
		STA	<PLPOUS		; マップＯＡＭセットフラグセット
		LDA	#00008H
		STA	<NGTIME
;
WALKMOV_350	EQU	$
		LDA	<P_XPOS
;
WALKMOV_370	EQU	$
		LDX	#00000
		SEC
		SBC	#00074H
		BMI	WALKMOV_400	; プレイヤー左の方にいる　？
;					; No !!
		TAX
		CMP	#00100H
		BCC	WALKMOV_400	; プレイヤー右の方にいる　？
;					; Yes !!
		LDX	#00100H
;
WALKMOV_400	EQU	$
		TXA
		STA	<MPSCH1
		STA	<MPSCH2
		STA	<MOKUSR
		STA	<SCCH3
;
		RTS
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	BABYMV0 ( 赤ちゃん投げポーズ処理 )		x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NAGETMD		EQU	$
		WORD	00008H,00008H,00000H
;
;
BABYMV0		EQU	$
		DEC	<NGTIME
		BNE	BABYMV0_050	; タイマー”０”　？
;					; Yes !!
		INC	<NAGCNT
		LDA	<NAGCNT
		ASL	A
		TAY
		LDA	!NAGETMD,Y
		STA	<NGTIME
		BNE	BABYMV0_050	; 赤ちゃんを投げる　？
;					; Yes !!
		LDA	<P_YPOS
		STA	<A_YPOS		; 赤ちゃんＹ座標セット
		LDA	<P_XPOS
		STA	<A_XPOS		; 赤ちゃんＸ座標セット
		STZ	<A_YSPD
		LDA	#0FFFCH
		STA	<A_YSPD+2	; 赤ちゃんＹスピードセット
		LDA	#0E000H
		STA	<A_XSPD		; 赤ちゃんＸスピードセット
		STZ	<A_XSPD+2
		INC	<MPMVFG		; モードインク
		LDA	#00003
		STA	<PLPOUS		; マップＯＡＭセットフラグセット
;
BABYMV0_050	EQU	$
		RTS
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	BABYMV1 ( 赤ちゃん投げ処理 )			x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BABYMV1		EQU	$
		LDA	<A_XSPD
		CLC
		ADC	<A_XSDR
		STA	<A_XSDR
		LDA	<A_XPOS
		ADC	<A_XSPD+2
		STA	<A_XPOS
;
		LDA	<A_YSPD
		CLC
		ADC	#04000H
		STA	<A_YSPD
		LDA	<A_YSPD+2
		ADC	#00000H
		STA	<A_YSPD+2
;
		LDA	<A_YSPD
		CLC
		ADC	<A_YSDR
		STA	<A_YSDR
		LDA	<A_YPOS
		ADC	<A_YSPD+2
		STA	<A_YPOS
;
		LDA	<A_YPOS
		CMP	<N_YPOS
		BCC	BABYMV1_050	; 赤ちゃん次のヨッシーに乗った　？
;					; Yes !!
		LDY	<P_YPOS
		LDX	<P_XPOS
		LDA	<N_YPOS
		STA	<P_YPOS
		LDA	<N_XPOS
		STA	<P_XPOS
		STY	<N_YPOS
		STX	<N_XPOS
;
		LDA	#00004
		STA	<PLPOUS		; マップＯＡＭセットフラグセット
		STZ	<NAGCNT		; パターンカウンタークリアー
		LDA	#00010H
		STA	<NGTIME		; パターンタイマーセット
		INC	<MPMVFG
;
;-------------- ヨッシー カラーデータ 入れ替え ------------------
		JSR	BIGYS_DM_COL
;
		JMP	WALKMOV_350
;
BABYMV1_050	EQU	$
;
		LDA	<A_XPOS
		JMP	WALKMOV_370
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	BABYMV2 ( 赤ちゃん受取ポーズ処理 )		x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BABYMV2		EQU	$
		DEC	<NGTIME
		BNE	BABYMV2_050	; タイマー”０”　？
;					; Yes !!
		STZ	<NAGCNT
		LDA	#00005
		STA	<PLPOUS		; マップＯＡＭセットフラグセット
		LDA	#00008
		STA	<NGTIME
		JMP	PLAYMOV_050
;
BABYMV2_050	EQU	$
		RTS
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	PLAYSCR ( 目的地　スクロール値 sub )		x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
XPINTDT		EQU	$
;-------------- world 1 --------------
		WORD	00030H,00058H,00098H,000C8H,00110H,00128H,00168H,001B8H
;
;-------------- world 2 --------------
		WORD	00030H,00060H,00098H,000D0H,00110H,00150H,00188H,001C0H
;
;-------------- world 3 --------------
		WORD	00030H,00070H,000A0H,000C8H,00118H,00158H,00198H,001D0H
;
;-------------- world 4 --------------
		WORD	00030H,00070H,000A0H,000C8H,00118H,00158H,00190H,001C8H
;
;-------------- world 5 --------------
		WORD	00030H,00060H,000A0H,000D0H,00118H,00158H,00190H,001C8H
;
;-------------- world 6 --------------
		WORD	00030H,00068H,00098H,000C8H,00118H,00150H,00180H,001B8H
;
YPINTDT		EQU	$
;-------------- world 1 --------------
		WORD	0009CH,0007CH,000A4H,000A8H,00094H,00074H,0008CH,00090H
;
;-------------- world 2 --------------
		WORD	000A4H,00094H,0009CH,00090H,0009CH,0009CH,0008CH,0008CH
;
;-------------- world 3 --------------
		WORD	000ACH,00094H,00084H,000A4H,000A4H,00084H,000ACH,00090H
;
;-------------- world 4 --------------
		WORD	0009CH,000A4H,0008CH,000B0H,000A4H,000A4H,0009CH,0008CH
;
;-------------- world 5 --------------
		WORD	000ACH,0007CH,0008CH,00080H,00074H,0008CH,00084H,0007CH
;
;-------------- world 6 --------------
		WORD	000ACH,000A4H,00094H,00094H,0009CH,0009CH,0008CH,000A8H
;
SCRCHDT		EQU	$
;-------------- world 1 --------------
		WORD	00001H,00001H,00001H,00001H,00001H,00001H,00000H,00001H
;
;-------------- world 2 --------------
		WORD	00001H,00001H,00001H,00001H,00001H,00001H,00000H,00001H
;
;-------------- world 3 --------------
		WORD	00001H,00001H,00001H,00001H,00001H,00001H,00000H,00001H
;
;-------------- world 4 --------------
		WORD	00001H,00001H,00001H,00001H,00001H,00001H,00000H,00001H
;
;-------------- world 5 --------------
		WORD	00001H,00001H,00001H,00001H,00001H,00001H,00000H,00001H
;
;-------------- world 6 --------------
		WORD	00001H,00001H,00001H,00001H,00001H,00001H,00000H,00001H
;
SCRDATA		EQU	$
		WORD	00002H,0FFFEH
;
PITCHRD		EQU	$
		WORD	03D60H,03F66H,03960H,03F60H,03966H,03D66H,03B66H,03B60H
;
;------------------------------ ６ＷＯＲＬＤ 看板持ち ヨッシー キャラクターＮｏ.
PITCHRD_SB	EQU	$
		WORD	03D60H,03F66H,03960H,03F60H,03966H,03D66H,03B66H,03D60H
;
PITCRD1		EQU	$
		WORD	00000H,00004H,00002H,00004H
;
PITCRD2		EQU	$
		WORD	0390FH,0391FH,0392FH,0393FH,0393BH,0393CH,0393DH,0393EH
;
PITYPSD		EQU	$
		WORD	00000H,00001H,00002H,00001H
;
CHARDAT		EQU	$
		WORD	02900H,02903H,02906H,02903H
;
PITCRD3		EQU	$
		WORD	02D4AH,02D4CH,02D4AH,02D4CH
;
;
PLAYSCR		EQU	$
		MI16			; memory,index 16 bit mode !!
;
		LDA	SCHMPTYP
		ASL	A
		ASL	A
		ORA	YOSHIPOS
		ASL	A
		STA	<POSPOT		; position pointer set !!
		TAY
		LDX	#00000
		LDA	!YPINTDT,Y
		SEC
		SBC	#00004
		STA	<P_YPOS		; player Y position set !!
		LDA	!XPINTDT,Y
		SEC
		SBC	#00008
		STA	<P_XPOS		; player X position set !!
		SEC
		SBC	#00074H
		BMI	PYR050		; H scroll ?
;					; Yes !!
		TAX
		CMP	#00100H
		BCC	PYR050		; H scroll stop ?
;					; No !!
		LDX	#00100H
;
PYR050		EQU	$
		STX	<MOKUSR		; 目的地　スクロール　セット !!
;
		LDA	#00000
		CPX	<MPSCH2
		BCS	PYR100		; 右　スクロール ?
;					; Yes !!
		INC	A
		INC	A
;
PYR100		EQU	$
		STA	<MOKUMK		; 目的地　向き　セット !!
		STZ	<PLPOUS
;
SCRLSET		EQU	$
		MI16			; memory,index 16 bit mode !!
;
		LDA	<MPSCH2
		CMP	<MOKUSR		; 目的地までスクロールしたか ?
		BEQ	MPOAMST		;	YES -> MPOAMST
;
		LDX	<MOKUMK
		LDA	<MPSCH2
		CLC
		ADC	!SCRDATA,X
		AND	#0FFFEH
		STA	<MPSCH1
		STA	<MPSCH2
		STA	<SCCH3
;
MPOAMST		EQU	$
		JSL	>MAKIMONO	; 巻物の両側 オブジェセット
;
		LDA	<PLPOUS
		ASL	A
		TAX
		JMP	(MPOAMAD,X)
;
;
MPOAMAD		EQU	$
		WORD	NMALSET		; プレイヤーＯＡＭセット
		WORD	MOVESET		; プレイヤームーブＯＡＭセット
		WORD	NAGESET		; プレイヤー投げＯＡＭセット
		WORD	BJMPSET		; 赤ちゃんジャンプＯＡＭセット
		WORD	UKETSET		; プレイヤー受けＯＡＭセット
		WORD	BYBYSET		; プレイヤーバイバイＯＡＭセット
;
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	NMALSET ( プレイヤーＯＡＭセット )		x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NMALSET		EQU	$
		DEC	<P_TIME
		BNE	MAT050		; player timer "0" ?
;					; Yes !!
		LDA	#00009
		STA	<P_TIME
		LDA	<P_CCNT
		INC	A
		AND	#00003H
		STA	<P_CCNT		; プレイヤーパターンカウンターセット
;
MAT050		EQU	$
		LDX	OAMIDX
		LDA	<P_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+00H,X	; 赤ちゃんＸポジションセット
		STA	SOAM_DX+10H,X	; ヨッシー身体Ｘポジションセット
		CLC
		ADC	#00008H
		STA	SOAM_DX+08H,X	; ヨッシー頭Ｘポジションセット
;;;;K;;;;		STA	SOAM_DX+28H,X	; 家Ｘポジションセット
		CLC
		ADC	#00008H
		STA	SOAM_DX+20H,X	; 看板Ｘポジションセット
		CLC
		ADC	#00004H
		STA	SOAM_DX+18H,X	; 看板数字Ｘポジションセット
;
		LDA	<P_YPOS
		SEC
		SBC	<MPSCV2
		STA	SOAM_DX+0AH,X	; ヨッシー頭Ｙポジションセット
		CLC
		ADC	#00001H
		STA	SOAM_DX+02H,X	; 赤ちゃんＹポジションセット
		CLC
		ADC	#00003H
;;;;K;;;;		STA	SOAM_DX+2AH,X	; 家Ｙポジションセット
		CLC
		ADC	#00002H
		STA	SOAM_DX+22H,X	; 看板Ｙポジションセット
		CLC
		ADC	#00002H
		STA	SOAM_DX+12H,X	; ヨッシー身体Ｙポジションセット
		CLC
		ADC	#00001H
		STA	SOAM_DX+1AH,X	; 看板数字Ｙポジションセット
;
		LDA	<P_CCNT
		ASL	A
		TAY
		LDA	!CHARDAT,Y	; char No. set !!
		STA	<WORK2
		INC	A
		STA	SOAM_DX+0CH,X	; ヨッシー頭キャラクターＮｏ．セット
		LDA	<WORK2
		ORA	#00010H
		STA	SOAM_DX+14H,X	; ヨッシー身体キャラクターＮｏ．セット
		LDA	!PITCRD3,Y
		STA	SOAM_DX+04H,X	; 赤ちゃんキャラクターＮｏ．セット
		LDA	YOSHIPOS
		ASL	A
		TAY
		LDA	!PITCRD2,Y
		STA	SOAM_DX+1CH,X	; 看板数字キャラクターＮｏ．セット
		LDA	#03D6EH
		STA	SOAM_DX+24H,X	; 看板キャラクターＮｏ．セット
;;;;K;;;;		LDA	#03D4EH
;;;;K;;;;		STA	SOAM_DX+2CH,X	; 家キャラクターＮｏ．セット
;
		LDA	#00400H
		STA	SOAM_DX+1EH,X
		INC	A
		INC	A
		STA	SOAM_DX+06H,X
		STA	SOAM_DX+0EH,X
		STA	SOAM_DX+16H,X
		STA	SOAM_DX+26H,X
;;;;K;;;;		STA	SOAM_DX+2EH,X
;
;-------------- 看板及びヨッシーポイントセット --------------
		LDA	<FRCNT
		AND	#00018H
		LSR	A
		LSR	A
		TAY
		LDA	!PITCRD1,Y
		STA	<WORK4		; ヨッシーキャラクターＮｏ．セット
		LDA	!PITYPSD,Y
		STA	<WORK6		; Ｙ補正データーセット
;
;;;;K;;;;		TXA
;;;;K;;;;		CLC
;;;;K;;;;		ADC	#00030H
;;;;K;;;;		TAX
		TXA
		CLC
		ADC	#00028H
		TAX
;
		LDA	SCHMPTYP
		ASL	A
		ASL	A
		ASL	A
		TAY
		STA	<WORKE
		STZ	<WORK2
;
MAT100		EQU	$
		LDA	<WORK2
		CMP	YOSHIPOS
		BNE	MAT150		; ヨッシーがいる　？
;					; Yes !!
		JMP	MAT250
;
MAT150		EQU	$
		LDA	!XPINTDT,Y
		SEC
		SBC	<MPSCH2
;;;;K;;;;		STA	SOAM_DX+18H,X	; 家Ｘ座標セット
		SEC
		SBC	#00008H
		STA	SOAM_DX+00H,X	; ヨッシーＸ座標セット
		CLC
		ADC	#00005H
		STA	SOAM_DX+10H,X	; 看板Ｘ座標セット
		CLC
		ADC	#00004H
		STA	SOAM_DX+08H,X	; 看板数字Ｘ座標セット
;
		LDA	!YPINTDT,Y
		SEC
		SBC	<MPSCV2
;;;;K;;;;		STA	SOAM_DX+1AH,X	; 家Ｙ座標セット
		CLC
		ADC	#00004H
		STA	SOAM_DX+02H,X	; ヨッシーＹ座標セット
		SEC
		SBC	<WORK6
		SEC
		SBC	#0000DH
		STA	SOAM_DX+12H,X	; 看板Ｙ座標セット
		CLC
		ADC	#00003H
		STA	SOAM_DX+0AH,X	; 看板数字Ｙ座標セット
;
		LDA	<WORK2
		ASL	A
		TAY
		LDA	!PITCRD2,Y
		STA	SOAM_DX+0CH,X	; 看板数字キャラクターＮｏ．セット
		LDA	#03B6EH
		STA	SOAM_DX+14H,X	; 看板キャラクターＮｏ．セット
		LDA	!MPTYPE
		CMP	#(00006-1)*2
		BNE	MAT150_40
		LDA	PITCHRD_SB,Y
		BRA	MAT150_60
MAT150_40	EQU	$
		LDA	!PITCHRD,Y
MAT150_60	EQU	$
		CLC
		ADC	<WORK4
		STA	SOAM_DX+04H,X	; ヨッシーキャラクターＮｏ．セット
;;;;K;;;;		LDA	#03D4EH
;;;;K;;;;		STA	SOAM_DX+1CH,X	; 家キャラクターＮｏ．セット
;
		LDA	#00000H
		STA	SOAM_DX+0EH,X
		INC	A
		INC	A
		STA	SOAM_DX+06H,X
		STA	SOAM_DX+16H,X
;;;;K;;;;		STA	SOAM_DX+1EH,X
;
;;;;K;;;;		TXA
;;;;K;;;;		CLC
;;;;K;;;;		ADC	#00020H
;;;;K;;;;		TAX
		TXA
		CLC
		ADC	#00018H
		TAX
;
MAT250		EQU	$
		LDY	<WORKE
		INY
		INY
		STY	<WORKE
		INC	<WORK2
		LDA	<WORK2
		CMP	#00008
		BEQ	MAT300		; point OAM set end ?
;					; No !!
		JMP	MAT100
;
MAT300		EQU	$
		STX	OAMIDX
;
		MI8			; memory,index 8 bit mode !!
;
		RTS
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	MOVESET ( プレイヤームーブＯＡＭセット )	x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
		MEM16
		IDX16
;
;
MOVESET		EQU	$
		DEC	<P_TIME
		BNE	MOVESET_050	; player timer "0" ?
;					; Yes !!
		LDA	#00009
		STA	<P_TIME
		LDA	<P_CCNT
		INC	A
		AND	#00003H
		STA	<P_CCNT		; プレイヤーパターンカウンターセット
;
MOVESET_050	EQU	$
		LDX	OAMIDX
		LDA	<P_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+00H,X	; 赤ちゃんＸポジションセット
		STA	SOAM_DX+10H,X	; ヨッシー身体Ｘポジションセット
		CLC
		ADC	#00008H
		STA	SOAM_DX+08H,X	; ヨッシー頭Ｘポジションセット
;
		LDA	<P_YPOS
		SEC
		SBC	<MPSCV2
		STA	SOAM_DX+0AH,X	; ヨッシー頭Ｙポジションセット
		CLC
		ADC	#00001H
		STA	SOAM_DX+02H,X	; 赤ちゃんＹポジションセット
		CLC
		ADC	#00007H
		STA	SOAM_DX+12H,X	; ヨッシー身体Ｙポジションセット
;
		LDA	<P_CCNT
		ASL	A
		TAY
		LDA	!CHARDAT,Y	; char No. set !!
		STA	<WORK2
		INC	A
		STA	SOAM_DX+0CH,X	; ヨッシー頭キャラクターＮｏ．セット
		LDA	<WORK2
		ORA	#00010H
		STA	SOAM_DX+14H,X	; ヨッシー身体キャラクターＮｏ．セット
		LDA	!PITCRD3,Y
		STA	SOAM_DX+04H,X	; 赤ちゃんキャラクターＮｏ．セット
;
		LDA	#00402H
		STA	SOAM_DX+06H,X
		STA	SOAM_DX+0EH,X
		STA	SOAM_DX+16H,X
;
		LDA	<N_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+18H,X
		CLC
		ADC	#00008H
		STA	SOAM_DX+20H,X
;
		LDA	<N_YPOS
		SEC
		SBC	<MPSCV2
		STA	SOAM_DX+1AH,X
		CLC
		ADC	#00008H
		STA	SOAM_DX+22H,X
;
		LDA	#06B01H
		STA	SOAM_DX+1CH,X
		LDA	#06B10H
		STA	SOAM_DX+24H,X
;
		LDA	#00402H
		STA	SOAM_DX+1EH,X
		STA	SOAM_DX+26H,X
;
		TXA
		CLC
		ADC	#00028H
		TAX
;
;-------------- 看板及びヨッシーポイントセット --------------
PINTOAM		EQU	$
		LDA	<FRCNT
		AND	#00018H
		LSR	A
		LSR	A
		TAY
		LDA	!PITCRD1,Y
		STA	<WORK4		; ヨッシーキャラクターＮｏ．セット
		LDA	!PITYPSD,Y
		STA	<WORK6		; Ｙ補正データーセット
;
		LDA	SCHMPTYP
		ASL	A
		ASL	A
		ASL	A
		TAY
		STY	<WORKE
		STZ	<WORK2
;;;;;;;;		STZ	<WORK4
;
MOVESET_100	EQU	$
		LDA	!XPINTDT,Y
		SEC
		SBC	<MPSCH2
		STA	<WORK8
		LDA	!YPINTDT,Y
		SEC
		SBC	<MPSCV2
		STA	<WORKA
;
		LDA	<BEFRPT
		CMP	<WORK2
		BEQ	MOVESET_150	; ヨッシーがいる　？
;					; No !!
		INC	A
		CMP	<WORK2
		BNE	MOVESET_200	; ヨッシーがいる　？
;					; Yes !!
MOVESET_150	EQU	$
		ASL	A
		TAY
		LDA	!PITCRD2,Y
		STA	SOAM_DX+04H,X	; 看板数字キャラクターＮｏ．セット
		LDA	#03B6EH
		STA	SOAM_DX+0CH,X	; 看板キャラクターＮｏ．セット
;;;;K;;;;		LDA	#03D4EH
;;;;K;;;;		STA	SOAM_DX+14H,X	; 家キャラクターＮｏ．セット
;
		LDA	<WORK8
;;;;K;;;;		STA	SOAM_DX+10H,X	; 家Ｘ座標セット
		CLC
		ADC	#00008
		STA	SOAM_DX+08H,X	; 看板Ｘ座標セット
		CLC
		ADC	#00004H
		STA	SOAM_DX+00H,X	; 看板数字Ｘ座標セット
;
		LDA	<WORKA
;;;;K;;;;		STA	SOAM_DX+12H,X	; 家Ｙ座標セット
		CLC
		ADC	#00002H
		STA	SOAM_DX+0AH,X	; 看板Ｙ座標セット
		CLC
		ADC	#00003H
		STA	SOAM_DX+02H,X	; 看板数字Ｙ座標セット
;
		LDA	#00000H
		STA	SOAM_DX+06H,X
		INC	A
		INC	A
;;;;K;;;;		STA	SOAM_DX+16H,X
		STA	SOAM_DX+0EH,X
;
;;;;K;;;;		TXA
;;;;K;;;;		CLC
;;;;K;;;;		ADC	#00018H
;;;;K;;;;		TAX
		TXA
		CLC
		ADC	#00010H
		TAX
		JMP	MOVESET_250
;
MOVESET_200	EQU	$
		LDA	<WORK8
;;;;K;;;;		STA	SOAM_DX+18H,X	; 家Ｘ座標セット
		SEC
		SBC	#00008H
		STA	SOAM_DX+00H,X	; ヨッシーＸ座標セット
		CLC
		ADC	#00005H
		STA	SOAM_DX+10H,X	; 看板Ｘ座標セット
		CLC
		ADC	#00004H
		STA	SOAM_DX+08H,X	; 看板数字Ｘ座標セット
;
		LDA	<WORKA
;;;;K;;;;		STA	SOAM_DX+1AH,X	; 家Ｙ座標セット
		CLC
		ADC	#00004H
		STA	SOAM_DX+02H,X	; ヨッシーＹ座標セット
		SEC
		SBC	<WORK6
		SEC
		SBC	#0000EH
		STA	SOAM_DX+12H,X	; 看板Ｙ座標セット
		CLC
		ADC	#00003H
		STA	SOAM_DX+0AH,X	; 看板数字Ｙ座標セット
;
		LDA	<WORK2
		ASL	A
		TAY
		LDA	!PITCRD2,Y
		STA	SOAM_DX+0CH,X	; 看板数字キャラクターＮｏ．セット
		LDA	#03B6EH
		STA	SOAM_DX+14H,X	; 看板キャラクターＮｏ．セット
		LDA	!PITCHRD,Y
		CLC
		ADC	<WORK4
		STA	SOAM_DX+04H,X	; ヨッシーキャラクターＮｏ．セット
;;;;K;;;;		LDA	#03D4EH
;;;;K;;;;		STA	SOAM_DX+1CH,X	; 家キャラクターＮｏ．セット
;
		LDA	#00000H
		STA	SOAM_DX+0EH,X
		INC	A
		INC	A
		STA	SOAM_DX+06H,X
		STA	SOAM_DX+16H,X
;;;;K;;;;		STA	SOAM_DX+1EH,X
;
;;;;K;;;;		TXA
;;;;K;;;;		CLC
;;;;K;;;;		ADC	#00020H
;;;;K;;;;		TAX
		TXA
		CLC
		ADC	#00018H
		TAX
;
MOVESET_250	EQU	$
		LDY	<WORKE
		INY
		INY
		STY	<WORKE
		INC	<WORK2
		LDA	<WORK2
		CMP	#00008
		BEQ	MOVESET_300	; point OAM set end ?
;					; No !!
		JMP	MOVESET_100
;
MOVESET_300	EQU	$
		JMP	MAT300
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	NAGESET ( プレイヤー投げＯＡＭセット )		x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NGPUSDT		EQU	$
		WORD	02930H,02930H
;
BBPUSDT		EQU	$
		WORD	02D4AH,02D4CH
;
BBYPSDT		EQU	$
		WORD	00004H,00008H
;
;
NAGESET		EQU	$
		LDX	OAMIDX
		LDA	<NAGCNT
		ASL	A
		TAY
		LDA	<P_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+08H,X
		STA	SOAM_DX+18H,X
		CLC
		ADC	#00002H
		STA	SOAM_DX+00H,X	; 赤ちゃんＸポジションセット
		CLC
		ADC	#00006H
		STA	SOAM_DX+10H,X
		STA	SOAM_DX+20H,X
;
		LDA	<P_YPOS
		SEC
		SBC	<MPSCV2
		STA	<WORK0
		STA	SOAM_DX+0AH,X
		STA	SOAM_DX+12H,X
		CLC
		ADC	#00008H
		STA	SOAM_DX+1AH,X
		STA	SOAM_DX+22H,X
		LDA	<WORK0
		CLC
		ADC	!BBYPSDT,Y
		STA	SOAM_DX+02H,X
;
		LDA	!BBPUSDT,Y
		STA	SOAM_DX+04H,X
		LDA	!NGPUSDT,Y
		STA	<WORK0
		STA	SOAM_DX+0CH,X
		INC	A
		STA	SOAM_DX+14H,X
		LDA	<WORK0
		CLC
		ADC	#00010H
		STA	SOAM_DX+1CH,X
		INC	A
		STA	SOAM_DX+24H,X
;
		LDA	<N_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+28H,X
		CLC
		ADC	#00008H
		STA	SOAM_DX+30H,X
;
		LDA	<N_YPOS
		SEC
		SBC	<MPSCV2
		STA	SOAM_DX+2AH,X
		CLC
		ADC	#00008H
		STA	SOAM_DX+32H,X
;
		LDA	#06B01H
		STA	SOAM_DX+2CH,X
		LDA	#06B10H
		STA	SOAM_DX+34H,X
;
		LDA	#00402H
		STA	SOAM_DX+06H,X
		STA	SOAM_DX+0EH,X
		STA	SOAM_DX+16H,X
		STA	SOAM_DX+1EH,X
		STA	SOAM_DX+26H,X
		STA	SOAM_DX+2EH,X
		STA	SOAM_DX+36H,X
;
		TXA
		CLC
		ADC	#00038H
		TAX
;
		JMP	PINTOAM
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	BJMPSET ( 赤ちゃんジャンプＯＡＭセット )	x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
JMPPTD0		EQU	$
		WORD	02903H,02933H
;
JMPPTD1		EQU	$
		WORD	02B36H,06B04H
;
JMPPTD2		EQU	$
		WORD	02B46H,06B13H
;
JMPXPDT		EQU	$
		WORD	00000H,00008H
;
;
BJMPSET		EQU	$
		LDX	OAMIDX
;-------------- 赤ちゃんセット --------------
		LDA	<A_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+00H,X
;
		LDA	<A_YPOS
		SEC
		SBC	<MPSCV2
		STA	SOAM_DX+02H,X
;
		LDA	#02D4AH
		STA	SOAM_DX+04H,X
;
		LDY	#00000
		LDA	<A_YSPD+2
		BPL	BJMPSET_050
;
		INY
		INY
;
BJMPSET_050	EQU	$
;
;-------------- ヨッシーセット --------------
		LDA	<P_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+08H,X
		STA	SOAM_DX+18H,X
		CLC
		ADC	#00008H
		STA	SOAM_DX+10H,X
		STA	SOAM_DX+20H,X
;
		LDA	<P_YPOS
		SEC
		SBC	<MPSCV2
		STA	<WORK0
		STA	SOAM_DX+0AH,X
		STA	SOAM_DX+12H,X
		CLC
		ADC	#00008H
		STA	SOAM_DX+1AH,X
		STA	SOAM_DX+22H,X
;
		LDA	!JMPPTD0,Y
		STA	<WORK0
		STA	SOAM_DX+0CH,X
		INC	A
		STA	SOAM_DX+14H,X
		LDA	<WORK0
		CLC
		ADC	#00010H
		STA	SOAM_DX+1CH,X
		INC	A
		STA	SOAM_DX+24H,X
;
;-------------- 次のヨッシーセット --------------
		LDA	<N_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+28H,X
		CLC
		ADC	!JMPXPDT,Y
		STA	SOAM_DX+30H,X
;
		LDA	<N_YPOS
		SEC
		SBC	<MPSCV2
		STA	SOAM_DX+2AH,X
		CLC
		ADC	#00008H
		STA	SOAM_DX+32H,X
;
		LDA	!JMPPTD1,Y
		STA	SOAM_DX+2CH,X
		LDA	!JMPPTD2,Y
		STA	SOAM_DX+34H,X
;
		LDA	#00402H
		STA	SOAM_DX+06H,X
		STA	SOAM_DX+0EH,X
		STA	SOAM_DX+16H,X
		STA	SOAM_DX+1EH,X
		STA	SOAM_DX+26H,X
		STA	SOAM_DX+2EH,X
		STA	SOAM_DX+36H,X
;
		TXA
		CLC
		ADC	#00038H
		TAX
;
		JMP	PINTOAM
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	UKETSET ( プレイヤー受けＯＡＭセット )		x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
UKETSET		EQU	$
		LDX	OAMIDX
;
		LDA	<P_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+10H,X
		CLC
		ADC	#00004H
		STA	SOAM_DX+00H,X
		CLC
		ADC	#00004H
		STA	SOAM_DX+08H,X
;
		LDA	<P_YPOS
		SEC
		SBC	<MPSCV2
		STA	SOAM_DX+02H,X
		STA	SOAM_DX+0AH,X
		CLC
		ADC	#00008H
		STA	SOAM_DX+12H,X
;
		LDA	#02904H
		STA	SOAM_DX+0CH,X
		LDA	#02913H
		STA	SOAM_DX+14H,X
		LDA	#02D4CH
		STA	SOAM_DX+04H,X
;
		LDA	<N_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+20H,X
		CLC
		ADC	#00008
		STA	SOAM_DX+18H,X
;
		LDA	<N_YPOS
		SEC
		SBC	<MPSCV2
		STA	SOAM_DX+1AH,X
		CLC
		ADC	#00008H
		STA	SOAM_DX+22H,X
;
		LDA	#02B04H
		STA	SOAM_DX+1CH,X
		LDA	#02B13H
		STA	SOAM_DX+24H,X
;
		LDA	#00402H
		STA	SOAM_DX+06H,X
		STA	SOAM_DX+0EH,X
		STA	SOAM_DX+16H,X
		STA	SOAM_DX+1EH,X
		STA	SOAM_DX+26H,X
;
		TXA
		CLC
		ADC	#00028H
		TAX
;
		JMP	PINTOAM
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	BYBYSET ( プレイヤーバイバイＯＡＭセット )	x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BYEYPSD		EQU	$
		WORD	00007H,00009H
;
BYECHRD		EQU	$
		WORD	02B38H,02B39H
;
;
BYBYSET		EQU	$
		DEC	<P_TIME
		BNE	BYBYSET_020	; player timer "0" ?
;					; Yes !!
		LDA	#00009
		STA	<P_TIME
		LDA	<P_CCNT
		INC	A
		AND	#00003H
		STA	<P_CCNT		; プレイヤーパターンカウンターセット
;
BYBYSET_020	EQU	$
		LDX	OAMIDX
;
		LDA	<P_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+00H,X	; 赤ちゃんＸポジションセット
		STA	SOAM_DX+10H,X	; ヨッシー身体Ｘポジションセット
		CLC
		ADC	#00008H
		STA	SOAM_DX+08H,X	; ヨッシー頭Ｘポジションセット
;
		LDA	<P_YPOS
		SEC
		SBC	<MPSCV2
		STA	SOAM_DX+0AH,X	; ヨッシー頭Ｙポジションセット
		CLC
		ADC	#00001H
		STA	SOAM_DX+02H,X	; 赤ちゃんＹポジションセット
		CLC
		ADC	#00007H
		STA	SOAM_DX+12H,X	; ヨッシー身体Ｙポジションセット
;
		LDA	<P_CCNT
		ASL	A
		TAY
		LDA	!CHARDAT,Y	; char No. set !!
		STA	<WORK2
		INC	A
		STA	SOAM_DX+0CH,X	; ヨッシー頭キャラクターＮｏ．セット
		LDA	<WORK2
		ORA	#00010H
		STA	SOAM_DX+14H,X	; ヨッシー身体キャラクターＮｏ．セット
		LDA	!PITCRD3,Y
		STA	SOAM_DX+04H,X	; 赤ちゃんキャラクターＮｏ．セット
;
		DEC	<NGTIME
		BNE	BYBYSET_050
;
		LDA	<NAGCNT
		EOR	#00002
		STA	<NAGCNT
		LDA	#00008H
		STA	<NGTIME
;
BYBYSET_050	EQU	$
		LDY	<NAGCNT
		LDA	<N_XPOS
		SEC
		SBC	<MPSCH2
		STA	SOAM_DX+18H,X
		STA	SOAM_DX+28H,X
		SEC
		SBC	#00005H
		STA	SOAM_DX+30H,X
		CLC
		ADC	#0000DH
		STA	SOAM_DX+20H,X
;
		LDA	<N_YPOS
		SEC
		SBC	<MPSCV2
		STA	<WORK0
		INC	A
		STA	SOAM_DX+1AH,X
		STA	SOAM_DX+22H,X
		CLC
		ADC	#00007H
		STA	SOAM_DX+2AH,X
		LDA	<WORK0
		CLC
		ADC	!BYEYPSD,Y
		STA	SOAM_DX+32H,X
;
		LDA	#06B36H
		STA	SOAM_DX+24H,X
		INC	A
		STA	SOAM_DX+1CH,X
		LDA	#06B48H
		STA	SOAM_DX+2CH,X
		LDA	!BYECHRD,Y
		STA	SOAM_DX+34H,X
;
		LDA	#00400H
		STA	SOAM_DX+1EH,X
		STA	SOAM_DX+26H,X
		STA	SOAM_DX+36H,X
		INC	A
		INC	A
		STA	SOAM_DX+06H,X
		STA	SOAM_DX+0EH,X
		STA	SOAM_DX+16H,X
		STA	SOAM_DX+2EH,X
;
		TXA
		CLC
		ADC	#00038H
		TAX
;
		JMP	PINTOAM
;
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	MAPSCRL ( pause map scroll sub )		x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
HSCRDAT		EQU	$
		WORD	0FFFEH,00002H,00004H,0FFFCH
;
HSCRDT1		EQU	$
		WORD	00000H,00100H,00100H,00000H
;
YAJIDAT		EQU	$
		WORD	0796CH,0396CH
;
;
MAPSCRL		EQU	$
		MI16			; memory,index 16 bit mode !!
;
		LDA	#00004
		STA	<MPSCFG
		LDA	<KEYC1L
		AND	#00010000B
		LSR	A
		LSR	A
		LSR	A
		TAY
;;;;;;;;		STA	<MOKUMK
		LDA	<MPSCH2
		CMP	!HSCRDT1,Y
		BEQ	MSL050		; scroll over ?
;					; No !!
		CLC
		ADC	!HSCRDAT,Y
		STA	<WORK0
		SEC
		SBC	!HSCRDT1,Y
		BEQ	MSL020		; 画面の端までいった　？
;					; No !!
		EOR	!HSCRDAT,Y
		BMI	MSL030		; 画面オーバー　？
;					; Yes !!
MSL020		EQU	$
		LDA	!HSCRDT1,Y
		STA	<WORK0
;
MSL030		EQU	$
		LDA	<WORK0
		STA	<MPSCH1
		STA	<MPSCH2
		STA	<SCCH3
;
MSL050		EQU	$
		LDX	OAMIDX
		LDA	#000E8H
		CPY	#00002
		BEQ	MSL100		; right scroll ?
;					; No !!
		LDA	#00008H
;
MSL100		EQU	$
		STA	SOAM_DX,X
		LDA	#000A8H
		STA	SOAM_DX+02H,X
		LDA	!YAJIDAT,Y
		STA	SOAM_DX+04H,X
		LDA	#00102H
		STA	SOAM_DX+06H,X
;
		TXA
		CLC
		ADC	#00008
		STA	OAMIDX
;
		JMP	MPOAMST		; map OAM set sub !!
;
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
;x		JSR	MAPSCR1 ( pause map scroll sub )		x
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MAPSCR1		EQU	$
		MI16			; memory,index 16 bit mode !!
;
		LDA	#00000
		LDX	<MPSCH2
		CPX	<MOKUSR
		BCC	HMAPPLAY_135
;
		INC	A
		INC	A
;
HMAPPLAY_135	EQU	$
		ORA	<MPSCFG
;;;;;;;;		ORA	<MOKUMK
		TAY
		LDA	<MPSCH2
		CMP	<MOKUSR
		BNE	MS1050		; scroll end ?
;					; Yes !!
		STZ	<MPSCFG
		BRA	MS1100
;
MS1050		EQU	$
		CLC
		ADC	!HSCRDAT,Y
		STA	<WORK0
		SEC
		SBC	<MOKUSR
		BEQ	MS1070		; もとの位置に戻った　？
;					; No !!
		EOR	!HSCRDAT,Y
		BMI	MS1080		; もとの位置をオーバー　？
;					; Yes !!
MS1070		EQU	$
		LDA	<MOKUSR
		STA	<WORK0
;
MS1080		EQU	$
		LDA	<WORK0
		STA	<MPSCH2
		STA	<MPSCH1
		STA	<SCCH3
;
MS1100		EQU	$
		JMP	MPOAMST		; map OAM set sub !!
;
		MEM8
		IDX8
;
;
;
;
;
;
;
;
		END
