;************************************************************************
;*									*
;*	title name	: "yossy"					*
;*	proccess	: enemy sub.1					*
;*	file name	: ys_enmy10					*
;*									*
;************************************************************************
;
;
		SALL
;
		include		ys_header.inc
		include		ys_unit.h
		include		ys_pld.h
		include		ys_color.h
		include		ys_ename.h
		include		../union/ys_bgcheck.h
		include		ys_presno.h
;
		XALL
;
;
;------------------------------------------------------------------------
;-		global symbol						-
;------------------------------------------------------------------------
		GLB	GOALXIN, BONSXIN, KONOTIN, RDOORIN
		GLB	YAJI0IN, YAJI1IN, DGFLYIN, BTFLYIN, P_KUNIN, P_KN2IN
		GLB	LUIGIIN, HIMITIN, SUZUMIN, EG1UPIN, SABO0IN, KOKERIN
		GLB	HIMI2IN
		GLB	PANSYIN
;
		GLB	GOALXMV, BONSXMV, KONOTMV, RDOORMV
		GLB	YAJI0MV, YAJI1MV, DGFLYMV, BTFLYMV, P_KUNMV, P_KN2MV
		GLB	LUIGIMV, HIMITMV, SUZUMMV, EG1UPMV, SABO0MV, KOKERMV
		GLB	HIMI2MV
		GLB	PANSYMV
;
		GLB	PANSYFL
;
;------------------------------------------------------------------------
;-		extern symbol						-
;------------------------------------------------------------------------
;
;-------------< ys_main >------------------------------------------------
		EXT	RANDAM
		EXT	D_00,GMIN
		EXT	SOUND_3_ON
;
;-------------< ys_init >------------------------------------------------
		EXT	UNCOMPRES,VRAMDX_ST,UNCOMPRES_X
;
;-------------< ys_rpro >------------------------------------------------
		EXT	JSRSUB
		EXT	CHIPON, CHIPON_RAM_READ, M_DMA_BFST
;
;-------------< ys_start >-----------------------------------------------
		EXT	STT_PL_STP
;
;-------------< ys_play >------------------------------------------------
		EXT	TIMEUP_SET,TIMEUP_SET_S
		EXT	EBSTAT
		EXT	PSTP,PMOV,PCLR,PGUS,PSDM
		EXT	PFLP,PSHT
		EXT	EGG_WARE_SET
		EXT	PO_NORMAL,PO_DK_O_R,PO_DK_O_L,PO_DK_O_D,PO_DK_O_U
		EXT	PO_DK_I_R,PO_DK_I_L,PO_DK_I_D,PO_DK_I_U
;
;-------------< ys_bgsc >------------------------------------------------
		EXT	BLK0, BGCG
		EXT	UNITCHG
;
;-------------< ys_enmy >------------------------------------------------
		EXT	ENEMY,ENINSB
		EXT	ENCLEAR,DISPCK0,DISPCK2
		EXT	ENINSR,ENINSR2,EEXCHK,EEYCHK,EEXYCK,ESTATST,ENINSR_I
		EXT	ENINSR2_I
		EXT	SCOREST
		EXT	ENMDCK,XSDOWN,EPCRCK,MUKEOR,XSPEOR,MKEOR2,PLFLST
		EXT	POBBGCR,BOBBGCR
;
		EXT	ENRETURN
		EXT	ENCLEAR_NORETN,ENCLEAR_NORETN2
;
		EXT	EXIST_CHECK2,NON_EXIST_SET,NON_EXIST_SET2
;
		EXT	PLAYER_REBOUND
;
		EXT	EINIT,EFAIL,EMOVE,EEATM,ENOSE,EBABL,EFALL
		EXT	EFIRE,ECHNG
;
		EXT	COS,SIN
;
		EXT	EATMXS,NOSWT
;
		EXT	EN_XYMOVE,ENDEATH_SET,ENDEATH_SET_2,EGGKILL_ALL
		EXT	PL_1UP_SET_P,PL_1UP_SET
		EXT	EGGKILL
;
		EXT	EGG00_MVINT,FSMK0_SET2,FSMK0_SET_S
;
		EXT	TROBJ_SR_2x2,TROBJ_SR_4x4,TROBJ_SR_8x8,TROBJ_SR_8x4
		EXT	TROBJ_SR_2x2_CL,TROBJ_SR_4x4_CL,TROBJ_SR_8x8_CL
		EXT	TROBJ_SR_8x4_CL,TROBJ_SR_6x4_CL
		EXT	TROBJ_OAM_8x4
		EXT	TROBJ_OAM_2x2,TROBJ_OAM_4x4,TROBJ_OAM_8x8,TROBJ_OAM_8H8
		EXT	TROBJ_OAM_2x2_I,TROBJ_OAM_4x4_I,TROBJ_OAM_8x8_I
		EXT	TROBJ_CLEAR
		EXT	TROBJ_PLOT_X,TROBJ_PLOT_Y
		EXT	TROBJ_CHAR_NO
;
		EXT	SHOT_EN_KILL, FSMK0_SET, FSMK2_SET, FUNDA_ENFALL_L
		EXT	ENFALL_END
		EXT	SCORE_SET, COIN1_END_SET
;
		EXT	QKM_COIN_XSP
;
		EXT	POBBGCR_2
;
		EXT	EGGTM
;
;-------------< ys_enmy2 >-----------------------------------------------
		EXT	COLD_KIRAKIRA, KINOMI_CANCEL
		EXT	FUSNB_SET, MISA0_KILL
		EXT	TO_PLDOWN
;
;-------------< ys_enmy3 >-----------------------------------------------
		EXT	ICE_IN_CK, KIRAKIRA_SET, TO_PLDEMO_2, GOAL0_CHR_SET
		EXT	DOOR_CHR_SET, TROBJ_OAM_4x4_F
;
;-------------< ys_enmy4 >-----------------------------------------------
		EXT	JBLKLIN
;
;-------------< ys_enmy6 >-----------------------------------------------
		EXT	LOCKON_TARGET, LOCKON_TARGET2
		EXT	DOKAN_CHECK, DOKAN_CHECK2
;
;-------------< ys_enmy7 >-----------------------------------------------
		EXT	EPFOOTCROSS, EPFOOTCROSS_01, PLCRSCK, HANABIRASET_L
;
		EXT	sec01,sec02,sec03,sec04,sec05,sec06,sec07,sec08,sec09,sec10
;
;-------------< ys_enmy8 >-----------------------------------------------
		EXT	PKPK2_FALL, TRBOXIN, COIN1IN
;
;-------------< ys_msgdt >------------------------------------------------
		EXT	BS6_MSG
;
;-------------< ys_hajime-chan >------------------------------------------------
		EXT	BABYM_RMODE00
		EXT	BABYM_RMODE10
		EXT	BABYM_RMODE38
		EXT	BABYM_RMODE50
		EXT	BABYM_RMODE51
		EXT	BABYM_RMODE52
		EXT	BABYM_RMODE60
		EXT	BABYM_RMODE61
		EXT	BABYM_RMODE70
		EXT	BABYM_RMODE71
;
		EXT	B_SP_RMODE20
;
		EXT	BABYM_SHABN_BRK
		EXT	BABYM_SHABN_C2
;
;-------------< ys_exst >------------------------------------------------
		EXT	EXINSR
;
;
;-------------< ys_unit >------------------------------------------------
		EXT	UNDTADD,UNDATA,RUTDATA
;
;------------------------------------------------------------------------
;-		define symbol						-
;------------------------------------------------------------------------
msec0125	EQU	(64/8)
msec0250	EQU	(64/4)
msec0500	EQU	(64/2)
;
;
;************************************************************************
;*									*
;*		program start						*
;*									*
;************************************************************************
;
		EXTEND
;
		MEM16
		IDX8
;
		DPAGE	EN0RAM
;
Group_1		GROUP	Enemy10_pro
Enemy10_pro	SECT	REL
;
;
;------------------------------------------------------------------------
;-	initial （ゴール文字）						-
;------------------------------------------------------------------------
GOALXIN		EQU	$
		LDY	#05
		STY	<ENWRK0,X
;-------------- ＧＯＡＬカラーセット ----------------------------
		LDX	#(15-1)*2
GOALXIN0080	EQU	$
		LDA	>COL_ADDRESS+GOAL_CHR_COL,X
		STA	>MOTOCOL+(80H+31H)*2,X
		STA	>DATACOL+(80H+31H)*2,X
		DEX
		DEX
		BPL	GOALXIN0080		; [->GOALXIN0080]
;
		LDX	<ENINDX
		RTL
;
;
;------------------------------------------------------------------------
;-	move	（ゴール文字）						-
;------------------------------------------------------------------------
GOALXMV		EQU	$
		LDY	!ENYUSN,X
		BMI	GOALXMV0040		; オブジェ表示？ [no->GOALXMV0040]
;
		LDA	#000E0H
		STA	!ENDSXL,X
		CLC
		ADC	!SCCH1
		STA	!ENXPSL,X
		LDA	#00020H
		STA	!ENDSYL,X
		CLC
		ADC	!SCCV1
		STA	!ENYPSL,X
		LDY	<ENWRK0,X
		TYA
		STA	R5			; R5 <- 文字数
		LDY	<ENWRK1,X
		TYA
		STA	R6			; R6 <- 倍率(80H=等倍)
		LDY	<ENWRK2,X
		TYA
		STA	R9			; R9 <- ふわふわインデックス(SIN DATA INDEX)
		LDY	<ENWRK3,X
		TYA
		STA	R10			; R10 <- ふわふわスイッチ
		M_CHIP	GOALOAM
		LDX	<ENINDX
;
GOALXMV0040	EQU	$
		LDY	<ENCONT,X
		TYX
		JMP	(GOALXMDSL,X)
;
GOALXMDSL	EQU	$
		WORD	GOALXSET0
		WORD	GOALXSET1
		WORD	GOALXFUWA
		WORD	GOALXEND0
;
GOALXSET0	EQU	$
		LDX	<ENINDX
;
		M8				; memory 8bit mode !!
;
		LDA	<ENWRK1,X
		CLC
		ADC	#08
		STA	<ENWRK1,X
		TAY
;
		M16				; memory 16bit mode !!
;
		CPY	#0A0H
		BCC	GOALXSET00100		; [->GOALXSET00100]
;
GOALXSET00080	EQU	$
		LDY	<ENCONT,X
		INY
		INY
		STY	<ENCONT,X
GOALXSET00100	EQU	$
		RTL
;
;
GOALXSET1	EQU	$
		LDX	<ENINDX
;
		M8				; memory 8bit mode !!
;
		LDA	<ENWRK1,X
		SEC
		SBC	#04
		STA	<ENWRK1,X
		TAY
;
		M16				; memory 16bit mode !!
;
		CPY	#080H
		BCS	GOALXSET00100		; [->GOALXSET00100]
;
GOALXSET10100	EQU	$
		LDY	#080H
		STY	<ENWRK1,X
		LDA	#00040H
		STA	!ENTIM0,X
		BRA	GOALXSET00080		; [->GOALXSET00080]
;
;
GOALXFUWA	EQU	$
		LDX	<ENINDX
		LDA	!BNS_GO_FG
		BNE	GOALXSET00080		; 消滅モード？ [yes->GOALXSET00080]
;
		LDA	!ENTIM0,X
		BNE	GOALXFUWA00F0		; [->GOALXFUWA00F0]
;
		LDY	<ENWRK3,X
		INY
		CPY	#040H
		BCC	GOALXFUWA0080		; [->GOALXFUWA0080]
;
		LDY	#040H
GOALXFUWA0080	EQU	$
		STY	<ENWRK3,X
;
		M8				; memory 8bit mode !!
;
		LDA	<ENWRK2,X
		CLC
		ADC	#04
		STA	<ENWRK2,X
;
		M16				; memory 16bit mode !!
;
GOALXFUWA00F0	EQU	$
		RTL
;
;
GOALXKOKAXP	EQU	$
		WORD	08H, 14H, 14H, 14H, 14H
;
GOALXEND0	EQU	$
		LDX	<ENINDX
;;;;iw		      LDY     <ENWRK3,X
;;;;iw		      BEQ     GOALXEND00100	      ; [->GOALXEND00100]
;;;;iw;
;;;;iw		      DEY
;;;;iw		      STY     <ENWRK3,X
;;;;iw		      RTL
;;;;iw;
;;;;iwGOALXEND00100   EQU     $
		LDA	!ENTIM0,X
		BNE	GOALXEND001F0		; [->GOALXEND001F0]
;
		LDY	<ENWRK0,X
		DEY
		BPL	GOALXEND00140		; [->GOALXEND00140]
;
		JMP	>ENCLEAR
;
GOALXEND00140	EQU	$
		STY	<ENWRK0,X
		TYX
;
		M8				; memory 8bit mode !!
;
		LDA	#00
		XBA
		LDA	>GOALXPOS,X
		PHA
		TXA
		ASL	A
		TAX
		PLA
;
		M16				; memmory 16bit mode !!
;
		SEC
		SBC	GOALXKOKAXP,X
		STA	<EWORK
		LDX	<ENINDX
;
		LDA	!BNS_GO_FG
		BMI	GOALXEND001A0		; 当たり？ [yes->GOALXEND001A0]
;
		LDA	#00036H
		JSL	>SOUND_3_ON		; サウンド セット！！
;
GOALXEND001A0	EQU	$
		LDA	#FUSNB
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		SEC
		SBC	<EWORK
		SEC
		SBC	#0008
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	#00018H-8
		STA	!EXYPSL,Y
		LDA	#0000BH
		STA	!EXWRK0,Y
		LDA	#0004
		STA	!EXTIM0,Y
;
		LDA	#0008H
		STA	!ENTIM0,X
;
GOALXEND001F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial （ボーナス文字）					-
;------------------------------------------------------------------------
BONSXIN		EQU	$
		LDA	!SCCH1
		STA	<ENWRK4,X
		CLC
		ADC	#00080H
		STA	!ENXPSL,X
		STA	!ENWRK6,X
		LDA	!SCCV1
		SEC
		SBC	#00040H
		STA	!ENYPSL,X
		LDY	#02
		STY	<ENWRK0,X
;
		LDX	#(15-1)*2
BONSXIN00A0	EQU	$
		LDA	>COL_ADDRESS+BONUS_CHR_COL,X
		STA	>MOTOCOL+(80H+61H)*2,X
		STA	>DATACOL+(80H+61H)*2,X
		DEX
		DEX
		BPL	BONSXIN00A0		; [->BONSXIN00A0]
;
		LDX	<ENINDX
		LDA	#00095H
		JSL	>SOUND_3_ON		; サウンド セット！！
;
		RTL
;
;
;------------------------------------------------------------------------
;-	move （ボーナス文字）						-
;------------------------------------------------------------------------
BONSXYSPD	EQU	$
		WORD	00000H, 0FE00H, 0FC00H
;
BONSXMV		EQU	$
		LDY	!ENYUSN,X
		BMI	BONSXMV0040		; オブジェ表示？ [no->BONSXMV0040]
;
;[1995.04.28.FR]		LDA	#00080H
;[1995.04.28.FR]		STA	!ENDSXL,X
;[1995.04.28.FR]		CLC
;[1995.04.28.FR]		ADC	!SCCH1
;[1995.04.28.FR]		STA	!ENXPSL,X
		LDA	#BANK BONSXCHAR
		STA	R0			; データバンク
		LDA	#BONSXCHAR
		STA	R5			; データアドレス
		LDA	#(BONSXCHAREND-BONSXCHAR)/5
		STA	R12			; ＯＡＭ数
		M_CHIP	OAMDRCTST
;
		LDX	<ENINDX
BONSXMV0040	EQU	$
		JSR	BONSXCOLCHG
;
		LDY	<ENCONT,X
		TYX
		JMP	(BONSXMDSL,X)
;
BONSXMDSL	EQU	$
		WORD	BONSXTENS
		WORD	BONSXTENS
		WORD	BONSXINIT
		WORD	BONSXFALL
;
;
BONSXCHRBKDT	EQU	$
		WORD	CHR38A
		WORD	CHR38B
;
BONSXVRAMAD	EQU	$
		WORD	5000H+8000H
		WORD	5400H+8000H
;
BONSXTENS	EQU	$
;-------------- ボーナスキャラクターセット ----------------------
;
		I16
;
		LDA	BONSXVRAMAD,X		;特別転送セット
		STA	OBM7WF
;
		LDA	BONSXCHRBKDT,X		;(A) <-- データＮｏ．
		JSL	>UNCOMPRES_X
;
		I8
;
		LDX	<ENINDX
		LDA	#00020H
		STA	!ENTIM0,X
		BRA	BONSXINIT00E0		; [->BONSXINIT00E0]
;
;
BONSXINIT	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	BONSXINIT00F0		; 待機？ [yes->BONSXINIT00F0]
;
;[1995.06.13.TU]		LDA	#00020H
;[1995.06.13.TU]		JSL	>SOUND_3_ON		; サウンド セット！！
;[1995.06.13.TU];
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#00800H
		STA	!ENGMAX,X
BONSXINIT00E0	EQU	$
		LDY	<ENCONT,X
		INY
		INY
		STY	<ENCONT,X
BONSXINIT00F0	EQU	$
		RTL
;
;
BONSXFALL	EQU	$
		LDX	<ENINDX
		LDA	<ENWRK4,X
		SEC
		SBC	!SCCH1
		CLC
		ADC	!ENWRK6,X
		STA	!ENXPSL,X
		LDA	!SCCV1
		CLC
		ADC	#00050H
		CMP	!ENYPSL,X
		BPL	BONSXFALL00F0		; [->BONSXFALL00F0]
;
		STA	!ENYPSL,X
		LDY	<ENWRK0,X
		LDA	BONSXYSPD,Y
		STA	!ENYSPD,X
;[1995.06.13.TU]		CPY	#02
;[1995.06.13.TU]		BNE	BONSXFALL0080		; [->BONSXFALL0080]
;[1995.06.13.TU];
;[1995.06.13.TU]		LDA	#0003BH
;[1995.06.13.TU]		PHY
;[1995.06.13.TU]		JSL	>SOUND_3_ON		; サウンド セット！！
;[1995.06.13.TU]		PLY
;[1995.06.13.TU];
;[1995.06.13.TU]BONSXFALL0080	EQU	$
		DEY
		DEY
		BMI	BONSXFALL00F0		; [->BONSXFALL00F0]
;
		STY	<ENWRK0,X
BONSXFALL00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-		JSR	BONSXCOLCHG ( カラーデーターチェンジ )		-
;------------------------------------------------------------------------
BONSXCOLDT2	EQU	$
		WORD	044A6H,048C7H,04CE8H,05109H
;
BONSXCOLDT	EQU	$
		WORD	0001FH,0023FH,0037FH,003F3H,00327H,07F20H,07E66H,07D77H
		WORD	07C1FH
;
;
BONSXCOLCHG	EQU	$
		LDA	<FRCNT2
		AND	#00007
		BNE	BONSXCOLCHG200		; color chenge ?
;						; Yes !!
		LDY	<ENWRK2,X
		INY
		INY
		CPY	#BONSXCOLCHG-BONSXCOLDT
		BNE	BONSXCOLCHG050		; color pointer over ?
;						; Yes !!
		LDY	#00
BONSXCOLCHG050	EQU	$
		STY	<ENWRK2,X		; color pointer clear !!
		LDX	#(9*2)-2
;
BONSXCOLCHG100	EQU	$
		LDA	!BONSXCOLDT,Y
		STA	>DATACOL+((80H+63H)*2),X
		INY
		INY
		CPY	#BONSXCOLCHG-BONSXCOLDT
		BNE	BONSXCOLCHG150		; color data pointer over ?
;						; Yes !!
		LDY	#00
BONSXCOLCHG150	EQU	$
		DEX
		DEX
		BPL	BONSXCOLCHG100		; color data set end ?
;						; Yes !!
; ( kouhan kakikae )
		LDX	<ENINDX
		LDY	<ENWRK3,X
		INY
		INY
		STY	<ENWRK3,X
		TYA
		AND	#00003<<1
		TAY
		LDX	#(4*2)-2
BONSXCOLCHG170	EQU	$
		LDA	!BONSXCOLDT2,Y
		STA	>DATACOL+((80H+6CH)*2),X
		DEY
		DEY
		BPL	BONSXCOLCHG180
;
		LDY	#(BONSXCOLDT-BONSXCOLDT2)-2
BONSXCOLCHG180	EQU	$
		DEX
		DEX
		BPL	BONSXCOLCHG170
;
BONSXCOLCHG200	EQU	$
		LDX	<ENINDX
		RTS
;
;
BONSXCHAR	EQU	$
		BYTE	0E8H,024H	;[00]
		HEX	0A,3D,00
		BYTE	020H,014H
		HEX	0B,3D,00
		BYTE	028H,014H
		HEX	0C,3D,00
		BYTE	030H,00CH
		HEX	60,7D,02
		BYTE	018H,01CH
		HEX	50,3D,00
		BYTE	008H,014H
		HEX	0D,3D,00
		BYTE	018H,014H
		HEX	0F,3D,00
		BYTE	010H,014H
		HEX	0E,3D,00
		BYTE	0F8H,0DCH
		HEX	4E,3D,00
		BYTE	008H,0DCH
		HEX	4E,7D,00
		BYTE	000H,0D4H
		HEX	10,3D,00
		BYTE	000H,0DCH
		HEX	4F,3D,00
		BYTE	010H,0E4H
		HEX	05,7D,00
		BYTE	028H,0ECH
		HEX	1C,3D,02
		BYTE	028H,0E4H
		HEX	01,7D,02
		BYTE	018H,0ECH
		HEX	1A,3D,02
		BYTE	018H,0E4H
		HEX	03,7D,02
		BYTE	010H,0ECH
		HEX	19,3D,00
		BYTE	000H,0E4H
		HEX	07,3D,02
		BYTE	008H,0F4H
		HEX	28,3D,02
		BYTE	030H,004H
		HEX	4D,3D,00
		BYTE	0B8H,0F4H
		HEX	5E,3D,00
		BYTE	0C0H,0F4H
		HEX	5F,3D,00
		BYTE	000H,014H
		HEX	67,3D,00
		BYTE	0C8H,004H
		HEX	40,3D,00
		BYTE	038H,0ECH
		HEX	1E,3D,02
		BYTE	0F0H,014H
		HEX	65,3D,02
		BYTE	020H,004H
		HEX	4B,3D,02
		BYTE	010H,004H
		HEX	49,3D,02
		BYTE	000H,004H
		HEX	47,3D,02
		BYTE	0F0H,004H
		HEX	45,3D,02
		BYTE	0E0H,004H
		HEX	43,3D,02
		BYTE	0D0H,004H
		HEX	41,3D,02
		BYTE	0F0H,0E4H
		HEX	05,3D,02
		BYTE	0E0H,0E4H
		HEX	03,3D,02
		BYTE	0D0H,0E4H
		HEX	01,3D,02
		BYTE	0E8H,014H
		HEX	64,3D,02
		BYTE	0D8H,014H
		HEX	62,3D,02
		BYTE	0C8H,014H
		HEX	60,3D,02
		BYTE	038H,0F4H
		HEX	2E,3D,02
		BYTE	028H,0F4H
		HEX	2C,3D,02
		BYTE	018H,0F4H
		HEX	2A,3D,02
		BYTE	0F8H,0F4H
		HEX	26,3D,02
		BYTE	0E8H,0F4H
		HEX	24,3D,02
		BYTE	0D8H,0F4H
		HEX	22,3D,02
		BYTE	0C8H,0F4H
		HEX	20,3D,02
BONSXCHAREND	EQU	$
;
;
;------------------------------------------------------------------------
;-	initial (パンジー)						-
;------------------------------------------------------------------------
pansy_00	EQU	000H
pansy_01	EQU	001H
pansy_02	EQU	002H
pansy_03	EQU	003H
pansy_04	EQU	004H
pansy_05	EQU	005H
pansy_06	EQU	006H
pansy_07	EQU	007H
pansy_08	EQU	008H
pansy_09	EQU	009H
;
pansyskipptn	EQU	(PANSYSKIPTM-PANSYSKIPPT-1)
pansyturnptn	EQU	(PANSYTURNTM-PANSYTURNPT-1)
PansyAwaMD	EQU	(PansyAwa-PANSYMODSEL)
;
PANSYCOLOR	EQU	$
		BYTE	0, 1<<1, 0, 2<<1, 0, 4<<1, 0, 1<<1
		BYTE	0, 2<<1, 0, 4<<1, 0, 1<<1, 0, 2<<1
;
PANSYXSPD	EQU	$
		WORD	-00040H,  00040H
;
PANSYIN		EQU	$
		LDA	!ENWRKA,X
		BNE	PANSYIN0040		; RESET INITIAL ? [yes->PANSYIN0040]
;
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		LSR	A
		INC	A
		STA	!ENWRKA,X
		DEC	A
		BNE	PANSYIN0020		; [->PANSYIN0020]
;
		LDA	<RANDM0
		AND	#00001H
		ASL	A
		TAY
		LDA	PANSYCOLOR,Y
		STA	!ENWRKC,X
		BRA	PANSYIN0040
;
PANSYIN0020	EQU	$
		LDA	#00400H<<1
		STA	!ENWRKC,X
PANSYIN0040	EQU	$
		JMP	PANSYTURN0100
;
;
;------------------------------------------------------------------------
;-	move (パンジー)							-
;------------------------------------------------------------------------
PANSYMV		EQU	$
		JSR	PANSY_OAM
;
		LDA	!ENMOD0,X
		LDY	!ENSHOT,X
		BNE	PANSYMV0040		; [->PANSYMV0040]
;
		AND	#1111110111111111B	; 衝突チェックされないセット !!
		BRA	PANSYMV0050
;
PANSYMV0040	EQU	$
		ORA	#0000001000000000B	; 衝突チェックされるセット !!
PANSYMV0050	EQU	$
		STA	!ENMOD0,X
;
		JSL	>ENMDCK			; mode check
;
		JSL	>EPCRCK
;
		JSR	PANSY_CRCK
;
		LDA	<ENCONT,X
		TAX
		JMP	(PANSYMODSEL,X)
;
PANSYMODSEL	EQU	$
		WORD	PANSYSKIP
		WORD	PANSYTURN
PansyAwa	WORD	PANSYAWA
;
PANSYSKIPPT	EQU	$
		BYTE	pansy_01, pansy_02, pansy_03, pansy_04
		BYTE	pansy_05, pansy_06, pansy_05, pansy_04
		BYTE	pansy_03, pansy_02, pansy_01, pansy_00
;
PANSYSKIPTM	EQU	$
		HEX	04, 04, 04, 04, 04, 08, 04, 04
		HEX	04, 04, 04, 08
;
PANSYSKIP	EQU	$
		LDX	<ENINDX
;
		LDA	!ENTIM1,X
		BNE	PANSYSKIP0040		; 音符セット ? [no->PANSYSKIP0040]
;
		LDA	#00020H
		STA	!ENTIM1,X
		JSR	ONPU0_SET
;
PANSYSKIP0040	EQU	$
		LDA	!ENCBFG,X
		BIT	#0000000000001100B
		BNE	PANSYSKIP0100		; 横当たり有 ? [yes->PANSYSKIP0100]
;
		BIT	#0000000000000001B
		BEQ	PANSYSKIP0100		; 足当たり有 ? [no->PANSYSKIP0100]
;
		LDA	!ENWRKA,X
		DEC	A
		BEQ	PANSYSKIP0060		; 泡吹き？ [no->PANSYSKIP0060]
;
		LDA	!ENTIM2,X
		BNE	PANSYSKIP0060		; 泡吹き？ [no->PANSYSKIP0060]
;
		LDA	<RANDM0
		AND	#0003FH
		BEQ	PANSYSKIP0200		; 泡吹き？ [yes->PANSYSKIP0200]
;
PANSYSKIP0060	EQU	$
		LDA	!ENTIM0,X
		BNE	PANSYSKIP00F0		; pattern change ? [no->PANSYSKIP00F0]
;
		M8				; memory 8bit mode !!
;
		DEC	<ENWRK0,X
		BPL	PANSYSKIP0080		; minimum pattern number ? [no->PANSYSKIP008]
;
		LDA	#pansyskipptn
		STA	<ENWRK0,X
PANSYSKIP0080	EQU	$
		LDY	<ENWRK0,X
		LDA	PANSYSKIPPT,Y
		STA	!ENCHPT,X
		LDA	PANSYSKIPTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
PANSYSKIP00F0	EQU	$
		RTL
;
PANSYSKIP0100	EQU	$
		LDA	#pansyturnptn
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	PANSYTURNPT,Y
		STA	!ENCHPT,X
		LDA	PANSYTURNTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		STZ	!ENXSPD,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		RTL
;
PANSYSKIP0200	EQU	$
		STZ	!ENXSPD,X
		STZ	!ENTIM1,X
;
		M8				; memory 8bit mode !!
;
		LDY	#(PANSYAWATM-PANSYAWAPT-1)
		STY	<ENWRK0,X
		LDA	PANSYAWAPT,Y
		STA	!ENCHPT,X
		LDA	PANSYAWATM,Y
		STA	!ENTIM0,X
		LDA	#PansyAwaMD
		STA	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
		RTL
;
;
PANSYTURNPT	EQU	$
		BYTE	pansy_07, pansy_07, pansy_07, pansy_07
		BYTE	pansy_08, pansy_07, pansy_08, pansy_07
;
PANSYTURNTM	EQU	$
		HEX	10, 10, 10, 10, 04, 04, 04, 04
;
PANSYTURNFP	EQU	$
		HEX	02, 02, 02, 00, 00, 00, 00, 00
;
PANSYTURN	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	PANSYTURN00F0		; pattern change ? [no->PANSYTURN00F0]
;
		DEC	<ENWRK0,X
		BMI	PANSYTURN0100		; [->PANSYTURN0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	PANSYTURNPT,Y
		STA	!ENCHPT,X
		LDA	PANSYTURNTM,Y
		STA	!ENTIM0,X
		LDA	!ENMUKI,X
		EOR	PANSYTURNFP,Y
		STA	!ENMUKI,X
;
		M16				; memory 16bit mode !!
;
PANSYTURN00F0	EQU	$
		RTL
;
PANSYTURN0100	EQU	$
		LDY	!ENMUKI,X
		LDA	PANSYXSPD,Y
		STA	!ENXSPD,X
		STZ	!ENTIM1,X
;
		M8				; memory 8bit mode !!
;
		LDA	#pansyskipptn
		STA	<ENWRK0,X
		TAY
		LDA	PANSYSKIPPT,Y
		STA	!ENCHPT,X
		LDA	PANSYSKIPTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		STZ	<ENCONT,X
		RTL
;
;
PANSYAWAPT	EQU	$
		BYTE	pansy_09, pansy_08, pansy_07
;
PANSYAWATM	EQU	$
		HEX	20, 20, 08
;
PANSYPLSHFG	EQU	$
		HEX	00, 01, 00
;
PANSYAWA	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	PANSYAWA00F0		; [->PANSYAWA00F0]
;
		LDY	<ENWRK0,X
		DEY
		BMI	PANSYAWA0100		; [->PANSYAWA0100]
;
		STY	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		LDA	PANSYAWAPT,Y
		STA	!ENCHPT,X
		LDA	PANSYAWATM,Y
		STA	!ENTIM0,X
		LDA	PANSYPLSHFG,Y
		BEQ	PANSYAWA0080		; [->PANSYAWA0080]
;
		LDA	!EPXMUK,X
		STA	!ENMUKI,X
PANSYAWA0080	EQU	$
;
		M16				; memory 16bit mode !!
;
PANSYAWA00F0	EQU	$
		LDY	<ENWRK0,X
		BNE	PANSYAWA00F8		; [->PANSYAWA00F8]
;
		LDA	!ENTIM1,X
		BNE	PANSYAWA00F8		; [->PANSYAWA00F8]
;
		JSR	PANSYAWASUB
;
PANSYAWA00F8	EQU	$
		RTL
;
PANSYAWA0100	EQU	$
		LDA	#00020H
		STA	!ENTIM2,X
		BRA	PANSYTURN0100
;
;
PANSYAWASPD	EQU	$
		WORD	-0300H, 00300H
;
PANSYAWAPOS	EQU	$
		WORD	-0018H, 00008H
;
PANSYAWASUB	EQU	$
		LDY	!ENMUKI,X
		LDA	PANSYAWASPD,Y
		STA	<EWORK
		LDA	PANSYAWAPOS,Y
		STA	<EWORK2
		LDA	#SOPB0
		JSL	>ENINSR_I
		BCC	PANSYAWASUB00F0		; [->PANSYAWASUB00F0]
;
		LDA	!ECENTX,X
		CLC
		ADC	<EWORK2
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
;;;;;;;;		CLC
;;;;;;;;		ADC	#00008H
		STA	!ENYPSL,Y
		LDA	<EWORK
		STA	!ENXSPD,Y
		LDA	#00010
		STA	!ENTIM1,Y
		LDA	#00004
		STA	!ENCHPT,Y
		LDA	#0004
		STA	!ENTIM1,X
		LDA	ENMOD0,Y	;敵と当たらない様に
		AND	#1111100111111111B
		STA	ENMOD0,Y
PANSYAWASUB00F0 EQU	$
		RTS
;
;
PANSYCHGADR	EQU	$
		WORD	2*8, 3*8, 2*8, 3*8, 2*8, 3*8, 2*8, 3*8
		WORD	2*8, 3*8, 3*8, 4*8, 3*8, 4*8, 1*8, 2*8
		WORD	0*8, 2*8, 0*8, 2*8
;
PANSY_OAM	EQU	$
		LDA	!ENCHPT,X
		ASL	A
		ASL	A
		TAY
		LDA	PANSYCHGADR,Y
		STA	<EWORK
		LDA	PANSYCHGADR+2,Y
		STA	<EWORK2
		LDY	!ENYUSN,X
		BMI	PANSY_OAM00F0		; [->PANSY_OAM00F0]
;
		I16				; index 16bit mode !!
;
		LDA	!ENOAML,X
		BMI	PANSY_OAM0080		; [->PANSY_OAM0080]
;
		CLC
		ADC	<EWORK
		TAY
		LDA	!SOAM_DX+4,Y
		ORA	!ENWRKC,X
		STA	!SOAM_DX+4,Y		; アトリビュートセット !!
;
		LDA	!ENOAML,X
		CLC
		ADC	<EWORK2
		TAY
		LDA	!SOAM_DX+4,Y
		ORA	!ENWRKC,X
		STA	!SOAM_DX+4,Y		; アトリビュートセット !!
PANSY_OAM0080	EQU	$
;
		I8				; index 8bit mode !!
;
PANSY_OAM00F0	EQU	$
		RTS
;
;
PANSY_CRCK	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	PANSY_CRCK00F0		; 衝突無し ? [yes->PANSY_CRCK00F0]
		BEQ	PANSY_CRCK00F0		; 赤ちゃんと衝突 ? [yes->PANSY_CRCK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	PANSY_CRCK00F0		; mode move ? [no->PANSY_CRCK00F0]
;
		LDA	!ENSHOT,Y
		BEQ	PANSY_CRCK00F0		; ショット ? [no->PANSY_CRCK00F0]
;
		LDA	!ENGPOW,Y
		CMP	#00040H
		BCC	PANSY_CRCK0080		; [->PANSY_CRCK0080]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
;
PANSY_CRCK0080	EQU	$
		LDA	#EFAIL
		STA	!ENMODE,X
		PLA
		RTL
;
PANSY_CRCK00F0	EQU	$
		RTS
;
;
ONPU0_XSPD	EQU	$
		WORD	 00060H, -00060H
;
ONPU0_SET	EQU	$
		LDY	!ENMUKI,X
		LDA	ONPU0_XSPD,Y
		STA	<EWORK
		LDA	#ONPU0
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00010H
		STA	!EXYPSL,Y
		STA	!EXWRK0,Y
		LDA	<EWORK
		STA	!EXXSPD,Y
		LDA	#0FF80H
		STA	!EXYSPD,Y
		LDA	#00008H
		STA	!EXGPOW,Y
		LDA	#00040H
		STA	!EXTIM0,Y
		RTS
;
;
;------------------------------------------------------------------------
;-	fail (パンジー)							-
;------------------------------------------------------------------------
PANSYFL		EQU	$
		LDA	#00039H
		JSL	>SOUND_3_ON		; サウンド セット！！
;
		LDA	!ENWRKC,X
		XBA
		STA	<EWORK			; カラーセット
		JSL	>HANABIRASET_L
;
		JMP	>ENCLEAR_NORETN
;
;
;------------------------------------------------------------------------
;-	initial （鸛）							-
;------------------------------------------------------------------------
KONOTIN		EQU	$
		STZ	!ENMUKI,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move （鸛）							-
;------------------------------------------------------------------------
KONOTPATIPT	EQU	$
		HEX	02, 00, 02, 00, 02, 00
;
KONOTPATITM	EQU	$
		HEX	20, 04, 04, 08, 10, 30
;
KONOTPAKUPT	EQU	$
		HEX	02, 03, 02, 01
KONOTPAKUPTE	EQU	$
;
KonotoriPati	EQU	(KONOTPATITM-KONOTPATIPT-1)
KonotoriPaku	EQU	(KONOTPAKUPTE-KONOTPAKUPT-1)
KonotoriArea	EQU	00080H
;
KONOTMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDY	<ENCONT,X
		TYX
		JMP	(KONOTMVMD,X)
;
KONOTMVMD	EQU	$
		WORD	KONOTWAIT
		WORD	KONOTPATI
		WORD	KONOTPAKU
;
;
KONOTWAIT	EQU	$
		LDX	<ENINDX
		LDA	!ENXPSL,X
		SEC
		SBC	!PLXPSL
		CLC
		ADC	#KonotoriArea
		CMP	#KonotoriArea*2
		BCS	KONOTWAIT00F0		; [->KONOTWAIT00F0]
;
		M8				; memory 8bit mode !!
;
		LDY	#KonotoriPati
		STY	<ENWRK0,X
		LDA	KONOTPATIPT,Y
		STA	!ENCHPT,X
		LDA	KONOTPATITM,Y
		STA	!ENTIM0,X
		INC	<ENCONT,X
		INC	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
KONOTWAIT00F0	EQU	$
		RTL
;
;
KONOTPATI	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	KONOTPATI00F0		; [->KONOTPATI00F0]
;
		LDY	<ENWRK0,X
		DEY
		BMI	KONOTPATI0100		; [->KONOTPATI0100]
;
		STY	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		LDA	KONOTPATIPT,Y
		STA	!ENCHPT,X
		LDA	KONOTPATITM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
KONOTPATI00F0	EQU	$
		RTL
;
KONOTPATI0100	EQU	$
		LDY	<ENCONT,X
		INY
		INY
		STY	<ENCONT,X
		BRA	KONOTPAKU0030		; [->KONOTPAKU0030]
;
;
KONOTPAKU	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	KONOTPAKU00F0		; [->KONOTPAKU00F0]
;
		LDY	<ENWRK0,X
		DEY
		BPL	KONOTPAKU0040		; [->KONOTPAKU0040]
;
KONOTPAKU0030	EQU	$
		LDY	#KonotoriPaku
KONOTPAKU0040	EQU	$
		STY	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		LDA	KONOTPAKUPT,Y
		STA	!ENCHPT,X
		LDA	#04
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
KONOTPAKU00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial （ルーレットドア）					-
;------------------------------------------------------------------------
RDOORANGL	EQU	$
		HEX	00, 00, 40, 80, C0
;
RDOORCHPT	EQU	$
		HEX	00, 00, 01, 02, 03
;
RDOORIN		EQU	$
		CPX	#04
		BEQ	RDOORIN0010		; [->RDOORIN0010]
;
		LDA	#RDOOR
		LDY	#04
		JSL	>ENINSR2
		BCC	RDOORIN000F		; [->RDOORIN000F]
;
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		STA	!ENYPSL,Y
		LDA	#EINIT
		STA	!ENMODE,Y
RDOORIN000F	EQU	$
		JMP	>ENCLEAR
;
RDOORIN0010	EQU	$
		JSL	>TROBJ_SR_4x4_CL
;
		STZ	!ENMUKI,X
		LDA	#00000H
		STA	<ENWRK2,X
		JSR	RDOORWRITE
;
		M8				; memory 8bit mode !!
;
		LDA	#0FFH
		STA	!ENYUSN,X
;
		M16				; memory 16bit mode !!
;
		STZ	!RDOORBF
		STZ	!RDOORBF+2
		STZ	!RDOORBF+4
		STZ	!RDOORBF+6
		STZ	!RDOORBF+8
;
		LDA	#(0004*2)
		STA	<EWORK
RDOORIN0040	EQU	$
		LDA	#RDOOR
		JSL	>ENINSR
		BCC	RDOORIN0100		; [->RDOORIN0100]
;
		LDA	!ENTROB,X
		STA	!ENTROB,Y
		LDA	!ENXPSL,X
		STA	!ENWRK6,Y
		LDA	!ENYPSL,X
		STA	!ENWRK8,Y
;
		M8				; memory 8bit mode !!
;
		LDA	<EWORK
		STA	!ENWRKA,Y
		LSR	A
		PHX
		TAX
		LDA	RDOORANGL,X
		STA	!ENWRK4,Y
		LDA	RDOORCHPT,X
		STA	!ENCHPT,Y
		PLX
;
		M16				; memory 16bit mode !!
;
		PHX
		TYX
		JSR	RDOORPOSSET
		PLX
;
		DEC	<EWORK
		DEC	<EWORK
		BNE	RDOORIN0040		; [->RDOORIN0040]
;
RDOORIN00F0	EQU	$
		RTL
;
RDOORIN0100	EQU	$
		LDA	<EWORK
		CMP	#(0004*2)
		BNE	RDOORIN00F0		; [->RDOORIN00F0]
;
		JSL	>ENCLEAR
;
;
RDOORWRITE	EQU	$
		LDA	!MSGMOD
		BNE	RDOORWRITE00F0		; メッセージ表示中？ [yes->RDOORWRITE00F0]
;
		LDA	!ENTROB,X
		BMI	RDOORWRITE00F0		; 回転オブジェ使用？ [no->RDOORWRITE00F0]
;
		JSL	>DOOR_CHR_SET
;
RDOORWRITE00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	move （ルーレットドア）						-
;------------------------------------------------------------------------
RDOORMV		EQU	$
		LDY	!ENWRKA,X
		TYX
		JMP	(RDOORMVMOD,X)
;
RDOORMVMOD	EQU	$
		WORD	RDOORMAIN
		WORD	RDOORSUB
		WORD	RDOORSUB
		WORD	RDOORSUB
		WORD	RDOORSUB
;
;
;-------< 親分 >--------
RDOORMAIN	EQU	$
		LDX	<ENINDX
		JSR	RDOORWRITE
;
		LDY	<ENWRK5,X
		TYX
		JMP	(RDOORMAINMOD,X)
;
RDOORMAINMOD	EQU	$
		WORD	RDOORMAIN01
		WORD	RDOORMAIN02
;
;
RDOORMAIN01	EQU	$
		LDX	<ENINDX
		LDA	!RDOORBF
		BEQ	RDOORMAIN00F0		; [->RDOORMAIN00F0]
;
		LDA	#0008*3
		LDY	#(0004*2)
RDOORMAIN0040	EQU	$
		CPY	!RDOORBF
		BEQ	RDOORMAIN0050		; [->RDOORMAIN0050]
;
		STA	!RDOORBF,Y
		SEC
		SBC	#0008
RDOORMAIN0050	EQU	$
		DEY
		DEY
		BNE	RDOORMAIN0040		; [->RDOORMAIN0040]
;
RDOORMAIN00F0	EQU	$
		RTL
;
;
RDOORMAIN02	EQU	$
		LDX	<ENINDX
		RTL
;
;
;-------< 子分 >--------
RDOORSUB	EQU	$
		LDX	<ENINDX
		LDY	!ENYUSN,X
		CMP	#0FFH
		BEQ	RDOORSUB0040		; 表示中？ [no->RDOORSUB0040]
;
		I16				; index 16bit mode !!
;
		LDA	!ENOAML,X
		CLC
		ADC	#0008
		TAY
		JSL	>TROBJ_OAM_4x4_F
		IDX8
;
RDOORSUB0040	EQU	$
		LDY	<ENWRK5,X
		TYX
		JMP	(RDOORSUBMOD,X)
;
RDOORSUBMOD	EQU	$
		WORD	RDOORSUB01
RDoorHit	WORD	RDOORSUB02
RDoorClr	WORD	RDOORSUB03
RDoorCl2	WORD	RDOORSUB04
;
RDoorHitMD	EQU	(RDoorHit-RDOORSUBMOD)
RDoorClrMD	EQU	(RDoorClr-RDOORSUBMOD)
RDoorCl2MD	EQU	(RDoorCl2-RDOORSUBMOD)
;
;
RDOORSUB01	EQU	$
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		LDY	!ENWRKA,X
		LDA	!RDOORBF,Y
		BEQ	RDOORSUB010020		; [->RDOORSUB010020]
;
		STA	!ENTIM0,X
		LDY	#RDoorCl2MD
		STY	<ENWRK5,X
		RTL
;
RDOORSUB010020	EQU	$
		JSR	RDOORSUBCRCK		; 衝突チェック！！
;
		JSR	RDOORPOSSET
;
		M8				; memory 8bit mode !!
;
		LDA	<ENWRK4,X
		CLC
		ADC	#0008
		STA	<ENWRK4,X
;
		M16				; memory 16bit mode !!
;
		RTL
;
;
RDOORSUB02	EQU	$
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		LDA	!ENCBFG,X
		AND	#0000000000000001B
		BEQ	RDOORSUB0200F0		; 着地？ [no->RDOORSUB0200F0]
;
		LDA	#ZDOOR
		JSL	>ENINSR_I
		BCC	RDOORSUB0200F0		; ドアセット成功？ [no->RDOORSUB0200F0]
;
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		STA	!ENYPSL,Y
		LDA	!ENMOD2,Y
		AND	#1111111111110011B
		STA	!ENMOD2,Y
;
		LDY	#RDoorClrMD
		STY	<ENWRK5,X
RDOORSUB0200F0	EQU	$
		RTL
;
;
RDOORSUB03	EQU	$
		LDX	<ENINDX
		LDY	!ECRSFG,X
		BPL	RDOORSUB0300F0		; プレイヤーと接触？ [no->RDOORSUB0300F0]
;
		LDA	!KEYC1
		AND	#00008H
		BEQ	RDOORSUB0300F0		; 上キーＯＮ？ [no->RDOORSUB0300F0]
;
RDOORSUB0300C0	EQU	$
		LDA	#-1
		STA	!ENTROB,X
		JSL	>ENCLEAR
;
RDOORSUB0300F0	EQU	$
		RTL
;
;
RDOORSUB04	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	RDOORSUB0400F0		; [->RDOORSUB0400F0]
;
		LDA	#00036H
		JSL	>SOUND_3_ON		; サウンド セット！！
;
		LDA	#FUSNB
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		SEC
		SBC	#0008
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		STA	!EXYPSL,Y
		LDA	#0000BH
		STA	!EXWRK0,Y
		LDA	#0004
		STA	!EXTIM0,Y
;
		BRA	RDOORSUB0300C0		; [->RDOORSUB0300C0]
;
RDOORSUB0400F0	EQU	$
		RTL
;
;
RDOORPOSSET	EQU	$
		LDY	<ENWRK4,X
		TYA
		ASL	A
		TXY
;
		I16				; index 16bit mode !!
;
		TAX
		LDA	>COS,X
		ASR16
		ASR16
		ASR16
		CLC
		ADC	!ENWRK6,Y
		STA	!ENXPSL,Y
		LDA	>SIN,X
		ASR16
		ASR16
		ASR16
		CLC
		ADC	!ENWRK8,Y
		STA	!ENYPSL,Y
;
		I8				; index 8bit mode !!
;
		TYX
RDOORPOSSET00F0 EQU	$
		RTS
;
;
RDOORSUBCRCK	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	RDOORPOSSET00F0		; 当たった？ [no->RDOORPOSSET00F0]
		BEQ	RDOORPOSSET00F0		; 赤ちゃん？ [yes->RDOORPOSSET00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	RDOORPOSSET00F0		; Ｍｏｄｅ Ｍｏｖｅ？ [no->RDOORPOSSET00F0]
;
		LDA	!ENSHOT,Y
		BEQ	RDOORPOSSET00F0		; ショット？ [no->RDOORPOSSET00F0]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
;
		LDY	!ENWRKA,X
		TYA
		STA	!RDOORBF
		JSR	ROOM_SET		; 部屋ナンバーセット！！
;
		LDA	#0FC00H
		STA	!ENYSPD,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	!ENMOD1,X
		ORA	#00001H
		STA	!ENMOD1,X
;
		LDY	#RDoorHitMD
		STY	<ENWRK5,X
RDOORSUBCRCK0F0 EQU	$
		PLA				; ぷるぷるりたーん！！
		RTL
;
;
;------------------------------------------------------------------------
;-	部屋ナンバーセット！！						-
;------------------------------------------------------------------------
		EXT	CORS_67_03,CORS_67_04,CORS_67_05,CORS_67_06
ROOM_NEXTGOTO	EQU	$
		BYTE	CORS_67_03, 005H,077H, PO_NORMAL    ;（１：木の城）
		BYTE	CORS_67_04, 007H,07AH, PO_NORMAL    ;（２：石）
		BYTE	CORS_67_05, 005H,05BH, PO_NORMAL    ;（３：カチカチオートスクロール）
		BYTE	CORS_67_06, 000H,077H, PO_DK_I_R    ;（４：ふかん）
;
ROOM_SET	EQU	$
		DEC	A
		DEC	A
		ASL	A
		CLC
		ADC	#ROOM_NEXTGOTO
		STA	<EWORK
		LDY	!ENWRK6+1,X
		TYA
		ASL	A
		ASL	A
		STA	<EWORK2
		LDA	!ENWRK8,X
		AND	#00700H
		LSR	A
		LSR	A
		ORA	<EWORK2
		PHX
;
		I16				; index 16bit mode !!
;
		TAX
		LDA	(<EWORK)
		STA	>NXGOTOBF,X
		INC	<EWORK
		INC	<EWORK
		LDA	(<EWORK)
		STA	>NXGOTOBF+2,X
;
		I8				; index 8bit mode !!
;
		PLX
		RTS
;
;
;------------------------------------------------------------------------
;-	initial (矢印)							-
;------------------------------------------------------------------------
YAJI0_ANGL	EQU	$
		HEX	00, 01, 01, 00
;
YAJI0_VHF	EQU	$
		BYTE	00000000B, 01000000B, 00000000B, 11000000B
;
YAJI1_ANGL	EQU	$
		HEX	02, 02, 02, 02
;
YAJI1_VHF	EQU	$
		BYTE	00000000B, 01000000B, 10000000B, 11000000B
;
YAJI1IN		EQU	$
;
		M8				; memory 8bit mode !!
;
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		LSR	A
		STA	<EWORK
		LDA	!ENYPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		ORA	<EWORK
		TAY
		LDA	YAJI1_ANGL,Y
		STA	!ENCHPT,X
		LDA	!ENCLOR,X
		ORA	YAJI1_VHF,Y
		STA	!ENCLOR,X
;
		M16				; memory 16bit mode !!
;
		BRA	YAJI0IN0080
;
YAJI0IN		EQU	$
;
		M8				; memory 8bit mode !!
;
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		LSR	A
		STA	<EWORK
		LDA	!ENYPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		ORA	<EWORK
		TAY
		LDA	YAJI0_ANGL,Y
		STA	!ENCHPT,X
		LDA	!ENCLOR,X
		EOR	YAJI1_VHF,Y
		STA	!ENCLOR,X
;
		M16				; memory 16bit mode !!
;
YAJI0IN0080	EQU	$
		LDA	!ENXPSL,X
		AND	#0FFE0H
		CLC
		ADC	#0008
		STA	!ENXPSL,X
		LDA	!ENYPSL,X
		AND	#0FFE0H
		CLC
		ADC	#0008
		STA	!ENYPSL,X
		STZ	!ENMUKI,X
;
		RTL
;
;
;------------------------------------------------------------------------
;-	move (矢印)							-
;------------------------------------------------------------------------
YAJI0MV		EQU	$
YAJI1MV		EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (とんぼ)						-
;------------------------------------------------------------------------
dragonflytime	EQU	02
;
DRAGONFLYXPOS	EQU	$
;			   [0]	    [2]	     [4]      [6]
		WORD	-00010H, -00020H, -00010H,  00000H
;			   [8]	    [A]	     [C]      [E]
		WORD	 00010H,  00020H,  00010H,  00000H
;
DRAGONFLYINCNT	EQU	$
		WORD	00000H, 00008H
;
DGFLYIN		EQU	$
		LDA	#dragonflytime
		STA	!ENTIM0,X
		LDA	!ENXPSL,X
		STA	<ENWRK0,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		EOR	#00002H
		STA	!ENMUKI,X
		TAY
		LDA	DRAGONFLYINCNT,Y
		STA	<ENCONT,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (とんぼ)							-
;------------------------------------------------------------------------
DGFLYMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		JSR	DGFLY_MOVE
;
		LDA	!ENTIM0,X
		BNE	DGFLYMV0080		; pattern change ? [no->DGFLYMV0080]
;
		LDA	#dragonflytime
		STA	!ENTIM0,X
		LDA	!ENCHPT,X
		EOR	#00001H
		STA	!ENCHPT,X
DGFLYMV0080	EQU	$
		RTL
;
;
DGFLY_MOVE	EQU	$
		LDY	<ENCONT,X
		LDA	<ENWRK0,X
		CLC
		ADC	DRAGONFLYXPOS,Y
		SEC
		SBC	!ENXPSL,X
		ASL	A
		ASL	A
		ASL	A
		ASL	A
		ASL	A
		STA	!ENXSPD,X
		BNE	DGFLY_MOVE0080		; 次の目標に変える ? [no->DGFLY_MOVE0080]
;
		LDA	!ENTIM1,X
		BNE	DGFLY_MOVE0080		; [->DGFLY_MOVE0080]
;
		LDA	<ENWRK2,X
		BNE	DGFLY_MOVE0040		; [->DGFLY_MOVE0040]
;
		LDA	#00020H
		STA	!ENTIM1,X
		INC	<ENWRK2,X
		BRA	DGFLY_MOVE0080
;
DGFLY_MOVE0040	EQU	$
		STZ	<ENWRK2,X
		LDA	<ENCONT,X
		INC	A
		INC	A
		AND	#0000EH
		STA	<ENCONT,X
		CMP	#00004H
		BEQ	DGFLY_MOVE0060		; 向きチェンジ ? [yes->DGFLY_MOVE0060]
;
		CMP	#0000CH
		BNE	DGFLY_MOVE0080		; 向きチェンジ ? [no->DGFLY_MOVE0080]
;
DGFLY_MOVE0060	EQU	$
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
DGFLY_MOVE0080	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	initial (蝶々)							-
;------------------------------------------------------------------------
butterflytime	EQU	04
butterflyxpos	EQU	00020H
butterflyxspd	EQU	00040H
butterflyxtim	EQU	((butterflyxpos<<9)/butterflyxspd)
;
BUTTERFLYCOL	EQU	$
		WORD	0<<1, 1<<1, 2<<1, 4<<1
;
BUTTERFLYXPS	EQU	$
		WORD	 butterflyxpos, -butterflyxpos
;
BUTTERFLYYPS	EQU	$
		WORD	 00008H, -00008H
;
BUTTERFLYXSPD	EQU	$
		WORD	-butterflyxspd,	 butterflyxspd
;
BUTTERFLYGMAX	EQU	$
		WORD	-00800H,  00800H
;
BTFLYIN		EQU	$
		LDA	<RANDM0
		AND	#00003H
		ASL	A
		TAY
		LDA	!ENCLOR,X
		ORA	BUTTERFLYCOL,Y
		STA	!ENCLOR,X
		LDA	#butterflytime
		STA	!ENTIM0,X
;
		LDA	!ENXPSL,X
		PHA
		STA	<ENWRK0,X		; 基準Ｘポジション
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		EOR	#00002H
		STA	!ENMUKI,X
		TAY
		PLA
		CLC
		ADC	BUTTERFLYXPS,Y
		STA	!ENXPSL,X
		LDA	!ENYPSL,X
		STA	<ENWRK2,X		; 基準Ｙポジション
		CLC
		ADC	BUTTERFLYYPS,Y
		STA	!ENYPSL,X
		LDA	BUTTERFLYXSPD,Y
		STA	!ENXSPD,X
		LDA	#butterflyxtim
		STA	!ENTIM1,X
		LDA	BUTTERFLYGMAX,Y
		STA	!ENGMAX,X
		LDA	#00008H
		STA	!ENGPOW,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (蝶々)							-
;------------------------------------------------------------------------
BTFLYMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	!ENTIM0,X
		BNE	BTFLYMV0080		; pattern change ? [no->BTFLYMV0080]
;
		LDA	#butterflytime
		STA	!ENTIM0,X
		LDA	!ENCHPT,X
		EOR	#00001H
		STA	!ENCHPT,X
BTFLYMV0080	EQU	$
		LDA	!ENTIM1,X
		BNE	BTFLYMV00C0		; 反転 ? [no->BTFLYMV00C0]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		TAY
		LDA	BUTTERFLYXSPD,Y
		STA	!ENXSPD,X
		LDA	#butterflyxtim
		STA	!ENTIM1,X
BTFLYMV00C0	EQU	$
		LDY	#00
		LDA	!ENYPSL,X
		CMP	<ENWRK2,X
		BPL	BTFLYMV00D0		; 上 ? [no->BTFLYMV00D0]
;
		INY
		INY
BTFLYMV00D0	EQU	$
		LDA	BUTTERFLYGMAX,Y
		STA	!ENGMAX,X
BTFLYMV00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (プチパックン)						-
;------------------------------------------------------------------------
p_kun_00	EQU	000H
p_kun_01	EQU	001H
p_kun_02	EQU	002H
p_kun_03	EQU	003H
p_kun_04	EQU	004H
p_kun_05	EQU	005H
p_kun_06	EQU	006H
p_kun_07	EQU	007H
;
P_KUN_XPOS	EQU	$
		WORD	-00008H, 00008H
;
P_KUN_XMAX	EQU	$
		WORD	00800H, -00800H
;
P_KUNIN		EQU	$
		STZ	!ENMUKI,X
		LDA	!ENXPSL,X
		STA	<ENWRK4,X		; 中心セーブ !!
		PHA
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		TAY
		LDA	P_KUN_XMAX,Y
		STA	!ENXMAX,X
		PLA
		CLC
		ADC	P_KUN_XPOS,Y
		STA	!ENXPSL,X
		LDA	#00004H
		STA	!ENXPOW,X
		RTL
;
;
P_KN2IN		EQU	$
		LDA	#0002
		STA	<ENCONT,X
		LDA	!ENMOD2,X
		ORA	#0000000100100000B	; 照準合うセット！！
		STA	!ENMOD2,X		; シャボン玉に入るセット !!
		STZ	!ENXPOW,X
		STZ	!ENXSPD,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#00400H
		STA	!ENGMAX,X
		LDA	#p_kun_06
		STA	!ENCHPT,X
		LDA	#0032
		STA	!ENTIM0,X
		LDA	#0001
		STA	<ENWRK0,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (プチパックン)						-
;------------------------------------------------------------------------
P_KUNMV		EQU	$
		LDA	!ENMODE,X
		CMP	#EEATM
		BNE	P_KN2MV		; 食べられた？ [no->P_KN2MV]
;
		LDA	!ENMOD1,X
		AND	#1000000000000000B
		BNE	P_KN2MV		; [yes->P_KN2MV]
;
		LDA	#P_KN2
		TXY
		JSL	>ESTATST
;
		JSL	>P_KN2IN
;
P_KN2MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JSR	(P_KUNMVMODSEL,X)
;
;[1995.05.15.MO]		LDY	<ENCONT,X
;[1995.05.15.MO]		BEQ	P_KUNMV00C0		; [->P_KUNMV00C0]
;[1995.05.15.MO];
;[1995.05.15.MO]		CPY	#02
;[1995.05.15.MO]		BNE	P_KUNMV00F0		; [->P_KUNMV00F0]
;[1995.05.15.MO];
P_KUNMV00C0	EQU	$
		JSL	>EPCRCK
;
P_KUNMV00F0	EQU	$
		RTL
;
P_KUNMVMODSEL	EQU	$
		WORD	P_KUN_FALL
		WORD	P_KUN_WALK
		WORD	P_KUN_FALL2
		WORD	P_KUN_WAIT
;
;
P_KUN_FALLPT	EQU	$
		BYTE	p_kun_01, p_kun_02, p_kun_03, p_kun_04
		BYTE	p_kun_03, p_kun_02, p_kun_01, p_kun_00
;
P_KUN_FALLTM	EQU	$
		HEX	08, 04, 08, 0C, 08, 04, 08, 0C
;
P_KUN_FALL	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		AND	#0000000000000001B
		BNE	P_KUN_FALL0100		; 着地 ? [yes->P_KUN_FALL0100]
;
		LDY	#00
		LDA	!ENXPSL,X
		CMP	<ENWRK4,X
		BMI	P_KUN_FALL0040		; 左 ? [yes->P_KUN_FALL0040]
;
		INY
		INY
P_KUN_FALL0040	EQU	$
		LDA	P_KUN_XMAX,Y
		STA	!ENXMAX,X
;
P_KUN_FALL0050	EQU	$
		LDY	#p_kun_02
		LDA	!ENXSPD,X
		CLC
		ADC	#00010H
		CMP	#00020H
		BCC	P_KUN_FALL0080		; [->P_KUN_FALL0080]
;
		CLC
		ADC	#00010H
		CMP	#00040H
		BCS	P_KUN_FALL0060		; [->P_KUN_FALL0060]
;
		LDY	#p_kun_01
		LDA	!ENXSPD,X
		BPL	P_KUN_FALL0080		; [->P_KUN_FALL0080]
;
		LDY	#p_kun_03
		BRA	P_KUN_FALL0080
;
P_KUN_FALL0060	EQU	$
		LDY	#p_kun_00
		LDA	!ENXSPD,X
		BPL	P_KUN_FALL0080		; [->P_KUN_FALL0080]
;
		LDY	#p_kun_04
P_KUN_FALL0080	EQU	$
		TYA
		STA	!ENCHPT,X
		RTS
;
P_KUN_FALL0100	EQU	$
		LDA	#00077H
		JSL	>SOUND_3_ON		; サウンド セット！！
;
		JSL	>FSMK0_SET_S
;
;[1995.06.16.FR]		LDA	#FSMK0
;[1995.06.16.FR]		JSL	>EXINSR
;[1995.06.16.FR];
;[1995.06.16.FR]		LDA	!ECENTX,X
;[1995.06.16.FR]		STA	!EXXPSL,Y
;[1995.06.16.FR]		LDA	!ECENTY,X
;[1995.06.16.FR]		STA	!EXYPSL,Y
;[1995.06.16.FR]		LDA	#0003
;[1995.06.16.FR]		STA	!EXTIM0,Y
;[1995.06.16.FR]		LDA	#0006
;[1995.06.16.FR]		STA	!EXCHPT,Y
;[1995.06.16.FR]		STA	!EXWRK0,Y
;[1995.06.16.FR];
P_KUN_FALL0180	EQU	$
		LDA	!ENMOD0,X
		AND	#1110011111111111B
		STA	!ENMOD0,X		; 踏めるセット！！
		LDA	!ENMOD1,X
		AND	#0111111111111111B
		ORA	#0000000001000000B
		STA	!ENMOD1,X		; ＢＧ横当たりで反転セット !!
		LDA	!ENMOD2,X
		ORA	#0000000100100000B	; 照準合うセット！！
		STA	!ENMOD2,X		; シャボン玉に入るセット !!
		STZ	!ENXPOW,X
		STZ	!ENXSPD,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#00400H
		STA	!ENGMAX,X
		LDA	#p_kun_06
		STA	!ENCHPT,X
;[1995.04.27.TH]		LDA	#0032
		LDA	#0064
		STA	!ENTIM0,X
		LDA	#0001
		STA	<ENWRK0,X
;[1995.04.27.TH]		LDA	!EPXMUK,X
;[1995.04.27.TH]		AND	#000FFH
;[1995.04.27.TH]		STA	!ENMUKI,X		; 向きセット !!
;[1995.04.27.TH]		LDA	#02
		LDA	#06
		STA	<ENCONT,X
		RTS
;
;
P_KUN_FALL2	EQU	$
		LDX	<ENINDX

		LDY	ENYSPD+1,X
		BMI	P_KUN_FALL2800

P_KUN_FALL2300	EQU	$
		LDA	ENXPSL,X
		SEC
		SBC	#00008
		STA	<ENWRK4,X
		LDA	#0F800H
		STA	ENXMAX,X
		LDA	ENMOD2,X
		ORA	#00004H
		STA	ENMOD2,X
		LDA	ENDSYL,X
		CMP	#0FFF0H
		BPL	P_KUN_FALL2700

		LDA	ESCCV1
		SEC
		SBC	#00010H
		STA	ENYPSL,X

P_KUN_FALL2700	EQU	$
		STZ	<ENCONT,X

P_KUN_FALL2800	EQU	$
		JMP	P_KUN_FALL0050
;
;
P_KUN_WAIT	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	P_KUN_WAIT00F0		; [->P_KUN_WAIT00F0]
;
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	!ENMUKI,X		; 向きセット !!
		LDY	#02
		STY	<ENCONT,X
P_KUN_WAIT00F0	EQU	$
		RTS
;
;
P_KUN_AIRPT	EQU	$
		BYTE	p_kun_05, p_kun_06, p_kun_07
;
P_KUN_EARTHPT	EQU	$
		BYTE	p_kun_07, p_kun_06
;
P_KUN_XSPD	EQU	$
		WORD	-00080H, 00080H
;
P_KUN_WALK	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BNE	P_KUN_WALK0080		; 足が地に着いている ? [yes->P_KUN_WALK0080]
;
		LDA	!ENMOD1,X
		AND	#1111011111111111B
		LDA	!ENMOD1,X		; ひっくり返るクリア !!
		LDA	#0004
		STA	!ENTIM0,X
		LDA	#0000
		STA	<ENWRK0,X
		LDY	#00
		LDA	!ENYSPD,X
		BPL	P_KUN_WALK0040		; 上昇中 ? [no->P_KUN_WALK0040]
;
		INY
		CMP	#0FF00H
		BCC	P_KUN_WALK0040		; [->P_KUN_WALK0040]
;
		INY
P_KUN_WALK0040	EQU	$
;
		M8				; memory 8bit mode !!
;
		LDA	P_KUN_AIRPT,Y
		STA	!ENCHPT,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
P_KUN_WALK0080	EQU	$
		LDA	!ENMOD1,X
		ORA	#0000100000000000B
		LDA	!ENMOD1,X		; ひっくり返るセット !!
		STZ	!ENXSPD,X
;[1995.02.27.MO]		LDA	!ENWRK6,X
;[1995.02.27.MO]		BNE	P_KUN_WALK00A0		; 向きセット ? [no->P_KUN_WALK00A0]
;[1995.02.27.MO];
;[1995.02.27.MO]		LDA	!EPXMUK,X
;[1995.02.27.MO]		AND	#000FFH
;[1995.02.27.MO]		STA	!ENMUKI,X
;[1995.02.27.MO]P_KUN_WALK00A0	EQU	$
		LDA	!ENTIM0,X
		BNE	P_KUN_WALK00F0		; [->P_KUN_WALK00A0]
;
		DEC	<ENWRK0,X
		BMI	P_KUN_WALK0100		; [->P_KUN_WALK0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	P_KUN_EARTHPT,Y
		STA	!ENCHPT,X
		LDA	#08
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
P_KUN_WALK00F0	EQU	$
		RTS
;
P_KUN_WALK0100	EQU	$
		LDY	!ENMUKI,X
		LDA	P_KUN_XSPD,Y
		STA	!ENXSPD,X
		LDA	#0FE00H
		STA	!ENYSPD,X
		RTS
;
;
;------------------------------------------------------------------------
;-	initial （ルイージ）						-
;------------------------------------------------------------------------
LUIGIIN		EQU	$
		JSL	>TROBJ_SR_4x4_CL
;
		JSR	LUIGICHRUSE
;
		STZ	!ENMUKI,X
		RTL
;
;
LUIGICHRSUU	EQU	$
		BYTE	00100000B, 00101000B, 00101000B, 00101000B
		BYTE	00101000B, 00101000B, 00101000B, 00101000B
		BYTE	00101000B, 00101000B
;
LUIGICHRUSE	EQU	$
;
		M8				; memory 8bit mode !!
;
		LDY	!ENCHPT,X
		LDA	!ENMOD2+1,X
		AND	#00000111B
		ORA	LUIGICHRSUU,Y
		STA	!ENMOD2+1,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
;------------------------------------------------------------------------
;-	move （ルイージ）						-
;------------------------------------------------------------------------
LUIGITIME	EQU	$
		HEX	20, 02, 02, 02, 20, 02, 20, 10
		HEX	02, 02, 02, 02, 02, 02, 10, 04
		HEX	04, 04, 04, 04, 04, 04, 04, 04
		HEX	04, 04, 04, 04, 04, 20
;
LUIGICHPT	EQU	$
		HEX	09, 08, 04, 06, 07, 06, 04, 05
		HEX	04, 03, 02, 01, 00, 00, 00, 00
		HEX	00, 00, 00, 00, 00, 00, 00, 00
		HEX	00, 00, 00, 00, 00, 00
;
LUIGIMAGID	EQU	$
		HEX	00, 00, 00, 00, 00, 00, 00, 04
		HEX	00, 02, 06, 06, 02, 00, 04, 00
		HEX	02, 00, 04, 00, 02, 00, 04, 00
		HEX	02, 00, 04, 00, 02, 00
;
LuigiPtn	EQU	(LUIGICHPT-LUIGITIME-1)
LuigeArea	EQU	00030H
;
LUIGIMV		EQU	$
		JSR	LUIGIOAMST
;
		JSR	LUIGICHRST
;
		JSL	>ENMDCK			; mode check
;
		LDY	<ENWRK0,X
		TYX
		JMP	(LUIGIMVMD,X)
;
LUIGIMVMD	EQU	$
		WORD	LUIGIWAIT
		WORD	LUIGIGOSO
;
;
LUIGIWAIT	EQU	$
		LDX	<ENINDX
		LDA	!ENXPSL,X
		SEC
		SBC	!PLXPSL
		CLC
		ADC	#LuigeArea
		CMP	#LuigeArea*2
		BCS	LUIGIWAIT00F0		; [->LUIGIWAIT00F0]
;
		M8				; memory 8bit mode !!
;
		LDY	#LuigiPtn
		STY	<ENWRK1,X
		LDA	LUIGITIME,Y
		STA	!ENTIM0,X
		LDA	LUIGICHPT,Y
		STA	!ENCHPT,X
		LDA	LUIGIMAGID,Y
		STA	<ENCONT,X
		INC	<ENWRK0,X
		INC	<ENWRK0,X
;
		M16				; memory 16bit mode !!
;
		JSR	LUIGICHRUSE
;
LUIGIWAIT00F0	EQU	$
		RTL
;
;
LUIGIGOSO	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	LUIGIGOSO00F0		; [->LUIGIGOSO00F0]
;
		LDY	<ENWRK1,X
		DEY
		BMI	LUIGIGOSO0100		; [->LUIGIGOSO0100]
;
		STY	<ENWRK1,X
;
		M8				; memory 8bit mode !!
;
		LDA	LUIGITIME,Y
		STA	!ENTIM0,X
		LDA	LUIGICHPT,Y
		STA	!ENCHPT,X
		LDA	LUIGIMAGID,Y
		STA	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
		JSR	LUIGICHRUSE
;
LUIGIGOSO00F0	EQU	$
		RTL
;
LUIGIGOSO0100	EQU	$
		RTL
;
;
LUIGIOAMST	EQU	$
		LDA	!ENCHPT,X
		BNE	LUIGIOAMS2		; [->LUIGIOAMS2]
;
		JSL	>TROBJ_OAM_4x4
;
		RTS
;
LUIGIOAMS2	EQU	$
;
		I16				; index 16bit mode !!
;
		LDA	!ENOAML,X
		CLC
		ADC	#0008
		TAY
		JSL	>TROBJ_OAM_4x4_I
;
		IDX8
;
		RTS
;
;
LUIGIXMAG	EQU	$
		WORD	00100H, 000E8H, 00120H, 000D0H
;
LUIGIYMAG	EQU	$
		WORD	00100H, 00120H, 000E8H, 00150H
;
LUIGICHRST	EQU	$
		LDY	!ENYUSN,X
		CMP	#0FFH
		BEQ	LUIGICHRST00F0		; 表示中？ [no->LUIGICHRST00F0]
;
		LDA	!MSGMOD
		BNE	LUIGICHRST00F0		; メッセージ表示中？ [yes->LUIGICHRST00F0]
;
		LDA	!ENTROB,X
		BMI	LUIGICHRST00F0		; 回転オブジェ使用？ [no->LUIGICHRST00F0]
;
		LDY	<ENCONT,X
		LDA	LUIGIXMAG,Y
		STA	R6			; (R6)	<- Ｘ倍率
		LDA	LUIGIYMAG,Y
		STA	R11			; (R11) <- Ｙ倍率
		LDA	#00010H
		STA	R8			; (R8)	<- 中心Ｘ
		LDA	#00019H
		STA	R9			; (R9)	<- 中心Ｙ
;
		I16				; index 16bit mode !!
;
		LDY	!ENTROB,X
		TYX
		LDA	>TROBJ_PLOT_X,X
		STA	R3			; (R3)	<- ビットマップＸ座標
		LDA	>TROBJ_PLOT_Y,X
		STA	R2			; (R2)	<- ビットマップＹ座標
		LDA	#CIPCHD2+020A0H
		STA	R12			; (R12) <- キャラクタアドレス
		LDA	#BANK CIPCHD2+020A0H
		STA	R13			; (R13) <- キャラクタバンク
;
		I8				; index 8bit mode !!
;
		M_CHIP	C_32_ZOOM_XY
		LDX	<ENINDX
;
		INC	!OBM7WF
LUIGICHRST00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	initial （見えない？雲）					-
;-		００：タイムくん  ０１：ひまわりリフト			-
;-		１０：フラワー	  １１：シャボン１ＵＰ			-
;------------------------------------------------------------------------
HIMITUITEM	EQU	$
		WORD	QKM0C, QKM13, QKM03, QKM02
;
HIMITIN		EQU	$
		LDY	!ENWRKA,X
		BNE	HIMITIN0040		; イニシャル？ [no->HIMITIN0040]
;
		M8				; memory 8bit mode !!
;
		LDA	!ENXPSL,X
		AND	#010H
		LSR	A
		LSR	A
		LSR	A
		STA	<EWORK
		LDA	!ENYPSL,X
		AND	#010H
		LSR	A
		LSR	A
		ORA	<EWORK
		INC	A
		STA	!ENWRKA,X
		TAY
;
		M16				; memory 16bit mode !!
;
HIMITIN0040	EQU	$
		DEY
		TYX
		JMP	(HIMITINMOD,X)
;
HIMITINMOD	EQU	$
		WORD	HIMITCHK
		WORD	HIMITNML
		WORD	HIMITCHK
		WORD	HIMITCHK
;
;
HIMITCHK	EQU	$
		LDX	<ENINDX
		JSL	>EXIST_CHECK2
		BEQ	HIMITNML0010		; 再セットＯＫ？ [yes->HIMITNML0010]
;
		JMP	>ENCLEAR
;
HIMITNML	EQU	$
		LDX	<ENINDX
HIMITNML0010	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;	move （見えない？雲）						-
;------------------------------------------------------------------------
HIMITMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		TXA
		STA	R1
		M_CHIP	MY_ENCROS2
;
HIMITMV0060	EQU	$
		LDX	<ENINDX
		LDY	R14
		BMI	HIMITMV00F0		; 敵と衝突有？ [no->HIMITMV00F0]
;
		LDA	!ENMYNO,Y
		CMP	#MBALL
		BEQ	HIMITMV0080		; 岩ごろごろ？ [yes->HIMITMV0080]
;
		CMP	#YGORO
		BEQ	HIMITMV0080		; 雪ごろごろ？ [yes->HIMITMV0080]
;
		LDX	#BANK MY_ENCROS2
		LDA	R15
		JSL	>CHIPON
;
		BRA	HIMITMV0060		; [->HIMITMV0060]
;
HIMITMV0080	EQU	$
		LDA	#00027H
		JSL	>SOUND_3_ON		; サウンド セット！！
;
		JSL	>FSMK0_SET_S
;
;[1995.06.16.FR]		LDA	#FSMK0
;[1995.06.16.FR]		JSL	>EXINSR			; 煙効果 !!
;[1995.06.16.FR];
;[1995.06.16.FR]		LDA	!ECENTX,X
;[1995.06.16.FR]		STA	!EXXPSL,Y
;[1995.06.16.FR]		LDA	!ECENTY,X
;[1995.06.16.FR]		STA	!EXYPSL,Y
;[1995.06.16.FR]		LDA	#06
;[1995.06.16.FR]		STA	!EXCHPT,Y
;[1995.06.16.FR]		STA	!EXWRK0,Y
;[1995.06.16.FR]		LDA	#04
;[1995.06.16.FR]		STA	!EXTIM0,Y
;
		LDY	!ENWRKA,X
		DEY
		LDA	HIMITUITEM,Y
		TXY
		JSL	>ESTATST
;
		LDA	#00
		STA	!ENWRKA,Y
		STA	!ENWRKC,Y
		LDA	#EINIT
		STA	!ENMODE,Y
;
		M8				; memory 8bit mode !!
;
		LDA	#01
		STA	!ENWRKX,Y
;
		M16				; memory 16bit mode !!
;
HIMITMV00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (すずめ)						-
;------------------------------------------------------------------------
suzume_search	EQU	00020H
suzume_time	EQU	02
;
SUZUMECOLOR	EQU	$
		WORD	0000<<1, 0001<<1, 0002<<1, 0004<<1
;
SUZUMIN		EQU	$
		LDA	<RANDM0
		AND	#00003H
		ASL	A
		TAY
		LDA	!ENCLOR,X
		ORA	SUZUMECOLOR,Y
		STA	!ENCLOR,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (すずめ)							-
;------------------------------------------------------------------------
SUZUMMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JMP	(SUZUMMVMODSEL,X)
;
SUZUMMVMODSEL	EQU	$
		WORD	SUZUMEEARTH
		WORD	SUZUMEFLY
;
;
SUZUMEXSPD	EQU	$
		WORD	-00080H, 00080H
;
SUZUMEXSPD2	EQU	$
		WORD	-00300H, -00200H, -00100H, -00040H
		WORD	 00040H,  00100H,  00200H,  00300H
;
SUZUMEEARTHPT	EQU	$
		HEX	01, 02, 03, 02, 01, 00
;
SUZUMEEARTHTM	EQU	$
		HEX	01, 02, 03, 02, 01, 03
;
SUZUMEEARTH	EQU	$
		LDX	<ENINDX
		TXA
		STA	R1
		M_CHIP	SHOTENSR
;
		LDX	<ENINDX
		LDY	R1
		BMI	SUZUMEEARTH0020		; [->SUZUMEEARTH0020]
;
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		CLC
		ADC	#suzume_search
		CMP	#suzume_search*2
		BCS	SUZUMEEARTH0020		; 侵入 ? [no->SUZUMEEARTH0020]
;
		LDA	!ECENTY,X
		SEC
		SBC	!ECENTY,Y
		CLC
		ADC	#suzume_search
		CMP	#suzume_search*2
		BCC	SUZUMEEARTH0030		; 侵入 ? [yes->SUZUMEEARTH0030]
;
SUZUMEEARTH0020 EQU	$
		LDA	!ECENTX,X
		SEC
		SBC	!PCENTX
		CLC
		ADC	#suzume_search
		CMP	#suzume_search*2
		BCS	SUZUMEEARTH0040		; プレイヤー侵入 ? [no->SUZUMEEARTH0040]
;
		LDA	!ECENTY,X
		SEC
		SBC	!PCENTY
		CLC
		ADC	#suzume_search
		CMP	#suzume_search*2
		BCS	SUZUMEEARTH0040		; プレイヤー侵入 ? [no->SUZUMEEARTH0040]
;
SUZUMEEARTH0030 EQU	$
		LDA	<RANDM0
		AND	#00007H
		ASL	A
		TAY
		LDA	SUZUMEXSPD2,Y
		STA	!ENXSPD,X
		TYA
		AND	#00008H
		LSR	A
		LSR	A
		STA	!ENMUKI,X
		LDA	#0FE00H
		STA	!ENGMAX,X
		LDA	#00010H
		STA	!ENGPOW,X
		STZ	!ENYSPD,X
		LDA	!ENMOD1,X
		AND	#1111111111100000B
		STA	!ENMOD1,X
		LDA	!ENMOD2,X
		AND	#1111111111111100B
		STA	!ENMOD2,X
		LDA	#suzume_time
		STA	!ENTIM0,X
		STZ	!ENCHPT,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		LDA	#00075H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		RTL
;
SUZUMEEARTH0040 EQU	$
		LDA	<ENWRK0,X
		BNE	SUZUMEEARTH0200		; きょろきょろモード ? [yes->SUZUMEEARTH0200]
;
		LDA	!ENTIM1,X
		BNE	SUZUMEEARTH00F0		; pattern change ? [no->SUZUMEEARTH00F0]
;
		DEC	<ENWRK2,X
		BPL	SUZUMEEARTH0080		; pattern max ? [no->SUZUMEEARTH0080]
;
		LDA	!ENTIM0,X
		BEQ	SUZUMEEARTH0100		; next mode ? [yes->SUZUMEEARTH0100]
;
		LDA	#(SUZUMEEARTHTM-SUZUMEEARTHPT-1)
		STA	<ENWRK2,X
SUZUMEEARTH0080 EQU	$
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK2,X
		LDA	SUZUMEEARTHPT,Y
		STA	!ENCHPT,X
		LDA	SUZUMEEARTHTM,Y
		STA	!ENTIM1,X
;
		M16				; memory 16bit mode !!
;
SUZUMEEARTH00F0 EQU	$
		RTL
;
SUZUMEEARTH0100 EQU	$
		LDA	<RANDM0
		AND	#0001FH
		CLC
		ADC	#00020H
		STA	!ENTIM0,X
		STZ	!ENXSPD,X
		INC	<ENWRK0,X
		RTL
;
SUZUMEEARTH0200 EQU	$
		LDA	!ENTIM0,X
		BEQ	SUZUMEEARTH0300		; チョンチョンモード ? [yes->SUZUMEEARTH0300]
;
		LDA	!ENTIM2,X
		BNE	SUZUMEEARTH02F0		; [->SUZUMEEARTH02F0]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		LDA	<RANDM0
		AND	#00007H
		CLC
		ADC	#00008H
		STA	!ENTIM2,X
SUZUMEEARTH02F0 EQU	$
		RTL
;
SUZUMEEARTH0300 EQU	$
		LDA	<RANDM0
		AND	#0003FH
		CLC
		ADC	#00040H
		STA	!ENTIM0,X
		LDY	!ENMUKI,X
		LDA	SUZUMEXSPD,Y
		STA	!ENXSPD,X
		STZ	<ENWRK0,X
		RTL
;
;
SUZUMEFLY	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	SUZUMEFLY00F0		; pattern change ? [no->SUZUMEFLY00F0]
;
;[1995.06.21.WE]		LDA	#0001BH
;[1995.06.21.WE]		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	!ENCHPT,X
		EOR	#00001H
		STA	!ENCHPT,X
		LDA	#suzume_time
		STA	!ENTIM0,X
SUZUMEFLY00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;	initial （１ｕｐ卵）						-
;------------------------------------------------------------------------
EG1UPIN		EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;	move （１ｕｐ卵）						-
;------------------------------------------------------------------------
EG1UPMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDY	<ENCONT,X
		TYX
		JMP	(EG1UPMVMOD,X)
;
EG1UPMVMOD	EQU	$
		WORD	EG1UPMV0000
Egg1up01	WORD	EG1UPMV1000
;
Egg1up01MD	EQU	(Egg1up01-EG1UPMVMOD)
;
;
EG1UPMV0000	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		AND	#0000000000000001B
		BEQ	EG1UPMV00F0		; 着地？ [no->EG1UPMV00F0]
;
		STZ	!ENXSPD,X
		LDA	#00010H
		STA	!ENTIM0,X
		LDY	#Egg1up01MD
		STY	<ENCONT,X
EG1UPMV00F0	EQU	$
		RTL
;
;
EG1UPMV1000	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	EG1UPMV10F0		[->EG1UPMV10F0]
;
		LDA	!ENXPSL,X
		STA	!WORK0
		LDA	!ENYPSL,X
		STA	!WORK2
		LDA	!ENCLOR,X
		AND	#0003EH
		STA	!WORK4
		JSL	>EGG_WARE_SET
;
		LDX	<ENINDX
		JSL	>PL_1UP_SET_P
;
		JSL	>ENCLEAR_NORETN
;
EG1UPMV10F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;	initial (サボテン)						-
;------------------------------------------------------------------------
SABO0IN		EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;	move (サボテン)							-
;------------------------------------------------------------------------
SABO0_YSPD	EQU	$
		WORD	-00400H, -00200H
;
SABO0MV		EQU	$
		LDA	!ENSHOT,X
		BEQ	SABO0MV0040		; ショット？ [no->SABO0MV0040]
;
		LDA	!ENMOD0,X
		ORA	#0000011000000000B
		STA	!ENMOD0,X		; 食べられない＆当たらないセット !!
		LDA	!ENMOD1,X
		AND	#1111111111100000B
		STA	!ENMOD1,X		; ＢＧチェックＯＦＦ！！
SABO0MV0040	EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	!ENMOD1,X
		BIT	#0000000000011111B
		BEQ	SABO0MV0100		; [->SABO0MV0100]
;
		JSL	>EPCRCK
;
		LDA	!ENCBFG,X
		AND	#0000000000000001B
		BEQ	SABO0MV0100		; 着地 ? [no->SABO0MV0100]
;
		LDA	<ENWRK0,X
		CMP	#0002
		BCS	SABO0MV0100		; [->SABO0MV0100]
;
		ASL	A
		TAY
		LDA	SABO0_YSPD,Y
		STA	!ENYSPD,X
		LDA	<ENWRK0,X
		BEQ	SABO0MV0080		; [->SABO0MV0080]
;
		LDA	!ENMOD0,X
		AND	#1111100110011111B
		STA	!ENMOD0,X		; 食べられない＆当たらないセット !!
		LDA	!ENMOD1,X
		AND	#1111111111100000B
		STA	!ENMOD1,X		; ＢＧチェックＯＦＦ !!
SABO0MV0080	EQU	$
;
		LDA	#00013H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		INC	<ENWRK0,X
SABO0MV0100	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (子蛙)							-
;------------------------------------------------------------------------
KOKERCOLOR	EQU	$
		WORD	0000H<<1, 0001H<<1, 0002H<<1, 0004H<<1
;
KOKERIN		EQU	$
		LDA	<RANDM0
		AND	#0006H
		TAY
		LDA	!ENCLOR,X
		ORA	KOKERCOLOR,Y
		STA	!ENCLOR,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (子蛙)							-
;------------------------------------------------------------------------
kokaerusearch	EQU	00030H
kaeruspeed	EQU	-0100H
;
KOKERMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDY	<ENCONT,X
		TYX
		JMP	(KOKERMVMODSEL,X)
		RTL
;
KOKERMVMODSEL	EQU	$
		WORD	KOKERGRND
		WORD	KOKERJUMP
		WORD	KOKERGRN2
		WORD	KOKERJUM2
;
;
KOKERGRND	EQU	$
		LDX	<ENINDX
		LDA	!EPWIDX,X
		ABS16
		CMP	#kokaerusearch
		BPL	KOKERGRND0040		; [->KOKERGRND0040]
;
		LDA	!EPWIDY,X
		ABS16
		CMP	#kokaerusearch
		BPL	KOKERGRND0040		; [->KOKERGRND0040]
;
		LDA	!ENMOD1,X
		AND	#1111111100111111B
		ORA	#0000010010000000B
		STA	!ENMOD1,X
		STZ	!ENTIM0,X
		LDA	<ENCONT,X
		CLC
		ADC	#0004
		STA	<ENCONT,X
		RTL
;
KOKERGRND0040	EQU	$
		LDA	!ENTIM0,X
		BNE	KOKERGRND00F0		; ジャンプ？ [no->KOKERGRND00F0]
;
		INC	<ENCONT,X
		INC	<ENCONT,X
		LDA	<RANDM0
		AND	#0002
		EOR	!ENMUKI,X
		STA	!ENMUKI,X
		PHP
		LDA	#kaeruspeed
		STA	!ENYSPD,X
		PLP
		BEQ	KOKERGRND0080		; [->KOKERGRND0080]
;
		EOR	#0FFFFH
		INC	A
KOKERGRND0080	EQU	$
		STA	!ENXSPD,X
KOKERGRND00F0	EQU	$
		RTL
;
;
KOKERJUMP	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	KOKERJUMP0040		; 着地？ [no->KOKERJUMP0040]
;
		STZ	!ENXSPD,X
		STZ	!ENCHPT,X
		LDA	<RANDM0
		AND	#0001FH
		CLC
		ADC	#00020H
		STA	!ENTIM0,X
		STZ	<ENCONT,X
		RTL
;
;
KOKERJUMP0040	EQU	$
		LDA	#0001
		LDY	!ENYSPD+1,X
		BMI	KOKERJUMP0080		; 上昇中？ [no->KOKERJUMP0080]
;
		LDA	#0002
KOKERJUMP0080	EQU	$
		STA	!ENCHPT,X
		RTL
;
;
KOKERGRN2	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	KOKERGRN200F0		; ジャンプ？ [no->KOKERGRN200F0]
;
		INC	<ENCONT,X
		INC	<ENCONT,X
		LDA	!EPXMUK,X
		AND	#000FFH
		EOR	#0002
		STA	!ENMUKI,X
		PHP
		LDA	#kaeruspeed
		STA	!ENYSPD,X
		PLP
		BEQ	KOKERGRN20080		; [->KOKERGRN20080]
;
		EOR	#0FFFFH
		INC	A
KOKERGRN20080	EQU	$
		STA	!ENXSPD,X
KOKERGRN200F0	EQU	$
		RTL
;
;
KOKERJUM2	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	KOKERJUM20040		; 着地？ [no->KOKERJUM20040]
;
		STZ	!ENXSPD,X
		STZ	!ENCHPT,X
		LDA	#00010H
		STA	!ENTIM0,X
		DEC	<ENCONT,X
		DEC	<ENCONT,X
		RTL
;
;
KOKERJUM20040	EQU	$
		LDA	#0001
		LDY	!ENYSPD+1,X
		BMI	KOKERJUM20080		; 上昇中？ [no->KOKERJUM20080]
;
		LDA	#0002
KOKERJUM20080	EQU	$
		STA	!ENCHPT,X
		RTL
;
;
;------------------------------------------------------------------------
;-	initial （隠しアイテム）					-
;-		００：赤コイン	 ０１：カギ				-
;-		１０：フラワー	 １１：ドア				-
;------------------------------------------------------------------------
HIMI2IN		EQU	$
		JSL	>EXIST_CHECK2
		BEQ	HIMI2IN0020		; 再セットＯＫ？ [yes->HIMI2IN0020]
;
		JMP	>ENCLEAR
;
HIMI2IN0020	EQU	$
;
		M8				; memory 8bit mode !!
;
		LDA	!ENXPSL,X
		AND	#010H
		LSR	A
		LSR	A
		LSR	A
		STA	<EWORK
		LDA	!ENYPSL,X
		AND	#010H
		LSR	A
		LSR	A
		ORA	<EWORK
		STA	!ENWRKA,X
;
		M16				; memory 16bit mode !!
;
		RTL
;
;
;------------------------------------------------------------------------
;-	move（隠しアイテム）						-
;------------------------------------------------------------------------
HIMI2MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		M_CHIP	ENEMYSEARCH
		LDX	<ENINDX
;
		LDA	R11
		BMI	HIMI2MV0100		; 敵がいなくなった？
;						; [yes->HIMI2MV0100]
		RTL
;
HIMI2MV0100	EQU	$
		LDA	#00095H
		JSL	>SOUND_3_ON		; サウンド セット！！
;
		JSL	>FSMK0_SET_S
;
		LDY	!ENWRKA,X
		LDA	HIMI2ITEM,Y
		TXY
		JSL	>ESTATST
;
		LDA	#EINIT
		STA	!ENMODE,X
;
		LDY	!ENWRKA,X
		TYX
		JMP	(HIMI2SETMOD,X)
;
HIMI2ITEM	EQU	$
		WORD	COIN1
		WORD	DRKEY
		WORD	ZFLWR
		WORD	ZDOOR
;
HIMI2SETMOD	EQU	$
		WORD	COIN1SET
		WORD	DRKEYSET
		WORD	ZFLWRSET
		WORD	ZDOORSET
;
;
COIN1SET	EQU	$
		LDX	<ENINDX
		LDA	#00
		STA	!ENWRKA,X
		LDA	!ENCLOR,X
		AND	#0FFF1H
		ORA	#00001H<<1
		STA	!ENCLOR,X
		LDA	!ENYPSL,X
		ASL	A
		ASL	A
		ASL	A
		ASL	A
		AND	#0FF00H
		ORA	#08000H
		STA	<EWORK
		LDA	!ENXPSL,X
		LSR	A
		LSR	A
		LSR	A
		LSR	A
		AND	#000FFH
		ORA	<EWORK
		STA	!ENWRKC,X
		RTL
;
;
ZDOORSET	EQU	$
ZFLWRSET	EQU	$
DRKEYSET	EQU	$
		LDX	<ENINDX
		LDA	#00
		STA	!ENWRKA,X
		STA	!ENWRKC,X
		RTL
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;
		END
;
;
