;************************************************************************
;*									*
;*	title name	: "yossy"					*
;*	proccess	: enemy sub.1					*
;*	file name	: ys_enmy7					*
;*									*
;************************************************************************
;
;
		SALL
;
		include		ys_header.inc
		include		ys_unit.h
		include		ys_pld.h
		include		ys_ename.h
		include		../union/ys_bgcheck.h
;
		XALL
;
;
;------------------------------------------------------------------------
;-		global symbol						-
;------------------------------------------------------------------------
		GLB	OTAMAIN, OTAMHIN, BBFLWIN, EGFLWIN
		GLB	TAKEHIN
		GLB	BATSNIN
		GLB	YARIHIN, YARH2IN
		GLB	MCHO2IN, BULETIN, POCHIIN
		GLB	MITSNIN, JUGEMIN, WATABIN, FHOTMIN, FVOTMIN
		GLB	DEBU0IN
		GLB	KOMO0IN, KOMO1IN, PKPK0IN, PKPK1IN
		GLB	KEME0IN, KEME1IN
		GLB	REFC0IN, REFC1IN, REFC2IN, REFC3IN, REFC4IN
		GLB	REFC5IN, REFC6IN, REFC7IN, REFC8IN
		GLB	MOTH0IN, TEPPOIN
		GLB	AJGM0IN
		GLB	TONG0IN, TONG1IN, BAMBOIN, KARATIN, ENRGBIN
		GLB	KORA0IN, KORA1IN, HNOK0IN, HNOK1IN, NKNK0IN, NKNK1IN
		GLB	PTPT0IN, PTPT1IN, PTPT2IN, TAIH0IN
		GLB	JGEMWIN, THJGMIN, P_KUNIN, P_KN2IN
		GLB	FUSN0IN, FUSN1IN, FUSN2IN, FUSN3IN, FUSN4IN
		GLB	FUSN5IN, FUSN6IN, FUSN7IN, FUSN8IN, FUSN9IN
		GLB	FUSNaIN, FUSNbIN, BALONIN, SABO0IN
		GLB	PANSYIN, DGFLYIN, BTFLYIN
;
		GLB	OTAMAMV, OTAMHMV, BBFLWMV, EGFLWMV
		GLB	TAKEHMV
		GLB	BATSNMV
		GLB	YARIHMV, YARH2MV
		GLB	MCHO2MV, BULETMV, POCHIMV
		GLB	MITSNMV, JUGEMMV, WATABMV, FHOTMMV, FVOTMMV
		GLB	DEBU0MV
		GLB	KOMO0MV, KOMO1MV, PKPK0MV, PKPK1MV
		GLB	KEME0MV, KEME1MV
		GLB	REFC0MV, REFC1MV, REFC2MV, REFC3MV, REFC4MV
		GLB	REFC5MV, REFC6MV, REFC7MV, REFC8MV
		GLB	MOTH0MV, TEPPOMV
		GLB	AJGM0MV
		GLB	TONG0MV, TONG1MV, BAMBOMV, KARATMV, ENRGBMV
		GLB	KORA0MV, KORA1MV, HNOK0MV, HNOK1MV, NKNK0MV, NKNK1MV
		GLB	PTPT0MV, PTPT1MV, PTPT2MV, TAIH0MV
		GLB	JGEMWMV, THJGMMV, P_KUNMV, P_KN2MV
		GLB	FUSN0MV, FUSN1MV, FUSN2MV, FUSN3MV, FUSN4MV
		GLB	FUSN5MV, FUSN6MV, FUSN7MV, FUSN8MV, FUSN9MV
		GLB	FUSNaMV, FUSNbMV, BALONMV, SABO0MV
		GLB	PANSYMV, DGFLYMV, BTFLYMV
;
		GLB	OTAMAFL, OTAMHFL
		GLB	TAKEHFL
		GLB	MITSNFL, JUGEMFL
		GLB	KEME0FL, KEME1FL
		GLB	AJGM0FL, KARATFL
		GLB	KORA0FL, KORA1FL, HNOK0FL, HNOK1FL, NKNK0FL, NKNK1FL
		GLB	PTPT0FL, PTPT1FL, PTPT2FL
		GLB	JGEMWFL, THJGMFL
		GLB	PANSYFL
;
		GLB	AJGM0_INIT
;
		GLB	EPFOOTCROSS, EPFOOTCROSS_01
;
		GLB	PLCRSCK
;
		GLB	sec01,sec02,sec03,sec04,sec05,sec06,sec07,sec08,sec09,sec10
;
;------------------------------------------------------------------------
;-		extern symbol						-
;------------------------------------------------------------------------
;
;-------------< ys_main >------------------------------------------------
		EXT	RANDAM
		EXT	D_00,GMIN
		EXT	SOUND_3_ON
;
;-------------< ys_rpro >------------------------------------------------
		EXT	JSRSUB
		EXT	CHIPON, CHIPON_RAM_READ
;
;-------------< ys_play >------------------------------------------------
		EXT	TIMEUP_SET
		EXT	EBSTAT
		EXT	PFAL,PSTP,PMOV,PCLR,PGUS
		EXT	PFLP,PSHT
		EXT	EGG_WARE_SET
;
;-------------< 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
;
		EXT	ENCLEAR_NORETN,ENCLEAR_NORETN2
;
		EXT	PLAYER_REBOUND
;
		EXT	EINIT,EFAIL,EMOVE,EEATM,ENOSE,EBABL,EDOWN,EFALL
;
		EXT	COS,SIN
;
		EXT	EATMXS,NOSWT
;
		EXT	EN_XYMOVE,ENDEATH_SET,ENDEATH_SET_2,EGGKILL_ALL
		EXT	PL_1UP_SET_P
;
		EXT	COLBL_SET2,EGG00_MVINT,FSMK0_SET2
;
		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
		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	SHOT_EN_KILL, FSMK0_SET, FSMK2_SET, FUNDA_ENFALL_L
		EXT	ENFALL_END
;
		EXT	EXIST_CHECK2
;
		EXT	EGGTM
;
;-------------< ys_enmy2 >-----------------------------------------------
		EXT	COLD_KIRAKIRA, KINOMI_CANCEL
;
;-------------< ys_enmy3 >-----------------------------------------------
		EXT	ICE_IN_CK
;
;-------------< ys_enmy4 >-----------------------------------------------
		EXT	JBLKLIN
;
;-------------< ys_enmy6 >-----------------------------------------------
		EXT	LOCKON_TARGET, LOCKON_TARGET2
;
;-------------< ys_enmy8 >-----------------------------------------------
		EXT	PKPK2_FALL, TRBOXIN, COIN1IN
;
;-------------< ys_enmy9 >-----------------------------------------------
		EXT	DEATHENEMY
;
;-------------< ys_exst >------------------------------------------------
		EXT	EXINSR
;
;
;-------------< ys_unit >------------------------------------------------
		EXT	UNDTADD,UNDATA,RUTDATA
;
;------------------------------------------------------------------------
;-		define symbol						-
;------------------------------------------------------------------------
sec01		EQU	(64*1)
sec02		EQU	(64*2)
sec03		EQU	(64*3)
sec04		EQU	(64*4)
sec05		EQU	(64*5)
sec06		EQU	(64*6)
sec07		EQU	(64*7)
sec08		EQU	(64*8)
sec09		EQU	(64*9)
sec10		EQU	(64*10)
;
;
;
;************************************************************************
;*									*
;*		program start						*
;*									*
;************************************************************************
;
		EXTEND
;
		MEM16
		IDX8
;
		DPAGE	EN0RAM
;
Group_7		GROUP	Enemy7_pro
Enemy7_pro	SECT	REL
;
;
;------------------------------------------------------------------------
;-	initial (OTAMA)							-
;------------------------------------------------------------------------
otama_max	EQU	0020H
otamatop_ptn	EQU	007H
otamaunder_ptn	EQU	007H
otamacount	EQU	004H
otamacount2	EQU	005H
ot_tarnp	EQU	020H
otama00		EQU	000H
otama01		EQU	001H
otama02		EQU	002H
otama03		EQU	003H
otama04		EQU	004H
otama05		EQU	005H
otama06		EQU	006H
otama07		EQU	007H
otama08		EQU	008H
otama09		EQU	009H
otama0A		EQU	00AH
otama0B		EQU	00BH
otama0C		EQU	00CH
otama0D		EQU	00DH
otama0E		EQU	00EH
otama0F		EQU	00FH
otama10		EQU	010H
otama11		EQU	011H
otama12		EQU	012H
otama13		EQU	013H
otama14		EQU	014H
otama15		EQU	015H
;
OTAMAHITCENTY	EQU	$
		HEX	08, 08, 08, 08, 08, 0C, 10, 10
		HEX	10, 10, 10, 10, 0C, 08, 10, 10
		HEX	10, 10, 10, 10, 10, 10
;
OTAMAMUKI	EQU	$
		HEX	00, 03
;
OTAMAIN		EQU	$
		LDA	!ENYPSL,X
		STA	<ENWRK0,X		; otama start position
;
		LDA	!ENXPSL,X
		AND	#00010H
		BEQ	OTAMAIN0080		;
;
		LDA	OTGMAX
		STA	!ENGMAX,X
		LDA	#-(00180H+10H)
		STA	!ENYSPD,X
		LDA	#otama06
		STA	!ENCHPT,X
		TAY
		LDA	OTAMAHITCENTY,Y
		AND	#000FFH
		STA	!ECNTYW,X
		BRA	OTAMAIN0090
;
OTAMAIN0080	EQU	$
		LDA	OTGMAX+2
		STA	!ENGMAX,X
		LDA	#00180H
		STA	!ENYSPD,X
		LDA	#otama0D
		STA	!ENCHPT,X
		TAY
		LDA	OTAMAHITCENTY,Y
		AND	#000FFH
		STA	!ECNTYW,X
OTAMAIN0090	EQU	$
		STZ	!ENTIM0,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (OTAMA)							-
;------------------------------------------------------------------------
OTOPPT		EQU	$
		BYTE	otama05, otama04, otama03, otama02, otama01
;
OUNDERPT	EQU	$
		BYTE	otama0C, otama0B, otama0A, otama09, otama08
;
OTGMAX		EQU	$
OTXMAX		EQU	$
		WORD	00800H, 0F800H
;
OTAMAMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		JSL	>SHOTENMYHIT		; shot enemy hit check !!
;
		LDA	<ENCONT,X
		BNE	OTMV0100		; tarn mode ? [yes->OTMV0100]
;
		LDA	#00010H
		STA	!ENGPOW,X
		LDY	#0
		LDA	!ENYPSL,X
		CMP	<ENWRK0,X
		BCC	OTMV0040		; top side ? [yes->OTMV0040]
;
		LDY	#2
OTMV0040	EQU	$
		LDA	OTGMAX,Y
		STA	!ENGMAX,X
		LDA	!ENYSPD,X
		BNE	OTMV0060		;
;
		LDA	#5
		STA	<ENCONT,X
		LDA	#otamacount
		STA	!ENTIM0,X
		STZ	!ENGPOW,X
		BRA	OTMV0200
;
OTMV0060	EQU	$
		BPL	OTMV0070		; down ? [yes->OTMV0070]
;
		LDA	#otama0D
		STA	!ENCHPT,X
		TAY
		LDA	OTAMAHITCENTY,Y
		AND	#000FFH
		STA	!ECNTYW,X
		BRA	OTMV0200
;
OTMV0070	EQU	$
		LDA	#otama06
		STA	!ENCHPT,X
		TAY
		LDA	OTAMAHITCENTY,Y
		AND	#000FFH
		STA	!ECNTYW,X
		BRA	OTMV0200
;
OTMV0100	EQU	$
		LDA	#OTOPPT
		LDY	!ENGMAX+1,X
		BPL	OTMV0140		; top side ? [no->OTMV0140]
;
		LDA	#OUNDERPT
OTMV0140	EQU	$
		STA	<EWORK
		LDA	<ENCONT,X
		LSR	A
		BNE	OTMV0150		; last pattern ? [no->OTMV0150]
;
		LDA	!ENTIM0,X
		LSR	A
		BNE	OTMV0150		;
;
		LDA	#00010H
		STA	!ENGPOW,X
OTMV0150	EQU	$
		LDY	<ENCONT,X
		DEY
		LDA	(<EWORK),Y
		AND	#000FFH
		STA	!ENCHPT,X
		TAY
		LDA	OTAMAHITCENTY,Y
		AND	#000FFH
		STA	!ECNTYW,X
;
		LDA	!ENTIM0,X
		BNE	OTMV0200		; next pattern ? [no->OTMV0200]
;
		LDA	#otamacount
		STA	!ENTIM0,X
		DEC	<ENCONT,X
OTMV0200	EQU	$
		JSL	>EPCRCK
;
		RTL
;
;
;------------------------------------------------------------------------
;-	fail (OTAMA)							-
;------------------------------------------------------------------------
OFINALPT	EQU	$
		BYTE	otama0E, otama0F, otama10, otama11, otama12, otama13, otama14, otama15
;
OTAMAFL		EQU	$
		LDA	#00180H
		STA	!ENGMAX,X
		LDA	#00010H
		STA	!ENGPOW,X
		STZ	!ENXSPD,X
		LDA	!ENTIM1,X
		BNE	OTAMAFL0100		; pattern change ? [no->OTAMAFL0100]
;
		LDA	#04
		STA	!ENTIM1,X
		LDY	<ENWRK2,X
		LDA	OFINALPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		TYA
		INC	A
		AND	#00007H
		STA	<ENWRK2,X
OTAMAFL0100	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;-	initial (H-OTAMA)						-
;------------------------------------------------------------------------
HOTAMAHITCENTX	EQU	$
		HEX	04, 04, 04, 04, 08, 0C, 08, 08
		HEX	08, 08, 0C, 0C, 0C, 0C, 08, 04
;
OTAMHIN		EQU	$
		LDA	!ENXPSL,X
		STA	<ENWRK0,X		; h-otama start position
;
		LDA	!ENXPSL,X
		AND	#00010H
		BEQ	OTAMHIN0080		;
;
		LDA	OTXMAX
		STA	!ENXMAX,X
		LDA	#-(00180H+10H)
		STA	!ENXSPD,X
		LDA	#otama0F
		STA	!ENCHPT,X
		TAY
		LDA	HOTAMAHITCENTX,Y
		AND	#000FFH
		STA	!ECNTXW,X
		BRA	OTAMHIN0090
;
OTAMHIN0080	EQU	$
		LDA	OTXMAX+2
		STA	!ENGMAX,X
		LDA	#00180H
		STA	!ENXSPD,X
		LDA	#otama05
		STA	!ENCHPT,X
		TAY
		LDA	HOTAMAHITCENTX,Y
		AND	#000FFH
		STA	!ECNTXW,X
OTAMHIN0090	EQU	$
		STZ	!ENTIM0,X
		LDA	#00010H
		STA	!ENXPOW,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (H-OTAMA)							-
;------------------------------------------------------------------------
OHRIGHTPT	EQU	$
		BYTE	otama04, otama03, otama02, otama01
;
OHLEFTPT	EQU	$
		BYTE	otama0E, otama0D, otama0C, otama0B
;
OTAMHMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		JSL	>SHOTENMYHIT		; shot enemy hit check !!
;
		STZ	!ENMUKI,X
;
		LDA	<ENCONT,X
		BNE	OHMV0100		; tarn mode ? [yes->OHMV0100]
;
		LDA	#00010H
		STA	!ENXPOW,X
		LDY	#0
		LDA	!ENXPSL,X
		CMP	<ENWRK0,X
		BCC	OHMV0040		; top side ? [yes->OHMV0040]
;
		LDY	#2
OHMV0040	EQU	$
		LDA	OTXMAX,Y
		STA	!ENXMAX,X
		LDA	!ENXSPD,X
		BNE	OHMV0060		;
;
		LDA	#4
		STA	<ENCONT,X
		LDA	#otamacount2
		STA	!ENTIM0,X
		STZ	!ENXPOW,X
		BRA	OHMV0200
;
OHMV0060	EQU	$
		BPL	OHMV0070		; right ? [yes->OHMV0070]
;
		LDA	#otama0F
		STA	!ENCHPT,X
		TAY
		LDA	HOTAMAHITCENTX,Y
		AND	#000FFH
		STA	!ECNTXW,X
		BRA	OHMV0200
;
OHMV0070	EQU	$
		LDA	#otama05
		STA	!ENCHPT,X
		TAY
		LDA	HOTAMAHITCENTX,Y
		AND	#000FFH
		STA	!ECNTXW,X
		BRA	OHMV0200
;
OHMV0100	EQU	$
		LDA	#OHRIGHTPT
		LDY	!ENXMAX+1,X
		BPL	OHMV0140		; top side ? [no->OHMV0140]
;
		LDA	#OHLEFTPT
OHMV0140	EQU	$
		STA	<EWORK
		LDA	<ENCONT,X
		LSR	A
		BNE	OHMV0150		; last pattern ? [no->OHMV0150]
;
		LDA	!ENTIM0,X
		LSR	A
		BNE	OHMV0150		;
;
		LDA	#00010H
		STA	!ENXPOW,X
OHMV0150	EQU	$
		LDY	<ENCONT,X
		DEY
		LDA	(<EWORK),Y
		AND	#000FFH
		STA	!ENCHPT,X
		TAY
		LDA	HOTAMAHITCENTX,Y
		AND	#000FFH
		STA	!ECNTXW,X
;
		LDA	!ENTIM0,X
		BNE	OHMV0200		; next pattern ? [no->OHMV0200]
;
		LDA	#otamacount2
		STA	!ENTIM0,X
		DEC	<ENCONT,X
OHMV0200	EQU	$
		JSL	>EPCRCK
;
		RTL
;
;
;------------------------------------------------------------------------
;-	fail (H-OTAMA)							-
;------------------------------------------------------------------------
OHFINALPT	EQU	$
		BYTE	otama06, otama07, otama08, otama09
;
OTAMHFL		EQU	$
		LDA	#00180H
		STA	!ENGMAX,X
		LDA	#00010H
		STA	!ENGPOW,X
		STZ	!ENXSPD,X
		LDA	!ENTIM1,X
		BNE	OTAMHFL0100		; pattern change ? [no->OTAMHFL0100]
;
		LDA	#05
		STA	!ENTIM1,X
		LDY	<ENWRK2,X
		LDA	OHFINALPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		TYA
		INC	A
		AND	#00003H
		STA	<ENWRK2,X
OTAMHFL0100	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;-	initial (BBFLW)							-
;------------------------------------------------------------------------
nomalflowertime EQU	(18*5)
;
bableflower00	EQU	000H
bableflower01	EQU	001H
bableflower02	EQU	002H
bableflower03	EQU	003H
bableflower04	EQU	004H
bableflower05	EQU	005H
bableflower06	EQU	006H
bableflower07	EQU	007H
bableflower08	EQU	008H
bableflower09	EQU	009H
bableflower0A	EQU	00AH
;
BBFLWIN		EQU	$
		LDA	#06
		STA	!ENTIM1,X
		LDA	#nomalflowertime
		STA	!ENTIM0,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (BBFLW)							-
;------------------------------------------------------------------------
NLPTN		EQU	$
		BYTE	bableflower00, bableflower06, bableflower07
;
BBTIM		EQU	$
		HEX	04, 04, 04, 14, 02, 20, 02, 04
;
BBPTN		EQU	$
		BYTE	bableflower00, bableflower02, bableflower01, bableflower02
		BYTE	bableflower05, bableflower03, bableflower05, bableflower04
;
BBFLWMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		JSR	EFLFCK
;
		LDA	<ENCONT,X
		BNE	BFMV0100		; bable ? [yes->BFMV0100]
;
		LDA	!ENTIM0,X
		BEQ	BFMV0100		; bable ? [yes->BFMV0100]
;
		LDA	!ENTIM1,X
		BEQ	BFMV0020		; pattern change ? [yes->BFMV0020]
;
		RTL
;
;
BFMV0020	EQU	$
		LDA	#06
		STA	!ENTIM1,X
		LDA	<ENWRK0,X
		INC	A
		CMP	#3
		BCC	BFMV0040		;
;
		LDA	#00
BFMV0040	EQU	$
		STA	<ENWRK0,X
		TAY
		LDA	NLPTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		BRA	BFMV0F00
;
BFMV0100	EQU	$
		LDA	!ENTIM2,X
		BNE	BFMV0180		; pattern change ? [no->BFMV0180]
;
		LDA	<ENCONT,X
		TAY
		INC	<ENCONT,X
		LDA	BBTIM,Y
		AND	#000FFH
		STA	!ENTIM2,X
		LDA	BBPTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		CPY	#4
		BNE	BFMV0F00		; bable start ? [no->BFMV0F00]
;
		LDA	#SOPB0
		JSL	>ENINSR
;
		BCC	BFMV0F00		;
;
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00018H
		STA	!ENYPSL,Y
		LDA	#0FF00H
		STA	!ENYSPD,Y
		LDA	#04
		STA	!ENCHPT,Y
		LDA	#10
		STA	!ENTIM1,Y
		BRA	BFMV0F00
;
BFMV0180	EQU	$
		LSR	A
		BNE	BFMV0F00		; mode check ? [no->BFMV0F00]
;
		LDA	<ENCONT,X
		CMP	#08
		BNE	BFMV0F00		; nomal ? [no->BFMV0F00]
;
		STZ	<ENCONT,X
		STZ	!ENCHPT,X
		LDA	#nomalflowertime
		STA	!ENTIM0,X
;
BFMV0F00	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	fail (BBFLW)							-
;------------------------------------------------------------------------
;
;
;------------------------------------------------------------------------
;-	initial (EGFLW)							-
;------------------------------------------------------------------------
eggflowerarea0	EQU	00010H
eggflowerarea	EQU	00030H
eggflowerareaY	EQU	00040H
efinterval	EQU	00000H		;0000CH
egg_maximum	EQU	06
egg_flower_Y	EQU	00014H
;
EGFLWIN		EQU	$
		JSL	>ICE_IN_CK
;
		M8				; memory 8bit mode !!
;
		LDY	#(EGFLWEG0TIM-EGFLWEG0PTN-1)
		STY	<ENWRK0,X
		LDA	EGFLWEG0PTN,Y
		STA	!ENCHPT,X
		LDA	EGFLWEG0TIM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		BRA	EGFLW_PLJUMPST
;
;
;------------------------------------------------------------------------
;-	move (EGFLW)							-
;------------------------------------------------------------------------
EGFLWMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		JSR	EFLFCK
;
		JSR	EGFLWDSFGST
;
		LDY	<ENCONT,X
		TYX
		JSR	(EFMVMOD,X)
;
EGFLW_PLJUMPST	EQU	$
		LDA	!PLJUMP
		STA	!ENWRKC,X
		RTL
;
;
EFMVMOD		EQU	$
		WORD	EGFLWEG0
		WORD	EGFLWEG1
		WORD	EGFLWWAT
;
;
EGFLWEG0PTN	EQU	$
		BYTE	bableflower02, bableflower01, bableflower02, bableflower00
;
EGFLWEG0TIM	EQU	$
		HEX	04, 02, 02, 04
;
EGGXSPD		EQU	$
		WORD	00000H, 00080H, -0080H, 00100H
		WORD	-0100H, 00040H, -0040H, 000C0H
;
EGGXSPD2	EQU	$
		WORD	00040H, -0040H, 00080H, -0080H
		WORD	00100H, -0100H
;
EGFLWEG0	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	EGFLWEG000F0		; パターンチェンジ？ [no->EGFLWEG000F0]
;
		LDY	<ENWRK0,X
		DEY
		BMI	EGFLWEG00100		; 卵セット？ [yes->EGFLWEG00100]
;
		STY	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		LDA	EGFLWEG0PTN,Y
		STA	!ENCHPT,X
		LDA	EGFLWEG0TIM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
EGFLWEG000F0	EQU	$
		RTS
;
EGFLWEG00100	EQU	$
;
		M8				; memory 8bit mode !!
;
		INC	<ENCONT,X
		INC	<ENCONT,X		; モードチェンジ！！
;
		LDY	#(EGFLWEG1TIM-EGFLWEG1PTN-1)
		STY	<ENWRK0,X
		LDA	EGFLWEG1PTN,Y
		STA	!ENCHPT,X
		LDA	EGFLWEG1TIM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		M_CHIP	EGGSEARCH
;
		LDX	<ENINDX
		LDA	R6
		CMP	#egg_maximum
		BCS	EGFLWEG00200		; 卵一杯？ [yes->EGFLWEG00200]
;
		CMP	#egg_maximum-1
		BEQ	EGFLWEG00180		; 卵一個セット？ [yes->EGFLWEG00180]
;
		LDY	<ENCONT+1,X
		BEQ	EGFLWEG00180		; 複数卵セット？ [no->EGFLWEG00180]
;
		JMP	EGFLWEG00300
;
EGFLWEG00180	EQU	$
		LDA	<RANDM0
		AND	#00007H
		ASL	A
		CMP	<ENWRK4,X
		BNE	EGFLWEG00190		; [->EGFLWEG00190]
;
		INC	A
		INC	A
		AND	#0000EH
EGFLWEG00190	EQU	$
		STA	<ENWRK4,X
		TAY
		LDA	EGGXSPD,Y
		STA	<EWORK
;
		LDA	#EGG03
		JSL	>ENINSR
		BCC	EGFLWEG00200		; 敵確保成功？ [no->EGFLWEG00200]
;
		LDA	#0002H
		STA	!ENYUSN,Y
		STA	!ENWRK6,Y
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00014H
		STA	!ENYPSL,Y
		LDA	<EWORK
		STA	!ENXSPD,Y
		LDA	#0FA00H
		STA	!ENYSPD,Y
		LDA	#00040H
		STA	!ENGPOW,Y
		LDA	!ENMOD1,Y
		AND	#1111111111100000B	; ＢＧチェック無し！！
		STA	!ENMOD1,Y
;
		LDA	#egg_flower_Y
		JSL	>SOUND_3_ON		; サウンド セット !!
;
EGFLWEG001F0	EQU	$
		RTS
;
EGFLWEG00200	EQU	$
		LDA	#DSMK0		;(A) <-- 効果Ｎｏ．
		JSL	>EXINSR		;効果エリア確保
;
		LDA	ENXPSL,X
		STA	EXXPSL,Y	;Ｘ座標セット
		LDA	ENYPSL,X
		SEC
		SBC	#00014H
		STA	EXYPSL,Y	;Ｙ座標セット
		LDA	#05H
		STA	EXWRK0,Y	;初期カウンターセット
		LDA	#05H
		STA	EXCHPT,Y	;初期パターンＮｏ．セット
		LDA	#04H
		STA	EXTIM0,Y	;初期タイマーセット
		LDA	#02H
		STA	EXYUSN,Y	;優先順位セット
		LDA	#0FF00H
		STA	!EXYSPD,Y
;
		LDA	#00037H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		RTS
;
EGFLWEG00300	EQU	$
		LDA	#egg_maximum
		SEC
		SBC	R6
		STA	<EWORK
		LDY	#00
		STY	<ENCONT+1,X
EGFLWEG00320	EQU	$
		LDA	<EWORK
		ASL	A
		TAY
		LDA	EGGXSPD2,Y
		STA	<EWORK2
;
		LDA	#EGG03
		JSL	>ENINSR
		BCC	EGFLWEG003E0		; 敵確保成功？ [no->EGFLWEG003E0]
;
		LDA	#0002H
		STA	!ENYUSN,Y
		STA	!ENWRK6,Y
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00014H
		STA	!ENYPSL,Y
		LDA	<EWORK2
		STA	!ENXSPD,Y
		LDA	#0FA00H
		STA	!ENYSPD,Y
		LDA	#00040H
		STA	!ENGPOW,Y
		LDA	!ENMOD1,Y
		AND	#1111111111100000B	; ＢＧチェック無し！！
		STA	!ENMOD1,Y
;
		DEC	<EWORK
		BNE	EGFLWEG00320		; [->EGFLWEG00320]
;
EGFLWEG003E0	EQU	$
		LDA	#egg_flower_Y
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		RTS
;
;
EGFLWEG1PTN	EQU	$
		BYTE	bableflower09, bableflower0A, bableflower09, bableflower08
;
EGFLWEG1TIM	EQU	$
		HEX	02, 08, 02, 04
;
EGFLWEG1	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	EGFLWEG100F0		; パターンチェンジ？ [no->EGFLWEG100F0]
;
		LDY	<ENWRK0,X
		DEY
		BMI	EGFLWEG10100		; [->EGFLWEG10100]
;
		STY	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		LDA	EGFLWEG1PTN,Y
		STA	!ENCHPT,X
		LDA	EGFLWEG1TIM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
EGFLWEG100F0	EQU	$
		RTS
;
EGFLWEG10100	EQU	$
;
		M8				; memory 8bit mode !!
;
		INC	<ENCONT,X
		INC	<ENCONT,X		; モードチェンジ！！
;
		LDY	#eggflwwaitpt
		STY	<ENWRK0,X
		LDA	EGFLWWATPT,Y
		STA	!ENCHPT,X
		LDA	#06
		STA	!ENTIM0,X
		LDA	#020H
		STA	!ENTIM1,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
EGFLWWATPT	EQU	$
		BYTE	bableflower07, bableflower06, bableflower00
EGFLWWATPTE	EQU	$
;
eggflwwaitpt	EQU	(EGFLWWATPTE-EGFLWWATPT-1)
;
EGFLWWAT	EQU	$
		LDX	<ENINDX
		LDY	<ENCONT+1,X
		BNE	EGFLWWAT0020		; [->EGFLWWAT0020]
;
		LDA	!ENTIM1,X
		BNE	EGFLWWAT0030		; [->EGFLWWAT0030]
;
EGFLWWAT0020	EQU	$
		LDA	!ENCHPT,X
		CMP	#bableflower00
		BEQ	EGFLWWAT0100		; [->EGFLWWAT0100]
;
EGFLWWAT0030	EQU	$
		LDA	!ENTIM0,X
		BNE	EGFLWWAT00F0		; パターンチェンジ？ [no->EGFLWWAT00F0]
;
		LDY	<ENWRK0,X
		DEY
		BPL	EGFLWWAT0040		; パターンリセット？ [no->EGFLWWAT0040]
;
		LDY	#eggflwwaitpt
EGFLWWAT0040	EQU	$
		STY	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		LDA	#06
		STA	!ENTIM0,X
		LDA	EGFLWWATPT,Y
		STA	!ENCHPT,X
;
		M16				; memory 16bit mode !!
;
EGFLWWAT00F0	EQU	$
		RTS
;
EGFLWWAT0100	EQU	$
;
		M8				; memory 8bit mode !!
;
		STZ	<ENCONT,X		; モードチェンジ！！
;
		LDY	#(EGFLWEG0TIM-EGFLWEG0PTN-1)
		STY	<ENWRK0,X
		LDA	EGFLWEG0PTN,Y
		STA	!ENCHPT,X
		LDA	EGFLWEG0TIM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
EGFLWDSFGST	EQU	$
		LDA	!PLDOSN
		BEQ	EGFLWDSFGST00F0		; フラグセット？ [no->EGFLWDSFGST00F0]
;
		LDA	!PLJUMP
		BNE	EGFLWDSFGST00F0		; フラグセット？ [no->EGFLWDSFGST00F0]
;
		LDA	!ENWRKC,X
		BEQ	EGFLWDSFGST00F0		; フラグセット？ [no->EGFLWDSFGST00F0]
;
		LDY	#01
		STY	<ENCONT+1,X
;
EGFLWDSFGST00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	リフトチェック							-
;------------------------------------------------------------------------
EFLFCK		EQU	$
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	!ECENTX,X
		STA	R5
		LDA	!ECENTY,X
		STA	R6
		LDA	!EWIDEX,X
		STA	R7
		LDA	!EWIDEY,X
		STA	R8
		M_CHIP	LIFTSEARCH
;
		LDX	<ENINDX
		LDY	R1
		BMI	EFLFCK00F0		; リフトと当たった ? [no->EFLFCK00F0]
;
		LDA	R0
		CMP	#00008H
		BPL	EFLFCK00F0		; リフトと当たった ? [no->EFLFCK00F0]
;
		STZ	!ENGPOW,X
		LDA	!ENYPSL,X
		SEC
		SBC	R0
		STA	!ENYPSL,X
		LDA	!ENXPSL,X
		CLC
		ADC	!ENMOVX,Y
		STA	!ENXPSL,X
EFLFCK00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	fail (EGFLW)							-
;------------------------------------------------------------------------
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;-	initial (TAKEH)						-
;------------------------------------------------------------------------
takeumatime	EQU	003H
takeumaheiho00	EQU	000H
takeumaheiho01	EQU	001H
takeumaheiho02	EQU	002H
takeumaheiho03	EQU	003H
takeumaheiho04	EQU	004H
takeumaheiho05	EQU	005H
takeumaheiho06	EQU	006H
takeumaheiho07	EQU	007H
takeumaheiho08	EQU	008H
takeumaheiho09	EQU	009H
takeumaheiho0A	EQU	00AH
takeumaheiho0B	EQU	00BH
takeumaheiho0C	EQU	00CH
takeumaheiho0D	EQU	00DH
takeumaheiho0E	EQU	00EH
takeumaheiho0F	EQU	00FH
takeumaheiho10	EQU	010H
takeumaheiho11	EQU	011H
takeumaheiho12	EQU	012H
takeumaheiho13	EQU	013H
takeumaheiho14	EQU	014H
takeumaheiho15	EQU	015H
takeumaheiho16	EQU	016H
takeumaheiho17	EQU	017H
takeumaheiho18	EQU	018H
;
takehoujump	EQU	0FE00H
takebikkuritm	EQU	60
;
TAKEHPTN	EQU	$
		BYTE	takeumaheiho00, takeumaheiho01, takeumaheiho02, takeumaheiho03
		BYTE	takeumaheiho04, takeumaheiho05, takeumaheiho06, takeumaheiho07
		BYTE	takeumaheiho08, takeumaheiho09, takeumaheiho0A, takeumaheiho0B
		BYTE	takeumaheiho0C, takeumaheiho0D, takeumaheiho0E, takeumaheiho0F
		BYTE	takeumaheiho10, takeumaheiho11, takeumaheiho12, takeumaheiho13
		BYTE	takeumaheiho14, takeumaheiho15, takeumaheiho16, takeumaheiho17
;
TAKEHXSP	EQU	$
		WORD	0FFA0H, 00060H
;
TKHBACKXSPD	EQU	$
		WORD	00060H, 0FFA0H
;
TAKHGCOL	EQU	$
		WORD	00000H<<1, 00001H<<1, 00002H<<1, 00004H<<1
;
TAKEHIN		EQU	$
		LDA	!ENWRKC,X
		BNE	TAKHGIN0040		; initial set ? [no->TAKHGIN0040]
;
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		STA	<EWORK
		LDA	!ENYPSL,X
		AND	#00010H
		ORA	<EWORK
		LSR	A
		LSR	A
		TAY
		LDA	TAKHGCOL,Y
		INC	A
		STA	!ENWRKC,X
		LDA	!ENCLOR,X
		ORA	TAKHGCOL,Y
		STA	!ENCLOR,X
		BRA	TAKHGIN0060
;
TAKHGIN0040	EQU	$
		LDA	!ENWRKC,X
		DEC	A
		ORA	!ENCLOR,X
		STA	!ENCLOR,X
TAKHGIN0060	EQU	$
		LDA	#takeumatime
		STA	!ENTIM0,X
		LDA	#takeumaheiho00
		STA	!ENCHPT,X
		LDY	!ENMUKI,X
		LDA	#0001
		STA	<ENWRK0,X
		LDA	!ENCBFG,X
		STA	<ENWRK4,X		; ＢＧチェックフラグセーブ !!
;;;;;;;;		LDA	!ENXPSL,X
;;;;;;;;		STA	>EBGOXP,X
;;;;;;;;		LDA	!ENYPSL,X
;;;;;;;;		STA	>EBGOYP,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (TAKEH)						-
;------------------------------------------------------------------------
TAKEHMV		EQU	$
		LDA	!ENMODE,X
		CMP	#EDOWN
		BNE	TAKEHMV0		; pow block on ? [no->TAKEHMV0]
;
		JMP	TAKEHFL
;
TAKEHMV0	EQU	$
		JSL	>ENMDCK			; mode check
;
;------<<< Ｎｅｗ 竹馬ヘイホー >>>-----
TAKEUMA_MOVE	EQU	$
		LDA	<ENCONT,X
		TAX
		JMP	(TAKEUMAMODSEL,X)
;
TAKEUMAMODSEL	EQU	$
		WORD	TAKEUMA_WALK
		WORD	TAKEUMA_OTTO
;
;
TAKEUMA_WALKXP	EQU	$
		WORD	 0, -1,	 0, -1,	 0, -1, -2, -1
		WORD	-2, -1, -2, -1,	 0, -1,	 0, -1
		WORD	 0,  0, -2, -2, -2, -1, -2, -1
;
TAKEUMA_WALK	EQU	$
		LDX	<ENINDX
		JSR	TAKE_BGCK		; ＢＧ衝突チェック !!
;
		LDA	!ENCBFG,X
		STA	<ENWRK4,X		; ＢＧチェックフラグセーブ !!
;
		JSR	TAKE_CRCK		; ＯＢＪ衝突チェック !!
;
		JSL	>EPCRCK
;
		LDA	!ENTIM0,X
		BNE	TAKE_WALK00F0		; pattern change ? [no->TAKE_WALK00F0]
;
		LDA	#takeumatime
		STA	!ENTIM0,X
		LDA	!ENCHPT,X
		STA	<EWORK
		CLC
		ADC	<ENWRK0,X
		CMP	#00017H+1
		BCC	TAKE_WALK0040		; [->TAKE_WALK0040]
;
		LDA	#0000
TAKE_WALK0040	EQU	$
		STA	!ENCHPT,X
		LDA	<ENWRK0,X
		BPL	TAKE_WALK0050		; [->TAKE_WALK0050]
;
		LDA	<EWORK
		ASL	A
		TAY
		LDA	TAKEUMA_WALKXP,Y
		LDY	!ENMUKI,X
		BNE	TAKE_WALK0070		; [->TAKE_WALK0070]
;
		EOR	#0FFFFH
		INC	A
		BRA	TAKE_WALK0070
;
TAKE_WALK0050	EQU	$
		CLC
		ADC	<EWORK
		CMP	#00017H+1
		BCC	TAKE_WALK0060		; [->TAKE_WALK0060]
;
		LDA	#0000
TAKE_WALK0060	EQU	$
		ASL	A
		TAY
		LDA	TAKEUMA_WALKXP,Y
		LDY	!ENMUKI,X
		BEQ	TAKE_WALK0070		; [->TAKE_WALK0070]
;
		EOR	#0FFFFH
		INC	A
TAKE_WALK0070	EQU	$
		CLC
		ADC	!ENXPSL,X
		STA	!ENXPSL,X
		LDA	<ENWRK0,X
		BPL	TAKE_WALK00F0		; [->TAKE_WALK00F0]
;
		LDA	!ENCHPT,X
		BEQ	TAKE_WALK0080		; [->TAKE_WALK0080]
;
		CMP	#0000CH
		BNE	TAKE_WALK00F0		; [->TAKE_WALK00F0]
;
TAKE_WALK0080	EQU	$
		LDA	#0001
		STA	<ENWRK0,X
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
TAKE_WALK00F0	EQU	$
		RTL
;
;
TAKEUMA_OTTO	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		STA	<ENWRK4,X		; ＢＧチェックフラグセーブ !!
;
		JSL	>EPCRCK
;
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	TAKE_OTTO00F0		; 着地 ? [no->TAKE_OTTO00F0]
;
		DEC	<ENWRK2,X
		BMI	TAKE_OTTO0100		; オットット終り ? [yes->TAKE_OTTO0100]
;
		LDA	#takehoujump
		STA	!ENYSPD,X
TAKE_OTTO00F0	EQU	$
		RTL
;
TAKE_OTTO0100	EQU	$
		STZ	!ENXSPD,X
		STZ	<ENCONT,X
		RTL
;
;
TAKE_BGCKSIDE	EQU	$
		WORD	0000000000001000B, 0000000000000100B
;
TAKE_BGCK	EQU	$
		LDA	!ENMUKI,X
		LDY	<ENWRK0,X
		BPL	TAKE_BGCK0020		; [->TAKE_BGCK0020]
;
		EOR	#00002H
TAKE_BGCK0020	EQU	$
		TAY
		LDA	!ENCBFG,X
		AND	TAKE_BGCKSIDE,Y
		BEQ	TAKE_BGCK0040		; 横当たり有 ? [no->TAKE_BGCK0040]
;
		LDA	<ENWRK0,X
		EOR	#0FFFFH
		INC	A
		STA	<ENWRK0,X
		RTS
;
TAKE_BGCK0040	EQU	$
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BNE	TAKE_BGCK00F0		; 足当たり有 ? [yes->TAKE_BGCK00F0]
;
;[1995.02.27.MO]		LDA	!ENMYNO,X
;[1995.02.27.MO]		CMP	#TAKEH
;[1995.02.27.MO]		BEQ	TAKE_BGCK00F0		; 赤竹馬ヘイホー ? [yes->TAKE_BGCK00F0]
;[1995.02.27.MO];
		LDA	<ENWRK4,X
		BIT	#0000000000000001B
		BEQ	TAKE_BGCK0100		; 前回足当たり有 ? [no->TAKE_BGCK0100]
;
		LDA	>EBGOXP,X
		STA	!ENXPSL,X
		LDA	>EBGOYP,X
		STA	!ENYPSL,X
		LDA	<ENWRK0,X
		EOR	#0FFFFH
		INC	A
		STA	<ENWRK0,X
TAKE_BGCK00F0	EQU	$
		RTS
;
TAKE_BGCK0100	EQU	$
		LDA	!ENCBFG,X
		STA	<ENWRK4,X		; ＢＧチェックフラグセーブ !!
		PLA
		RTL
;
;
TAKE_CRCK	EQU	$
		LDY	!ECRSFG,X
		BPL	TAKE_CRCK0100		; プレイヤー ? [no->TAKE_CRCK0100]
;
		JSL	>EPFOOTCROSS_01		; 踏まれたチェック !!
		BEQ	TAKE_CRCK00F0		; 当たってない ? [yes->TAKE_CRCK00F0]
		BCS	TAKE_CRCK00F0		; 踏まれた ? [yes->TAKE_CRCK00F0]
;
TAKE_CRCK0080	EQU	$
		LDA	!PLFLSH
		BNE	TAKE_CRCK00F0		; プレイヤーフラッシュ ? [yes->TAKE_CRCK00F0]
;
		JSL	>PLFLST
;
		LDY	!EPXMUK,X
		JMP	TAKEUMA_OTTOIN
;
TAKE_CRCK00F0	EQU	$
		RTS
;
TAKE_CRCK0100	EQU	$
		DEY
		BMI	TAKE_CRCK00F0		; 当たってない ? [yes->TAKE_CRCK00F0]
		BEQ	TAKE_CRCK00F0		; 赤ちゃんと衝突 ? [yes->TAKE_CRCK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	TAKE_CRCK00F0		; mode move ? [no->TAKE_CRCK00F0]
;
		LDA	!ENSHOT,Y
		BEQ	TAKE_CRCK00F0		; ショット ? [no->TAKE_CRCK00F0]
;
		LDA	!ECENTY,X
		SEC
		SBC	#00008H
		CMP	!ECENTY,Y
		BPL	TAKE_CRCK0180		; 下半身当たり ? [no->TAKE_CRCK0180]
;
		PHY
		TYX
		JSL	>SHOT_EN_KILL
;
		PLY
		LDX	<ENINDX
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAY
		JMP	TAKEUMA_OTTOIN
;
TAKE_CRCK0180	EQU	$
		LDA	!ENGPOW,Y
		CMP	#00040H
		BMI	TAKE_CRCK0190		; マックス卵 ? [yes->TAKE_CRCK0190]
;
		PLA
		JMP	TAKEHOKOROBU2
;
TAKE_CRCK0190	EQU	$
		LDA	!ENXSPD,Y
		ASR16	A
		ASR16	A
		STA	<EWORK
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
		LDA	#TAKEU
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		STA	!EXYPSL,Y
		LDA	!ENMUKI,X
		STA	!EXMUKI,Y
		LDA	<EWORK
		STA	!EXXSPD,Y
		LDA	#yspeedinit
		STA	!EXYSPD,Y
		LDA	#64*3
		STA	!EXTIM0,Y
		LDA	!ENWRKC,X
		DEC	A
		ORA	!EXCLOR,Y
		STA	!EXCLOR,Y
;
;[1995.02.27.MO]		LDA	!ENMYNO,X
;[1995.02.27.MO]		CMP	#TAKEH
;[1995.02.27.MO]		BEQ	TAKE_CRCK01E0		; 赤ヘイホー ? [yes->TAKE_CRCK01E0]
;[1995.02.27.MO];
;[1995.02.27.MO]		LDA	!EXCLOR,Y
;[1995.02.27.MO]		ORA	#0000000000000010B
;[1995.02.27.MO]		STA	!EXCLOR,Y
;[1995.02.27.MO]		LDA	#HEIH0
;[1995.02.27.MO]		BRA	TAKE_CRCK01F0
;[1995.02.27.MO];
;[1995.02.27.MO]TAKE_CRCK01E0	EQU	$
;[1995.02.27.MO]		LDA	#HEIH1
;[1995.02.27.MO]TAKE_CRCK01F0	EQU	$
;
		LDA	#HEIH0
		STA	!ENMYNO,X
		LDA	!ENMOD2,X
		AND	#0000011111111111B
		ORA	#0001100000000000B
		STA	!ENMOD2,X
;
		M8				; memory 8bit mode !!
;
		STZ	!ENCHRB,X
;
		M16				; memory 16bit mode !!
;
		STZ	!ENCHPT,X
		LDA	!ENYPSL,X
		SEC
		SBC	#00020H
		STA	!ENYPSL,X
		PLA
		JMP	>ENDEATH_SET		; 死亡セット !!
;
;
TAKEUMA_OTTOIN	EQU	$
		LDA	TKHBACKXSPD,Y
		STA	!ENXSPD,X
		LDA	#takeumaheiho15
		STA	!ENCHPT,X
		LDA	#0003
		STA	<ENWRK2,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		PLA
		RTL
;
;
;------------------------------------------------------------------------
;-	fail (TAKEH)						-
;------------------------------------------------------------------------
TKHFLXSPD	EQU	$
		WORD	00080H, 0FF80H
;
TAKEHOKOROBU2	EQU	$
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
TAKEHFL		EQU	$
		PHX
		LDA	#TAKEU
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		STA	!EXYPSL,Y
		LDA	!ENWRKC,X
		DEC	A
		ORA	!EXCLOR,Y
		STA	!EXCLOR,Y		; カラーセット！！
		LDA	!ENMUKI,X
		STA	!EXMUKI,Y
		TAX
		LDA	TATEXSPDIN,X
		STA	!EXXSPD,Y
		LDA	#yspeedinit
		STA	!EXYSPD,Y
		LDA	#64*3
		STA	!EXTIM0,Y
		PLX
;
		PHY
		JSL	>ENCLEAR_NORETN2
		PLY
;
;[1995.02.27.MO]		LDA	!ENMYNO,X
;[1995.02.27.MO]		CMP	#TAKEH
;[1995.02.27.MO]		BEQ	TKHKRB0070		; 赤ヘイホー ? [yes->TKHKRB0070]
;[1995.02.27.MO];
;[1995.02.27.MO]		LDA	!EXCLOR,Y
;[1995.02.27.MO]		ORA	#0000000000000010B
;[1995.02.27.MO]		STA	!EXCLOR,Y
;[1995.02.27.MO]		LDA	#HEIH1			; 緑ヘイホー
;[1995.02.27.MO]		BRA	TKHKRB0080
;[1995.02.27.MO];
;[1995.02.27.MO]TKHKRB0070	EQU	$
;[1995.02.27.MO]		LDA	#HEIH0			; 赤ヘイホー
;[1995.02.27.MO]TKHKRB0080	EQU	$
		LDA	#HEIH0
		TXY
		JSL	>ESTATST
;
		LDA	!ENYPSL,X
		SEC
		SBC	#00018H
		STA	!ENYPSL,X
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	TKHKRB00F0		; [->TKHKRB00F0]
;
		CMP	#EFAIL
		BNE	TKHKRB0100		; [->TKHKRB0100]
;
TKHKRB00F0	EQU	$
		LDA	#EINIT
		STA	!ENMODE,X
TKHKRB0100	EQU	$
		RTL
;
;
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;-	initial (BATSN)							-
;------------------------------------------------------------------------
batsan00	EQU	000H
batsan01	EQU	001H
batsan02	EQU	002H
batsan03	EQU	003H
batsan04	EQU	004H
batsan05	EQU	005H
batsan06	EQU	006H
batsan07	EQU	007H
batsan08	EQU	008H
batsan09	EQU	009H
batsan0A	EQU	00AH
batsan0B	EQU	00BH
batsan0C	EQU	00CH
batsan0D	EQU	00DH
batsan0E	EQU	00EH
batsan0F	EQU	00FH
batsan10	EQU	010H
batsan11	EQU	011H
batsan12	EQU	012H
batsan13	EQU	013H
batsan14	EQU	014H
batsan15	EQU	015H
batsan16	EQU	016H
batsan17	EQU	017H
batsan18	EQU	018H
batsan19	EQU	019H
batsan1A	EQU	01AH
batsan1B	EQU	01BH
;
batsanwalktm0	EQU	004H
swingarea	EQU	00030H
swingarea2	EQU	00018H
takebackarea	EQU	00020H
batsanatariyoko EQU	00008H
batsanataritate EQU	00010H
batwidth	EQU	02
;
bwalk		EQU	0
cancel		EQU	1
ftake		EQU	2
swing		EQU	3
blast		EQU	4
;
BATXSPINT	EQU	$
		WORD	0FF80H, 00080H
;
BATSANREVIVEPT	EQU	$
		BYTE	batsan16, batsan17, batsan18, batsan17
		BYTE	batsan19, batsan17, batsan18, batsan17
		BYTE	batsan19, batsan17, batsan18, batsan17
		BYTE	batsan19, batsan17, batsan17, batsan1A
		BYTE	batsan1B, batsan1A
;
BATSNIN		EQU	$
		LDA	BATSANWALK
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#batsanwalktm0
		STA	!ENTIM0,X
		LDY	!ENMUKI,X
		LDA	BATXSPINT,Y
		STA	!ENXSPD,X
		STZ	!ENWRKA,X		; 気絶フラグ クリア
		RTL
;
;
;------------------------------------------------------------------------
;-	move (BATSN)							-
;------------------------------------------------------------------------
BATSNMV		EQU	$
		LDA	!ENCLOR,X
		AND	#1111111111110001B
		LDY	!ENSHOT,X
		BEQ	BTSNMV0020		; shot ? [no->BTSNMV0020]
;
		ORA	#0000000000000100B
BTSNMV0020	EQU	$
		STA	!ENCLOR,X
		JSL	>ENMDCK			; mode check
;
		LDA	!ENWRKA,X
		BEQ	BTSNMV00A0		; 気絶 ? [no->BTSNMV00A0]
;
		JMP	BATSANREVIVE		; 復活処理 !!
;
BTSNMV00A0	EQU	$
		JSL	>EPFOOTCROSS		; 踏まれたチェック!!
;
		BCS	BTSNMV0100		; 踏まれた ? [yes->BTSNMV0100]
;
		JSR	BATCRCK
;
		JSL	>EPCRCK
;
		TXY
		LDA	<ENCONT,X
		ASL	A
		TAX
		JMP	(BATSANMOD,X)
;
BTSNMV0100	EQU	$
		JMP	BATSANREVIVEIN
;
BATSANMOD	EQU	$
		WORD	BTMV0000		; walk
		WORD	BTMV0100		; miokuri
		WORD	BTMV0200		; take back
		WORD	BTMV0300		; swing
		WORD	BTMV0400		;
;
BATSANWALK	EQU	$
		BYTE	batsan00, batsan01, batsan02, batsan03, batsan04
;
BTMV0000	EQU	$
		TYX
		LDA	!ENMUKI,X
		TAY
		LDA	BATXSPINT,Y
		STA	!ENXSPD,X
;
		LDA	#swingarea
		STA	<EWORK4
		STA	<EWORK8
		ASL	A
		STA	<EWORK6
		STA	<EWORKA
		JSR	SEARCHSHEN		; shot enemy search !!
;
		BMI	BTMV0010		; shot in ? [no->BTMV0010]
;
		LDA	#swing
		STA	<ENCONT,X
		STZ	!ENXSPD,X
		LDA	<EWORK2
		STA	!ENMUKI,X
		LDA	#00
		STA	<ENWRK0,X
		TAY
		LDA	BATSANSWING,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	SWINGTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
		STZ	<ENWRK2,X		; hit mode
		RTL
;
;
BTMV0010	EQU	$
		LDA	#takebackarea
		STA	<EWORK4
		STA	<EWORK8
		ASL	A
		STA	<EWORK6
		STA	<EWORKA
		JSR	SEARCHPLAYER		; player search !!
;
		BPL	BTMV0018		; area in ? [yes->BTMV0018]
;
		CPX	!PLNAGE_IX
		BNE	BTMV001C		; target ? [no->BTMV001C]
;
BTMV0018	EQU	$
		LDA	#ftake
		STA	<ENCONT,X
		STZ	!ENXSPD,X
		LDA	<EWORK2
		STA	!ENMUKI,X
		LDA	#00
		STA	<ENWRK0,X
		TAY
		LDA	TAKEBACKF,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	TBFTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
		STZ	<ENWRK2,X		; hit mode
		RTL
;
;
BTMV001C	EQU	$
		JSL	>RANDAM
;
		LDA	<RANDM0
		AND	#000FFH
		BNE	BTMV0020		;
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		TAY
		LDA	BATXSPINT,Y
		STA	!ENXSPD,X
BTMV0020	EQU	$
		LDA	!ENTIM0,X
		BNE	BTMV00F0		; pattern change ? [no->BTMV00F0]
;
		LDA	<ENWRK0,X
		INC	A
		CMP	#05
		BCC	BTMV0040		; [->BTMV0040]
;
		LDA	#00
BTMV0040	EQU	$
		STA	!ENWRK0,X
		TAY
		LDA	BATSANWALK,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#batsanwalktm0
		STA	!ENTIM0,X
BTMV00F0	EQU	$
		RTL
;
;
TAKEBACKS	EQU	$
		BYTE	batsan08, batsan07, batsan06, batsan05
;
TBSTIME		EQU	$
		HEX	20, 04, 04, 10
;
BTMV0100	EQU	$
		TYX
		LDA	#swingarea
		STA	<EWORK4
		STA	<EWORK8
		ASL	A
		STA	<EWORK6
		STA	<EWORKA
		JSR	SEARCHSHEN		; shot enemy search !!
;
		BMI	BTMV0108		; shot in ? [no->BTMV0108]
;
		LDA	#swing
		STA	<ENCONT,X
		STZ	!ENXSPD,X
		LDA	<EWORK2
		STA	!ENMUKI,X
		LDA	#00
		STA	<ENWRK0,X
		TAY
		LDA	BATSANSWING,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	SWINGTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
		STZ	<ENWRK2,X		; hit mode
		RTL
;
;
BTMV0108	EQU	$
		LDA	#takebackarea
		STA	<EWORK4
		STA	<EWORK8
		ASL	A
		STA	<EWORK6
		STA	<EWORKA
		JSR	SEARCHPLAYER		; player search !!
;
		BPL	BTMV0110		; area in ? [yes->BTMV0110]
;
		CPX	!PLNAGE_IX
		BNE	BTMV0118		; target ? [no->BTMV0118]
;
BTMV0110	EQU	$
		LDA	#ftake
		STA	<ENCONT,X
		STZ	!ENXSPD,X
		LDA	<EWORK2
		STA	!ENMUKI,X
		LDA	#00
		STA	<ENWRK0,X
		TAY
		LDA	TAKEBACKF,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	TBFTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
		STZ	<ENWRK2,X		; hit mode
		RTL
;
;
BTMV0118	EQU	$
		LDA	!ENTIM0,X
		BNE	BTMV01F0		; pattern change ? [no->BTMV01F0]
;
		LDA	<ENWRK0,X
		INC	A
		CMP	#04
		BCC	BTMV0120		; [->BTMV0120]
;
		LDA	#00
		STA	!ENTIM0,X
		LDA	#blast
		STA	<ENCONT,X
		RTL
;
BTMV0120	EQU	$
		STA	!ENWRK0,X
		TAY
		LDA	TAKEBACKS,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	TBSTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
BTMV01F0	EQU	$
		RTL
;
;
TAKEBACKF	EQU	$
		BYTE	batsan05, batsan06, batsan07, batsan08
;
TBFTIME		EQU	$
		HEX	04, 02, 02, 02
;
BSXHOSEI	EQU	$
		WORD	0FFE8H, 00018H
;
BTMV0200	EQU	$
		TYX
		LDA	#swingarea2
		STA	<EWORK4
		STA	<EWORK8
		ASL	A
		STA	<EWORK6
		STA	<EWORKA
		JSR	SEARCHPLAYER		; player search !!
;
		BPL	BTMV0208		; area in ? [yes->BTMV0208]
;
		LDA	#swingarea
		STA	<EWORK4
		STA	<EWORK8
		ASL	A
		STA	<EWORK6
		STA	<EWORKA
		JSR	SEARCHSHEN		; shot enemy search !!
;
		BMI	BTMV0210		; shot in ? [no->BTMV0210]
;
BTMV0208	EQU	$
		LDA	#swing
		STA	<ENCONT,X
		STZ	!ENXSPD,X
		LDA	<EWORK2
		STA	!ENMUKI,X
		LDA	#00
		STA	<ENWRK0,X
		TAY
		LDA	BATSANSWING,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	SWINGTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
		STZ	<ENWRK2,X		; hit mode
		RTL
;
;
BTMV0210	EQU	$
		LDA	#takebackarea
		STA	<EWORK4
		STA	<EWORK8
		ASL	A
		STA	<EWORK6
		STA	<EWORKA
		JSR	SEARCHPLAYER		; player search !!
;
		BPL	BTMV0218		; area in ? [yes->BTMV0218]
;
		CPX	!PLNAGE_IX
		BEQ	BTMV021C		; target ? [yes->BTMV021C]
;
		LDA	#cancel
		STA	<ENCONT,X
		LDA	<EWORK2
		STA	!ENMUKI,X
		LDA	#00
		STA	<ENWRK0,X
		TAY
		LDA	TAKEBACKS,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	TBSTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
		RTL
;
;
BTMV0218	EQU	$
		CMP	!ENMUKI,X
		BEQ	BTMV021C		;
;
		STA	!ENMUKI,X
		TAY
		LDA	!ENXPSL,X
		CLC
		ADC	BSXHOSEI,Y
		STA	!ENXPSL,X
BTMV021C	EQU	$
		LDA	!ENTIM0,X
		BNE	BTMV02F0		; pattern change ? [no->BTMV02F0]
;
		LDA	<ENWRK0,X
		INC	A
		CMP	#04
		BCC	BTMV0220		; [->BTMV0220]
;
		LDA	#03
BTMV0220	EQU	$
		STA	!ENWRK0,X
		TAY
		LDA	TAKEBACKF,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	TBFTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
BTMV02F0	EQU	$
		RTL
;
;
BATSANSWING	EQU	$
		BYTE	batsan08
		BYTE	batsan06, batsan09, batsan0A, batsan0B
		BYTE	batsan0C, batsan0D, batsan0E, batsan0F
		BYTE	batsan10, batsan11, batsan12, batsan13
		BYTE	batsan14, batsan15, batsan09, batsan05
;
SWINGTIME	EQU	$
		HEX	01
		HEX	01, 01, 01, 01
		HEX	01, 01, 01, 20
		HEX	01, 01, 01, 02
		HEX	02, 03, 03, 10
;
BTMV0300	EQU	$
		TYX
		LDA	<ENWRK0,X
		SEC
		SBC	#01
		CMP	#07
		BCC	BTMV0308		; hit cheack ? [yes->BTMV0308]
;
		CMP	#16
		BCS	BTMV0305		;
;
		LDA	#swingarea
		STA	<EWORK4
		STA	<EWORK8
		ASL	A
		STA	<EWORK6
		STA	<EWORKA
		JSR	SEARCHSHEN		; shot enemy search !!
;
		BMI	BTMV0305		;
;
		TYA
		CMP	<ENWRK4,X
		BNE	BTMV0306		;
;
BTMV0305	EQU	$
		JMP	BTMV0310		;
;
BTMV0306	EQU	$
		LDA	<EWORK2
		STA	!ENMUKI,X
		LDA	#00
		STA	<ENWRK0,X
		TAY
		LDA	BATSANSWING,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	SWINGTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
		STZ	<ENWRK2,X		; hit mode
		RTL
;
;
BTMV0308	EQU	$
		LDA	<ENWRK2,X
		BNE	BTMV0310		; hit mode cheack
;
		LDA	#batsanatariyoko
		STA	<EWORK4
		ASL	A
		STA	<EWORK6
		LDA	#batsanataritate
		STA	<EWORK8
		ASL	A
		STA	<EWORKA
		JSR	SEARCHSHEN		; shot enemy search !!
;
		BMI	BTMV0310		; hit ? [no->BTMV0310]
;
		LDA	!ENMYNO,Y
		CMP	#EGG00
		BCC	BTMV030A		; 卵 ? [no->BTMV030A]
;
		CMP	#EGG09+1
		BCS	BTMV030A		; 卵 ? [no->BTMV030A]
;
		LDA	#0001
		STA	!ENWRK6,Y
;
		M8
;
		STA	!ENWRKX,Y		;タマゴスクロールＳＴＯＰ！！
;
		M16
;
BTMV030A	EQU	$
		LDA	!ENXPSL,Y
		SEC
		SBC	!ENMOVX,Y
		STA	!ENXPSL,Y
		LDA	!ENXSPD,Y
		EOR	#0FFFFH
		INC	A
		STA	!ENXSPD,Y
		LDA	!ENYPSL,Y
		SEC
		SBC	!ENMOVY,Y
		STA	!ENYPSL,Y
		LDA	!ENYSPD,Y
		EOR	#0FFFFH
		INC	A
		STA	!ENYSPD,Y
		TYA
		STA	<ENWRK4,X
		INC	<ENWRK2,X
;
		LDA	#0001CH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	!ECENTX,Y
		STA	<EWORK
		LDA	!ECENTY,Y
		STA	<EWORK2
		JSR	KAKIN_SET		; ヒットマークセット
;
BTMV0310	EQU	$
		LDA	!ENTIM0,X
		BNE	BTMV03F0		; pattern change ? [no->BTMV03F0]
;
		LDA	<ENWRK0,X
		INC	A
		CMP	#17
		BCC	BTMV0320		; [->BTMV0320]
;
		LDA	#00
		STA	!ENTIM0,X
		INC	<ENCONT,X
		BRA	BTMV03F0
;
BTMV0320	EQU	$
		STA	!ENWRK0,X
		TAY
		LDA	BATSANSWING,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	SWINGTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
BTMV03F0	EQU	$
		RTL
;
;
BTMV0400	EQU	$
		TYX
		LDA	!ENTIM0,X
		BNE	BTMV04F0		;
;
		LDA	#bwalk
		STA	<ENCONT,X
		STZ	<ENWRK0,X
		LDA	BATSANWALK
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#batsanwalktm0
		STA	!ENTIM0,X
BTMV04F0	EQU	$
		RTL
;
;
;================================================
;=	EWORK4 <- atari hankei yoko		=
;=	EWORK6 <- atari area yoko		=
;=	EWORK8 <- atari hankei tate		=
;=	EWORKA <- atari area tate		=
;=	enemy index -> Y			=
;=	yoko houkou -> EWORK2			=
;================================================
SEARCHSHEN	EQU	$
		TXA
		STA	R1
		PHX
		M_CHIP	SHOTENSR
;
		PLX
		LDY	R1
		BMI	SRSE0100		;
;
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		PHA
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		STA	<EWORK2
		PLA
		CLC
		ADC	<EWORK4
		CMP	<EWORK6
		BCS	SRSE00F0		; aria in ? [no->SRSE00F0]
;
		LDA	!ECENTY,X
		SEC
		SBC	!ECENTY,Y
		CLC
		ADC	<EWORK8
		CMP	<EWORKA
		BCS	SRSE00F0		; aria in ? [no->SRSE00F0]
;
		CPY	#00
		BRA	SRSE0100
;
SRSE00F0	EQU	$
		LDA	#-1
SRSE0100	EQU	$
		RTS
;
;
;================================================
;=	EWORK4 <- atari hankei yoko		=
;=	EWORK6 <- atari area yoko		=
;=	EWORK8 <- atari hankei tate		=
;=	EWORKA <- atari area tate		=
;=	yoko houkou -> A			=
;=	yoko houkou -> EWORK2			=
;================================================
SEARCHPLAYER	EQU	$
		LDA	!ENXPSL,X
		SEC
		SBC	!PLXPSL
		PHA
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		STA	<EWORK2
		PLA
		CLC
		ADC	<EWORK4
		CMP	<EWORK6
		BCS	SRPL00F0		; aria in ? [no->SRPL00F0]
;
		LDA	!ENYPSL,X
		SEC
		SBC	!PLYPSL
		CLC
		ADC	<EWORK8
		CMP	<EWORKA
		BCS	SRPL00F0		; aria in ? [no->SRPL00F0]
;
		LDA	<EWORK2
		BRA	SRPL0100
;
SRPL00F0	EQU	$
		LDA	#-1
SRPL0100	EQU	$
		RTS
;
;
BATHITXP	EQU	$
		WORD	0000AH, -0000AH, 0000AH, -0000AH, 0000AH, -0000AH, 0000BH, -0000BH
		WORD	0000AH, -0000AH, 00008H, -00008H, 0000CH, -0000CH, 0000FH, -0000FH
		WORD	00008H, -00008H, 00010H, -00010H, 00008H, -00008H, 0FFECH, -0FFECH
		WORD	0FFEEH, -0FFEEH, 0FFFAH, -0FFFAH, 00008H, -00008H, 00009H, -00009H
		WORD	00001H, -00001H, 0FFF6H, -0FFF6H, 0FFECH, -0FFECH, 0FFEEH, -0FFEEH
		WORD	00001H, -00001H, 0000FH, -0000FH
;
BATHITYP	EQU	$
		WORD	0FFF7H, 0FFF6H, 0FFF5H, 0FFF6H, 0FFF8H, 0FFF3H, 0FFF3H, 0FFF1H
		WORD	0FFEDH, 0FFF7H, 00009H, 00004H, 0FFF4H, 0FFECH, 0FFEEH, 0FFF1H
		WORD	0FFECH, 0FFECH, 0FFF7H, 00009H, 0000DH, 00006H
;
BATCRCK		EQU	$
		LDA	!PWIDEY
		ASL	A
		CLC
		ADC	#batwidth*2
		STA	<EWORK
		LDA	!PWIDEX
		ASL	A
		CLC
		ADC	#batwidth*2
		STA	<EWORK2
		LDA	!ENCHPT,X
		ASL	A
		TAY
		LDA	!ECENTY,X
		CLC
		ADC	BATHITYP,Y
		SEC
		SBC	!PCENTY
		CLC
		ADC	!PWIDEY
		CLC
		ADC	#batwidth
		CMP	<EWORK
		BCS	BTCC0100		; player hit ? [no->BTCC0100]
;
		LDA	!ENCHPT,X
		ASL	A
		ASL	A
		ORA	!ENMUKI,X
		TAY
		LDA	!ECENTX,X
		CLC
		ADC	BATHITXP,Y
		SEC
		SBC	!PCENTX
		CLC
		ADC	!PWIDEX
		CLC
		ADC	#batwidth
		CMP	<EWORK2
		BCS	BTCC0100		; player hit ? [no->BTCC0100]
;
		JSL	>PLFLST
;
BTCC0100	EQU	$
		RTS
;
;
BATSANREVIVEIN	EQU	$
		LDA	!ENMOD1,X
		AND	#1111110011111111B	; 足当たり無しで落ちる !!
		STA	!ENMOD1,X
		LDA	#BATSANREVIVEPT
		STA	<EWORK
		JSR	REVIVEINIT
;
		RTL
;
;
BATSANREVIVE	EQU	$
		LDA	#BATSANREVIVEPT
		STA	<EWORK
		JSR	REVIVE
;
		LDA	!ENWRKA,X
		BNE	BTSNRV0080		; 復活 ? [no->BTSNRV0080]
;
		LDA	!ENMOD1,X
		ORA	#0000000100000000B	; ; 足当たり無しで行ったり来たり !!
		STA	!ENMOD1,X
BTSNRV0080	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	fail (BATSN)							-
;------------------------------------------------------------------------
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;-	initial (YARIH)							-
;------------------------------------------------------------------------
yariho00	EQU	000H
yariho01	EQU	001H
yariho02	EQU	002H
yariho03	EQU	003H
yariho04	EQU	004H
yariho05	EQU	005H
;[1995.01.23.MO]yariho06	EQU	006H
;[1995.01.23.MO]yariho07	EQU	007H
;
yarihoxarea	EQU	018H
front_hit	EQU	002H
back_hit	EQU	004H
yarihou_walktm	EQU	04
;
yarihou_walkpt	EQU	(YRHTATETM-YRHWALKPT-1)
;
YARIHXSPIN	EQU	$
		WORD	0FFA8H, 00058H
;
YARIHIN		EQU	$
		LDA	#YARICENTY0
		STA	<ENWRK0,X		; yari y haba
		LDA	#00800H
		BRA	YARH2IN0010
;
;------------------------------------------------------------------------
;-	initial (YARH2)							-
;------------------------------------------------------------------------
YARH2IN		EQU	$
		LDA	#YARICENTY1
		STA	<ENWRK0,X		; yari y haba
		LDA	#00000H
YARH2IN0010	EQU	$
		STA	<ENWRK4,X		; yari nagasa
;
		LDA	#yarihou_walkpt
		STA	<ENCONT,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	#yarihou_walktm
		STA	!ENTIM0,X
		LDA	YRHWALKPT,Y
		STA	!ENCHPT,X
		TAY
		LDA	YRHXHITCX,Y
		STA	!ECNTXW,X
		LDA	YRHXHITWX,Y
		STA	!EWIDEX,X
;
		M16				; memory 16bit mode !!
;
		LDY	!ENMUKI,X
		LDA	YARIHXSPIN,Y
		STA	!ENXSPD,X
;
		LDA	#(0001<<1)+1
		STA	!ENWRKC,X
		RTL
;
;------------------------------------------------------------------------
;-	move (YARIH)							-
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;-	move (YARH2)							-
;------------------------------------------------------------------------
YARIHOHITMD	EQU	$
		WORD	back_hit, front_hit
;
YRHWALKPT	EQU	$
		BYTE	yariho04, yariho03, yariho02, yariho01
		BYTE	yariho00
;
YRHTATETM	EQU	$
		HEX	04, 04, 30, 01
;
YRHXHITCX	EQU	$
		HEX	08, 08, 08, 08, 08, 06
;[1995.01.23.MO]		HEX	08, 08, 08, 08, 08, 08, 08, 06
;
YRHXHITWX	EQU	$
		HEX	06, 06, 06, 06, 06, 0A
;[1995.01.23.MO]		HEX	06, 06, 06, 06, 06, 06, 06, 0A
;
;[1995.01.23.MO]YRHTATEPT	EQU	$
;[1995.01.23.MO]		BYTE	yariho05, yariho06, yariho07, yariho06
;[1995.01.23.MO];
YRHSLIPPOW	EQU	$
		WORD	00020H, 00020H
;
YRHSLIPSPD	EQU	$
		WORD	00200H, 0FE00H
;
YRHSMKSPD	EQU	$
		WORD	0FFE0H, 00020H
;
YARIHMV		EQU	$
YARH2MV		EQU	$
		LDA	!ENMODE,X
		CMP	#EDOWN
		BEQ	YRHMV0018		; pow block on ? [no->YRHMV0018]
;
		CMP	#EEATM
		BEQ	YRHMV0010		; eat ? [yes->YRHMV0010]
;
		JMP	YRHMV0040		; eat ? [no->YRHMV0040]
;
YRHMV0010	EQU	$
		LDA	!EPXMUK,X
		AND	#000FFH
		EOR	!ENMUKI,X
		BEQ	YRHMV0020		; back eat ? [no->YRHMV0020]
;
YRHMV0018	EQU	$
		JMP	YRHMV0302
;
YRHMV0020	EQU	$
		LDA	!BERFLG
		CMP	#03
		BCS	YRHMV0018		; top or under eat ? [yes->YRHMV0018]
;
		LDA	#02
		STA	!BERFLG
		LDA	#EMOVE
		STA	!ENMODE,X
		STZ	!EATFLG
		STZ	!EATSTP
;
		PLA
		PLY				; eat mode cancel !!
		JSL	>ENMDCK			; mode check
;
		JSR	YARIHOSLIP		; slip initial !!
;
		LDY	#02
		BRA	YRHMV0050
;
YRHMV0040	EQU	$
		JSL	>ENMDCK			; mode check
;
		JSL	>EPCRCK
;
		JSR	YARIHOCRCK
;
		BPL	YRHMV0050		; shot enemy hit ? [yes->YRHMV0050]
		JMP	YRHMV0080		; shot enemy hit ? [no->YRHMV0080]
;
YRHMV0050	EQU	$
		LDA	YARIHOHITMD,Y
		STA	<ENWRK2,X
;[1995.01.23.MO]		LDA	#03
;[1995.01.23.MO]		STA	<ENCONT,X
;[1995.01.23.MO]		TAY
;[1995.01.23.MO]		LDA	YRHTATETM,Y
;[1995.01.23.MO]		AND	#000FFH
		LDA	#00020H
		STA	!ENTIM0,X
;[1995.01.23.MO]		LDA	YRHTATEPT,Y
;[1995.01.23.MO]		AND	#000FFH
		LDA	#yariho05
		STA	!ENCHPT,X
		TAY
		LDA	YRHXHITCX,Y
		AND	#000FFH
		STA	!ECNTXW,X
		LDA	YRHXHITWX,Y
		AND	#000FFH
		STA	!EWIDEX,X
;
		LDA	ENMOD1,X
		AND	#1111110000111111B
		ORA	#0000000010000000B	; 足当たり無しで落ちる !!
		STA	ENMOD1,X		; BG 横当たりで止まる !!
		LDA	ENMOD2,X
		ORA	#0000000000000100B	; 範囲クリアオン !!
		STA	ENMOD2,X
		LDY	!ECRSFG,X
		DEY
		BMI	YRHMV0080		; slip initial set ? [no->YRHMV0080]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	YRHMV0080		; [->YRHMV0080]
;
		LDA	!ENSHOT,Y
		BEQ	YRHMV0080		; slip initial set ? [no->YRHMV0080]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		JSR	YARIHOSLIP		; slip initial !!
;
YRHMV0080	EQU	$
		TXY
		LDX	<ENWRK2,Y
		JMP	(YARIMVMD,X)
;
;
YARIMVMD	EQU	$
		WORD	YRHMV0100
		WORD	YRHMV0200
		WORD	YRHMV0300
;
YRHMV0100	EQU	$
		TYX
		LDA	!ENTIM0,X
		BNE	YRHMV0180		; pattern change ? [no->YRHMV0180]
;
		DEC	<ENCONT,X
		BPL	YRHMV0140		; [->YRHMV0140]
;
		LDA	#yarihou_walkpt
		STA	<ENCONT,X
YRHMV0140	EQU	$
;
		M8				; memory 8bit mode !!
;
		LDY	<ENCONT,X
		LDA	#yarihou_walktm
		STA	!ENTIM0,X
		LDA	YRHWALKPT,Y
		STA	!ENCHPT,X
		TAY
		LDA	YRHXHITCX,Y
		STA	!ECNTXW,X
		LDA	YRHXHITWX,Y
		STA	!EWIDEX,X
;
		M16				; memory 16bit mode !!
;
YRHMV0180	EQU	$
		RTL
;
;
YRHMV0200	EQU	$
		TYX
		LDA	!ENXSPD,X
		BNE	YRHMV0240		; G clear [no->YRHMV0240]
;
		STZ	!ENXPOW,X
YRHMV0240	EQU	$
		LDA	!ENTIM0,X
		BNE	YRHMV02C0		; pattern change ? [no->YRHMV02C0]
;
;[1995.01.23.MO]		LDY	<ENCONT,X
;[1995.01.23.MO]		BEQ	YRHMV0280		; next walk mode ? [yes->YRHMV0280]
;[1995.01.23.MO];
;[1995.01.23.MO]		DEY
;[1995.01.23.MO]		STY	<ENCONT,X
;[1995.01.23.MO]		LDA	YRHTATEPT,Y
;[1995.01.23.MO]		AND	#000FFH
;[1995.01.23.MO]		STA	!ENCHPT,X
;[1995.01.23.MO]		PHY
;[1995.01.23.MO]		TAY
;[1995.01.23.MO]		LDA	YRHXHITCX,Y
;[1995.01.23.MO]		AND	#000FFH
;[1995.01.23.MO]		STA	!ECNTXW,X
;[1995.01.23.MO]		LDA	YRHXHITWX,Y
;[1995.01.23.MO]		AND	#000FFH
;[1995.01.23.MO]		STA	!EWIDEX,X
;[1995.01.23.MO]		PLY
;[1995.01.23.MO]		LDA	YRHTATETM,Y
;[1995.01.23.MO]		AND	#000FFH
;[1995.01.23.MO]		STA	!ENTIM0,X
;[1995.01.23.MO]		RTL
;
YRHMV0280	EQU	$
		LDA	#yarihou_walkpt
		STA	<ENCONT,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	#yarihou_walktm
		STA	!ENTIM0,X
		LDA	YRHWALKPT,Y
		STA	!ENCHPT,X
		TAY
		LDA	YRHXHITCX,Y
		STA	!ECNTXW,X
		LDA	YRHXHITWX,Y
		STA	!EWIDEX,X
;
		M16				; memory 16bit mode !!
;
		LDY	!ENMUKI,X
		LDA	YARIHXSPIN,Y
		STA	!ENXSPD,X
		STZ	!ENXPOW,X
		STZ	<ENWRK2,X
		LDA	ENMOD1,X
		AND	#1111110000111111B
		ORA	#0000000101000000B	; 足当たり無しで行ったり来たり !!
		STA	ENMOD1,X		; BG 横当たりで反転 !!
YRHMV02C0	EQU	$
		RTL
;
;
yspeedinit	EQU	0FC00H
;
TATEXSPDIN	EQU	$
		WORD	0FF00H, 00100H
;
YRHMV0300	EQU	$
		TYX
YRHMV0302	EQU	$
		JSR	YARITATESET
;
		JSL	>ENCLEAR_NORETN2
;
		LDA	#HEIH0
		TXY
		JSL	>ESTATST
;
		LDA	!ENWRKC,X
		DEC	A
		ORA	!ENCLOR,X
		STA	!ENCLOR,X
;
		LDA	!ENMODE,X
		CMP	#EMOVE
		BNE	YRHMV0380		; [->YRHMV0380]
;
		LDA	#EINIT
		STA	!ENMODE,X
YRHMV0380	EQU	$
		RTL
;
;
YARITATESET	EQU	$
		PHX
		LDA	#TATE0
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		STA	!EXYPSL,Y
		LDA	!ENMUKI,X
		STA	!EXMUKI,Y
		TAX
		LDA	TATEXSPDIN,X
		STA	!EXXSPD,Y
		LDA	#yspeedinit
		STA	!EXYSPD,Y
		LDA	#32
		STA	!EXTIM0,Y
		PLX
;
		PHX
		LDA	#YARI0
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		STA	!EXYPSL,Y
		LDA	!EXMOD2,Y
		CLC
		ADC	!ENWRK4,X
		STA	!EXMOD2,Y
		LDA	!ENMUKI,X
		STA	!EXMUKI,Y
		EOR	#02
		TAX
		LDA	TATEXSPDIN,X
		STA	!EXXSPD,Y
		LDA	#yspeedinit
		STA	!EXYSPD,Y
		LDA	#32
		STA	!EXTIM0,Y
		PLX
;
		RTS
;
;
YARIHEATFLG	EQU	$
		WORD	0000000001000000B
		WORD	0000000000000000B
;
yaricenterx	EQU	03
yaricentery	EQU	04
;
YARICENTX0	EQU	$
		WORD	00005H+yaricenterx, 00006H+yaricenterx
		WORD	00006H+yaricenterx, 00005H+yaricenterx
		WORD	00005H+yaricenterx, 00007H+yaricenterx
;
YARICENTY0	EQU	$
		WORD	0FFE5H+yaricentery, 0FFE7H+yaricentery
		WORD	0FFE6H+yaricentery, 0FFE5H+yaricentery
		WORD	0FFE4H+yaricentery, 0FFEBH+yaricentery
;
YARICENTY1	EQU	$
		WORD	0FFF1H+yaricentery, 0FFF3H+yaricentery
		WORD	0FFF2H+yaricentery, 0FFF1H+yaricentery
		WORD	0FFF0H+yaricentery, 0FFF5H+yaricentery
;
YARIHOCRCK	EQU	$
		JSR	YARICRCK
;
		LDY	!ECRSFG,X
		DEY
		BMI	YRHCRCK0080		; enemy hit ? [no->YRHCRCK0080]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	YRHCRCK0080		; enemy mode move ? [no->YRHCRCK0080]
;
		LDA	!ENSHOT,Y
		BEQ	YRHCRCK0080		; shot enemy ? [no->YRHCRCK0080]
;
		LDX	<ENINDX
		LDA	!ECROSX,X
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		EOR	!ENMUKI,X
		BEQ	YRHCRCK0070		; やられセット？ [yes->YRHCRCK0070]
;
		TAY
		RTS
;
YRHCRCK0070	EQU	$
		TYX
		JSL	>SHOT_EN_KILL
;
		LDA	#0003BH
		JSL	>SOUND_3_ON		; サウンド セット！！
;
		LDX	<ENINDX
		JSR	YARITATESET
;
		PLA				; Pull Pull Return !!
		JMP	>ENDEATH_SET		; 死亡セット !!
;
YRHCRCK0080	EQU	$
		TXA
		STA	R1
		PHX
		M_CHIP	SHOTENSR
;
		PLX
		LDY	R1
		BMI	YRHCRCK0200		; shot enemy on ? [no->YRHCRCK0200]
;
		LDA	!ENMUKI,X
		LSR	A
		LSR	A
		ROR	A
		STA	<EWORK
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		STA	<EWORK2
		EOR	<EWORK
		BMI	YRHCRCK0100		; shot enemy front ? [no->YRHCRCK0100]
;
		LDA	<EWORK2
		EOR	!ENXSPD,Y
		BMI	YRHCRCK0100		; [->YRHCRCK0100]
;
		LDA	<EWORK2
		CLC
		ADC	#yarihoxarea
		CMP	#yarihoxarea*2
		BCS	YRHCRCK0100		; x area in ? [no->YRHCRCK0100]
;
		LDA	<EWORK2
		ABS16
		STA	<EWORK4
		LSR	A
		STA	<EWORK2
		LDA	!ECENTY,X
		SEC
		SBC	!ECENTY,Y
		STA	<EWORK
		EOR	!ENYSPD,Y
		BMI	YRHCRCK0100		; [->YRHCRCK0100]
;
		LDA	<EWORK
		CLC
		ADC	<EWORK2
		CMP	<EWORK4
		BCS	YRHCRCK0100		; y area in ? [no->YRHCRCK0100]
;
		LDY	#02
		RTS
;
;
YRHCRCK0100	EQU	$
		LDY	#-1
YRHCRCK0200	EQU	$
		RTS
;
;
YARICRCK	EQU	$
		LDY	!ECRSFG,X
		BMI	YRCRCK0100		; hit check [no->YRCRCK0100]
;
		LDA	!PWIDEY
		ASL	A
		STA	<EWORK2
		LDA	<ENWRK0,X
		STA	<EWORK
		LDA	!ENCHPT,X
		ASL	A
		TAY
		LDA	!ENYPSL,X
		CLC
		ADC	(<EWORK),Y
		SEC
		SBC	!PCENTY
		CLC
		ADC	!PWIDEY
		CMP	<EWORK2
		BCS	YRCRCK0100		; hit ? [no->YRCRCK0100]
;
		LDA	!ENCHPT,X
		ASL	A
		TAY
		LDA	YARICENTX0,Y
		LDY	!ENMUKI,X
		BEQ	YRCRCK0080		; [->YRCRCK0080]
;
		EOR	#0FFFFH
		CLC
		ADC	#0009
YRCRCK0080	EQU	$
		STA	<EWORK
		LDA	!PWIDEX
		ASL	A
		STA	<EWORK2
		LDA	!ENXPSL,X
		CLC
		ADC	<EWORK
		SEC
		SBC	!PCENTX
		CLC
		ADC	!PWIDEX
		CMP	<EWORK2
		BCS	YRCRCK0100		; hit ? [no->YRCRCK0100]
;
		JSL	>PLFLST
;
YRCRCK0100	EQU	$
		RTS
;
;
YARIHOSLIP	EQU	$
		LDY	!ENMUKI,X
		LDA	YRHSLIPPOW,Y
		STA	!ENXPOW,X
		LDA	YRHSLIPSPD,Y
		STA	!ENXSPD,X
		LDA	YRHSMKSPD,Y
		STA	<EWORK
		LDA	#DSMK1
		JSL	>EXINSR
;
		LDA	!ENMUKI,X
		EOR	#02
		STA	!EXMUKI,Y
		LDA	#04
		STA	!EXTIM0,Y
		STA	!EXWRK0,Y
		LDA	<EWORK
		STA	!EXXSPD,Y
		LDA	#0FFF0H
		STA	!EXYSPD,Y
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	#0000CH
		STA	!EXYPSL,Y
		RTS
;
;
;------------------------------------------------------------------------
;-	initial (MCHO2)							-
;------------------------------------------------------------------------
mucho00		EQU	000H
mucho01		EQU	001H
mucho02		EQU	002H
mucho03		EQU	003H
mucho04		EQU	004H
mucho05		EQU	005H
mucho06		EQU	006H
mucho07		EQU	007H
mucho08		EQU	008H
mucho09		EQU	009H
;
muchoshottimer	EQU	00080H
mc2reactionxpow EQU	00010H
;
MCHO2XSPD	EQU	$
		WORD	0FFA8H, 00058H
;
MC2REACTIONXSPD EQU	$
		WORD	00100H, 0FF00H
;
MC2TAMAXP	EQU	$
		WORD	0FFECH, 00005H
;
MC2S0XPS	EQU	$
		WORD	0FFF3H, 0FFFDH
;
MC2S1XPS	EQU	$
		WORD	0FFF8H, 0FFF8H
;
MCHO2WALK	EQU	$
		WORD	mucho00, mucho01, mucho02, mucho03
		WORD	mucho04
;
MCHO2SHOT	EQU	$
		WORD	mucho05, mucho06, mucho07, mucho08
		WORD	mucho09, mucho08, mucho05
;
MCHO2SHOTTM	EQU	$
		WORD	00010H, 00020H, 00002H, 00002H
		WORD	00006H, 00008H, 00010H
;
MCHO2IN		EQU	$
		LDY	!ENMUKI,X
		LDA	MCHO2XSPD,Y
		STA	!ENXSPD,X
		LDA	#04
		STA	!ENTIM0,X
;[1994.10.05.WE]		LDA	#muchoshottimer
;[1994.10.05.WE]		STA	!ENTIM1,X
		LDA	MCHO2WALK
		STA	!ENCHPT,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (MCHO2)							-
;------------------------------------------------------------------------
MCHO2MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JSR	(MCHO2SEL,X)
;
		JSL	>EPCRCK
;
		RTL
;
;
MCHO2SEL	EQU	$
		WORD	MCHO2WK
		WORD	MCHO2ST
;
MCHO2WK		EQU	$
		LDX	<ENINDX
		LDA	!ENDSXL,X
		CMP	#000F0H
		BCS	MC2WK0020		; 横画面内 ? [no->MC2WK0020]
;
		LDA	!ENTIM1,X
		BEQ	MC2WK0100		; shot ? [yes->MC2WK0100]
;
MC2WK0020	EQU	$
		LDA	!ENTIM0,X
		BNE	MC2WK0200		; pattern change ? [no->MC2WK0200]
;
		LDA	#04
		STA	!ENTIM0,X
		LDA	<ENWRK0,X
		INC	A
		INC	A
		CMP	#05*2
		BCC	MC2WK0040		; pattern max over ? [no->MC2WK0040]
;
		LDA	#00
MC2WK0040	EQU	$
		STA	<ENWRK0,X
		TAY
		LDA	MCHO2WALK,Y
		STA	!ENCHPT,X
		BRA	MC2WK0200
;
MC2WK0100	EQU	$
		STZ	<ENWRK0,X
		STZ	!ENXSPD,X
		LDA	MCHO2SHOTTM
		STA	!ENTIM0,X
		LDA	MCHO2SHOT
		STA	!ENCHPT,X
		LDA	!ENMOD1,X
		AND	#1111100000111111B	; BG 横当たりで何もしない !!
		ORA	#0000010000000000B	; 反転でXスピードクリア !!
		STA	!ENMOD1,X		; 足当たり無しで落ちる !!
		INC	<ENCONT,X
		INC	<ENCONT,X
MC2WK0200	EQU	$
		RTS
;
;
MCHO2ST		EQU	$
		LDX	<ENINDX
		LDA	<ENWRK2,X
		BEQ	MC2ST0040		; x pow clear ? [no->MC2ST0040]
;
		LDA	!ENXSPD,X
		BNE	MC2ST0040		; x pow clear ? [no->MC2ST0040]
;
		STZ	!ENXPOW,X
		STZ	<ENWRK2,X
MC2ST0040	EQU	$
		LDA	!ENTIM0,X
		BNE	MC2ST0100		; pattern change ? [no->MC2ST0100]
;
		LDA	<ENWRK0,X
		INC	A
		INC	A
		CMP	#07*2
		BCS	MC2ST0200		; walk ? [yes->MC2ST0200]
;
		STA	<ENWRK0,X
		TAY
		LDA	MCHO2SHOTTM,Y
		STA	!ENTIM0,X
		LDA	MCHO2SHOT,Y
		STA	!ENCHPT,X
		TYX
		JMP	(MC2SHOTINSEL,X)
;
MC2SHOTINSEL	EQU	$
		WORD	MC2ST0100
		WORD	MC2ST0300
		WORD	MC2ST0400
		WORD	MC2ST0100
		WORD	MC2ST0100
		WORD	MC2ST0100
		WORD	MC2ST0100
;
;
MC2ST0100	EQU	$
		LDX	<ENINDX
		RTS
;
;
MC2ST0200	EQU	$
		STZ	<ENCONT,X
		STZ	<ENWRK0,X
		LDA	!ENMOD1,X
		AND	#1111100000111111B	; 反転でXスピード反転 !!
		ORA	#0000000101000000B	; 足当たり無しで行ったり来たり !!
		STA	!ENMOD1,X		; BG 横当たりで反転 !!
		LDA	#muchoshottimer
		STA	!ENTIM1,X
		JSL	>MCHO2IN		; walk initial set
;
		RTS
;
;
MC2ST0300	EQU	$
		LDX	<ENINDX
		LDY	!ENMUKI,X
		LDA	MC2S0XPS,Y
		STA	<EWORK
		LDA	#MC2S0
		JSL	>EXINSR
;
		LDA	!ECENTX,X
		CLC
		ADC	<EWORK
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#0000AH
		STA	!EXYPSL,Y
		LDA	!ENMUKI,X
		STA	!EXMUKI,Y
		LDA	#06
		STA	!EXWRK0,Y
		STA	!EXTIM0,Y
		LDA	#03-1
		STA	!EXWRK2,Y
		RTS
;
;
MC2ST0400	EQU	$
		LDX	<ENINDX
		INC	<ENWRK2,X
		LDY	!ENMUKI,X
		LDA	MC2REACTIONXSPD,Y
		STA	!ENXSPD,X
		LDA	#mc2reactionxpow
		STA	!ENXPOW,X
		LDA	BULETXSPD,Y
		STA	<EWORK
		LDA	MC2TAMAXP,Y
		STA	<EWORK2
		LDA	MC2S1XPS,Y
		STA	<EWORK4
;
		LDA	#BULET
		JSL	>ENINSR
;
		BCC	MC2ST0480		; [->MC2ST0480]
;
		LDA	!ECENTX,X
		CLC
		ADC	<EWORK2
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00001H
		STA	!ENYPSL,Y
		LDA	!ENMUKI,X
		STA	!ENMUKI,Y
		LDA	<EWORK
		STA	!ENXSPD,Y
MC2ST0480	EQU	$
		LDA	#MC2S1
		JSL	>EXINSR
;
		LDA	!ECENTX,X
		CLC
		ADC	<EWORK4
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00004H
		STA	!EXYPSL,Y
		LDA	!ENMUKI,X
		STA	!EXMUKI,Y
		LDA	#02
		STA	!EXWRK0,Y
		STA	!EXTIM0,Y
		LDA	#06-1
		STA	!EXWRK2,Y
;
		LDA	#00047H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		RTS
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;-	initial (BULET)							-
;------------------------------------------------------------------------
BULETXSPD	EQU	$
		WORD	0FE00H, 00200H
;
BULETIN		EQU	$
		LDY	!ENMUKI,X
		LDA	BULETXSPD,Y
		STA	!ENXSPD,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (BULET)							-
;------------------------------------------------------------------------
BULETMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDY	!ECRSFG,X
		BPL	BLTMV0100		; player hit [no->BLTMV0100]
;
		JSL	>PLFLST
;
BLTMV0100	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;-	initial (POCHI)							-
;------------------------------------------------------------------------
pochi00		EQU	000H
pochi01		EQU	001H
pochi02		EQU	002H
pochi03		EQU	003H
pochi04		EQU	004H
pochi05		EQU	005H
pochi06		EQU	006H
pochi07		EQU	007H
pochi08		EQU	008H
pochi09		EQU	009H
pochi0A		EQU	00AH
pochi0B		EQU	00BH
pochi0C		EQU	00CH
pochi0D		EQU	00DH
pochi0E		EQU	00EH
pochi0F		EQU	00FH
pochi10		EQU	010H
pochi11		EQU	011H
;
pochidash	EQU	000H
pochistop	EQU	002H
pochiturn	EQU	004H
pochijyare	EQU	006H
pochiakirame	EQU	008H
;
pochijyar1	EQU	000H
pochijyar2	EQU	002H
pochijyar3	EQU	004H
pochijyar4	EQU	006H
;
pochi_earth	EQU	000H
pochi_air	EQU	002H
pochi_water	EQU	004H
;
pochiruntm	EQU	06
pochistptm	EQU	08
pochistptm2	EQU	02
pochiturntm	EQU	04
pochiwidarea	EQU	048H
pochiwidarea2	EQU	060H
pochitoparea	EQU	020H
pochiunderarea	EQU	020H
pochiytop	EQU	00100H
pochijumpspd	EQU	0FC00H
pochiyoko	EQU	00020H
pochijyare1tm	EQU	04
pochijyare1ptn	EQU	16
pochijyare2tm	EQU	02
pochijyare2ptn	EQU	06*3
pochijyare2pt2	EQU	03
pochijyare3jmp	EQU	0FE00H
pochijyare3ptn	EQU	04*5
pochijyare4ptn	EQU	04
pochijyare4pt2	EQU	08
pochitamago0	EQU	01CH
pochitamago1	EQU	01CH
pochitamago2	EQU	010H
tamagobound	EQU	0FE00H
pochi_furyoku	EQU	0FF00H
;
pochi_xpower	EQU	00030H
pochi_xpower2	EQU	00008H
pochi_find	EQU	00300H
pochi_jumpready EQU	06
pochi_turnptn	EQU	13
pochi_egg_under EQU	010H
pochi_egg_top	EQU	010H
pochi_egg_hight EQU	(pochi_egg_under+pochi_egg_top)
;
pochi_hanten	EQU	02
pochi_jyare1	EQU	04
pochi_jyare2	EQU	06
pochi_jyare3	EQU	08
;
POCHIDASHPT	EQU	$
		BYTE	pochi03, pochi04, pochi05, pochi06
;
POCHISTOPTIME	EQU	$
		HEX	08, 02
;
POCHISTOPPT	EQU	$
POCHIJYAR3PT	EQU	$
		BYTE	pochi01, pochi02, pochi01, pochi00
		BYTE	pochi01, pochi02, pochi01, pochi00
		BYTE	pochi01, pochi02, pochi01, pochi00
		BYTE	pochi01, pochi02, pochi01, pochi00
		BYTE	pochi01, pochi02, pochi01, pochi00
;
POCHIJYAR1PT	EQU	$
		BYTE	pochi08, pochi09, pochi08, pochi07
		BYTE	pochi08, pochi0C, pochi0B, pochi0A
		BYTE	pochi08, pochi0C, pochi0B, pochi0A
		BYTE	pochi08, pochi09, pochi08, pochi07
;
POCHIJYAR2PT	EQU	$
		BYTE	pochi0E, pochi0F, pochi10, pochi0F
		BYTE	pochi0E, pochi0D
		BYTE	pochi0E, pochi0F, pochi10, pochi0F
		BYTE	pochi0E, pochi0D
		BYTE	pochi0E, pochi0F, pochi10, pochi0F
		BYTE	pochi0E, pochi0D
;
POCHIAKIRAMETM	EQU	$
		HEX	05, 05, 03, 03, 05, 05, 03, 03
		HEX	05, 05, 03, 03, 08
;
POCHIAKIRAMEPT	EQU	$
		BYTE	pochi00, pochi00, pochi11, pochi11
		BYTE	pochi00, pochi00, pochi11, pochi11
		BYTE	pochi00, pochi00, pochi11, pochi11
		BYTE	pochi00
;
POCHIJ3XSPD	EQU	$
		WORD	0FF00H, 00100H
;
POCHIMAXX	EQU	$
		WORD	0FD00H, 00300H
;
POCHIXSPD	EQU	$
		WORD	0FF00H, 00100H
;
POCHIYOKOATARI	EQU	$
		WORD	00008H, 00004H
;
POCHANSYAMINX	EQU	$
		WORD	00100H, 0FF00H
;
POCHIYOKOATARI2 EQU	$
		WORD	-pochiyoko, pochiyoko
;
POCHIRUNTM	EQU	$
		HEX	06, 04, 02, 02
;
;
POCHIIN		EQU	$
		LDA	!POCI_ST_FG
		BEQ	PCIN0080		; ポチ フラグ オン ? [no->PCIN0080]
;
		JMP	>ENCLEAR
;
PCIN0080	EQU	$
		INC	!POCI_ST_FG
		RTL
;
;
;------------------------------------------------------------------------
;-	move (POCHI)							-
;------------------------------------------------------------------------
POCHIMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	!ENYPSL,X
		CMP	#00800H
		BMI	PCMV0020		; クリア ? [no->PCMV0020]
;
		STZ	!POCI_ST_FG
		JMP	>ENCLEAR
;;;;;		JSL	>EN_CLR_CHECK		; 縦 画面クリア チェック
;
PCMV0020	EQU	$
		JSR	POCHIEGGSH		; 卵 サーチ !!
;
		JSR	POCHIENHIT		; 敵 衝突 チェック !!
;
		JSR	POCHIENKILL		; 敵 衝突 チェック !!
;;;;;;;;		JSL	>EN_ENSHOT		; 敵 衝突 チェック !!
;
		LDA	!POCI_ST_FG
		BNE	PCMV0080		; ポチ フラグ オン ? [yes->PCMV0080]
;
		LDA	!ENMOD2,X
		ORA	#0000000000000100B
		STA	!ENMOD2,X		; 範囲クリアー オン !!
PCMV0080	EQU	$
		LDA	<ENCONT,X
		TAX
		JSR	(POCHIMVMD,X)
;
		JSL	>EPCRCK
;
		RTL
;
;
POCHIMVMD	EQU	$
		WORD	POCHIEARTH
		WORD	POCHIAIR
		WORD	POCHIWATER
;
;
KASOKUHABA	EQU	$
		WORD	(pochitamago0+1), -(pochitamago0+1)
;
POCHIEARTH	EQU	$
		LDX	<ENINDX
		LDY	!ENWATR,X
		BEQ	POCHIEARTH0040		; 水中 ? [no->POCHIEARTH0040]
;
		JMP	POCHIWATERIN
;
POCHIEARTH0040	EQU	$
		JSR	POCHIBGCK2		; BG チェック !!
;
		LDY	<ENWRK3,X
		BEQ	PCET0040		; 反転 ? [no->PCET0040]
;
		TYX
		JMP	(PCMODESELECT,X)	; 反転 !!
;
PCMODESELECT	EQU	$
		WORD	POCHITURNNING
		WORD	POCHITURNNING
		WORD	POCHIJYARE_1
		WORD	POCHIJYARE_2
		WORD	POCHIJYARE_1
		WORD	POCHIJYARE_2
;
;
PCET0040	EQU	$
		LDA	!POCI_ST_FG
		BNE	PCET0050		; ポチ フラグ オン ? [yes->PCET0050]
;
		JMP	POCHIBAYBAY		; ポチ 去る !!
;
PCET0050	EQU	$
		LDA	#pochi_find
		STA	<EWORK
		ASL	A
		STA	<EWORK2
		JSR	POCHIPLSH
;
		BCS	PCET0200		; プレイヤー発見 ? [no->PCET0200]
;
		LDA	!PLNAGE
		BNE	PCET0060		; プレイヤー投げポーズ ? [yes->PCET0060]
;
		LDY	<ENWRK2,X
		BEQ	PCET0060		; 卵無 ? [yes->PCET0060]
		BPL	PCET0100		; 卵有 ? [yes->]
;
PCET0060	EQU	$
		LDA	!ENTIM1,X
		BNE	PCET0180		; [->PCET0180]
;
		LDA	!EPXMUK,X
		AND	#000FFH
		DEC	A
		STA	<EWORK2
		LDA	!EPWIDX,X
		STA	<EWORK
		BRA	POCHITURNCHK		; 加速、減速、反転、停止 !!
;
PCET0100	EQU	$
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		STA	<EWORK
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		DEC	A
		STA	<EWORK2
		JMP	POCHITURNCHK2		; 加速、減速、反転、停止 !!
;
PCET0180	EQU	$
		LDA	!ENMUKI,X
		TAY
		DEC	A
		STA	<EWORK2
		LDA	KASOKUHABA,Y
		STA	<EWORK
		JMP	POCHITURNCHK2		; 加速、減速、反転、停止 !!
;
PCET0200	EQU	$
		LDY	<ENWRK2,X
		BEQ	PCET0240		; 卵無 ? [yes->PCET0240]
		BPL	PCET0100		; 卵有 ? [yes->]
;
		LDA	!ENTIM1,X
		BNE	PCET0180		; [->PCET0180]
;
PCET0240	EQU	$
		JMP	PCTNCK0090
;
;
;--------------------------------------------------------
;-	EWORK	<- 幅					-
;-	EWORK2	<- 向き関係 （前:-1, 後:+1）		-
;--------------------------------------------------------
POCHITURNCHK	EQU	$
		STZ	!ENXMAX,X
		LDA	#pochi_xpower2
		STA	!ENXPOW,X
		LDA	<EWORK
		CLC
		ADC	#pochiwidarea
		CMP	#pochiwidarea*2
		BCC	PCTNCK0040		; 加速 ? [no->PCTNCK0040]
;
		LDA	!ENXSPD,X
		BNE	PCTNCK0020		; 停止 ? [no->PCTNCK0020]
;
		STZ	!ENXPOW,X
		LDA	<EWORK2
		INC	A
		CMP	!ENMUKI,X
		BNE	PCTNCK0090		; 反転 ? [yes->PCTNCK0090]
;
PCTNCK0020	EQU	$
		LDY	!ENMUKI,X
		LDA	POCHIMAXX,Y
		STA	!ENXMAX,X
		LDA	#pochi_xpower
		STA	!ENXPOW,X
		BRA	POCHIRUNNING
;
PCTNCK0040	EQU	$
		LDA	!ENXSPD,X
		BEQ	PCTNCK0060		; 停止 ? [yes->PCTNCK0060]
;
		EOR	<EWORK2
		BMI	POCHIRUNNING		; 停止 ? [no->POCHIRUNNING]
;
PCTNCK0060	EQU	$
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
PCTNCK0080	EQU	$
		LDA	<EWORK2
		INC	A
		CMP	!ENMUKI,X
		BEQ	POCHISTOPING		; 反転 ? [no->PCTNCK00A0]
;
PCTNCK0090	EQU	$
		LDY	#pochi_hanten
		STY	<ENWRK3,X		; 反転フラグセット !!
		STZ	<ENWRK0,X
		LDA	POCHIAKIRAMETM
		AND	#000FFH
		STA	!ENTIM0,X
		LDA	POCHIAKIRAMEPT
		AND	#000FFH
		STA	!ENCHPT,X
PCTNCK00A0	EQU	$
		RTS
;
;
POCHISTOPING	EQU	$
		LDA	!ENTIM0,X
		BNE	PCSP00F0		; pattern change ? [no->PCSP00F0]
;
		LDY	#00
		LDA	!PLNAGE
		BEQ	PCSP0040		; プレイヤー投げポーズ ? [no->PCSP0040]
;
		LDY	#01
PCSP0040	EQU	$
		LDA	POCHISTOPTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
		LDA	<ENWRK0,X
		DEC	A
		AND	#00003H
		STA	<ENWRK0,X
		TAY
		LDA	POCHISTOPPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
PCSP00F0	EQU	$
		RTS
;
;
POCHIRUNNING	EQU	$
		LDA	!ENTIM0,X
		BNE	PCRN00F0		; pattern change ? [no->PCRN00F0]
;
		LDA	!ENXSPD,X
		ABS16
		XBA
		AND	#00003H
		TAY
		LDA	POCHIRUNTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
		LDA	<ENWRK0,X
		INC	A
		AND	#00003H
		STA	<ENWRK0,X
		TAY
		LDA	POCHIDASHPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
PCRN00F0	EQU	$
		RTS
;
;
POCHITURNNING	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	PCTN00F0		; pattern change ? [no->PCTN00F0]
;
		LDA	<ENWRK0,X
		INC	A
		CMP	#pochi_turnptn
		BCS	PCTN0100		; 反転モード終り ? [yes->PCTN0100]
;
		STA	<ENWRK0,X
		TAY
		AND	#00003H
		CMP	#00003H
		BNE	PCTN0040		; 向きチェンジ ? [no->PCTN0040]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
PCTN0040	EQU	$
		LDA	POCHIAKIRAMETM,Y
		AND	#000FFH
		STA	!ENTIM0,X
		LDA	POCHIAKIRAMEPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
PCTN00F0	EQU	$
		RTS
;
;
PCTN0100	EQU	$
		LDY	#00
		STY	<ENWRK3,X
		LDY	<ENWRK2,X
		BPL	PCTN0140		; [->PCTN0140]
;
		LDY	#00
		STY	<ENWRK2,X
PCTN0140	EQU	$
		STZ	<ENWRK0,X
		RTS
;
;
;--------------------------------------------------------
;-	EWORK	<- 幅					-
;-	EWORK2	<- 向き関係 （前:-1, 後:+1）		-
;--------------------------------------------------------
POCHITURNCHK2	EQU	$
		STZ	!ENXMAX,X
		LDA	#pochi_xpower2
		STA	!ENXPOW,X
		LDA	<EWORK
		CLC
		ADC	#pochitamago0
		CMP	#pochitamago0*2
		BCC	PCTNCK2040		; 加速 ? [no->PCTNCK2040]
;
		LDA	!ENXSPD,X
		BNE	PCTNCK2020		; 停止 ? [no->PCTNCK2020]
;
		STZ	!ENXPOW,X
		LDA	<EWORK2
		INC	A
		CMP	!ENMUKI,X
		BNE	PCTNCK20A0		; 反転 ? [yes->PCTNCK20A0]
;
PCTNCK2020	EQU	$
		LDY	!ENMUKI,X
		LDA	POCHIMAXX,Y
		STA	!ENXMAX,X
		LDA	#pochi_xpower
		STA	!ENXPOW,X
		JMP	POCHIRUNNING
;
PCTNCK2040	EQU	$
		LDA	!ENXSPD,X
		BEQ	PCTNCK2060		; 停止 ? [yes->PCTNCK2060]
;
		EOR	<EWORK2
		BPL	PCTNCK2060		; 停止 ? [yes->PCTNCK2060]
;
		JMP	POCHIRUNNING		; 停止 ? [no->POCHIRUNNING]
;
PCTNCK2060	EQU	$
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
PCTNCK2080	EQU	$
		LDA	<EWORK2
		INC	A
		CMP	!ENMUKI,X
		BNE	PCTNCK20A0		; 反転 ? [yes->PCTNCK20A0]
;
		LDY	<ENWRK2,X
		LDA	!ENSHOT,Y
		BEQ	POCHIJYARE		; じゃれる ? [yes->POCHIJYARE]
;
		JMP	POCHISTOPING		; [->POCHISTOPING]
;
PCTNCK20A0	EQU	$
		JMP	PCTNCK0090
;
;
POCHIJYARE	EQU	$
		LDA	!ECENTY,X
		SEC
		SBC	!ECENTY,Y
		CLC
		ADC	#pochi_egg_under
		CMP	#pochi_egg_hight
		BCC	PCJY0040		; じゃれる ? [yes->PCJY0040]
;
		JMP	POCHIJUMP2
;
PCJY0040	EQU	$
		M8				; memory 8bit mode !!
;
		LDA	<RANDM0
		AND	#00006H
		CLC
		ADC	#pochi_jyare1
		STA	<ENWRK3,X
		TAX
;
		M16				; memory 16bit mode !!
;
		JMP	(PCJYNODSELIN,X)
;
PCJYNODSELIN	EQU	$
		WORD	POCHIJYARE_1IN
		WORD	POCHIJYARE_1IN
		WORD	POCHIJYARE_1IN
		WORD	POCHIJYARE_2IN
		WORD	POCHIJYARE_1IN
		WORD	POCHIJYARE_3IN
;
;
POCHIJYARE_1IN	EQU	$
		LDX	<ENINDX
		LDA	#pochijyare1ptn-1
		STA	<ENWRK0,X
		TAY
		LDA	POCHIJYAR1PT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#pochijyare1tm
		STA	!ENTIM0,X
		RTS
;
;
POCHIJYARE_1	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	PJ10080			; pattern change ? [no->PJ10080]
;
		DEC	<ENWRK0,X
		BMI	PJ10100			; [->PJ10100]
;
		LDY	<ENWRK0,X
		LDA	POCHIJYAR1PT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#pochijyare1tm
		STA	!ENTIM0,X
		CPY	#09
		BNE	PJ10080			; [->PJ10080]
;
		LDY	<ENWRK2,X
		LDA	#tamagobound
		STA	!ENYSPD,Y
		LDA	#00040H
		STA	!ENGPOW,Y
		LDA	#01
		STA	!ENSHOT,Y
PJ10080		EQU	$
		RTS
;
;
PJ10100		EQU	$
		LDY	#00
		STY	<ENWRK3,X
		RTS
;
;
POCHIJYARE_2IN	EQU	$
		LDX	<ENINDX
		LDA	#pochijyare2ptn-1
		STA	<ENWRK0,X
		TAY
		LDA	POCHIJYAR2PT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#pochijyare2tm
		STA	!ENTIM0,X
		RTS
;
;
POCHIJYARE_2	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	PJ20080			; pattern change ? [no->PJ20080]
;
		DEC	<ENWRK0,X
		BMI	PJ10100			; [->PJ10100]
;
		LDY	<ENWRK0,X
		LDA	POCHIJYAR2PT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#pochijyare2tm
		STA	!ENTIM0,X
PJ20080		EQU	$
		RTS
;
;
POCHIJYARE_3IN	EQU	$
		LDX	<ENINDX
		LDA	#pochijyare3ptn-1
		STA	<ENWRK0,X
		TAY
		LDA	POCHIJYAR3PT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#pochijyare2tm
		STA	!ENTIM0,X
		RTS
;
;
POCHIBGCK2	EQU	$
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	POCHIAIRIN		; 空中 ? [yes->POCHIAIRIN]
;
		BIT	#0000000000001100B
		BNE	POCHIJUMP		; 横あたり ? [yes->POCHIJUMP]
;
		RTS
;
;
PCJRXSPD	EQU	$
		WORD	0FF00H, 00100H
;
POCHIJUMP	EQU	$
		PLA
POCHIJUMP2	EQU	$
		LDA	<ENWRK4,X
		BNE	PCJMP0040		; [->PCJMP0040]
;
		LDA	#pochi_jumpready
		STA	!ENTIM0,X
		LDA	#pochi0D
		STA	!ENCHPT,X
		INC	<ENWRK4,X
PCJMP0040	EQU	$
		LDY	!ENMUKI,X
		LDA	PCJRXSPD,Y
		STA	!ENXSPD,X
		STZ	!ENXPOW,X
		LDA	!ENTIM0,X
		BNE	PCJMP0080		; [->PCJMP0080]
;
		LDA	#pochijumpspd
		STA	!ENYSPD,X
		STZ	<ENWRK4,X
PCJMP0080	EQU	$
		RTS
;
;
POCHIAIRIN	EQU	$
		LDA	#pochi_air
		STA	<ENCONT,X
		PLA
		RTS
;
;
POCHIAIR	EQU	$
		LDX	<ENINDX
		LDA	!ENYSPD,X
		BMI	POCAIR0020		; 上昇中 ? [yes->POCAIR0020]
;
		LDY	!ENWATR,X
		BNE	POCHIWATERIN		; 水中 ? [yes->POCHIWATERIN]
;
POCAIR0020	EQU	$
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BNE	POCAIR0200		; 空中 ? [no->POCAIR0200]
;
		LDY	!ENMUKI,X
		LDA	PCJRXSPD,Y
		STA	!ENXSPD,X
		LDA	!ENYSPD,X
		CLC
		ADC	#pochiytop
		CMP	#pochiytop*2
		BCS	POCAIR0040		; top point ? [no->POCAIR0040]
;
		LDA	#pochi04
		BRA	POCAIR0100
;
POCAIR0040	EQU	$
		LDA	!ENYSPD,X
		BPL	POCAIR0080		; down ? [yes->POCAIR0080]
;
		LDA	#pochi03
		BRA	POCAIR0100
;
POCAIR0080	EQU	$
		LDA	#pochi05
POCAIR0100	EQU	$
		STA	!ENCHPT,X
		RTS
;
;
POCAIR0200	EQU	$
		LDA	#pochi_earth
		STA	<ENCONT,X
		RTS
;
;
POCHIWATERBGCK	EQU	$
		LDA	!ENCBFG,X
		BIT	#0000000000001100B
		BEQ	PCWTRBGCK00F0		; 横当たり ? [no->PCWTRBGCK00F0]
;
		LDA	#0FC00H
		STA	!ENYSPD,X
		LDA	#00400H
		STA	!ENGMAX,X
		LDA	#00040H
		STA	!ENGPOW,X
		STZ	<ENWRK0,X
		STZ	<ENWRK2,X
		STZ	<ENWRK4,X
		STZ	!ENWRK6,X
		STZ	!ENWRK8,X
		STZ	!ENWRKA,X
		STZ	!ENWRKC,X
		BRA	POCHIAIRIN
;
PCWTRBGCK00F0	EQU	$
		RTS
;
;
POCHIWATERIN	EQU	$
		STZ	<ENWRK2,X		; 卵インデックスクリア !!
		STZ	<ENWRK4,X
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		STZ	<ENWRK0,X
		LDA	#pochi_water
		STA	<ENCONT,X
		RTS
;
;
POCHIWATERPT	EQU	$
		BYTE	pochi05, pochi06
;
POCHIWATER	EQU	$
		LDX	<ENINDX
		LDA	<ENWRK4,X
		TAX
		JMP	(POCHIWATERMDSEL,X)
;
POCHIWATERMDSEL EQU	$
		WORD	POCHIWATER0000
		WORD	POCHIWTRTN
;
;
POCHIWATER0000	EQU	$
		LDX	<ENINDX
		JSR	POCHIWATERBGCK
;
		JSR	POCHIEGGSH2		; 卵サーチ !!
;
		JSR	POCHIWATERMOVE
;
		LDA	!ENTIM0,X
		BNE	POCHIWATER01F0		; [->POCHIWATER01F0]
;
		M8				; memory 8bit mode !!
;
		LDA	<ENWRK0,X
		EOR	#01
		STA	<ENWRK0,X
		LDY	<ENWRK0,X
		LDA	POCHIWATERPT,Y
		STA	!ENCHPT,X
		LDA	#04
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
POCHIWATER01F0	EQU	$
		RTS
;
;
POCHIWATERMOVE	EQU	$
		LDA	!ENTIM2,X
		BNE	PCWTRMV0100		; [->PCWTRMV0100]
;
		LDY	!ENWATR,X
		BEQ	PCWTRMV0080		; [->PCWTRMV0080]
;
		LDA	#pochi_furyoku
		STA	!ENGMAX,X
		LDA	#00020H
		STA	!ENGPOW,X
		LDA	#00
		STA	!ENTIM2,X
		BRA	PCWTRMV0100
;
PCWTRMV0080	EQU	$
		LDA	#00400H
		STA	!ENGMAX,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#16
		STA	!ENTIM2,X
PCWTRMV0100	EQU	$
		RTS
;
;
POCHI_WATERXSPD EQU	$
		WORD	-00200H,  00200H
;
POCHIEGGSH2	EQU	$
		STZ	!ENXSPD,X
		TXA
		STA	R1
		M_CHIP	SHOTENSR
;
		LDX	<ENINDX
		LDY	R1
		BMI	PCEGS200F0		; shot on ? [no->PCEGS200F0]
;
		LDA	!ENMYNO,Y
		CMP	#EGG00
		BCC	PCEGS200F0		; 卵 ? [no->PCEGS200F0]
;
		CMP	#EGG09+1
		BCS	PCEGS200F0		; 卵 ? [no->PCEGS200F0]
;
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		STA	<EWORK
		LDA	!ENMUKI,X
		DEC	A
		EOR	<EWORK
		BPL	POCHIWTRTNIN		; 反転 ? [yes->POCHIWTRTNIN]
;
PCEGS20080	EQU	$
		LDY	!ENMUKI,X
		LDA	POCHI_WATERXSPD,Y
		STA	!ENXSPD,X
		RTS
;
PCEGS200F0	EQU	$
		LDA	!EPXMUK,X
		AND	#000FFH
		CMP	!ENMUKI,X
		BEQ	PCEGS20080		; 反転 ? [no->PCEGS20080]
;
POCHIWTRTNIN	EQU	$
		LDA	#0002
		STA	<ENWRK4,X
		LDA	#(POCHIWTRTN-POCHIWTRTNPT-1)
		STA	<ENWRK0,X
		LDA	#0004
		STA	!ENTIM0,X
		STZ	!ENXSPD,X
		RTS
;
;
POCHIWTRTNPT	EQU	$
		BYTE	pochi00, pochi11, pochi11, pochi00
;
POCHIWTRTN	EQU	$
		LDX	<ENINDX
		JSR	POCHIWATERMOVE
;
		LDA	!ENTIM0,X
		BNE	POCHIWTRTN00F0		; pattern change ? [no->POCHIWTRTN00F0]
;
		DEC	<ENWRK0,X
		BMI	POCHIWTRTN0100		; [->POCHIWTRTN0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	POCHIWTRTNPT,Y
		STA	!ENCHPT,X
		LDA	#0004
		STA	!ENTIM0,X
		CPY	#01
		BNE	POCHIWTRTN0080		; 反転 ? [no->POCHIWTRTN0080]
;
		LDA	!ENMUKI,X
		EOR	#002H
		STA	!ENMUKI,X
POCHIWTRTN0080	EQU	$
;
		M16				; memory 16bit mode !!
;
POCHIWTRTN00F0	EQU	$
		RTS
;
POCHIWTRTN0100	EQU	$
		STZ	<ENWRK0,X
		STZ	<ENWRK4,X
		RTS
;
;
POCHIBAYBAY	EQU	$
		LDA	!EPXMUK,X
		AND	#000FFH
		CMP	!ENMUKI,X
		BNE	PCBY0040		; プレイヤー 後 ? [yes->PCBY0040]
;
		LDA	!ENXSPD,X
		BEQ	PCBY0020		; 停止 ? [yes->PCBY0020]
;
		STZ	!ENXMAX,X
		LDA	#pochi_xpower2
		STA	!ENXPOW,X
		LDA	!ENMUKI,X
		DEC	A
		EOR	!ENXSPD,X
		BMI	PCBY0030		; 停止 ? [no->PCBY0030]
;
		STZ	!ENXSPD,X
PCBY0020	EQU	$
		STZ	!ENXPOW,X
		JMP	PCTNCK0090
;
PCBY0030	EQU	$
		JMP	POCHIRUNNING
;
PCBY0040	EQU	$
		LDY	!ENMUKI,X
		LDA	POCHIMAXX,Y
		STA	!ENXMAX,X
		LDA	#pochi_xpower
		STA	!ENXPOW,X
		JMP	POCHIRUNNING
;
;--------------------------------------------------------
;--------------------------------------------------------
POCHIEGGSH	EQU	$
		TXA
		STA	R1
		M_CHIP	SHOTENSR
;
		LDX	<ENINDX
		LDY	R1
		BMI	PCEGSH0040		; shot on ? [no->PCEGSH0040]
;
		LDA	!ENMYNO,Y
		CMP	#EGG00
		BCC	PCEGSH0040		; 卵 ? [no->PCEGSH0040]
;
		CMP	#EGG09+1
		BCS	PCEGSH0040		; 卵 ? [no->PCEGSH0040]
;
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		CLC
		ADC	#00100H
		CMP	#00200H
		BCS	PCEGSH0040		; 横範囲内 ? [no->PCEGSH0040]
;
		LDA	!ECENTY,X
		SEC
		SBC	!ECENTY,Y
		CLC
		ADC	#00100H
		CMP	#00200H
		BCS	PCEGSH0040		; 縦範囲内 ? [no->PCEGSH0040]
;
		STY	<ENWRK2,X		; 卵インデックスセーブ !!
PCEGSH0040	EQU	$
		LDY	<ENWRK2,X
		BEQ	PCEGSH00E0		; 卵有 ? [no->PCEGSH00C0]
		BMI	PCEGSH00E0		; 卵有 ? [no->PCEGSH00C0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	PCEGSH00A0		; mode move ? [no->PCEGSH00A0]
;
		LDA	!ENMYNO,Y
		CMP	#EGG00
		BCC	PCEGSH00A0		; 卵 ? [no->PCEGSH00A0]
;
		CMP	#EGG09+1
		BCS	PCEGSH00A0		; 卵 ? [no->PCEGSH00A0]
;
		LDA	!ENWRK4,Y
		BNE	PCEGSH00A0		; プレイヤー子分 ? [yes->PCEGSH00A0]
;
		LDA	!ENDSXL,Y
		CLC
		ADC	#00030H
		CMP	#00150H
		BCS	PCEGSH00A0		; [->PCEGSH00A0]
;
		LDA	!ENDSYL,Y
		CLC
		ADC	#00030H
		CMP	#00150H
		BCS	PCEGSH00A0		; [->PCEGSH00A0]
;
		BRA	PCEGSH00C0
;
PCEGSH00A0	EQU	$
		LDA	#0032
		STA	!ENTIM1,X
		LDY	#-1
		STY	<ENWRK2,X
		BRA	PCEGSH00D0
;
PCEGSH00C0	EQU	$
		LDA	!ENDSXL,X
		CLC
		ADC	#00028H
		CMP	#00128H
		BCC	PCEGSH00E0		; 卵あきらめ ? [no->PCEGSH00E0]
;
PCEGSH00D0	EQU	$
		STZ	!ENTIM1,X
		LDY	#00
		STY	<ENWRK2,X
		STZ	!ENXPOW,X
		STZ	!ENXSPD,X
		STZ	!ENXMAX,X
PCEGSH00E0	EQU	$
		RTS
;
;
;--------------------------------------------------------
;-	EWORK <- x hankei				-
;-	EWORK2 <- x width				-
;--------------------------------------------------------
POCHIPLSH	EQU	$
		LDA	!ECENTY,X
		SEC
		SBC	!PCENTY
		STA	<EWORK8
		LDA	!ECENTX,X
		SEC
		SBC	!PCENTX
		PHA
		ABS16
		STA	<EWORK4			; x kyori save !!
		PLA
		CLC
		ADC	<EWORK
		CMP	<EWORK2
		BCS	PPSH0100		; aria in ? [no->PPSH0100]
;
		LDA	<EWORK4
		ASL	A
		STA	<EWORK4
		ASL	A
		STA	<EWORK6
		LDA	<EWORK8
		CLC
		ADC	<EWORK4
		CMP	<EWORK6
		BCC	PPSH0100		; aria in ? [yes->PPSH0100]
;
		LDA	<EWORK8
		CLC
		ADC	#pochiunderarea
		BPL	PPSH0080		; area in ? [yes->PPSH0080]
;
		SEC
		BRA	PPSH0100
;
PPSH0080	EQU	$
		CLC
PPSH0100	EQU	$
		RTS
;
;
POCHIBOUND	EQU	$
		WORD	00200H, 0FE00H
;
POCHIENHIT	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	PCHT0100		; 敵 衝突 ? [no->PCHT0100]
		BEQ	PCHT0100		; 赤ちゃん 衝突 ? [yes->PCHT0100]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	PCHT0100		; mode move ? [no->PCHT0100]
;
		LDA	!ENMYNO,Y
		CMP	#EGG00
		BCC	PCHT0100		; 卵 ? [no->PCHT0100]
;
		CMP	#EGG09+1
		BCS	PCHT0100		; 卵 ? [no->PCHT0100]
;
		LDA	!ENWRK4,Y
		BNE	PCHT0100		; 子分 ? [yes->PCHT0100]
;
		LDA	#01
		STA	!ENSHOT,Y
		LDA	#00040H
		STA	!ENGPOW,Y
		LDA	#0FC00H
		STA	!ENYSPD,Y
		LDA	!ECROSX,X
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAX
		LDA	POCHIBOUND,X
		STA	!ENXSPD,Y
		LDX	<ENINDX
PCHT0100	EQU	$
		RTS
;
;
POCHIENKILL	EQU	$
		TXA
		STA	R1
		M_CHIP	MY_ENCROS2
;
		LDX	<ENINDX
		LDY	R14
		BMI	POCHIENKILL00F0		; 敵 衝突 ? [no->POCHIENKILL00F0]
		BEQ	POCHIENKILL00F0		; 赤ちゃん 衝突 ? [yes->POCHIENKILL00F0]
;
		LDA	!ENMODE,Y
		CMP	#EFAIL
		BCC	POCHIENKILL00F0		; MODE OK ? [no->POCHIENKILL00F0]
;
		LDA	!ENMOD1,Y
		BIT	#0110000000000000B
		BNE	POCHIENKILL00F0		; 敵 ? [no->POCHIENKILL00F0]
;
		LDA	!ENXSPD,X
		BNE	POCHIENKILL0040		; ポチ動いてる ? [yes->POCHIENKILL0040]
;
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BNE	POCHIENKILL00F0		; ポチ動いてる ? [no->POCHIENKILL00F0]
;
POCHIENKILL0040 EQU	$
		TYX
		JSL	>ENDEATH_SET
;
		LDX	<ENINDX
POCHIENKILL00F0 EQU	$
		RTS
;
POCHIENKILL0100 EQU	$
		LDA	#0001
		STA	!ENSHOT,Y	;enemy shot flag "ON" !!
		LDA	#0400H
		STA	!ENGMAX,Y	;max G power set
		LDA	#040H
		STA	!ENGPOW,Y	;G power set
		LDA	#0000
		STA	!ENXPOW,Y	;X power set
		STA	!ENCBFG,Y	;行ったり来りしない様に
		STA	!ENWRK0,Y	;bound flag set
;
		LDA	!ECROSX,Y
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAX
		LDA	EN_ENSHOT_XSPD,X
		STA	!ENXSPD,Y
		LDA	#0FE00H
		STA	!ENYSPD,Y
		LDX	<ENINDX
		RTS
;
;
;------------------------------------------------------------------------
;-	initial (MITSN)							-
;------------------------------------------------------------------------
mitsan00	EQU	000H
mitsan01	EQU	001H
mitsan02	EQU	002H
mitsan03	EQU	003H
mitsan04	EQU	004H
mitsan05	EQU	005H
mitsan06	EQU	006H
mitsan07	EQU	007H
mitsan08	EQU	008H
mitsan09	EQU	009H
mitsan0A	EQU	00AH
mitsan0B	EQU	00BH
mitsan0C	EQU	00CH
mitsan0D	EQU	00DH
mitsan0E	EQU	00EH
mitsan0F	EQU	00FH
mitsan10	EQU	010H
mitsan11	EQU	011H
mitsan12	EQU	012H
mitsan13	EQU	013H
mitsan14	EQU	014H
mitsan15	EQU	015H
mitsan16	EQU	016H
mitsan17	EQU	017H
mitsan18	EQU	018H
mitsan19	EQU	019H
mitsan1A	EQU	01AH
mitsan1B	EQU	01BH
mitsan1C	EQU	01CH
mitsan1D	EQU	01DH
;
mitsanwalkptn	EQU	05
mitsanthrowptn	EQU	18
mitsanwalktm	EQU	04
mitsan_turntime EQU	(62*2)
mitsan_sliptime EQU	62
mitsanmotiontm	EQU	04
mitsanmotionptn EQU	02
mitsanwidth	EQU	030H
mitsantop	EQU	030H
mitsanunder	EQU	020H
eggrelease	EQU	11
throwspeed	EQU	006F0H
;
mitsanwalk	EQU	000H
mitsancatch	EQU	002H
mitsanmotion	EQU	004H
mitsanthrow	EQU	006H
mitsanslip	EQU	008H
;
MITSANWALKPT	EQU	$
		BYTE	mitsan00, mitsan01, mitsan02, mitsan03
		BYTE	mitsan04
;
MITSANMOTIONPT	EQU	$
		BYTE	mitsan05, mitsan06
;
MITSANTHROWPT	EQU	$
		BYTE	mitsan07, mitsan08, mitsan09, mitsan0A
		BYTE	mitsan0B, mitsan0C, mitsan0D, mitsan0E
		BYTE	mitsan0F, mitsan10, mitsan11, mitsan12
		BYTE	mitsan13, mitsan12, mitsan11, mitsan14
		BYTE	mitsan15, mitsan05
;
MITSANREVIVEPT	EQU	$
		BYTE	mitsan18, mitsan19, mitsan1A, mitsan19
		BYTE	mitsan1B, mitsan19, mitsan1A, mitsan19
		BYTE	mitsan1B, mitsan19, mitsan1A, mitsan19
		BYTE	mitsan1B, mitsan19, mitsan19, mitsan1C
		BYTE	mitsan1D, mitsan1C
;
MITSANTHROWTM	EQU	$
		HEX	04, 04, 10, 04, 04, 04, 20, 03
		HEX	02, 01, 01, 01, 10, 04, 04, 04
		HEX	04, 10
;
MITSANCOL	EQU	$
		WORD	00000H, 00002H, 00004H, 00008H
;
MITSANXSPD	EQU	$
		WORD	0FFA0H, 00060H
;
MITSANSMK0XP	EQU	$
		WORD	00006H, 0FFFAH
;
MITSANSMK1XP	EQU	$
		WORD	00001H, 0FFFFH
;
MITSANEGGX	EQU	$
		WORD	0FFFDH, 00003H, 0FFFEH, 00002H	; 00, 01
		WORD	0FFFEH, 00002H, 0FFFDH, 00003H	; 02, 03
		WORD	0FFFDH, 00003H, 0FFFEH, 00002H	; 04, 05
		WORD	0FFFCH, 00004H, 0FFFCH, 00004H	; 06, 07
		WORD	00000H, 00000H, 00002H, 0FFFEH	; 08, 09
		WORD	00003H, 0FFFDH, 00005H, 0FFFBH	; 0A, 0B
		WORD	00009H, 0FFF7H, 0000FH, 0FFF1H	; 0C, 0D
		WORD	0000FH, 0FFF1H, 0000CH, 0FFF4H	; 0E, 0F
		WORD	0FFFFH, 00001H, 0FFF8H, 00008H	; 10, 11
		WORD	0FFF8H, 00008H, 0FFF8H, 00008H	; 12, 13
		WORD	0FFFAH, 00006H, 0FFFDH, 00003H	; 14, 15
		WORD	0FFECH, 00014H, 0FFF6H, 0000AH	; 16, 17
;
MITSANEGGY	EQU	$
		WORD	0FFF8H, 0FFF8H, 0FFF7H, 0FFF7H	; 00, 01
		WORD	0FFF6H, 0FFF6H, 0FFF7H, 0FFF7H	; 02, 03
		WORD	0FFF8H, 0FFF8H, 0FFF8H, 0FFF8H	; 04, 05
		WORD	0FFF8H, 0FFF8H, 0FFF7H, 0FFF7H	; 06, 07
		WORD	0FFF7H, 0FFF7H, 0FFF5H, 0FFF5H	; 08, 09
		WORD	0FFF6H, 0FFF6H, 0FFF7H, 0FFF7H	; 0A, 0B
		WORD	0FFF7H, 0FFF7H, 0FFFDH, 0FFFDH	; 0C, 0D
		WORD	0FFFBH, 0FFFBH, 0FFF8H, 0FFF8H	; 0E, 0F
		WORD	0FFF0H, 0FFF0H, 0FFF8H, 0FFF8H	; 10, 11
		WORD	0FFFAH, 0FFFAH, 0FFFBH, 0FFFBH	; 12, 13
		WORD	0FFF8H, 0FFF8H, 0FFF7H, 0FFF7H	; 14, 15
		WORD	0FFFCH, 0FFFCH, 0FFEAH, 0FFEAH	; 16, 17
;
MITSNIN		EQU	$
		LDA	#-1
		STA	<ENWRK2,X
		STZ	!ENWRKA,X
		JSR	MITSANWALKIN
;
		RTL
;
;
;------------------------------------------------------------------------
;-	move (MITSN)							-
;------------------------------------------------------------------------
MITSNMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	!ENCHPT,X
		CMP	#mitsan0D
		BNE	MTSNMV0070		; tenmetu ? [no->MTSNMV0070]
;
		LDA	<FRCNT2
		AND	#00006H
		TAY
		LDA	!ENCLOR,X
		AND	#0FFF1H
		ORA	MITSANCOL,Y
		BRA	MTSNMV0080
;
MTSNMV0070	EQU	$
		LDA	!ENCLOR,X
		AND	#0FFF1H
MTSNMV0080	EQU	$
		STA	!ENCLOR,X
;
		LDA	!ENWRKA,X
		BEQ	MTSNMV00A0		; 気絶 ? [no->MTSNMV00A0]
;
		JMP	MITSANREVIVE		; 復活処理 !!
;
MTSNMV00A0	EQU	$
		JSL	>EPFOOTCROSS		; 踏まれたチェック!!
;
		BCS	MTSNMV0100		; 踏まれた ? [yes->MTSNMV0100]
;
		LDA	<ENCONT,X
		TAX
		JSR	(MITSANSELECT,X)
;
		JSL	>EPCRCK
;
		RTL
;
MTSNMV0100	EQU	$
		JMP	MITSANREVIVEIN
;
MITSANSELECT	EQU	$
		WORD	MITSANWALK
		WORD	MITSANCATCH
		WORD	MITSANMOTION
		WORD	MITSANTHROW
		WORD	MITSANSLIP
;
MITSANWALKIN	EQU	$
		LDY	!ENMUKI,X
		LDA	MITSANXSPD,Y
		STA	!ENXSPD,X
		STZ	<ENWRK0,X
		LDA	MITSANWALKPT
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#mitsanwalktm
		STA	!ENTIM0,X
		LDA	#mitsan_turntime
		STA	!ENTIM1,X
		LDA	#mitsanwalk
		STA	<ENCONT,X
		RTS
;
;
MITSANWALK	EQU	$
		LDX	<ENINDX
		JSR	MITSANSEARCH		; search shot enmy !!
;
		BMI	MTSNWK0000		; shot enmy on ? [no->MTSNWK0000]
;
		JSL	>EN_EN_XSPD
;
		BPL	MTSNWK0008		; shot enmy on ? [yes->MTSNWK0008]
;
MTSNWK0000	EQU	$
		CPX	!PLNAGE_IX
		BNE	MTSNWK0010		; target ? [no->MTSNWK0010]
;
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	<EWORK2
MTSNWK0008	EQU	$
		JMP	MITSANCATCHIN
;
MTSNWK0010	EQU	$
		JSR	STOPEGGCRCK		; egg cross check !!
;
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	MTSNWK0020		; ashi hit ? [no->MTSNWK0020]
;
		AND	#0000000000001100B
		BEQ	MTSNWK0030		; side hit ? [no->MTSNWK0030]
;
MTSNWK0020	EQU	$
		LDA	!ENXPSL,X
		SEC
		SBC	!ENMOVX,X
		STA	!ENXPSL,X
		JMP	MITSANTURN		; turn !!
;
MTSNWK0030	EQU	$
		LDA	!ENTIM0,X
		BNE	MTSNWK00F0		; pattern change ? [no->MTSNWK00F0]
;
		LDA	!ENTIM1,X
		BNE	MTSNWK0040		; turn ? [no->MTSNWK0040]
;
		JSR	MITSANTURN		; turn !!
;
MTSNWK0040	EQU	$
;
		M8				; memory 8bit mode !!
;
		LDA	!ENWRK0,X
		INC	A
		CMP	#mitsanwalkptn
		BCC	MTSNWK0080		; [->MTSNWK0080]
;
		LDA	#00
MTSNWK0080	EQU	$
		STA	!ENWRK0,X
		TAY
		LDA	MITSANWALKPT,Y
		STA	!ENCHPT,X
		LDA	#mitsanwalktm
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
MTSNWK00F0	EQU	$
		RTS
;
;
STOPEGGCRCK	EQU	$
		LDY	!ECRSFG,X
		DEY
		BEQ	STEGCC00F0		; baby ? [yes->STEGCC00F0]
		BMI	STEGCC00F0		; enemy ? [no->STEGCC00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	STEGCC00F0		; move ? [no->STEGCC00F0]
;
		LDA	!ENMYNO,Y
		CMP	#EGG00
		BCC	STEGCC00F0		; egg ? [no->STEGCC00F0]
;
		CMP	#EGG09+1
		BCS	STEGCC00F0		; egg ? [no->STEGCC00F0]
;
		LDA	#00005H
		STA	!ENYUSN,Y
		LDA	#00
		STA	!ENXPOW,Y
		STA	!ENGPOW,Y
		STA	!ENXSPD,Y
		STA	!ENYSPD,Y
		STA	!ENSHOT,Y
		LDA	!ENMOD0,Y
		ORA	#0000000001000000B
		STA	!ENMOD0,Y		; 食べれないセット
		LDA	!ENMOD1,Y
		AND	#1111111111100000B	; ＢＧチェックＯＦＦ！！
		STA	!ENMOD1,Y
		LDA	!ENMOD2,Y
		AND	#1111111111110011B	; 範囲外クリアＯＦＦ！！
		STA	!ENMOD2,Y
		LDA	#-1
		STA	!ENWRK6,Y
		STY	<ENWRK2,X		; egg index save !!
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		PLA
		JMP	MITSANMOTIONIN
;
STEGCC00F0	EQU	$
		RTS
;
;
MITSANTURN	EQU	$
		LDA	!ENMUKI,X
		EOR	#02
		STA	!ENMUKI,X
		TAY
		LDA	MITSANXSPD,Y
		STA	!ENXSPD,X
		LDA	#mitsan_turntime
		STA	!ENTIM1,X
		RTS
;
;
MITSANCATCHIN	EQU	$
		STZ	!ENXSPD,X
		LDA	<EWORK2
		STA	!ENMUKI,X
		LDA	#mitsan16
		STA	!ENCHPT,X
		LDA	#mitsancatch
		STA	<ENCONT,X
		STZ	!ENTIM0,X
		RTS
;
;
MITSANCATCH	EQU	$
		LDX	<ENINDX
		LDY	!ECRSFG,X
		DEY
		BEQ	MTSNCT0010		; baby ? [yes->MTSNCT0010]
		BPL	MTSNCT0020		; enmy hit ? [yes->MTSNCT0100]
;
MTSNCT0010	EQU	$
		JMP	MTSNCT0100
;
MTSNCT0020	EQU	$
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	MTSNCT0010		; move ? [no->MTSNCT0010]
;
		LDA	!ENSHOT,Y
		BEQ	MTSNCT0010		; shot ? [no->MTSNCT0010]
;
		JSL	>EN_EN_XPOS		; enemy x posistion check
		BMI	MTSNCT0100		; front ? [no->MTSNCT0100]
;
		LDA	!ENMYNO,Y
		CMP	#EGG00
		BCC	MTSNCT0100		; egg ? [no->MTSNCT0100]
;
		CMP	#EGG09+1
		BCS	MTSNCT0100		; egg ? [no->MTSNCT0100]
;
		LDA	!ENGPOW,Y
		CMP	#00040H
		BCS	MTSNCT0060		; slip ? [no->MTSNCT0060]
;
		LDA	!ENXSPD,Y
		CMP	#08000H
		ROR	A
		STA	!ENXSPD,X
		LDA	#00040H
		STA	!ENXPOW,X
MTSNCT0060	EQU	$
		LDA	#00005H
		STA	!ENYUSN,Y
		LDA	#00
		STA	!ENXPOW,Y
		STA	!ENGPOW,Y
		STA	!ENXSPD,Y
		STA	!ENYSPD,Y
		STA	!ENSHOT,Y
		LDA	#-1
		STA	!ENWRK6,Y
		LDA	!ENMOD0,Y
		ORA	#0000000001000000B
		STA	!ENMOD0,Y		; 食べれないセット
		LDA	!ENMOD1,Y
		AND	#1111111111100000B	; ＢＧチェックＯＦＦ！！
		STA	!ENMOD1,Y
		LDA	!ENMOD2,Y
		AND	#1111111111110011B	; 範囲外クリアＯＦＦ！！
		STA	!ENMOD2,Y
		TYA
		AND	#000FFH
		STA	<ENWRK2,X
;
		LDA	!ECENTY,X
		SEC
		SBC	#00010H
		SEC
		SBC	!ECENTY,Y
		BCC	MTSNCT0080		; top catch ? [no->MTSNCT0080]
;
		JSR	MITSANCATCH02
		BRA	MTSNCT0090
;
MTSNCT0080	EQU	$
		JSR	MITSANCATCH01
MTSNCT0090	EQU	$
		JMP	MITSANSLIPIN
;
;
MTSNCT0100	EQU	$
		LDA	!ENTIM0,X
		BNE	MTSNCT0190		; timer zero ? [no->MTSNCT0190]
;
		JSR	MITSANSEARCH		; search shot enmy !!
;
		BMI	MTSNCT0140		; shot enmy on ? [no->MTSNCT0140]
;
		JSL	>EN_EN_XSPD
;
		BPL	MTSNCT0180		; shot enmy on ? [yes->MTSNCT0180]
;
MTSNCT0140	EQU	$
		CPX	!PLNAGE_IX
		BNE	MTSNCT0200		; target ? [no->MTSNCT0200]
;
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	<EWORK2
MTSNCT0180	EQU	$
		LDA	<EWORK2
		STA	!ENMUKI,X
		LDA	#00040H
		STA	!ENTIM0,X
MTSNCT0190	EQU	$
		RTS
;
;
MTSNCT0200	EQU	$
		JMP	MITSANWALKIN
;
;
MITSANMOTIONIN	EQU	$
		LDA	#mitsanmotion
		STA	<ENCONT,X
		STZ	<ENWRK0,X
		LDA	MITSANMOTIONPT
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#mitsanmotiontm
		STA	!ENTIM0,X
		JMP	MTSNTR0100
;
;
MITSANMOTION	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	MTSNMT00F0		; pattern change ? [no->MTSNMT00F0]
;
		LDA	<ENWRK0,X
		INC	A
		CMP	#mitsanmotionptn
		BCC	MTSNMT0080		; throw ? [no->MTSNMT0080]
;
		JMP	MITSANTHROWIN
;
MTSNMT0080	EQU	$
		STA	<ENWRK0,X
		TAY
		LDA	MITSANMOTIONPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#mitsanmotiontm
		STA	!ENTIM0,X
MTSNMT00F0	EQU	$
		JMP	MTSNTR0100
;
;
MITSANSLIPIN	EQU	$
		LDA	#00047H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	#mitsanslip
		STA	<ENCONT,X
		LDA	#mitsan_sliptime
		STA	!ENTIM0,X
		RTS
;
;
MITSANSLIP	EQU	$
		LDX	<ENINDX
		LDA	!ENXSPD,X
		BEQ	MTSNSL0080		; [->MTSNSL0080]
;
		LDA	!ENMUKI,X
		LSR	A
		LSR	A
		ROR	A
		EOR	!ENXSPD,X
		BPL	MTSNTR0100		; slip end ? [no->MTSNTR0100]
;
MTSNSL0080	EQU	$
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		LDA	!ENTIM0,X
		BNE	MTSNTR0100		; throw mode ? [no->MTSNTR0100]
;
MITSANTHROWIN	EQU	$
		LDA	#mitsanthrow
		STA	<ENCONT,X
		STZ	<ENWRK0,X
		LDA	MITSANTHROWPT
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	MITSANTHROWTM
		AND	#000FFH
		STA	!ENTIM0,X
		BRA	MTSNTR0100
;
MITSANTHROW	EQU	$
		LDX	<ENINDX
		LDA	!EPXMUK,X
		STA	!ENMUKI,X
		LDA	!ENTIM0,X
		BNE	MTSNTR00F0		; pattern change ? [no->MTSNTR00F0]
;
		LDA	<ENWRK0,X
		INC	A
		CMP	#mitsanthrowptn
		BCS	MTSNTR0200		; next mode ? [yes->MTSNTR0200]
;
		STA	<ENWRK0,X
		TAY
		LDA	MITSANTHROWPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	MITSANTHROWTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
;
MTSNTR00F0	EQU	$
		LDA	<ENWRK0,X
		CMP	#eggrelease
		BEQ	MTSNTR0300		; release point ? [yes->MTSNTR0300]
		BCS	MTSNTR01F0		; egg out ? [yes->MTSNTR01F0]
;
		JSL	>LOCKON_TARGET		; lock on !!
;
MTSNTR0100	EQU	$
		LDA	!ENCHPT,X
		ASL	A
		ASL	A
		ORA	!ENMUKI,X
		TAY
		LDA	MITSANEGGX,Y
		STA	<EWORK
		LDA	MITSANEGGY,Y
		STA	<EWORK2
		LDY	<ENWRK2,X		; egg index !!
		LDA	!ENXPSL,X
		CLC
		ADC	<EWORK
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	<EWORK2
		STA	!ENYPSL,Y
MTSNTR01F0	EQU	$
		RTS
;
;
MTSNTR0200	EQU	$
		JMP	MITSANWALKIN
;
;
MTSNTR0300	EQU	$
		JSL	>LOCKON_TARGET2		; lock on !!
;
		LDA	!PCENTX
		STA	R1			; target X
		LDA	!PCENTY
		STA	R2			; target Y
		LDY	<ENWRK2,X		; egg index !!
		LDA	!ECENTX,Y
		STA	R3			; my X
		LDA	!ECENTY,Y
		STA	R4			; my Y
		LDA	#throwspeed
		STA	R6			; speed
		M_CHIP	SEARCH_SPEED
;
		LDX	<ENINDX
		LDY	<ENWRK2,X		; egg index !!
		LDA	R1
		STA	!ENXSPD,Y		; x speed set !!
		LDA	R2
		STA	!ENYSPD,Y		; y speed set !!
		LDA	#01
		STA	!ENGPOW,Y
		STA	!ENSHOT,Y
		LDA	#01
		STA	!ENWRK6,Y
		STA	!ENYUSN,Y
;
		M8
;
		STA	!ENWRKX,Y		;タマゴスクロールＳＴＯＰ！！
;
		M16
;
		LDA	!ENMOD0,Y
		AND	#1111111110111111B
		STA	!ENMOD0,Y		; 食べれるセット
		LDA	!ENMOD2,Y
		ORA	#0000000000000100B	; 範囲外クリアＯＮ！！
		STA	!ENMOD2,Y
		LDA	#-1
		STA	<ENWRK2,X
		RTS
;
;
MITSANCATCH01	EQU	$
		PHY
		LDA	!ENCHPT,X
		ASL	A
		ASL	A
		ORA	!ENMUKI,X
		TAY
		LDA	MITSANEGGX,Y
		STA	<EWORK
		LDA	MITSANEGGY,Y
		STA	<EWORK2
		PLY
		LDA	!ENXPSL,X
		CLC
		ADC	<EWORK
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	<EWORK2
		STA	!ENYPSL,Y
;
		LDY	!ENMUKI,X
		LDA	MITSANSMK0XP,Y
		STA	<EWORK
;
		LDA	#MC2S1
		JSL	>EXINSR
;
		LDA	!ENMUKI,X
		STA	!EXMUKI,Y
		LDA	!ENXPSL,X
		SEC
		SBC	<EWORK
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00007H
		STA	!EXYPSL,Y
		LDA	#02
		STA	!EXWRK0,Y
		STA	!EXTIM0,Y
		LDA	#06-1
		STA	!EXWRK2,Y
		RTS
;
;
MITSANCATCH02	EQU	$
		LDA	#mitsan17
		STA	!ENCHPT,X
;
		PHY
		LDA	!ENCHPT,X
		ASL	A
		ASL	A
		ORA	!ENMUKI,X
		TAY
		LDA	MITSANEGGX,Y
		STA	<EWORK
		LDA	MITSANEGGY,Y
		STA	<EWORK2
		PLY
		LDA	!ENXPSL,X
		CLC
		ADC	<EWORK
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	<EWORK2
		STA	!ENYPSL,Y
;
		LDY	!ENMUKI,X
		LDA	MITSANSMK1XP,Y
		STA	<EWORK
;
		LDA	#MSNSK
		JSL	>EXINSR
;
		LDA	!ENMUKI,X
		STA	!EXMUKI,Y
		LDA	!ENXPSL,X
		SEC
		SBC	<EWORK
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#0000BH
		STA	!EXYPSL,Y
		LDA	#02
		STA	!EXWRK0,Y
		STA	!EXTIM0,Y
		LDA	#06-1
		STA	!EXWRK2,Y
		RTS
;
;
MITSANSEARCH	EQU	$
		LDA	#mitsanwidth
		STA	<EWORK4
		ASL	A
		STA	<EWORK6
		LDA	#mitsanunder
		STA	<EWORK8
		CLC
		ADC	#mitsantop
		STA	<EWORKA
		JMP	SEARCHSHEN
;
;
MITSANREVIVEIN	EQU	$
		LDY	<ENWRK2,X
		BMI	MTSNRVIN0080		; egg on ? [no->MTSNRVIN0080]
;
		LDA	!ENMOD0,Y
		AND	#1111111110111111B
		STA	!ENMOD0,Y		; 食べれるセット
		LDA	#00
		STA	!ENWRK6,Y
		STA	!ENSHOT,Y
		LDA	#00040H
		STA	!ENGPOW,X
MTSNRVIN0080	EQU	$
		LDA	#MITSANREVIVEPT
		STA	<EWORK
		JSR	REVIVEINIT
;
		RTL
;
;
MITSANREVIVE	EQU	$
		LDA	#MITSANREVIVEPT
		STA	<EWORK
		JSR	REVIVE
;
		RTL
;
;
;----------------------------------------------------------------
;-	復活							-
;-		EWORK <- PATTERN ADDRESS			-
;----------------------------------------------------------------
reviveptn	EQU	18
revivejump	EQU	16
reviveyspeed	EQU	0FD00H
;
REVIVETIME	EQU	$
		HEX	20, 20, 02, 02, 02, 02, 02, 02
		HEX	02, 02, 02, 02, 02, 02, 20, 06
		HEX	18, 10
;
REVIVEINIT	EQU	$
		LDA	(<EWORK)
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	REVIVETIME
		AND	#000FFH
		STA	!ENTIM0,X
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		STZ	!ENWRK0,X
		LDA	#1
		STA	!ENWRKA,X
		LDA	#0001CH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	!ECENTX,X
		STA	<EWORK
		LDA	!ECENTY,X
		STA	<EWORK2
		LDA	#FSMK1
		JSL	>FSMK0_SET2
;
		JSL	>PLAYER_REBOUND
;
		RTS
;
;
REVIVE		EQU	$
		LDA	!ENCBFG,X
		AND	#0000000000000001B	; 足下チェック
		BEQ	REVIVE0080		; 空中 ? [yes->REVIVE0080]
;
		LDA	!ENTIM0,X
		BNE	REVIVE0080		; pattern change ? [no->REVIVE0080]
;
		LDA	!ENWRK0,X
		INC	A
		CMP	#reviveptn
		BCS	REVIVE0100		; 復活 ? [yes->REVIVE0100]
;
		STA	!ENWRK0,X
		TAY
		LDA	(<EWORK),Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	REVIVETIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
		CPY	#revivejump
		BNE	REVIVE0080		; jump ? [no->REVIVE0080]
;
		LDA	#reviveyspeed
		STA	!ENYSPD,X
REVIVE0080	EQU	$
		RTS
;
;
REVIVE0100	EQU	$
		STZ	!ENWRKA,X
		LDA	!ENMYNO,X
		TXY
		JSL	>ESTATST
;
		RTS
;
;
;------------------------------------------------------------------------
;-	fail (MITSN)							-
;------------------------------------------------------------------------
MITSNFL		EQU	$
		LDA	<ENWRK2,X
		BMI	MSNFL0080		; egg on ? [no->MSNFL0080]
;
		TAY
		LDA	#00040H
		STA	!ENGPOW,Y
		LDA	!ENMOD0,Y
		AND	#1111111110111111B
		STA	!ENMOD0,Y		; 食べれるセット
		LDA	#00
		STA	!ENWRK6,Y
		STA	!ENXPOW,Y
		STA	!ENXSPD,Y
		STA	!ENYSPD,Y
		STA	!ENSHOT,Y
MSNFL0080	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (JUGEM)							-
;------------------------------------------------------------------------
jugemu00	EQU	000H
jugemu01	EQU	001H
jugemu02	EQU	002H
jugemu03	EQU	003H
jugemu04	EQU	004H
jugemu05	EQU	005H
jugemu06	EQU	006H
jugemu07	EQU	007H
jugemu08	EQU	008H
jugemu09	EQU	009H
jugemu0A	EQU	00AH
jugemu0B	EQU	00BH
jugemu0C	EQU	00CH
jugemu0D	EQU	00DH
jugemu0E	EQU	00EH
jugemu0F	EQU	00FH
;
jugemucheckxspd EQU	00080H
jugemucheckyspd EQU	00100H
jugemucheckxp	EQU	00078H
jugemucheckyp	EQU	00030H
jugemu_xspdmax	EQU	00200H
jugemu_yspdmax	EQU	00200H
jugemu_xpower	EQU	00008H
jugemu_xpower2	EQU	00010H
jugemu_gpower	EQU	00008H
jugemu_gpower2	EQU	00010H
jgm_ido_time	EQU	00100H
jgm_idoptntm	EQU	00003H
jgm_goso_time	EQU	(00010H*5)
jgm_gosoptntm	EQU	00007H
jgm_thrwptn	EQU	13
jugemu_luckon	EQU	11
jugemu_throw	EQU	12
jugemu_throwspd EQU	00380H
;
jgm_idomode	EQU	000H
jgm_gosomode	EQU	002H
jgm_throwmode	EQU	004H
;
JUGEMU2XPOS	EQU	$
		WORD	-00180H, 00180H
;
JUGEMIN		EQU	$
		LDA	!JUGM_ST_FG
		BEQ	JGMIN0040		; ジュゲム ON ? [no->JGMIN0040]
;
		JMP	>ENCLEAR
;
;
JGMIN0040	EQU	$
		LDA	#01
		STA	!JUGM_ST_FG		; ジュゲムフラグセット
;
		LDA	#jugemu_xspdmax
		STA	!ENXMAX,X
		LDA	#jugemu_yspdmax
		STA	!ENGMAX,X
		LDA	#jugemu_xpower
		STA	!ENXPOW,X
		LDA	#jugemu_gpower
		STA	!ENGPOW,X
;
		LDA	#JUGEMUMARKXPOS
		STA	!ENWRK6,X
;
		JSR	JUGEMUIDOIN
;
		LDA	!ENXPSL,X
		AND	#00010H
		BEQ	JGMIN0080		; 二匹セット ? [no->JGMIN0080]
;
		LDY	!ENMUKI,X
		LDA	!ENXPSL,X
		CLC
		ADC	JUGEMU2XPOS,Y
		AND	#0FFE0H
		STA	<EWORK
		LDA	#JUGEM
		JSL	>ENINSR
;
		BCC	JGMIN0080		; エリア確保失敗 ? [yes->JGMIN0080]
;
		LDA	<EWORK
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		STA	!ENYPSL,Y
;
		LDA	#jugemu_xspdmax
		STA	!ENXMAX,Y
		LDA	#jugemu_yspdmax
		STA	!ENGMAX,Y
		LDA	#jugemu_xpower
		STA	!ENXPOW,Y
		LDA	#jugemu_gpower
		STA	!ENGPOW,Y
;
		LDA	#JUGEMUMARKXPS2
		STA	!ENWRK6,Y
;
		TYX
		JSR	JUGEMUIDOIN
;
		LDX	<ENINDX
JGMIN0080	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	move (JUGEM)							-
;------------------------------------------------------------------------
JUGEMUMARKXPOS	EQU	$
		WORD	00088H, 00068H
;
JUGEMUMARKXPS2	EQU	$
		WORD	00098H, 00058H
;
JUGEMMV		EQU	$
		LDA	!ENMODE,X
		CMP	#EEATM
		BNE	JGMMV0060		; 食べられモード ? [no->JGMMV0060]
;
JUGEMUEAT	EQU	$			; 食べられモード
		LDA	#KINTO
		JSL	>ENINSR
;
		BCC	JGMEAT0080		; エリア確保失敗 ? [yes->JGMEAT0080]
;
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		STA	!ENYPSL,Y
		LDA	#EEATM
		STA	!ENMODE,Y
		TYA
		AND	#000FFH
		INC	A
		STA	!EATFLG
		LDA	!ENMOD2,Y
		AND	#0FFF3H			; 範囲クリアオフ !!
		STA	!ENMOD2,Y
		TXA
		INC	A
		STA	!ENCONT,Y
		JSL	>JUGEMUDOWNIN1
;
		BRA	JGMEAT00A0
;
JGMEAT0080	EQU	$
		STZ	!EATFLG
JGMEAT00A0	EQU	$
		STZ	!EATSTP
		PLA
		PLY
		BRA	JGMMV0070
;
JGMMV0060	EQU	$
		JSR	JUGEMUOAM_CHG		; キャラクターチェンジ !!
;
JGMMV0070	EQU	$
		JSL	>ENMDCK			; mode check
;
JGMMV0080	EQU	$
		JSR	JGMCRCK			; 衝突チェック
;
		LDA	!EPXMUK,X
		STA	!ENMUKI,X		; 向きセット !!
;
		LDA	!JUGM_ST_FG
		BNE	JUGEMU0000		; セットオフ ? [no->JUGEMU00A0]
;
		LDA	#0FC00H
		STA	!ENXMAX,X
		STA	!ENGMAX,X
		LDA	!ENMOD2,X
		ORA	#0000000000000100B	; 範囲クリアオン !!
		STA	!ENMOD2,X
		BRA	JUGEMU00A0
;
JUGEMU0000	EQU	$
		LDA	!EPXMUK,X
		LSR	A
		LSR	A
		ROR	A
		EOR	!ENXSPD,X
		BMI	JUGEMU0010		; 減速 ? [no->JUGEMU0010]
;
		LDA	#jugemu_xpower2
		BRA	JUGEMU0020
;
JUGEMU0010	EQU	$
		LDA	#jugemu_xpower
JUGEMU0020	EQU	$
		STA	!ENXPOW,X
		LDA	!ENXSPD,X
		ABS16
		CMP	#jugemucheckxspd
		BCC	JUGEMU0050		; MAX x speed change ? [no->JUGEMU0050]
;
		LDA	!ENXSPD,X
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAY
		LDA	!ENWRK6,X
		STA	<EWORK
		LDA	!ENDSXL,X
		CMP	(<EWORK),Y
		BPL	JUGEMU0030		; 右 ? [yes->JUGEMU0030]
;
		LDA	#jugemu_xspdmax
		BRA	JUGEMU0040
;
JUGEMU0030	EQU	$
		LDA	#-jugemu_xspdmax
JUGEMU0040	EQU	$
		STA	!ENXMAX,X
JUGEMU0050	EQU	$
		LDA	!ENDSYL,X
		SEC
		SBC	#jugemucheckyp
		EOR	!ENYSPD,X
		BMI	JUGEMU0060		; 減速 ? [no->JUGEMU0060]
;
		LDA	#jugemu_gpower2
		BRA	JUGEMU0070
;
JUGEMU0060	EQU	$
		LDA	#jugemu_gpower
JUGEMU0070	EQU	$
		STA	!ENGPOW,X
		LDA	!ENYSPD,X
		ABS16
		CMP	#jugemucheckyspd
		BCC	JUGEMU00A0		; MAX y speed change ? [no->JUGEMU00A0]
;
		LDA	!ENDSYL,X
		CMP	#jugemucheckyp
		BPL	JUGEMU0080		; 下 ? [yes->JUGEMU0080]
;
		LDA	#jugemu_yspdmax
		BRA	JUGEMU0090
;
JUGEMU0080	EQU	$
		LDA	#-jugemu_yspdmax
JUGEMU0090	EQU	$
		STA	ENGMAX,X
JUGEMU00A0	EQU	$
		LDA	<FRCNT2
		AND	#00007H
		BNE	JUGEMU00C0		; ちぎれ雲セット ? [no->JUGEMU00C0]
;
		LDA	#KINTS
		JSL	>EXINSR
;
		LDA	#02
		STA	!EXCHPT,Y
		LDA	#08
		STA	!EXTIM0,Y
		LDA	!ECENTX,X
		SEC
		SBC	#00008H
		SEC
		SBC	!ENMOVX,X
		STA	!EXXPSL,Y
		LDA	<RANDM0
		AND	#00007H
		CLC
		ADC	!ECENTY,X
		SEC
		SBC	#00008H
		SEC
		SBC	!ENMOVY,X
		STA	!EXYPSL,Y
JUGEMU00C0	EQU	$
		LDA	<ENCONT,X
		TAX
		JSR	(JUGEMUMODE,X)
;
		JSL	>EPCRCK
;
		RTL
;
JUGEMUMODE	EQU	$
		WORD	JUGEMUIDO
		WORD	JUGEMUIDO
		WORD	JUGEMUTHROW
;
;
JUGEMUIDOIN	EQU	$
		LDA	<RANDM0
		AND	#0007FH
		CLC
		ADC	#00080H
		STA	!ENTIM0,X
		STZ	!ENCHPT,X
		STZ	<ENCONT,X
		LDA	#jgm_idoptntm
		STA	<ENWRK2,X
		LDA	#JUGEMUGOSOIN
		STA	<ENWRK4,X
		RTS
;
;
JUGEMUIDO	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	JGMIDO0020		; next mode ? [no->JGMIDO0020]
;
		LDA	!ENDSXL,X
		ORA	!ENDSYL,X
		AND	#0FF00H
		BEQ	JGMIDO0080		; next mode ? [yes->JGMIDO0080]
;
		LDA	#jgm_goso_time
		STA	!ENTIM0,X
JGMIDO0020	EQU	$
		AND	<ENWRK2,X
		BNE	JGMIDO0040		; pattern change ? [no->JGMIDO0040]
;
		LDA	!ENCHPT,X
		EOR	#00001H
		STA	!ENCHPT,X
JGMIDO0040	EQU	$
		RTS
;
;
JGMIDO0080	EQU	$
		LDA	<ENWRK4,X
		STA	<EWORK
		JMP	(!EWORK)
;
;
JUGEMUGOSOIN	EQU	$
		LDA	#jgm_goso_time
		STA	!ENTIM0,X
		LDA	#jugemu02
		STA	!ENCHPT,X
		LDA	#jgm_gosomode
		STA	<ENCONT,X
		LDA	#jgm_gosoptntm
		STA	<ENWRK2,X
		LDA	#JUGEMUTHROWIN
		STA	<ENWRK4,X
		RTS
;
;
JGMTHROWTIME	EQU	$
		HEX	0C, 02, 02, 02, 02, 02, 02, 02
		HEX	02, 06, 10, 80, 20
;
JGMTHROWPTN	EQU	$
		BYTE	jugemu04, jugemu05, jugemu06, jugemu07
		BYTE	jugemu08, jugemu09, jugemu0A, jugemu0B
		BYTE	jugemu0A, jugemu0C, jugemu0A, jugemu0D
		BYTE	jugemu0E
;
JUGEMUTHROWIN	EQU	$
		STZ	<ENWRK2,X
		LDA	JGMTHROWTIME
		AND	#000FFH
		STA	!ENTIM0,X
		LDA	JGMTHROWPTN
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#jgm_throwmode
		STA	<ENCONT,X
		RTS
;
;
JUGEMUTHROW	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BEQ	JGMTHROW0010		; pattern change ? [yes->JGMTHROW0080]
;
		JMP	JGMTHROW0080		; pattern change ? [no->JGMTHROW0080]
;
JGMTHROW0010	EQU	$
		LDA	<ENWRK2,X
		INC	A
		CMP	#jgm_thrwptn
		BCC	JGMTHROW0020		; 移動モード ? [no->JGMTHROW0020]
;
		JMP	JUGEMUIDOIN		; 移動モード ? [yes->JUGEMUIDOIN]
;
JGMTHROW0020	EQU	$
		STA	<ENWRK2,X
		TAY
		LDA	JGMTHROWTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
		LDA	JGMTHROWPTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		CPY	#jugemu_throw
		BNE	JGMTHROW0080		; throw ? [no->JGMTHROW0080]
;
		JSL	>LOCKON_TARGET2		; lock on !!
;
		JSR	JGM_TAMATHROW
;
		BRA	JGMTHROW00A0
;
JGMTHROW0080	EQU	$
		LDA	<ENWRK2,X
		CMP	#jugemu_luckon
		BCC	JGMTHROW00A0		; lock on ? [no->JGMTHROW00A0]
;
		CMP	#jugemu_throw
		BCS	JGMTHROW00A0		; lock on ? [no->JGMTHROW00A0]
;
		JSL	>LOCKON_TARGET		; lock on !!
;
		STZ	!ENXPOW,X
		STZ	!ENGPOW,X
		STZ	!ENXSPD,X
		STZ	!ENYSPD,X
JGMTHROW00A0	EQU	$
		RTS
;
;
JUGEMUDOWNIN0	EQU	$
		LDA	!ECENTX,X
		STA	<EWORK
		LDA	!ECENTY,X
		STA	<EWORK2
		LDA	#FSMK0
		JSL	>FSMK0_SET2
;
JUGEMUDOWNIN1	EQU	$
		STZ	!ENYSPD,X
		STZ	!ENXPOW,X
		STZ	!ENXMAX,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#00400H
		STA	!ENGMAX,X
		LDA	#jugemu0F
		STA	!ENCHPT,X
		LDA	#EFAIL
		STA	!ENMODE,X
		LDA	#64*10
		STA	!ENTIM3,X
		RTL
;
;
JUGEMUKUMO	EQU	$
		WORD	2*8, 3*8,  2*8, 3*8,  0*8, 1*8,	 0*8, 1*8
		WORD	0*8, 1*8,  0*8, 1*8,  0*8, 1*8,	 1*8, 2*8
		WORD	1*8, 2*8,  2*8, 3*8,  2*8, 3*8,	 2*8, 3*8
		WORD	2*8, 3*8,  2*8, 3*8,  2*8, 3*8
;
JUGEMUCLOUD	EQU	$
		WORD	00008H, 0000AH
;
JUGEMUCOLOR	EQU	$
		WORD	00000H, 00200H, 00400H, 00800H
;
JUGEMUOAM_CHG	EQU	$
		I16				; index 16bit mode !!
;
		LDA	!ENCHPT,X
		CMP	#jugemu0F
		BEQ	JGMOC0040		; 雲チェンジ ? [no->JGMOC0040]
;
		ASL	A
		ASL	A
		TAY
		LDA	JUGEMUKUMO,Y
		STA	<EWORK
		LDA	JUGEMUKUMO+2,Y
		STA	<EWORK2
		LDA	<FRCNT2
		AND	#00008H
		LSR	A
		LSR	A
		TAY
		LDA	JUGEMUCLOUD,Y
		STA	<EWORK4
		LDA	!ENOAML,X
		CLC
		ADC	<EWORK
		TAY
		LDA	!SOAM_DX+4,Y
		AND	#0FFF0H
		ORA	<EWORK4
		STA	!SOAM_DX+4,Y
		LDA	!ENOAML,X
		CLC
		ADC	<EWORK2
		TAY
		LDA	!SOAM_DX+4,Y
		AND	#0FFF0H
		ORA	<EWORK4
		STA	!SOAM_DX+4,Y
		LDA	!ENCHPT,X
JGMOC0040	EQU	$
		CMP	#jugemu0D
		BNE	JGMOC0080		; カラーチェンジ ? [no->JGMOC0080]
;
		LDA	<FRCNT2
		AND	#00006H
		TAY
		LDA	JUGEMUCOLOR,Y
		STA	<EWORK
		LDY	!ENOAML,X
		LDA	!SOAM_DX+4,Y
		AND	#0F1FFH
		ORA	<EWORK
		STA	!SOAM_DX+4,Y
JGMOC0080	EQU	$
		I8				; index 8bit mode !!
		RTS
;
;
JGMCRCK		EQU	$
		LDY	!ECRSFG,X
		BMI	JGMCRCK0100		; プレイヤー衝突 ? [yes->JGMCRCK0100]
;
		DEY
		BEQ	JGMCRCK00F0		; 赤ちゃん衝突 ? [yes->JGMCRCK00F0]
		BMI	JGMCRCK00F0		; 衝突 ? [no->JGMCRCK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	JGMCRCK00F0		; move mode ? [no->JGMCRCK00F0]
;
		LDA	!ENSHOT,Y
		BEQ	JGMCRCK00F0		; shot ? [no->JGMCRCK00F0]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
		PLA
		JMP	JUGEMUDOWNIN0
;
;
JGMCRCK00F0	EQU	$
		RTS
;
;
JGMCRCK0100	EQU	$			; プレイヤー衝突 !!
		JSL	>EPFOOTCROSS_01
;
		BCS	JGMCRCK0140		; 踏まれた ? [yes->JGMCRCK0140]
		BEQ	JGMCRCK0120		; [->JGMCRCK0120]
;
		JSL	>PLFLST
;
JGMCRCK0120	EQU	$
		RTS
;
;
JGMCRCK0140	EQU	$
		LDA	#KINTO
		JSL	>ENINSR_I
;
		BCC	JGMCRCK0180		; エリア確保失敗 ? [yes->JGMCRCK0180]
;
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		STA	!ENYPSL,Y
		TXA
		INC	A
		STA	!ENCONT,Y
JGMCRCK0180	EQU	$
		JSL	>PLAYER_REBOUND
;
		PLA
		JMP	JUGEMUDOWNIN0
;
;
TAMAINTXPS	EQU	$
		WORD	0FFF0H, 00000H
;
JGM_TAMATHROW	EQU	$
		LDA	!PCENTX
		STA	R1			; target X
		LDA	!PCENTY
		STA	R2			; target Y
		LDY	!ENMUKI,X
		LDA	!ECENTX,X
		CLC
		ADC	TAMAINTXPS,Y
		STA	<EWORK
		STA	R3			; my X
		LDA	!ECENTY,X
		STA	R4			; my Y
		LDA	#jugemu_throwspd
		STA	R6			; speed
		M_CHIP	SEARCH_SPEED
;
		LDX	<ENINDX
		LDA	#JTAMA
		JSL	>ENINSR
;
		BCC	JGMTTR00F0		; 不発 ? [yes->JGMTTR00F0]
;
		LDA	R1
		STA	!ENXSPD,Y		; X スピードセット
		LDA	R2
		STA	!ENYSPD,Y		; Y スピードセット
		LDA	<EWORK
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00008H
		STA	!ENYPSL,Y
JGMTTR00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	fail (JUGEM)							-
;------------------------------------------------------------------------
JGMFUUKATUXP	EQU	$
		WORD	-00040H, 00140H
;
JGMFUUKATUYP	EQU	$
		WORD	-00040H, 00140H
;
JUGEMFL		EQU	$
		LDA	!ENDSYL,X
		AND	#0FF00H
		BEQ	JGMFL0080		; 画面内 ? [yes->JGMFL0080]
;
		STZ	!ENGPOW,X
		STZ	!ENYSPD,X
JGMFL0080	EQU	$
		LDA	!ENTIM3,X
		BNE	JGMFL0100		; ジュゲム復活 ? [no->JGMFL0100]
;
		LDA	#jugemu_xspdmax
		STA	!ENXMAX,X
		LDA	#jugemu_yspdmax
		STA	!ENGMAX,X
		LDA	#jugemu_xpower
		STA	!ENXPOW,X
		LDA	#jugemu_gpower
		STA	!ENGPOW,X
;
		JSR	JUGEMUIDOIN
;
		LDY	!SCHMK1
		LDA	!SCCH1
		CLC
		ADC	JGMFUUKATUXP,Y
		STA	!ENXPSL,X
		LDY	!SCVMK1
		LDA	!SCCV1
		CLC
		ADC	JGMFUUKATUYP,Y
		STA	!ENYPSL,X
		LDA	#EMOVE
		STA	!ENMODE,X
JGMFL0100	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (WATAB)							-
;------------------------------------------------------------------------
watabouleftclr	EQU	00080H
watabouxarea	EQU	00200H
wataboutopclr	EQU	00040H
watabouyarea	EQU	00140H
watabougpow	EQU	00004H
;
WATABGMAXDAT	EQU	$
		WORD	-000C0H, 000C0H
;
WATABYPOSDTA	EQU	$
		WORD	00020H, -00020H
;
WATABXSPD	EQU	$
		WORD	-00040H, 00040H
;
WATABXPS	EQU	$
		WORD	00120H, -00020H, 00130H, -00030H
		WORD	00140H, -00040H, 00150H, -00050H
;
WATABYPS	EQU	$
		WORD	00020H, 00060H, 000A0H, 000E0H, 00000H, 00040H, 00080H, 000C0H
;
WATABIN		EQU	$
		LDA	#-000C0H
		STA	!ENGMAX,X
		LDY	!ENMUKI,X
		LDA	!ENYPSL,X
		CLC
		ADC	#00020H
		STA	<ENWRK0,X
		LDA	WATABXSPD,Y
		STA	!ENXSPD,X		; X スピードセット !!
		RTL
;
;
;[1995.03.23.TH]		LDA	!WATB_ST_FG
;[1995.03.23.TH]		BEQ	WTBIN0020		; 綿ぼう ON ? [no->WTBIN0020]
;[1995.03.23.TH];
;[1995.03.23.TH]		JMP	>ENCLEAR
;[1995.03.23.TH];
;[1995.03.23.TH];
;[1995.03.23.TH]WTBIN0020	EQU	$
;[1995.03.23.TH]		LDA	#01
;[1995.03.23.TH]		STA	!WATB_ST_FG		; 綿ぼう セットフラグオン !!
;[1995.03.23.TH]		LDA	#00
;[1995.03.23.TH]		STA	<ENWRK4,X		; 綿ぼうインデックスセット
;[1995.03.23.TH]		LDA	<RANDM0
;[1995.03.23.TH]		AND	#00003H
;[1995.03.23.TH]		ASL	A
;[1995.03.23.TH]		ASL	A
;[1995.03.23.TH]		ORA	!SCHMK1
;[1995.03.23.TH]		TAY
;[1995.03.23.TH]		LDA	!SCCH1
;[1995.03.23.TH]		CLC
;[1995.03.23.TH]		ADC	WATABXPS,Y
;[1995.03.23.TH]		STA	!ENXPSL,X		; X ポジションセット
;[1995.03.23.TH]		AND	#00010H
;[1995.03.23.TH]		LSR	A
;[1995.03.23.TH]		LSR	A
;[1995.03.23.TH]		LSR	A
;[1995.03.23.TH]		TAY
;[1995.03.23.TH]		LDA	WATABGMAXDAT,Y
;[1995.03.23.TH]		STA	!ENGMAX,X		; G-MAX セット !!
;[1995.03.23.TH]		LDA	!SCCV1
;[1995.03.23.TH]		AND	#0FF00H
;[1995.03.23.TH]		CLC
;[1995.03.23.TH]		ADC	WATABYPS
;[1995.03.23.TH]		STA	<ENWRK0,X
;[1995.03.23.TH]		CLC
;[1995.03.23.TH]		ADC	WATABYPOSDTA,Y
;[1995.03.23.TH]		STA	!ENYPSL,X		; Y ポジションセット
;[1995.03.23.TH]		STZ	!ENYSPD,X		; Y スピードセット !!
;[1995.03.23.TH]		LDY	!ENMUKI,X
;[1995.03.23.TH]		LDA	WATABXSPD,Y
;[1995.03.23.TH]		STA	!ENXSPD,X		; X スピードセット !!
;[1995.03.23.TH];
;[1995.03.23.TH]		LDA	#8*2-2
;[1995.03.23.TH]		STA	<EWORK
;[1995.03.23.TH]WTBIN0040	EQU	$
;[1995.03.23.TH]		JSR	WTBIN0080
;[1995.03.23.TH];
;[1995.03.23.TH]		DEC	<EWORK
;[1995.03.23.TH]		DEC	<EWORK
;[1995.03.23.TH]		BNE	WTBIN0040		; 綿ぼうセット エンド ? [no->WTBIN0040]
;[1995.03.23.TH];
;[1995.03.23.TH]		RTL
;[1995.03.23.TH];
;[1995.03.23.TH];
;[1995.03.23.TH]WTBIN0080	EQU	$
;[1995.03.23.TH]		LDA	#WATAB
;[1995.03.23.TH]		JSL	>ENINSR
;[1995.03.23.TH];
;[1995.03.23.TH]		BCC	WTBIN00F0		; エリア確保失敗 ? [yes->WTBIN00F0]
;[1995.03.23.TH];
;[1995.03.23.TH]		LDA	!ENMUKI,X
;[1995.03.23.TH]		STA	!ENMUKI,Y
;[1995.03.23.TH]		TYX
;[1995.03.23.TH]		LDA	<EWORK
;[1995.03.23.TH]		STA	<ENWRK4,X		; 綿ぼうインデックスセット
;[1995.03.23.TH]		JSL	>RANDAM
;[1995.03.23.TH];
;[1995.03.23.TH]		LDA	<RANDM0
;[1995.03.23.TH]		AND	#0000CH
;[1995.03.23.TH]		ORA	!SCHMK1
;[1995.03.23.TH]		TAY
;[1995.03.23.TH]		LDA	!SCCH1
;[1995.03.23.TH]		CLC
;[1995.03.23.TH]		ADC	WATABXPS,Y
;[1995.03.23.TH]		STA	!ENXPSL,X		; X ポジションセット
;[1995.03.23.TH]		AND	#00010H
;[1995.03.23.TH]		LSR	A
;[1995.03.23.TH]		LSR	A
;[1995.03.23.TH]		LSR	A
;[1995.03.23.TH]		TAY
;[1995.03.23.TH]		LDA	WATABGMAXDAT,Y
;[1995.03.23.TH]		STA	!ENGMAX,X		; G-MAX セット !!
;[1995.03.23.TH]		PHY
;[1995.03.23.TH]		LDY	<EWORK
;[1995.03.23.TH]		LDA	!SCCV1
;[1995.03.23.TH]		AND	#0FF00H
;[1995.03.23.TH]		CLC
;[1995.03.23.TH]		ADC	WATABYPS,Y
;[1995.03.23.TH]		STA	<ENWRK0,X
;[1995.03.23.TH]		PLY
;[1995.03.23.TH]		CLC
;[1995.03.23.TH]		ADC	WATABYPOSDTA,Y
;[1995.03.23.TH]		STA	!ENYPSL,X		; Y ポジションセット
;[1995.03.23.TH]		STZ	!ENYSPD,X		; Y スピードセット !!
;[1995.03.23.TH]		LDY	!ENMUKI,X
;[1995.03.23.TH]		LDA	WATABXSPD,Y
;[1995.03.23.TH]		STA	!ENXSPD,X		; X スピードセット !!
;[1995.03.23.TH]		LDX	<ENINDX
;[1995.03.23.TH]		RTS
;[1995.03.23.TH];
;[1995.03.23.TH];
;[1995.03.23.TH]WTBIN00F0	EQU	$
;[1995.03.23.TH]		PLA
;[1995.03.23.TH]		RTL
;[1995.03.23.TH];
;
;------------------------------------------------------------------------
;-	move (WATAB)							-
;------------------------------------------------------------------------
WATABMV		EQU	$
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	WTBMV0000		; Ｍｏｄｅ Ｍｏｖｅ？ [yes->WTBMV0000]
;
		LDA	<ENWRK4,X
		BEQ	WTBMV0000		; 既に死んでる？ [yes->WTBMV0000]
;
		DEC	!WATAB_COUNT		; 綿ぼうフラグ ｏｆｆ！！
;
		LDA	<ENWRK4,X
		TRB	!WATAB_STLIN		; ラインビット ｏｆｆ！！
		STZ	<ENWRK4,X
;
;[1995.03.24.FR]		CMP	#EEATM
;[1995.03.24.FR]		BNE	WTBMV0000		; EAT MODE ? [no->WTBMV0000]
;[1995.03.24.FR];
;[1995.03.24.FR]		LDA	!BERXPS
;[1995.03.24.FR]		ORA	!BERYPS
;[1995.03.24.FR]		ORA	!BERFLG
;[1995.03.24.FR]		BNE	WTBMV0000		; [->WTBMV0000]
;[1995.03.24.FR];
;[1995.03.23.TH]		LDA	#EMOVE
;[1995.03.23.TH]		STA	!ENMODE,X
;[1995.03.24.FR]		PLY
;[1995.03.24.FR]		JMP	WATABOURESET		; 再セット !!
;[1995.03.24.FR];
;
WTBMV0000	EQU	$
		JSL	>ENMDCK			; mode check
;
		JSR	WATABCLRCK		; 綿ぼう範囲チェック！！
;
		LDA	<ENWRK2,X
		BEQ	WTBMV0040		; [->WTBMV0040]
;
		LDA	!ENTIM0,X
		BNE	WTBMV0020		; [->WTBMV0020]
;
		STZ	<ENWRK2,X
		JMP	WATABOURESET2
;
WTBMV0020	EQU	$
		JSR	WTBCRCK0090
;
WTBMV0040	EQU	$
		JSR	WATABOUCRCK
;
		LDY	#00
		LDA	<ENWRK0,X
		CMP	!ENYPSL,X
		BMI	WTBMV0080		; top side ? [no->WTBMV0080]
;
		LDY	#02
WTBMV0080	EQU	$
		LDA	WATABGMAXDAT,Y
		STA	!ENGMAX,X
;
		LDY	#00
		LDA	!ENYSPD,X
		EOR	!ENGMAX,X
		BMI	WTBMV00C0		; 中間ポーズ ? [no->WTBMV00C0]
;
		LDA	!ENYSPD,X
		CLC
		ADC	#00060H
		CMP	#00060H*2
		BCC	WTBMV0120		; 中間ポーズ ? [no->WTBMV0120]
;
		LDA	!ENYSPD,X
		CLC
		ADC	#000a0H
		CMP	#000a0H*2
		BCC	WTBMV0100		; 中間ポーズ ? [yes->WTBMV0100]
;
WTBMV00C0	EQU	$
		INY
		LDA	!ENYSPD,X
		BMI	WTBMV0100		; 上昇中 ? [yes->WTBMV0100]
;
		INY
WTBMV0100	EQU	$
		TYA
		AND	#000FFH
		STA	!ENCHPT,X
WTBMV0120	EQU	$
		JSL	>EPCRCK
;
		RTL
;
;
WATABOUCRCK	EQU	$
		LDY	!ECRSFG,X
		BPL	WTBCRCK0040		; プレイヤー衝突 ? [no->WTBCRCK0040]
;
		LDA	#0001CH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	#00400H
		STA	!FURA_FG		; プレイヤー フラフラ フラグ セット
		LDA	#03H
		STA	BG2OF_FG
		LDA	#010H
		STA	BIRIBIRI
		BRA	WTBCRCK0080
;
WTBCRCK0040	EQU	$
		DEY
		BMI	WTBCRCK00A0		; 衝突 ? [no->WTBCRCK00A0]
		BEQ	WTBCRCK00A0		; 赤ちゃん ? [yes->WTBCRCK00A0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	WTBCRCK00A0		; move mode ? [no->WTBCRCK00A0]
;
		LDA	!ENSHOT,Y
		BEQ	WTBCRCK00A0		; shot ? [no->WTBCRCK00A0]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
WTBCRCK0080	EQU	$
;[1995.03.23.TH]		STZ	!ENXSPD,X
;[1995.03.23.TH]		STZ	!ENYSPD,X
;[1995.03.23.TH]		STZ	!ENGPOW,X
;[1995.03.23.TH]		LDA	#01
;[1995.03.23.TH]		STA	<ENWRK2,X
;[1995.03.23.TH]		LDA	#03
;[1995.03.23.TH]		STA	!ENTIM0,X
;[1995.03.23.TH];
;[1995.03.23.TH]		M8				; memory 8bit mode !!
;[1995.03.23.TH];
;[1995.03.23.TH]		LDA	#0FFH
;[1995.03.23.TH]		STA	!ENYUSN,X
;[1995.03.23.TH];
;[1995.03.23.TH]		M16				; memory 16bit mode !!
;[1995.03.23.TH];
WTBCRCK0090	EQU	$
		LDA	#FSMK0
		JSL	>EXINSR			; 煙効果 !!
;
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	!ECENTY,X
		STA	!EXYPSL,Y
		LDA	#06
		STA	!EXCHPT,Y
		STA	!EXWRK0,Y
		LDA	#04
		STA	!EXTIM0,Y
		BRA	WATABOURESET
;
;[1995.03.23.TH]		PLA
;[1995.03.23.TH]		RTL
;
WTBCRCK00A0	EQU	$
		RTS
;
;
WATABCLRCK	EQU	$
		LDA	!ENDSXL,X
		CLC
		ADC	#watabouleftclr
		CMP	#watabouxarea
		BCS	WATABOURESET		; 横 範囲内 ? [no->WATABOURESET]
;
;[1995.03.24.FR]		LDA	<ENWRK0,X
;[1995.03.24.FR]		SEC
;[1995.03.24.FR]		SBC	!SCCV1
		LDA	!ENDSYL,X
		CLC
		ADC	#wataboutopclr
		CMP	#watabouyarea
		BCS	WATABOURESET		; 縦 範囲内 ? [no->WATABOURESET]
;
		RTS
;
WATABOURESET	EQU	$
		PLA
WATABOURESET2	EQU	$
;
		DEC	!WATAB_COUNT		; 綿ぼうフラグ ｏｆｆ！！
;
		LDA	<ENWRK4,X
		TRB	!WATAB_STLIN		; ラインビット ｏｆｆ！！
;
		JMP	>ENCLEAR
;
;
;[1995.03.23.TH]		LDA	!WATB_ST_FG
;[1995.03.23.TH]		BEQ	WATABOUCLEAR		; 綿ぼうクリア ? [yes->WATABOUCLEAR]
;[1995.03.23.TH];
;[1995.03.23.TH]		M8				; memory 8bit mode !!
;[1995.03.23.TH];
;[1995.03.23.TH]		LDA	#005H
;[1995.03.23.TH]		STA	!ENYUSN,X
;[1995.03.23.TH];
;[1995.03.23.TH]		M16				; memory 16bit mode !!
;[1995.03.23.TH];
;[1995.03.23.TH]		LDA	!SCHMK1
;[1995.03.23.TH]		STA	!ENMUKI,X
;[1995.03.23.TH]		LDA	#watabougpow
;[1995.03.23.TH]		STA	!ENGPOW,X
;[1995.03.23.TH];
;[1995.03.23.TH]		LDA	<RANDM0
;[1995.03.23.TH]		AND	#00003H
;[1995.03.23.TH]		ASL	A
;[1995.03.23.TH]		ASL	A
;[1995.03.23.TH]		ORA	!SCHMK1
;[1995.03.23.TH]		TAY
;[1995.03.23.TH]		LDA	!SCCH1
;[1995.03.23.TH]		CLC
;[1995.03.23.TH]		ADC	WATABXPS,Y
;[1995.03.23.TH]		STA	!ENXPSL,X		; X ポジションセット
;[1995.03.23.TH]		AND	#00010H
;[1995.03.23.TH]		LSR	A
;[1995.03.23.TH]		LSR	A
;[1995.03.23.TH]		LSR	A
;[1995.03.23.TH]		TAY
;[1995.03.23.TH]		LDA	WATABGMAXDAT,Y
;[1995.03.23.TH]		STA	!ENGMAX,X		; G-MAX セット !!
;[1995.03.23.TH]		PHY
;[1995.03.23.TH]		LDY	<ENWRK4,X		; 綿ぼうインデックス
;[1995.03.23.TH]		LDA	!SCCV1
;[1995.03.23.TH]		AND	#0FF00H
;[1995.03.23.TH]		CLC
;[1995.03.23.TH]		ADC	WATABYPS,Y
;[1995.03.23.TH]		STA	<ENWRK0,X
;[1995.03.23.TH]		PLY
;[1995.03.23.TH]		CLC
;[1995.03.23.TH]		ADC	WATABYPOSDTA,Y
;[1995.03.23.TH]		STA	!ENYPSL,X		; Y ポジションセット
;[1995.03.23.TH]		STZ	!ENYSPD,X		; Y スピードセット !!
;[1995.03.23.TH]		LDY	!ENMUKI,X
;[1995.03.23.TH]		LDA	WATABXSPD,Y
;[1995.03.23.TH]		STA	!ENXSPD,X		; X スピードセット !!
;[1995.03.23.TH];
;[1995.03.23.TH]		M8				; memory 8bit mode !!
;[1995.03.23.TH];
;[1995.03.23.TH]		STZ	!ENXSDR,X
;[1995.03.23.TH]		STZ	!ENYSDR,X
;[1995.03.23.TH];
;[1995.03.23.TH]		M16				; memory 16bit mode !!
;[1995.03.23.TH];
;[1995.03.23.TH]		RTL
;[1995.03.23.TH];
;[1995.03.23.TH];
;[1995.03.23.TH]WATABOUCLEAR	EQU	$
;[1995.03.23.TH]		JMP	>ENCLEAR
;
;
;------------------------------------------------------------------------
;-	initial (FHOTM)							-
;------------------------------------------------------------------------
fire_otama00	EQU	000H
fire_otama01	EQU	001H
fire_otama02	EQU	002H
fire_otama03	EQU	003H
fire_otama04	EQU	004H
fire_otama05	EQU	005H
fire_otama06	EQU	006H
fire_otama07	EQU	007H
fire_otama08	EQU	008H
fire_otama09	EQU	009H
fire_otama0A	EQU	00AH
fire_otama0B	EQU	00BH
fire_otama0C	EQU	00CH
fire_otama0D	EQU	00DH
fire_otama0E	EQU	00EH
fire_otama0F	EQU	00FH
fire_otama10	EQU	010H
fire_otama11	EQU	011H
fire_otama12	EQU	012H
fire_otama13	EQU	013H
;
fire_otamapow	EQU	004H
fire_otama_mvtm EQU	03
fire_otama_mvpt EQU	04
fire_otama_tntm EQU	04
f_otama_tunept	EQU	08
f_otama_flip	EQU	00
;
FHO_MARKPOS	EQU	$
		WORD	-00030H, 00030H
;
FHO_INITSPD	EQU	$
		WORD	-00200H, 00200H
;
FHOTMIN		EQU	$
		LDA	!ENXPSL,X
		CLC
		ADC	FHO_MARKPOS
		STA	<ENWRK0,X		; 左 目標
		LDA	!ENXPSL,X
		CLC
		ADC	FHO_MARKPOS+2
		STA	<ENWRK2,X		; 右 目標
;
		LDA	#fire_otamapow
		STA	!ENXPOW,X
;
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		EOR	#00002H
		STA	!ENMUKI,X
		TAY
		LDA	FHO_INITSPD,Y
		STA	!ENXSPD,X
		LDA	!ENXPSL,X
		SEC
		SBC	FHO_MARKPOS,Y
		STA	!ENXPSL,X
		LDA	#fire_otama_mvtm
		STA	!ENTIM0,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (FHOTM)							-
;------------------------------------------------------------------------
FHO_TURNPTN	EQU	$
		BYTE	fire_otama00, fire_otama09, fire_otama08, fire_otama07
		BYTE	fire_otama06, fire_otama05, fire_otama04, fire_otama00
;
HINOKOPOS	EQU	$
		WORD	00008H, 0FFF8H
;
FHOTMMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	!ENXSPD,X
		BEQ	FHOMV0200		; 反転 ? [yes->FHOMV0200]
;
		LDA	<ENWRK0,X
		CMP	!ENXPSL,X
		BCS	FHOMV0100		; 左 オーバー ? [yes->FHOMV0100]
;
		LDA	<ENWRK2,X
		CMP	!ENXPSL,X
		BCC	FHOMV0100		; 右 オーバー ? [yes->FHOMV0100]
;
		LDA	!ENTIM0,X
		BNE	FHOMV00E0		; pattern change ? [no->FHOMV00E0]
;
		LDA	#fire_otama_mvtm
		STA	!ENTIM0,X
		LDA	!ENCHPT,X
		INC	A
		AND	#00003H
		STA	!ENCHPT,X
FHOMV00E0	EQU	$
		LDA	<FRCNT2
		AND	#00007H
		BNE	FHOMV00F0		; 火の粉 ? [no->FHOMV00F0]
;
		LDY	!ENMUKI,X
		LDA	!ENXPSL,X
		CLC
		ADC	HINOKOPOS,Y
		STA	<EWORK
		LDA	#FHHIK
		JSL	>EXINSR
;
		LDA	<RANDM0
		AND	#00006H
		SEC
		SBC	#00002H
		CLC
		ADC	!ENYPSL,X
		STA	!EXYPSL,Y
		LDA	<EWORK
		STA	!EXXPSL,Y
		LDA	#0006
		STA	!EXTIM0,Y
		LDA	#0004-1
		STA	!EXCHPT,Y
FHOMV00F0	EQU	$
		BRA	FHOMV01F0
;
FHOMV0100	EQU	$
		STA	!ENXPSL,X
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		LDA	#f_otama_tunept-1
		STA	<ENWRK4,X
		LDA	#fire_otama_tntm
		STA	!ENTIM0,X
FHOMV01F0	EQU	$
		JMP	PLAYERDAMAGE
;
;
FHOMV0200	EQU	$
		LDA	!ENTIM0,X
		BNE	FHOMV01F0		; pattern change ? [no->FHOMV01F0]
;
		LDA	#fire_otama_tntm
		STA	!ENTIM0,X
		LDA	<ENWRK4,X
		DEC	A
		BMI	FHOMV0280		; turn end ? [yes->FHOMV0280]
;
		STA	<ENWRK4,X
		TAY
		LDA	FHO_TURNPTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		CPY	#f_otama_flip
		BNE	FHOMV01F0		; flip ? [no->FHOMV01F0]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		BRA	FHOMV01F0
;
FHOMV0280	EQU	$
		LDA	!ENMUKI,X
		TAY
		LDA	FHO_INITSPD,Y
		STA	!ENXSPD,X
		LDA	#fire_otamapow
		STA	!ENXPOW,X
		LDA	#fire_otama_mvtm
		STA	!ENTIM0,X
		BRA	FHOMV01F0
;
;
;------------------------------------------------------------------------
;-	initial (FVOTM)							-
;------------------------------------------------------------------------
FVOTMIN		EQU	$
		LDA	!ENYPSL,X
		CLC
		ADC	FHO_MARKPOS
		STA	<ENWRK0,X		; 左 目標
		LDA	!ENYPSL,X
		CLC
		ADC	FHO_MARKPOS+2
		STA	<ENWRK2,X		; 右 目標
;
		LDA	#fire_otamapow
		STA	!ENGPOW,X
;
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		EOR	#00002H
		STA	!ENCONT,X
		TAY
		LDA	FHO_INITSPD,Y
		STA	!ENYSPD,X
		LDA	!ENYPSL,X
		SEC
		SBC	FHO_MARKPOS,Y
		STA	!ENYPSL,X
		LDA	FVO_MOVE,Y
		STA	<EWORK
		LDY	<ENWRK4,X
		LDA	(<EWORK),Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#fire_otama_mvtm
		STA	!ENTIM0,X
		LDA	#fire_otama_mvpt-1
		STA	<ENWRK4,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (FVOTM)							-
;------------------------------------------------------------------------
FVOUPPT		EQU	$
		BYTE	fire_otama00, fire_otama01, fire_otama02, fire_otama03
;
FVODOWNPT	EQU	$
		BYTE	fire_otama0A, fire_otama0B, fire_otama0C, fire_otama0D
;
FVOTOPTURNPT	EQU	$
		BYTE	fire_otama0D, fire_otama09, fire_otama08, fire_otama07
		BYTE	fire_otama06, fire_otama05, fire_otama04, fire_otama00
;
FVOUNDERTURNPT	EQU	$
		BYTE	fire_otama03, fire_otama13, fire_otama12, fire_otama11
		BYTE	fire_otama10, fire_otama0F, fire_otama0E, fire_otama0A
;
FVO_MOVE	EQU	$
		WORD	FVOUPPT
		WORD	FVODOWNPT
;
FVO_TURN	EQU	$
		WORD	FVOTOPTURNPT
		WORD	FVOUNDERTURNPT
;
FVOTMMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	!ENYSPD,X
		BNE	FVOMV0020		; 反転 ? [no->FVOMV0020]
;
		JMP	FVOMV0200		; 反転 ? [yes->FVOMV0200]
;
FVOMV0020	EQU	$
		LDA	<ENWRK0,X
		CMP	!ENYPSL,X
		BCS	FVOMV0100		; 上 オーバー [yes->FVOMV0100]
;
		LDA	<ENWRK2,X
		CMP	!ENYPSL,X
		BCC	FVOMV0100		; 下 オーバー [yes->FVOMV0100]
;
		LDA	!ENTIM0,X
		BNE	FVOMV00A0		; pattern change ? [no->FVOMV00A0]
;
		LDA	#fire_otama_mvtm
		STA	!ENTIM0,X
		LDY	<ENCONT,X
		LDA	FVO_MOVE,Y
		STA	<EWORK
		DEC	<ENWRK4,X
		BPL	FVOMV0080		; [->FVOMV0080]
;
		LDA	#fire_otama_mvpt-1
		STA	<ENWRK4,X
FVOMV0080	EQU	$
		LDY	<ENWRK4,X
		LDA	(<EWORK),Y
		AND	#000FFH
		STA	!ENCHPT,X
FVOMV00A0	EQU	$
		LDA	<FRCNT2
		AND	#00007H
		BNE	FVOMV00F0		; 火の粉 ? [no->FVOMV00F0]
;
		LDY	<ENCONT,X
		LDA	!ENYPSL,X
		CLC
		ADC	HINOKOPOS,Y
		STA	<EWORK
		LDA	#FVHIK
		JSL	>EXINSR
;
		LDA	<RANDM0
		AND	#00006H
		SEC
		SBC	#00002H
		CLC
		ADC	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	<EWORK
		STA	!EXYPSL,Y
		LDA	#0006
		STA	!EXTIM0,Y
		LDA	#0004-1
		STA	!EXCHPT,Y
FVOMV00F0	EQU	$
		BRA	FVOMV01F0
;
FVOMV0100	EQU	$
		STA	!ENYPSL,X
		STZ	!ENYSPD,X
		STZ	!ENGPOW,X
		LDA	#f_otama_tunept-1
		STA	<ENWRK4,X
		LDA	#fire_otama_tntm
		STA	!ENTIM0,X
		LDY	<ENCONT,X
		LDA	FVO_TURN,Y
		STA	<EWORK
		LDY	<ENWRK4,X
		LDA	(<EWORK),Y
		AND	#000FFH
		STA	!ENCHPT,X
FVOMV01F0	EQU	$
		JMP	PLAYERDAMAGE
;
;
FVOMV0200	EQU	$
		LDY	<ENCONT,X
		LDA	FVO_TURN,Y
		STA	<EWORK
		LDA	!ENTIM0,X
		BNE	FVOMV01F0		; pattern change ? [no->FVOMV01F0]
;
		DEC	<ENWRK4,X
		BMI	FVOMV0280
;
		LDY	<ENWRK4,X
		LDA	(<EWORK),Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#fire_otama_tntm
		STA	!ENTIM0,X
		BRA	FVOMV01F0
;
FVOMV0280	EQU	$
		LDA	#fire_otamapow
		STA	!ENGPOW,X
		LDA	#fire_otama_mvtm
		STA	!ENTIM0,X
		LDA	#fire_otama_mvpt-1
		STA	<ENWRK4,X
		LDA	<ENCONT,X
		EOR	#00002H
		STA	<ENCONT,X
		TAY
		LDA	FHO_INITSPD,Y
		STA	!ENYSPD,X
		LDA	FVO_MOVE,Y
		STA	<EWORK
		LDY	<ENWRK4,X
		LDA	(<EWORK),Y
		AND	#000FFH
		STA	!ENCHPT,X
		BRA	FVOMV01F0
;
;
;------------------------------------------------------------------------
;-	initial (DEBU0)							-
;------------------------------------------------------------------------
debohou00	EQU	000H
debohou01	EQU	001H
debohou02	EQU	002H
debohou03	EQU	003H
debohou04	EQU	004H
debohou05	EQU	005H
debohou06	EQU	006H
debohou07	EQU	007H
debohou08	EQU	008H
debohou09	EQU	009H
debohou0A	EQU	00AH
debohou0B	EQU	00BH
debohou0C	EQU	00CH
debohou0D	EQU	00DH
debohou0E	EQU	00EH
debohou0F	EQU	00FH
debohou10	EQU	010H
debohou11	EQU	011H
debohou12	EQU	012H
debohou13	EQU	013H
debohou14	EQU	014H
debohou15	EQU	015H
debohou16	EQU	016H
debohou17	EQU	017H
;
debuwalktime	EQU	03
debuwalkptn	EQU	12
deburuntime	EQU	02
;
debuwalk	EQU	000H
deburun		EQU	002H
debucrush	EQU	004H
debuboyoyon	EQU	006H
;
debucrushptn	EQU	(DEBUCRUSHTM-DEBUCRUSHPT)-1
debuboyoyonptn	EQU	(DBBOYOYONTM-DBBOYOYONPT)-1
;
DEBUWALKSPD	EQU	$
		WORD	0FFA0H, 00060H
;
DEBURUNSPD	EQU	$
		WORD	0FF00H, 00100H
;
DEBUEGGNUM	EQU	$
		WORD	EGG08, EGG09
;
DEBUCOLOR	EQU	$
		WORD	00001H<<1, 00000H<<1
;
DEBU0IN		EQU	$
		LDA	!ENWRKC,X
		BNE	DEBU0IN0040
;
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		INC	A
		STA	!ENWRKC,X
DEBU0IN0040	EQU	$
		TAY
		DEY
		LDA	!ENCLOR,X
		ORA	DEBUCOLOR,Y
		STA	!ENCLOR,X
		LDA	DEBUEGGNUM,Y
		STA	<ENWRK4,X
		TYX
		JMP	(DEBU0INMODSEL,X)
;
DEBU0INMODSEL	EQU	$
		WORD	DEBU0WALKIN
		WORD	DEBU0RUNIN
;
;
DEBU0WALKIN	EQU	$
		LDX	<ENINDX
		LDY	!ENMUKI,X
		LDA	DEBUWALKSPD,Y
		STA	!ENXSPD,X
		LDA	#debuwalk
		STA	<ENCONT,X
		LDA	#debuwalktime
		STA	!ENTIM0,X
		LDA	DEBUWALKPT
		AND	#000FFH
		STA	!ENCHPT,X
		STZ	<ENWRK0,X
		RTL
;
;
DEBU0RUNIN	EQU	$
		LDX	<ENINDX
		LDY	!ENMUKI,X
		LDA	DEBURUNSPD,Y
		STA	!ENXSPD,X
		LDA	#deburun
		STA	<ENCONT,X
		LDA	#deburuntime
		STA	!ENTIM0,X
		LDA	DEBURUNPT
		AND	#000FFH
		STA	!ENCHPT,X
		STZ	<ENWRK0,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (DEBU0)							-
;------------------------------------------------------------------------
DEBU0MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JMP	(DEBUMODSEL,X)
;
DEBUMODSEL	EQU	$
		WORD	DEBUWALK
		WORD	DEBURUN
		WORD	DEBUCRUSH
		WORD	DBBOYOYON
;
;
DEBUWALKPT	EQU	$
		BYTE	debohou04, debohou05, debohou06, debohou07
		BYTE	debohou08, debohou09, debohou0A, debohou0B
		BYTE	debohou0C, debohou0D, debohou0E, debohou0F
;
DEBUWALK	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	DBWK00F0		; pattern change ? [no->DBWK00F0]
;
		LDA	#debuwalktime
		STA	!ENTIM0,X
		LDA	<ENWRK0,X
		INC	A
		CMP	#debuwalkptn
		BCC	DBWK0040		;[->DBWK0040]
;
		LDA	#00
DBWK0040	EQU	$
		STA	<ENWRK0,X
		TAY
		LDA	DEBUWALKPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
DBWK00F0	EQU	$
		JMP	DPCRCK
;
;
DEBURUNPT	EQU	$
		BYTE	debohou10, debohou11
;
DEBURUN		EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	DBRN00F0		; pattern change ? [no->DBRN00F0]
;
		LDA	#deburuntime
		STA	!ENTIM0,X
		LDA	<ENWRK0,X
		EOR	#00001H
		STA	<ENWRK0,X
		TAY
		LDA	DEBURUNPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
DBRN00F0	EQU	$
		JMP	DPCRCK
;
;
DEBUCRUSHPT	EQU	$
		BYTE	debohou13, debohou02, debohou01, debohou00
;
DEBUCRUSHTM	EQU	$
		HEX	04, 03, 02, 02
;
DEBUCRUSH	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	DEBUCRUSH00F0		; pattern change ? [no->DEBUCRUSH00F0]
;
		DEC	<ENWRK0,X
		BMI	DEBUCRUSH0100		; [->DEBUCRUSH0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	DEBUCRUSHPT,Y
		STA	!ENCHPT,X
		LDA	DEBUCRUSHTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
DEBUCRUSH00F0	EQU	$
		RTL
;
DEBUCRUSH0100	EQU	$
		LDA	<ENWRK4,X
		TXY
		JSL	>ESTATST
;
		LDA	#EGGTM
		STA	!ENTIM0,X
		LDA	#EINIT
		STA	!ENMODE,X
		RTL
;
;
;[1994.10.24.MO]DEBUCRUSHPT	EQU	$
;[1994.10.24.MO]		BYTE	debohou01, debohou02, debohou01, debohou00
;[1994.10.24.MO]		BYTE	debohou03, debohou15, debohou16, debohou17
;[1994.10.24.MO]		BYTE	debohou16, debohou15, debohou03, debohou00
;[1994.10.24.MO]		BYTE	debohou01, debohou02, debohou13, debohou14
;[1994.10.24.MO]		BYTE	debohou13, debohou02, debohou13, debohou14
;[1994.10.24.MO]		BYTE	debohou13, debohou12, debohou13, debohou14
;[1994.10.24.MO]		BYTE	debohou13, debohou12, debohou13, debohou14
;[1994.10.24.MO]		BYTE	debohou13, debohou12, debohou13, debohou14
;[1994.10.24.MO]		BYTE	debohou13, debohou12, debohou13, debohou14
;[1994.10.24.MO]		BYTE	debohou13, debohou02, debohou01, debohou00
;[1994.10.24.MO];
;[1994.10.24.MO]DEBUCRUSHTM	EQU	$
;[1994.10.24.MO]		HEX	03, 06, 03, 02, 02, 02, 03, 06
;[1994.10.24.MO]		HEX	03, 02, 02, 02, 02, 02, 02, 02
;[1994.10.24.MO]		HEX	02, 02, 02, 20, 06, 06, 06, 06
;[1994.10.24.MO]		HEX	06, 06, 06, 06, 06, 06, 06, 06
;[1994.10.24.MO]		HEX	06, 06, 06, 06, 04, 03, 02, 02
;[1994.10.24.MO];
;[1994.10.24.MO]DEBUCRUSH	EQU	$
;[1994.10.24.MO]		LDX	<ENINDX
;[1994.10.24.MO]		LDA	!ENTIM0,X
;[1994.10.24.MO]		BNE	DBCRUSH00F0		; pattern change ? [no->DBCRUSH00F0]
;[1994.10.24.MO];
;[1994.10.24.MO]		DEC	<ENWRK0,X
;[1994.10.24.MO]		BMI	DBCRUSH0100		; 復活 ? [yes->DBCRUSH0100]
;[1994.10.24.MO];
;[1994.10.24.MO]		LDY	<ENWRK0,X
;[1994.10.24.MO]		LDA	DEBUCRUSHPT,Y
;[1994.10.24.MO]		AND	#000FFH
;[1994.10.24.MO]		STA	!ENCHPT,X
;[1994.10.24.MO]		LDA	DEBUCRUSHTM,Y
;[1994.10.24.MO]		AND	#000FFH
;[1994.10.24.MO]		STA	!ENTIM0,X
;[1994.10.24.MO]		CPY	#08
;[1994.10.24.MO]		BNE	DBCRUSH00F0		; ジャンプ ? [no->DBCRUSH00F0]
;[1994.10.24.MO];
;[1994.10.24.MO]		LDA	#0FE00H
;[1994.10.24.MO]		STA	!ENYSPD,X
;[1994.10.24.MO]		LDA	!ENCBFG,X
;[1994.10.24.MO]		AND	#0FFFEH
;[1994.10.24.MO]		STA	!ENCBFG,X		; 足当たりのクリア !!
;[1994.10.24.MO]DBCRUSH00F0	EQU	$
;[1994.10.24.MO]		JMP	DPCRCK
;[1994.10.24.MO];
;[1994.10.24.MO]DBCRUSH0100	EQU	$
;[1994.10.24.MO]		LDA	!EPXMUK,X
;[1994.10.24.MO]		AND	#000FFH
;[1994.10.24.MO]		EOR	#00002H
;[1994.10.24.MO]		STA	!ENMUKI,X
;[1994.10.24.MO];
;[1994.10.24.MO]		JSL	>DB3IN0030
;[1994.10.24.MO];
;[1994.10.24.MO]		JMP	DPCRCK
;[1994.10.24.MO];
;[1994.10.24.MO]DBCRUSH0200	EQU	$
;[1994.10.24.MO]		LDY	!ENMUKI,X
;[1994.10.24.MO]		LDA	DEBUWALKSPD,Y
;[1994.10.24.MO]		BRA	DBCRUSH0220
;[1994.10.24.MO];
;[1994.10.24.MO]DBCRUSH0210	EQU	$
;[1994.10.24.MO]		LDY	!ENMUKI,X
;[1994.10.24.MO]		LDA	DEBURUNSPD,Y
;[1994.10.24.MO]DBCRUSH0220	EQU	$
;[1994.10.24.MO]		STA	!ENXSPD,X
;[1994.10.24.MO]		LDA	#deburun
;[1994.10.24.MO]		STA	<ENCONT,X
;[1994.10.24.MO]		LDA	#deburuntime
;[1994.10.24.MO]		STA	!ENTIM0,X
;[1994.10.24.MO]		LDA	DEBURUNPT
;[1994.10.24.MO]		AND	#000FFH
;[1994.10.24.MO]		STA	!ENCHPT,X
;[1994.10.24.MO]		STZ	<ENWRK0,X
;[1994.10.24.MO]		RTS
;
;
DBBOYOYONPT	EQU	$
		BYTE	debohou00, debohou01, debohou02, debohou01
		BYTE	debohou00, debohou15, debohou16, debohou17
;
DBBOYOYONTM	EQU	$
		HEX	03, 03, 05, 03, 02, 04, 05, 0F
;
DBBOYOYON	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		AND	#0000000000000001B
		BEQ	DBBOYOYON0040		; 着地 ? [yes->DBBOYOYON0040]
;
		STZ	!ENXSPD,X
DBBOYOYON0040	EQU	$
		LDA	!ENTIM0,X
		BNE	DBBOYOYON00F0		; pattern change ? [no->DBBOYOYON00F0]
;
		DEC	<ENWRK0,X
		BPL	DBBOYOYON0080		; 復活 ? [no->DBBOYOYON0080]
;[1994.10.24.MO]		BMI	DBCRUSH0100		; 復活 ? [yes->DBCRUSH0100]
;
		LDA	!EPXMUK,X
		AND	#000FFH
		EOR	#00002H
		STA	!ENMUKI,X
;
		JSL	>DEBU0RUNIN
;
		BRA	DPCRCK
;
DBBOYOYON0080	EQU	$
		LDY	<ENWRK0,X
		LDA	DBBOYOYONPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	DBBOYOYONTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
DBBOYOYON00F0	EQU	$
DPCRCK		EQU	$
		LDY	!ECRSFG,X
		BMI	DPCRCK0080		; プレイヤー衝突 ? [yes->DPCRCK0080]
;
		DEY
		BMI	DPCRCK0070		; 衝突無し ? [yes->DPCRCK0070]
		BEQ	DPCRCK0070		; 赤ちゃん衝突 ? [yes->DPCRCK0070]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	DPCRCK0070		; mode move ? [no->DPCRCK0070]
;
		LDA	!ENSHOT,Y
		BEQ	DPCRCK0070		; shot ? [no->DPCRCK0070]
;
		LDA	!ENGPOW,Y
		CMP	#00040H
		BPL	DPCRCK0100		; MAX ? [no->DPCRCK0100]
;
		PHY
		JSL	>ENDEATH_SET		; 死亡セット !!
;
		PLY
		LDA	#0FE00H
		STA	!ENYSPD,X
		LDA	!ENXSPD,Y
		ASR16
		ASR16
		STA	!ENXSPD,X
		PHY
		JSL	>FSMK0_SET
;
		PLX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
DPCRCK0070	EQU	$
		RTL
;
;
DPCRCK0080	EQU	$
		JSL	>EPFOOTCROSS		; 踏まれたチェック !!
;
		BCS	DPCRCK00A0		; 踏まれた ? [yes->DPCRCK00A0]
		BEQ	DPCRCK00F0		; [->DPCRCK00F0]
;
		JMP	>PLFLST
;
DPCRCK00A0	EQU	$
		LDA	!PLDOSN
		BEQ	DPCRCK00B0		; どすん ? [no->DPCRCK00B0]
;
		JMP	DPCRCK0200
;
DPCRCK00B0	EQU	$
		LDA	#00015H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
;[1994.10.17.MO]		LDA	#0F800H
		LDA	#0FC00H
		STA	!PLYSPD
		LDA	#P008
		STA	!PLJUMP
		LDA	#01H+8000H
		STA	!PLSPJP
		STZ	!ENXSPD,X
		LDA	#debucrush
		STA	<ENCONT,X
		LDA	#debucrushptn
		STA	<ENWRK0,X
		TAY
		LDA	DEBUCRUSHPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	DEBUCRUSHTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
DPCRCK00F0	EQU	$
		RTL
;
;
DBHANEXSPD	EQU	$
		WORD	00100H, 0FF00H
;
DPCRCK0100	EQU	$
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		EOR	!ENXSPD,Y
		BMI	DPCRCK00F0		; 衝突無し ? [yes->DPCRCK00F0]
;
		LDA	#00015H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	!ENXSPD,Y
		ASR16
		ASR16
		STA	<EWORK
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAX
		LDA	<EWORK
		CLC
		ADC	#00100H
		CMP	#00200H
		BCS	DPCRCK0180		; [->DPCRCK0180]
;
		LDA	DBHANEXSPD,X
		STA	<EWORK
DPCRCK0180	EQU	$
		LDX	<ENINDX
		LDA	<EWORK
		STA	!ENXSPD,X
		EOR	#0FFFFH
		INC	A
		STA	!ENXSPD,Y
		LDA	#0FE00H
		STA	!ENYSPD,X
		LDA	!ENYSPD,Y
		EOR	#0FFFFH
		INC	A
		STA	!ENYSPD,Y
		LDA	!ENCBFG,X
		AND	#0FFFEH
		STA	!ENCBFG,X		; 足当たりのクリア !!

;
		LDA	#debuboyoyon
		STA	<ENCONT,X
		LDA	#debuboyoyonptn
		STA	<ENWRK0,X
		TAY
		LDA	DBBOYOYONPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	DBBOYOYONTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
		RTL
;
DPCRCK0200	EQU	$
		JSL	>FUNDA_ENFALL_L
;
		LDX	<ENINDX
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (KOMO0)							-
;------------------------------------------------------------------------
koumori00	EQU	000H
koumori01	EQU	001H
koumori02	EQU	002H
koumori03	EQU	003H
koumori04	EQU	004H
;
koumoritime	EQU	03
komoriptn	EQU	06
pl_head		EQU	00010H
k_p_area_y	EQU	00020H
k_p_width_area	EQU	00080H
k_start_angle	EQU	(000CAH*2)
k_angle_adder	EQU	04
next_ten2_time	EQU	12
tenten_time	EQU	(next_ten2_time*5)
;
KOMO0IN		EQU	$
		LDA	#koumori04
		STA	!ENCHPT,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (KOMO0)							-
;------------------------------------------------------------------------
KOMO0MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		JSR	KMRPLCRCK		; コウモリとプレイヤーの衝突 !!
;
		LDA	<ENCONT,X
		TAX
		JSR	(KOMO0MODESEL,X)
;
		JSL	>EPCRCK
;
		RTL
;
;
KOMO0MODESEL	EQU	$
		WORD	KOMO0WAIT
		WORD	KOMO0FALL
		WORD	KOMO0LOOP
;
KOMORIX_EOR	EQU	$
		WORD	0FFFFH, 00000H
;
KOMO0WAIT	EQU	$
		LDX	<ENINDX
		LDA	!ECENTY,X
		SEC
		SBC	!PCENTY
		CLC
		ADC	#k_p_area_y
		BPL	KMWT00F0		; プレイヤーが縦の範囲内か ? [no->KMWT00F0]
;
		LDA	!ECENTX,X
		SEC
		SBC	!PCENTX
		CLC
		ADC	#k_p_width_area
		CMP	#k_p_width_area*2
		BCS	KMWT00F0		; プレイヤーが横の範囲内か ? [no->KMWT00F0]
;
		LDA	#k_start_angle
		STA	<ENWRK0,X
		JSR	KOUMORISPEEDSET		; コウモリ スピード セット !!
;
		LDA	#koumori00
		STA	!ENCHPT,X
		LDY	#00
		LDA	!ENYSPD,X
		BPL	KMWT0080		; [->KMWT0080]
;
		INY
		INY
KMWT0080	EQU	$
		LDA	KOUMORITIME,Y
		STA	!ENTIM0,X
;
		LDA	#0001BH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		INC	<ENCONT,X
		INC	<ENCONT,X
KMWT00F0	EQU	$
		RTS
;
;
KOMORIPTN	EQU	$
		BYTE	koumori00, koumori01, koumori02, koumori03
		BYTE	koumori02, koumori01
;
KOUMORITIME	EQU	$
		WORD	0003, 0001
;
KOMO0FALL	EQU	$
		LDX	<ENINDX
		LDA	!ECENTY,X
		SEC
		SBC	!PCENTY
		CLC
		ADC	#pl_head
		BMI	KMFAL00F0		; [no->KMFAL00F0]
;
		LDA	<ENWRK0,X
		CLC
		ADC	#k_angle_adder
		AND	#001FEH
		STA	<ENWRK0,X
		JSR	KOUMORISPEEDSET		; コウモリ スピード セット !!
;
		INC	<ENCONT,X
		INC	<ENCONT,X
KMFAL00F0	EQU	$
KOUMORIPTNSET	EQU	$
		LDA	!ENTIM0,X
		BNE	KMPTST00F0		; pattern change ? [no->KMPTST00F0]
;
		LDY	#00
		LDA	!ENYSPD,X
		BPL	KMPTST0020		; [->KMPTST0020]
;
		INY
		INY
KMPTST0020	EQU	$
		LDA	KOUMORITIME,Y
		STA	!ENTIM0,X
		LDA	<ENWRK4,X
		DEC	A
		BPL	KMPTST0040		; [->KMPTST0040]
;
		LDA	#komoriptn-1
KMPTST0040	EQU	$
		STA	<ENWRK4,X
		TAY
		LDA	KOMORIPTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
KMPTST00F0	EQU	$
		LDA	!ENTIM1,X
		BNE	KMPTST01F0		; テンテン ? [no->KMPTST01F0]
;
		LDA	#TEN_2
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		SEC
		SBC	!ENMOVX,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	!ENMOVY,X
		STA	!EXYPSL,Y
		LDA	#tenten_time
		STA	!EXTIM0,Y
		LDA	#next_ten2_time
		STA	!ENTIM1,X
KMPTST01F0	EQU	$
		RTS
;
;
KOMO0LOOP	EQU	$
		LDX	<ENINDX
		LDA	<ENWRK0,X
		BNE	KMLP0040		; [->KMLP0040]
;
		LDY	<ENWRK2,X
		BNE	KMLP0080		; [->KMLP0080]
;
		INC	<ENWRK2,X
KMLP0040	EQU	$
		CLC
		ADC	#k_angle_adder
		AND	#001FEH
		STA	<ENWRK0,X
		JSR	KOUMORISPEEDSET		; コウモリ スピード セット !!
;
KMLP0080	EQU	$
		JMP	KOUMORIPTNSET
;
;
;----------------------------------------------------------------
;-	コウモリ スピード セット				-
;-	(A) <- Angle						-
;----------------------------------------------------------------
KOUMORISPEEDSET EQU	$
;
		I16				; index 16bit mode !!
;
		TXY
		TAX
		LDA	>SIN,X
		STA	!ENYSPD,Y		; Y スピードセット
		LDA	>COS,X
		LDX	!ENMUKI,Y
		EOR	KOMORIX_EOR,X
		INC	A
		STA	!ENXSPD,Y		; X スピードセット
		TYX
;
		I8				; index 8bit mode !!
;
		RTS
;
;
;------------------------------------------------------------------------
;-	コウモリとプレイヤーの衝突					-
;------------------------------------------------------------------------
KMRPLCRCK	EQU	$
		LDY	!ECRSFG,X
		BPL	KPCRCK00F0		; プレイヤー衝突 ? [no->KPCRCK00F0]
;
		JSL	>EPFOOTCROSS_01
		BCS	KPCRCK00F0		; 踏まれた ? [yes->KPCRCK00F0]
		BEQ	KPCRCK00F0		; [->KPCRCK00F0]
;
		JSL	>PLFLST
;
KPCRCK00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	initial (KOMO1)							-
;------------------------------------------------------------------------
koumori1_gpower EQU	00008H
;
KOMO1INYSPD	EQU	$
		WORD	-0160H, 00160H
;
KOMO1YHABA	EQU	$
		WORD	00020H, 0FFE0H
;
KOMO1GMAX	EQU	$
		WORD	0F800H, 00800H
;
KOMO1XSPD	EQU	$
		WORD	0FF80H, 00080H
;
KOMO1IN		EQU	$
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		TAY
		LDA	!ENYPSL,X
		STA	<ENWRK0,X
;
		LDA	KOMO1INYSPD,Y
		STA	!ENYSPD,X
;
;;;;;;;;		CLC
;;;;;;;;		ADC	KOMO1YHABA,Y
;;;;;;;;		STA	!ENYPSL,X
		LDA	KOMO1GMAX,Y
		STA	!ENGMAX,X
		LDA	#koumori1_gpower
		STA	!ENGPOW,X
;
		LDY	!ENMUKI,X
		LDA	KOMO1XSPD,Y
		STA	!ENXSPD,X
		LDA	#koumori00
		STA	!ENCHPT,X
		LDY	#00
		LDA	!ENYSPD,X
		BPL	K1IN0080		; [->K1IN0080]
;
		INY
		INY
K1IN0080	EQU	$
		LDA	KOUMORITIME,Y
		STA	!ENTIM0,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (KOMO1)							-
;------------------------------------------------------------------------
KOMO1MV		EQU	$
		LDA	!ENWRK6,X
		BEQ	K1MV0020		; わきだし ? [no->K1MV0020]
;
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	K1MV0020		; mode move ? [yes->K1MV0020]
;
		DEC	!KOMOR_COUNT
		STZ	!ENWRK6,X
K1MV0020	EQU	$
		JSL	>ENMDCK			; mode check
;
		JSL	>EN_CLR_CHECK2
		BCC	K1MV0040		; 範囲内 ? [yes->K1MV0040]
;
		DEC	!KOMOR_COUNT
		STZ	!ENWRK6,X
		JMP	>ENCLEAR
;
K1MV0040	EQU	$
		JSR	KMRPLCRCK		; コウモリとプレイヤーの衝突 !!
;
		LDY	#00
		LDA	!ENYPSL,X
		CMP	<ENWRK0,X
		BPL	K1MV0080		; [->K1MV0080]
;
		INY
		INY
K1MV0080	EQU	$
		LDA	KOMO1GMAX,Y
		STA	!ENGMAX,X
		JSR	KOUMORIPTNSET
;
		JSL	>EPCRCK
;
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (PKPK0)							-
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;-	initial (PKPK1)							-
;------------------------------------------------------------------------
pkpk00		EQU	000H
pkpk01		EQU	001H
pkpk02		EQU	002H
pkpk03		EQU	003H
pkpk04		EQU	004H
pkpk05		EQU	005H
pkpk06		EQU	006H
pkpk07		EQU	007H
pkpk08		EQU	008H
pkpk09		EQU	009H
pkpk0A		EQU	00AH
pkpk0B		EQU	00BH
pkpk0C		EQU	00CH
pkpk0D		EQU	00DH
pkpk0E		EQU	00EH
pkpk0F		EQU	00FH
pkpk10		EQU	010H
;
pukupuku_r	EQU	00020H
pukupuku_xmax	EQU	00100H
pukupuku_xpower EQU	00004H
pkpk_swimptn	EQU	04
pkpk_turntime	EQU	08
pkpk_turnptn	EQU	05
;
pkpkjump	EQU	04
;
PKPKSTPOS	EQU	$
		WORD	pukupuku_r, -pukupuku_r
;
PKPK_XSPD	EQU	$
		WORD	-00100H, 00100H
;
PKPK_XMAX	EQU	$
		WORD	pukupuku_xmax, -pukupuku_xmax
;
PKPK0IN		EQU	$
PKPK1IN		EQU	$
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		EOR	#00002H
		STA	!ENMUKI,X
		TAY
		LDA	!ENXPSL,X
		STA	<ENWRK0,X		; センター X セーブ !!
		CLC
		ADC	PKPKSTPOS,Y
		STA	!ENXPSL,X
		LDA	PKPK_XSPD,Y
		STA	!ENXSPD,X
		LDA	#pkpk_swimptn-1
		STA	<ENWRK2,X
		TAY
		LDA	PKPKSWIMPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	PKPKSWIMTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
		LDA	!ENYPSL,X
		CLC
		ADC	#00004H
		STA	!ENWRK6,X		; 水面セーブ !!
		STA	!ENWRKC,X
		STZ	!ENWRKA,X		; 効果フラグ クリア !!
		RTL
;
;
;------------------------------------------------------------------------
;-	move (PKPK0)							-
;------------------------------------------------------------------------
PKPKSWIMPT	EQU	$
		BYTE	pkpk00, pkpk0E, pkpk00, pkpk01
;
PKPKSWIMTM	EQU	$
		HEX	08, 0A, 08, 0A
;
PKPK0MV		EQU	$
;;;;;;;;		JSL	>PKPK2_FALL
		LDA	!ENMODE,X
		CMP	#EFALL
		BNE	PKPK0MV0040		; FALL ? [no->PKPK0MV0040]
;
		LDA	#03
		STA	!ENCHPT,X
PKPK0MV0040	EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JSR	(PKPK0MODSEL,X)
;
		JSL	>EPCRCK
;
		RTL
;
;
;------------------------------------------------------------------------
;-	move (PKPK1)							-
;------------------------------------------------------------------------
PKPK1MV		EQU	$
;;;;;;;;		JSL	>PKPK2_FALL
		LDA	!ENMODE,X
		CMP	#EFALL
		BNE	PKPK1MV0040		; FALL ? [no->PKPK1MV0040]
;
		LDA	#03
		STA	!ENCHPT,X
PKPK1MV0040	EQU	$
		JSL	>ENMDCK			; mode check
;
		JSR	PKPKJUMPSET
;
		LDA	<ENCONT,X
		TAX
		JSR	(PKPK0MODSEL,X)
;
		JSL	>EPCRCK
;
		RTL
;
;
PKPK0MODSEL	EQU	$
		WORD	PKPKSWIM
		WORD	PKPKTURN
		WORD	PKPKJUMP
		WORD	PKPKJMP2
		WORD	PKPKJMP3
		WORD	PKPKJMP4
		WORD	PKPKJMP5
;
PKPKJUMPSET	EQU	$
		LDA	!ENWRK8,X
		BNE	PKJPST00F0		; ジャンプ禁止 ? [yes->PKJPST00F0]
;
		LDA	<RANDM0
		AND	#0003FH
		BNE	PKJPST00F0		; ジャンプセット ? [no->PKJPST00F0]
;
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		STZ	!ENYSPD,X
		STZ	!ENGPOW,X
		INC	!ENWRK8,X		; ジャンプ禁止フラグセット !!
		LDA	#pkpkjump
		STA	<ENCONT,X
PKJPST00F0	EQU	$
		RTS
;
;
PKPKSWIM	EQU	$
		LDX	<ENINDX
		JSR	PKPK_WATER_CK		; 重力セット !!
;
		LDA	!ENXPSL,X
		SEC
		SBC	<ENWRK0,X
		PHA
		CLC
		ADC	#pukupuku_r
		CMP	#pukupuku_r*2
		BCS	PKSW0100		; エリアオーバー ? [yes->PKSW0100]
;
		STZ	!ENXPOW,X
		PLA
		CLC
		ADC	#pukupuku_r-10H
		CMP	#(pukupuku_r-10H)*2
		BCC	PKSW0020		; 減速 エリア ? [no->PKSW0020]
;
		LDA	#pukupuku_xpower
		STA	!ENXPOW,X
PKSW0020	EQU	$
		LDY	#00
		LDA	!ENXPSL,X
		CMP	<ENWRK0,X
		BCC	PKSW0040		; 右 エリア ? [no->PKSW0040]
;
		INY
		INY
PKSW0040	EQU	$
		LDA	PKPK_XMAX,Y
		STA	!ENXMAX,X		; X max set !!
;
		LDA	!ENTIM0,X
		BNE	PKSW0080		; pattern change ? [no->PKSW0080]
;
		DEC	<ENWRK2,X
		BPL	PKSW0060		;[->PKSW0060]
;
		LDA	#pkpk_swimptn-1
		STA	<ENWRK2,X
PKSW0060	EQU	$
		LDY	<ENWRK2,X
		LDA	PKPKSWIMPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	PKPKSWIMTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
PKSW0080	EQU	$
		RTS
;
;
PKSW0100	EQU	$
		PLA
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAY
		LDA	<ENWRK0,X
		CLC
		ADC	PKPKSTPOS,Y
		STA	!ENXPSL,X
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		LDA	#pkpk_turntime
		STA	!ENTIM0,X
		LDA	#pkpk_turnptn-1
		STA	<ENWRK2,X
		LDA	#pkpk00
		STA	!ENCHPT,X
		LDA	PKPKTRNPTAD,Y
		STA	<ENWRK4,X
		INC	!ENWRK8,X		; ジャンプ禁止フラグセット !!
		INC	<ENCONT,X
		INC	<ENCONT,X
		RTS
;
;
PKPKTRNPTAD	EQU	$
		WORD	PKPKTRNRPT
		WORD	PKPKTRNLPT
;
PKPKTRNLPT	EQU	$
		BYTE	pkpk00, pkpk0E, pkpk10, pkpk0E, pkpk00
;
PKPKTRNRPT	EQU	$
		BYTE	pkpk00, pkpk01, pkpk0F, pkpk01, pkpk00
;
PKPKTURN	EQU	$
		LDX	<ENINDX
		JSR	PKPK_WATER_CK		; 重力セット !!
;
		LDA	!ENTIM0,X
		BNE	PKTN00F0		; pattern change ? [no->PKTN00F0]
;
		DEC	<ENWRK2,X
		BMI	PKTN0100		; 反転終了 ? [yes->PKTN0100]
;
		LDY	<ENWRK2,X
		CPY	#02
		BNE	PKTN0040		; flip ? [no->PKTN0040]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
PKTN0040	EQU	$
		LDA	#pkpk_turntime
		STA	!ENTIM0,X
		LDA	<ENWRK4,X
		STA	<EWORK
		LDA	(<EWORK),Y
		AND	#000FFH
		STA	!ENCHPT,X
PKTN00F0	EQU	$
		RTS
;
;
PKTN0100	EQU	$
		STZ	!ENWRK8,X		; ジャンプ禁止フラグクリア !!
PKTN0110	EQU	$
		LDA	#pkpk_swimptn-1
		STA	<ENWRK2,X
		TAY
		LDA	PKPKSWIMPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	PKPKSWIMTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
		LDY	!ENMUKI,X
		LDA	PKPK_XSPD,Y
		STA	!ENXSPD,X
		STZ	<ENCONT,X
		RTS
;
;
PKPKJUMP	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	PKJP00F0		; pattern change ? [yes->PKJP00F0]
;
		DEC	<ENWRK2,X
		BMI	PKJP0100		;[->PKJP0100]
;
		LDY	<ENWRK2,X
		LDA	#02
		STA	!ENTIM0,X
		LDA	#pkpk02
		STA	!ENCHPT,X
PKJP00F0	EQU	$
		RTS
;
;
PKJP0100	EQU	$
		LDA	#0003-1
		STA	<ENWRK2,X
		TAY
		LDA	PKJ2PTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#06
		STA	!ENTIM0,X
		LDA	#0F900H
		STA	!ENYSPD,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		RTS
;
;
PKJ2PTN		EQU	$
		BYTE	pkpk05, pkpk04, pkpk03
;
PKPKJMP2	EQU	$
		LDX	<ENINDX
		JSR	PKPK_WATER_CK2
;
		LDA	!ENYSPD,X
		CLC
		ADC	#00100H
		BMI	PKJ20000		; 頂点 mode ? [no-PKJ20000>]
;
		JMP	PKJ20100		; 頂点 mode ? [yes->PKJ20100]
;
PKJ20000	EQU	$
		LDY	!ENWRKA,X
		BNE	PKJ20020		; 離水効果セット ? [no->PKJ20020]
;
		LDA	!ENYPSL,X
		CMP	!ENWRK6,X
		BPL	PKJ20020		; 離水効果セット ? [no->PKJ20020]
;
		LDA	#PKSB1
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENWRK6,X
		SEC
		SBC	#00008H
		STA	!EXYPSL,Y
		LDA	#0006
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
;
		LDA	#00003H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		INC	!ENWRKA,X
PKJ20020	EQU	$
		LDA	!ENYPSL,X
		CMP	!ENWRK6,X
		BPL	PKJ20030		; 水上 ? [no->PKJ20030]
;
		LDA	!ENTIM1,X
		BNE	PKJ20030		; キラキラ水しぶきセット ? [no->PKJ20030]
;
		LDA	#PKSB0
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		STA	!EXYPSL,Y
		LDA	#0000FH
		STA	!EXCHPT,Y
		LDA	#0003
		STA	!EXTIM0,Y
		LDA	#0006
		STA	!ENTIM1,X
PKJ20030	EQU	$
		LDA	!ENTIM0,X
		BNE	PKJ200F0		; pattern change ? [no->PKJ200F0]
;
		DEC	<ENWRK2,X
		BPL	PKJ20040		; [->PKJ20040]
;
		LDA	#0003-1
		STA	<ENWRK2,X
PKJ20040	EQU	$
		LDY	<ENWRK2,X
		LDA	PKJ2PTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#06
		STA	!ENTIM0,X
PKJ200F0	EQU	$
		RTS
;
;
PKJ20100	EQU	$
		LDA	#pkpk06
		STA	!ENCHPT,X
		STZ	!ENWRKA,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		RTS
;
;
PKPKJMP3	EQU	$
		LDX	<ENINDX
		JSR	PKPK_WATER_CK2
;
		LDY	#pkpk06
		LDA	!ENYSPD,X
		CLC
		ADC	#00100H
		CMP	#00100H
		BCC	PKJ30040		; 上昇パターン ? [yes->PKJ30040]
;
		LDY	#pkpk07
		CMP	#00180H
		BCC	PKJ30040		; 頂点パターン ? [yes->PKJ30040]
;
		CMP	#00200H
		BCS	PKJ30100		; 下降 mode ? [yes->PKJ30100]
;
		LDY	#pkpk08
PKJ30040	EQU	$
		TYA
		STA	!ENCHPT,X
		RTS
;
;
PKJ30100	EQU	$
		LDA	#0003-1
		STA	<ENWRK2,X
		TAY
		LDA	PKJ4PTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#06
		STA	!ENTIM0,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		RTS
;
;
PKJ4PTN		EQU	$
		BYTE	pkpk0B, pkpk0A, pkpk09
;
PKPKJMP4	EQU	$
		LDX	<ENINDX
		JSR	PKPK_WATER_CK2
;
		LDA	!ENWRK6,X
		SEC
		SBC	!ENYPSL,X
		CMP	#00020H
		BCC	PKJ40100		; 着水 mode ? [yes->PKJ40100]
;
		LDA	!ENTIM0,X
		BNE	PKJ400F0		; pattern change ? [no->PKJ400F0]
;
		DEC	<ENWRK2,X
		BPL	PKJ40040		; [->PKJ40040]
;
		LDA	#0003-1
		STA	<ENWRK2,X
PKJ40040	EQU	$
		LDY	<ENWRK2,X
		LDA	PKJ4PTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#06
		STA	!ENTIM0,X
PKJ400F0	EQU	$
		RTS
;
;
PKJ40100	EQU	$
		LDA	#04-1
		STA	<ENWRK2,X
		TAY
		LDA	PKJ5PTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	PKJ5TIM,Y
		AND	#000FFH
		STA	!ENTIM0,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		RTS
;
;
PKJ5PTN		EQU	$
		BYTE	pkpk01, pkpk02, pkpk0D, pkpk0C
;
PKJ5TIM		EQU	$
		HEX	08, 0C, 08, 08
;
PKPKJMP5	EQU	$
		LDX	<ENINDX
		JSR	PKPK_WATER_CK2
;
		LDY	!ENWRKA,X
		BNE	PKJ50020		; 着水効果セット ? [no->PKJ50020]
;
		LDA	!ENYPSL,X
		CMP	!ENWRK6,X
		BMI	PKJ50020		; 着水効果セット ? [no->PKJ50020]
;
		LDA	#PKSB1
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENWRK6,X
		SEC
		SBC	#00008H
		STA	!EXYPSL,Y
		LDA	#0006
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
;
		LDA	#00003H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		INC	!ENWRKA,X
PKJ50020	EQU	$
		LDA	!ENTIM0,X
		BNE	PKJ500F0		; pattern change ? [no->PKJ500F0]
;
		DEC	<ENWRK2,X
		BPL	PKJ50040		; 泳ぎ mode ? [no->PKJ50040]
;
		STZ	!ENWRKA,X
		JMP	PKTN0110
;
PKJ50040	EQU	$
		LDY	<ENWRK2,X
		LDA	PKJ5PTN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	PKJ5TIM,Y
		AND	#000FFH
		STA	!ENTIM0,X
PKJ500F0	EQU	$
		RTS
;
;
PKPKGMAXDT	EQU	$
		WORD	00040H, 0FFC0H
;
PKPKGPOWDT	EQU	$
		WORD	00008H, 00008H
;
PKCKPNT		EQU	$
		WORD	00000H, 00004H
;
PKPK_WATER_CK	EQU	$
		LDA	!ENYSPD,X
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAY
		LDA	!ECENTY,X
		CLC
		ADC	PKCKPNT,Y
		LDY	#00
		CMP	!ENWRK6,X
		BMI	PKWTCK0040		; 水 ? [no->PKWTCK0040]
;
		INY
		INY
PKWTCK0040	EQU	$
		LDA	PKPKGMAXDT,Y
		STA	!ENGMAX,X
		LDA	PKPKGPOWDT,Y
		STA	!ENGPOW,X
		RTS
;
;
PKPKGMAXDT2	EQU	$
		WORD	00400H, 0FF00H
;
PKPKGPOWDT2	EQU	$
		WORD	00040H, 00040H
;
PKPK_WATER_CK2	EQU	$
		LDA	!ENYSPD,X
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAY
		LDA	!ECENTY,X
		CLC
		ADC	PKCKPNT,Y
		LDY	#00
		CMP	!ENWRK6,X
		BMI	PKWTCK2040		; 水 ? [no->PKWTCK2040]
;
		INY
		INY
PKWTCK2040	EQU	$
		LDA	PKPKGMAXDT2,Y
		STA	!ENGMAX,X
		LDA	PKPKGPOWDT2,Y
		STA	!ENGPOW,X
		RTS
;
;
;------------------------------------------------------------------------
;-	initial (KEME0, KEME1)						-
;------------------------------------------------------------------------
keme00		EQU	000H
keme01		EQU	001H
keme02		EQU	002H
keme03		EQU	003H
keme04		EQU	004H
keme05		EQU	005H
;
keme_area	EQU	00060H
keme_area2	EQU	00030H
keme_gpower	EQU	00040H
keme_gpower1	EQU	00100H
keme_gmax	EQU	00400H
keme_walktime	EQU	08
keme_walkptn	EQU	04
keme_fallptn	EQU	05
keme_landptn	EQU	05
keme_falltime	EQU	04
keme_failtime	EQU	03
keme_failptn	EQU	03
;
KEMEXSPEED	EQU	$
		WORD	0FFE0H, 00020H
;
KEME_SEARCHAREA EQU	$
		WORD	keme_area, keme_area2
;
;;;;;;;;KEME_COLOR	EQU	$
;;;;;;;;		WORD	00000H<<1, 00004H<<1
;;;;;;;;;
KEME0IN		EQU	$
		LDY	!ENMUKI,X
		LDA	KEMEXSPEED,Y
		STA	!ENXSPD,X
KEME1IN		EQU	$
		LDA	#keme_walktime
		STA	!ENTIM0,X
		LDA	#keme_walkptn-1
		STA	<ENWRK0,X
		TAY
		LDA	KEMEWALKPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#keme_gpower1
		STA	!ENGPOW,X
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		TAY
		LDA	KEME_SEARCHAREA,Y
		STA	!ENWRKA,X
		ASL	A
		STA	!ENWRKC,X
;;;;;;;;		LDA	!ENCLOR,X
;;;;;;;;		ORA	KEME_COLOR,Y
;;;;;;;;		STA	!ENCLOR,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (KEME0, KEME1)						-
;------------------------------------------------------------------------
KEME0MV		EQU	$
KEME1MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		JSL	>KEMESHOTHIT		; SHOT ENEMY HIT CHECK !!
;
		LDA	<ENCONT,X
		TAX
		JSR	(KEMEMODESEL,X)
;
		JMP	>KM_PL_CRCK		; プレイヤー衝突チェック !!
;
;
KEMEMODESEL	EQU	$
		WORD	KEMETENJ
		WORD	KEMEFALL
		WORD	KEMELAND
		WORD	KEMEGRND
;
;
KEMETENJ	EQU	$
		LDX	<ENINDX
		JSL	>TENJYOUCHK		; 天井当たりチェック !!
;
		LDA	!ECENTX,X
		SEC
		SBC	!PCENTX
		CLC
		ADC	!ENWRKA,X
		CMP	!ENWRKC,X
		BCS	KEMEWALK		; プレイヤー 発見 ? [no->KEMEWALK]
;
		STZ	!ENXSPD,X
		LDA	#keme_fallptn-1
		STA	<ENWRK0,X
		TAY
		LDA	KEMEFALLPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		RTS
;
;
KEMEWALKPT	EQU	$
		BYTE	keme01, keme02, keme01, keme00
;
KEMEWALK	EQU	$
		LDA	!ENTIM0,X
		BNE	KMWK00F0		; pattern change ? [no->KMWK00F0]
;
		LDA	#keme_walktime
		STA	!ENTIM0,X
		DEC	<ENWRK0,X
		BPL	KMWK0040		; [->KMWK0040]
;
		LDA	#keme_walkptn-1
		STA	<ENWRK0,X
KMWK0040	EQU	$
		LDY	<ENWRK0,X
		LDA	KEMEWALKPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
KMWK00F0	EQU	$
		RTS
;
;
KEMEFALLPT	EQU	$
		BYTE	keme04, keme03, keme02, keme01, keme00
;
KEMEFALL	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	KMFL0080		; pattern change ? [no->KMFL0080]
;
		LDA	#keme_falltime
		STA	!ENTIM0,X
		DEC	<ENWRK0,X
		BMI	KMFL00A0		; 落下 ? [yes->KMFL00A0]
;
		LDY	<ENWRK0,X
		LDA	KEMEFALLPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
KMFL0080	EQU	$
		RTS
;
;
KMFL00A0	EQU	$
		LDA	!ENYPSL,X
		CLC
		ADC	#00004H
		STA	!ENYPSL,X
		LDA	#keme05
		STA	!ENCHPT,X
		LDA	#keme_gmax
		STA	!ENGMAX,X
		LDA	#keme_gpower
		STA	!ENGPOW,X
		LDA	#keme_landptn
		STA	<ENWRK0,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		RTS
;
;
KEMELANDPT	EQU	$
		BYTE	keme02, keme01, keme00, keme01, keme02
;
KEMELANDTM	EQU	$
		HEX	10, 04, 04, 01, 01
;
KEMELAND	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	KMLD0080		; 着地 ? [no->KMLD0080]
;
		LDA	<ENWRK2,X
		BNE	KMLD0020		; 着地 瞬間 ? [no->KMLD0020]
;
		LDA	!ENCLOR,X
		ORA	#0000000010000000B	; V FLIP !!
		STA	!ENCLOR,X
		INC	<ENWRK2,X
KMLD0020	EQU	$
		LDA	!ENTIM0,X
		BNE	KMLD0080		; pattern change ? [no->KMLD0080]
;
		DEC	<ENWRK0,X
		BMI	KMLD00A0		; 歩く ? [yes->KMLD00A0]
;
		LDY	<ENWRK0,X
		LDA	KEMELANDPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	KEMELANDTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
KMLD0080	EQU	$
		RTS
;
;
KMLD00A0	EQU	$
		LDA	#keme_walktime
		STA	!ENTIM0,X
		LDA	#keme_walkptn-1
		STA	<ENWRK0,X
		TAY
		LDA	KEMEWALKPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	!ENMOD1,X
		ORA	#0000000100000000B	; 足当たり無しで行ったり来たりする !!
		STA	!ENMOD1,X
		LDY	!ENMUKI,X
		LDA	KEMEXSPEED,Y
		STA	!ENXSPD,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		RTS
;
;
KEMEGRND	EQU	$
		LDX	<ENINDX
		JMP	KEMEWALK
;
;
;------------------------------------------------------------------------
;-	プレイヤー衝突チェック （跳ね返り無し、空中無敵）		-
;------------------------------------------------------------------------
KM_PL_CRCK	EQU	$
		LDY	!ECRSFG,X
		BPL	KMPLCRCK00F0		; プレイヤー 衝突 ? [no->KMPLCRCK00F0]
;
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	KMPLCRCK0070		; 空中 ? [yes->KMPLCRCK0070]
;
		JSL	>EPFOOTCROSS		; 踏まれたチェック !!
		BCS	KMPLCRCK0080		; 踏まれた ? [yes->KMPLCRCK0080]
		BEQ	KMPLCRCK00F0		; [->KMPLCRCK00F0]
;
KMPLCRCK0070	EQU	$
		JMP	>PLFLST
;
KMPLCRCK0080	EQU	$
		LDA	#EFAIL
		STA	!ENMODE,X
		STZ	!ENXSPD,X
KMPLCRCK00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	ショット 敵 衝突チェック					-
;------------------------------------------------------------------------
KEMESHOTHIT	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	KEMESH0080		; 敵衝突 ? [no->KEMESH0080]
		BEQ	KEMESH0080		; 赤ちゃん衝突 ? [yes->KEMESH0080]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	KEMESH0080		; mode move ? [no->KEMESH0080]
;
		LDA	!ENSHOT,Y
		BEQ	KEMESH0080		; shot ? [no->KEMESH0080]
;
		PHX
		TYX
		JSL	>SHOT_EN_KILL
;
		PLX
		LDA	#EFAIL
		STA	!ENMODE,X
		STZ	!ENYSPD,X
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		STZ	!ENXMAX,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#00400H
		STA	!ENGMAX,X
		LDA	#keme05
		STA	!ENCHPT,X
		LDA	!ENCLOR,X
		AND	#1111111101111111B
		STA	!ENCLOR,X
		LDA	!ENMOD1,X
		AND	#0FFE0H
		STA	!ENMOD1,X
;
		M8				; memory 8bit mode !!
;
		LDA	#0FFH
		STA	!ENRETN,X
;
		M16				; memory 16bit mode !!
;
		INC	<ENWRK4,X
		PLY
		PLA
KEMESH0080	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	fail (KEME0, KEME1)						-
;------------------------------------------------------------------------
KMPLHOSEI	EQU	$
		WORD	00021H, 00023H, 00025H
;
KEME0FL		EQU	$
KEME1FL		EQU	$
		LDA	!ENWRK4,X
		BNE	KMFAIL0140		; [->KMFAIL0140]
;
		LDA	!ENWRK8,X
		BNE	KMFAIL0110		; [->KMFAIL0110]
;
		LDA	!PLYSPD
		BMI	KMFAIL0100		; [->KMFAIL0100]
;
		LDA	#01
		STA	!ONLFFG
		LDA	!ENWRK6,X
		BNE	KMFAIL0040		; initial ? [no->KMFAIL0040]
;
		LDA	#keme_failtime
		STA	!ENTIM0,X
		LDA	#keme_failptn-1
		STA	!ENCHPT,X
		LDA	#00100H
		STA	!PLYSPD
		LDA	!ENYPSL,X
		SEC
		SBC	#00020H
		STA	!PLYPSL
		INC	!ENWRK6,X
		RTL
;
;
KMFAIL0040	EQU	$
		LDA	!ENYPSL,X
		SEC
		SBC	!PLYPSL
		SEC
		SBC	#00010H
		CMP	#00004H
		BMI	KMFAIL0200		; 敵つぶれた ? [yes->KMFAIL0200]
;
		PHA
		ASL	A
		ASL	A
		ASL	A
		ASL	A
		STA	!PLYSPD
		PLA
		LDY	#02
		CMP	#00018H
		BCS	KMFAIL0060		; [->KMFAIL0060]
;
		DEY
		CMP	#00010H
		BCS	KMFAIL0060		; [->KMFAIL0060]
;
		DEY
KMFAIL0060	EQU	$
		TYA
		STA	!ENCHPT,X
		RTL
;
;
KMFAIL0100	EQU	$
		LDA	#keme_failtime
		STA	!ENTIM0,X
		INC	!ENWRK8,X
KMFAIL0110	EQU	$
		LDA	!ENTIM0,X
		BNE	KMFAIL0140
;
		DEC	!ENCHPT,X
		BMI	KMFAIL0200		; 敵つぶれた ? [yes->KMFAIL0200]
;
		LDA	#keme_failtime
		STA	!ENTIM0,X
KMFAIL0140	EQU	$
		RTL
;
;
KMFAIL0200	EQU	$
		M8				; memory 8bit mode !!
;
		LDA	#0FFH
		STA	!ENYUSN,X
;
		M16				; memory 16bit mode !!
;
		LDA	#PONBR
		JSL	>EXINSR
;
		LDA	#0008
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	!ECENTY,X
		STA	!EXYPSL,Y
;
		LDA	#0003BH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		JMP	>ENCLEAR_NORETN
;
;
;------------------------------------------------------------------------
;-	initial (反射雲)						-
;------------------------------------------------------------------------
rfcloud_ptn	EQU	03
rfcloud_time	EQU	08
;
REFLECTIONSOUND EQU	$
		WORD	0002FH, 0002EH, 0002DH, 0002CH
		WORD	0002BH, 0002AH, 00029H, 00028H
;
REFLECTION_XSPD EQU	$
		WORD	-005A8H, -00800H, -005A8H,  00000H
		WORD	 005A8H,  00800H,  005A8H,  00000H
;
REFLECTION_YSPD EQU	$
		WORD	-005A8H,  00000H,  005A8H,  00800H
		WORD	 005A8H,  00000H, -005A8H, -00800H
;
REFLECTION_COL	EQU	$
		WORD	00000H<<1, 00001H<<1, 00002H<<1, 00004H<<1
;
REFC0IN		EQU	$
		LDA	#0007<<1
		BRA	RFCIN0040
;
REFC1IN		EQU	$
		LDA	#0006<<1
		BRA	RFCIN0040
;
REFC2IN		EQU	$
		LDA	#0005<<1
		BRA	RFCIN0040
;
REFC3IN		EQU	$
		LDA	#0004<<1
		BRA	RFCIN0040
;
REFC4IN		EQU	$
		LDA	#0003<<1
		BRA	RFCIN0040
;
REFC5IN		EQU	$
		LDA	#0002<<1
		BRA	RFCIN0040
;
REFC6IN		EQU	$
		LDA	#0001<<1
		BRA	RFCIN0040
;
REFC7IN		EQU	$
		LDA	#0000<<1
RFCIN0040	EQU	$
		STA	<ENWRK0,X
		LDA	#rfcloud_ptn-1
		STA	!ENCHPT,X
		STA	<ENWRK2,X
		LDA	#rfcloud_time
		STA	!ENTIM0,X
		STZ	ENMUKI,X
;
		LDA	<RANDM0
		AND	#00003H
		ASL	A
		TAY
		LDA	!ENCLOR,X
		ORA	REFLECTION_COL,Y
		STA	!ENCLOR,X
		RTL
;
;
REFC8IN		EQU	$
		LDY	#rfcloud_ptn
		STY	4202H
		LDA	<RANDM0
		AND	#00007H
		INC	A
		TAY
		STY	4203H
;
		LDA	#rfcloud_ptn*8-1
		STA	<ENWRK2,X
		LDA	#rfcloud_time
		STA	!ENTIM0,X
;
		LDA	4216H
		DEC	A
		STA	!ENCHPT,X
;
		STA	4204H
		LDY	#03
		STY	4206H
;
		STZ	ENMUKI,X
		LDA	<RANDM0
		AND	#00003H
		ASL	A
		TAY
		LDA	!ENCLOR,X
		ORA	REFLECTION_COL,Y
		STA	!ENCLOR,X
;
		LDA	4214H
		ASL	A
		STA	<ENWRK0,X
;
		RTL
;
;
;------------------------------------------------------------------------
;-	move (反射雲)							-
;------------------------------------------------------------------------
REFC0MV		EQU	$
REFC1MV		EQU	$
REFC2MV		EQU	$
REFC3MV		EQU	$
REFC4MV		EQU	$
REFC5MV		EQU	$
REFC6MV		EQU	$
REFC7MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		JSL	>RFCLOUDCRCK		; 卵 衝突チェック !!
;
		JSR	RFCLOUDANIME
;
		RTL
;
;
REFC8MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	!ENCHPT,X
		STA	4204H
		LDY	#03
		STY	4206H
		NOP
		NOP
		NOP
		NOP
		NOP
		NOP
		NOP
		NOP
		LDA	4214H
		ASL	A
		STA	<ENWRK0,X
		JSL	>RFCLOUDCRCK		; 卵 衝突チェック !!
;
		JSR	RFCLOUDANIME
;
		RTL
;
;
RFCLOUDANIME	EQU	$
		LDA	!ENTIM0,X
		BNE	RFAN00F0		; pattern change ? [no->RFAN00F0]
;
		DEC	!ENCHPT,X
		BPL	RFAN0080		; [->RFAN0080]
;
		LDA	<ENWRK2,X
		STA	!ENCHPT,X
RFAN0080	EQU	$
		LDA	#rfcloud_time
		STA	!ENTIM0,X
RFAN00F0	EQU	$
		RTS
;
;
RFCLOUDCRCK	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	RFCCRCK0040		; 敵 衝突 ? [no->RFCCRCK0040]
		BEQ	RFCCRCK0040		; 赤ちゃん ? [yes->RFCCRCK0040]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	RFCCRCK0040		; mode move ? [no->RFCCRCK0040]
;
		LDA	!ENSHOT,Y
		BEQ	RFCCRCK0040		; shot ? [no->RFCCRCK0040]
;
		LDA	!ENMYNO,Y
		CMP	#EGG00
		BCC	RFCCRCK0040		; 卵 ? [no->RFCCRCK0040]
;
		CMP	#EGG09+1
		BCC	RFCCRCK0050		; 卵 ? [yes->RFCCRCK00F0]
;
RFCCRCK0040	EQU	$
		JMP	RFCCRCK00F0
;
RFCCRCK0050	EQU	$
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		STA	!ENYPSL,Y
		LDA	#0000
		STA	!ENGPOW,Y
		LDA	<ENWRK0,X
		TAX
		LDA	REFLECTION_XSPD,X
		STA	!ENXSPD,Y
		LDA	REFLECTION_YSPD,X
		STA	!ENYSPD,Y
		LDA	#0FFFFH
		STA	!ENTIM0,Y
		INC	A			;[ LDA #00 ]
;
		M8
;
		STA	!ENWRKX,Y		;タマゴスクロールＳＴＯＰ！！
;
		M16
;
		LDX	<ENINDX
		LDA	#FSMK0
		JSL	>EXINSR
;
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	!ECENTY,X
		STA	!EXYPSL,Y
		LDA	#0006
		STA	!EXCHPT,Y
		STA	!EXWRK0,Y
		LDA	#0004
		STA	!EXTIM0,Y
;
		LDA	#REFAW
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		STA	!EXYPSL,Y
		LDA	#0064*2
		STA	!EXTIM0,Y
		LDA	!ENCLOR,X
		AND	#0000000000001110B
		ORA	!EXCLOR,Y
		STA	!EXCLOR,Y
		LDA	<ENWRK0,X
		LSR	A
		STA	!EXCHPT,Y
;
		LDA	#00020H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDY	<ENWRK0,X
		LDA	REFLECTIONSOUND,Y
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		JSL	>ENCLEAR_NORETN
;
		PLY
		PLA
RFCCRCK00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (花ちゃん成虫)						-
;------------------------------------------------------------------------
moth_00		EQU	000H
moth_01		EQU	001H
moth_02		EQU	002H
moth_03		EQU	003H
moth_04		EQU	004H
moth_05		EQU	005H
moth_06		EQU	006H
moth_07		EQU	007H
moth_08		EQU	008H
moth_09		EQU	009H
;
moth_time0	EQU	04
moth_time1	EQU	02
moth_time2	EQU	64
moth_time3	EQU	14
moth_ptn00	EQU	04
moth_ptn01	EQU	07
moth_speed	EQU	00200H
moth_gpower	EQU	00008H
;
moth0_normal	EQU	00
moth0_damage	EQU	02
moth0_angry	EQU	04
;
MOTH_XSPD	EQU	$
		WORD	0FF80H, 00080H
;
MOTH_YPOS	EQU	$
		WORD	-00020H,  00020H
;
MOTH_GMAX	EQU	$
		WORD	 00800H, -00800H
;
MOTH0IN		EQU	$
		LDY	!ENMUKI,X
		LDA	MOTH_XSPD,Y
		STA	!ENXSPD,X
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		TAY
		LDA	!ENYPSL,X
		STA	<ENWRK0,X		; Y ポジション セーブ !!
		CLC
		ADC	MOTH_YPOS,Y
		STA	!ENYPSL,X
		LDA	MOTH_GMAX,Y
		STA	!ENGMAX,X
		LDA	#moth_gpower
		STA	!ENGPOW,X
		LDA	#moth_time0
		STA	!ENTIM0,X
		LDA	#moth_ptn00-1
		STA	<ENWRK2,X
		TAY
		LDA	MOTH0_NPATTERN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (花ちゃん成虫)						-
;------------------------------------------------------------------------
MOTH0MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		JSL	>MOTH0_AREACHK
;
		LDA	<ENCONT,X
		TAX
		JMP	(MOTH0MODSEL,X)
;
MOTH0MODSEL	EQU	$
		WORD	MOTH0NORMAL
		WORD	MOTH0DAMAGE
		WORD	MOTH0ANGRY
;
MOTH0_NPATTERN	EQU	$
		BYTE	moth_01, moth_02, moth_01, moth_00
;
MOTH0NORMAL	EQU	$
		LDX	<ENINDX
		JSL	>MOTH0_CROSCHECK	; 衝突チェック !!
;
		LDA	!ENTIM0,X
		BNE	MOTH0N0080		; pattern change ? [no->MOTH0N0080]
;
		DEC	<ENWRK2,X
		BPL	MOTH0N0040		; [->MOTH0N0040]
;
		LDA	#moth_ptn00-1
		STA	<ENWRK2,X
MOTH0N0040	EQU	$
		LDY	<ENWRK2,X
		LDA	MOTH0_NPATTERN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#moth_time0
		STA	!ENTIM0,X
MOTH0N0080	EQU	$
		LDY	#00
		LDA	!ENYPSL,X
		CMP	<ENWRK0,X
		BMI	MOTH0N00A0		; [->MOTH0N00A0]
;
		INY
		INY
MOTH0N00A0	EQU	$
		LDA	MOTH_GMAX,Y
		STA	!ENGMAX,X
		RTL
;
;
HANA_XSPD	EQU	$
		WORD	00100H, 0FF00H
;
MOTH0_CROSCHECK EQU	$
		LDY	!ECRSFG,X
		BPL	MOTH0_CRCK0040		; プレイヤー衝突 ? [no->MOTH0_CRCK0040]
;
		JSL	>EPFOOTCROSS_01
		BEQ	MOTH0_CRCK0048		; 衝突無し ? [yes->MOTH0_CRCK00F0]
		BCC	MOTH0_CRCK0020		; 踏まれた ? [no->MOTH0_CRCK0020]
;
		LDA	!PLXSPD
		STA	!ENXSPD,X
		LDA	!PLYSPD
		STA	!ENYSPD,X
;
		LDA	#0001CH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		JSL	>PLAYER_REBOUND
;
		BRA	MOTH0_CRCK0060
;
MOTH0_CRCK0020	EQU	$
		JMP	>PLFLST
;
MOTH0_CRCK0040	EQU	$
		DEY
		BMI	MOTH0_CRCK0048		; 敵 衝突 ? [no->MOTH0_CRCK00F0]
		BEQ	MOTH0_CRCK0048		; 赤ちゃん ? [yes->MOTH0_CRCK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	MOTH0_CRCK0048		; mode move ? [no->MOTH0_CRCK00F0]
;
		LDA	!ENSHOT,Y
		BNE	MOTH0_CRCK0050		; shot ? [yes->MOTH0_CRCK0050]
;
MOTH0_CRCK0048	EQU	$
		JMP	MOTH0_CRCK00F0		; shot ? [no->MOTH0_CRCK00F0]
;
MOTH0_CRCK0050	EQU	$
		LDA	!ENXSPD,Y
		STA	!ENXSPD,X
		LDA	!ENYSPD,Y
		STA	!ENYSPD,X
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
MOTH0_CRCK0060	EQU	$
		LDA	!ENXSPD,X
		STA	!ENWRKA,X
		LDA	!ENYSPD,X
		STA	!ENWRKC,X
		LDA	#00100H
		STA	!ENGPOW,X
		STA	!ENXPOW,X
		STZ	!ENGMAX,X
		LDA	#moth_ptn01-1
		STA	!ENWRK2,X
		TAY
		LDA	MOTH0_DPATTERN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	MOTH0_DTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
;
		LDY	!EPXMUK,X
		LDA	HANA_XSPD,Y
		STA	<EWORK
		LDA	#HANA0
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00008H
		STA	!EXYPSL,Y
		LDA	<EWORK
		STA	!EXXSPD,Y
		LDA	#0FE00H
		STA	!EXYSPD,Y
		LDA	#00020H
		STA	!EXGPOW,Y
		LDA	#00400H
		STA	!EXGMAX,Y
		LDA	#0064
		STA	!EXTIM0,Y
		LDA	#moth0_damage
		STA	<ENCONT,X
		PLY
		PLA
MOTH0_CRCK00F0	EQU	$
		RTL
;
;
MOTH0_DPATTERN	EQU	$
		BYTE	moth_03, moth_04, moth_05, moth_06
		BYTE	moth_05, moth_04, moth_03
;
MOTH0_DTIME	EQU	$
		HEX	02, 02, 02, 04, 02, 02, 02
;
MOTH0DAMAGE	EQU	$
		LDX	<ENINDX
		JSL	>MOTH0_CROSCHCK2	; 衝突チェック !!
;
		LDA	!ENXSPD,X
		EOR	!ENWRKA,X
		BMI	MOTH0D0040		; [->MOTH0D0040]
;
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		STZ	!ENWRKA,X
MOTH0D0040	EQU	$
		LDA	!ENYSPD,X
		EOR	!ENWRKC,X
		BPL	MOTH0D0060		; [->MOTH0D0060]
;
		STZ	!ENYSPD,X
		STZ	!ENGPOW,X
		STZ	!ENWRKC,X
MOTH0D0060	EQU	$
		LDA	!ENTIM0,X
		BNE	MOTH0D0080		; pattern change ? [no->MOTH0D0080]
;
		DEC	!ENWRK2,X
		BMI	MOTH0D0090		; [->MOTH0D0090]
;
		LDY	!ENWRK2,X
		LDA	MOTH0_DPATTERN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	MOTH0_DTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
MOTH0D0080	EQU	$
		RTL
;
;
MOTH0D0090	EQU	$
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		STZ	!ENWRKA,X
		STZ	!ENYSPD,X
		STZ	!ENGPOW,X
		STZ	!ENWRKC,X
		LDA	#moth_ptn00-1
		STA	<ENWRK2,X
		TAY
		LDA	MOTH0_APATTERN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#moth_time1
		STA	!ENTIM0,X
		LDA	#moth_time2
		STA	!ENTIM1,X
		LDA	#moth0_angry
		STA	<ENCONT,X
		RTL
;
;
MOTH0_APATTERN	EQU	$
		BYTE	moth_08, moth_09, moth_08, moth_07
;
YUGE0_XPOS0	EQU	$
		WORD	0FFF0H, 00000H
;
MOTH0ANGRY	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM1,X
		BEQ	MOTH0A0020		; 振り向き ? [no->MOTH0A0020]
;
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	!ENMUKI,X
MOTH0A0020	EQU	$
		JSL	>MOTH0_CROSCHCK2	; 衝突チェック !!
;
		LDA	!ENTIM0,X
		BNE	MOTH0A0080		; pattern change ? [no->MOTH0A0080]
;
		DEC	<ENWRK2,X
		BPL	MOTH0A0040		; [->MOTH0A0040]
;
		LDA	#moth_ptn00-1
		STA	<ENWRK2,X
MOTH0A0040	EQU	$
		LDY	<ENWRK2,X
		LDA	MOTH0_APATTERN,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#moth_time1
		STA	!ENTIM0,X
MOTH0A0080	EQU	$
		LDA	!ENTIM2,X
		BNE	MOTH0A00C0		; 湯気セット ? [no->MOTH0A00C0]
;
		LDA	#moth_time3
		STA	!ENTIM2,X
;
		LDY	!ENMUKI,X
		LDA	!ENXPSL,X
		CLC
		ADC	YUGE0_XPOS0,Y
		STA	<EWORK
		LDA	!ENYPSL,X
		SEC
		SBC	#00010H
		STA	<EWORK2
		LDA	#0FE00H
		CLC
		ADC	!ENXSPD,X
		STA	<EWORK4
		LDA	#0FE00H
		CLC
		ADC	!ENYSPD,X
		STA	<EWORK6
		LDA	#0002
		STA	<EWORK8
		JSR	YUGE0SET		; 湯気セット !!
;
		LDY	!ENMUKI,X
		LDA	<EWORK
		CLC
		ADC	#00010H
		STA	<EWORK
		LDA	#00200H
		CLC
		ADC	!ENXSPD,X
		STA	<EWORK4
		STZ	<EWORK8
		JSR	YUGE0SET		; 湯気セット !!
;
MOTH0A00C0	EQU	$
		LDA	<ENWRK4,X
		BNE	MOTH0A00F0		; 既にスピードセットされてるか ? [yes->MOTH0A00F0]
;
		LDA	!ENTIM1,X
		BNE	MOTH0A00F0		; スピードセット ? [no->MOTH0A00F0]
;
		LDA	!PCENTX
		STA	R1			; target X
		LDA	!PCENTY
		STA	R2			; target Y
		LDA	!ECENTX,X
		STA	R3			; my X
		LDA	!ECENTY,X
		STA	R4			; my Y
		LDA	#moth_speed
		STA	R6			; speed
		M_CHIP	SEARCH_SPEED
;
		LDX	<ENINDX
		LDA	R1
		STA	!ENXSPD,X
		LDA	R2
		STA	!ENYSPD,X
		INC	<ENWRK4,X
MOTH0A00F0	EQU	$
		RTL
;
;
YUGE0SET	EQU	$
		LDA	#YUGE0
		JSL	>EXINSR
;
		LDA	<EWORK			; X ポジション !!
		STA	!EXXPSL,Y
		LDA	<EWORK2			; Y ポジション !!
		STA	!EXYPSL,Y
		LDA	<EWORK4			; X スピード !!
		STA	!EXXSPD,Y
		LDA	<EWORK6			; Y スピード !!
		STA	!EXYSPD,Y
		LDA	!EXXMAX,Y
		CLC
		ADC	!ENXSPD,X
		STA	!EXXMAX,Y
		LDA	!EXGMAX,Y
		CLC
		ADC	!ENYSPD,X
		STA	!EXGMAX,Y
		LDA	!EWORK8			; 向き !!
		STA	!EXMUKI,Y
		LDA	#00040H
		STA	!EXGPOW,Y
		STA	!EXXPOW,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	#0007-1
		STA	!EXCHPT,Y
		RTS
;
;
MOTH0_CROSCHCK2 EQU	$
		LDY	!ECRSFG,X
		BPL	MOTH0_CRC20040		; プレイヤー衝突 ? [no->MOTH0_CRC20040]
;
		JSL	>EPFOOTCROSS_01
		BEQ	MOTH0_CRC200F0		; 衝突無し ? [yesMOTH0_CRC200F0]
		BCC	MOTH0_CRC20020		; 踏まれた ? [no->MOTH0_CRC200F0]
;
		LDA	#0001CH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		JMP	>PLAYER_REBOUND
;
MOTH0_CRC20020	EQU	$
		JMP	>PLFLST
;
MOTH0_CRC20040	EQU	$
		DEY
		BMI	MOTH0_CRC200F0		; 敵 衝突 ? [no->MOTH0_CRC200F0]
		BEQ	MOTH0_CRC200F0		; 赤ちゃん ? [yes->MOTH0_CRC200F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	MOTH0_CRC200F0		; mode move ? [no->MOTH0_CRC200F0]
;
		LDA	!ENSHOT,Y
		BEQ	MOTH0_CRC200F0		; shot ? [no->MOTH0_CRC200F0]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
MOTH0_CRC200F0	EQU	$
		RTL
;
;
MOTH0_AREACHK	EQU	$
		LDA	!ENWRK6,X		; わきだしフラグ !!
		BEQ	MOTH0_ARCK00F0		; わきだし ? [no->MOTH0_ARCK00F0]
;
		LDA	!ENDSXL,X
		CLC
		ADC	#00050H
		CMP	#00190H
		BCS	MOTH0_ARCK0040		; 範囲外 ? [yes->MOTH0_ARCK0040]
;
		LDA	!ENDSYL,X
		CLC
		ADC	#00050H
		CMP	#00190H
		BCC	MOTH0_ARCK00F0		; 範囲外 ? [no->MOTH0_ARCK00F0]
;
MOTH0_ARCK0040	EQU	$
		DEC	!MOTH0_COUNT
MOTH0_ARCK0080	EQU	$
		PLY
		PLA
		JMP	>ENCLEAR
;
MOTH0_ARCK00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (鉄砲魚)						-
;------------------------------------------------------------------------
tpg_fujyoukyori EQU	00018H
;
tpg_yarare	EQU	(tpgyarare-TPGMODSEL)
;
TEPPOIN		EQU	$
		LDA	!ENXPSL,X
		SEC
		SBC	#00020H
		STA	<ENWRK2,X
		CLC
		ADC	#00040H
		STA	<ENWRK4,X
		LDA	!ENYPSL,X
		CLC
		ADC	#00008H
		STA	!ENYPSL,X
		STA	!ENWRK8,X
		SEC
		SBC	#0001CH
		STA	!ENWRK6,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (鉄砲魚)							-
;------------------------------------------------------------------------
TEPPO_POS	EQU	$
		WORD	0FFF0H, 0FFFBH		;[01]
		WORD	0FFEAH, 0FFF5H		;[02]
		WORD	0FFE4H, 0FFEFH		;[03]
		WORD	0FFDEH, 0FFE9H		;[04]
		WORD	0FFD8H, 0FFE3H		;[05]
		WORD	0FFD2H, 0FFDDH		;[06]
		WORD	0FFCCH, 0FFD7H		;[07]
		WORD	0FFC6H, 0FFD1H		;[08]
		WORD	0FFC0H, 0FFCBH		;[09]
		WORD	0FFBAH, 0FFC5H		;[0A]
		WORD	0FFB4H, 0FFBFH		;[0B]
		WORD	0FFAEH, 0FFB9H		;[0C]
		WORD	0FFA8H, 0FFB3H		;[0D]
		WORD	0FFA2H, 0FFADH		;[0E]
		WORD	0FF9CH, 0FFA7H		;[0F]
		WORD	0FF96H, 0FFA1H		;[10]
		WORD	0FF90H, 0FF9BH		;[11]
		WORD	0FF8AH, 0FF95H		;[12]
;
TEPPOMV		EQU	$
		LDA	!ENCHPT,X
		STA	R1
		LDA	<ENCONT,X
		STA	R2
		LDA	#TEPPO_POS
		STA	R3
		LDA	#BANK TEPPO_POS
		STA	R4
		M_CHIP	TEPPOUGYOOAM
;
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		LDA	<ENWRK0,X
		TAX
		JMP	(TPGMODSEL,X)
;
;
TPGMODSEL	EQU	$
		WORD	TPGSENKOU
		WORD	TPGFUJYOU
		WORD	TPGKOUGEK
		WORD	TPGMOGURU
tpgyarare	WORD	TPGYARARE
		WORD	TPGMACHI0
;
TPGSENKOU	EQU	$
		LDX	<ENINDX
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	!ENMUKI,X
		LDA	!ENTIM0,X
		BNE	TPGS0080		; search on ? [no->TPGS0080]
;
		LDA	!EPWIDY,X
		SEC
		SBC	#tpg_fujyoukyori
		CMP	#000A0H
		BCS	TPGS0080		; search on ? [no->TPGS0080]
;
		LDY	!EPXMUK,X
		DEY
		BMI	TPGS0040		; プレイヤーの右 ? [yes->TPGS0040]
;
		EOR	#0FFFFH
		INC	A
TPGS0040	EQU	$
		CLC
		ADC	!PLXPSL
		CMP	<ENWRK2,X
		BPL	TPGS0050		; minimum over ? [no->TPGS0050]
;
		LDA	<ENWRK2,X
		BRA	TPGS0060
;
TPGS0050	EQU	$
		CMP	<ENWRK4,X
		BMI	TPGS0060		; maximum over ? [no->TPGS0060]
;
		LDA	<ENWRK4,X
TPGS0060	EQU	$
		STA	!ENXPSL,X
		SEC
		SBC	!PLXPSL
		CLC
		ADC	#00020H
		CMP	#00040H
		BCS	TPGS0100		; 浮上 ? [yes->TPGS0100]
;
TPGS0080	EQU	$
		RTL
;
TPGS0100	EQU	$
		LDA	#WTUP0
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENWRK6,X
		STA	!EXYPSL,Y
		LDA	#WUP0P
		STA	!EXWRK0,Y
		LDA	#0003
		STA	!EXTIM0,Y
;
		LDA	#00003H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	#tpg_fujyoukyori
		STA	!ENTIM0,X
		LDA	!ENWRK8,X
		STA	!ENYPSL,X
		LDA	#0FF00H
		STA	!ENYSPD,X
		INC	<ENWRK0,X
		INC	<ENWRK0,X
		RTL
;
;
TPGFUJYOU	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	TPGF0100		; 浮上完了 ? [no->TPGF0100]
;
		STZ	!ENYSPD,X
		INC	!ENCHPT,X
		LDA	#00030H
		STA	!ENTIM1,X
		LDA	#209
		STA	!ENTIM2,X
		INC	<ENWRK0,X
		INC	<ENWRK0,X
TPGF0100	EQU	$
		JSR	TP_EN_CRCK
;
		RTL
;
;
TPGTIME		EQU	$
		BYTE	01, 01, 01, 01, 01, 01, 01, 01
		BYTE	01, 01, 01, 01, 01, 01, 01, 01
		BYTE	01, 01, 192
;
TPGKOUGEK	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM1,X
		BNE	TPGF0100		; [->TPGF0100]
;
		LDA	#02
		STA	!ENCHPT,X
;
		LDA	<FRCNT2
		AND	#00003H
		BNE	TPGK0040		; [->TPGK0040]
;
		LDA	#00049H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
TPGK0040	EQU	$
		LDA	!ENTIM2,X
		BEQ	TPGK0100		; [->TPGK0100]
;
		JSL	>TPGMIZUCRCK
;
		LDA	<ENCONT,X
		CMP	#0018
		BEQ	TPGK0080		; [->TPGK0080]
;
		LDA	!ENTIM0,X
		CMP	#0002
		BCS	TPGK0090		; [->TPGK0090]
;
TPGK0080	EQU	$
		LDA	!ENTIM0,X
		BNE	TPGK00F0		; [->TPGK00F0]
;
TPGK0090	EQU	$
		LDA	<ENCONT,X
		CMP	#0018
		BCS	TPGK0100		; [->TPGK0100]
;
		INC	A
		STA	<ENCONT,X
		TAY
		LDA	TPGTIME,Y
		AND	#000FFH
		STA	!ENTIM0,X
TPGK00F0	EQU	$
		JSR	TPGMIZU0
;
		JSR	TP_EN_CRCK
;
		RTL
;
TPGK0100	EQU	$
		INC	<ENWRK0,X
		INC	<ENWRK0,X
		JSR	TP_EN_CRCK
;
		RTL
;
;
TPGMOGURU	EQU	$
		LDX	<ENINDX
		LDA	<ENCONT,X
		BEQ	TPGM0060		; [->TPGM0060]
;
		JSR	TPGMIZU0
;
		LDA	!ENTIM1,X
		BNE	TPGM0100		; [->TPGM0100]
;
		DEC	<ENCONT,X
		BNE	TPGM0040		; [->TPGM0040]
;
		LDA	#WTUP0
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENWRK6,X
		STA	!EXYPSL,Y
		LDA	#WUP0P
		STA	!EXWRK0,Y
		LDA	#0003
		STA	!EXTIM0,Y
;
		LDA	#00003H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	#tpg_fujyoukyori
		STA	!ENTIM0,X
		LDA	#00100H
		STA	!ENYSPD,X
		STZ	!ENCHPT,X
TPGM0040	EQU	$
		LDA	#0001
		STA	!ENTIM1,X
		BRA	TPGM0100
;
TPGM0060	EQU	$
		LDA	!ENTIM0,X
		BNE	TPGM0100		; 潜水完了 ? [no->TPGM0100]
;
		LDA	#0064
		STA	!ENTIM0,X
		STZ	!ENYSPD,X
		STZ	<ENWRK0,X
TPGM0100	EQU	$
		JSR	TP_EN_CRCK
;
		RTL
;
;
TPGYARARE	EQU	$
		LDX	<ENINDX
		LDA	<ENCONT,X
		BEQ	TPGYARARE0080		; [->TPGYARARE0080]
;
		DEC	<ENCONT,X
		JSR	TPGMIZU0
;
		RTL
;
TPGYARARE0080	EQU	$
		LDA	#00
		STA	!ENCHPT,X
		LDA	!ENWRK8,X
		CMP	!ENYPSL,X
		BPL	TPGYARARE0100		; [->TPGYARARE0100]
;
		STA	!ENYPSL,X
		LDA	#sec05
		STA	!ENTIM0,X
		INC	<ENWRK0,X
		INC	<ENWRK0,X
		RTL
;
TPGYARARE0100	EQU	$
		INC	!ENYPSL,X
		RTL
;
;
TPGMACHI0	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	TPGMACHI000F0		; [->TPGMACHI000F0]
;
		LDA	#0064
		STA	!ENTIM0,X
		STZ	!ENYSPD,X
		STZ	<ENWRK0,X
TPGMACHI000F0	EQU	$
		RTL
;
;
TPGANDDT	EQU	$
		WORD	0001H, 0001H, 0001H, 0001H
		WORD	0001H, 0001H, 0001H, 0001H
		WORD	0001H, 0001H, 0001H, 0001H
		WORD	0001H, 0001H, 0001H, 0001H
		WORD	0001H, 0001H, 0003H
;
TPGSPD		EQU	$
		WORD	0FC00H, 00400H
;
TPGMIZU0	EQU	$
		LDA	<ENCONT,X
		ASL	A
		TAY
		LDA	<FRCNT2
		AND	TPGANDDT,Y
		BNE	TPGMZ00F0		; [->TPGMZ00F0]
;
		LDY	!ENMUKI,X
		LDA	TPGSPD,Y
		STA	<EWORK
		LDA	<ENCONT,X
		DEC	A
		ASL	A
		ASL	A
		TAY
		LDA	TEPPO_POS,Y
		PHY
		LDY	!ENMUKI,X
		BEQ	TPGMZ0080		; [->TPGMZ0080]
;
		EOR	#0FFFFH
		INC	A
TPGMZ0080	EQU	$
		PLY
		CLC
		ADC	!ENXPSL,X
		STA	<EWORK2
		INY
		INY
		LDA	!ENYPSL,X
		CLC
		ADC	TEPPO_POS,Y
		STA	<EWORK4
		LDA	#MIZU0
		JSL	>EXINSR
;
		LDA	!EXCLOR,Y
		ORA	#00003H<<1
		STA	!EXCLOR,Y
		LDA	!ENMUKI,X
		STA	!EXMUKI,Y
		LDA	<EWORK2
		STA	!EXXPSL,Y
		LDA	<EWORK4
		STA	!EXYPSL,Y
		LDA	<EWORK
		STA	!EXXSPD,Y
		LDA	#0FC00H
		STA	!EXYSPD,Y
		LDA	#00010H
		STA	!EXTIM0,Y
		LDA	#0002
		STA	!EXCHPT,Y
TPGMZ00F0	EQU	$
		RTS
;
;
TPGPLSPD	EQU	$
		WORD	0FE00H, 00200H
;
TPGPLBGVIT	EQU	$
		WORD	0000000110000000B, 0000000001100000B
;
TPGMIZUCRCK	EQU	$
		LDA	#BANK TEPPO_POS
		STA	R0
		LDA	#TEPPO_POS
		STA	R1
		LDA	<ENCONT,X
		STA	R12
		M_CHIP	TEPPOUGYOCRCK
;
		LDX	<ENINDX
		LDA	R11
		BPL	TPGMZCRCK0040		; 当たった ? [yes->TPGMZCRCK0040]
;
		JMP	TPGMZCRCK00F0		; 当たった ? [no->TPGMZCRCK00F0]
;
TPGMZCRCK0040	EQU	$
		STA	<ENCONT,X
		DEC	A
		ASL	A
		ASL	A
		TAY
		LDA	TEPPO_POS,Y
		PHY
		LDY	!ENMUKI,X
		BEQ	TPGMZCRCK0080		; [->TPGMZCRCK0080]
;
		EOR	#0FFFFH
		INC	A
TPGMZCRCK0080	EQU	$
		PLY
		CLC
		ADC	!ENXPSL,X
		STA	<EWORK
		INY
		INY
		LDA	!ENYPSL,X
		CLC
		ADC	TEPPO_POS,Y
		STA	<EWORK2
		LDA	!ENTIM3,X
		BNE	TPGMZCRCK0090		; [->TPGMZCRCK0090]
;
		LDA	#04
		STA	!ENTIM3,X
		LDA	#SIBU0
		JSL	>EXINSR
;
		LDA	<EWORK
		STA	!EXXPSL,Y
		LDA	<EWORK2
		STA	!EXYPSL,Y
		LDA	#0002
		STA	EXTIM0,Y
		LDA	#0001
		STA	EXCHPT,Y
;
TPGMZCRCK0090	EQU	$
		LDA	<RANDM0
		AND	#00003H
		XBA
		LSR	A
		CLC
		ADC	#00100H
		STA	<EWORK4
		LDA	<RANDM0
		AND	#00001H
		BEQ	TPGMZCRCK00A0		; [->TPGMZCRCK00A0]
;
		LDA	<EWORK4
		EOR	#0FFFFH
		INC	A
		STA	<EWORK4
TPGMZCRCK00A0	EQU	$
		LDA	<RANDM0
		AND	#0000CH
		XBA
		LSR	A
		LSR	A
		LSR	A
		CLC
		ADC	#00100H
		STA	<EWORK6
		LDA	<RANDM0
		AND	#00100H
		BNE	TPGMZCRCK00C0		; [->TPGMZCRCK00C0]
;
		LDA	<EWORK6
		EOR	#0FFFFH
		INC	A
		STA	<EWORK6
TPGMZCRCK00C0	EQU	$
		LDA	#HANE0
		JSL	>EXINSR
;
		LDA	!EXCLOR,Y
		ORA	#00003H<<1
		STA	!EXCLOR,Y
		LDA	<EWORK
		STA	!EXXPSL,Y
		LDA	<EWORK2
		STA	!EXYPSL,Y
		LDA	<EWORK4
		STA	!EXXSPD,Y
		STA	!EXYSPD,Y
		LDA	#0006
		STA	EXTIM0,Y
		LDA	#0002
		STA	EXCHPT,Y
;
		LDY	!ENMUKI,X
		LDA	!PLBGCR
		AND	TPGPLBGVIT,Y
		BNE	TPGMZCRCK00D0		; ＢＧに当たってる？ [yes->TPGMZCRCK00D0]
;
		LDA	TPGPLSPD,Y
		STA	!PLXSPD
		STA	!PLMVSP
TPGMZCRCK00D0	EQU	$
;
		PLY
		PLA
		JSR	TP_EN_CRCK
;
TPGMZCRCK00F0	EQU	$
		RTL
;
;
TP_EN_CRCK	EQU	$
		LDY	!ECRSFG,X
		BMI	TP_EN_CRCK0100		; プレイヤーとの衝突？ [yes->TP_EN_CRCK0100]
;
		DEY
		BMI	TP_EN_CRCK00F0		; 敵衝突 ? [no->TP_EN_CRCK00F0]
		BEQ	TP_EN_CRCK00F0		; 赤ちゃん衝突 ? [yes->TP_EN_CRCK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	TP_EN_CRCK00F0		; mode MOVE ? [no->TP_EN_CRCK00F0]
;
		LDA	!ENSHOT,Y
		BEQ	TP_EN_CRCK00F0		; SHOT ? [no->TP_EN_CRCK00F0]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
TP_EN_CRCK0080	EQU	$
		LDA	#tpg_yarare
		STA	<ENWRK0,X
		STZ	!ENYSPD,X
		STZ	!ENGPOW,X
TP_EN_CRCK00F0	EQU	$
		RTS
;
TP_EN_CRCK0100	EQU	$
		JSL	>EPFOOTCROSS_01
		BCS	TP_EN_CRCK0080		; 踏まれた？ [yes->TP_EN_CRCK0080]
		BEQ	TP_EN_CRCK00F0		; [->TP_EN_CRCK00F0]
;
		JSL	>PLFLST
;
		RTS
;
;
;------------------------------------------------------------------------
;-	initial (穴ジュゲム)						-
;------------------------------------------------------------------------
ajgm_00		EQU	000H
ajgm_01		EQU	001H
ajgm_02		EQU	002H
ajgm_03		EQU	003H
ajgm_04		EQU	004H
ajgm_05		EQU	005H
ajgm_06		EQU	006H
ajgm_07		EQU	007H
ajgm_08		EQU	008H
ajgm_09		EQU	009H
ajgm_0A		EQU	00AH
ajgm_0B		EQU	00BH
ajgm_0C		EQU	00CH
ajgm_0D		EQU	00DH
ajgm_0E		EQU	00EH
ajgm_0F		EQU	00FH
ajgm_10		EQU	010H
;
ajgm_waittime	EQU	0064*2
ajgm_waittime1	EQU	0064
ajgmappearptn	EQU	(AJGMAPPEAR-AJGMAPPEARPT)-1
ajgmhideptn	EQU	(AJGMHIDE-AJGMHIDEPT)-1
ajgmattackptn	EQU	(AJGMATTACKTM-AJGMATTACKPT)-1
ajgm_tame	EQU	0001
ajgm_throw	EQU	0000
ajgm_ypos	EQU	00BH
;
;
AJGMYUSNIN	EQU	$
		WORD	0FFFFH, 00005H
;
AJGMTIMEIN	EQU	$
		WORD	ajgm_waittime1, ajgm_waittime
;
AJGMMOD2IN	EQU	$
		WORD	0000000000000000B
		WORD	0000000100000000B
;
AJGM0IN		EQU	$
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		STA	<ENCONT,X		; 穴ジュゲムタイプセット !!
		TAY
		LDA	AJGMYUSNIN,Y
		STA	!ENYUSN,X
		LDA	AJGMTIMEIN,Y
		STA	!ENTIM0,X
		LDA	!ENMOD2,X
		AND	#1111111011111111B	; 照準フラグクリア !!
		ORA	AJGMMOD2IN,Y		; 照準フラグセット !!
		STA	!ENMOD2,X
		LDA	#ajgm_00
		STA	!ENCHPT,X
;
		LDA	!ENYPSL,X
		CLC
		ADC	#ajgm_ypos
		STA	!ENYPSL,X
;
		LDA	!ENMOD2,X
		ORA	#0000000000000100B
		STA	!ENMOD2,X		; 範囲クリアセット !!
;
		RTL
;
;
AJGM0_INIT	EQU	$
		LDA	<EWORK
		STA	!ENXPSL,Y
		LDA	<EWORK2
		CLC
		ADC	#ajgm_ypos
		STA	!ENYPSL,Y
		LDA	#0FFFFH
		STA	!ENYUSN,Y
		LDA	#ajgm_waittime1
		STA	!ENTIM0,Y
		LDA	!ENMOD2,Y
		AND	#1111111011111111B	; 照準フラグクリア !!
		STA	!ENMOD2,Y
		LDA	#ajgm_00
		STA	!ENCHPT,Y
		LDA	#0001
		STA	!ENWRK4,Y
		RTL
;
;
;------------------------------------------------------------------------
;-	move (穴ジュゲム)						-
;------------------------------------------------------------------------
AJGM0MV		EQU	$
		LDA	!ENMODE,X
		CMP	#EDOWN
		BNE	AJGM0MV0040		; pow block on ? [no->AJGM0MV0040]
;
		JMP	AJGMCRCK0140
;
AJGM0MV0040	EQU	$
		CMP	#EEATM
		BNE	AJGM0MV0050		; 食べられモード ? [no->AJGM0MV0050]
;
		LDA	#ajgm_10
		STA	!ENCHPT,X
		LDA	!BERXPS
		ORA	!BERYPS
		ORA	!BERFLG
		BNE	AJGM0MV0060		; [->AJGM0MV0060]
;
		LDA	!ENWRK4,X
		BEQ	AJGM0MV0060		; わきだし ? [no->AJGM0MV0060]
;
		LDA	#0064
		STA	!AJGM0_TIMER
		DEC	!AJGM0_COUNT
		BRA	AJGM0MV0060
;
AJGM0MV0050	EQU	$
		LDA	!ENCHPT,X
		CMP	#ajgm_0E
		BNE	AJGM0MV0060		; 弾光る ? [no->AJGM0MV0060]
;
		LDA	<FRCNT2
		AND	#00006H
		TAY
		LDA	JUGEMUCOLOR,Y
		STA	<EWORK
;
		I16				; index 16bit mode !!
;
		LDY	!ENOAML,X
		LDA	!SOAM_DX+4,Y
		AND	#0F1FFH
		ORA	<EWORK
		STA	!SOAM_DX+4,Y
;
		I8				; index 8bit mode !!
;
AJGM0MV0060	EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JMP	(AJGMTYPE,X)
;
;
AJGMTYPE	EQU	$
		WORD	AJGMTYPE0		; 出たり引っ込んだり
		WORD	AJGMTYPE1		; 出たまま
;
AJGMTYPE0	EQU	$
		LDX	<ENINDX
;
		LDA	!ENWRK4,X
		BEQ	AJGMTP00040		; わきだし ? [no->AJGMTP00040]
;
		JSL	>EN_CLR_CHECK2
		BCC	AJGMTP00040		; クリア ? [no->AJGMTP00040]
;
		DEC	!AJGM0_COUNT
		JMP	>ENCLEAR
;
AJGMTP00040	EQU	$
		LDA	<ENWRK0,X
		TAX
		JMP	(AJGMTP0MDSEL,X)
;
AJGMTP0MDSEL	EQU	$
		WORD	AJGMWAIT0
		WORD	AJGMAPPEARPT
		WORD	AJGMWAIT1
		WORD	AJGMATTACK
		WORD	AJGMHIDE
;
;
AJGMTYPE1	EQU	$
		LDX	<ENINDX
		LDA	<ENWRK0,X
		TAX
		JMP	(AJGMTP1MDSEL,X)
;
AJGMTP1MDSEL	EQU	$
		WORD	AJGMWAIT1
		WORD	AJGMATTACK
;
;
AJGMWAIT0	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	AJGMW000F0		; next mode ? [no->AJGMW000F0]
;
		LDA	#00005H
		STA	!ENYUSN,X
		LDA	!ENMOD2,X
		ORA	#0000000100000000B	; 照準フラグセット !!
		STA	!ENMOD2,X
		LDA	#ajgmappearptn
		STA	<ENWRK2,X
		TAY
		LDA	AJGMAPPEARPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#0003
		STA	!ENTIM0,X
		INC	<ENWRK0,X
		INC	<ENWRK0,X
AJGMW000F0	EQU	$
		RTL
;
;
AJGMWAIT1	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	AJGMW10080		; next mode ? [no->AJGMW10080]
;
		LDA	!ENDSXL,X
		ORA	!ENDSYL,X
		AND	#0FF00H
		BNE	AJGMW10080		; 画面外 ? [no->AJGMW10080]
;
		LDA	#ajgmattackptn
		STA	<ENWRK2,X
		TAY
		LDA	AJGMATTACKPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	AJGMATTACKTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
		INC	<ENWRK0,X
		INC	<ENWRK0,X
		JMP	AJGMCRCK		; 衝突チェック !!
;
AJGMW10080	EQU	$
		LDA	!ENTIM1,X
		BNE	AJGMW100F0		; [->AJGMW100F0]
;
		LDA	!ENWRK6,X
		BEQ	AJGMW100A0		; [->AJGMW100A0]
;
		STZ	!ENWRK6,X
		BRA	AJGMW100C0
;
AJGMW100A0	EQU	$
		LDA	<RANDM0
		AND	#0000FH
		BNE	AJGMW100F0		; [->AJGMW100F0]
;
		INC	!ENWRK6,X
AJGMW100C0	EQU	$
		LDA	#00010H
		STA	!ENTIM1,X
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
AJGMW100F0	EQU	$
		JMP	AJGMCRCK		; 衝突チェック !!
;
;
AJGMAPPEARPT	EQU	$
		BYTE	ajgm_01, ajgm_03, ajgm_04, ajgm_05
;
AJGMAPPEAR	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	AJGMA00F0		; pattern change ? [no->AJGMA00F0]
;
		DEC	<ENWRK2,X
		BMI	AJGMA0100		; next mode ? [yes->AJGMA0100]
;
		LDY	<ENWRK2,X
		LDA	AJGMAPPEARPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#0003
		STA	!ENTIM0,X
AJGMA00F0	EQU	$
		JMP	AJGMCRCK		; 衝突チェック !!
;
AJGMA0100	EQU	$
		LDA	#ajgm_00
		STA	!ENCHPT,X
		LDA	#ajgm_waittime
		STA	!ENTIM0,X
		INC	<ENWRK0,X
		INC	<ENWRK0,X
		JMP	AJGMCRCK		; 衝突チェック !!
;
;
AJGMHIDEPT	EQU	$
		BYTE	ajgm_05, ajgm_04, ajgm_03, ajgm_01
;
AJGMHIDE	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	AJGMH00F0		; pattern cahnge ? [no->AJGMH00F0]
;
		DEC	<ENWRK2,X
		BMI	AJGMH0100		; next mode ? [yes->AJGMH0100]
;
		LDY	<ENWRK2,X
		LDA	AJGMHIDEPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#0003
		STA	!ENTIM0,X
AJGMH00F0	EQU	$
		JMP	AJGMCRCK		; 衝突チェック !!
;
AJGMH0100	EQU	$
		LDA	!ENWRK4,X
		BNE	AJGMH0200		; わきだし ? [yes->AJGMH0200]
;
		STZ	<ENWRK2,X
		LDA	#ajgm_waittime1
		STA	!ENTIM0,X
		LDA	#0FFFFH
		STA	!ENYUSN,X
		LDA	!ENMOD2,X
		AND	#1111111011111111B	; 照準フラグクリア !!
		STA	!ENMOD2,X
		STZ	<ENWRK0,X
		RTL
;
AJGMH0200	EQU	$
		DEC	!AJGM0_COUNT
		JMP	>ENCLEAR
;
;
AJGMATTACKPT	EQU	$
		BYTE	ajgm_0F, ajgm_0E, ajgm_0B, ajgm_0D
		BYTE	ajgm_0B, ajgm_0C, ajgm_0B, ajgm_0A
		BYTE	ajgm_09, ajgm_08, ajgm_07, ajgm_06
		BYTE	ajgm_04, ajgm_03, ajgm_02, ajgm_03
		BYTE	ajgm_02, ajgm_03, ajgm_02
;
AJGMATTACKTM	EQU	$
		HEX	20, 80, 10, 06, 02, 02, 02, 02
		HEX	02, 02, 02, 02, 0C, 08, 08, 08
		HEX	08, 08, 08
;
AJGMATTACK	EQU	$
		LDX	<ENINDX
		LDA	<ENWRK2,X
		CMP	#ajgm_tame+1
		BCC	AJGMAT0020		; 向きセット ? [no->AJGMAT0020]
;
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	!ENMUKI,X
AJGMAT0020	EQU	$
		LDA	!ENTIM0,X
		BNE	AJGMAT0080		; pattern change ? [no->AJGMAT0080]
;
		DEC	<ENWRK2,X
		BMI	AJGMAT0100		; next mode ? [yes->AJGMAT0100]
;
		LDY	<ENWRK2,X
		LDA	AJGMATTACKPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	AJGMATTACKTM,Y
		AND	#000FFH
		STA	!ENTIM0,X
		CPY	#ajgm_tame
		BNE	AJGMAT0060		; lock on initial ? [no->AJGMAT0060]
;
		LDA	!PCENTX
		SEC
		SBC	#00008H
		STA	!ENWRKA,X
		LDA	!PCENTY
		SEC
		SBC	#00008H
		STA	!ENWRKC,X
		STZ	!ENWRK8,X
		BRA	AJGMAT00A0
;
AJGMAT0060	EQU	$
		CPY	#ajgm_throw
		BNE	AJGMAT0080		; throw ? [no->AJGMAT0080]
;
		LDA	!ENWRKA,X
		STA	<EWORK
		LDA	!ENWRKC,X
		STA	<EWORK2
		LDA	!ENWRK8,X
		STA	<EWORK4
		JSL	>TARGET_ON2		; lock on !!
;
		JSR	AJGM_TAMATHROW
;
		BRA	AJGMAT00F0
;
AJGMAT0080	EQU	$
		LDY	<ENWRK2,X
		CPY	#ajgm_tame
		BNE	AJGMAT00F0		; lock on ? [no->AJGMAT00F0]
;
AJGMAT00A0	EQU	$
		LDA	!ENWRKA,X
		STA	<EWORK
		LDA	!ENWRKC,X
		STA	<EWORK2
		LDA	!ENWRK8,X
		STA	<EWORK4
		JSL	>TARGET_ON		; lock on !!
;
		LDA	!ENWRK8,X
		INC	A
		CMP	#00020H
		BCS	AJGMAT00F0		; [->AJGMAT00F0]
;
		STA	!ENWRK8,X
AJGMAT00F0	EQU	$
		BRA	AJGMCRCK		; 衝突チェック !!
;
AJGMAT0100	EQU	$
		LDA	<ENCONT,X
		BEQ	AJGMAT0200		; 出たまま穴ジュゲム ? [no->AJGMAT0200]
;
		LDA	#ajgm_00
		STA	!ENCHPT,X
		LDA	#ajgm_waittime
		STA	!ENTIM0,X
		STZ	<ENWRK2,X
		STZ	<ENWRK0,X
		BRA	AJGMCRCK		; 衝突チェック !!
;
AJGMAT0200	EQU	$
		LDA	#ajgmhideptn
		STA	<ENWRK2,X
		TAY
		LDA	AJGMHIDEPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#0003
		STA	!ENTIM0,X
		INC	<ENWRK0,X
		INC	<ENWRK0,X
;
AJGMCRCK	EQU	$
		LDY	!ECRSFG,X
		BMI	AJGMCRCK0100		; プレイヤーと衝突 [yes->AJGMCRCK0100]
;
		DEY
		BMI	AJGMCRCK00F0		; 敵と衝突 [no->AJGMCRCK00F0]
		BEQ	AJGMCRCK00F0		; 赤ちゃんと衝突 [yes->AJGMCRCK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	AJGMCRCK00F0		; mode move ? [no->AJGMCRCK00F0]
;
		LDA	!ENSHOT,Y
		BEQ	AJGMCRCK00F0		; shot ? [no->AJGMCRCK00F0]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
		BRA	AJGMCRCK0140
;
AJGMCRCK00F0	EQU	$
		RTL
;
;
AJGMCRCK0100	EQU	$
		JSL	>EPFOOTCROSS_01		; 踏まれたチェック !!
		BEQ	AJGMCRCK00F0		; 衝突無し ? [yes->AJGMCRCK00F0]
		BCC	AJGMCRCK00F0		; プレイヤーダメージ ? [yes->AJGMCRCK00F0]
;
		JSL	>PLAYER_REBOUND
;
		LDA	#0001CH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
AJGMCRCK0140	EQU	$
		LDA	#0FC00H
		STA	!ENYSPD,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#ajgm_10
		STA	!ENCHPT,X
		LDA	#EFAIL
		STA	!ENMODE,X
;
		M8				; memory 8bit mode !!
;
		LDA	#0FFH
		STA	!ENRETN,X
;
		M16				; memory 16bit mode !!
;
		RTL
;
;
AJGMCRCK0200	EQU	$
		JMP	>PLFLST
;
;
AJGM_TAMATHROW	EQU	$
		LDA	!ENWRKA,X
		STA	R1			; target X
		LDA	!ENWRKC,X
		STA	R2			; target Y
		LDY	!ENMUKI,X
		LDA	!ECENTX,X
		CLC
		ADC	TAMAINTXPS,Y
		STA	<EWORK
		STA	R3			; my X
		LDA	!ECENTY,X
		STA	R4			; my Y
		LDA	#jugemu_throwspd
		STA	R6			; speed
		M_CHIP	SEARCH_SPEED
;
		LDX	<ENINDX
		LDA	#JTAMA
		JSL	>ENINSR
;
		BCC	AJGMTTR00F0		; 不発 ? [yes->JGMTTR00F0]
;
		LDA	R1
		STA	!ENXSPD,Y		; X スピードセット
		LDA	R2
		STA	!ENYSPD,Y		; Y スピードセット
		LDA	<EWORK
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00008H
		STA	!ENYPSL,Y
AJGMTTR00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	fail (穴ジュゲム)						-
;------------------------------------------------------------------------
AJGM0FL		EQU	$
		LDA	!ENWRK4,X
		BEQ	AJGM0FL00F0		; わきだし ? [no->AJGM0FL00F0]
;
		LDA	#0064
		STA	!AJGM0_TIMER
;
		JSL	>EN_CLR_CHECK2
		BCC	AJGM0FL00F0		; クリア ? [no->AJGM0FL00F0]
;
		DEC	!AJGM0_COUNT
		JMP	>ENCLEAR
;
AJGM0FL00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (とんがり)						-
;------------------------------------------------------------------------
tongari00	EQU	000H
tongari01	EQU	001H
tongari02	EQU	002H
tongari03	EQU	003H
tongari04	EQU	004H
tongari05	EQU	005H
tongari06	EQU	006H
tongari07	EQU	007H
tongari08	EQU	008H
tongari09	EQU	009H
tongari0A	EQU	00AH
tongari0B	EQU	00BH
tongari0C	EQU	00CH
tongari0D	EQU	00DH
tongari0E	EQU	00EH
tongari0F	EQU	00FH
tongari10	EQU	010H
tongari11	EQU	011H
tongari12	EQU	012H
tongari13	EQU	013H
;
tongariwalktm	EQU	04
tongariwalkpt	EQU	(TONGARIWALK-TONGARIWALKPT-1)
tongarirun0tm	EQU	03
tongarirun0pt	EQU	(02-1)
tongarihit1pt	EQU	(TONGARIHIT1TM-TONGARIHIT1PT-1)
tongarifumapt	EQU	(TONGARIFUMATM-TONGARIFUMAPT-1)
;
tongarifumare	EQU	(tongfuma-TONG0MODSEL)
;
TONG0XSPD	EQU	$
		WORD	0FFA0H, 00060H
;
TONG0IN		EQU	$
		LDY	!ENMUKI,X
		LDA	TONG0XSPD,Y
		STA	!ENXSPD,X
		LDA	#tongariwalktm
		STA	!ENTIM0,X
		LDA	#tongariwalkpt
		STA	<ENWRK0,X
		TAY
		LDA	TONGARIWALKPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		STZ	<ENCONT,X
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (とんがり)						-
;------------------------------------------------------------------------
TONG1XSPD	EQU	$
		WORD	0FF00H, 00100H
;
TONG1IN		EQU	$
		LDY	!ENMUKI,X
		LDA	TONG1XSPD,Y
		STA	!ENXSPD,X
		LDA	#tongarirun0tm
		STA	!ENTIM0,X
		LDA	#tongarirun0pt
		STA	<ENWRK0,X
		TAY
		LDA	TONGARIRUN0PT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		STZ	<ENCONT,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (とんがり)							-
;------------------------------------------------------------------------
TONG0MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JMP	(TONG0MODSEL,X)
;
TONG0MODSEL	EQU	$
		WORD	TONGARIWALK
		WORD	TONGARIHIT0
		WORD	TONGARIHIT1
		WORD	TONGARIRUN1
tongfuma	WORD	TONGARIFUMA
TONG0MODSELE	EQU	$
;
;
;------------------------------------------------------------------------
;-	move (とんがり)							-
;------------------------------------------------------------------------
TONG1MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JMP	(TONG1MODSEL,X)
;
TONG1MODSEL	EQU	$
		WORD	TONGARIRUN0
		WORD	TONGARIHIT0
		WORD	TONGARIHIT1
		WORD	TONGARIRUN1
		WORD	TONGARIFUMA
;
;
TONGARIWALKPT	EQU	$
		BYTE	tongari04, tongari03, tongari02, tongari01
		BYTE	tongari00
;
TONGARIWALK	EQU	$
		LDX	<ENINDX
		JSL	>TONGCRCK
;
		LDA	!ENTIM0,X
		BNE	TONGWK0160		; pattern change ? [no->TONGWK0160]
;
		DEC	<ENWRK0,X
		BPL	TONGWK0140		; [->TONGWK0140]
;
		LDA	#tongariwalkpt
		STA	<ENWRK0,X
TONGWK0140	EQU	$
		LDY	<ENWRK0,X
		LDA	TONGARIWALKPT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#tongariwalktm
		STA	!ENTIM0,X
TONGWK0160	EQU	$
		RTL
;
;
TONGARIRUN0PT	EQU	$
		BYTE	tongari08, tongari07
;
TONGARIRUN0	EQU	$
		LDX	<ENINDX
		JSL	>TONGCRCK
;
		LDA	#TONGARIRUN0PT
		STA	<EWORK
;
TONGR00100	EQU	$
		LDA	!ENTIM0,X
		BNE	TONGR00160		; pattern change ? [no->TONGR00160]
;
		LDA	<ENWRK0,X
		EOR	#0001
		STA	<ENWRK0,X
		TAY
		LDA	(<EWORK),Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#tongarirun0tm
		STA	!ENTIM0,X
TONGR00160	EQU	$
		RTL
;
;
TONGARIRUN1PT	EQU	$
		BYTE	tongari06, tongari05
;
TONGARIRUN1	EQU	$
		LDX	<ENINDX
		JSL	>TONGCRCK2
;
		LDA	!ENWRK4,X
		BEQ	TONGR10040		; [->TONGR10040]
;
		LDA	!ENTIM1,X
		BNE	TONGR10040		; [->TONGR10040]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		LDA	!ENXSPD,X
		EOR	#0FFFFH
		INC	A
		STA	!ENXSPD,X
		LDA	#0032
		STA	!ENTIM1,X
		DEC	!ENWRK4,X
TONGR10040	EQU	$
		LDA	#TONGARIRUN1PT
		STA	<EWORK
		BRA	TONGR00100
;
;
TONGARIHIT0	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		AND	#0000000000000001B
		BEQ	TGH00080		; 着地 ? [no->TGH00080]
;
		M8				; memory 8bit mode !!
;
		LDA	#tongarihit1pt
		STA	<ENWRK0,X
		TAY
		LDA	TONGARIHIT1PT,Y
		STA	!ENCHPT,X
		LDA	TONGARIHIT1TM,Y
		STA	!ENTIM0,X
		LDA	<ENWRK2,X
		STA	!ENMUKI,X		; 向きストア !!
		INC	<ENCONT,X
		INC	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
		STZ	!ENXSPD,X
TGH00080	EQU	$
		RTL
;
;
TONGARIHIT1PT	EQU	$
		BYTE	tongari0D, tongari0A, tongari0C, tongari0A
		BYTE	tongari0B, tongari0A, tongari0C, tongari0A
		BYTE	tongari0B, tongari0A, tongari0C, tongari0A
		BYTE	tongari0B, tongari0A, tongari09, tongari10
		BYTE	tongari0F
;
TONGARIHIT1TM	EQU	$
		HEX	42, 12, 02, 02, 02, 02, 02, 02
		HEX	02, 02, 02, 02, 02, 08, 20, 02
		HEX	02
;
TONGARIHIT1	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	TGH101F0		; pattern change ? [no->TGH101F0]
;
		DEC	<ENWRK0,X
		BMI	TGH10200		; next mode ? [yes->TGH10200]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	TONGARIHIT1PT,Y
		STA	!ENCHPT,X
		LDA	TONGARIHIT1TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
TGH101F0	EQU	$
		RTL
;
TGH10200	EQU	$
		LDY	!ENMUKI,X
		LDA	TONG1XSPD,Y
		STA	!ENXSPD,X
		LDA	#tongarirun0tm
		STA	!ENTIM0,X
		LDA	#tongarirun0pt
		STA	<ENWRK0,X
		TAY
		LDA	TONGARIRUN1PT,Y
		AND	#000FFH
		STA	!ENCHPT,X
		LDA	#0003
		STA	!ENWRK4,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		RTL
;
;
TONGARIFUMAPT	EQU	$
		BYTE	tongari12, tongari13, tongari12, tongari11
;
TONGARIFUMATM	EQU	$
		HEX	40, 03, 03, 03
;
TONGARIFUMA	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	TGFM01F0		; pattern change ? [no->TGFM01F0]
;
		DEC	<ENWRK0,X
		BMI	TGFM0200		; next mode ? [yes->TGFM0200]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	TONGARIFUMAPT,Y
		STA	!ENCHPT,X
		LDA	TONGARIFUMATM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
TGFM01F0	EQU	$
		RTL
;
TGFM0200	EQU	$
		LDA	!ENMYNO,X
		CMP	#TONG0
		BNE	TGFM0240		; 歩くとんがり ? [no->TGFM0240]
;
		JMP	TONG0IN			; 歩くとんがり初期設定 !!
;
TGFM0240	EQU	$
		JMP	TONG1IN			; 走るとんがり初期設定 !!
;
;
TONGCRCK	EQU	$
		LDY	!ECRSFG,X
		BPL	TGCRCK0040		; プレイヤーと衝突 ? [no->TGCRCK0040]
;
		JMP	TGCRCK0100		; プレイヤーと衝突 ? [yes->TGCRCK0100]
;
TGCRCK0040	EQU	$
		DEY
		BEQ	TGCRCK0050		; 赤ちゃんと衝突 ? [yes->TGCRCK0050]
		BPL	TGCRCK0060		; 衝突 ? [yes->TGCRCK0060]
;
TGCRCK0050	EQU	$
		JMP	TGCRCK00F0
;
TGCRCK0060	EQU	$
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	TGCRCK00F0		; mode move ? [no->TGCRCK00F0]
;
		LDA	!ENSHOT,Y
		BEQ	TGCRCK00F0		; shot ? [no->TGCRCK00F0]
;
		LDA	#tongari0E
		STA	!ENCHPT,X
		LDA	#0FE00H
		STA	!ENYSPD,X
		LDA	!ENCBFG,X
		AND	#0FFFEH
		STA	!ENCBFG,X		; 足当たりのクリア !!
		LDA	!ENXSPD,Y
		ASR16
		ASR16
		STA	!ENXSPD,X
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		STA	<ENWRK2,X		; 向きセーブ !!
		PHY
		JSL	>FSMK0_SET
;
		PLX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
		LDA	#KABUT
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#0000EH
		STA	!EXYPSL,Y
		LDA	!ENYSPD,X
		SEC
		SBC	#00100H
		STA	!EXYSPD,Y
		LDA	!ENXSPD,X
		EOR	#0FFFFH
		INC	A
		STA	!EXXSPD,Y
		LDA	#0064*3
		STA	!EXTIM0,Y
		LDA	!ENMUKI,X
		STA	!EXMUKI,Y
;
		INC	<ENCONT,X
		INC	<ENCONT,X
		PLY
		PLA
TGCRCK00F0	EQU	$
		RTL
;
TGCRCK0100	EQU	$
		JSL	>EPFOOTCROSS_01		; 踏まれたチェック !!
		BEQ	TGCRCK01F0		; 衝突無し ? [yes->TGCRCK01F0]
		BCC	TGCRCK01E0		; 踏まれた ? [no->TGCRCK01E0]
;
		STZ	!ENXSPD,X
;
		M8				; memory 8bit mode !!
;
		LDA	#tongarifumapt
		STA	<ENWRK0,X
		TAY
		LDA	TONGARIFUMAPT,Y
		STA	!ENCHPT,X
		LDA	TONGARIFUMATM,Y
		STA	!ENTIM0,X
		LDA	#tongarifumare
		STA	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
		PLY
		PLA
TGCRCK01E0	EQU	$
		JSL	>PLFLST
;
TGCRCK01F0	EQU	$
		RTL
;
;
TONGCRCK2	EQU	$
		LDY	!ECRSFG,X
		BMI	TGCRC20100		; プレイヤーと衝突 ? [yes->TGCRC20100]
;
		DEY
		BMI	TGCRC200F0		; 衝突無し ? [yes->TGCRC200F0]
		BEQ	TGCRC200F0		; 赤ちゃんと衝突 ? [yes->TGCRC200F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	TGCRC200F0		; mode move ? [no->TGCRC200F0]
;
		LDA	!ENSHOT,Y
		BEQ	TGCRC200F0		; shot ? [no->TGCRC200F0]
;
		PHY
		JSL	>ENDEATH_SET		; 死亡セット !!
;
		PLY
		LDA	#0FE00H
		STA	!ENYSPD,X
		LDA	!ENXSPD,Y
		ASR16
		ASR16
		STA	!ENXSPD,X
		PHY
		JSL	>FSMK0_SET
;
		PLX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
		PLY
		PLA
TGCRC200F0	EQU	$
		RTL
;
TGCRC20100	EQU	$
		JSL	>EPCRCK
;
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (バンブーダンサーズ)					-
;------------------------------------------------------------------------
bamboo00	EQU	000H
bamboo01	EQU	001H
bamboo02	EQU	002H
bamboo03	EQU	003H
bamboo04	EQU	004H
bamboo05	EQU	005H
bamboo06	EQU	006H
bamboo07	EQU	007H
bamboo08	EQU	008H
bamboo09	EQU	009H
bamboo0A	EQU	00AH
bamboo0B	EQU	00BH
bamboo0C	EQU	00CH
bamboo0D	EQU	00DH
bamboo0E	EQU	00EH
bamboo0F	EQU	00FH
bamboo10	EQU	010H
;
banboo_wait	EQU	(bamboo_wait_p-BAMBOOINMODSEL)
;
banboo_dance00	EQU	(BAMBOODANCE00TM-BAMBOODANCE00PT-1)
banboo_dance01	EQU	(BAMBOODANCE01TM-BAMBOODANCE01PT-1)
banboo_dance02	EQU	(BAMBOODANCE02TM-BAMBOODANCE02PT-1)
banboo_dance03	EQU	(BAMBOODANCE03TM-BAMBOODANCE03PT-1)
banboo_dance04	EQU	banboo_dance03
banboo_dance05	EQU	(BAMBOODANCE05TM-BAMBOODANCE05PT-1)
banboo_dance06	EQU	(BAMBOODANCE07PT-BAMBOODANCE06PT-1)
banboo_dance07	EQU	banboo_dance06
banboo_dance08	EQU	(BAMBOODANCE08TM-BAMBOODANCE08PT-1)
;
bamboo_jc0	EQU	(banboo_dance00-2)
bamboo_time0	EQU	08
bamboo_jump0	EQU	0FE00H
bamboo_gpow0	EQU	00040H
;
bamboo_jc1	EQU	(banboo_dance01-2)
bamboo_time1	EQU	08
bamboo_jump1	EQU	0FE00H
bamboo_gpow1	EQU	00040H
;
bamboo_fc3	EQU	(banboo_dance03-4)
bamboo_time3	EQU	06
;
bamboo_fc4	EQU	(banboo_dance04-4)
bamboo_time4	EQU	06
;
bamboo_jc5	EQU	(banboo_dance05-2)
bamboo_jump5	EQU	0FE08H
bamboo_gpow5	EQU	0002AH
;
bamboo_jc61	EQU	(banboo_dance06-1)
bamboo_jc62	EQU	(banboo_dance06-5)
bamboo_time6	EQU	06
bamboo_jump6	EQU	0FE80H
bamboo_gpow6	EQU	00040H
;
bamboo_jc71	EQU	(banboo_dance07-1)
bamboo_jc72	EQU	(banboo_dance07-5)
bamboo_time7	EQU	06
bamboo_jump7	EQU	0FE80H
bamboo_gpow7	EQU	00040H
;
bamboo_fc81	EQU	(banboo_dance08-2)
bamboo_fc82	EQU	(banboo_dance08-5)
bamboo_fc83	EQU	(banboo_dance08-8)
bamboo_fc84	EQU	(banboo_dance08-11)
;
BAMBOIN		EQU	$
		LDA	!BAMBO_ST_FG
		BNE	BAMBOIN0040		; 指揮者不在 ? [no->BAMBOIN0040]
;
		JMP	>ENCLEAR
;
BAMBOIN0040	EQU	$
		STZ	!ENMUKI,X
		LDA	!ECNTYW,X
		SEC
		SBC	#00004H
		STA	!ECNTYW,X
		LDA	!EWIDEY,X
		CLC
		ADC	#00002H
		STA	!EWIDEY,X
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		STA	<ENWRK2,X
		TAY
		LDA	!BAMBO_QUE
		BEQ	BAMBOIN0100		; [->BAMBOIN0100]
;
		LDA	!ENXPSL,X
		CLC
		ADC	!BAMBO_XREV01,Y
		STA	!ENXPSL,X
		LDA	!BAMBO_SEQ0,Y
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTL
;
;
BAMBOIN0100	EQU	$
		LDA	!ENXPSL,X
		CLC
		ADC	!BAMBO_XREV00,Y
		STA	!ENXPSL,X
		LDA	#banboo_wait
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTL
;
;
;------------------------------------------------------------------------
;-	move (バンブーダンサーズ)					-
;------------------------------------------------------------------------
BAMBOMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		JSR	BAMBOOYRCK
;
		LDA	!BAMBO_QUE
		BEQ	BAMBOMV0040		; NEXT DANCE ? [no->BAMBOMV0040]
;
		STZ	!ENXSPD,X
		STZ	!ENMUKI,X
		LDY	<ENWRK2,X
		LDA	!BAMBO_SEQ0,Y
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		BRA	BAMBOMV0080
;
BAMBOMV0040	EQU	$
		LDA	<ENCONT,X
		TAX
		JSR	(BAMBOOMODSEL,X)
;
BAMBOMV0080	EQU	$
		JSL	>EPCRCK
;
		RTL
;
BAMBOOINMODSEL	EQU	$
		WORD	BAMBOODANCE00IN
		WORD	BAMBOODANCE01IN
bamboo_wait_p	WORD	BAMBOODANCE02IN
		WORD	BAMBOODANCE03IN
		WORD	BAMBOODANCE04IN
		WORD	BAMBOODANCE05IN
		WORD	BAMBOODANCE06IN
		WORD	BAMBOODANCE07IN
		WORD	BAMBOODANCE08IN
;
BAMBOOMODSEL	EQU	$
		WORD	BAMBOODANCE00
		WORD	BAMBOODANCE01
		WORD	BAMBOODANCE02
		WORD	BAMBOODANCE03
		WORD	BAMBOODANCE04
		WORD	BAMBOODANCE05
		WORD	BAMBOODANCE06
		WORD	BAMBOODANCE07
		WORD	BAMBOODANCE08
;
;
BAMBOOD0XSPD	EQU	$
		WORD	-00200H,  00200H
;
BAMBOODANCE00PT EQU	$
		BYTE	bamboo07, bamboo03, bamboo02, bamboo01, bamboo00, bamboo06
;
BAMBOODANCE00TM EQU	$
		BYTE	bamboo_time0, bamboo_time0, bamboo_time0, bamboo_time0
		BYTE	bamboo_time0, bamboo_time0
;
BAMBOODANCE00IN EQU	$
		LDX	<ENINDX
		LDA	#banboo_dance00
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	BAMBOODANCE00PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE00TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
BAMBOODANCE00	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	BAMBD00040		; 足当たり ? [no->BAMBD00040]
;
		STZ	!ENXSPD,X
BAMBD00040	EQU	$
		LDA	!ENTIM0,X
		BNE	BAMBD000F0		; pattern change ? [no->BAMBD000F0]
;
		DEC	<ENWRK0,X
		BMI	BAMBD00100		; [->BAMBD00100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	BAMBOODANCE00PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE00TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#bamboo_jc0
		BNE	BAMBD000F0		; ジャンプ開始 ? [no->BAMBD000F0]
;
		LDA	#bamboo_jump0
		STA	!ENYSPD,X
		LDA	!ENCBFG,X
		AND	#0FFFEH
		STA	!ENCBFG,X		; 足当たりクリア !!
		LDA	#bamboo_gpow0
		STA	!ENGPOW,X
		LDY	!ENMUKI,X
		LDA	BAMBOOD0XSPD,Y
		STA	!ENXSPD,X
BAMBD000F0	EQU	$
		RTS
;
BAMBD00100	EQU	$
		LDA	#banboo_wait
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTS
;
;
BAMBOOD1XSPD	EQU	$
		WORD	 00200H, -00200H
;
BAMBOODANCE01PT EQU	$
		BYTE	bamboo06, bamboo00, bamboo05, bamboo04, bamboo03, bamboo07
;
BAMBOODANCE01TM EQU	$
		BYTE	bamboo_time1, bamboo_time1, bamboo_time1, bamboo_time1
		BYTE	bamboo_time1, bamboo_time1
;
BAMBOODANCE01IN EQU	$
		LDX	<ENINDX
		LDA	#banboo_dance01
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	BAMBOODANCE01PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE01TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
BAMBOODANCE01	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	BAMBD10040		; 足当たり ? [no->BAMBD10040]
;
		STZ	!ENXSPD,X
BAMBD10040	EQU	$
		LDA	!ENTIM0,X
		BNE	BAMBD100F0		; pattern change ? [no->BAMBD100F0]
;
		DEC	<ENWRK0,X
		BMI	BAMBD10100		; [->BAMBD10100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	BAMBOODANCE01PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE01TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#bamboo_jc1
		BNE	BAMBD100F0		; ジャンプ開始 ? [no->BAMBD100F0]
;
		LDA	#bamboo_jump1
		STA	!ENYSPD,X
		LDA	!ENCBFG,X
		AND	#0FFFEH
		STA	!ENCBFG,X		; 足当たりクリア !!
		LDA	#bamboo_gpow1
		STA	!ENGPOW,X
		LDY	!ENMUKI,X
		LDA	BAMBOOD1XSPD,Y
		STA	!ENXSPD,X
BAMBD100F0	EQU	$
		RTS
;
BAMBD10100	EQU	$
		LDA	#banboo_wait
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTS
;
;
BAMBOODANCE02PT EQU	$
		BYTE	bamboo00, bamboo05, bamboo04, bamboo03
		BYTE	bamboo02, bamboo01, bamboo00, bamboo05
		BYTE	bamboo04, bamboo03, bamboo02, bamboo01
		BYTE	bamboo00
;
BAMBOODANCE02TM EQU	$
		HEX	02, 04, 04, 04, 04, 04, 04, 04
		HEX	04, 04, 04, 04, 02
;
BAMBOODANCE02IN EQU	$
		LDX	<ENINDX
		LDA	#banboo_dance02
		STA	<ENWRK0,X
		TAY
;
		M8				; memory 8bit mode !!
;
		LDA	BAMBOODANCE02PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE02TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
BAMBOODANCE02	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	BAMBD200F0		; pattern change ? [no->BAMBD200F0]
;
		DEC	<ENWRK0,X
		BMI	BAMBD20100		; [->BAMBD20100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	BAMBOODANCE02PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE02TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
BAMBD200F0	EQU	$
		RTS
;
BAMBD20100	EQU	$
		LDA	#banboo_wait
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTS
;
;
BAMBOOD3XSPD	EQU	$
BAMBOOD4XSPD	EQU	$
		WORD	-00055H,  00055H
;
BAMBOODANCE03PT EQU	$
BAMBOODANCE04PT EQU	$
		BYTE	bamboo08, bamboo09, bamboo0A, bamboo0B
		BYTE	bamboo0B, bamboo0A, bamboo09, bamboo08
;
BAMBOODANCE03TM EQU	$
BAMBOODANCE04TM EQU	$
		BYTE	bamboo_time3, bamboo_time3, bamboo_time3, bamboo_time3
		BYTE	bamboo_time3, bamboo_time3, bamboo_time3, bamboo_time3
;
BAMBOODANCE03IN EQU	$
		LDX	<ENINDX
		LDA	#banboo_dance03
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	BAMBOODANCE03PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE03TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		LDY	!ENMUKI,X
		LDA	BAMBOOD3XSPD,Y
		STA	!ENXSPD,X
		RTS
;
;
BAMBOODANCE03	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	BAMBD300F0		; pattern change ? [no->BAMBD300F0]
;
		DEC	<ENWRK0,X
		BMI	BAMBD30100		;[->BAMBD30100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	BAMBOODANCE03PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE03TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#bamboo_fc3
		BNE	BAMBD300F0		; [->BAMBD300F0]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
BAMBD300F0	EQU	$
		RTS
;
BAMBD30100	EQU	$
		STZ	!ENXSPD,X
		LDA	#banboo_wait
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTS
;
;
BAMBOODANCE04IN EQU	$
		LDX	<ENINDX
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		LDA	#banboo_dance04
		STA	<ENWRK0,X
		TAY
;
		M8				; memory 8bit mode !!
;
		LDA	BAMBOODANCE04PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE04TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		LDY	!ENMUKI,X
		LDA	BAMBOOD4XSPD,Y
		STA	!ENXSPD,X
		RTS
;
;
BAMBOODANCE04	EQU	$
		LDX	<ENINDX
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	BAMBD400F0		; pattern change ? [no->BAMBD400F0]
;
		DEC	<ENWRK0,X
		BMI	BAMBD40100		;[->BAMBD40100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	BAMBOODANCE04PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE04TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#bamboo_fc4
		BNE	BAMBD400F0		; [->BAMBD400F0]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
BAMBD400F0	EQU	$
		RTS
;
BAMBD40100	EQU	$
		STZ	!ENXSPD,X
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		LDA	#banboo_wait
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTS
;
;
BAMBOODANCE05PT EQU	$
		BYTE	bamboo0C, bamboo0D, bamboo0E, bamboo0D
		BYTE	bamboo0C
;
BAMBOODANCE05TM EQU	$
		HEX	08, 04, 18, 04, 08
;
BAMBOODANCE05IN EQU	$
		LDX	<ENINDX
		LDA	#banboo_dance05
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	BAMBOODANCE05PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE05TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
BAMBOODANCE05	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	BAMBD500F0		; pattern change ? [no->BAMBD500F0]
;
		DEC	<ENWRK0,X
		BMI	BAMBD50100		; [->BAMBD50100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	BAMBOODANCE05PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE05TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#bamboo_jc5
		BNE	BAMBD500F0		; ジャンプ開始 ? [no->BAMBD500F0]
;
		LDA	#bamboo_jump5
		STA	!ENYSPD,X
		LDA	!ENCBFG,X
		AND	#0FFFEH
		STA	!ENCBFG,X		; 足当たりクリア !!
		LDA	#bamboo_gpow5
		STA	!ENGPOW,X
BAMBD500F0	EQU	$
		RTS
;
BAMBD50100	EQU	$
		LDA	#banboo_wait
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTS
;
;
BAMBOODANCE06PT EQU	$
		BYTE	bamboo03, bamboo03, bamboo03, bamboo07
		BYTE	bamboo03, bamboo03, bamboo03, bamboo07
;
BAMBOODANCE07PT EQU	$
		BYTE	bamboo00, bamboo00, bamboo00, bamboo06
		BYTE	bamboo00, bamboo00, bamboo00, bamboo06
;
BAMBOODANCE06TM EQU	$
BAMBOODANCE07TM EQU	$
		BYTE	bamboo_time6, bamboo_time6, bamboo_time6, bamboo_time6
		BYTE	bamboo_time6, bamboo_time6, bamboo_time6, bamboo_time6
;
BAMBOODANCE06IN EQU	$
		LDX	<ENINDX
		LDA	#banboo_dance06
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	BAMBOODANCE06PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE06TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
BAMBOODANCE06	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	BAMBD600F0		; pattern change ? [no->BAMBD600F0]
;
		DEC	<ENWRK0,X
		BMI	BAMBD60100		; [->BAMBD60100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	BAMBOODANCE06PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE06TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#bamboo_jc61
		BEQ	BAMBD60080		; ジャンプ開始 ? [yes->BAMBD60080]
;
		CPY	#bamboo_jc62
		BNE	BAMBD600F0		; ジャンプ開始 ? [no->BAMBD600F0]
;
BAMBD60080	EQU	$
		LDA	#bamboo_jump6
		STA	!ENYSPD,X
		LDA	!ENCBFG,X
		AND	#0FFFEH
		STA	!ENCBFG,X		; 足当たりクリア !!
		LDA	#bamboo_gpow6
		STA	!ENGPOW,X
BAMBD600F0	EQU	$
		RTS
;
BAMBD60100	EQU	$
		LDA	#banboo_wait
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTS
;
;
BAMBOODANCE07IN EQU	$
		LDX	<ENINDX
;;;;;;;;		LDA	!ENMUKI,X
;;;;;;;;		EOR	#00002H
;;;;;;;;		STA	!ENMUKI,X
		LDA	#banboo_dance07
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	BAMBOODANCE07PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE07TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
BAMBOODANCE07	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	BAMBD700F0		; pattern change ? [no->BAMBD700F0]
;
		DEC	<ENWRK0,X
		BMI	BAMBD70100		; [->BAMBD70100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	BAMBOODANCE07PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE07TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#bamboo_jc71
		BEQ	BAMBD70080		; ジャンプ開始 ? [yes->BAMBD70080]
;
		CPY	#bamboo_jc72
		BNE	BAMBD700F0		; ジャンプ開始 ? [no->BAMBD700F0]
;
BAMBD70080	EQU	$
		LDA	#bamboo_jump7
		STA	!ENYSPD,X
		LDA	!ENCBFG,X
		AND	#0FFFEH
		STA	!ENCBFG,X		; 足当たりクリア !!
		LDA	#bamboo_gpow7
		STA	!ENGPOW,X
BAMBD700F0	EQU	$
		RTS
;
BAMBD70100	EQU	$
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		LDA	#banboo_wait
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTS
;
;
BAMBOODANCE08PT EQU	$
		BYTE	bamboo0F, bamboo10, bamboo10, bamboo0F
		BYTE	bamboo10, bamboo10, bamboo0F, bamboo10
		BYTE	bamboo10, bamboo0F, bamboo10, bamboo10
		BYTE	bamboo0F
;
BAMBOODANCE08TM EQU	$
		HEX	02, 04, 04, 04, 04, 04, 04, 04
		HEX	04, 04, 04, 04, 02
;
BAMBOODANCE08IN EQU	$
		LDX	<ENINDX
		LDA	#banboo_dance08
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	BAMBOODANCE08PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE08TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
BAMBOODANCE08	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	BAMBD800F0		; pattern change ? [no->BAMBD800F0]
;
		DEC	<ENWRK0,X
		BMI	BAMBD80100		; [->BAMBD80100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	BAMBOODANCE08PT,Y
		STA	!ENCHPT,X
		LDA	BAMBOODANCE08TM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#bamboo_fc81
		BEQ	BAMBD80080		; 反転 ? [yes->BAMBD80080]
;
		CPY	#bamboo_fc82
		BEQ	BAMBD80080		; 反転 ? [yes->BAMBD80080]
;
		CPY	#bamboo_fc83
		BEQ	BAMBD80080		; 反転 ? [yes->BAMBD80080]
;
		CPY	#bamboo_fc84
		BNE	BAMBD800F0		; 反転 ? [no->BAMBD800F0]
;
BAMBD80080	EQU	$
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
BAMBD800F0	EQU	$
		RTS
;
BAMBD80100	EQU	$
		LDA	#banboo_wait
		STA	<ENCONT,X
		TAX
		JSR	(BAMBOOINMODSEL,X)
;
		RTS
;
;
BAMBOOYRXP	EQU	$
		WORD	0000CH+4, 0000BH+4, 0000AH+4, 00008H+4		;  0 -	3
		WORD	00009H+4, 0000AH+4, 0000CH+4, 00008H+4		;  4 -	7
		WORD	00001H+4, 0FFFEH+4, 0FFFFH+4, 00002H+4		;  8 -	B
		WORD	0000AH+4, 0000AH+4, 0000AH+4, 00003H+4		;  C -	F
		WORD	00004H+4					; 10
;
BAMBOOYRYP	EQU	$
		WORD	0FFE0H+4, 0FFDEH+4, 0FFDDH+4, 0FFDCH+4		;  0 -	3
		WORD	0FFDBH+4, 0FFDDH+4, 0FFE3H+4, 0FFDFH+4		;  4 -	7
		WORD	0FFDEH+4, 0FFDFH+4, 0FFE0H+4, 0FFDFH+4		;  8 -	B
		WORD	0FFE2H+4, 0FFDFH+4, 0FFDAH+4, 0FFE0H+4		;  C -	F
		WORD	0FFDFH+4					; 10
;
BAMBOOYRCK	EQU	$
		LDA	!ENCHPT,X
		ASL	A
		TAY
		LDA	!PWIDEY
		CLC
		ADC	#0001
		STA	<EWORK
		LDA	BAMBOOYRYP,Y
		CLC
		ADC	!ENYPSL,X
		SEC
		SBC	!PCENTY
		ABS16
		CMP	<EWORK
		BCS	BAMBOOYRCK00F0		; 触ってる？ [no->BAMBOOYRCK00F0]
;
		LDA	!PWIDEX
		CLC
		ADC	#0001
		STA	<EWORK
		LDA	BAMBOOYRXP,Y
		LDY	!ENMUKI,X
		BEQ	BAMBOOYRCK0080		; [->BAMBOOYRCK0080]
;
		EOR	#0FFFFH
		CLC
		ADC	#0009
BAMBOOYRCK0080	EQU	$
		CLC
		ADC	!ENXPSL,X
		SEC
		SBC	!PCENTX
		ABS16
		CMP	<EWORK
		BCS	BAMBOOYRCK00F0		; 触ってる？ [no->BAMBOOYRCK00F0]
;
		JSL	>PLFLST
;
BAMBOOYRCK00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	initial (空手家)						-
;------------------------------------------------------------------------
karate00	EQU	000H
karate01	EQU	001H
karate02	EQU	002H
karate03	EQU	003H
karate04	EQU	004H
karate05	EQU	005H
karate06	EQU	006H
karate07	EQU	007H
karate08	EQU	008H
karate09	EQU	009H
karate0A	EQU	00AH
karate0B	EQU	00BH
karate0C	EQU	00CH
karate0D	EQU	00DH
karate0E	EQU	00EH
karate0F	EQU	00FH
karate10	EQU	010H
karate11	EQU	011H
karate12	EQU	012H
karate13	EQU	013H
karate14	EQU	014H
karate15	EQU	015H
karate16	EQU	016H
karate17	EQU	017H
karate18	EQU	018H
karate19	EQU	019H
karate1A	EQU	01AH
karate1B	EQU	01BH
karate1C	EQU	01CH
karate1D	EQU	01DH
karate1E	EQU	01EH
karate1F	EQU	01FH
karate20	EQU	020H
karate21	EQU	021H
karate22	EQU	022H
karate23	EQU	023H
karate24	EQU	024H
karate25	EQU	025H
karate26	EQU	026H
karate27	EQU	027H
karate28	EQU	028H
karate29	EQU	029H
karate2A	EQU	02AH
karate2B	EQU	02BH
;
karateman_area	EQU	00080H
karateman_area1 EQU	00020H
karateman_area2 EQU	00010H
karateman_area3 EQU	00060H
karateman_area4 EQU	00010H
;
krt_tatearea	EQU	00008H
krt_yokoarea	EQU	00008H
;
karate_kiai	EQU	0003CH
;
karate_frontpt	EQU	(KARATE_FRONTTM-KARATE_FRONTPT-1)
krt_frgop	EQU	(karate_frontpt-1)
karate_backpt	EQU	(KARATE_BKXSPD0-KARATE_BACKPT-1)
krt_bkgop0	EQU	(karate_backpt-2)
krt_bkgop1	EQU	(karate_backpt-3)
karate_tukipt	EQU	(KARATE_TUKITM-KARATE_TUKIPT-1)
krt_tukidestroy EQU	(karate_tukipt-3)
karate_keript	EQU	(KARATE_KERITM-KARATE_KERIPT-1)
krt_keridestroy EQU	(karate_keript-6)
karate_mawapt	EQU	(KARATE_MAWATM-KARATE_MAWAPT-1)
krt_mawadestroy EQU	(karate_mawapt-9)
karate_hadopt	EQU	(KARATE_HADOTM-KARATE_HADOPT-1)
krt_hadostart	EQU	(karate_hadopt-6)
karate_jumppt	EQU	(KARATE_JUMPTM-KARATE_JUMPPT-1)
krt_jumpset	EQU	(karate_jumppt-1)
krt_jumpspd	EQU	0FA80H
;
karate_taiki	EQU	(taiki-KARATEMODSEL)
karate_zensn	EQU	(zensn-KARATEMODSEL)
karate_kogek	EQU	(kogek-KARATEMODSEL)
karate_kabew	EQU	(kabew-KARATEMODSEL)
;
karate_frnt	EQU	(frnt-KARATEMD2INSEL)
karate_back	EQU	(back-KARATEMD2INSEL)
karate_tuki	EQU	(tuki-KARATEMD2INSEL)
karate_keri	EQU	(keri-KARATEMD2INSEL)
karate_mawa	EQU	(mawa-KARATEMD2INSEL)
karate_hado	EQU	(hado-KARATEMD2INSEL)
karate_jump	EQU	(jump-KARATEMD2INSEL)
;
karate_failptn	EQU	(KRTFAILTIM-KRTFAILPTN-1)
karate_fljmppnt EQU	(karate_failptn-1)
karate_failjump EQU	-00180H
;
KRT_XSPD	EQU	$
		WORD	-00100H,  00100H
;
KARATIN		EQU	$
		STZ	<ENCONT,X
		STZ	!ENWRK4,X
		LDA	#KARATE_FRONTTM
		STA	!ENWRKC,X
		JSR	KARATE_FRONTIN
;
		RTL
;
;
;------------------------------------------------------------------------
;-	move (空手家)							-
;------------------------------------------------------------------------
KARATSLIPXSPD	EQU	$
		WORD	00200H, -0200H
;
KARATMV		EQU	$
		LDA	!ENMODE,X
		CMP	#EEATM
		BNE	KARATMV0040		; 食べられた ? [no->KARATMV0040]
;
		LDA	#02
		STA	!BERFLG
		STZ	!EATFLG
		STZ	!EATSTP
;
		LDA	#EMOVE
		STA	!ENMODE,X
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	!ENMUKI,X
		TAY
		LDA	KARATSLIPXSPD,Y
		STA	!ENXSPD,X
		LDA	#0001
		STA	!ENXPOW,X
		PLY
		PLA
KARATMV0040	EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	!ENXPOW,X
		BEQ	KARATMV0060		; スリップモード ? [no->KARATMV0060]
;
		JMP	KARATSLIP
;
KARATMV0060	EQU	$
		STZ	!ENWRKA,X		; 敵衝突情報クリア !!
		LDA	!ENCLOR,X
		AND	#0FFF1H
		STA	!ENCLOR,X		; カラーセット !!
;
		TAX
		STA	R1
		M_CHIP	SHOTENSR
;
		LDX	<ENINDX
		LDA	R1
		STA	!ENWRK8,X		; ショット敵情報セーブ !!
;
		LDA	!ENCHPT,X
		CMP	#karate00
		BNE	KARATMV0080		; [->KARATMV0080]
;
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	!ENMUKI,X
KARATMV0080	EQU	$
		JSR	KRTPLSEARCH
;
		JSR	KRT_BGCHECK
;
		JSR	KRT_SHOTENSH
;
		LDA	<ENCONT,X
		CMP	#karate_kogek
		BCS	KARATMV00A0		; 攻撃 ? [yes->KARATMV00A0]
;
		LDY	!ENWRK8,X
		BMI	KARATMV00A0		; ショット敵が存在する ? [yes->KARATMV00A0]
;
		JSL	>EN_EN_XSPD
		BMI	KARATMV00A0		; 近付いてる ? [no->KARATMV00A0]
;
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		STA	!ENMUKI,X
;
		STZ	<ENCONT,X
		INC	<ENWRK2,X
KARATMV00A0	EQU	$
		LDA	!ENCBFG,X
		BIT	#00001H
		BEQ	KARATMV0100		; 足当たり ? [no->KARATMV0100]
;
		STZ	!ENWRK6,X		; ジャンプフラグクリア !!
		LDA	<ENCONT,X
		TAX
		JSR	(KARATEMODSEL,X)
;
		JMP	KRT_CRSCHK
;
KARATMV0100	EQU	$
		LDA	!ENWRK6,X
		BEQ	KARATMV0180		; 自分でジャンプした ? [no->KARATMV0180]
;
		LDY	!ENMUKI,X
		LDA	KRT_XSPD,Y
		STA	!ENXSPD,X
KARATMV0180	EQU	$
		LDA	#karate20
		STA	!ENCHPT,X
		STZ	!ENTIM0,X
		LDA	#karate_jump
		STA	!ENWRK4,X
		LDA	#krt_jumpset
		STA	<ENWRK0,X
;
		JMP	KRT_CRSCHK
;
;
KARATEMODSEL	EQU	$
taiki		WORD	KARATE_WAIT
zensn		WORD	KARATE_ZNSN
kogek		WORD	KARATE_KOGK
kabew		WORD	KARATE_KBWR
;
;
KARATEMD2INSEL	EQU	$
frnt		WORD	KARATE_FRONTIN
back		WORD	KARATE_BACKIN
tuki		WORD	KARATE_TUKIIN
keri		WORD	KARATE_KERIIN
mawa		WORD	KARATE_MAWAIN
hado		WORD	KARATE_HADOIN
jump		WORD	KARATE_JUMPIN
;
KARATEMD2SEL	EQU	$
		WORD	KARATE_FRONT
		WORD	KARATE_BACK
		WORD	KARATE_TUKI
		WORD	KARATE_KERI
		WORD	KARATE_MAWA
		WORD	KARATE_HADO
		WORD	KARATE_JUMP
;
KOGEKI_PTN	EQU	$
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
		WORD	karate_hado
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
;
KABEWARI_PTN	EQU	$
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
		WORD	karate_tuki
;
IKAKU_PTN	EQU	$
		WORD	karate_hado
		WORD	karate_hado
		WORD	karate_hado
		WORD	karate_hado
		WORD	karate_hado
		WORD	karate_tuki
		WORD	karate_keri
		WORD	karate_mawa
;
KARATE_WAIT	EQU	$
		LDX	<ENINDX
		LDA	#KARATE_FRONTTM
		STA	!ENWRKC,X
		LDA	<ENWRK2,X
		BEQ	KARATE_WAIT0100		; initial ? [no->KARATE_WAIT0100]
;
		LDA	!ENWRK4,X
		AND	#00002H
		EOR	#00002H
		STA	!ENWRK4,X
		TAX
		JMP	(KARATEMD2INSEL,X)
;
KARATE_WAIT0100 EQU	$
		LDA	!ENWRK4,X
		TAX
		JMP	(KARATEMD2SEL,X)
;
;
KARATE_ZNSN	EQU	$
		LDX	<ENINDX
		LDA	#KARATE_FRNT2TM
		STA	!ENWRKC,X
		LDA	<ENWRK2,X
		BEQ	KARATE_WAIT0100		; initial ? [no->KARATE_WAIT0100]
;
		LDA	<RANDM0
		AND	#00007H
		BEQ	KARATE_ZNSN0040		; 威嚇 ? [yes->KARATE_ZNSN0040]
;
		LDA	#0000
		BRA	KARATE_ZNSN0080
;
KARATE_ZNSN0040 EQU	$
		LDA	<RANDM0
		AND	#00038H
		LSR	A
		LSR	A
		TAY
		LDA	IKAKU_PTN,Y
KARATE_ZNSN0080 EQU	$
		STA	!ENWRK4,X
		TAX
		JMP	(KARATEMD2INSEL,X)
;
;
KARATE_KOGK	EQU	$
		LDX	<ENINDX
		LDA	<ENWRK2,X
		BEQ	KARATE_WAIT0100		; initial ? [no->KARATE_WAIT0100]
;
		LDA	<RANDM0
		AND	#0000FH
		ASL	A
		TAY
		LDA	KOGEKI_PTN,Y
		STA	!ENWRK4,X
		TAX
		JMP	(KARATEMD2INSEL,X)
;
;
KARATE_KBWR	EQU	$
		LDX	<ENINDX
		LDA	<ENWRK2,X
		BEQ	KARATE_WAIT0100		; initial ? [no->KARATE_WAIT0100]
;
		LDA	<RANDM0
		AND	#0000FH
		ASL	A
		TAY
		LDA	KABEWARI_PTN,Y
		STA	!ENWRK4,X
		TAX
		JMP	(KARATEMD2INSEL,X)
;
;
KARATE_FRONTPT	EQU	$
		BYTE	karate00, karate1F, karate1E, karate1D
;
KARATE_FRONTTM	EQU	$
KARATE_BACKTM	EQU	$
		HEX	20, 02, 02, 02
;
KARATE_FRNT2TM	EQU	$
		HEX	08, 02, 02, 02
;
KARATE_FRCHKBIT EQU	$
		WORD	0000000000001000B, 0000000000000100B
;
KARATE_FRXSPD0	EQU	$
		WORD	-00004H,  00004H
;
KARATE_FRXSPD1	EQU	$
		WORD	-00002H,  00002H
;
KARATE_FRONTIN	EQU	$
		LDX	<ENINDX
		LDA	!ENWRKC,X
		STA	<EWORK
		LDA	#karate_frontpt
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	KARATE_FRONTPT,Y
		STA	!ENCHPT,X
		LDA	(<EWORK),Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		LDY	!ENMUKI,X
		LDA	!ENCBFG,X
		AND	KARATE_FRCHKBIT,Y
		BNE	KRT_FRIN0040		; [->KRT_FRIN0040]
;
		LDA	!ENXPSL,X
		CLC
		ADC	KARATE_FRXSPD0,Y
		STA	!ENXPSL,X
KRT_FRIN0040	EQU	$
		STZ	<ENWRK2,X
		RTS
;
;
KARATE_FRONT	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	KRT_FR00F0		; pattern change ? [no->KRT_FR00F0]
;
		DEC	<ENWRK0,X
		BMI	KRT_FR0100		; 前進モード終わり ? [yes->KRT_FR0100]
;
		LDA	!ENWRKC,X
		STA	<EWORK
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KARATE_FRONTPT,Y
		STA	!ENCHPT,X
		LDA	(<EWORK),Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#krt_frgop
		BNE	KRT_FR00F0		; [->KRT_FR00F0]
;
		LDY	!ENMUKI,X
		LDA	!ENCBFG,X
		AND	KARATE_FRCHKBIT,Y
		BNE	KRT_FR00F0		; [->KRT_FR00F0]
;
		LDA	!ENXPSL,X
		CLC
		ADC	KARATE_FRXSPD1,Y
		STA	!ENXPSL,X
KRT_FR00F0	EQU	$
		RTS
;
KRT_FR0100	EQU	$
		INC	<ENWRK2,X
		RTS
;
;
KARATE_BACKPT	EQU	$
		BYTE	karate00, karate1D, karate1E, karate1F
;
KARATE_BKXSPD0	EQU	$
		WORD	 00002H, -00002H
;
KARATE_BKXSPD1	EQU	$
		WORD	 00004H, -00004H
;
KARATE_BKCHKBIT EQU	$
		WORD	0000000000000100B, 0000000000001000B
;
KARATE_BACKIN	EQU	$
		LDX	<ENINDX
		LDA	#karate_backpt
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	KARATE_BACKPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_BACKTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		STZ	<ENWRK2,X
		RTS
;
;
KARATE_BACK	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	KRT_BK00F0		; pattern change ? [no->KRT_BK00F0]
;
		DEC	<ENWRK0,X
		BMI	KRT_BK0100		; 後進モード終わり ? [yes->KRT_BK0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KARATE_BACKPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_BACKTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#krt_bkgop0
		BNE	KRT_BK0080		; [->KRT_BK0080]
;
		LDY	!ENMUKI,X
		LDA	!ENCBFG,X
		AND	KARATE_BKCHKBIT,Y
		BNE	KRT_BK00F0		; [->KRT_BK00F0]
;
		LDA	!ENXPSL,X
		CLC
		ADC	KARATE_BKXSPD0,Y
		STA	!ENXPSL,X
		BRA	KRT_BK00F0
;
KRT_BK0080	EQU	$
		CPY	#krt_bkgop1
		BNE	KRT_BK00F0		; [->KRT_BK00F0]
;
		LDY	!ENMUKI,X
		LDA	!ENCBFG,X
		AND	KARATE_BKCHKBIT,Y
		BNE	KRT_BK00F0		; [->KRT_BK00F0]
;
		LDA	!ENXPSL,X
		CLC
		ADC	KARATE_BKXSPD1,Y
		STA	!ENXPSL,X
KRT_BK00F0	EQU	$
		RTS
;
KRT_BK0100	EQU	$
		INC	<ENWRK2,X
		RTS
;
;
KARATE_TUKIPT	EQU	$
		BYTE	karate01, karate02, karate03, karate02
		BYTE	karate01, karate00
;
KARATE_TUKITM	EQU	$
		HEX	02, 01, 08, 01, 02, 08
;
KRT_TUKIINTPT	EQU	$
		WORD	-2, -1
;
KARATE_TUKIIN	EQU	$
		LDX	<ENINDX
		JSR	KRT_SHOTENCRCK		; ショット敵＆プレイヤー衝突チェック !!
;
		LDA	#karate_tukipt
		STA	<ENWRK0,X
		LDY	!ENWRK8,X		; ショット敵情報
		BMI	KARATE_TUKIIN04		; ショット敵が存在する ? [no->KARATE_TUKIIN04]
;
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		ABS16
		LSR	A
		LSR	A
		LSR	A
		CMP	#0002
		BCS	KARATE_TUKIIN04		; [->KARATE_TUKIIN04]
;
		ASL	A
		TAY
		LDA	<ENWRK0,X
		CLC
		ADC	KRT_TUKIINTPT,Y
		STA	<ENWRK0,X
KARATE_TUKIIN04 EQU	$
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KARATE_TUKIPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_TUKITM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		LDA	#karate_kiai
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		STZ	<ENWRK2,X
		RTS
;
;
KARATE_TUKI	EQU	$
		LDX	<ENINDX
		JSR	KRT_SHOTENCRCK		; ショット敵＆プレイヤー衝突チェック !!
;
		LDA	!ENTIM0,X
		BNE	KARATE_TUKI00F0		; pattern change ? [no->KARATE_TUKI00F0]
;
		DEC	<ENWRK0,X
		BMI	KARATE_TUKI0100		; [->KARATE_TUKI0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KARATE_TUKIPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_TUKITM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#krt_tukidestroy
		BNE	KARATE_TUKI00F0		; BG CHANGE ? [no->KARATE_TUKI00F0]
;
		JSR	KRT_BGDESTROY
;
KARATE_TUKI00F0 EQU	$
		RTS
;
KARATE_TUKI0100 EQU	$
		LDA	#karate00
		STA	!ENCHPT,X
		INC	<ENWRK2,X
		RTS
;
;
KARATE_KERIPT	EQU	$
		BYTE	karate04, karate05, karate06, karate07
		BYTE	karate08, karate09, karate08, karate07
		BYTE	karate06, karate05, karate04, karate00
;
KARATE_KERITM	EQU	$
		HEX	02, 02, 02, 02, 01, 01, 01, 02
		HEX	02, 02, 02, 08
;
KRT_KERIINTPT	EQU	$
		WORD	-3, -2, -1
;
KARATE_KERIIN	EQU	$
		LDX	<ENINDX
		JSR	KRT_SHOTENCRCK		; ショット敵＆プレイヤー衝突チェック !!
;
		LDA	#karate_keript
		STA	<ENWRK0,X
		LDY	!ENWRK8,X		; ショット敵情報
		BMI	KARATE_KERIIN04		; ショット敵が存在する ? [no->KARATE_KERIIN04]
;
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		ABS16
		LSR	A
		LSR	A
		LSR	A
		LSR	A
		CMP	#0003
		BCS	KARATE_KERIIN04		; [->KARATE_KERIIN04]
;
		ASL	A
		TAY
		LDA	<ENWRK0,X
		CLC
		ADC	KRT_KERIINTPT,Y
		STA	<ENWRK0,X
KARATE_KERIIN04 EQU	$
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KARATE_KERIPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_KERITM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		LDA	#karate_kiai
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		STZ	<ENWRK2,X
		RTS
;
;
KARATE_KERI	EQU	$
		LDX	<ENINDX
		JSR	KRT_SHOTENCRCK		; ショット敵＆プレイヤー衝突チェック !!
;
		LDA	!ENTIM0,X
		BNE	KARATE_KERI00F0		; pattern change ? [no->KARATE_KERI00F0]
;
		DEC	<ENWRK0,X
		BMI	KARATE_TUKI0100		; [->KARATE_TUKI0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KARATE_KERIPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_KERITM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#krt_keridestroy
		BNE	KARATE_KERI00F0		; BG CHANGE ? [no->KARATE_KERI00F0]
;
		JSR	KRT_BGDESTROY
;
KARATE_KERI00F0 EQU	$
		RTS
;
;
KARATE_MAWAPT	EQU	$
		BYTE	karate17, karate16, karate15, karate14
		BYTE	karate13, karate12, karate11, karate10
		BYTE	karate0F, karate0E, karate0D, karate0C
		BYTE	karate0B, karate0A, karate00
;
KARATE_MAWATM	EQU	$
		HEX	02, 02, 02, 02, 02, 02, 02, 02
		HEX	02, 02, 02, 02, 02, 02, 08
;
KRT_MAWAINTPT	EQU	$
		WORD	-6, -5, -4, -3, -2, -1
;
KARATE_MAWAIN	EQU	$
		LDX	<ENINDX
		JSR	KRT_SHOTENCRCK		; ショット敵＆プレイヤー衝突チェック !!
;
		LDA	#karate_mawapt
		STA	<ENWRK0,X
		LDY	!ENWRK8,X		; ショット敵情報
		BMI	KARATE_MAWAIN04		; ショット敵が存在する ? [no->KARATE_MAWAIN04]
;
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		ABS16
		LSR	A
		LSR	A
		LSR	A
		LSR	A
		CMP	#0006
		BCS	KARATE_MAWAIN04		; [->KARATE_MAWAIN04]
;
		ASL	A
		TAY
		LDA	<ENWRK0,X
		CLC
		ADC	KRT_MAWAINTPT,Y
		STA	<ENWRK0,X
KARATE_MAWAIN04 EQU	$
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KARATE_MAWAPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_MAWATM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		LDA	#karate_kiai
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		STZ	<ENWRK2,X
		RTS
;
;
KARATE_MAWA	EQU	$
		LDX	<ENINDX
		JSR	KRT_SHOTENCRCK		; ショット敵＆プレイヤー衝突チェック !!
;
		LDA	!ENTIM0,X
		BNE	KARATE_MAWA00F0		; pattern change ? [no->KARATE_MAWA00F0]
;
		DEC	<ENWRK0,X
		BMI	KARATE_MAWA0100		; [->KARATE_MAWA0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KARATE_MAWAPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_MAWATM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#krt_mawadestroy
		BNE	KARATE_MAWA00F0		; BG CHANGE ? [no->KARATE_MAWA00F0]
;
		JSR	KRT_BGDESTROY
;
KARATE_MAWA00F0 EQU	$
		RTS
;
KARATE_MAWA0100 EQU	$
		JMP	KARATE_TUKI0100
;
;
KARATE_HADOPT	EQU	$
		BYTE	karate1C, karate18, karate19, karate1A
		BYTE	karate19, karate18, karate00
;
KARATE_HADOTM	EQU	$
		HEX	12, 01, 02, 22, 02, 02, 08
;
ENERGYBALLXPSL	EQU	$
		WORD	-00010H,  00010H
;
KARATE_HADOIN	EQU	$
		LDX	<ENINDX
		LDA	#karate_hadopt
		STA	<ENWRK0,X
		STZ	!ENXSPD,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	KARATE_HADOPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_HADOTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		LDA	#karate_kiai
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		STZ	<ENWRK2,X
		RTS
;
;
HADO_TAMECOL	EQU	$
		WORD	00000H<<1, 00001H<<1, 00002H<<1, 00004H<<1
;
KARATE_HADO	EQU	$
		LDX	<ENINDX
		STZ	!ENXSPD,X
		LDA	!ENCHPT,X
		CMP	#karate1A
		BNE	KARATE_HADO0040		; カラーチェンジ ? [no->KARATE_HADO0040]
;
		LDA	<FRCNT2
		AND	#00003H
		ASL	A
		TAY
		LDA	!ENCLOR,X
		ORA	HADO_TAMECOL,Y
		STA	!ENCLOR,X
		CPY	#00
		BNE	KARATE_HADO0040		; SOUND SET ? [no->KARATE_HADO0040]
;
		LDA	#0000EH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
KARATE_HADO0040 EQU	$
		LDA	!ENTIM0,X
		BNE	KARATE_HADO00F0		; pattern change ? [no->KARATE_HADO00F0]
;
		DEC	<ENWRK0,X
		BMI	KARATE_MAWA0100		; [->KARATE_MAWA0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KARATE_HADOPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_HADOTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#krt_hadostart
		BNE	KARATE_HADO00F0		; 気弾発射 ? [no->KARATE_HADO00F0]
;
		LDY	!ENMUKI,X
		LDA	!ENXPSL,X
		CLC
		ADC	ENERGYBALLXPSL,Y
		STA	<EWORK
		LDA	#ENRGB
		JSL	>ENINSR
		BCC	KARATE_HADO00F0		; 敵エリア確保成功 ? [no->KARATE_HADO00F0]
;
		LDA	!ENMUKI,X
		STA	!ENMUKI,Y
		LDA	<EWORK
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		STA	!ENYPSL,Y
		TYX
		JSL	>ENRGBIN
;
KARATE_HADO00F0 EQU	$
		LDX	<ENINDX
		RTS
;
;
KARATE_JUMPPT	EQU	$
		BYTE	karate00, karate21, karate20, karate21
;
KARATE_JUMPTM	EQU	$
		HEX	04, 04, 00, 20
;
KARATE_JUMPIN	EQU	$
		LDX	<ENINDX
		STZ	!ENXSPD,X
		LDA	#karate_jumppt
		STA	<ENWRK0,X
		STZ	<ENWRK2,X
		RTS
;
;
KARATE_JUMP	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		BIT	#00001H
		BEQ	KARATE_JUMP00F0		; 着地 ? [no->KARATE_JUMP00F0]
;
		LDA	!ENTIM0,X
		BNE	KARATE_JUMP00F0		; pattern change ? [no->KARATE_JUMP00F0]
;
		DEC	<ENWRK0,X
		BMI	KARATE_JUMP0100		; [->KARATE_JUMP0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KARATE_JUMPPT,Y
		STA	!ENCHPT,X
		LDA	KARATE_JUMPTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#krt_jumpset
		BNE	KARATE_JUMP00F0		; ジャンプセット ? [no->KARATE_JUMP00F0]
;
		LDA	#krt_jumpspd
		STA	!ENYSPD,X
		INC	!ENWRK6,X		; ジャンプフラグセット !!
KARATE_JUMP00F0 EQU	$
		RTS
;
KARATE_JUMP0100 EQU	$
		STZ	!ENXSPD,X
		STZ	!ENWRK4,X
		INC	<ENWRK2,X
		RTS
;
;
KRT_XSPD2	EQU	$
		WORD	0FFE0H, 00020H
;
KRTPLSEARCH	EQU	$
		STZ	<ENCONT,X
		STZ	!ENXSPD,X
		LDA	#karateman_area
		STA	<EWORK
		STA	<EWORK4
		ASL	A
		STA	<EWORK2
		STA	<EWORK6
		JSL	>PL_SEARCH
		BCS	KRTPLSEARCH00F0		; 範囲内 [no->KRTPLSEARCH00F0]
;
		LDA	#karate_zensn
		STA	<ENCONT,X
;
		LDA	#karateman_area1
		STA	<EWORK
		ASL	A
		STA	<EWORK2
		LDA	#karateman_area2
		STA	<EWORK4
		ASL	A
		STA	<EWORK6
		JSL	>PL_SEARCH
		BCS	KRTPLSEARCH00F0		; 範囲内 [no->KRTPLSEARCH00F0]
;
		LDY	!ENMUKI,X
		LDA	KRT_XSPD2,Y
		STA	!ENXSPD,X
		LDA	#karateman_area4
		STA	<EWORK
		ASL	A
		STA	<EWORK2
		LDA	#karateman_area2
		STA	<EWORK4
		ASL	A
		STA	<EWORK6
		JSL	>PL_SEARCH
		BCS	KRTPLSEARCH0040		; 範囲内 [no->KRTPLSEARCH0040]
;
		STZ	!ENXSPD,X
KRTPLSEARCH0040 EQU	$
		LDA	#karate_kogek
		STA	<ENCONT,X
;
		LDA	!ENWRK4,X
		CMP	#karate_frnt
		BEQ	KRTPLSEARCH0080		; 前進中 ? [yes->KRTPLSEARCH0080]
;
		CMP	#karate_back
		BNE	KRTPLSEARCH00F0		; 後進中 ? [no->KRTPLSEARCH00F0]
;
KRTPLSEARCH0080 EQU	$
		INC	<ENWRK2,X
KRTPLSEARCH00F0 EQU	$
		RTS
;
;
KRT_YOKOCKBIT	EQU	$
		WORD	0000000000001000B, 0000000000000100B
;
KRT_CHKXPNT	EQU	$
		WORD	-00014H,  00014H
;
KRT_BGCHECK	EQU	$
		LDY	!ENMUKI,X
		LDA	!ECENTX,X
		CLC
		ADC	KRT_CHKXPNT,Y
		STA	<EWORK
		STA	R8			; チェック座標 X !!
		LDA	!ECENTY,X
		STA	R0			; チェック座標 Y !!
		M_CHIPR M_BGUNIT_READ
;
		LDX	<ENINDX
		LDA	R7
		AND	#1111100000000000B
		CMP	#ET
		BEQ	KRT_BGCHECK0080		; 壊れるBG ? [yes->KRT_BGCHECK0080]
;
		LDA	<EWORK
		STA	R8			; チェック座標 X !!
		LDA	!ECENTY,X
		SEC
		SBC	#00008H
		STA	R0			; チェック座標 Y !!
		M_CHIPR M_BGUNIT_READ
;
		LDX	<ENINDX
		LDA	R7
		AND	#1111100000000000B
		CMP	#ET
		BNE	KRT_BGCHECK0100		; 壊れるBG ? [no->KRT_BGCHECK0100]
;
KRT_BGCHECK0080 EQU	$
		LDA	#karate_kabew
		STA	<ENCONT,X
		LDA	!ENWRK4,X
		CMP	#karate_frnt
		BEQ	KRT_BGCHECK00A0		; 前進中 ? [yes->KRT_BGCHECK00A0]
;
		CMP	#karate_back
		BNE	KRT_BGCHECK00F0		; 後進中 ? [no->KRT_BGCHECK00F0]
;
KRT_BGCHECK00A0 EQU	$
		INC	<ENWRK2,X
KRT_BGCHECK00F0 EQU	$
		RTS
;
KRT_BGCHECK0100 EQU	$
		LDA	!ENWRK4,X
		CMP	#karate_jump
		BEQ	KRT_BGCHECK01F0		; jump mode ? [yes->KRT_BGCHECK01F0]
;
		LDY	!ENMUKI,X
		LDA	!ENCBFG,X
		AND	KRT_YOKOCKBIT,Y
		BEQ	KRT_BGCHECK01F0		; 前当たり ? [no->KRT_BGCHECK01F0]
;
		LDA	#karate_jump
		STA	!ENWRK4,X
		JSR	KARATE_JUMPIN
;
KRT_BGCHECK01F0 EQU	$
		RTS
;
;
KRT_SHOTENSH	EQU	$
		LDY	!ENWRK8,X
		BMI	KRT_STENCH00F0		; ショット敵が存在する ? [no->KRT_STENCH00F0]
;
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		STA	<EWORK
		CLC
		ADC	#karateman_area3
		CMP	#karateman_area3*2
		BCS	KRT_STENCH00F0		; 横範囲内 ? [no->KRT_STENCH00F0]
;
		LDA	<EWORK
		ABS16
		ASL	A
		STA	<EWORK
		ASL	A
		STA	<EWORK2
		LDA	!ECENTY,X
		SEC
		SBC	!ECENTY,Y
		CLC
		ADC	<EWORK
		CMP	<EWORK2
		BCS	KRT_STENCH00F0		; 縦範囲内 ? [no->KRT_STENCH00F0]
;
		LDA	#karate_kabew
		STA	<ENCONT,X
		LDA	!ENWRK4,X
		CMP	#karate_frnt
		BEQ	KRT_STENCH0080		; 前進中 ? [yes->KRT_STENCH0080]
;
		CMP	#karate_back
		BNE	KRT_STENCH00F0		; 後進中 ? [no->KRT_STENCH00F0]
;
KRT_STENCH0080	EQU	$
		INC	<ENWRK2,X
KRT_STENCH00F0	EQU	$
		RTS
;
;
KRT_HITMARKXPS	EQU	$
		WORD	0FFF0H, 00010H
;
KRT_SHOTENCRCK	EQU	$
		LDA	!ENMUKI,X
		DEC	A
		STA	<EWORK
		LDY	!ECRSFG,X
		BMI	KRT_STCRCK0040		; プレイヤー衝突してる ? [yes->KRT_STCRCK0040]
;
		DEY
		BEQ	KRT_STCRCK0040		; 赤ちゃん衝突 ? [yes->KRT_STCRCK0040]
		BMI	KRT_STCRCK0040		; 敵衝突 ? [no->KRT_STCRCK0040]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	KRT_STCRCK0040		; mode move ? [no->KRT_STCRCK0040]
;
		LDA	!ENSHOT,Y
		BEQ	KRT_STCRCK0040		; shot ? [no->KRT_STCRCK0040]
;
		LDA	!ENMUKI,X
		DEC	A
		STA	<EWORK2
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		EOR	<EWORK2
		BMI	KRT_STCRCK0040		; 前に当たった ? [yes->KRT_STCRCK0040]
		JMP	KRT_STCRCK00F0
;
KRT_STCRCK0040	EQU	$
		LDY	!ENWRK8,X
		BMI	KRT_STCRCK00F0		; ショット敵が存在する ? [no->KRT_STCRCK00F0]
;
		LDA	!EWIDEY,X
		CLC
		ADC	#krt_tatearea
		CLC
		ADC	!EWIDEY,Y
		STA	<EWORK4
		ASL	A
		STA	<EWORK2
		LDA	!ECENTY,X
		SEC
		SBC	!ECENTY,Y
		CLC
		ADC	<EWORK4
		CMP	<EWORK2
		BCS	KRT_STCRCK00F0		; 縦範囲内 [no->KRT_STCRCK00F0]
;
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		STA	<EWORK2
		EOR	<EWORK
		BPL	KRT_STCRCK00F0		; 後ろ ? [yes->KRT_STCRCK00F0]
;
		LDA	!EWIDEX,X
		CLC
		ADC	#krt_yokoarea
		CLC
		ADC	!EWIDEX,Y
		STA	<EWORK4
		LDA	<EWORK2
		ABS16
		CMP	<EWORK4
		BCS	KRT_STCRCK00F0		; 横範囲内 [no->KRT_STCRCK00F0]
;
		LDA	!ENMYNO,Y
		CMP	#EGG00
		BCC	KRT_STCRCK0090		; 卵 ? [no->KRT_STCRCK0090]
;
		CMP	#EGG09+1
		BCS	KRT_STCRCK0090		; 卵 ? [no->KRT_STCRCK0090]
;
		LDA	!ENXPSL,Y
		STA	WORK0
		LDA	!ENYPSL,Y
		STA	WORK2
		LDA	!ENCLOR,Y
		AND	#0003EH
		STA	!WORK4
		PHY
		JSL	>EGG_WARE_SET
;
		PLX
		JSL	>ENCLEAR_NORETN		; ショット敵やっつけ !!
;
		BRA	KRT_STCRCK00A0
;
KRT_STCRCK0090	EQU	$
		TYX
		JSL	>SHOT_EN_KILL		; ショット敵やっつけ !!
;
KRT_STCRCK00A0	EQU	$
		INC	!ENWRKA,X		; 敵衝突情報セット !!
		LDX	<ENINDX
KRT_STCRCK00F0	EQU	$
		LDA	!EWIDEY,X
		CLC
		ADC	!PWIDEY
		STA	<EWORK2
		ASL	A
		STA	<EWORK4
		LDA	!ECENTY,X
		SEC
		SBC	!PCENTY
		CLC
		ADC	<EWORK2
		CMP	!EWORK4
		BCS	KRT_STCRCK01F0		; 縦範囲内 ? [no->KRT_STCRCK01F0]
;
		LDA	!ECENTX,X
		SEC
		SBC	!PCENTX
		STA	<EWORK2
		EOR	<EWORK
		BPL	KRT_STCRCK01F0		; 後ろ ? [yes->KRT_STCRCK01F0]
;
		LDA	!EWIDEX,X
		CLC
		ADC	#krt_yokoarea
		CLC
		ADC	!PWIDEX
		STA	<EWORK4
		LDA	<EWORK2
		ABS16
		CMP	<EWORK4
		BCS	KRT_STCRCK01F0		; 横範囲内 [no->KRT_STCRCK01F0]
;
		LDA	!PLFLSH
		BNE	KRT_STCRCK0180		; [->KRT_STCRCK0180]
;
		LDY	!ENMUKI,X
		LDA	!ECENTX,X
		CLC
		ADC	KRT_HITMARKXPS,Y
		STA	<EWORK
		LDA	!ECENTY,X
		STA	<EWORK2
		JSR	KAKIN_SET		; ヒットマークセット
;
KRT_STCRCK0180	EQU	$
		JSL	>PLFLST
;
KRT_STCRCK01F0	EQU	$
		RTS
;
;
KRT_BGDESTROY	EQU	$
		LDY	!ENMUKI,X
		LDA	!ECENTX,X
		CLC
		ADC	KRT_CHKXPNT,Y
		STA	<EWORK
		STA	R8			; チェック座標 X !!
		LDA	!ECENTY,X
		STA	<EWORK2
		STA	R0			; チェック座標 Y !!
		M_CHIPR M_BGUNIT_READ
;
		LDX	<ENINDX
		LDA	R7
		AND	#1111100000000000B
		CMP	#ET
		BNE	KRT_BGDST0080		; 壊れるBG ? [no->KRT_BGDST0080]
;
		JSR	KRT_BGUNITCHG
;
KRT_BGDST0080	EQU	$
		LDA	<EWORK
		STA	R8			; チェック座標 X !!
		LDA	!ECENTY,X
		SEC
		SBC	#00008H
		STA	<EWORK2
		STA	R0			; チェック座標 Y !!
		M_CHIPR M_BGUNIT_READ
;
		LDX	<ENINDX
		LDA	R7
		AND	#1111100000000000B
		CMP	#ET
		BNE	KRT_BGDST00F0		; 壊れるBG ? [no->KRT_BGDST00F0]
;
		JSR	KRT_BGUNITCHG
;
KRT_BGDST00F0	EQU	$
		RTS
;
;
KRT_BGUNITCHG	EQU	$
		LDA	#BLK0
		STA	!BGCGNO
		LDA	<EWORK
		STA	!BGXPS1
		LDA	<EWORK2
		STA	!BGYPS1
		JSL	>UNITCHG
;
		LDX	<ENINDX
		LDA	#BRBG0
		JSL	>EXINSR
;
		LDA	<EWORK
		AND	#0FFF0H
		STA	!EXXPSL,Y
		LDA	<EWORK2
		AND	#0FFF0H
		STA	!EXYPSL,Y
		LDA	#0000AH
		STA	!EXCHPT,Y
		LDA	#00002H
		STA	!EXTIM0,Y
;
		LDA	#0000AH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		RTS
;
;
KRT_CRSCHK	EQU	$
		LDA	!ENWRKA,X		; 敵衝突情報読み込み !!
		BNE	KRT_CRSCHK00F0		; 既に敵は死亡している	? [yes->KRT_CRSCHK00F0]
;
		LDY	!ECRSFG,X
		BMI	KRT_CRSCHK0100		; プレイヤーと衝突した？ [yes->KRT_CRSCHK0100]
;
		DEY
		BMI	KRT_CRSCHK00F0		; 衝突した ? [no->KRT_CRSCHK00F0]
		BEQ	KRT_CRSCHK00F0		; 赤ちゃん ? [yes->KRT_CRSCHK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	KRT_CRSCHK00F0		; mode move ? [no->KRT_CRSCHK00F0]
;
		LDA	!ENSHOT,Y
		BEQ	KRT_CRSCHK00F0		; ショット ? [no->KRT_CRSCHK00F0]
;
		LDA	!ENXSPD,Y
		ASR16
		ASR16
		STA	!ENXSPD,X
		TYX
		JSL	>SHOT_EN_KILL		; ショット敵やっつけ !!
;
		LDX	<ENINDX
KRT_CRSCHK0080	EQU	$
		LDA	#EFAIL
		STA	!ENMODE,X
		LDA	#karate_failptn
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	KRTFAILPTN,Y
		STA	!ENCHPT,X
		LDA	KRTFAILTIM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
KRT_CRSCHK00F0	EQU	$
		RTL
;
KRT_CRSCHK0100	EQU	$
		JSL	>EPFOOTCROSS_01
		BCC	KRT_CRSCHK0180		; 踏まれてない？ [yes->KRT_CRSCHK0180]
;
KRT_CRSCHK0140	EQU	$
		JSL	>PLAYER_REBOUND
;
		LDA	#0001CH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		BRA	KRT_CRSCHK0080
;
KRT_CRSCHK0180	EQU	$
		BEQ	KRT_CRSCHK01F0		; 当たり無し？ [yes->KRT_CRSCHK01F0]
;
		JSL	>PLFLST
;
KRT_CRSCHK01F0	EQU	$
		RTL
;
;
KARATSLIPPOW	EQU	$
		HEX	01, 20
;
KARATSLIP	EQU	$
		LDY	#00
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	KARATSLIP0040		; 空中 ? [yes->KARATSLIP0040]
;
		INY
KARATSLIP0040	EQU	$
		LDA	KARATSLIPPOW,Y
		AND	#000FFH
		STA	!ENXPOW,X
;
		LDA	!ENXSPD,X
		BEQ	KARATSLIP0070		; スリップエンド ? [yes->KARATSLIP0070]
;
		LDA	!ENMUKI,X
		DEC	A
		EOR	!ENXSPD,X
		BMI	KARATSLIP0080		; スリップエンド ? [no->KARATSLIP0080]
;
KARATSLIP0070	EQU	$
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
KARATSLIP0080	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	fail (空手家)							-
;------------------------------------------------------------------------
KRTFAILPTN	EQU	$
		BYTE	karate2A, karate2B, karate2A, karate2B
		BYTE	karate2A, karate2B, karate2A, karate2A
		BYTE	karate29, karate28, karate27, karate26
		BYTE	karate25, karate24, karate23, karate22
		BYTE	karate00
;
KRTFAILTIM	EQU	$
		HEX	20, 02, 02, 02, 02, 02, 02, 22
		HEX	02, 02, 80, 02, 04, 02, 02, 04
		HEX	02
;
KARATFL		EQU	$
		LDA	!ENCLOR,X
		AND	#0FFF1H
		STA	!ENCLOR,X		; カラーセット !!
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	KARATFL0040		; 着地 ? [no->KARATFL0040]
;
		STZ	!ENXSPD,X
KARATFL0040	EQU	$
		LDA	!ENTIM0,X
		BNE	KARATFL00F0		; pattern change ? [no->KARATFL00F0]
;
		DEC	<ENWRK0,X
		BMI	KARATFL0100		; fail end ? [yes->KARATFL0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	KRTFAILPTN,Y
		STA	!ENCHPT,X
		LDA	KRTFAILTIM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#karate_fljmppnt
		BNE	KARATFL00F0		; ジャンプポイント ? [no->KARATFL00F0]
;
		LDA	#karate_failjump
		STA	!ENYSPD,X
KARATFL00F0	EQU	$
		JSL	>PLCRSCK
		BCS	KARATFL00F8		; 踏まれた？ [yes->KARATFL00F8]
;
		RTL
;
KARATFL00F8	EQU	$
		JMP	KRT_CRSCHK0140
;
KARATFL0100	EQU	$
		LDA	#EMOVE
		STA	!ENMODE,X
		JMP	>KARATIN
;
;
;------------------------------------------------------------------------
;-	initial (気弾)							-
;------------------------------------------------------------------------
energyball00	EQU	000H
energyball01	EQU	001H
energyball02	EQU	002H
energyball03	EQU	003H
;
energyballpt	EQU	(ENRGBMV-ENERGYBALLPT-1)
energyballtm	EQU	01
energyballxspd	EQU	00100H
;
ENERGYBALLXSPD	EQU	$
		WORD	-energyballxspd,  energyballxspd
;
ENRGBIN		EQU	$
		LDA	#energyballpt
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	ENERGYBALLPT,Y
		STA	!ENCHPT,X
		LDA	#energyballtm
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		LDY	!ENMUKI,X
		LDA	ENERGYBALLXSPD,Y
		STA	!ENXSPD,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (気弾)							-
;------------------------------------------------------------------------
ENERGYBALLPT	EQU	$
		BYTE	energyball01, energyball02, energyball03, energyball02
		BYTE	energyball01, energyball00
;
ENRGBMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	!ENTIM0,X
		BNE	ENRGBMV0080		; pattern change ? [no->ENRGBMV0080]
;
		DEC	<ENWRK0,X
		BPL	ENRGBMV0040		; [->ENRGBMV0040]
;
		LDA	#energyballpt
		STA	<ENWRK0,X
ENRGBMV0040	EQU	$
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	ENERGYBALLPT,Y
		STA	!ENCHPT,X
		LDA	#energyballtm
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
ENRGBMV0080	EQU	$
		LDY	!ECRSFG,X
		BPL	ENRGBMV00F0		; プレイヤーと当たった ? [no->ENRGBMV00F0]
;
		LDA	#EBSMK
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		SEC
		SBC	#00004H
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00004H
		STA	!EXYPSL,Y
		LDA	#0008
		STA	!EXTIM0,Y
		LDA	#0004
		STA	!EXCHPT,Y
		STA	!EXWRK0,Y
;
		JSL	>PLFLST			; プレイヤーダメージセット !!
;
		JSL	>ENCLEAR
;
ENRGBMV00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (甲羅)							-
;------------------------------------------------------------------------
kora_kurutm	EQU	04
;
KORA0IN		EQU	$
KORA1IN		EQU	$
		LDA	#00002H
		STA	<ENWRK4,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (甲羅)							-
;------------------------------------------------------------------------
KORA_XSPD	EQU	$
		WORD	00380H, -00380H
;
KORA_BOUNDSPD	EQU	$
		WORD	0FE40H, 0FF00H
;
KORA0MV		EQU	$
KORA1MV		EQU	$
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	KORA0MV0010		; mode move ? [yes->KORA0MV0010]
;
		STZ	!ENWRK2,X
		BRA	KORA0MV0020
;
KORA0MV0010	EQU	$
		LDA	!ENSHOT,X
		BNE	KORA0MV0024		; ショット ? [yes->KORA0MV0024]
;
;[1994.10.13.TH]		BEQ	KORA0MV0020		; ショット ? [no->KORA0MV0020]
;[1994.10.13.TH];
;[1994.10.13.TH]		STZ	!ENSHOT,X
;[1994.10.13.TH]		STZ	<ENWRK2,X		; Bound フラグクリア !!
KORA0MV0020	EQU	$
		JSL	>ENMDCK			; mode check
;
		BRA	KORA0MV0026
;
KORA0MV0024	EQU	$
		LDA	!ENSTFG
		BEQ	KORA0MV0025		; POUSE ? [no->KORA0MV0025]
;
		RTL
;
KORA0MV0025	EQU	$
		LDA	!ENSHOT,X
		CMP	#02
		BCC	KORA0MV0025_2		; [->KORA0MV0025_2]
;
		DEC	!ENSHOT,X
KORA0MV0025_2	EQU	$
		JSR	KORA_BGCRCK		; 壊れるＢＧチェック !!
;
KORA0MV0026	EQU	$
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	KORA0MV0028		; 空中 ? [yes->KORA0MV0028]
;
		LDA	!ENWRK4,X
		CMP	#00002H
		BCS	KORA0MV0030		; 着地中フラグ MAX ? [yes->KORA0MV0030]
;
		INC	A
		STA	!ENWRK4,X		; 着地中フラグ 加算 !!
		BRA	KORA0MV0030
;
KORA0MV0028	EQU	$
		STZ	!ENWRK4,X		; 着地中フラグクリア !!
KORA0MV0030	EQU	$
		LDA	!ENWRK4,X
		CMP	#00001H
		BNE	KORA0MV0038		; 着地の瞬間 ? [no->KORA0MV0038]
;
		LDA	#0001DH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	<ENWRK2,X
		CMP	#00002H
		BCS	KORA0MV0038		; Bound ? [no->KORA0MV0038]
;
		LDA	<ENWRK2,X
		ASL	A
		TAY
		LDA	KORA_BOUNDSPD,Y
		STA	!ENYSPD,X
		INC	<ENWRK2,X
KORA0MV0038	EQU	$
		LDA	!ENXSPD,X
		BNE	KORA0MV0100		; X スピード ON ? [yes->KORA0MV0100]
;
		LDY	!ECRSFG,X
		BMI	KORA0MV0040		; プレイヤーと衝突 ? [yes->KORA0MV0040]
;
		JMP	KORA0MV0200		; プレイヤーと衝突 ? [no->KORA0MV0200]
;
KORA0MV0040	EQU	$
		JSL	>EPFOOTCROSS_01		; 踏まれたチェック !!
		BCC	KORA0MV0080		; 踏まれた ? [no->KORA0MV0080]
;
		JSL	>PLAYER_REBOUND
;
		LDA	#0001CH
		BRA	KORA0MV0090
;
KORA0MV0080	EQU	$
		LDA	#0000BH
KORA0MV0090	EQU	$
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	#0032
		STA	!PLFLSH
;
		LDA	!PLXSPD
		ABS16
		STA	<EWORK
		CMP	#00300H
		BMI	KORA0MV00C0		; [->KORA0MV00C0]
;
		LDA	<EWORK
		CLC
		ADC	#00080H
		BRA	KORA0MV00D0
;
KORA0MV00C0	EQU	$
		LDA	#00380H
KORA0MV00D0	EQU	$
		STA	<EWORK
		EOR	#0FFFFH
		INC	A
		STA	<EWORK2
		LDA	!ECENTX,X
		SEC
		SBC	!PCENTX
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAY
		LDA	!EWORK,Y
		STA	!ENXSPD,X
		LDA	#kora_kurutm
		STA	!ENTIM0,X
		LDA	#0001
		STA	!ENSHOT,X
KORA0MV00F0	EQU	$
		RTL
;
KORA0MV0100	EQU	$
		LDA	!ENCBFG,X
		AND	#0000000000001110B
		BEQ	KORA0MV0120		; sound on ? [no->KORA0MV0120]
;
		LDA	#0001CH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
KORA0MV0120	EQU	$
		LDA	!ENTIM0,X
		BNE	KORA0MV01F0		; pattern change ? [no->KORA0MV01F0]
;
		LDA	!ENCHPT,X
		INC	A
		AND	#00003H
		STA	!ENCHPT,X
		LDA	#kora_kurutm
		STA	!ENTIM0,X
KORA0MV01F0	EQU	$
		JSR	KORA_CRCK		; 衝突チェック !!
;
		RTL
;
KORA0MV0200	EQU	$
		LDA	!ENTIM1,X
		BNE	KORA0MV02F0		; 衝突チェック ? [no->KORA0MV02F0]
;
		LDA	!ENCBFG,X
		AND	#0000000000000001B
		BNE	KORA0MV02E0		; 空中 ? [no->KORA0MV02E0]
;
		JSR	KORA_CRCK		; 衝突チェック !!
;
		RTL
;
KORA0MV02E0	EQU	$
		STZ	!ENSHOT,X
		JSR	KORA_CRC2
;
KORA0MV02F0	EQU	$
		RTL
;
;
KORA_SOUND	EQU	$
		HEX	0C, 0D, 0E, 0F, 10, 11, 12, 12
;
KORA_DEATH_XSPD EQU	$
		WORD	00200H, -00200H
;
KORA_CRCK	EQU	$
		LDY	!ECRSFG,X
		BPL	KORA_CRCK0100		; プレイヤーと衝突 ? [no->KORA_CRCK0100]
;
		JSL	>EPFOOTCROSS_01		; 踏まれたチェック !!
		BCC	KORA_CRCK0080		; 踏まれた ? [no->KORA_CRCK0080]
;
		LDA	#0001CH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		STZ	!ENXSPD,X
		JSL	>PLAYER_REBOUND
;
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	KORA_CRCK0060		; 空中 ? [yes->KORA_CRCK0060]
;
		STZ	!ENSHOT,X
KORA_CRCK0060	EQU	$
		RTS
;
KORA_CRCK0080	EQU	$
		BEQ	KORA_CRCK00F0		; プレイヤー上昇中 ? [yes->KORA_CRCK00F0]
;
		JSL	>PLFLST
;
KORA_CRCK00F0	EQU	$
		RTS
;
KORA_CRCK0100	EQU	$
		DEY
		BMI	KORA_CRCK01F0		; 衝突無し ? [yes->KORA_CRCK01F0]
		BEQ	KORA_CRCK01F0		; 赤ちゃん ? [yes->KORA_CRCK01F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	KORA_CRCK01F0		; mode move ? [no->KORA_CRCK01F0]
;
		LDA	!ENMYNO,Y
		CMP	#EGG00
		BCC	KORA_CRCK0108		; 卵？ [no->KORA_CRCK0108]
;
		CMP	#EGG09+1
		BCC	KORA_CRCK010A		; 卵？ [yes->KORA_CRCK010A]
;
KORA_CRCK0108	EQU	$
		CMP	#SUIKT
		BNE	KORA_CRCK0110		; 西瓜の種？ [no->KORA_CRCK0110]
;
KORA_CRCK010A	EQU	$
		LDA	!ENSHOT,Y
		BNE	KORA_CRCK0148		; ショット？ [yes->KORA_CRCK0148]
;
KORA_CRCK0110	EQU	$
		LDA	!ENMOD1,Y
		BIT	#0110000000000000B
		BNE	KORA_CRCK01F0		; 敵 ? [no->KORA_CRCK01F0]
;
		LDA	!ENMYNO,Y
		CMP	#KORA0
		BCC	KORA_CRCK0140		; 亀類 ? [no->KORA_CRCK0140]
;
KORA_CRCK0120	EQU	$
		CMP	#PTPT2+1
		BCC	KORA_CRCK0200		; 亀類 ? [yes->KORA_CRCK0200]
;
KORA_CRCK0140	EQU	$
		LDA	!ENSHOT,Y
		BEQ	KORA_CRCK0160		; ショット？ [no->KORA_CRCK0160]
;
KORA_CRCK0148	EQU	$
		JMP	KORA_CRCK0300
;
KORA_CRCK0160	EQU	$
		LDA	!ENMOD0,Y
		BIT	#0000000000100000B
		BNE	KORA_CRCK01F0		; 投げた敵に当たる？ [no->KORA_CRCK01F0]
;
KORA_CRCK0180	EQU	$
		LDA	!ENWRK6,X
		INC	A
		CMP	#0009
		BCS	KORA_CRCK01A0		; [->KORA_CRCK01A0]
;
		STA	!ENWRK6,X
KORA_CRCK01A0	EQU	$
		CMP	#0008
		BCC	KORA_CRCK01B0		; １ｕｐ ? [no->KORA_CRCK01B0]
;
		PHX
		PHY
		TYX
		JSL	>PL_1UP_SET_P
;
		PLY
		PLX
;[1995.03.01.WE]		LDA	!ENMOD2,Y
;[1995.03.01.WE]		ORA	#0000011000000000B
;[1995.03.01.WE]		STA	!ENMOD2,Y		; １ｕｐ ＳＥＴ !!
KORA_CRCK01B0	EQU	$
		TYX
		JSL	>DEATHENEMY
;
		JSL	>ENCLEAR_NORETN		; 死亡セット !!
;
		LDX	<ENINDX
KORA_CRCK01C0	EQU	$
		LDY	!ENWRK6,X
		DEY
		CPY	#0007
		BCS	KORA_CRCK01F0		; [->KORA_CRCK01F0]
;
		LDA	KORA_SOUND,Y
		AND	#000FFH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
KORA_CRCK01F0	EQU	$
		RTS
;
KORA_CRCK0200	EQU	$
		CMP	#KORA1+1
		BCS	KORA_CRCK0240		; 甲羅 ? [no->KORA_CRCK0240]
;
		LDA	!ENSHOT,Y
		BEQ	KORA_CRCK0240		; 甲羅動いてる ? [no->KORA_CRCK0240]
;
		PHY
		JSL	>ENDEATH_SET_2		; 自分死亡セット !!
;
		M8				; memory 8bit mode !!
;
		LDA	#0FFH
		STA	!ENRETN,X
;
		LDA	!ECROSX+1,X
		AND	#080H
		ASL	A
		ROL	A
		ASL	A
		EOR	#002H
		TAY
;
		M16				; memory 16bit mode !!
;
		LDA	KORA_DEATH_XSPD,Y
		STA	!ENXSPD,X
		LDA	#EFAIL
		STA	!ENMODE,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#00400H
		STA	!ENGMAX,X
		LDA	#0FC00H
		STA	!ENYSPD,X
;
		PLY
KORA_CRCK0240	EQU	$
		LDA	!ENWRK6,X
		INC	A
		CMP	#0009
		BCS	KORA_CRCK0260		; [->KORA_CRCK0260]
;
		STA	!ENWRK6,X
KORA_CRCK0260	EQU	$
		CMP	#0008
		BCC	KORA_CRCK0270		; １ｕｐ ? [no->KORA_CRCK0270]
;
		PHX
		PHY
		TYX
		JSL	>PL_1UP_SET_P
;
		PLY
		PLX
;[1995.03.01.WE]		LDA	!ENMOD2,Y
;[1995.03.01.WE]		ORA	#0000011000000000B
;[1995.03.01.WE]		STA	!ENMOD2,Y		; １ｕｐ ＳＥＴ !!
KORA_CRCK0270	EQU	$
		PHY
		TYX
		JSL	>DEATHENEMY
;
		JSL	>ENDEATH_SET
;
		PLY
		LDX	<ENINDX
;
		M8				; memory 8bit mode !!
;
		LDA	!ECROSX+1,X
		AND	#080H
		ASL	A
		ROL	A
		ASL	A
		TAX
;
		M16				; memory 16bit mode !!
;
		LDA	KORA_DEATH_XSPD,X
		STA	!ENXSPD,Y
		LDA	#EFAIL
		STA	!ENMODE,Y
		LDA	#00040H
		STA	!ENGPOW,Y
		LDA	#00400H
		STA	!ENGMAX,Y
		LDA	#0FC00H
		STA	!ENYSPD,Y
		LDA	#00001
		STA	!ENWRKA,Y		; のこのこ／パタパタ デスフラグ セット !!
		LDX	<ENINDX
		JMP	KORA_CRCK01C0
;
KORA_CRCK0300	EQU	$
		TYX
		JSL	>SHOT_EN_KILL
;
		JSL	>ENDEATH_SET_2		; 自分死亡セット !!
;
		M8				; memory 8bit mode !!
;
		LDA	#0FFH
		STA	!ENRETN,X
;
		LDA	!ECROSX+1,X
		AND	#080H
		ASL	A
		ROL	A
		ASL	A
		EOR	#002H
		TAY
;
		M16				; memory 16bit mode !!
;
		LDA	KORA_DEATH_XSPD,Y
		STA	!ENXSPD,X
		LDA	#EFAIL
		STA	!ENMODE,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#00400H
		STA	!ENGMAX,X
		LDA	#0FC00H
		STA	!ENYSPD,X
		RTS
;
;
KORA_CRC2	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	KORA_CRC200F0		; 敵衝突無し＆プレイヤー衝突 ? [yes->KORA_CRC200F0]
		BEQ	KORA_CRC200F0		; 赤ちゃん衝突 ? [yes->KORA_CRC200F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	KORA_CRC200F0		; mode move ? [no->KORA_CRC200F0]
;
		LDA	!ENSHOT,Y
		BEQ	KORA_CRC200F0		; ショット ? [no->KORA_CRC200F0]
;
		LDA	!ENMYNO,Y
		CMP	#KORA0
		BCC	KORA_CRC20040		; 甲羅 ? [no->KORA_CRC20040]
;
		CMP	#KORA1+1
		BCC	KORA_CRC200F0		; 甲羅 ? [yes->KORA_CRC200F0]
;
KORA_CRC20040	EQU	$
		STZ	<EWORK
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		BPL	KORA_CRC20060
;
		INC	<EWORK
		INC	<EWORK
KORA_CRC20060	EQU	$
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
		LDY	<EWORK
		LDA	KORA_XSPD,Y
		STA	!ENXSPD,X
		LDA	#0001
		STA	!ENSHOT,X
KORA_CRC200F0	EQU	$
		RTS
;
;
KORA_BGCRCK	EQU	$
		LDA	!ENCBFG,X
		AND	#0000000000001110B
		BEQ	KORA_CRC200F0		; [->KORA_CRC200F0]
;[1994.10.14.FR]		BEQ	KORA_BGCRCK00F0		; [->KORA_BGCRCK00F0]
;
		BIT	#0000000000001000B
		BNE	KORA_BGCRCK0080		; 左 ? [yes->KORA_BGCRCK0080]
;
		BIT	#0000000000000100B
		BNE	KORA_BGCRCK0060		; 右 ? [yes->KORA_BGCRCK0060]
;
		LDA	!ENWRKC,X
;
		I16				; index 16bit mode !!
;
		TAX
		LDA	>ENBGCK_TYPE_H,X
		AND	#1111100000000000B
		CMP	#ET
;;;;;;;;		BNE	KORA_BGCRCK00E0		; [->KORA_BGCRCK00E0]
		BNE	KORA_BGCRCK0040		; [->KORA_BGCRCK0040]
;
		LDA	>ENBGCK_X_H,X
		STA	<EWORK
		STA	!BGXPS1
		LDA	>ENBGCK_Y_H,X
		STA	<EWORK2
		STA	!BGYPS1
		BRA	KORA_BGCRCK00A0
;
KORA_BGCRCK0040 EQU	$
		JMP	KORA_BGCRCK00E0
;
KORA_BGCRCK0060 EQU	$
		LDA	!ENWRKC,X
;
		I16				; index 16bit mode !!
;
		TAX
		LDA	>ENBGCK_TYPE_R,X
		AND	#1111100000000000B
		CMP	#ET
		BNE	KORA_BGCRCK00E0		; [->KORA_BGCRCK00E0]
;
		LDA	>ENBGCK_X_R,X
		STA	<EWORK
		STA	!BGXPS1
		LDA	>ENBGCK_Y_R,X
		STA	<EWORK2
		STA	!BGYPS1
		BRA	KORA_BGCRCK00A0
;
KORA_BGCRCK0080 EQU	$
		LDA	!ENWRKC,X
;
		I16				; index 16bit mode !!
;
		TAX
		LDA	>ENBGCK_TYPE_L,X
		AND	#1111100000000000B
		CMP	#ET
		BNE	KORA_BGCRCK00E0		; [->KORA_BGCRCK00E0]
;
		LDA	>ENBGCK_X_L,X
		STA	<EWORK
		STA	!BGXPS1
		LDA	>ENBGCK_Y_L,X
		STA	<EWORK2
		STA	!BGYPS1
KORA_BGCRCK00A0 EQU	$
;
		I8				; index 8bit mode !!
;
		LDA	#BLK0
		STA	!BGCGNO
		JSL	>UNITCHG
;
		LDX	<ENINDX
		LDA	#BRBG0
		JSL	>EXINSR
;
		LDA	<EWORK
		AND	#0FFF0H
		STA	!EXXPSL,Y
		LDA	<EWORK2
		AND	#0FFF0H
		STA	!EXYPSL,Y
		LDA	#0000AH
		STA	!EXCHPT,Y
		LDA	#00002H
		STA	!EXTIM0,Y
;
		LDA	#0000AH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
KORA_BGCRCK00E0 EQU	$
;
		I8				; index 8bit mode !!
;
		LDX	<ENINDX
KORA_BGCRCK00F0 EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	initial (裸ノコノコ)						-
;-		HNOK0 : 床チェック無(緑)				-
;-		HNOK1 :	     "    有(赤)                                -
;------------------------------------------------------------------------
nknk_00		EQU	000H
nknk_01		EQU	001H
nknk_02		EQU	002H
nknk_03		EQU	003H
nknk_04		EQU	004H
nknk_05		EQU	005H
nknk_06		EQU	006H
nknk_07		EQU	007H
nknk_08		EQU	008H
nknk_09		EQU	009H
nknk_0A		EQU	00AH
nknk_0B		EQU	00BH
nknk_0C		EQU	00CH
nknk_0D		EQU	00DH
nknk_0E		EQU	00EH
nknk_0F		EQU	00FH
nknk_10		EQU	010H
;
hnok_area	EQU	020H
nknk_time	EQU	05
nknk_walkpt	EQU	(NKNKWALK-NKNKWALKPT-1)
nknk_turnpt	EQU	(NKNKTURN-NKNKTURNPT-1)
nknkflipp	EQU	(nknk_turnpt-3)
nknk_againpt	EQU	(NKNKAGINTM-NKNKAGINPT-1)
nknk_bgckhos	EQU	(nknk_againpt-1)
nknk_againjp	EQU	(nknk_againpt-2)
;
nokonokowalk	EQU	(nknkwkmd-HNOKMODSEL)
nokonokoturn	EQU	(nknktnmd-HNOKMODSEL)
nokonokobuttobi EQU	(nknkbtmd-HNOKMODSEL)
nokonokowait	EQU	(nknkwtmd-HNOKMODSEL)
nokonokoagain	EQU	(nknkagmd-HNOKMODSEL2)
;
HNOK_XSPD	EQU	$
		WORD	-00060H, 00060H
;
HNOK0IN		EQU	$
HNOK1IN		EQU	$
		LDY	!ENMUKI,X
		LDA	HNOK_XSPD,Y
		STA	!ENXSPD,X
		LDA	#0010AH
		STA	!ENWRK6,X		; 裸フラグ＆のこのこ／パタパタ ボディフラグ セット!!
		LDA	!ENCBFG,X
		STA	!ENWRK8,X		; BG衝突情報のセーブ !!
;
		M8				; memory 8bit mode !!
;
		STZ	!ENCHPT,X
		LDA	#nknk_time
		STA	!ENTIM0,X
		LDA	#nokonokowalk
		STA	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (ノコノコ)						-
;-		NKNK0 : 床チェック無(緑)				-
;-		NKNK1 :	     "    有(赤)                                -
;------------------------------------------------------------------------
NKNK0IN		EQU	$
NKNK1IN		EQU	$
		LDY	!ENMUKI,X
		LDA	HNOK_XSPD,Y
		STA	!ENXSPD,X
		LDA	#0000AH
		STA	!ENWRK6,X		; 裸フラグ＆のこのこ／パタパタ ボディフラグ セット!!
		LDA	!ENCBFG,X
		STA	!ENWRK8,X		; BG衝突情報のセーブ !!
;
		M8				; memory 8bit mode !!
;
		STZ	!ENCHPT,X
		LDA	#nknk_time
		STA	!ENTIM0,X
		LDA	#nokonokowalk
		STA	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
		STZ	!ENWRKA,X		; のこのこ／パタパタ デスフラグ クリア !!
		RTL
;
;
;------------------------------------------------------------------------
;-	move (裸ノコノコ)						-
;-		HNOK0 : 床チェック無(緑)				-
;-		HNOK1 :	     "    有(赤)                                -
;------------------------------------------------------------------------
HNOK0MV		EQU	$
HNOK1MV		EQU	$
		M_CHIP	NOKONOKOOAM
;
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BNE	HNOKMV0040		; 足当たり有 ? [yes->HNOKMV0040]
;
		LDA	!ENWRK8,X
		BIT	#0000000000000001B
		BNE	HNOKMV0040		; 前回足当たり有 ? [yes->HNOKMV0040]
;
		LDA	#02
		STA	!ENTIM1,X
HNOKMV0040	EQU	$
		LDA	<ENCONT,X
		TAX
		JSR	(HNOKMODSEL,X)
;
		JSL	>EPCRCK
;
		RTL
;
;
HNOKMODSEL	EQU	$
nknkwkmd	WORD	NKNKWALK2
nknktnmd	WORD	NKNKTURN
nknkbtmd	WORD	NKNKBUTTOBI
nknkwtmd	WORD	HNOKWAIT
;
;
;------------------------------------------------------------------------
;-	move (ノコノコ)							-
;-		NKNK0 : 床チェック無(緑)				-
;-		NKNK1 :	     "    有(赤)                                -
;------------------------------------------------------------------------
NKNK0MV		EQU	$
NKNK1MV		EQU	$
		LDA	!ENMODE,X
		CMP	#EDOWN
		BEQ	NKNKMV0010
;
		CMP	#EEATM
		BNE	NKNKMV0020
;
NKNKMV0010	EQU	$
		JMP	NKNK_KORA
;
NKNKMV0020	EQU	$
		M_CHIP	NOKONOKOOAM
;
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		JSL	>NK_NK_CRCK0100
;
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BNE	NKNKMV0040		; 足当たり有 ? [yes->NKNKMV0040]
;
		LDA	!ENWRK8,X
		BIT	#0000000000000001B
		BNE	NKNKMV0040		; 前回足当たり有 ? [yes->NKNKMV0040]
;
		LDA	#02
		STA	!ENTIM1,X
NKNKMV0040	EQU	$
		LDA	<ENCONT,X
		TAX
		JSR	(HNOKMODSEL2,X)
;
		JSL	>EPCRCK
;
		RTL
;
HNOKMODSEL2	EQU	$
		WORD	NKNKWALK
		WORD	NKNKTURN
nknkagmd	WORD	NKNKAGIN
;
;
NKNKWALKPT	EQU	$
		BYTE	nknk_07, nknk_06, nknk_05, nknk_04
		BYTE	nknk_03, nknk_02, nknk_01, nknk_00
;
NKNKWALK	EQU	$
		LDX	<ENINDX
		JSR	NKNK_CHECK
		BEQ	NKNKWALK0040		; 床チェック有 ? [yes->NKNKWALK0040]
;
		JSR	NKNK_BGCK2
;
		BRA	NKNKWALK0050
;
NKNKWALK0040	EQU	$
		JSR	NKNK_BGCK1
;
NKNKWALK0050	EQU	$
		JSR	NK_PL_CRCK
;
		JSR	NKNK_NKNK_CRCK		; ノコノコどうしの衝突チェック !!
;
		LDA	!ENTIM1,X
		BNE	NKNKWALK0060		; 飛んでる ? [yes->NKNKWALK0060]
;
		LDY	!ENMUKI,X
		LDA	HNOK_XSPD,Y
		STA	!ENXSPD,X
		BRA	NKNKWALK0080
;
NKNKWALK0060	EQU	$
		LDA	#nknk_0C
		STA	!ENCHPT,X
		LDA	!ENCBFG,X
		AND	#0000000000000001B
		BEQ	NKNKWALK00F0		; 本当 ? [yes->NKNKWALK00F0]
;
		LDA	#nknk_08
		STA	!ENCHPT,X
		STZ	!ENXSPD,X
		RTS
;
NKNKWALK0080	EQU	$
		LDA	!ENTIM0,X
		BNE	NKNKWALK00F0		; pattern change ? [no->NKNKWALK00F0]
;
		M8				; memory 8bit mode !!
;
		LDA	!ENCHPT,X
		INC	A
		AND	#007H
		STA	!ENCHPT,X
		LDA	#nknk_time
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
NKNKWALK00F0	EQU	$
		RTS
;
;
NKNKWALK2	EQU	$
		LDX	<ENINDX
		LDA	!ENWRK4,X
		BEQ	NKNKWALK2_0		; 甲羅サーチ ? [yes->NKNKWALK2_0]
;
		JMP	NKNKWALK20000
;
NKNKWALK2_0	EQU	$
		LDA	!ENTIM2,X
		BNE	NKNKWALK20000		; 甲羅サーチ ? [no->NKNKWALK20000]
;
		LDA	!ENXPSL,X
		STA	R3			; (R3) <- My X Position
		LDA	!ENYPSL,X
		STA	R4			; (R4) <- My Y Position
		M_CHIP	KOURASEARCH		; 甲羅サーチ !!
;
		LDX	<ENINDX
		LDY	R9			; Find Enemy Index Read !!
		BMI	NKNKWALK20000		; 甲羅有 ? [no->NKNKWALK20000]
;
		LDA	!ECENTY,X
		SEC
		SBC	!ECENTY,Y
		CLC
		ADC	#00010H
		CMP	#00020H
		BCS	NKNKWALK20000		; 範囲外 ? [yes->NKNKWALK20000]
;
		LDA	!ENMUKI,X
		DEC	A
		STA	<EWORK
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		STA	<EWORK2
		EOR	<EWORK
		BPL	NKNKWALK20000		; 甲羅後 ? [yes->NKNKWALK20000]
;
		LDA	<EWORK2
		ABS16
		CMP	#hnok_area
		BCS	NKNKWALK20000		; 範囲外 ? [yes->NKNKWALK20000]
;
KOURA_PUTON	EQU	$
;[1994.10.05.WE]		ASL	A
		ASL	A
		ASL	A
		ASL	A
		LDY	<EWORK2+1
		BMI	KORA_PT0040		; [->KORA_PT0040]
;
		EOR	#0FFFFH
		INC	A
KORA_PT0040	EQU	$
		STA	!ENXSPD,X
		LDA	#0FE00H
		STA	!ENYSPD,X
		LDA	#00020H
		STA	!ENGPOW,X
		LDA	#00001
		STA	!ENWRK4,X		; 甲羅サーチ禁止フラグセット !!
		LDA	!ENCBFG,X
		AND	#0FFFEH
		STA	!ENCBFG,X
		STA	!ENWRK8,X		; BG衝突情報のセーブ !!
		LDA	#nknk_0C
		STA	!ENCHPT,X
		RTS
;
NKNKWALK20000	EQU	$
		JSR	NKNK_CHECK
		BEQ	NKNKWALK20040		; 床チェック有 ? [yes->NKNKWALK20040]
;
		JSR	NKNK_BGCK2
;
		BRA	NKNKWALK20050
;
NKNKWALK20040	EQU	$
		JSR	NKNK_BGCK1
;
NKNKWALK20050	EQU	$
		JSR	NK_PL_CRCK
;
		JSR	NKNK_NKNK_CRCK		; ノコノコどうしの衝突チェック !!
;
		LDA	!ENTIM1,X
;[1994.10.05.WE]		BNE	NKNKWALK20060		; 飛んでる ? [yes->NKNKWALK20060]
		BNE	NKNKPTON
;
		STZ	!ENWRK4,X		; 甲羅サーチ禁止フラグクリア !!
		LDY	!ENMUKI,X
		LDA	HNOK_XSPD,Y
		STA	!ENXSPD,X
;[1994.10.05.WE]		BRA	NKNKWALK20080
;[1994.10.05.WE];
;[1994.10.05.WE]NKNKWALK20060	EQU	$
;[1994.10.05.WE]		LDA	#nknk_0C
;[1994.10.05.WE]		STA	!ENCHPT,X
;[1994.10.05.WE]		LDA	!ENCBFG,X
;[1994.10.05.WE]		AND	#0000000000000001B
;[1994.10.05.WE]		BEQ	NKNKPTON		; 本当 ? [yes->NKNKPTON]
;[1994.10.05.WE];
;[1994.10.05.WE]		LDA	#00040H
;[1994.10.05.WE]		STA	!ENGPOW,X
;[1994.10.05.WE]		LDA	#nknk_08
;[1994.10.05.WE]		STA	!ENCHPT,X
;[1994.10.05.WE]		STZ	!ENXSPD,X
;[1994.10.05.WE]		RTS
;[1994.10.05.WE];
NKNKWALK20080	EQU	$
		LDA	!ENTIM0,X
		BNE	NKNKWALK200F0		; pattern change ? [no->NKNKWALK200F0]
;
		M8				; memory 8bit mode !!
;
		LDA	!ENCHPT,X
		INC	A
		AND	#007H
		STA	!ENCHPT,X
		LDA	#nknk_time
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
NKNKWALK200F0	EQU	$
		RTS
;
NKNKPTON	EQU	$
		LDA	#nknk_0C
		LDY	!ENYSPD+1,X
		BMI	NKNKPTON0010		; 落下中 ? [no->NKNKPTON0010]
;
		LDA	#nknk_10
NKNKPTON0010	EQU	$
		STA	!ENCHPT,X
;
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	NKNKPTON0048		; 空中 ? [yes->NKNKPTON0048]
;
		LDY	!ECRSFG,X
		BMI	NKNKPTON0040		; プレイヤーと衝突 ? [yes->NKNKPTON0040]
;
		DEY
		BMI	NKNKPTON0040		; 衝突無し ? [yes->NKNKPTON0040]
		BEQ	NKNKPTON0040		; 赤ちゃんと衝突 ? [yes->NKNKPTON0040]
;
		LDA	!ENMYNO,Y
		CMP	#KORA0
		BCC	NKNKPTON0040		; 甲羅と衝突 ? [no->NKNKPTON0040]
;
		CMP	#KORA1+1
		BCS	NKNKPTON0040		; 甲羅と衝突 ? [no->NKNKPTON0040]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	NKNKPTON0040		; mode move ? [no->NKNKPTON0040]
;
		LDA	!ENSHOT,Y
		BNE	NKNKPTON0040		; shot ? [yes->NKNKPTON0040]
;
		LDA	!ENXSPD,Y
		BNE	NKNKPTON0040		; 動いてる ? [yes->NKNKPTON0040]
;
		LDA	!ENCBFG,Y
		BIT	#0000000000000001B
		BNE	NKNKPTON0050		; 甲羅空中 ? [no->NKNKPTON0050]
;
NKNKPTON0040	EQU	$
		JMP	NKNKPTON0100
;
NKNKPTON0048	EQU	$
		RTS
;
NKNKPTON0050	EQU	$
		LDA	!ENMYNO,Y
		CMP	#KORA0
		BNE	NKNKPTON0080		; 緑甲羅 ? [no->NKNKPTON0080]
;
		LDA	#NKNK0			; 緑ノコノコ
		BRA	NKNKPTON0090
;
NKNKPTON0080	EQU	$
		LDA	#NKNK1			; 赤ノコノコ
NKNKPTON0090	EQU	$
		PHY				; Y save !!
		TXY
		JSL	>ESTATST
;
		LDA	#EMOVE
		STA	!ENMODE,X
		LDA	!ENYPSL,X
		CLC
		ADC	#0008
		STA	!ENYPSL,X
		LDA	#-00008H
		STA	!ENBGYP,X
		LDA	#nokonokoagain
		STA	<ENCONT,X
		LDA	#nknk_againpt
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	NKNKAGINPT,Y
		STA	!ENCHPT,X
		LDA	NKNKAGINTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		LDA	#0000AH
		STA	!ENWRK6,X		; 裸フラグ＆のこのこ／パタパタ ボディフラグ セット!!
		LDA	!ENCBFG,X
		STA	!ENWRK8,X		; BG衝突情報のセーブ !!
;
		PLX				; Y load !!
		JSL	>ENCLEAR
;
		LDX	<ENINDX
		RTS
;
NKNKPTON0100	EQU	$
;[1994.10.05.WE]		LDA	!ENCBFG,X
;[1994.10.05.WE]		BIT	#0000000000000001B
;[1994.10.05.WE]		BEQ	NKNKPTON01F0		; 空中 ? [yes->NKNKPTON01F0]
;
		LDA	#00040H
		STA	!ENGPOW,X
		JMP	NKNKTURN00200
;
NKNKPTON01F0	EQU	$
		RTS
;
;
NKNKTURNPT	EQU	$
		BYTE	nknk_08, nknk_09, nknk_0A, nknk_0A
		BYTE	nknk_09, nknk_08
;
NKNKTURN	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		STA	!ENWRK8,X		; BG衝突情報のセーブ !!
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BNE	NKNKTURN00100		; 空中 ? [no->NKNKTURN00100]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		BRA	NKNKTURN00200
;
NKNKTURN00100	EQU	$
		LDA	!ENTIM0,X
		BNE	NKNKTURN001F0		; pattern change ? [no->NKNKTURN001F0]
;
		DEC	<ENWRK0,X
		BMI	NKNKTURN00200		; mode change ? [yes->NKNKTURN00200]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	NKNKTURNPT,Y
		STA	!ENCHPT,X
		LDA	#nknk_time
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#nknkflipp
		BNE	NKNKTURN001F0		; 反転 ? [no->NKNKTURN001F0]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
NKNKTURN001F0	EQU	$
		RTS
;
NKNKTURN00200	EQU	$
		LDY	!ENMUKI,X
		LDA	HNOK_XSPD,Y
		STA	!ENXSPD,X
;
		M8				; memory 8bit mode !!
;
		STZ	!ENCHPT,X
		LDA	#nknk_time
		STA	!ENTIM0,X
		LDA	#nokonokowalk
		STA	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
		RTS
;
;
NKNKAGINPT	EQU	$
		BYTE	nknk_08, nknk_0D, nknk_0C, nknk_0B
		BYTE	nknk_0E
;
NKNKAGINTM	EQU	$
		HEX	0A, 08, 10, 08, 60
;
NKNK_ADDDT	EQU	$
		WORD	0FFFEH, 00002H, 00002H, 0FFFEH
		WORD	0FFFEH, 00002H, 00002H, 0FFFEH
		WORD	0FFFEH, 00002H, 00002H, 0FFFEH
		WORD	0FFFEH, 00002H, 00002H, 0FFFEH
		WORD	0FFFEH, 00002H, 00002H, 0FFFEH
		WORD	0FFFEH, 00002H, 00002H, 0FFFEH
		WORD	0FFFEH, 00002H, 00002H, 0FFFEH
		WORD	0FFFEH, 00002H, 00002H, 0FFFEH
		WORD	0FFFEH, 00002H, 00002H, 0FFFEH
		WORD	00000H, 00000H, 00000H, 00000H
		WORD	00000H, 00000H, 00000H, 00000H
		WORD	00000H, 00000H, 00000H, 00000H
;
NKNKAGIN	EQU	$
		LDX	<ENINDX
		LDA	<ENWRK0,X
		CMP	#nknk_againpt
		BNE	NKNKAGIN0040		; ブルブル ? [no->NKNKAGIN0040]
;
		LDA	!ENTIM0,X
		LSR	A
		BCS	NKNKAGIN0040		; ブルブル ? [no->NKNKAGIN0040]
;
		ASL	A
		TAY
		LDA	!ENXPSL,X
		CLC
		ADC	NKNK_ADDDT,Y
		STA	!ENXPSL,X
NKNKAGIN0040	EQU	$
		LDA	!ENTIM0,X
		BNE	NKNKAGIN00F0		; pattern change ? [no->NKNKAGIN00F0]
;
		DEC	<ENWRK0,X
		BMI	NKNKAGIN0100		; next mode ? [yes->NKNKAGIN0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	NKNKAGINPT,Y
		STA	!ENCHPT,X
		LDA	NKNKAGINTM,Y
		STA	!ENTIM0,X
;
		M16				; memory 16bit mode !!
;
		CPY	#nknk_bgckhos
		BNE	NKNKAGIN0080		; BGチェック位置補正 ? [no->NKNKAGIN0080]
;
		LDA	!ENYPSL,X
		SEC
		SBC	#00008H
		STA	!ENYPSL,X
		STZ	!ENBGYP,X
		BRA	NKNKAGIN00F0
;
NKNKAGIN0080	EQU	$
		CPY	#nknk_againjp
		BNE	NKNKAGIN00F0		; ジャンプ ? [no->NKNKAGIN00F0]
;
		LDA	#0FE00H
		STA	!ENYSPD,X
		LDA	!ENCBFG,X
		AND	#0FFFEH
		STA	!ENCBFG,X
		STA	!ENWRK8,X		; BG衝突情報のセーブ !!
NKNKAGIN00F0	EQU	$
		RTS
;
NKNKAGIN0100	EQU	$
		JMP	NKNKTURN00200
;
;
NKNKSMK_XSPD	EQU	$
		WORD	0FFE0H, 00020H
;
NKNKBUTTOBI	EQU	$
		LDX	<ENINDX
		LDA	!ENMUKI,X
		DEC	A
		EOR	!ENXSPD,X
		BPL	NKNKBUTTOBI0100		; ぶっ飛びモード終り ? [yes->NKNKBUTTOBI0100]
;
		LDA	!ENXSPD,X
		BEQ	NKNKBUTTOBI0100		; ぶっ飛びモード終り ? [yes->NKNKBUTTOBI0100]
;
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BEQ	NKNKBUTTOBI00F0		; 足が地に付いている ? [no->NKNKBUTTOBI00F0]
;
		LDA	!ENMOD0,X
		ORA	#0000001000000000B	; 敵 VS 敵 衝突チェックされるフラグオン !!
		STA	!ENMOD0,X
;
		LDA	<FRCNT2
		AND	#00003H
		BNE	NKNKBUTTOBI00F0		; 煙セット ? [no->NKNKBUTTOBI00F0]
;
		LDY	!ENMUKI,X
		LDA	NKNKSMK_XSPD,Y
		STA	<EWORK
		LDA	#DSMK1
		JSL	>EXINSR
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!EXMUKI,Y
		LDA	#0004
		STA	!EXTIM0,Y
		STA	!EXWRK0,Y
		LDA	<EWORK
		STA	!EXXSPD,Y
		LDA	#0FFF0H
		STA	!EXYSPD,Y
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	#00014H
		STA	!EXYPSL,Y
NKNKBUTTOBI00F0 EQU	$
		PLA
		RTL
;
NKNKBUTTOBI0100 EQU	$
		LDA	!ENMOD0,X
		ORA	#0000001000000000B	; 敵 VS 敵 衝突チェックされるフラグオン !!
		STA	!ENMOD0,X
;
		STZ	!ENXPOW,X
		STZ	!ENXSPD,X
		LDA	#0008
		STA	!ENTIM0,X
		LDA	#0001
		STA	<ENWRK0,X
		LDA	#nokonokowait
		STA	<ENCONT,X
		PLA
		RTL
;
;
HNOKWAIT	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	HNOKWAIT0020		; 待ち終り ? [no->HNOKWAIT0020]
;
		DEC	<ENWRK0,X
		BMI	HNOKWAIT0040		; 待ち終り ? [yes->HNOKWAIT0040]
;
		LDA	#nknk_0D
		STA	!ENCHPT,X
		LDA	#0008
		STA	!ENTIM0,X
HNOKWAIT0020	EQU	$
		PLA
		RTL
;
HNOKWAIT0040	EQU	$
		STZ	<ENWRK0,X
		JSR	NKNK_CHECK
		BNE	HNOKWAIT0080		; 床チェック有 ? [no->HNOKWAIT0080]
;
		LDA	!ENMOD1,X
		ORA	#0000001000000000B	; 床チェック有フラグオン !!
		STA	!ENMOD1,X
HNOKWAIT0080	EQU	$
		JMP	NKNKTURN00200
;
;
NKNK_CHECKNUM	EQU	$
		WORD	HNOK1, NKNK1
;
NKNK_CHECK	EQU	$
		LDY	#(NKNK_CHECK-NKNK_CHECKNUM-2)
		LDA	!ENMYNO,X
NKNK_CHECK0040	EQU	$
		CMP	NKNK_CHECKNUM,Y
		BEQ	NKNK_CHECK00F0		; 見つかった ? [yes->NKNK_CHECK00F0]
;
		DEY
		DEY
		BPL	NKNK_CHECK0040		; check end ? [no->NKNK_CHECK0040]
;
NKNK_CHECK00F0	EQU	$
		RTS
;
;
NKNK_BGCK2	EQU	$	; 床チェック無
		LDA	!ENCBFG,X
		BIT	#0000000000001100B
		BNE	NKNK_BGCK10040		; 横当たり有 ? [yes->NKNK_BGCK10040]
;
		BRA	NKNK_BGCK100F0
;
NKNK_BGCK1	EQU	$	; 床チェック有
		LDA	!ENCBFG,X
		BIT	#0000000000001100B
		BNE	NKNK_BGCK10040		; 横当たり有 ? [yes->NKNK_BGCK10040]
;
		BIT	#0000000000000001B
		BNE	NKNK_BGCK100F0		; 足当たり有 ? [yes->NKNK_BGCK100F0]
;
		LDA	!ENWRK8,X
		BEQ	NKNK_BGCK100F0		; 前回足当たり有 ? [no->NKNK_BGCK100F0]
;
NKNK_BGCK10040	EQU	$
		LDA	#nknk_turnpt
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	NKNKTURNPT,Y
		STA	!ENCHPT,X
		LDA	#nknk_time
		STA	!ENTIM0,X
		LDA	#nokonokoturn
		STA	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
		PLA
NKNK_BGCK100F0	EQU	$
		LDA	!ENCBFG,X
		STA	!ENWRK8,X		; BG衝突情報のセーブ !!
		RTS
;
;
NKNK_KORAGREEN	EQU	$
		WORD	NKNK0, PTPT0
;
NKNK_KORA	EQU	$
		LDY	#(NKNK_KORA-NKNK_KORAGREEN-2)
		LDA	!ENMYNO,X
NKNK_KORA0020	EQU	$
		CMP	NKNK_KORAGREEN,Y
		BEQ	NKNK_KORA0030		; 緑 ? [yes->NKNK_KORA0030]
;
		DEY
		DEY
		BPL	NKNK_KORA0020		; チェック END ? [no->NKNK_KORA0020]
;
		LDA	#KORA1			; 赤
		BRA	NKNK_KORA0050
;
NKNK_KORA0030	EQU	$
		LDA	#KORA0			; 緑
NKNK_KORA0050	EQU	$
		TXY
		JSL	>ESTATST
;
		RTL
;
;
NKNK_NKNK_CRCK	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	NK_NK_CRCK00F0		; 衝突無し＆プレイヤー衝突 ? [yes->NK_NK_CRCK00F0]
		BEQ	NK_NK_CRCK00F0		; 赤ちゃん衝突 ? [yes->NK_NK_CRCK00F0]
;
		LDA	!ENSHOT,Y
		BNE	NK_NK_CRCK00F0		; shot ? [yes->NK_NK_CRCK00F0]
;
		LDA	!ENMYNO,Y
		CMP	#HNOK0
		BCC	NK_NK_CRCK00F0		; ノコノコ ? [no->NK_NK_CRCK00F0]
;
		CMP	#PTPT0+1
		BCS	NK_NK_CRCK00F0		; ノコノコ ? [no->NK_NK_CRCK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	NK_NK_CRCK00F0		; mode move ? [no->NK_NK_CRCK00F0]
;
		LDA	!ENMUKI,X
		DEC	A
		STA	<EWORK
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		EOR	<EWORK
		BPL	NK_NK_CRCK00F0		; 反転 ? [no->NK_NK_CRCK00F0]
;
		STZ	!ENXSPD,X
		LDA	#nknk_turnpt
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	NKNKTURNPT,Y
		STA	!ENCHPT,X
		LDA	#nknk_time
		STA	!ENTIM0,X
		LDA	#nokonokoturn
		STA	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
		PLA
NK_NK_CRCK00F0	EQU	$
		RTS
;
NK_NK_CRCK0100	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	NK_NK_CRCK01F0		; 衝突無し＆プレイヤー衝突 ? [yes->NK_NK_CRCK01F0]
		BEQ	NK_NK_CRCK01F0		; 赤ちゃん衝突 ? [yes->NK_NK_CRCK01F0]
;
		LDA	!ENSHOT,Y
		BEQ	NK_NK_CRCK01F0		; shot ? [no->NK_NK_CRCK01F0]
;
		LDA	!ENMYNO,Y
		CMP	#KORA0
		BCC	NK_NK_CRCK0120		; 甲羅 ? [no->NK_NK_CRCK0120]
;
		CMP	#KORA1+1
		BCC	NK_NK_CRCK01F0		; 甲羅 ? [yes->NK_NK_CRCK01F0]
;
NK_NK_CRCK0120	EQU	$
		STZ	<EWORK
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		BPL	NK_NK_CRCK0140		; [->NK_NK_CRCK0140]
;
		INC	<EWORK
		INC	<EWORK
NK_NK_CRCK0140	EQU	$
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
		LDA	!ENMYNO,X
		CMP	#NKNK0
		BNE	NK_NK_CRCK0160		; 緑ノコノコ ? [no->NK_NK_CRCK0160]
;
		LDA	#KORA0
		BRA	NK_NK_CRCK0168
;
NK_NK_CRCK0160	EQU	$
		LDA	#KORA1
NK_NK_CRCK0168	EQU	$
		TXY
		JSL	>ESTATST
;
		LDA	#EMOVE
		STA	!ENMODE,X
		LDA	#32
		STA	!ENTIM1,X
		LDA	#0001
		STA	!ENSHOT,X
		LDY	<EWORK
		LDA	KORA_XSPD,Y
		STA	!ENXSPD,X
		PLY
		PLA
NK_NK_CRCK01F0	EQU	$
		RTL
;
;
NK_PL_CRCK	EQU	$
		LDA	!PLFLSH
		BNE	NK_PL_CRCK00F0		; プレイヤーフラッシュ ? [yes->NK_PL_CRCK00F0]
;
		LDY	!ECRSFG,X
		BPL	NK_PL_CRCK00F0		; プレイヤーと衝突 ? [no->NK_PL_CRCK00F0]
;
		LDA	!EPXMUK,X
		AND	#000FFH
		CMP	!ENMUKI,X
		BEQ	NK_PL_CRCK00F0		; [->NK_PL_CRCK00F0]
;
		STZ	!ENXSPD,X
		LDA	#nknk_turnpt
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	NKNKTURNPT,Y
		STA	!ENCHPT,X
		LDA	#nknk_time
		STA	!ENTIM0,X
		LDA	#nokonokoturn
		STA	<ENCONT,X
;
		M16				; memory 16bit mode !!
;
;[1994.10.14.FR]		LDA	!EPXMUK,X
;[1994.10.14.FR]		AND	#000FFH
;[1994.10.14.FR]		STA	!ENMUKI,X
;[1994.10.14.FR]		TAY
;[1994.10.14.FR]		LDA	HNOK_XSPD,Y
;[1994.10.14.FR]		STA	!ENXSPD,X
		PLA
NK_PL_CRCK00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	fail (裸ノコノコ)							-
;-		HNOK0 : 床チェック無(緑)				-
;-		HNOK1 :	     "    有(赤)                                -
;------------------------------------------------------------------------
NKNK_DEATH	EQU	$
		LDA	!ENMOD2,X
		BIT	#0000000000000011B
		BEQ	NKNK_DEATH0020		; [->NKNK_DEATH0020]
;
		M_CHIP	NOKONOKOOAM
;
		LDX	<ENINDX
NKNK_DEATH0020	EQU	$
		STZ	!ENCHPT,X
		LDA	!ENMOD2,X
		AND	#0000011111111100B
		ORA	#0000100000000000B
		STA	!ENMOD2,X		; １キャラＯＢＪセット !!
		BRA	KORA0FL
;
HNOK0FL		EQU	$
HNOK1FL		EQU	$
		M_CHIP	NOKONOKOOAM
;
		LDX	<ENINDX
KORA0FL		EQU	$
KORA1FL		EQU	$
		LDA	!ENMOD1,X
		AND	#1111111111100000B
		STA	!ENMOD1,X		; ＢＧチェックＯＦＦ !!
		LDA	!ENCLOR,X
		ORA	#0000000010000000B
		STA	!ENCLOR,X		; Ｖフリップセット !!
		RTL
;
;
;------------------------------------------------------------------------
;-	fail (ノコノコ)							-
;-		NKNK0 : 床チェック無(緑)				-
;-		NKNK1 :	     "    有(赤)                                -
;------------------------------------------------------------------------
nknk_failyspd	EQU	0FF00H
;
NKNK_FAILXSPD	EQU	$
		WORD	00400H, -00400H
;
NKNK0FL		EQU	$
		LDA	!ENWRKA,X
		BNE	NKNK_DEATH		; 通常やられ処理 ? [no->NKNK_DEATH]
;
NKNK0FL_0000	EQU	$
		M_CHIP	NOKONOKOOAM
;
		LDX	<ENINDX
		LDA	#KORA0
		STA	<EWORK
		LDA	#HNOK0
		BRA	NKNK_FAIL
;
NKNK1FL		EQU	$
		LDA	!ENWRKA,X
		BNE	NKNK_DEATH		; 通常やられ処理 ? [no->NKNK_DEATH]
;
NKNK1FL_0000	EQU	$
		M_CHIP	NOKONOKOOAM
;
		LDX	<ENINDX
		LDA	#KORA1
		STA	<EWORK
		LDA	#HNOK1
NKNK_FAIL	EQU	$
		TXY
		JSL	>ESTATST
;
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	!ENMUKI,X
		TAY
		LDA	NKNK_FAILXSPD,Y
		STA	!ENXSPD,X
		LDA	#32
		STA	!ENTIM2,X		; 甲羅サーチ禁止フラグセット !!
		LDA	#0010AH
		STA	!ENWRK6,X		; 裸フラグ＆のこのこ／パタパタ ボディフラグ セット!!
		LDA	!ENCBFG,X
		STA	!ENWRK8,X		; BG衝突情報のセーブ !!
		LDA	#nokonokobuttobi
		STA	!ENCONT,X
		LDA	#nknk_0C
		STA	!ENCHPT,X
		LDA	#00020H
		STA	!ENXPOW,X
		LDA	!ENMOD0,X
		AND	#1111110111111111B	; 敵 VS 敵 衝突チェックされるフラグオフ !!
		STA	!ENMOD0,X
		LDA	!ENMOD1,X
		AND	#1111110011111111B	; 床チェック有フラグオン !!
		STA	!ENMOD1,X
		LDA	#EMOVE
		STA	!ENMODE,X
;
		LDA	<EWORK
		JSL	>ENINSR
		BCC	NKNK_FAIL00F0		; 敵エリア確保失敗 ? [yes->NKNK_FAIL00F0]
;
		LDA	#32
		STA	!ENTIM1,Y
		LDA	!ENMUKI,X
		STA	!ENMUKI,Y
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		STA	!ENYPSL,Y
NKNK_FAIL00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (パタパタ)						-
;-		PTPT0 : 跳ねるやつ(緑)					-
;-		PTPT1 : 左右(赤)					-
;-		PTPT2 : 上下(赤)					-
;------------------------------------------------------------------------
ptpt_00		EQU	000H
ptpt_01		EQU	001H
ptpt_02		EQU	002H
ptpt_03		EQU	003H
ptpt_04		EQU	004H
ptpt_05		EQU	005H
ptpt_06		EQU	006H
ptpt_07		EQU	007H
ptpt_08		EQU	008H
ptpt_09		EQU	009H
;
patapata_airpt	EQU	008H
patapata_airtm	EQU	03
patapata_airtm1 EQU	02
patapata_airtm2 EQU	04
ptpt_earthtm	EQU	08
;
ptpt_air	EQU	(ptpt_airmd-PTPT0MODSEL)
ptpt_earth	EQU	(ptpt_earthmd-PTPT0MODSEL)
;
PTPT0_XSPD	EQU	$
		WORD	-00080H, 00080H
;
PTPT0IN		EQU	$
		LDA	#0002AH
		STA	!ENWRK6,X		; 裸フラグ＆のこのこ／パタパタ ボディフラグ セット!!
		LDA	#00010H
		STA	!ENGPOW,X
		LDA	#00100H
		STA	!ENGMAX,X
PTPT0IN0000	EQU	$
		LDY	!ENMUKI,X
		LDA	PTPT0_XSPD,Y
		STA	!ENXSPD,X
		LDA	#0FE00H
		STA	!ENYSPD,X
		LDA	#patapata_airpt
		STA	!ENCHPT,X
		LDA	#patapata_airtm1
		STA	!ENTIM0,X
		LDA	#ptpt_air
		STA	<ENCONT,X
		STZ	!ENWRKA,X		; のこのこ／パタパタ デスフラグ クリア !!
		RTL
;
;
PTPT2_STARTYP	EQU	$
PTPT1_STARTXP	EQU	$
		WORD	 00030H, -00030H
;
PTPT1_STARTYP	EQU	$
		WORD	 00004H, -00004H
;
PTPT2_YMAXIMUM	EQU	$
PTPT1_YMAXIMUM	EQU	$
PTPT1_XMAXIMUM	EQU	$
		WORD	-00800H,  00800H
;
PTPT1IN		EQU	$
		LDA	#0002AH
		STA	!ENWRK6,X		; 裸フラグ＆のこのこ／パタパタ ボディフラグ セット!!
		LDA	!ENXPSL,X
		STA	<ENWRK0,X		; センター X ポジション セーブ !!
		PHA
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		EOR	#00002H
		STA	!ENMUKI,X		; イニシャル向きセット !!
		TAY
		PLA
		CLC
		ADC	PTPT1_STARTXP,Y
		STA	!ENXPSL,X		; イニシャルポジションセット !!
		LDA	PTPT1_XMAXIMUM,Y
		STA	!ENXMAX,X		; マックススピードセット !!
		STA	!ENGMAX,X
		LDA	#00004H
		STA	!ENXPOW,X
		LDA	#00008H
		STA	!ENGPOW,X
		LDA	!ENYPSL,X
		STA	<ENWRK2,X		; センター Y ポジション セーブ !!
		CLC
		ADC	PTPT1_STARTYP,Y
		STA	!ENYPSL,X
		LDA	#patapata_airpt
		STA	!ENCHPT,X
		LDA	#patapata_airtm
		STA	!ENTIM0,X
		STZ	!ENWRKA,X		; のこのこ／パタパタ デスフラグ クリア !!
		RTL
;
;

PTPT2IN		EQU	$
		LDA	#0002AH
		STA	!ENWRK6,X		; 裸フラグ＆のこのこ／パタパタ ボディフラグ セット!!
		LDA	!ENXPSL,X
		AND	#00010H
		LSR	A
		LSR	A
		LSR	A
		EOR	#00002H
		TAY
		LDA	!ENYPSL,X
		STA	<ENWRK0,X		; センター Y ポジション セーブ !!
		CLC
		ADC	PTPT2_STARTYP,Y
		STA	!ENYPSL,X		; イニシャルポジションセット !!
		LDA	PTPT2_YMAXIMUM,Y
		STA	!ENGMAX,X		; マックススピードセット !!
		LDA	#00004H
		STA	!ENGPOW,X
		LDA	#patapata_airpt
		STA	!ENCHPT,X
		LDA	PTPT2TIME,Y
		STA	!ENTIM0,X
		STZ	!ENWRKA,X		; のこのこ／パタパタ デスフラグ クリア !!
		RTL
;
;
;------------------------------------------------------------------------
;-	move (パタパタ)							-
;-		PTPT0 : 跳ねるやつ(緑)					-
;-		PTPT1 : 左右(赤)					-
;-		PTPT2 : 上下(赤)					-
;------------------------------------------------------------------------
PTPT0MV		EQU	$
		LDA	!ENMODE,X
		CMP	#EEATM
		BNE	PTPT0MV0020		; 食べられた ? [no->PTPT0MV0020]
;
		STZ	<EWORK
		JSR	HANESET
;
		JMP	NKNK_KORA		; 甲羅チェンジ !!
;
PTPT0MV0020	EQU	$
		M_CHIP	NOKONOKOOAM
;
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		JSL	>PTPTCRSCK
;
		JSR	PTPTTURNCHK
;
		LDA	<ENCONT,X
		TAX
		JSR	(PTPT0MODSEL,X)
;
		JSL	>EPCRCK
;
		RTL
;
PTPT0MODSEL	EQU	$
ptpt_airmd	WORD	PTPT0AIR
ptpt_earthmd	WORD	PTPT0EARTH
;
;
;
PTPT2TIME	EQU	$
PTPT0TIME	EQU	$
		WORD	patapata_airtm1, patapata_airtm2
;
PTPT0AIR	EQU	$
		LDX	<ENINDX
		LDA	!ENCBFG,X
		BIT	#0000000000000001B
		BNE	PTPT0AIR0100		; 着地 ? [yes->PTPT0AIR0100]
;
PTPT0AIR0000	EQU	$
		LDA	!ENTIM0,X
		BNE	PTPT0AIR00F0		; pattern change ? [no->PTPT0AIR00F0]
;
		DEC	!ENCHPT,X
		BPL	PTPT0AIR0040		; pattern minimum ? [no->PTPT0AIR0040]
;
		LDA	#patapata_airpt
		STA	!ENCHPT,X
PTPT0AIR0040	EQU	$
;[1994.10.06.TH]		LDY	#00
;[1994.10.06.TH]		LDA	#00100H
;[1994.10.06.TH]		CLC
;[1994.10.06.TH]		ADC	!ENYSPD,X
;[1994.10.06.TH]		BMI	PTPT0AIR0050		; [->PTPT0AIR0050]
;[1994.10.06.TH];
;[1994.10.06.TH]		INY
;[1994.10.06.TH]		INY
;[1994.10.06.TH]PTPT0AIR0050	EQU	$
;[1994.10.06.TH]		LDA	PTPT0TIME,Y
		LDA	#patapata_airtm1
		STA	!ENTIM0,X
PTPT0AIR00F0	EQU	$
		RTS
;
PTPT0AIR0100	EQU	$
		STZ	!ENXSPD,X
		LDA	#ptpt_earthtm
		STA	!ENTIM0,X
		LDA	#ptpt_09
		STA	!ENCHPT,X
		LDA	#ptpt_earth
		STA	<ENCONT,X
		RTS
;
;
PTPT0EARTH	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	PTPT0EARTH00F0		; [->PTPT0EARTH00F0]
;
		JSL	>PTPT0IN0000
;
PTPT0EARTH00F0	EQU	$
		RTS
;
;
PTPT1MV		EQU	$
		LDA	!ENMODE,X
		CMP	#EEATM
		BNE	PTPT1MV0020		; 食べられた ? [no->PTPT1MV0020]
;
		STZ	<EWORK
		JSR	HANESET
;
		JMP	NKNK_KORA		; 甲羅チェンジ !!
;
PTPT1MV0020	EQU	$
		M_CHIP	NOKONOKOOAM
;
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		JSL	>PTPTCRSCK
;
		LDY	#00
		LDA	!ENXPSL,X
		CMP	<ENWRK0,X
		BPL	PTPT1MV0040		; 右側マックススピード ? [no->PTPT1MV0040]
;
		INY
		INY
PTPT1MV0040	EQU	$
		LDA	PTPT1_XMAXIMUM,Y
		STA	!ENXMAX,X
		LDA	!ENMUKI,X
		DEC	A
		EOR	!ENXSPD,X
		BPL	PTPT1MV0080		; 向きとスピードの関係が合っているか ? [yes->PTPT1MV0080]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
PTPT1MV0080	EQU	$
		LDY	#00
		LDA	!ENYPSL,X
		CMP	<ENWRK2,X
		BPL	PTPT1MV0090		; 下側マックススピード ? [no->PTPT1MV0090]
;
		INY
		INY
PTPT1MV0090	EQU	$
		LDA	PTPT1_YMAXIMUM,Y
		STA	!ENGMAX,X
		LDA	!ENTIM0,X
		BNE	PTPT1AIR00F0		; pattern change ? [no->PTPT1AIR00F0]
;
		DEC	!ENCHPT,X
		BPL	PTPT1AIR00A0		; pattern minimum ? [no->PTPT1AIR00A0]
;
		LDA	#patapata_airpt
		STA	!ENCHPT,X
PTPT1AIR00A0	EQU	$
		LDA	#patapata_airtm
		STA	!ENTIM0,X
PTPT1AIR00F0	EQU	$
		JSL	>EPCRCK
;
		RTL
;
;
PTPT2MV		EQU	$
		LDA	!ENMODE,X
		CMP	#EEATM
		BNE	PTPT2MV0020		; 食べられた ? [no->PTPT2MV0020]
;
		STZ	<EWORK
		JSR	HANESET
;
		JMP	NKNK_KORA		; 甲羅チェンジ !!
;
PTPT2MV0020	EQU	$
		M_CHIP	NOKONOKOOAM
;
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		JSL	>PTPTCRSCK
;
		LDY	#00
		LDA	!ENYPSL,X
		CMP	<ENWRK0,X
		BPL	PTPT2MV0040		; 下側マックススピード ? [no->PTPT2MV0040]
;
		INY
		INY
PTPT2MV0040	EQU	$
		LDA	PTPT2_YMAXIMUM,Y
		STA	!ENGMAX,X
		LDA	!ENTIM0,X
		BNE	PTPT2AIR00F0		; pattern change ? [no->PTPT2AIR00F0]
;
		DEC	!ENCHPT,X
		BPL	PTPT2AIR0080		; pattern minimum ? [no->PTPT2AIR0080]
;
		LDA	#patapata_airpt
		STA	!ENCHPT,X
PTPT2AIR0080	EQU	$
		LDY	#00
		LDA	#00100H
		BIT	!ENGMAX,X
		BPL	PTPT2AIR0090		; 上側 ? [yes->PTPT2AIR0090]
;
		LDA	#0FF00H
PTPT2AIR0090	EQU	$
		CLC
		ADC	!ENYSPD,X
		BMI	PTPT2AIR00A0		; [->PTPT2AIR00A0]
;
		INY
		INY
PTPT2AIR00A0	EQU	$
		LDA	PTPT2TIME,Y
		STA	!ENTIM0,X
PTPT2AIR00F0	EQU	$
		JSL	>EPCRCK
;
		RTL
;
;
PTPTCRSCK	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	PTPTCRSCK00F0		; 衝突無し＆プレイヤー衝突 ? [yes->PTPTCRSCK00F0]
		BEQ	PTPTCRSCK00F0		; 赤ちゃん衝突 ? [yes->PTPTCRSCK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	PTPTCRSCK00F0		; mode move ? [no->PTPTCRSCK00F0]
;
		LDA	!ENSHOT,Y
		BEQ	PTPTCRSCK00F0		; shot ? [yes->PTPTCRSCK00F0]
;
		LDA	!ENMYNO,Y
		CMP	#KORA0
		BCC	PTPTCRSCK0080		; 甲羅 ? [no->PTPTCRSCK0080]
;
		CMP	#KORA1+1
		BCC	PTPTCRSCK00F0		; 甲羅 ? [yes->PTPTCRSCK00F0]
;
PTPTCRSCK0080	EQU	$
		TYX
		JSL	>SHOT_EN_KILL		; ショット敵やっつけ !!
;
		LDX	<ENINDX
		LDA	#EFAIL
		STA	!ENMODE,X
		PLY
		PLA
PTPTCRSCK00F0	EQU	$
		RTL
;
;
PTPTTURNCHK	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	PTPTTURNCHK00F0		; 衝突無し＆プレイヤー衝突 ? [yes->PTPTTURNCHK00F0]
		BEQ	PTPTTURNCHK00F0		; 赤ちゃん衝突 ? [yes->PTPTTURNCHK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	PTPTTURNCHK00F0		; mode move ? [no->PTPTTURNCHK00F0]
;
		LDA	!ENSHOT,Y
		BNE	PTPTTURNCHK00F0		; shot ? [yes->PTPTTURNCHK00F0]
;
		LDA	!ENMYNO,Y
		CMP	#HNOK0
		BCC	PTPTTURNCHK00F0		; ノコノコ類 ? [no->PTPTTURNCHK00F0]
;
		CMP	#PTPT0+1
		BCS	PTPTTURNCHK00F0		; ノコノコ類 ? [no->PTPTTURNCHK00F0]
;
		LDA	!ENMUKI,X
		DEC	A
		STA	<EWORK
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		EOR	<EWORK
		BPL	PTPTTURNCHK00F0		; 反転 ? [no->PTPTTURNCHK00F0]
;
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		LDA	!ENXSPD,X
		EOR	#0FFFFH
		INC	A
		STA	!ENXSPD,X
PTPTTURNCHK00F0 EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	fail (パタパタ)							-
;-		PTPT0 : 跳ねるやつ(緑)					-
;------------------------------------------------------------------------
PTPT0FL		EQU	$
		LDA	!ENTIM3,X
		BNE	PTPT0FL00		; 羽根 ? [no->PTPT0FL00]
;
		STZ	<EWORK
		JSR	HANESET
;
		LDA	#0FFFFH
		STA	!ENTIM3,X
PTPT0FL00	EQU	$
		LDA	!ENWRKA,X
		BEQ	PTPT0FL0000		; 通常やられ処理 ? [yes->PTPT0FL0000]
;
		JMP	NKNK_DEATH
;
PTPT0FL0000	EQU	$
		LDA	#NKNK0
		BRA	PTPT_FAIL0000
;
PTPT1FL		EQU	$
PTPT2FL		EQU	$
		LDA	!ENTIM3,X
		BNE	PTPT1FL00		; 羽根 ? [no->PTPT1FL00]
;
		STZ	<EWORK
		JSR	HANESET
;
		LDA	#0FFFFH
		STA	!ENTIM3,X
PTPT1FL00	EQU	$
		LDA	!ENWRKA,X
		BEQ	PTPT1FL0000		; 通常やられ処理 ? [yes->PTPT1FL0000]
;
		JMP	NKNK_DEATH
;
PTPT1FL0000	EQU	$
		LDA	#NKNK1
PTPT_FAIL0000	EQU	$
		PHA
		M_CHIP	NOKONOKOOAM
;
		PLA
		LDX	<ENINDX
		TXY
		JSL	>ESTATST
;
		LDA	#EMOVE
		STA	!ENMODE,X
		LDA	#0000AH
		STA	!ENWRK6,X		; 裸フラグ＆のこのこ／パタパタ ボディフラグ セット!!
		LDA	!ENCBFG,X
		STA	!ENWRK8,X		; BG衝突情報のセーブ !!
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (大砲君)						-
;------------------------------------------------------------------------
taiho_00	EQU	000H
taiho_01	EQU	001H
taiho_02	EQU	002H
taiho_03	EQU	003H
taiho_04	EQU	004H
taiho_05	EQU	005H
taiho_06	EQU	006H
taiho_07	EQU	007H
taiho_08	EQU	008H
taiho_09	EQU	009H
taiho_0A	EQU	00AH
taiho_0B	EQU	00BH
taiho_0C	EQU	00CH
taiho_0D	EQU	00DH
;
taihowalkptn	EQU	(TAIH0WALKTM-TAIH0WALKPT-1)
taihofumrptn	EQU	(TAIH0FUMARETM-TAIH0FUMAREPT-1)
taihohshaptn	EQU	(TAIH0HASSHATM-TAIH0HASSHAPT-1)
taiho_discharge EQU	(taihohshaptn-2)
;
taihowalk	EQU	(taihowalkmd-TAIH0MODSEL)
taihofumare	EQU	(taihofumrmd-TAIH0MODSEL)
taihohassha	EQU	(taihohshamd-TAIH0MODSEL)
;
TAIH0_CNTYW	EQU	$
		HEX	08, 06, 07, 08, 09, 0C, 0A, 09
		HEX	09, 0A, 08, 08, 0B, 0D
;
TAIHO_PLHOSEI	EQU	$
		WORD	-18H, -1AH, -19H, -18H, -17H, -14H, -16H, -17H
		WORD	-17H, -16H, -18H, -18H, -15H, -13H
;
TAIHO_XSPD	EQU	$
		WORD	-00080H, 00080H
;
TAIH0IN		EQU	$
		LDA	#taihowalkptn
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	TAIH0WALKTM,Y
		STA	!ENTIM0,X
		LDA	TAIH0WALKPT,Y
		STA	!ENCHPT,X
		TAY
		LDA	TAIH0_CNTYW,Y
		STA	!ECNTYW,X
;
		M16				; memory 16bit mode !!
;
		LDA	#00004H
		STA	!EWIDEY,X
		LDA	#00004H
		STA	!EWIDEX,X
		LDY	!ENMUKI,X
		LDA	TAIHO_XSPD,Y
		STA	!ENXSPD,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (大砲君)							-
;------------------------------------------------------------------------
TAIH0MV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JSR	(TAIH0MODSEL,X)
;
		LDA	<ENWRK2,X
		STA	!ENWRKC,X		; プレイヤー乗せフラグ待避 !!
		STZ	<ENWRK2,X		; プレイヤー乗せフラグクリア !!
		JSL	>EPCRCK
;
		LDY	!ECRSFG,X
		BPL	TAIH0MV0100		; プレイヤーと衝突してる ? [no->TAIH0MV0100]
;
		LDA	!PLJUMP
		BNE	TAIH0MV00F0		; プレイヤージャンプフラグ ＯＮ ? [yes->TAIH0MV00F0]
;
		LDA	!PLYSPD
		BMI	TAIH0MV00F0		; プレイヤー上昇中 ? [yes->TAIH0MV00F0]
;
		LDA	!ENWRKC,X
		BNE	TAIH0MV00E0		; 前回のプレイヤー乗せフラグがＯＮ ? [yes->TAIH0MV00E0]
;
		INC	A
TAIH0MV00E0	EQU	$
		STA	<ENWRK2,X		; プレイヤー乗せフラグセット !!
TAIH0MV00F0	EQU	$
		RTL
;
TAIH0MV0100	EQU	$
		DEY
		BMI	TAIH0MV00F0		; 敵と当たった？ [no->TAIH0MV00F0]
		BEQ	TAIH0MV00F0		; 赤ちゃん？ [yes->TAIH0MV00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	TAIH0MV00F0		; Ｍｏｄｅ Ｍｏｖｅ？ [no->TAIH0MV00F0]
;
		LDA	!ENSHOT,Y
		BEQ	TAIH0MV00F0		; ショット？ [no->TAIH0MV00F0]
;
		LDA	!ENGPOW,Y
		CMP	#00040H
		BCS	TAIH0MV0180		; [->TAIH0MV0180]
;
		JSL	>DEATHENEMY
;
		JMP	>ENDEATH_SET
;
TAIH0MV0180	EQU	$
		PHX
		TYX
		JSL	>SHOT_EN_KILL
;
		PLX
		RTL
;
TAIH0MODSEL	EQU	$
taihowalkmd	WORD	TAIH0WALK
taihofumrmd	WORD	TAIH0FUMARE
taihohshamd	WORD	TAIH0HASSHA
;
;
TAIH0WALKPT	EQU	$
		BYTE	taiho_07, taiho_06, taiho_05, taiho_04
		BYTE	taiho_03, taiho_02, taiho_01, taiho_00
;
TAIH0WALKTM	EQU	$
		HEX	04, 04, 03, 02, 02, 03, 04, 04
;
TAIH0WALK	EQU	$
		LDX	<ENINDX
		JSR	TAIH0_PLCRSCK
;
		LDA	<RANDM0
		AND	#0003FH
		BEQ	TAIH0WALK0100		; 弾発射 ? [yes->TAIH0WALK0100]
;
		LDA	!ENTIM0,X
		BNE	TAIH0WALK00F0		; pattern change ? [no->TAIH0WALK00F0]
;
		DEC	<ENWRK0,X
		BPL	TAIH0WALK0040		; pattern max ? [no->TAIH0WALK0040]
;
		LDA	#taihowalkptn
		STA	<ENWRK0,X
TAIH0WALK0040	EQU	$
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	TAIH0WALKTM,Y
		STA	!ENTIM0,X
		LDA	TAIH0WALKPT,Y
		STA	!ENCHPT,X
		TAY
		LDA	TAIH0_CNTYW,Y
		STA	!ECNTYW,X
;
		M16				; memory 16bit mode !!
;
		LDA	<ENWRK2,X
		BEQ	TAIH0WALK00F0		; プレイヤー乗せてる ? [no->TAIH0WALK00F0]
;
		TYA
		ASL	A
		TAY
		LDA	!ENYPSL,X
		CLC
		ADC	TAIHO_PLHOSEI,Y
		STA	!PLYPSL
TAIH0WALK00F0	EQU	$
		RTS
;
TAIH0WALK0100	EQU	$
		STZ	!ENXSPD,X
		LDA	#taihohshaptn
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	TAIH0HASSHATM,Y
		STA	!ENTIM0,X
		LDA	TAIH0HASSHAPT,Y
		STA	!ENCHPT,X
		TAY
		LDA	TAIH0_CNTYW,Y
		STA	!ECNTYW,X
;
		M16				; memory 16bit mode !!
;
		LDA	<ENWRK2,X
		BEQ	TAIH0WALK01F0		; プレイヤー乗せてる ? [no->TAIH0WALK01F0]
;
		TYA
		ASL	A
		TAY
		LDA	!ENYPSL,X
		CLC
		ADC	TAIHO_PLHOSEI,Y
		STA	!PLYPSL
TAIH0WALK01F0	EQU	$
		LDA	#taihohassha
		STA	<ENCONT,X
		RTS
;
;
TAIH0FUMAREPT	EQU	$
		BYTE	taiho_08, taiho_0C, taiho_0D, taiho_0C
;
TAIH0FUMARETM	EQU	$
		HEX	10, 02, 04, 02
;
TAIH0FUMARE	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	TAIH0FUMARE00F0		; pattern change ? [no->TAIH0FUMARE00F0]
;
		DEC	<ENWRK0,X
		BMI	TAIH0FUMARE0100		; [->TAIH0FUMARE0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	TAIH0FUMARETM,Y
		STA	!ENTIM0,X
		LDA	TAIH0FUMAREPT,Y
		STA	!ENCHPT,X
		TAY
		LDA	TAIH0_CNTYW,Y
		STA	!ECNTYW,X
;
		M16				; memory 16bit mode !!
;
		LDA	<ENWRK2,X
		BEQ	TAIH0FUMARE00F0		; プレイヤー乗せてる ? [no->TAIH0FUMARE00F0]
;
		TYA
		ASL	A
		TAY
		LDA	!ENYPSL,X
		CLC
		ADC	TAIHO_PLHOSEI,Y
		STA	!PLYPSL
TAIH0FUMARE00F0 EQU	$
		RTS
;
TAIH0FUMARE0100 EQU	$
		LDY	!ENMUKI,X
		LDA	TAIHO_XSPD,Y
		STA	!ENXSPD,X
		LDA	#taihowalkptn
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	TAIH0WALKTM,Y
		STA	!ENTIM0,X
		LDA	TAIH0WALKPT,Y
		STA	!ENCHPT,X
		TAY
		LDA	TAIH0_CNTYW,Y
		STA	!ECNTYW,X
;
		M16				; memory 16bit mode !!
;
		LDA	<ENWRK2,X
		BEQ	TAIH0FUMARE0180		; プレイヤー乗せてる ? [no->TAIH0FUMARE0180]
;
		TYA
		ASL	A
		TAY
		LDA	!ENYPSL,X
		CLC
		ADC	TAIHO_PLHOSEI,Y
		STA	!PLYPSL
TAIH0FUMARE0180 EQU	$
		LDA	#taihowalk
		STA	<ENCONT,X
TAIH0FUMARE01F0 EQU	$
		RTS
;
;
TAIH0HASSHAPT	EQU	$
		BYTE	taiho_08, taiho_09, taiho_0B, taiho_0A
		BYTE	taiho_09, taiho_08
;
TAIH0HASSHATM	EQU	$
		HEX	10, 04, 04, 02, 10, 20
;
TAIHOHSHAXPSL	EQU	$
		WORD	-00010H,  00010H
;
TAIHOHSHAXSPD	EQU	$
		WORD	-00200H,  00200H
;
TAIH0HASSHA	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	TAIH0FUMARE01F0		; pattern change ? [no->TAIH0FUMARE01F0]
;
		DEC	<ENWRK0,X
		BMI	TAIH0FUMARE0100		; [->TAIH0FUMARE0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	TAIH0HASSHATM,Y
		STA	!ENTIM0,X
		LDA	TAIH0HASSHAPT,Y
		STA	!ENCHPT,X
		TAY
		LDA	TAIH0_CNTYW,Y
		STA	!ECNTYW,X
;
		M16				; memory 16bit mode !!
;
		LDA	<ENWRK2,X
		BEQ	TAIH0HASSHA0080		; プレイヤー乗せてる ? [no->TAIH0HASSHA0080]
;
		TYA
		ASL	A
		TAY
		LDA	!ENYPSL,X
		CLC
		ADC	TAIHO_PLHOSEI,Y
		STA	!PLYPSL
TAIH0HASSHA0080 EQU	$
		LDA	<ENWRK0,X
		CMP	#taiho_discharge
		BNE	TAIH0HASSHA00F0		; 発射 ? [no->TAIH0HASSHA00F0]
;
		LDY	!ENMUKI,X
		LDA	!ENXPSL,X
		CLC
		ADC	TAIHOHSHAXPSL,Y
		STA	<EWORK
		LDA	TAIHOHSHAXSPD,Y
		STA	<EWORK2
		LDA	#BOMB0
		JSL	>ENINSR
		BCC	TAIH0HASSHA00A0		; 敵確保失敗 ? [yes->TAIH0HASSHA00A0]
;
		LDA	!EWORK
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00010H
		STA	!ENYPSL,Y
		LDA	<EWORK2
		STA	!ENXSPD,Y
		LDA	#-00200H
		STA	!ENYSPD,Y
		LDA	#00001H
		STA	!ENSHOT,Y
;
		LDA	#00047H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		BRA	TAIH0HASSHA00F0
;
TAIH0HASSHA00A0 EQU	$
		LDA	#00042H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
TAIH0HASSHA00F0 EQU	$
		RTS
;
;
TAIH0_PLCRSCK	EQU	$
		LDA	<ENWRK2,X
		CMP	#0001
		BNE	THO_PLCRCK00F0		; プレイヤー乗せフラグ ON ? [yes->THO_PLCRCK00F0]
;
		STZ	!ENXSPD,X
		LDA	#taihofumrptn
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	TAIH0FUMARETM,Y
		STA	!ENTIM0,X
		LDA	TAIH0FUMAREPT,Y
		STA	!ENCHPT,X
		TAY
		LDA	TAIH0_CNTYW,Y
		STA	!ECNTYW,X
;
		M16				; memory 16bit mode !!
;
		LDA	<ENWRK2,X
		BEQ	THO_PLCRCK0080		; プレイヤー乗せてる ? [no->THO_PLCRCK0080]
;
		TYA
		ASL	A
		TAY
		LDA	!ENYPSL,X
		CLC
		ADC	TAIHO_PLHOSEI,Y
		STA	!PLYPSL
THO_PLCRCK0080	EQU	$
		INC	<ENWRK2,X		; プレイヤー乗せフラグセット !!
		LDA	#taihofumare
		STA	<ENCONT,X
		PLA
THO_PLCRCK00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	initial (水ジュゲム)						-
;------------------------------------------------------------------------
jugemu_w00	EQU	000H
jugemu_w01	EQU	001H
jugemu_w02	EQU	002H
jugemu_w03	EQU	003H
jugemu_w04	EQU	004H
jugemu_w05	EQU	005H
jugemu_w06	EQU	006H
jugemu_w07	EQU	007H
jugemu_w08	EQU	008H
jugemu_w09	EQU	009H
jugemu_w0A	EQU	00AH
jugemu_w0B	EQU	00BH
jugemu_w0C	EQU	00CH
jugemu_w0D	EQU	00DH
jugemu_w0E	EQU	00EH
jugemu_w0F	EQU	00FH
jugemu_w10	EQU	010H
jugemu_w11	EQU	011H
jugemu_w12	EQU	012H
;
jgmw_move	EQU	(jgmw_mvmd-JGEMW_MODSEL)
jgmw_throw	EQU	(jgmw_trmd-JGEMW_MODSEL)
;
jugemu_wtime	EQU	08
jugemu_winter	EQU	128
jugemu_winarea	EQU	00020H
jugemu_woutarea EQU	00060H
jugemu_wttearea EQU	00020H
jgmw_throwptn	EQU	(JGEMW_THROWTM-JGEMW_THROWPT-1)
jgmw_release	EQU	(jgmw_throwptn-14)
jgmw_lock	EQU	(jgmw_throwptn-13)
jgmw_eaton	EQU	(jgmw_throwptn-5)
jgmw_eatoff	EQU	(jgmw_throwptn-19)
jgmw_tobi	EQU	(jgmw_throwptn-4)
jgmw_hiko	EQU	(jgmw_throwptn-21)
;
JGEMW_ECNTYW	EQU	$
		WORD	 18H,  18H,  18H,  18H,	 10H,  08H,  04H,  03H
		WORD	 00H,  00H,  00H,  00H,	 00H,  01H,  00H,  04H
		WORD	 08H,  0CH
;
JGEMW_XSPD	EQU	$
		WORD	-00080H,  00080H
;
JGEMWIN		EQU	$
		LDA	#jugemu_wtime
		STA	!ENTIM0,X
		LDA	#jugemu_w00
		STA	!ENCHPT,X
		ASL	A
		TAY
		LDA	JGEMW_ECNTYW,Y
		STA	!ECNTYW,X
		LDA	#0005H
		STA	!EWIDEY,X
		LDY	!ENMUKI,X
		LDA	JGEMW_XSPD,Y
		STA	!ENXSPD,X		; Ｘスピードセット !!
		RTL
;
;
;------------------------------------------------------------------------
;-	move (水ジュゲム)						-
;------------------------------------------------------------------------
JGEMWMV		EQU	$
		LDA	!ENMODE,X
		CMP	#EFALL
		BEQ	JGEMWMV0030		; ショットの敵に当たった ? [yes->JGEMWMV0030]
;
		CMP	#EEATM
		BNE	JGEMWMV0040		; 食べられ中 ? [no->JGEMWMV0040]
;
JGEMWMV0030	EQU	$
		LDA	#jugemu_w12
		STA	!ENCHPT,X
JGEMWMV0040	EQU	$
		LDA	!ENCHPT,X
		CMP	#jugemu_w0B
		BNE	JGEMWMV0080		; アトリビュートチェンジ ? [no->JGEMWMV0080]
;
		LDA	<FRCNT2
		AND	#00006H
		TAY
		LDA	JUGEMUCOLOR,Y
		STA	<EWORK
;
		I16				; index 16bit mode !!
;
		LDY	!ENOAML,X
		LDA	!SOAM_DX+14H,Y
		AND	#0F1FFH
		ORA	<EWORK
		STA	!SOAM_DX+14H,Y
;
		I8				; index 8bit mode !!
;
JGEMWMV0080	EQU	$
		JSL	>ENMDCK			; mode check
;
		JSR	JGMW_BGCHK		; ＢＧチェック !!
;
		LDA	<ENCONT,X
		TAX
		JSR	(JGEMW_MODSEL,X)
;
		JSL	>EPCRCK
;
		RTL
;
JGEMW_MODSEL	EQU	$
jgmw_mvmd	WORD	JGEMW_MVUW
jgmw_trmd	WORD	JGEMW_THROW
;
JGEMW_MVUW	EQU	$
		LDX	<ENINDX
		JSR	JGEMW_THROWCK
;
		LDA	!ENTIM0,X
		BNE	JGEMW_MVUW00F0		; pattern change ? [no->JGEMW_MVUW00F0]
;
		LDA	#jugemu_wtime
		STA	!ENTIM0,X
		LDA	!ENCHPT,X
		INC	A
		AND	#00001H
		STA	!ENCHPT,X
		ASL	A
		TAY
		LDA	JGEMW_ECNTYW,Y
		STA	!ECNTYW,X
JGEMW_MVUW00F0	EQU	$
		RTS
;
;
JGEMW_THROWPT	EQU	$
		BYTE	jugemu_w01, jugemu_w02, jugemu_w03, jugemu_w11
		BYTE	jugemu_w10, jugemu_w0F, jugemu_w0D, jugemu_w0E
		BYTE	jugemu_w0D, jugemu_w0C, jugemu_w0B, jugemu_w09
		BYTE	jugemu_w08, jugemu_w09, jugemu_w0A, jugemu_w09
		BYTE	jugemu_w08, jugemu_w07, jugemu_w06, jugemu_w05
		BYTE	jugemu_w04, jugemu_w03, jugemu_w02, jugemu_w01
;
JGEMW_THROWTM	EQU	$
		HEX	04, 04, 38, 02, 02, 02, 02, 04
		HEX	02, 20, 40, 20, 04, 02, 02, 02
		HEX	02, 02, 02, 02, 02, 20, 02, 02
;
JUGEMU_W_XSPD	EQU	$
		WORD	-00200H,  00200H
;
JGMW_TARGETX	EQU	$
		WORD	-00040H,  00040H
;
JGEMW_THROW0100 EQU	$
		LDA	#jugemu_wtime
		STA	!ENTIM0,X
		LDA	#jugemu_w00
		STA	!ENCHPT,X
		ASL	A
		TAY
		LDA	JGEMW_ECNTYW,Y
		STA	!ECNTYW,X
;[1994.10.12.WE]		LDA	!ENMOD0,X
;[1994.10.12.WE]		ORA	#1100000001100000B
;[1994.10.12.WE]		STA	!ENMOD0,X		; 横当たり無し＆食べれない＆投げた敵に当たらないセット !!
;[1994.10.12.WE]		LDA	!ENMOD2,X
;[1994.10.12.WE]		AND	#1111111011111111B
;[1994.10.12.WE]		STA	!ENMOD2,X		; 照準合わないセット !!
		LDA	#jugemu_winter
		STA	!ENTIM1,X
		LDY	!ENMUKI,X
		LDA	JGEMW_XSPD,Y
		STA	!ENXSPD,X		; Ｘスピードセット !!
		LDA	#jgmw_move
		STA	<ENCONT,X
		RTS
;
JGEMW_THROW	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BEQ	JGEMW_THROW0020		; pattern change ? [yes->JGEMW_THROW0020]
;
		JMP	JGEMW_THROW00C0		; pattern change ? [no->JGEMW_THROW00C0]
;
JGEMW_THROW0020 EQU	$
		DEC	<ENWRK0,X
		BMI	JGEMW_THROW0100		; 投げ終り ? [yes->JGEMW_THROW0100]
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK0,X
		LDA	JGEMW_THROWTM,Y
		STA	!ENTIM0,X
		LDA	JGEMW_THROWPT,Y
		STA	!ENCHPT,X
		ASL	A
		TAY
;
		M16				; memory 16bit mode !!
;
		LDA	JGEMW_ECNTYW,Y
		STA	!ECNTYW,X
		LDA	<ENWRK0,X
		CMP	#jgmw_tobi
		BNE	JGEMW_THROW0050		; 浮上 ? [no->JGEMW_THROW0050]
;
		LDA	#PICHA
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	#00008H
		STA	!EXYPSL,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	#0005
		STA	!EXCHPT,Y
;
		LDA	#00003H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		RTS
;
JGEMW_THROW0050 EQU	$
		CMP	#jgmw_hiko
		BNE	JGEMW_THROW0058		; 潜水 ? [no->JGEMW_THROW0058]
;
		LDA	#WTUP0
		JSL	>EXINSR
;
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00008H
		STA	!EXYPSL,Y
		LDA	#WUP0P
		STA	!EXWRK0,Y
		LDA	#0003
		STA	!EXTIM0,Y
;
		LDA	#00003H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		RTS
;
JGEMW_THROW00C0 EQU	$
		LDA	<ENWRK0,X
JGEMW_THROW00D0 EQU	$
		CMP	#jgmw_lock
		BNE	JGEMW_THROW00F0		; ターゲットスコープオープン ? [no->JGEMW_THROW00F0]
;
JGEMW_THROW00E0 EQU	$
		LDY	!ENMUKI,X
		LDA	!ENXPSL,X
		CLC
		ADC	JGMW_TARGETX,Y
		STA	<EWORK			; Ｘ座標セット!!
		LDA	!ENYPSL,X
		SEC
		SBC	#00010H
		STA	<EWORK2			; Ｙ座標セット!!
		LDA	!ENWRK8,X
		STA	<EWORK4			; カウンターセット !!
		JSL	>TARGET_ON		; lock on !!
;
		LDA	!ENWRK8,X
		INC	A
		CMP	#00020H
		BCS	JGEMW_THROW00F0		; カウンターＭＡＸ ? [yes->JGEMW_THROW00F0]
;
		STA	!ENWRK8,X
JGEMW_THROW00F0 EQU	$
		RTS
;
JGEMW_THROW0058 EQU	$
		CMP	#jgmw_eaton
		BNE	JGEMW_THROW0060		; 敵状態セット ? [no->JGEMW_THROW0060]
;
		LDA	!ENMOD0,X
		AND	#0111111110011111B
		STA	!ENMOD0,X		; 横当たる＆食べれる＆投げた敵に当たるセット !!
		LDA	!ENMOD2,X
		ORA	#0000000100000000B
		STA	!ENMOD2,X		; 照準合うセット !!
		RTS
;
JGEMW_THROW0060 EQU	$
		CMP	#jgmw_eatoff
		BNE	JGEMW_THROW0070		; 敵状態リセット ? [no->JGEMW_THROW0070]
;
		LDA	!ENMOD0,X
		ORA	#1100000001100000B
		STA	!ENMOD0,X		; 横当たり無し＆食べれない＆投げた敵に当たらないセット !!
		LDA	!ENMOD2,X
		AND	#1111111011111111B
		STA	!ENMOD2,X		; 照準合わないセット !!
		RTS
;
JGEMW_THROW0070 EQU	$
		CMP	#jgmw_lock
		BNE	JGEMW_THROW0080		; ターゲットスコープオープン ? [no->JGEMW_THROW0080]
;
		STZ	!ENWRK8,X
		BRA	JGEMW_THROW00E0
;
JGEMW_THROW0080 EQU	$
		CMP	#jgmw_release
		BNE	JGEMW_THROW00D0		; リリースポイント ? [no->JGEMW_THROW00D0]
;
		LDY	!ENMUKI,X
		LDA	!ENXPSL,X
		CLC
		ADC	JGMW_TARGETX,Y
		STA	<EWORK			; Ｘ座標セット!!
		LDA	!ENYPSL,X
		SEC
		SBC	#00014H
		STA	<EWORK2			; Ｙ座標セット!!
		LDA	!ENWRK8,X
		STA	<EWORK4			; カウンターセット !!
		JSL	>TARGET_ON2		; lock on !!
;
		LDY	!ENMUKI,X
		LDA	JUGEMU_W_XSPD,Y
		STA	<EWORK
		LDA	#JTAM2
		JSL	>ENINSR
		BCC	JGEMW_THROW00F0		; スカ ? [yes->JGEMW_THROW00F0]
;
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00010H
		STA	!ENYPSL,Y
		LDA	<EWORK
		STA	!ENXSPD,Y
		RTS
;
;
JGEMW_THROWCK	EQU	$
		LDA	!ENTIM1,X
		BNE	JGEMW_TRWCK00F0		; 投げ ? [no->JGEMW_TRWCK00F0]
;
		LDA	!ECENTX,X
		SEC
		SBC	!PCENTX
		CLC
		ADC	#jugemu_winarea
		CMP	#jugemu_winarea*2
		BCC	JGEMW_TRWCK00F0		; 浮上禁止領域 ? [yes->JGEMW_TRWCK00F0]
;
		SEC
		SBC	#jugemu_winarea
		CLC
		ADC	#jugemu_woutarea
		CMP	#jugemu_woutarea*2
		BCS	JGEMW_TRWCK00F0		; 浮上禁止領域 ? [yes->JGEMW_TRWCK00F0]
;
		LDA	!ECENTY,X
		SEC
		SBC	!PCENTY
		CLC
		ADC	#jugemu_wttearea
		CMP	#jugemu_wttearea*2
		BCS	JGEMW_TRWCK00F0		; 浮上禁止領域 ? [yes->JGEMW_TRWCK00F0]
;
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	!ENMUKI,X
		STZ	!ENXSPD,X
		LDA	#jgmw_throwptn
		STA	<ENWRK0,X
;
		M8				; memory 8bit mode !!
;
		TAY
		LDA	JGEMW_THROWTM,Y
		STA	!ENTIM0,X
		LDA	JGEMW_THROWPT,Y
		STA	!ENCHPT,X
		ASL	A
		TAY
;
		M16				; memory 16bit mode !!
;
		LDA	JGEMW_ECNTYW,Y
		STA	!ECNTYW,X
;[1994.10.12.WE]		LDA	!ENMOD0,X
;[1994.10.12.WE]		AND	#0111111110011111B
;[1994.10.12.WE]		STA	!ENMOD0,X		; 横当たる＆食べれる＆投げた敵に当たるセット !!
;[1994.10.12.WE]		LDA	!ENMOD2,X
;[1994.10.12.WE]		ORA	#0000000100000000B
;[1994.10.12.WE]		STA	!ENMOD2,X		; 照準合うセット !!
		LDA	#jgmw_throw
		STA	<ENCONT,X
		PLA
JGEMW_TRWCK00F0 EQU	$
		RTS
;
;
JGMW_BGCHKPNT	EQU	$
		WORD	00000H, 00010H
;
JGMW_BGCHK	EQU	$
		LDY	!ENMUKI,X
		LDA	!ENXPSL,X
		CLC
		ADC	JGMW_BGCHKPNT,Y
		STA	R8			; チェック座標 Ｘ !!
		LDA	!ENYPSL,X
		CLC
		ADC	#00008H
		STA	R0			; チェック座標 Ｙ !!
		M_CHIPR M_BGUNIT_READ
;
		LDX	<ENINDX
		LDA	R6			; unit no. read !!
		CMP	#UT77C9
		BCC	JGMW_BGCHK0080		; 水流ユニット ? [no->JGMW_BGCHK0080]
;
		CMP	#UT77CC+1
		BCC	JGMW_BGCHK00F0		; 水流ユニット ? [yes->JGMW_BGCHK00F0]
;
		CMP	#UT77D7
		BCC	JGMW_BGCHK0080		; 水流ユニット ? [no->JGMW_BGCHK0080]
;
		CMP	#UT77DC+1
		BCC	JGMW_BGCHK00F0		; 水流ユニット ? [yes->JGMW_BGCHK00F0]
;
JGMW_BGCHK0080	EQU	$
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
		LDA	!ENXSPD,X
		EOR	#0FFFFH
		INC	A
		STA	!ENXSPD,X
		LDA	!ENXPSL,X
		SEC
		SBC	!ENMOVX,X
		STA	!ENXPSL,X
		LDA	!ECENTX,X
		SEC
		SBC	!ENMOVX,X
		STA	!ECENTX,X
JGMW_BGCHK00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;-	fail (水ジュゲム)						-
;------------------------------------------------------------------------
JGEMWFL		EQU	$
		LDA	#jugemu_w12
		STA	!ENCHPT,X
		RTL
;
;
;------------------------------------------------------------------------
;-	initial (雷ジュゲム)						-
;------------------------------------------------------------------------
thunder_00	EQU	000H
thunder_01	EQU	001H
thunder_02	EQU	002H
thunder_03	EQU	003H
thunder_04	EQU	004H
thunder_05	EQU	005H
;
thunder_jgmcyp	EQU	030H
thunder_jgmcys	EQU	00100H
thjgm_flushtm	EQU	030H
thjgm_nagetim	EQU	030H
;
thunder_look	EQU	(thjgm_lookmd-THJGMMODSEL)
thunder_charge	EQU	(thjgm_crgemd-THJGMMODSEL)
thunder_flush	EQU	(thjgm_flshmd-THJGMMODSEL)
thunder_thunder EQU	(thjgm_tndrmd-THJGMMODSEL)

;
THJGMIN		EQU	$
		LDA	#0001
		STA	!TJGM_ST_FG		; 雷ジュゲムわきだしフラグセット !!
;
		LDA	!MANSEL
		STA	<ENWRK2,X
;
		LDA	#00010H
		STA	!ENXPOW,X
		STA	!ENGPOW,X
		LDA	#00200H
		STA	!ENGMAX,X
		STA	!ENXMAX,X
;
		LDA	!ENXPSL,X
		AND	#00010H
		BEQ	THJGMIN00F0		; 二匹目セット ? [no->THJGMIN00F0]
;
		LDY	!SCHMK1
		LDA	!SCCH1
		CLC
		ADC	THJGM_SETPOS,Y
		STA	<EWORK
		LDA	#THJGM
		JSL	>ENINSR
		BCC	THJGMIN00F0		; 失敗 ? [yes->THJGMIN00F0]
;
		LDA	!MANSEL
		STA	!ENWRK2,Y
;
		LDA	<EWORK
		STA	!ENXPSL,Y
		LDA	!SCCV1
		SEC
		SBC	#00030H
		STA	!ENYPSL,Y
		LDA	#00010H
		STA	!ENXPOW,Y
		STA	!ENGPOW,Y
		LDA	#00200H
		STA	!ENGMAX,Y
		STA	!ENXMAX,Y
THJGMIN00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	move (雷ジュゲム)						-
;------------------------------------------------------------------------
THJGMMV		EQU	$
		LDA	!ENMODE,X
		CMP	#EMOVE
		BNE	THJGMMV0020		; mode move ? [no->THJGMMV0020]
;
		JSR	THJGM_CLOUDCHG
		BRA	THJGMMV0040
;
THJGMMV0020	EQU	$
		PHA
		JSR	MODE_RESET
;
		PLA
		CMP	#EEATM
		BNE	THJGMMV0040		; 食べられ中 ? [no->THJGMMV0040]
;
THJGM_EAT	EQU	$
		LDA	#KINTO
		JSL	>ENINSR
;
		BCC	THJGM_EAT0080		; エリア確保失敗 ? [yes->THJGM_EAT0080]
;
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	#00008H
		STA	!ENYPSL,Y
		LDA	#EEATM
		STA	!ENMODE,Y
		TYA
		AND	#000FFH
		INC	A
		STA	!EATFLG
		LDA	!ENMOD2,Y
		AND	#0FFF3H			; 範囲クリアオフ !!
		STA	!ENMOD2,Y
		TXA
		INC	A
		STA	!ENCONT,Y
;
		LDA	#EFAIL
		STA	!ENMODE,X
		JSL	>THJGMFLIN0080
;
		BRA	THJGM_EAT00A0
;
THJGM_EAT0080	EQU	$
		STZ	!EATFLG
THJGM_EAT00A0	EQU	$
		STZ	!EATSTP
		PLA
		PLY
;
THJGMMV0040	EQU	$
		JSL	>ENMDCK			; mode check
;
		JSL	>THJGM_ENCRS		; 衝突チェック !!
;
		LDA	<ENCONT,X
		TAX
		JSR	(THJGMMODSEL,X)
;
		LDA	!TJGM_ST_FG
		BNE	THJGMMV0060		; バイバイ ? [no->THJGMMV0060]
;
		LDA	#0F800H
		STA	!ENGMAX,X
		STA	!ENXMAX,X
		LDA	!ENMOD2,X
		ORA	#0000000000000100B
		STA	!ENMOD2,X
THJGMMV0060	EQU	$
		LDA	<FRCNT2
		AND	#00007H
		BNE	THJGMMV0080		; ちぎれ雲セット ? [no->THJGMMV0080]
;
		LDA	#KINTS
		JSL	>EXINSR
;
		LDA	#0002
		STA	!EXCHPT,Y
		LDA	#0008
		STA	!EXTIM0,Y
		LDA	!ENXPSL,X
		SEC
		SBC	!ENMOVX,X
		STA	!EXXPSL,Y
		LDA	<RANDM0
		AND	#00007H
		CLC
		ADC	!ENYPSL,X
		CLC
		ADC	#00008H
		SEC
		SBC	!ENMOVY,X
		STA	!EXYPSL,Y
THJGMMV0080	EQU	$
		JSL	>EPCRCK
;
		RTL
;
THJGMMODSEL	EQU	$
thjgm_lookmd	WORD	THJGM_LOOK
thjgm_crgemd	WORD	THJGM_CRGE
thjgm_flshmd	WORD	THJGM_FLSH
thjgm_tndrmd	WORD	THJGM_TNDR
;
;
THJGMCKXPOS	EQU	$
		WORD	00030H, -00030H
;
THJGM_XPOW	EQU	$
		WORD	00008H, 00010H
;
THJGM_XMAX	EQU	$
		WORD	00200H, -00200H
;
THJGM_GPOW	EQU	$
		WORD	00008H, 00010H
;
THJGM_GMAX	EQU	$
		WORD	00200H, -00200H
;
THJGM_LOOK	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM1,X
		BNE	THJGM_MOVE		; 雷セットＯＫ ? [no->THJGM_MOVE]
;
		LDA	!ENDSXL,X
		SEC
		SBC	#00010H
		CMP	#000D0H
		BCS	THJGM_MOVE		; 雷セットＯＫ ? [no->THJGM_MOVE]
;
		LDA	!ENDSYL,X
		CMP	#00080H
		BCS	THJGM_MOVE		; 雷セットＯＫ ? [no->THJGM_MOVE]
;
		LDA	#thunder_01
		STA	!ENCHPT,X
		STZ	!ENXPOW,X
		STZ	!ENXSPD,X
		STZ	!ENGPOW,X
		STZ	!ENYSPD,X
		STA	<ENWRK0,X
		LDA	#thunder_charge
		STA	<ENCONT,X
		RTS
;
THJGM_MOVE	EQU	$
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	!ENMUKI,X
		LDY	#00
		DEC	A
		EOR	!ENXSPD,X
		BPL	THJGM_MOVE0020		; 減速 ? [no->THJGM_MOVE0020]
;
		INY
		INY
THJGM_MOVE0020	EQU	$
		LDA	THJGM_XPOW,Y
		STA	!ENXPOW,X
		LDA	!ENXSPD,X
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAY
		LDA	!PLXPSL
		CLC
		ADC	THJGMCKXPOS,Y
		LDY	#00
		CMP	!ENXPSL,X
		BPL	THJGM_MOVE0040		; 左 ? [yes->THJGM_MOVE0040]
;
		INY
		INY
THJGM_MOVE0040	EQU	$
		LDA	THJGM_XMAX,Y
		STA	!ENXMAX,X
;
		LDA	!ENYSPD,X
		ABS16
		CMP	#thunder_jgmcys
		BCC	THJGM_MOVE0068		; [->THJGM_MOVE0068]
;
		LDY	#00
		LDA	!ENDSYL,X
		CMP	#thunder_jgmcyp
		BMI	THJGM_MOVE0060		; 上 ? [yes->THJGM_MOVE0060]
;
		INY
		INY
THJGM_MOVE0060	EQU	$
		LDA	THJGM_GMAX,Y
		STA	!ENGMAX,X
THJGM_MOVE0068	EQU	$
		LDY	#00
		LDA	!ENDSYL,X
		SEC
		SBC	#thunder_jgmcyp
		EOR	!ENYSPD,X
		BMI	THJGM_MOVE0070		; 減速 ? [no->THJGM_MOVE0070]
;
		INY
		INY
THJGM_MOVE0070	EQU	$
		LDA	THJGM_GPOW,Y
		STA	!ENGPOW,X
;
		LDA	!ENDSXL,X
		CLC
		ADC	#00080H
		CMP	#00200H
		BCC	THJGM_MOVE0080		; Ｘマックススピード倍 ? [no->THJGM_MOVE0080]
;
		LDA	!ENXMAX,X
		CLC
		ADC	#00800H
		CMP	#01000H
		BCS	THJGM_MOVE0080		; [->THJGM_MOVE0080]
;
		LDA	!ENXMAX,X
		ASL	A
		ASL	A
		STA	!ENXMAX,X
THJGM_MOVE0080	EQU	$
		LDA	!ENDSYL,X
		CLC
		ADC	#00080H
		CMP	#00200H
		BCC	THJGM_MOVE00A0		; Ｙマックススピード倍 ? [no->THJGM_MOVE00A0]
;
		LDA	!ENGMAX,X
		CLC
		ADC	#00800H
		CMP	#01000H
		BCS	THJGM_MOVE00A0		; [->THJGM_MOVE00A0]
;
		LDA	!ENGMAX,X
		ASL	A
		ASL	A
		STA	!ENGMAX,X
THJGM_MOVE00A0	EQU	$
		RTS
;
;
GENKIDAMACOL	EQU	$
		WORD	00003H<<1, 00006H<<1
;
GENKIDAMAXPS	EQU	$
		WORD	-00002H,  00002H
;
GOKOU_XPOS	EQU	$
		WORD	00006H, 0000CH
;
CHARGE_TIME	EQU	$
		WORD	0001FH, 0001FH, 0001FH, 0001FH, 0001FH, 0001FH
;
THJGM_CRGE	EQU	$
		LDX	<ENINDX
		LDA	<ENWRK0,X
		PHA
		AND	#00004H
		LSR	A
		TAY
		LDA	GENKIDAMACOL,Y
		STA	<EWORK
		PLA
		LSR	A
		LSR	A
		LSR	A
		LSR	A
		CMP	#0005
		BCC	THJGM_CRGE0080		; max number ? [no->THJGM_CRGE0080]
;
		LDA	#0005
THJGM_CRGE0080	EQU	$
		STA	<EWORK2
		ASL	A
		TAY
		LDA	<ENWRK0,X
		AND	CHARGE_TIME,Y
		BNE	THJGM_CRGE0090		; [->THJGM_CRGE0090]
;
		LDA	#00051H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
THJGM_CRGE0090	EQU	$
		LDY	!ENMUKI,X
		LDA	!ENXPSL,X
		CLC
		ADC	GENKIDAMAXPS,Y
		STA	<EWORK4
		LDA	#SBALL
		JSL	>EXINSR
;
		LDA	<EWORK2
		STA	!EXCHPT,Y
		LDA	#0001H
		STA	!EXTIM0,Y
		LDA	<EWORK4
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00018H
		STA	!EXYPSL,Y
		LDA	!EXCLOR,Y
		AND	#0FFF1H
		ORA	<EWORK
		STA	!EXCLOR,Y
;
		LDY	!ENMUKI,X
		LDA	!ENXPSL,X
		CLC
		ADC	GOKOU_XPOS,Y
		STA	<EWORK
		LDA	#GOKOU
		JSL	>EXINSR
;
		LDA	<ENWRK0,X
		LSR	A
		AND	#00007H
		STA	!EXCHPT,Y
		LDA	#0001H
		STA	!EXTIM0,Y
		LDA	<EWORK
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00020H
		STA	!EXYPSL,Y
;
		LDA	<ENWRK0,X
		INC	A
		CMP	#00080H
		BCS	THJGM_CRGE0100		; [->THJGM_CRGE0100]
;
		STA	<ENWRK0,X
		RTS
;
THJGM_CRGE0100	EQU	$
;---- Test !! ----
		LDA	#07FFFH
		STA	>DATACOL
		LDA	!MANSEL
		STA	<ENWRK2,X
		AND	#0000FH
		XBA
		ORA	#00010H
		STA	!MANSEL
;-----------------
		LDA	#thunder_02
		STA	!ENCHPT,X
		LDA	#thjgm_flushtm
		STA	!ENTIM0,X
		LDA	#thunder_flush
		STA	<ENCONT,X
		RTS
;
;
FLUSHCOL	EQU	$
		WORD	00000H, 07FFFH
;
THJGM_FLSH	EQU	$
		LDX	<ENINDX
		LDA	<FRCNT2
		AND	#00007H
		BNE	THJGM_FLSH0040		; [->THJGM_FLSH0040]
;
		LDA	#00051H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
THJGM_FLSH0040	EQU	$
		LDA	!ENCHPT,X
		AND	#00001H
		ASL	A
		TAY
		LDA	GENKIDAMACOL,Y
		STA	<EWORK
		LDA	#SBALL
		JSL	>EXINSR
;
		LDA	#0005
		STA	!EXCHPT,Y
		LDA	#0001H
		STA	!EXTIM0,Y
		LDA	!ENXPSL,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		SEC
		SBC	#00018H
		STA	!EXYPSL,Y
		LDA	!EXCLOR,Y
		AND	#0FFF1H
		ORA	<EWORK
		STA	!EXCLOR,Y
;
;[1994.10.15.SA]		LDA	#GOKOU
;[1994.10.15.SA]		JSL	>EXINSR
;[1994.10.15.SA];
;[1994.10.15.SA]		LDA	<ENWRK0,X
;[1994.10.15.SA]		LSR	A
;[1994.10.15.SA]		AND	#00007H
;[1994.10.15.SA]		STA	!EXCHPT,Y
;[1994.10.15.SA]		LDA	#0001H
;[1994.10.15.SA]		STA	!EXTIM0,Y
;[1994.10.15.SA]		LDA	!ENXPSL,X
;[1994.10.15.SA]		STA	!EXXPSL,Y
;[1994.10.15.SA]		LDA	!ENYPSL,X
;[1994.10.15.SA]		SEC
;[1994.10.15.SA]		SBC	#00018H
;[1994.10.15.SA]		STA	!EXYPSL,Y
;
		LDA	!ENTIM0,X
		BEQ	THJGM_FLSH0100		; [->THJGM_FLSH0100]
;
		AND	#00003H
		BNE	THJGM_FLSH00F0		; pattern change ? [no->THJGM_FLSH00F0]
;
		LDA	!ENCHPT,X
		EOR	#00001H
		STA	!ENCHPT,X
;---- Test !! ----
		LDA	!SUBADF
		EOR	#00080H
		STA	!SUBADF
;-----------------
THJGM_FLSH00F0	EQU	$
		RTS
;
THJGM_FLSH0100	EQU	$
;---- Test !! ----
		JSR	MODE_RESET
;
;-----------------
		LDA	#thjgm_nagetim
		STA	!ENTIM0,X
		LDA	#thunder_04
		STA	!ENCHPT,X
		LDA	#thunder_thunder
		STA	<ENCONT,X
;
		LDA	#GENKI
		JSL	>ENINSR
		BCC	THJGM_FLSH01F0		; スカ ? [yes->THJGM_FLSH01F0]
;
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		STA	!ENYPSL,Y
		LDA	#00005H
		STA	!ENCHPT,Y
		LDA	#00200H
		STA	!ENYSPD,Y
THJGM_FLSH01F0	EQU	$
		RTS
;
;
RESETMAX	EQU	$
		WORD	-00200H, 00200H
;
THJGM_TNDR	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	THJGM_TNDR00F0		; [->THJGM_TNDR00F0]
;
		LDA	<RANDM0
		AND	#0007FH
		CLC
		ADC	#sec02
		STA	!ENTIM1,X
		LDA	#00010H
		STA	!ENXPOW,X
		STA	!ENGPOW,X
		LDA	<RANDM0
		AND	#00001H
		ASL	A
		TAY
		LDA	RESETMAX,Y
		STA	!ENXMAX,X
		LDA	<RANDM0
		AND	#00002H
		TAY
		LDA	RESETMAX,Y
		STA	!ENGMAX,X
		LDA	#thunder_00
		STA	!ENCHPT,X
		LDA	#thunder_look
		STA	<ENCONT,X
THJGM_TNDR00F0	EQU	$
		RTS
;
;
THJGM_CLOUDNUM	EQU	$
		WORD	0000AH, 0000AH, 0000AH, 00022H, 0000AH
;
THJGM_CLOUDCHG	EQU	$
		LDA	<FRCNT2
		AND	#00008H
		BEQ	THJGM_CCHG00F0		; 雲データチェンジ ? [no->THJGM_CCHG00F0]
;
		LDA	!ENCHPT,X
		CMP	#thunder_05
		BCS	THJGM_CCHG00F0		; 雲データチェンジ ? [no->THJGM_CCHG00F0]
;
		ASL	A
		TAY
		LDA	!ENCHRB,X
		AND	#000FFH
		ASL	A
		ASL	A
		ASL	A
		CLC
		ADC	THJGM_CLOUDNUM,Y
		STA	<EWORK
;
		I16				; index 16bit mode !!
;
		LDA	!ENOAML,X
		CLC
		ADC	#1*8
		TAY
		LDA	!SOAM_DX+4,Y
		AND	#0FE00H
		ORA	<EWORK
		STA	!SOAM_DX+4,Y
		TYA
		CLC
		ADC	#00008H
		TAY
		LDA	!SOAM_DX+4,Y
		AND	#0FE00H
		ORA	<EWORK
		STA	!SOAM_DX+4,Y
;
		I8				; index 8bit mode !!
;
THJGM_CCHG00F0	EQU	$
		RTS
;
;
THJGM_ENCRS	EQU	$
		LDY	!ECRSFG,X
		DEY
		BEQ	THJGM_ENCRS00F0		; 赤ちゃん ? [yes->THJGM_ENCRS00F0]
		BMI	THJGM_ENCRS00F0		; 敵と衝突無し ? [yes->THJGM_ENCRS00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	THJGM_ENCRS00F0		; mode move ? [no->THJGM_ENCRS00F0]
;
		LDA	!ENSHOT,Y
		BEQ	THJGM_ENCRS00F0		; ショット ? [no->THJGM_ENCRS00F0]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
		LDA	!ECENTX,X
		STA	<EWORK
		LDA	!ECENTY,X
		STA	<EWORK2
		LDA	#FSMK0
		JSL	>FSMK0_SET2
;
		LDA	#EFAIL
		STA	!ENMODE,X
		JSL	>THJGMFLIN0080
;
		PLY
		PLA
THJGM_ENCRS00F0 EQU	$
		RTL
;
;
MODE_RESET	EQU	$
		LDA	!SUBADF
		AND	#0FF7FH
		STA	!SUBADF
		LDA	>MOTOCOL
		STA	>DATACOL
		LDA	<ENWRK2,X
		STA	!MANSEL
		RTS
;
;
;------------------------------------------------------------------------
;-	fail (雷ジュゲム)						-
;------------------------------------------------------------------------
THJGMFL		EQU	$
		LDA	!ENWRK6,X
		TAX
		JMP	(THJGMFLMODSEL,X)
;
THJGMFLMODSEL	EQU	$
		WORD	THJGMFLIN
		WORD	THJGMFLMV
		WORD	THJGMFLWT
;
;
THJGMFLIN	EQU	$
		LDX	<ENINDX
		LDA	#KINTO
		JSL	>ENINSR_I
		BCC	THJGMFLIN0080		; 雲セット失敗 ? [yes->THJGMFLIN0080]
;
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	#00008H
		STA	!ENYPSL,Y
		TXA
		INC	A
		STA	!ENCONT,Y
THJGMFLIN0080	EQU	$
		JSR	MODE_RESET
;
		LDA	#thunder_05
		STA	!ENCHPT,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#00400H
		STA	!ENGMAX,X
		LDA	#00100H
		STA	!ENYSPD,X
		INC	!ENWRK6,X
		INC	!ENWRK6,X
		RTL
;
;
THJGMFLMV	EQU	$
		LDX	<ENINDX
		LDA	!ENDSXL,X
		CLC
		ADC	#00050H
		CMP	#00190H
		BCS	THJGMFLMV0040		; 範囲外 ? [yes->THJGMFLMV0040]
;
		LDA	!ENDSYL,X
		CLC
		ADC	#00050H
		CMP	#00190H
		BCC	THJGMFLMV00F0		; 範囲外 ? [no->THJGMFLMV00F0]
;
THJGMFLMV0040	EQU	$
		STZ	!ENGPOW,X
		STZ	!ENYSPD,X
		STZ	!ENXSPD,X
		LDA	#-1
		STA	!ENYUSN,X
		LDA	#sec10
		STA	!ENTIM0,X
		INC	!ENWRK6,X
		INC	!ENWRK6,X
THJGMFLMV00F0	EQU	$
		RTL
;
;
THJGM_SETPOS	EQU	$
		WORD	-00030H, 00110H
;
THJGMFLWT	EQU	$
		LDX	<ENINDX
		LDA	!ENTIM0,X
		BNE	THJGMFLWT00F0		; 再セット ? [no->THJGMFLWT00F0]
;
		LDY	!SCHMK1
		LDA	!SCCH1
		CLC
		ADC	THJGM_SETPOS,Y
		STA	!ENXPSL,X
		LDA	!SCCV1
		SEC
		SBC	#00030H
		STA	!ENYPSL,X
		LDA	#00010H
		STA	!ENXPOW,X
		STA	!ENGPOW,X
		LDA	#00200H
		STA	!ENGMAX,X
		STA	!ENXMAX,X
		LDA	#00005H
		STA	!ENYUSN,X
		STZ	<ENCONT,X
		STZ	!ENCHPT,X
		STZ	!ENWRK6,X
		LDA	#EMOVE
		STA	!ENMODE,X
THJGMFLWT00F0	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_KN2MV		EQU	$
P_KUNMV		EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JSR	(P_KUNMVMODSEL,X)
;
		LDY	<ENCONT,X
		BEQ	P_KUNMV00F0		; [->P_KUNMV00F0]
		DEY
		DEY
		BNE	P_KUNMV00F0
;
		JSL	>EPCRCK
;
P_KUNMV00F0	EQU	$
		RTL
;
P_KUNMVMODSEL	EQU	$
		WORD	P_KUN_FALL
		WORD	P_KUN_WALK
		WORD	P_KUN_FALL2
;
;
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	#FSMK0
		JSL	>EXINSR
;
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	!ECENTY,X
		STA	!EXYPSL,Y
		LDA	#0003
		STA	!EXTIM0,Y
		LDA	#0006
		STA	!EXCHPT,Y
		STA	!EXWRK0,Y
;
		LDA	!ENMOD1,X
		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
		LDA	#0032
		STA	!ENTIM0,X
		LDA	#0001
		STA	<ENWRK0,X
		LDA	!EPXMUK,X
		AND	#000FFH
		STA	!ENMUKI,X		; 向きセット !!
		INC	<ENCONT,X
		INC	<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_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 (風船)							-
;------------------------------------------------------------------------
fusen_chkarea	EQU	00040H
;
FUSN_COLOR	EQU	$
		BYTE	000H<<1, 001H<<1, 002H<<1, 004H<<1
;
FUSEN_XSPD	EQU	$
		WORD	-00040H,  00040H
;
FUSN7IN		EQU	$
		LDA	#(07H<<1)
		BRA	FUSN5IN0000
;
FUSN6IN		EQU	$
		JSL	>EXIST_CHECK2
		BEQ	FUSN6IN0040		; 鍵取った？ [no->FUSN6IN0040]
;
		JMP	>ENCLEAR
;
FUSN6IN0040	EQU	$
		LDA	!ENXPSL,X
		ASL	A
		ASL	A
		ASL	A
		ASL	A
		AND	#0FF00H
		STA	<EWORK
		LDA	!ENYPSL,X
		LSR	A
		LSR	A
		LSR	A
		LSR	A
		AND	#000FFH
		ORA	<EWORK
		STA	!ENWRK8,X
		LDA	#(06H<<1)
		BRA	FUSN5IN0000
;
FUSN5IN		EQU	$
		LDA	#(05H<<1)
FUSN5IN0000	EQU	$
		STA	!ENWRK6,X
		LDA	!ENMUKI,X
		STA	<ENWRK4,X		; 風船向きセット !!
		TAY
		STZ	!ENMUKI,X
		BRA	FUSN0IN0040
;
FUSN4IN		EQU	$
		JSL	>TROBJ_SR_4x4_CL
;
		LDA	#00100H			;(R6) <- 倍率
		STA	R6			;
;
		LDA	#BANK CIPCHD3+40E0H+000 ;chara data bank set
		STA	R13
		LDA	#CIPCHD3+40E0H+000	;chara data address set
		STA	R12
;
		LDA	#00010H			;(R8) <- 中心Ｘ　ＰＯＳ．
		STA	R8			;
		STA	R9			;(R9) <- 中心Ｙ　ＰＯＳ．
;
		LDY	ENTROB,X
		TYX
		LDA	>TROBJ_PLOT_X,X		;回転エリアＸ　ＰＯＳ．セット
		STA	R3			;
		LDA	>TROBJ_PLOT_Y,X		;回転エリアＹ　ＰＯＳ．セット
		STA	R2			;
;
		M_CHIP	C_32_ZOOM
;
		LDX	<ENINDX
;
		INC	OBM7WF			;mode 7 OBJ chara DMA "ON"
;
		LDA	#(04H<<1)
		BRA	FUSN0IN0000
;
FUSNaIN		EQU	$
		LDA	#(0AH<<1)
		BRA	FUSN0IN0000
;
FUSN9IN		EQU	$
		LDA	#(09H<<1)
		BRA	FUSN0IN0000
;
FUSN8IN		EQU	$
		LDA	#(08H<<1)
		BRA	FUSN0IN0000
;
FUSN3IN		EQU	$
		LDA	#(03H<<1)
		BRA	FUSN0IN0000
;
FUSN2IN		EQU	$
		LDA	#(02H<<1)
		BRA	FUSN0IN0000
;
FUSN1IN		EQU	$
		LDA	#(01H<<1)
		BRA	FUSN0IN0000
;
FUSN0IN		EQU	$
		LDA	#(00H<<1)
FUSN0IN0000	EQU	$
		STA	!ENWRK6,X
		LDA	#-1
		STA	<ENWRK4,X
		LDA	!ENMUKI,X
		TAY
FUSN0IN0040	EQU	$
		LDA	FUSEN_XSPD,Y
		STA	!ENXSPD,X
;
		M8				; memory 8bit mode !!
;
		LDA	<RANDM0
		AND	#00003H
		TAY
		LDA	FUSN_COLOR,Y
		STA	<ENWRK0,X
;
		M16				; memory 16bit mode !!
;
		LDA	#00800H
		STA	!ENGMAX,X
		LDA	#00004H
		STA	!ENGPOW,X
		RTL
;
;
FUSNbIN		EQU	$
		JSL	>TROBJ_SR_4x4_CL
;
		LDA	#00100H			;(R6) <- 倍率
		STA	R6			;
;
		LDA	#BANK CIPCHD3+2080H+000 ;chara data bank set
		STA	R13
		LDA	#CIPCHD3+2080H+000	;chara data address set
		STA	R12
;
		LDA	#00010H			;(R8) <- 中心Ｘ　ＰＯＳ．
		STA	R8			;
		STA	R9			;(R9) <- 中心Ｙ　ＰＯＳ．
;
		LDY	ENTROB,X
		TYX
		LDA	>TROBJ_PLOT_X,X		;回転エリアＸ　ＰＯＳ．セット
		STA	R3			;
		LDA	>TROBJ_PLOT_Y,X		;回転エリアＹ　ＰＯＳ．セット
		STA	R2			;
;
		M_CHIP	C_32_ZOOM
;
		LDX	<ENINDX
;
		INC	OBM7WF			;mode 7 OBJ chara DMA "ON"
;
		LDA	#(0BH<<1)
		STA	!ENWRK6,X
		LDA	!ENMUKI,X
		STA	<ENWRK4,X		; 風船向きセット !!
		TAY
		STZ	!ENMUKI,X
		LDA	FUSEN_XSPD,Y
		STA	!ENXSPD,X
;
		M8				; memory 8bit mode !!
;
		LDA	<RANDM0
		AND	#00003H
		TAY
		LDA	FUSN_COLOR,Y
		LSR	A
		STA	<ENWRK0,X
		LDA	<RANDM0
		AND	#0000CH
		LSR	A
		LSR	A
		TAY
		LDA	FUSN_COLOR,Y
		LSR	A
		STA	<ENWRK1,X
		LDA	<RANDM0
		AND	#00030H
		LSR	A
		LSR	A
		LSR	A
		LSR	A
		TAY
		LDA	FUSN_COLOR,Y
		LSR	A
		STA	<ENWRK2,X
		LDA	#03
		STA	<ENWRK3,X		; 風船の数セット !!
;
		M16				; memory 16bit mode !!
;
		LDA	#00800H
		STA	!ENGMAX,X
		LDA	#00004H
		STA	!ENGPOW,X
		RTL
;
;
;------------------------------------------------------------------------
;-	move (風船)							-
;------------------------------------------------------------------------
FUSN3MV		EQU	$
FUSN2MV		EQU	$
FUSN1MV		EQU	$
FUSN0MV		EQU	$
		STZ	R4			; Ｈフリップ情報セット !!
		M_CHIP	FUSEN0OAM
;
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		JSR	FUSEN0_CRCK		; 敵衝突チェック !!
;
		JSR	FUSEN0_PLSH
;
		JSR	FUSEN_UPDOWN
;
		RTL
;
;
FUSN4MV		EQU	$
		JSL	>TROBJ_OAM_4x4
;
		STZ	R4			; Ｈフリップ情報セット !!
		M_CHIP	FUSEN0OAM
;
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		JSR	FUSEN_CRC2
		JSR	FUSEN0_CRCK0100		; 敵衝突チェック !!
;
		JSR	FUSEN_UPDOWN
;
		RTL
;
;
FUSN9MV		EQU	$
FUSN8MV		EQU	$
		STZ	R4			; Ｈフリップ情報セット !!
		M_CHIP	FUSEN0OAM
;
		LDX	<ENINDX
		LDA	!ENMODE,X
		CMP	#EEATM
		BNE	FUSN8MV0040		; 食べられた？ [no->FUSN8MV0040]
;
		JSR	FUSN_EAT
;
FUSN8MV0040	EQU	$
		JSL	>ENMDCK			; mode check
;
		JSR	FUSEN_CRC2
		JSR	FUSEN0_CRCK0100		; 敵衝突チェック !!
;
		JSR	FUSEN_UPDOWN
;
		RTL
;
;
FUSNaMV		EQU	$
		STZ	R4			; Ｈフリップ情報セット !!
		M_CHIP	FUSEN0OAM
;
		LDX	<ENINDX
		LDA	!ENMODE,X
		CMP	#EEATM
		BNE	FUSNaMV0040		; 食べられた？ [no->FUSNaMV0040]
;
		JSR	FUSN_EAT
;
FUSNaMV0040	EQU	$
		JSL	>ENMDCK			; mode check
;
		JSR	FUSEN_CRC2
		JSR	FUSEN0_CRCK0100		; 敵衝突チェック !!
;
		JSR	FUSEN_UPDOWN
;
		JSL	>COLD_KIRAKIRA
;
		RTL
;
;
FUSN7MV		EQU	$
FUSN6MV		EQU	$
FUSN5MV		EQU	$
		LDA	<ENWRK4,X
		LSR	A
		LSR	A
		ROR	A
		LSR	A
		STA	R4			; Ｈフリップ情報セット !!
		M_CHIP	FUSEN0OAM
;
		LDX	<ENINDX
		LDA	!ENMODE,X
		CMP	#EEATM
		BNE	FUSN5MV0030		; 食べられた？ [no->FUSN5MV0030]
;
		JSR	FUSN_EAT
;
FUSN5MV0030	EQU	$
		JSL	>ENMDCK			; mode check
;
		LDA	!ENMUKI,X
		BEQ	FUSN5MV0040		; 向きチェンジ ? [no->FUSN5MV0040]
;
		LDA	<ENWRK4,X
		EOR	#00002H
		STA	<ENWRK4,X		; 風船向きセット !!
FUSN5MV0040	EQU	$
		STZ	!ENMUKI,X		; 向きセット !!
;
		JSR	FUSEN_CRC2
		JSR	FUSEN0_CRCK0100		; 敵衝突チェック !!
;
		JSR	FUSEN_UPDOWN
;
		RTL
;
;
FUSNbPOSDAT0	EQU	$
		BYTE	004H,0F7H
		BYTE	004H,0F3H
		BYTE	000H,0E5H
		BYTE	00BH,0F8H
		BYTE	00DH,0F5H
		BYTE	00CH,0E8H
		BYTE	0FDH,0F9H
		BYTE	0FBH,0F5H
		BYTE	0F4H,0E8H
;
FUSNbPOSDAT1	EQU	$
		BYTE	008H,0F8H
		BYTE	009H,0F4H
		BYTE	007H,0E7H
		BYTE	000H,0F8H
		BYTE	0FFH,0F4H
		BYTE	0F9H,0E7H
;
FUSNbPOSDAT2	EQU	$
		BYTE	004H,0F8H
		BYTE	004H,0F4H
		BYTE	000H,0E6H
;
FUSNbPOSDATADR	EQU	$
		WORD	FUSNbPOSDATADR-1
		WORD	FUSNbPOSDAT2-1
		WORD	FUSNbPOSDAT1-1
;
FUSNbMV		EQU	$
		JSL	>TROBJ_OAM_4x4
;
		LDA	#BANK FUSNbPOSDAT0
		STA	R0			; データバンクセット !!
		LDA	<ENWRK3,X
		DEC	A
		ASL	A
		TAY
		LDA	FUSNbPOSDATADR,Y
		STA	R7			; データアドレスセット !!
		LDA	<ENWRK4,X
		LSR	A
		LSR	A
		ROR	A
		LSR	A
		STA	R4			; Ｈフリップ情報セット !!
		M_CHIP	FUSEN1OAM
;
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		LDA	!ENMUKI,X
		BEQ	FUSNbMV0040		; 向きチェンジ ? [no->FUSNbMV0040]
;
		LDA	<ENWRK4,X
		EOR	#00002H
		STA	<ENWRK4,X		; 風船向きセット !!
FUSNbMV0040	EQU	$
		STZ	!ENMUKI,X		; 向きセット !!
;
		JSR	FUSENb_CRC2
		JSR	FUSENb_CRCK		; 敵衝突チェック !!
;
		JSR	FUSEN_UPDOWN
;
		RTL
;
;
FUSEN_GMAX	EQU	$
		WORD	-00800H, 00800H
;
FUSEN_UPDOWN	EQU	$
		LDA	!ENYSPD,X
		CLC
		ADC	#00060H
		CMP	#000C0H
		BCC	FUSEN_UPDOWN040		; [->FUSEN_UPDOWN040]
;
		LDA	!ENYSPD,X
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAY
		LDA	FUSEN_GMAX,Y
		STA	!ENGMAX,X
FUSEN_UPDOWN040 EQU	$
		RTS
;
;
FUSEN_YP	EQU	$
		WORD	-00018H, -00018H, -00018H, -00020H
		WORD	-00018H, -00018H, -00018H, -00018H
		WORD	-00018H, -00018H, -00018H
;
FUSEN0_CRCK	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	FUSEN0_CRCK0100		; 衝突無し ? [yes->FUSEN0_CRCK0100]
		BEQ	FUSEN0_CRCK0100		; 赤ちゃんと衝突 ? [yes->FUSEN0_CRCK0100]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	FUSEN0_CRCK0100		; mode move ? [no->FUSEN0_CRCK0100]
;
		LDA	!ENSHOT,Y
		BEQ	FUSEN0_CRCK0100		; ショット ? [no->FUSEN0_CRCK0100]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
		LDY	!ENWRK6,X
		LDA	FUSEN_YP,Y
		STA	<EWORK
;
		LDA	#BALON
		JSL	>ENINSR
		BCC	FUSEN0_CRCK0080		; 敵エリア確保失敗 ? [yes->FUSEN0_CRCK0080]
;
		LDA	<ENWRK0,X
		STA	!ENWRK0,Y
		LDA	!ENXSPD,X
		STA	!ENXSPD,Y
		LDA	!ENMUKI,X
		STA	!ENMUKI,Y
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	<EWORK
		STA	!ENYPSL,Y
		BRA	FUSEN0_CRCK00A0
;
FUSEN0_CRCK0080 EQU	$
		LDA	#KACHB
		JSL	>EXINSR
;
		LDA	#0005
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	<EWORK
		CLC
		ADC	#0008
		STA	!EXYPSL,Y
FUSEN0_CRCK00A0 EQU	$
		LDX	<ENINDX
;
		M8				; memory 8bit mode !!
;
		LDA	#0FFH
		STA	!ENRETN,X
;
		M16				; memory 16bit mode !!
;
		PLA
		JMP	>ENFALL_END		; 死亡セット !!
;
FUSEN0_CRCK0100 EQU	$
		TXA
		STA	R1			; R1 <- My Index
		M_CHIP	SHOTENSR
;
		LDX	<ENINDX
		LDY	R1			; ショット敵インデックス読み込み !!
		BPL	FUSEN0_CRCK0140		; ショット敵存在せず ? [no->FUSEN0_CRCK0140]
;
FUSEN0_CRCK01F0 EQU	$
		RTS
;
FUSEN0_CRCK0140 EQU	$
		LDA	!EWIDEX,Y
		CLC
		ADC	#0006
		STA	<EWORK
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		ABS16
		CMP	<EWORK
		BCS	FUSEN0_CRCK01F0		; 風船に当たった ? [no->FUSEN0_CRCK01F0]
;
		LDA	!EWIDEY,Y
		CLC
		ADC	#0006
		STA	<EWORK
		LDA	!ENWRK6,X
		TAX
		LDA	FUSEN_YP,X
		LDX	<ENINDX
		CLC
		ADC	!ENYPSL,X
		CLC
		ADC	#0008
		STA	<EWORK4			; 風船の中心Ｙの保存 !!
		SEC
		SBC	!ECENTY,Y
		ABS16
		CMP	<EWORK
		BCS	FUSEN0_CRCK01F0		; 風船に当たった ? [no->FUSEN0_CRCK01F0]
;
		LDA	!ENGPOW,Y
		CMP	#00040H
		BCC	FUSEN0_CRCK0180		; Ｍａｘ ショット？ [yes->FUSEN0_CRCK0180]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
FUSEN0_CRCK0180 EQU	$
		LDA	#0003BH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	#KACHB
		JSL	>EXINSR
;
		LDA	#0005
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	<EWORK4
		STA	!EXYPSL,Y
		LDA	!ENWRK6,X
		TAX
		LDA	FUSEN_SETENEMY,X
		JSR	(FUSEN_SETMODSEL,X)
;
		PLA
		RTL
;
;
FUSEN_CRC2	EQU	$
		LDY	!ECRSFG,X
		BPL	FUSEN_CRC200F0		; プレイヤーと触れた？ [no->FUSEN_CRC200F0]
;
		LDY	!ENWRK6,X
		LDA	!ENYPSL,X
		CLC
		ADC	FUSEN_YP,Y
		CLC
		ADC	#0008
		STA	<EWORK
;
		LDA	#0003BH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	#KACHB
		JSL	>EXINSR
;
		LDA	#0005
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	<EWORK
		STA	!EXYPSL,Y
FUSEN_CRC20040	EQU	$
		LDY	!ENWRK6,X
		TYX
		LDA	FUSEN_SETENEMY,X
		JSR	(FUSEN_SETMODSEL,X)
;
		PLA
		RTL
;
FUSEN_CRC200F0	EQU	$
		RTS
;
;
FUSENb_OAMSUU	EQU	$
		BYTE	7<<3, 10<<3, 13<<3
;
FUSENb_CRCK	EQU	$
;
		M8				; memory 8bit mode !!
;
		LDA	<ENWRK2,X
		BPL	FUSENb_CRCK0010		; [->FUSENb_CRCK0010]
;
		LDA	<ENWRK1,X
		BPL	FUSENb_CRCK0020		; [->FUSENb_CRCK0020]
;
		LDA	<ENWRK0,X
		STA	<ENWRK2,X
		BRA	FUSENb_CRCK0028
;
FUSENb_CRCK0010 EQU	$
		LDA	<ENWRK1,X
		BPL	FUSENb_CRCK0030		; [->FUSENb_CRCK0030]
;
		LDA	<ENWRK0,X
		STA	<ENWRK1,X
		BRA	FUSENb_CRCK0028
;
FUSENb_CRCK0020 EQU	$
		LDA	<ENWRK1,X
		STA	<ENWRK2,X
		LDA	<ENWRK0,X
		STA	<ENWRK1,X
FUSENb_CRCK0028 EQU	$
		LDA	#-1
		STA	<ENWRK0,X
FUSENb_CRCK0030 EQU	$
;
		STZ	<EWORK3
		LDA	<ENWRK3,X
		STA	<EWORK2
		DEC	A
		ASL	A
		TAY
;
		M16				; memory 16bit mode !!
;
		LDA	FUSNbPOSDATADR,Y
		STA	<EWORK
FUSENb_CRCK0040 EQU	$
		TXA
		STA	R1			; R1 <- My Index
		M_CHIP	SHOTENSR
;
		LDX	<ENINDX
		LDY	R1			; ショット敵インデックス読み込み !!
		BPL	FUSENb_CRCK0048		; ショット敵存在 ? [yes->FUSENb_CRCK0048]
;
		RTS
;
FUSENb_CRCK0048 EQU	$
		LDA	!EWIDEX,X
		CLC
		ADC	#00006H
		STA	<EWORKC			; EWORKC <- 横チェック幅セーブ !!
		LDA	!EWIDEY,X
		CLC
		ADC	#00006H
		STA	<EWORKE			; EWORKE <- 縦チェック幅セーブ !!
FUSENb_CRCK0050 EQU	$
		LDA	(<EWORK)
		AND	#000FFH
		BIT	#00080H
		BEQ	FUSENb_CRCK0060		; 負 ? [no->FUSENb_CRCK0060]
;
		ORA	#0FF00H
FUSENb_CRCK0060 EQU	$
		CLC
		ADC	!ENYPSL,X
		CLC
		ADC	#00008H
		STA	<EWORK4			; EWORK4 <- 風船Ｙポジションセーブ !!
		DEC	<EWORK
;
		LDA	(<EWORK)
		AND	#000FFH
		BIT	#00080H
		BEQ	FUSENb_CRCK0070		; 負 ? [no->FUSENb_CRCK0070]
;
		ORA	#0FF00H
FUSENb_CRCK0070 EQU	$
		CLC
		ADC	!ENXPSL,X
		CLC
		ADC	#00008H
		STA	<EWORK6			; EWORK6 <- 風船Ｘポジションセーブ !!
;
		SEC
		SBC	!ECENTX,Y
		ABS16
		CMP	<EWORKC
		BCC	FUSENb_CRCK0078		; 衝突した ? [no->FUSENb_CRCK0078]
;
		JMP	FUSENb_CRCK00C0		; 衝突した ? [no->FUSENb_CRCK00C0]
;
FUSENb_CRCK0078 EQU	$
		LDA	<EWORK4
		SEC
		SBC	!ECENTY,Y
		ABS16
		CMP	<EWORKE
		BCS	FUSENb_CRCK00C0		; 衝突した ? [no->FUSENb_CRCK00C0]
;
;[1995.04.07.FR]		LDA	!ENGPOW,Y
;[1995.04.07.FR]		CMP	#00040H
;[1995.04.07.FR]		BCC	FUSENb_CRCK0080		; Ｍａｘ ショット？ [yes->FUSENb_CRCK0080]
;[1995.04.07.FR];
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
FUSENb_CRCK0080 EQU	$
		LDA	#0003BH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	#KACHB
		JSL	>EXINSR
;
		LDA	#0005
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	<EWORK6
		STA	!EXXPSL,Y
		LDA	<EWORK4
		STA	!EXYPSL,Y
;
		LDA	#000C0H
		STA	!ENYSPD,X		; Ｙスピードセット !!
;
		M8				; memory 8bit mode !!
;
		DEC	<ENWRK3,X
;
		M16				; memory 16bit mode !!
;
		BNE	FUSENb_CRCK00A0		; 全ての風船がわれた ? [no->FUSENb_CRCK00A0]
;
		JSR	FUSEN_TRBOXSET
;
		BRA	FUSENb_CRCK00B0
;
FUSENb_CRCK00A0 EQU	$
;
		M8				; memory 8bit mode !!
;
		LDY	<ENWRK3,X
		DEY
		LDA	!ENMOD2+1,X
		AND	#00000111B
		ORA	FUSENb_OAMSUU,Y
		STA	!ENMOD2+1,X
;
		LDA	#-1
		LDY	<EWORK2
		CPY	#03
		BNE	FUSENb_CRCK00A4		; [->FUSENb_CRCK00A4]
;
		STA	<ENWRK0,X
		LDA	<ENWRK1,X
		PHA
		LDA	<ENWRK2,X
		STA	<ENWRK1,X
		PLA
		STA	<ENWRK2,X
		BRA	FUSENb_CRCK00AC
;
FUSENb_CRCK00A4 EQU	$
		CPY	#02
		BNE	FUSENb_CRCK00A8		; [->FUSENb_CRCK00A8]
;
		STA	<ENWRK1,X
		BRA	FUSENb_CRCK00AC
;
FUSENb_CRCK00A8 EQU	$
		STA	<ENWRK2,X
FUSENb_CRCK00AC EQU	$
;
		M16				; memory 16bit mode !!
;
FUSENb_CRCK00B0 EQU	$
		PLA
		RTL
;
FUSENb_CRCK00C0 EQU	$
		LDA	<EWORK
		SEC
		SBC	#0005
		STA	<EWORK
		DEC	<EWORK2
		BEQ	FUSENb_CRCK00F0		; 全ての風船の衝突チェック終了 ? [yes->FUSENb_CRCK00F0]
;
		JMP	FUSENb_CRCK0050
;
FUSENb_CRCK00F0 EQU	$
		RTS
;
;
FUSENb_XP	EQU	$
		WORD	00000H+08H
FUSENb_XP1	EQU	$
		WORD	-0007H+08H, 00007H+08H
FUSENb_XP2	EQU	$
		WORD	-000CH+08H, 0000CH+08H, 00000H+08H
;
FUSENb_YP	EQU	$
		WORD	-001AH+08H
FUSENb_YP1	EQU	$
		WORD	-0019H+08H, -0019H+08H
FUSENb_YP2	EQU	$
		WORD	-0018H+08H, -0018H+08H, -001CH+08H
;
FUSENb_XAD	EQU	$
		WORD	FUSENb_XP
		WORD	FUSENb_XP1
		WORD	FUSENb_XP2
;
FUSENb_YAD	EQU	$
		WORD	FUSENb_YP
		WORD	FUSENb_YP1
		WORD	FUSENb_YP2
;
FUSENb_CRC2	EQU	$
		LDY	!ECRSFG,X
		BPL	FUSENb_CRC200F0		; プレイヤーと触れた？ [no->FUSENb_CRC200F0]
;
		LDY	<ENWRK3,X
		DEY
		PHY
		TYA
		ASL	A
		TAY
		LDA	FUSENb_XAD,Y
		STA	<EWORKC
		LDA	FUSENb_YAD,Y
		STA	<EWORKE
		PLY
FUSENb_CRC20040	EQU	$
;
		PHY
;
		ASL	A
		AND	#000FFH
		STA	<EWORK4
		TYA
		ASL	A
		TAY
		LDA	!ENXPSL,X
		CLC
		ADC	(<EWORKC),Y
		STA	<EWORK6
		LDA	!ENYPSL,X
		CLC
		ADC	(<EWORKE),Y
		STA	<EWORK8
;
		LDA	#0003BH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	#KACHB
		JSL	>EXINSR
;
		LDA	#0005
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	<EWORK6
		STA	!EXXPSL,Y
		LDA	<EWORK8
		STA	!EXYPSL,Y
;
FUSENb_CRC20080	EQU	$
;
		PLY
;
FUSENb_CRC20090	EQU	$
		DEY
		BPL	FUSENb_CRC20040		; [->FUSENb_CRC20040]
;
		JSR	FUSEN_TRBOXSET
;
		PLA
		RTL
;
FUSENb_CRC200F0	EQU	$
		RTS
;
;
FUSEN0_PLSH	EQU	$
		LDA	!ECENTX,X
		SEC
		SBC	!PCENTX
		CLC
		ADC	#fusen_chkarea
		CMP	#fusen_chkarea*2
		BCS	FUSEN0_PLSH00F0		; [->FUSEN0_PLSH00F0]
;
		LDA	#0000EH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDY	!ENWRK6,X
		LDA	FUSEN_YP,Y
		STA	<EWORK
;
		LDA	#BALON
		JSL	>ENINSR
		BCC	FUSEN0_PLSH0080		; 敵エリア確保失敗 ? [yes->FUSEN0_PLSH0080]
;
		LDA	<ENWRK0,X
		STA	!ENWRK0,Y
		LDA	!ENXSPD,X
		STA	!ENXSPD,Y
		LDA	!ENMUKI,X
		STA	!ENMUKI,Y
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		CLC
		ADC	<EWORK
		STA	!ENYPSL,Y
FUSEN0_PLSH0080 EQU	$
		LDA	!ENWRK6,X
		TAX
		LDA	FUSEN_SETENEMY,X
		JSR	(FUSEN_SETMODSEL,X)
;
		PLA
		RTL
;
FUSEN0_PLSH00F0 EQU	$
		RTS
;
;
FUSEN_SETENEMY	EQU	$
		WORD	HEIH0			; ヘイホー
		WORD	SABO0			; サボテン
		WORD	BOMBX			; 爆弾
		WORD	DOROB			; 泥棒
		WORD	JBLKL			; ジャンプ台
		WORD	HEIH0			; １ｕｐ
		WORD	DRKEY			; 鍵
		WORD	COIN1			; コイン
		WORD	SUIKA			; 西瓜
		WORD	FIRE0			; 火西瓜
		WORD	COLD0			; 氷西瓜
		WORD	TRBOX			; 宝箱
;
FUSEN_SETMODSEL EQU	$
		WORD	FUSEN_HEIHOSET
		WORD	FUSEN_JUMPSET
		WORD	FUSEN_BOMBSET
		WORD	FUSEN_DOROBSET
		WORD	FUSEN_JUMPLSET
		WORD	FUSEN_1UPSET
		WORD	FUSEN_KEYSET
		WORD	FUSEN_COINSET
		WORD	FUSEN_KINOSET
		WORD	FUSEN_KINOSET
		WORD	FUSEN_KINOSET
		WORD	FUSEN_TRBOXSET
;
;
FUSEN_HEIHOSET	EQU	$
		LDX	<ENINDX
		TXY
		JSL	>ESTATST
;
		LDA	#0004
		STA	<ENCONT,X
;
		LDA	!ENCLOR,X
		ORA	#00001H<<1
		STA	!ENCLOR,X
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	FUSEN_HOST0080		; mode move ? [yes->FUSEN_HOST0080]
;
		LDA	#EINIT
		STA	!ENMODE,X
FUSEN_HOST0080	EQU	$
		RTS
;
;
FUSEN_BOMBSET	EQU	$
		LDX	<ENINDX
		TXY
		JSL	>ESTATST
;
		LDA	#0001
		STA	<ENWRK4,X
;
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	FUSEN_BMST0080		; mode move ? [yes->FUSEN_BMST0080]
;
		LDA	#EINIT
		STA	!ENMODE,X
FUSEN_BMST0080	EQU	$
		RTS
;
;
FUSEN_DOROBSET	EQU	$
		LDX	<ENINDX
		TXY
		JSL	>ESTATST
;
		LDA	#0000CH
		STA	ENWRK2,Y
		LDA	#00017H
		STA	ENCHPT,Y
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	FUSEN_DRST0080		; mode move ? [yes->FUSEN_DRST0080]
;
		LDA	#EINIT
		STA	!ENMODE,X
FUSEN_DRST0080	EQU	$
		RTS
;
;
FUSEN_JUMPSET	EQU	$
		LDX	<ENINDX
		TXY
		JSL	>ESTATST
;
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	FUSN_JPST0080		; mode move ? [yes->FUSN_JPST0080]
;
		LDA	#EINIT
		STA	!ENMODE,X
FUSN_JPST0080	EQU	$
		RTS
;
;
FUSEN_KEYSET	EQU	$
		LDX	<ENINDX
		LDA	!ENWRK8,X
		PHA
		AND	#0FF00H
		LSR	A
		LSR	A
		LSR	A
		LSR	A
		STA	<EWORK
		PLA
		AND	#000FFH
		ASL	A
		ASL	A
		ASL	A
		ASL	A
		STA	<EWORK2
		TXY
		JSL	>ESTATST
;
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	FUSEN_KEYST0080		; mode move ? [yes->FUSEN_KEYST0080]
;
		LDA	<EWORK
		STA	!ENWRKA,X
		LDA	<EWORK2
		STA	!ENWRKC,X
;
		LDA	#EMOVE
		STA	!ENMODE,X
FUSEN_KEYST0080	EQU	$
		RTS
;
FUSEN_KINOSET	EQU	$
		LDX	<ENINDX
		TXY
		JSL	>ESTATST
;
		JSL	>KINOMI_CANCEL
;
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	FUSN_KNST0080		; mode move ? [yes->FUSN_KNST0080]
;
		LDA	#EINIT
		STA	!ENMODE,X
FUSN_KNST0080	EQU	$
		RTS
;
;
FUSEN_TRBOXSET	EQU	$
		LDX	<ENINDX
		JSL	>TROBJ_CLEAR
;
		TXY
		LDA	#TRBOX
		JSL	>ESTATST
;
		LDA	!ENYPSL,X
		CLC
		ADC	#00008H
		STA	!ENYPSL,X
;
		LDA	#00001			;絶対に中身を出すフラグセット
		STA	<ENCONT,X		;
;
		PHB
		LDY	#BANK TRBOXIN
		PHY
		PLB				; DBR Set !!
		JSL	>TRBOXIN
;
		PLB				; DBR Reset !!
;
		LDA	#EMOVE
		STA	!ENMODE,X
		RTS
;
;
FUSEN_COINXSPD	EQU	$
		WORD	 00100H,  00080H, -00100H, -00180H
;
FUSEN_COINSET	EQU	$
		LDX	<ENINDX
		TXY
		JSL	>ESTATST
;
		JSL	>COIN1IN
;
		M8				; memory 8bit mode !!
;
		LDA	#0FFH
		STA	!ENRETN,X
;
		M16				; memory 16bit mode !!
;
		LDA	#00018H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	!ENMODE,X
		CMP	#EMOVE
		BEQ	FUSEN_CNST0080		; mode move ? [yes->FUSEN_CNST0080]
;
		LDA	#EINIT
		STA	!ENMODE,X
FUSEN_CNST0080	EQU	$
		LDA	#(4-1)*2
		STA	<EWORK
FUSEN_CNST0090	EQU	$
		JSL	>RANDAM
;
		LDY	<EWORK
		LDA	FUSEN_COINXSPD,Y
		STA	<EWORK2
		LDA	#COIN1
		JSL	>ENINSR_I
		BCC	FUSEN_CNST00F0		; 領域確保失敗 ? [yes->FUSEN_CNST00F0]
;
		LDA	!ENXPSL,X
		STA	!ENXPSL,Y
		LDA	!ENYPSL,X
		STA	!ENYPSL,Y
		LDA	<RANDM0
		AND	#000FFH
		CLC
		ADC	<EWORK2
		STA	!ENXSPD,Y
		LDA	<RANDM0
		AND	#001FFH
		EOR	#0FFFFH
		INC	A
		STA	!ENYSPD,Y
;
		DEC	<EWORK
		DEC	<EWORK
		BPL	FUSEN_CNST0090		; [->FUSEN_CNST0090]
;
FUSEN_CNST00F0	EQU	$
		RTS
;
;
FUSEN_1UPSET	EQU	$
		LDX	<ENINDX
		JSL	>PL_1UP_SET_P
;
		JSL	>ENCLEAR_NORETN
;
		RTS
;
;
FUSEN_JUMPLSET	EQU	$
		LDX	<ENINDX
		PHA
		JSL	>TROBJ_CLEAR
;
		PLA
		TXY
		JSL	>ESTATST
;
		LDA	!ENYPSL,X
		CLC
		ADC	#00010H
		ORA	#00001H
		STA	!ENYPSL,X
;
		PHB
		LDY	#BANK JBLKLIN
		PHY
		PLB				; DBR Set !!
		JSL	>JBLKLIN
;
		PLB				; DBR Reset !!
;
		LDA	#EMOVE
		STA	!ENMODE,X
		RTS
;
;
FUSN_EAT	EQU	$
		LDA	!ENWRK6,X
		TAX
		LDA	FUSEN_SETENEMY,X
		JMP	(FUSN_EATMDSL,X)
;
;
FUSN_EATMDSL	EQU	$
		WORD	FUSN_NOEAT		; ヘイホー  
		WORD	FUSN_NOEAT		; サボテン  
		WORD	FUSN_NOEAT		; 爆弾      
		WORD	FUSN_NOEAT		; 泥棒      
		WORD	FUSN_NOEAT		; ジャンプ台
		WORD	FUSN_EAT1UP		; １ｕｐ
		WORD	FUSN_NOEAT		; 鍵    
		WORD	FUSN_EATCO		; コイン
		WORD	FUSN_EATSK		; 西瓜  
		WORD	FUSN_EATSK		; 火西瓜
		WORD	FUSN_EATSK		; 氷西瓜
		WORD	FUSN_NOEAT		; 宝箱
;
;
FUSN_NOEAT	EQU	$
		LDX	<ENINDX
		RTS
;
;
FUSN_EATSK	EQU	$
		PHA
		TXA
		ASL	A
		TAX
		LDY	<ENINDX
		PLA
		JSL	>ESTATST
;
		TXY
		LDX	<ENINDX
;
		LDA	!ENYPSL,X
		CLC
		ADC	FUSEN_YP,Y
		CLC
		ADC	#0008
		STA	<EWORK
		LDA	#KACHB
		JSL	>EXINSR
;
		LDA	#0005
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	<EWORK
		STA	!EXYPSL,Y
;
		RTS
;
;
FUSN_EATCO	EQU	$
		PHA
		TXA
		ASL	A
		TAX
		LDY	<ENINDX
		PLA
		JSL	>ESTATST
;
		TXY
		LDX	<ENINDX
;
		M8				; memory 8bit mode !!
;
		LDA	#0FFH
		STA	!ENRETN,X
;
		M16				; memory 16bit mode !!
;
		LDA	#00018H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		STZ	!EATSTP
;
		LDA	!ENYPSL,X
		CLC
		ADC	FUSEN_YP,Y
		CLC
		ADC	#0008
		STA	<EWORK
		LDA	#KACHB
		JSL	>EXINSR
;
		LDA	#0005
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	<EWORK
		STA	!EXYPSL,Y
;
		JMP	FUSEN_CNST0080
;
;
FUSN_EAT1UP	EQU	$
		LDA	#00018H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		TXA
		ASL	A
		TAY
		LDX	<ENINDX
;
		STZ	!EATFLG
		STZ	!EATSTP
;
		LDA	!ENYPSL,X
		CLC
		ADC	FUSEN_YP,Y
		CLC
		ADC	#0008
		STA	<EWORK
		LDA	#KACHB
		JSL	>EXINSR
;
		LDA	#0005
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	<EWORK
		STA	!EXYPSL,Y
;
		JMP	FUSEN_1UPSET
;
;
;------------------------------------------------------------------------
;-	initial (風船)							-
;------------------------------------------------------------------------
BALONIN		EQU	$
		LDA	!ENMUKI,X
		TAY
		LDA	FUSEN_XSPD,Y
		STA	!ENXSPD,X
;
		M8				; memory 8bit mode !!
;
		LDA	<RANDM0
		AND	#00003H
		TAY
		LDA	FUSN_COLOR,Y
		STA	<ENWRK0,X
;
		M16				; memory 16bit mode !!
;
		RTL
;
;
;------------------------------------------------------------------------
;-	move (風船)							-
;------------------------------------------------------------------------
BALONMV		EQU	$
		STZ	R4			; Ｈフリップ情報セット !!
		M_CHIP	FUSEN0OAM
;
		LDX	<ENINDX
		JSL	>ENMDCK			; mode check
;
		LDA	<ENCONT,X
		TAX
		JMP	(BALOONMODSEL,X)
;
BALOONMODSEL	EQU	$
		WORD	BALONMV0000		; 通常処理
		WORD	BALONMV0100		; プレイヤー引っかけ
;
;
BALONMV0000	EQU	$
		LDX	<ENINDX
		JSR	BALOONCRCK
;
;;;;;		JSR	BALOONPLCRCK
;
;[1995.03.31.FR]		LDA	!ENYSPD,X
;[1995.03.31.FR]		CLC
;[1995.03.31.FR]		ADC	#00080H
;[1995.03.31.FR]		CMP	#000C0H
;[1995.03.31.FR]		BCC	BALONMV0040		; [->BALONMV0040]
;[1995.03.31.FR];
;[1995.03.31.FR]		LDA	!ENGMAX,X
;[1995.03.31.FR]		EOR	#0FFFFH
;[1995.03.31.FR]		INC	A
;[1995.03.31.FR]		STA	!ENGMAX,X
;[1995.03.31.FR]BALONMV0040	EQU	$
		RTL
;
;
BALONMV0100	EQU	$
		LDX	<ENINDX
;
		JSR	FUSEN_UPDOWN
;
		LDA	!PCENTX
		SEC
		SBC	#00008H
		STA	!ENXPSL,X
		LDA	!ENYPSL,X
		CLC
		ADC	#00016H
		CLC
		ADC	<ENWRK4,X
		STA	!PLYPSL
		LDA	!PLCMKI
		EOR	#00002H
		STA	!ENMUKI,X
		LDA	<ENWRK4,X
		BEQ	BALONMV0180		; [->BALONMV0180]
;
		DEC	<ENWRK4,X
BALONMV0180	EQU	$
		RTL
;
;
BALOONCRCK	EQU	$
		LDY	!ECRSFG,X
		DEY
		BEQ	BALOONCRCK00F0		; 赤ちゃんと衝突 ? [yes->BALOONCRCK00F0]
		BMI	BALOONCRCK00F0		; 衝突無し ? [yes->BALOONCRCK00F0]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	BALOONCRCK00F0		; mode move ? [no->BALOONCRCK00F0]
;
		LDA	!ENSHOT,Y
		BEQ	BALOONCRCK00F0		; ショット ? [no->BALOONCRCK00F0]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
;
		LDA	#0003BH
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	#KACHB
		JSL	>EXINSR
;
		LDA	#0005
		STA	!EXCHPT,Y
		LDA	#0002
		STA	!EXTIM0,Y
		LDA	!ECENTX,X
		STA	!EXXPSL,Y
		LDA	!ECENTY,X
		STA	!EXYPSL,Y
;
		PLA
		JMP	>ENCLEAR_NORETN
;
BALOONCRCK00F0	EQU	$
		RTS
;
;
BALOONPLCRCK	EQU	$
		LDA	!ENXPSL,X
		CLC
		ADC	#00008H
		SEC
		SBC	!PCENTX
		BNE	BALNPLCRCK00F0		; [->BALNPLCRCK00F0]
;
		LDA	!PWIDEY
		CLC
		ADC	#00004H
		STA	<EWORK
		LDA	!ENYPSL,X
		CLC
		ADC	#00016H
		SEC
		SBC	!PCENTY
		CLC
		ADC	<EWORK
		CMP	<EWORK
		BCS	BALNPLCRCK00F0		; [->BALNPLCRCK00F0]
;
		STA	<ENWRK4,X
		STZ	!ENXSPD,X
		LDA	#00080H
		STA	!ENYSPD,X
		INC	<ENCONT,X
		INC	<ENCONT,X
		PLA
		RTL
;
BALNPLCRCK00F0	EQU	$
		RTS
;
;
;------------------------------------------------------------------------
;	initial (サボテン)						-
;------------------------------------------------------------------------
SABO0IN		EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;	move (サボテン)							-
;------------------------------------------------------------------------
SABO0_YSPD	EQU	$
		WORD	-00400H, -00300H
;
SABO0MV		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 (パンジー)						-
;------------------------------------------------------------------------
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
		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
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]
;
		TYX
		JSL	>SHOT_EN_KILL
;
		LDX	<ENINDX
;
		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	!ENWRKC,X
		XBA
		STA	<EWORK			; カラーセット
		JSR	HANABIRASET
;
		JMP	>ENCLEAR_NORETN
;
;
;------------------------------------------------------------------------
;-	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
;
;
;------------------------------------------------------------------------
;-	ENEMY X POSITION CHECK						-
;-		(X) <- MY INDEX						-
;-		(Y) <- ENEMY INDEX					-
;-		FRONT : + -> (A)					-
;-		BACK  : - -> (A)					-
;------------------------------------------------------------------------
EN_EN_XPOS	EQU	$
		LDA	!ENMUKI,X
		LSR	A
		LSR	A
		ROR	A
		STA	<EWORK
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		EOR	<EWORK
		RTL
;
;
;------------------------------------------------------------------------
;-	ENEMY X POSITION CHECK						-
;-		(X) <- MY INDEX						-
;-		(Y) <- ENEMY INDEX					-
;-		近付いてる時	 : + -> (A)				-
;-		遠ざかっている時 : - -> (A)				-
;------------------------------------------------------------------------
EN_EN_XSPD	EQU	$
		LDA	!ECENTX,X
		SEC
		SBC	!ECENTX,Y
		EOR	!ENXSPD,Y
		RTL
;
;
;------------------------------------------------------------------------
;-	踏まれたチェック						-
;-	踏んだ	   : キャリーセット					-
;-	踏んでない : キャリークリア					-
;------------------------------------------------------------------------
EPFOOTCROSS	EQU	$
		LDY	!ECRSFG,X
		BPL	FPFTCR0100		; player ? [no->FPFTCR0100]
;
EPFOOTCROSS_01	EQU	$
		LDA	!EPWIDY,X
		SEC
		SBC	!PWIDEY
		SEC
		SBC	!EWIDEY,X
		CMP	#0FFF8H
		BCC	FPFTCR0120
;
		LDA	!PLYSPD
		BMI	FPFTCR00F0		; プレイヤー上昇中 ? [yes->FPFTCR00F0]
;
		SEC
		RTL
;
FPFTCR00F0	EQU	$
		LDA	#0000
FPFTCR0100	EQU	$
		CLC
FPFTCR0120	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
SHOTENMYHIT	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	SEH0080			; 敵衝突 ? [no->SEH0080]
		BEQ	SEH0080			; 赤ちゃん衝突 ? [yes->SEH0080]
;
		LDA	!ENMODE,Y
		CMP	#EMOVE
		BNE	SEH0080			; mode MOVE ? [no->SEH0080]
;
		LDA	!ENSHOT,Y
		BEQ	SEH0080			; SHOT ? [no->SEH0080]
;
		PHX
		TYX
		JSL	>SHOT_EN_KILL
;
		PLX
		LDA	#EFAIL
		STA	!ENMODE,X
		STZ	!ENYSPD,X
		STZ	!ENXSPD,X
		STZ	!ENXPOW,X
		STZ	!ENXMAX,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDA	#00400H
		STA	!ENGMAX,X
		PLY
		PLA
SEH0080		EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
PLAYERDAMAGE	EQU	$
		LDY	!ECRSFG,X
		BPL	PD0080			; プレイヤー衝突 ? [no->PD0080]
;
		JSL	>PLFLST
;
PD0080		EQU	$
		RTL
;------------------------------------------------------------------------
;-	縦 画面クリア チェック						-
;------------------------------------------------------------------------
EN_CLR_CHECK	EQU	$
		LDA	!ENYPSL,X
		CMP	#00800H
		BMI	ECLCK0040		; クリア ? [no->ECLCK0040]
;
		PLY
		PLA
		JMP	>ENCLEAR
;
ECLCK0040	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	範囲外 チェック							-
;------------------------------------------------------------------------
EN_CLR_CHECK2	EQU	$
		LDA	!ENDSXL,X
		CLC
		ADC	#00040H
		CMP	#00180H
		BCS	ECLCK20080		; クリア ? [yes->ECLCK20080]
;
		LDA	!ENDSYL,X
		CLC
		ADC	#00040H
		CMP	#00180H
ECLCK20080	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	敵 薙ぎ倒し							-
;------------------------------------------------------------------------
EN_ENSHOT_XSPD	EQU	$
		WORD	00100H, 0FF00H
;
EN_ENSHOT	EQU	$
		LDY	!ECRSFG,X
		DEY
		BMI	EES00F0			; 敵衝突 ? [no->EES00F0]
		BEQ	EES00F0			; 赤ちゃん衝突 ? [yes->EES00F0]
;
		LDA	!ENMOD1,Y
		AND	#0110000000000000B
		BNE	EES00F0		;敵？ ( no:EES00F0 )
;
		LDA	#0001
		STA	!ENSHOT,Y	;enemy shot flag "ON" !!
		LDA	#0400H
		STA	!ENGMAX,Y	;max G power set
		LDA	#040H
		STA	!ENGPOW,Y	;G power set
		LDA	#0000
		STA	!ENXPOW,Y	;X power set
		STA	!ENCBFG,Y	;行ったり来りしない様に
		STA	!ENWRK0,Y	;bound flag set
;
		LDA	!ECROSX,Y
		AND	#08000H
		ASL	A
		ROL	A
		ASL	A
		TAX
		LDA	EN_ENSHOT_XSPD,X
		STA	!ENXSPD,Y
		LDA	#0FE00H
		STA	!ENYSPD,Y
		LDX	<ENINDX
EES00F0		EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	天井張り付き							-
;------------------------------------------------------------------------
TENJYOUCHK	EQU	$
		LDA	!ENCBFG,X
		BIT	#0000000000000010B
		BNE	TJCK0080		; ターン ? [no->TJCK0080]
;
		LDA	!ENXPSL,X
		SEC
		SBC	!ENMOVX,X
		STA	!ENXPSL,X
		LDA	!ENYPSL,X
		SEC
		SBC	!ENMOVY,X
		STA	!ENYPSL,X
		LDA	!ENXSPD,X
		EOR	#0FFFFH
		INC	A
		STA	!ENXSPD,X
		LDA	!ENMUKI,X
		EOR	#00002H
		STA	!ENMUKI,X
TJCK0080	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
EN_WATER_CK	EQU	$
		LDA	#00400H
		STA	!ENGMAX,X
		LDA	#00040H
		STA	!ENGPOW,X
		LDY	!ENWATR,X
		BEQ	ENWTCK00F0		; 水 ? [no->ENWTCK00F0]
;
		LDA	#0FF80H
		STA	!ENGMAX,X
		LDA	#00008H
		STA	!ENGPOW,X
ENWTCK00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	ターゲット							-
;-		EWORK  <- X 座標					-
;-		EWORK2 <- Y 座標					-
;-		EWORK4 <- ターゲットカウンター				-
;------------------------------------------------------------------------
TARGET_COLOR	EQU	$
		WORD	00000H<<1, 00001H<<1, 00002H<<1, 00004H<<1
;
TARGET_ON2	EQU	$
		LDA	#00010H
		BRA	TG_ON0000
;
TARGET_ON	EQU	$
		LDA	#00001H
TG_ON0000	EQU	$
		STA	<EWORK8
		LDA	<FRCNT2
		BIT	#00007H
		BNE	TG_ON0040		; SOUND ON ? [no->TG_ON0040]
;
		LDA	#00050H
		JSL	>SOUND_3_ON		; サウンド セット !!
;
		LDA	<FRCNT2
TG_ON0040	EQU	$
		AND	#00003H
		ASL	A
		TAY
		LDA	TARGET_COLOR,Y
		STA	<EWORK6
		LDA	#NAG_P
		JSL	>EXINSR
;
		LDA	<EWORK
		STA	!EXXPSL,Y
		LDA	<EWORK2
		STA	!EXYPSL,Y
		LDA	<EWORK8
		STA	!EXTIM0,Y
		LDA	!EXCLOR,Y
		ORA	<EWORK6
		STA	!EXCLOR,Y
		LDA	<EWORK4
		STA	!EXWRK0,Y
		RTL
;
;
;------------------------------------------------------------------------
;-	プレイヤーとの距離チェック					-
;-		EWORK  <- 横半径					-
;-		EWORK2 <- 横直径					-
;-		EWORK4 <- 縦半径					-
;-		EWORK6 <- 縦直径					-
;-									-
;-		範囲外 -> キャリーセット				-
;-		範囲内 -> キャリークリア				-
;------------------------------------------------------------------------
PL_SEARCH	EQU	$
		LDA	!ECENTX,X
		SEC
		SBC	!PCENTX
		CLC
		ADC	<EWORK
		CMP	<EWORK2
		BCS	PL_SEARCH00F0		; 範囲外 ? [yes->PL_SEARCH00F0]
;
		LDA	!ECENTY,X
		SEC
		SBC	!PCENTY
		CLC
		ADC	<EWORK4
		CMP	<EWORK6
PL_SEARCH00F0	EQU	$
		RTL
;
;
;------------------------------------------------------------------------
;-	ヒットマークセット						-
;-		EWORK  <- X POSITION					-
;-		EWORK2 <- Y POSITION					-
;------------------------------------------------------------------------
KAKIN_SET	EQU	$
		LDA	#STAR2
		JSL	>EXINSR
;
		LDA	<EWORK
		STA	!EXXPSL,Y
		LDA	<EWORK2
		STA	!EXYPSL,Y
		LDA	#02
		STA	!EXTIM0,Y
		LDA	#((1<<1)|00020H)
		STA	!EXCLOR,Y
		RTS
;
;------------------------------------------------------------------------
;-	花びらセット							-
;-		EWORK <- カラー						-
;------------------------------------------------------------------------
HANESET		EQU	$
		LDA	#HIRA1
		BRA	HANABIRASET0020
;
HANABIRASET	EQU	$
		LDA	#HIRA0
HANABIRASET0020 EQU	$
		JSL	>EXINSR
;
		LDA	!EXCLOR,Y
		AND	#0FFF1H
		ORA	<EWORK
		STA	!EXCLOR,Y
		LDA	!ENXPSL,X
		CLC
		ADC	#00008H
		STA	!EXXPSL,Y
		LDA	!ENYPSL,X
		STA	!EXYPSL,Y
		LDA	#0001
		STA	!EXTIM0,Y
		LDA	#00017H
		STA	!EXCHPT,Y
		RTS
;
;
;------------------------------------------------------------------------
;-	プレイヤーとの衝突チェック					-
;-		衝突した   : ０以外					-
;-		衝突しない : ０						-
;-		踏まれた   : キャリーセット				-
;-		踏まれない : キャリークリア				-
;------------------------------------------------------------------------
PLCRSCK		EQU	$
		LDA	!ECENTX,X
		SEC
		SBC	!PCENTX
		ABS16
		SEC
		SBC	!EWIDEX,X
		SEC
		SBC	!PWIDEX
		BPL	PLCRSCK00E0		; 当たった？ [no->PLCRSCK00E0]
;
		LDA	!ECENTY,X
		SEC
		SBC	!PCENTY
		STA	<EWORK
		ABS16
		SEC
		SBC	!EWIDEY,X
		SEC
		SBC	!PWIDEY
		BPL	PLCRSCK00E0		; 当たった？ [no->PLCRSCK00E0]
;
		LDA	<EWORK
		SEC
		SBC	!EWIDEY,X
		SEC
		SBC	!PWIDEY
		CMP	#0FFF8H
		BCS	PLCRSCK00C0		; 踏まれた？ [yes->PLCRSCK00C0]
;
		LDA	#01
		BRA	PLCRSCK00F0
;
PLCRSCK00C0	EQU	$
		LDA	!PLYSPD
		BPL	PLCRSCK0100		; 踏まれた？ [yes->PLCRSCK0100]
;
PLCRSCK00E0	EQU	$
		LDA	#00
PLCRSCK00F0	EQU	$
		CLC
		RTL
;
PLCRSCK0100	EQU	$
		LDA	#01
		SEC
		RTL
;
;
;------------------------------------------------------------------------
;------------------------------------------------------------------------
;
;
		END
;
;
