;
		onbankgroup
;
;==============	バンク０ ================================================
BANK0		GROUP	0
;-------------<	ZCO >-------------
		extern	RNDSUB,OBJBG,BGMSET,SOUNDCLR,DDNGOITL,DJITRV
		extern	SOUNDOUT
;
;-------------<	ZPL >-------------
		extern	PLPSRV,MSGCHK,MSGCHK2,DUSHCL,KNCSET,KNFLSH,PLSHST
		extern	MVCALC,FLASHST,EXIDSH,NXGOTO,LDTIM0,BG1CHG,NAZOCLR
		extern	BBSDST,OTOSET,NXGOTO3,MSGCH2,LDTIM1,LDTIM3,DUSHCL2
		extern	CARITMD,PTOBI,PBULE,POVER,PINDR1,PTATE,PKEN,PMGIC
		extern	PBOMB,PYAST,PBOXER,PROD,PFOLE,PFUCK,ENDG,GMAP
;
;-------------<	ZBS >-------------
		extern	DJRMRD,BGCRRD,BGCRRD2
;
;-------------<	ZES >-------------
		extern	ENPSSV,TAKARSTL,ENMOVEL,ENPTST,STATINC,EN2CST,EN1CST
		extern	ENHNBC,YMVSUBL,ENOMST,HAYAMITL,HAYABITL,ENMOVE
		extern	BGKAOITL,BSLIMITL,TBOSSITL,BSNAKITL,BFIREITL,ENFEND
		extern	ENCLER,BBIRDITL,ENSZST,BFISHITL,O2MCHK,SHRVSE,GKFLSH
		extern	ENDTON,PSERCH2L,PSERCHL,CAOFCKL,KTFLCSL,SADWSTL
		extern	NXOMSBL,ENRMCL,EFAIL,EFOLE,EFIRE,EINIT,EMOVE,ESTOP
		extern	ECACH,ESHOT,ENSDCL,HNSMST
;
;-------------<	ZNA >-------------
		extern	HIMITSU,PBSET,HRTC1,HRTC2,HRTC3,HRTC4
;
;==============	バンク２ ================================================
BANK2		GROUP	2
;-------------<	ZEX >-------------
		extern	WTUP,SMK1,FLSH,KPWF,HNSM
;
;==============	バンク８ ================================================
BANK8		GROUP	8
;-------------<	ZBD >-------------
		extern	GRBGCR,DJBGCR
;
;==============	バンク１４ ==============================================
BANK14		GROUP	14H
;-------------<	ZDB >-------------
		extern	NOT,DMP,SKY,BKY,KEN,TBO,BMB,KAI,BUL,C01,C10,C20
		extern	C50,GK1,GK5,TAT
;
;========================================================================
	PUBALL
;
BANK3	GROUP	03
;
	LIB	ZRAM
	LIB	ZBN
;
;;;;;;;;	EXTERN	RNDSUB,PLPSRV,MSGCHK,MSGCHK2,DUSHCL,OBJBG,KNCSET,KNFLSH	
;;;;;;;;	EXTERN	PLSHST,MVCALC,FLASHST,DJRMRD,EXIDSH,NXGOTO,ENPSSV,TAKARSTL
;;;;;;;;	EXTERN	ENMOVEL,LDTIM0,ENPTST,STATINC,EN2CST,EN1CST,BG1CHG
;;;;;;;;	EXTERN	ENHNBC,YMVSUBL,ENOMST,HAYAMITL,HAYABITL,ENMOVE,BGKAOITL
;;;;;;;;	EXTERN	BSLIMITL,TBOSSITL,BSNAKITL,BGMSET,SOUNDCLR,DDNGOITL,BFIREITL
;;;;;;;;	EXTERN	ENFEND,ENCLER,BBIRDITL,NAZOCLR,ENSZST,BBSDST,OTOSET,NXGOTO3
;;;;;;;;	EXTERN	BFISHITL,MSGCH2,DJITRV,O2MCHK,SHRVSE,GKFLSH,HIMITSU,ENDTON
;;;;;;;;	EXTERN	LDTIM1,LDTIM3,SOUNDOUT,BGCRRD,BGCRRD2,DUSHCL2     ;TOURST,
;;;;;;;;	EXTERN	PSERCH2L,PSERCHL,PBSET,CAOFCKL
;;;;;;;;	EXTERN	KTFLCSL,SADWSTL,NXOMSBL,ENRMCL
;;;;;;;;;
;;;;;;;;	EXTERN	CARITMD,GRBGCR,DJBGCR,PTOBI,WTUP,PBULE,POVER,SMK1,PINDR1
;;;;;;;;	EXTERN	EFAIL,EFOLE,EFIRE,EINIT,EMOVE,ESTOP,ECACH,ESHOT,FLSH,PTATE
;;;;;;;;	EXTERN	ENSDCL,HNSMST,KPWF,HRTC1,HRTC2,HRTC3,HRTC4,PKEN ;,ONOFBD
;;;;;;;;	EXTERN  NOT,DMP,SKY,BKY,KEN,TBO,BMB,PMGIC,PBOMB,HNSM,PYAST,PBOXER
;;;;;;;;	EXTERN	KAI,BUL,C01,C10,C20,C50,PROD,PFOLE,GK1,GK5,PFUCK,TAT,ENDG
;;;;;;;;	EXTERN	GMAP
;------------------------------------------------
	KANJI
	PAGE
;
	LIST
	ORG	$4000
;---------------------------------------------------------------
EPBANK	; Program bank
	DB	$03 ;PYAAA
;;	DB	$04 ;TEST 
	DB	$19 ;BUMER
	DB	$03 ;BOMBR
	DB	$18 ;FUCKS
	DB	$03 ;PRTBM
;
	DB	$03 ;KTOBJ
	DB	$03 ;BLOCK
	DB	$07 ;TAKAR
	DB	$18 ;POWDR
;
	DB	$03 ;OCTA1
	DB	$03 ;OCTAM
	DB	$03 ;MORI1
	DB	$03 ;MORYA
	DB	$06 ;TEKTA
	DB	$04 ;RIVER
	DB	$06 ;KUZUH
	DB	$04 ;GHOST
	DB	$04 ;GHOSB
	DB	$04 ;GHOSS
	DB	$03 ;BOMBO
	DB	$07 ;HEIS0
	DB	$06 ;BABUL
	DB	$06 ;SPARK
	DB	$06 ;SPAR2
	DB	$06 ;PORUS
	DB	$06 ;BLBAT
	DB	$06 ;SKEL0
	DB	$06 ;SLIMB
	DB	$06 ;SLIMS
	DB	$06 ;BASSF
	DB	$15 ;SKEL1
	DB	$06 ;MUMMY
	DB	$06 ;MOTOS
	DB	$06 ;MAGE0
	DB	$06 ;SONIC
	DB	$06 ;LAIKU
	DB	$03 ;HIPLP
	DB	$03 ;BOSS1
	DB	$03 ;KWUSO
	DB	$06 ;TRAP0
	DB	$19 ;COPYA
	DB	$04 ;HAYAM
	DB	$04 ;RENO7
	DB	$15 ;R7BEM
	DB	$07 ;INOSI
;
	DB	$03 ;HART1
	DB	$03 ;RUPY1
	DB	$03 ;YOSEI
	DB	$03 ;KEYSM
	DB	$03 ;PLTAT
	DB	$03 ;HMASK
	DB	$03 ;POWER
	DB	$03 ;KINOM
	DB	$03 ;KAKER
	DB	$03 ;HARTB
	DB	$03 ;ALOW1 
	DB	$03 ;BOMB1 
	DB	$03 ;GAKKI 
	D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	$18 ;KHIMI
	DB	$18 ;GIRL1
	DB	$18 ;GIRL2
	DB	$18 ;MAMUU
	DB	$18 ;TODD 
	DB	$15 ;UNIUNI
	DB	$15 ;KANI 
	DB	$18 ;MANBO
	DB	$18 ;USAGI
	DB	$18 ;ONPU 
	DB	$18 ;AKUMA
	DB	$18 ;ZORA 
	DB	$15 ;BLANKA
	DB	$19 ;WANI 
	DB	$18 ;MAMAD2
	DB	$19 ;GAGE   
	DB	$18 ;USAG2
	DB	$18 ;KUMAS
	DB	$18 ;NTORI
	DB	$18 ;GMUSI
;-Bank 19-
	DB	$19 ;OBAKE
	DB	$19 ;NIWAX
	DB	$19 ;YTUBO
	DB	$19 ;DOSNS
	DB	$19 ;DOSNB
	DB	$19 ;TAIAT
	DB	$19 ;FIREB
	DB	$19 ;BABUB
	DB	$19 ;BOOK 
	DB	$19 ;SEIREN
	DB	$19 ;KENBM 
	DB	$19 ;KAZAM
;-Bank 17-
	DB	$15 ;SARUK 
	DB	$15 ;MOUSE 
	DB	$15 ;HODAI 
	DB	$15 ;SANBO 
	DB	$15 ;MBOSS 
	DB	$06 ;FLYIT2  
	DB	$15 ;BOSS  
	DB	$15 ;SIROS
;- - - Ending obj - -
	DB	$17 ;EDAI   
;****************************************
;*      Enemy                           *
;****************************************
;- - Kind of enemy - - 
;-- Player wepon - -
PYAAA	EQU	$0
BUMER	EQU	$1
TEST	EQU	$1
BOMBR	EQU	$2
FUCKS	EQU	$3
PRTBM	EQU	$4
;- - - - - - - - - - 
KTOBJ	EQU	$5
BLOCK	EQU	$6
TAKAR	EQU	$7
POWDR	EQU	$8
;- - - - - - - - - -
OCTA1	EQU	$9
OCTAM	EQU	$A
MORI1	EQU	$B
MORYA	EQU	$C
TEKTA	EQU	$D
RIVER	EQU	$E
KUZUH	EQU	$F
GHOST	EQU	$10
GHOSB	EQU	$11
GHOSS	EQU	$12
BOMBO	EQU	$13
HEIS0	EQU	$14
BABUL	EQU	$15
SPARK	EQU	$16
SPAR2	EQU	$17
PORUS	EQU	$18
BLBAT	EQU	$19
SKEL0	EQU	$1A
SLIMB	EQU	$1B
SLIMS	EQU	$1C
BASSF	EQU	$1D
SKEL1	EQU	$1E
MUMMY	EQU	$1F
MOTOS	EQU	$20
MAGE0	EQU	$21
SONIC	EQU	$22
LAIKU	EQU	$23
HIPLP	EQU	$24
BOSS1	EQU	$25
KWUSO	EQU	$26
TRAP0	EQU	$27
COPYA	EQU	$28
HAYAM	EQU	$29
RENO7	EQU	$2A
R7BEM	EQU	$2B
INOSI	EQU	$2C
;- - - - - - - - - -
HART1	EQU	$2D
RUPY1	EQU	$2E
YOSEI	EQU	$2F
KEYSM	EQU	$30	
PLTAT	EQU	$31
HMASK	EQU	$32
POWER	EQU	$33
KINOM	EQU	$34
KAKER	EQU	$35
HARTB	EQU	$36
ALOW1 	EQU	$37
BOMB1	EQU	$38
GAKKI	EQU	$39
KINOK	EQU	$3A
MGPOW	EQU	$3B
KAKIN	EQU	$3C	;葉っぱ！
KAIIN	EQU	$3D	;貝殻！
GIRL0 	EQU	$3E	;マリン
PAPA0 	EQU	$3F	;タリン
BABA0 	EQU	$40
FUKURO	EQU	$41
HINTO 	EQU	$42
EWOOD 	EQU	$43	;話す木
MSPNT 	EQU	$44	;粉かけると話す！
IWAGO 	EQU	$45	;岩ゴロゴロ
SWBLKU	EQU	$46	;スイッチ引くとウゴク！
SWBLKD	EQU	$47	;
SWBLKL	EQU	$48	;
SWBLKR	EQU	$49	;
;
;;STEST	EQU	$4A
MSTESF	EQU	$4B
;----------------------- BANK 2-------------
FRBAR	EQU	$4C
NYAMA	EQU	$4D
CHUNLI	EQU	$4E
UFOCH	EQU	$4F
TERSA	EQU	$50
TEKYU	EQU	$51
BHOLE	EQU	$52
BHOL2	EQU	$53
FISHG	EQU	$54
SBOMB	EQU	$55
OBOMB	EQU	$56
NINJA	EQU	$57
NINTM	EQU	$58
HAYAB	EQU	$59
BGKAO	EQU	$5A
BSLIM	EQU	$5B
TBOSS	EQU	$5C
BSNAK	EQU	$5D
GORMA	EQU	$5E
BSKEL	EQU	$5F
DDNGO	EQU	$60
WARP	EQU	$61
BFIRE	EQU	$62
BBIRD	EQU	$63
PSCRL	EQU	$64
BFISH	EQU	$65
ONOFS	EQU	$66
SWTRP	EQU	$67
MVHAS	EQU	$68
HIKUS	EQU	$69
IKADA	EQU	$6A
TANABE	EQU	$6B	; メッセージテスト！
NIWAT	EQU	$6C
WANWAN	EQU	$6D
BTFLY	EQU	$6E
FOXDOG	EQU	$6F
KODOMO	EQU	$70 ; SAME
KODOMA	EQU	$70 ; SAME
KODOMB	EQU	$71
KODOMC	EQU	$72
KODOMD	EQU	$73
MAMA0	EQU	$74
MAMA1	EQU	$75
PAPA1	EQU	$76	;Dr.ライト
URURI	EQU	$77
OZWAN	EQU	$78
MSWAN	EQU	$79
KARAS	EQU	$7A
TRYCY	EQU	$7B
BHANA	EQU	$7C
BHFIR	EQU	$7D
SHANA	EQU	$7E 
KAMEI	EQU	$7F
DENWA	EQU	$80
OBAQ	EQU	$81
OBQBAR	EQU	$82
BEDIN	EQU	$83
IZUMI	EQU	$84
HATO0	EQU	$85
FLYIT	EQU	$86	;Flying item
RANEM	EQU	$87
NOMOS	EQU	$88
HINO0	EQU	$89
PANEL	EQU	$8A
PANEL2	EQU	$8B
SWBLK	EQU	$8C
SWBLK2	EQU	$8D
MIZUB	EQU	$8E
HEIHO	EQU	$8F
SLOT	EQU	$90
KARBY	EQU	$91
OCHAN	EQU	$92
HEISM	EQU	$93	;もぐら兵士
HEISB	EQU	$94	;壁兵士
RICHD	EQU	$95
KAERU	EQU	$96
SWIMP	EQU	$97	;地上水潜りポイント
DAISU	EQU	$98	;サイコロ
AMENB	EQU	$99	;あめんぼ
YUKAB	EQU	$9A	;床 ビュン
YSLIM	EQU	$9B	;床スライム
BALEE	EQU	$9C	;バレリーナ
MOAI 	EQU	$9D	;石像
TBEAM	EQU	$9E	;トウロウビーム
KURI0	EQU	$9F	;栗ぼん
PIHAT	EQU	$A0	;ピーハット
LOPE	EQU	$A1	;ロープ
PACKN	EQU	$A2	;パックン花
LIFTX	EQU	$A3	;リフト 横
LIFTY	EQU	$A4	;リフト 縦
LIFTD	EQU	$A5	;リフト 載ったら落ちる！
LIFTT	EQU	$A6	;リフト 天秤！
HASIR	EQU	$A7	;Level 7 柱
TAMA0	EQU	$A8	;柱ぶつける玉
GESSO	EQU	$A9	;ゲッソー
PUKPK	EQU	$AA	;魚(横）
PUKPV	EQU	$AB	;魚(縦）
PUKPJ	EQU	$AC	;魚（ジャンプ）
MONKY	EQU	$AD	;猿
OCTAJ	EQU	$AE	;パタオクタ
YOSSI	EQU	$AF	;わらしべアイテム！
AMUSI	EQU	$B0	;穴虫！
YUKAS	EQU	$B1	;床作りブロック
AMUST	EQU	$B2	;穴わきだすやつ
HANNY	EQU	$B3	;ハチの巣
PAPA2	EQU	$B4	;タリン（ハチの巣）
KUMA0	EQU	$B5	;クマコック
PAPAL	EQU	$B6	;パパール
MAMAD	EQU	$B7	;人魚
TURI	EQU	$B8	;橋の下釣りおやじ
NYOROO	EQU	$B9	;ニョロニョロ
PKURI	EQU	$BA	;パタクリ
SHIGE	EQU	$BB	;しげミン！
TUKAI	EQU	$BC	;鳥使い！
ARIMA	EQU	$BD	;バイア
BOXER	EQU	$BE	;ボクサー
ZONBI	EQU	$BF	;ゾンビ
KHIMI	EQU	$C0	;看板秘密！
GIRL1	EQU	$C1	;海岸マリン！
GIRL2	EQU	$C2	;橋の上マリン！
MAMUU	EQU	$C3	;笛カエル！
TODD	EQU	$C4	;セイウチトッド
UNIUNI	EQU	$C5	;うにうに
KANI	EQU	$C6	;かに！
MANBO	EQU	$C7	;マンボウ
USAGI	EQU	$C8	;マリン呼ぶうさぎ
ONPU 	EQU	$C9	;おんぷ
AKUMA	EQU	$CA	;小悪魔
ZORA	EQU	$CB	;ゾーラ
BLANKA	EQU	$CC	;ピラニア
WANI	EQU	$CD	;ワニ絵かき
MAMAD2	EQU	$CE	;にんぎょ像！
GAGE	EQU	$CF	;剣２もらうとこのやつ！
USAG2	EQU	$D0	;動物村 うさぎ
KUMAS	EQU	$D1	;動物村 小くま
NTORI	EQU	$D2	;動物村 南国鳥
GMUSI	EQU	$D3	;動物村 虫
OBAKE	EQU	$D4	;迷いオバケ（オプション）
NIWAX	EQU	$D5	;ニワトリ（オプション）
YTUBO	EQU	$D6	;横用壷	
DOSNS	EQU	$D7	;ドスン Ｓ	
DOSNB	EQU	$D8	;ドスン Ｌ
TAIAT	EQU	$D9	;体当たりおちる奴！
FIREB	EQU	$DA	;ヨコバブル！
BABUB	EQU	$DB	;大バブル
KAZAM	EQU	$DC	;風見鳥！&ニワトリオヤジ
BOOK	EQU	$DD	;図書館の本
SEIREN	EQU	$DE	;卵山楽器デモ！
KENBM	EQU	$DF	;剣ビーム
;- Bank 15
SARUK	EQU	$E0	;木の上猿！
MOUSE	EQU	$E1	;木の上猿！
HODAI	EQU	$E2	;火のほうだい！
SANBO	EQU	$E3	;さぼてん！
MBOSS	EQU	$E4	;モリブリンボス！
FLYIT2	EQU	$E5	;パタアイテム（矢、ハート）
;------------------------------------
BOSS	EQU	$E6	;ラスト ボス！
SIROS	EQU	$E7	;城スイッチ！
;-- Ending obj - - - -
EDAI	EQU	$E8	;台
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ENMDD0
	DB	%01000010 ;PYAAA
	DB	%11000010 ;BUMER
;;	DB	%00000010 ;TEST 
	DB	%11010010 ;BOMBR
	DB	%11000010 ;FUCKS
	DB	%11000010 ;PRTBM
;
	DB	%11010010 ;KTOBJ
	DB	%11000010 ;BLOCK
	DB	%11000010 ;TAKAR
	DB	%11000011 ;POWDR
;
	DB	%00010010 ;OCTA1
	DB	%01000010 ;OCTAM
	DB	%00010010 ;MORI1
	DB	%01000010 ;MORYA
	DB	%00010010 ;TEKTA
	DB	%00010010 ;RIVER
	DB	%10010010 ;KUZUH
	DB	%00010010 ;GHOST
	DB	%00011000 ;GHOSB
	DB	%00010010 ;GHOSS
	DB	%00010001 ;BOMBO
	DB	%00010010 ;HEIS0
	DB	%00000010 ;BABUL
	DB	%00000010 ;SPARK
	DB	%00000010 ;SPAR2
	DB	%00010010 ;PORUS
	DB	%00000010 ;BLBAT
	DB	%00010010 ;SKEL0
	DB	%00010010 ;SLIMB
	DB	%00010001 ;SLIMS
	DB	%00000010 ;BASSF
	DB	%00010010 ;SKEL1
	DB	%00010010 ;MUMMY
	DB	%00010010 ;MOTOS
	DB	%00000010 ;MAGE0
	DB	%01000010 ;SONIC
	DB	%10010010 ;LAIKU
	DB	%00010010 ;HIPLP
	DB	%11100010 ;BOSS1
	DB	%11100010 ;KWUSO
	DB	%00000010 ;TRAP0
	DB	%00010010 ;COPYA
	DB	%00000010 ;HAYAM
	DB	%00000010 ;RENO7
	DB	%01000001 ;R7BEM
	DB	%00010010 ;INOSI
;
	DB	%10110001 ;HART1
	DB	%10110001 ;RUPY1
	DB	%10110001 ;YOSEI
	DB	%10110001 ;KEYSM
	DB	%10110001 ;PLTAT
	DB	%10110010 ;HMASK
	DB	%10110010 ;POWER
	DB	%10110001 ;KINOM
	DB	%10110010 ;KAKER
	DB	%10110010 ;HARTB
	DB	%10110010 ;ALOW1 
	DB	%10110001 ;BOMB1 
	DB	%10010010 ;GAKKI 
	DB	%10110010 ;KINOK 
	DB	%10110001 ;MGPOW
	DB	%10110010 ;KAKIN
	DB	%10110001 ;KAIIN
	DB	%10000010 ;GIRL0 
	DB	%10010010 ;PAPA0 
	DB	%10000100 ;BABA0 
	DB	%10010010 ;FUKURO
	DB	%10000010 ;HINTO 
	DB	%11000000 ;EWOOD 
	DB	%11000000 ;MSPNT 
	DB	%11000010 ;IWAGO 
	DB	%10000010 ;SWBLKU
	DB	%10000010 ;SWBLKD
	DB	%10000010 ;SWBLKL
	DB	%10000010 ;SWBLKR
	DB	%10000010 ;;;STEST
	DB	%10000010 ;MSTESF
	DB	%01000001 ;FRBAR
	DB	%10000010 ;NYAMA
	DB	%10000010 ;CHUNLI
	DB	%10000010 ;UFOCH
	DB	%00010010 ;TERSA
	DB	%00000010 ;TEKYU
	DB	%01000010 ;BHOLE
	DB	%01000010 ;BHOL2
	DB	%11000010 ;FISHG
	DB	%00000010 ;SBOMB
	DB	%00000010 ;OBOMB
	DB	%00000010 ;NINJA
	DB	%01000010 ;NINTM
	DB	%00001000 ;HAYAB
	DB	%01001000 ;BGKAO
	DB	%00000000 ;BSLIM
	DB	%10010001 ;TBOSS
	DB	%00000010 ;BSNAK
	DB	%00000000 ;GORMA
	DB	%00000000 ;BSKEL
	DB	%00000010 ;DDNGO
	DB	%11000010 ;WARP
	DB	%00001000 ;BFIRE
	DB	%00000010 ;BBIRD
	DB	%11000000 ;PSCRL
	DB	%00000000 ;BFISH
	DB	%10000010 ;ONOFS
	DB	%00000010 ;SWTRP
	DB	%11000000 ;MVHAS
	DB	%11000010 ;HIKUS
	DB	%10010010 ;IKADA
	DB	%10000010 ;TANABE
	DB	%10010010 ;NIWAT 
	DB	%00010010 ;WANWAN
	DB	%11000001 ;BTFLY 
	DB	%10010010 ;FOXDOG
	DB	%10010010 ;KODOMA
	DB	%10010010 ;KODOMB
	DB	%10010010 ;KODOMC
	DB	%10010010 ;KODOMD
	DB	%10010011 ;MAMA0 
	DB	%10010010 ;MAMA1 
	DB	%10010010 ;PAPA1 
	DB	%10010010 ;URURI 
	DB	%10010010 ;OZWAN 
	DB	%10010010 ;MSWAN 
	DB	%01010010 ;KARAS 
	DB	%10010010 ;TRYCY 
	DB	%00000000 ;BHANA 
	DB	%01000010 ;BHFIR 
	DB	%00000010 ;SHANA 
	DB	%10000010 ;KAMEI 
	DB	%10010010 ;DENWA 
	DB	%00000000 ;OBAQ  
	DB	%01000010 ;OBQBAR  
	DB	%11000010 ;BEDIN   
	DB	%11010001 ;IZUMI   
	DB	%11010010 ;HATO0   
	DB	%11010001 ;FLYIT   
	DB	%00010010 ;RANEM   
	DB	%10000100 ;NOMOS   
	DB	%00001100 ;HINO0   
	DB	%11000010 ;PANEL   
	DB	%11000010 ;PANEL2   
	DB	%10010010 ;SWBLK    
	DB	%10010010 ;SWBLK2   
	DB	%00001000 ;MIZUB
	DB	%00010010 ;HEIHO
	DB	%00010010 ;SLOT 
	DB	%00010011 ;KARBY
	DB	%00010100 ;OCHAN
	DB	%00010010 ;HEISM
	DB	%10000000 ;HEISB
	DB	%10010010 ;RICHD
	DB	%10010010 ;KAERU
	DB	%11000000 ;SWIMP
	DB	%11010010 ;DAISU
	DB	%00010010 ;AMENB
	DB	%11000000 ;YUKAB
	DB	%11010010 ;YSLIM
	DB	%00010010 ;BALEE
	DB	%10010100 ;MOAI
	DB	%11000000 ;TBEAM
	DB	%00010010 ;KURI0
	DB	%00010010 ;PIHAT
	DB	%00010010 ;LOPE 
	DB	%00010100 ;PACKN
	DB	%11000100 ;LIFTX
	DB	%11000100 ;LIFTY
	DB	%11000100 ;LIFTD
	DB	%11000010 ;LIFTT
	DB	%10001010 ;HASIR
	DB	%10010010 ;TAMA0
	DB	%00000010 ;GESSO
	DB	%00010010 ;PUKPK
	DB	%00010010 ;PUKPV
	DB	%00010010 ;PUKPJ
	DB	%10010010 ;MONKY
	DB	%00010010 ;OCTAJ
	DB	%10110010 ;YOSSI
	DB	%00000010 ;AMUSI
	DB	%10000010 ;YUKAS
	DB	%11000000 ;AMUST
	DB	%10000010 ;HANNY 
	DB	%10010010 ;PAPA2
	DB	%10000010 ;KUMA0
	DB	%10010010 ;PAPAL
	DB	%10010100 ;MAMAD
	DB	%10010101 ;TURI
	DB	%00010010 ;NYORO
	DB	%00010011 ;PKURI
	DB	%00010010 ;SHIGE
	DB	%00010010 ;TUKAI
	DB	%00010011 ;ARIMA
	DB	%00010110 ;BOXER
	DB	%01010010 ;ZONBI
	DB	%11000000 ;KHIMI
	DB	%11010010 ;GIRL1
	DB	%11010010 ;GIRL2
	DB	%10010100 ;MAMUU
	DB	%10011000 ;TODD 
	DB	%00010010 ;UNIUNI 
	DB	%00010010 ;KANI   
	DB	%11010000 ;MANBO   
	DB	%11010010 ;USAGI   
	DB	%11000001 ;ONPU    
	DB	%10001000 ;AKUMA   
	DB	%00000010 ;ZORA    
	DB	%01010010 ;BLANKA    
	DB	%10000101 ;WANI      
	DB	%10000100 ;MAMAD2      
	DB	%11000010 ;GAGE        
	DB	%10000010 ;USAG2
	DB	%10000010 ;KUMAS
	DB	%10000010 ;NTORI
	DB	%11010010 ;GMUSI
	DB	%11010010 ;OBAKE
	DB	%11010010 ;NIWAX
	DB	%10000010 ;YTUBO
	DB	%00000010 ;DOSNS
	DB	%11000010 ;DOSNB
	DB	%11001000 ;TAIAT
	DB	%01000010 ;FIREB
	DB	%01001000 ;BABUB
	DB	%11000100 ;KAZAM
	DB	%11000010 ;BOOK 
	DB	%11000010 ;SEIREN 
	DB	%11000010 ;KENBM
	DB	%11010011 ;SARUK 
	DB	%11010010 ;MOUSE 
	DB	%01000010 ;HODAI 
	DB	%00010010 ;SANBO 
	DB	%00010011 ;MBOSS 
	DB	%11010010 ;FLYIT2   
	DB	%01010000 ;BOSS  	
	DB	%11000000 ;SIROS
;--------
	DB	%00000000 ;EDAI        
;
ENMDD1
	DB	%00000000 ;PYAAA
;;	DB	%00000000 ;TEST
	DB	%00000000 ;BUMER
	DB	%00000001 ;BOMBR
	DB	%00000001 ;FUCKS
	DB	%00000001 ;PRTBM
;
	DB	%00000000 ;KTOBJ
	DB	%00000110 ;BLOCK
	DB	%00000000 ;TAKAR
	DB	%00000000 ;POWDR
;
	DB	%00000000 ;OCTA1
	DB	%00000000 ;OCTAM
	DB	%00000000 ;MORI1
	DB	%00000000 ;MORYA
	DB	%00000000 ;TEKTA
	DB	%00000000 ;RIVER
	DB	%10000000 ;KUZUH
	DB	%00000000 ;GHOST
	DB	%00001000 ;GHOSB
	DB	%00000000 ;GHOSS
	DB	%00000001 ;BOMBO
	DB	%00000000 ;HEIS0
	DB	%00000000 ;BABUL
	DB	%00000011 ;SPARK
	DB	%00000011 ;SPAR2
	DB	%00000000 ;PORUS
	DB	%00000000 ;BLBAT
	DB	%00000000 ;SKEL0
	DB	%00000000 ;SLIMB
	DB	%00010000 ;SLIMS
	DB	%00000010 ;BASSF
	DB	%00000000 ;SKEL1
	DB	%00000000 ;MUMMY
	DB	%00000000 ;MOTOS
	DB	%00000000 ;MAGE0
	DB	%00000000 ;SONIC
	DB	%00000000 ;LAIKU
	DB	%00000000 ;HIPLP
	DB	%10000000 ;BOSS1
	DB	%10000000 ;KWUSO
	DB	%10000010 ;TRAP0
	DB	%00000000 ;COPYA
	DB	%00000000 ;HAYAM
	DB	%10000000 ;RENO7
	DB	%00000000 ;R7BEM
	DB	%10000000 ;INOSI
;
	DB	%00011101 ;HART1
	DB	%00011101 ;RUPY1
	DB	%00011101 ;YOSEI
	DB	%00011101 ;KEYSM
	DB	%00011101 ;PLTAT
	DB	%00000001 ;HMASK
	DB	%00011101 ;POWER
	DB	%00011101 ;KINOM
	DB	%00011101 ;KAKER
	DB	%00011101 ;HARTB
	DB	%00011101 ;ALOW1 
	DB	%00011101 ;BOMB1 
	DB	%10011101 ;GAKKI 
	DB	%00011101 ;KINOK 
	DB	%00011101 ;MGPOW
	DB	%00011101 ;KAKIN
	DB	%00011101 ;KAIIN 
	DB	%10011000 ;GIRL0  
	DB	%10011000 ;PAPA0 
	DB	%10011000 ;BABA0 
	DB	%10011000 ;FUKURO
	DB	%10011000 ;HINTO 
	DB	%10011000 ;EWOOD 
	DB	%10011000 ;MSPNT 
	DB	%00000000 ;IWAGO 
	DB	%10000100 ;SWBLKU 
	DB	%10000100 ;SWBLKD 
	DB	%10000100 ;SWBLKL 
	DB	%10000100 ;SWBLKR 
	DB	%10011000 ;;;STEST 
	DB	%10011000 ;MSTESF
	DB	%00000000 ;FRBAR
	DB	%10011000 ;NYAMA
	DB	%10011000 ;CHUNLI
	DB	%10011000 ;UFOCH
	DB	%00000000 ;TERSA
	DB	%00000000 ;TEKYU
	DB	%00000000 ;BHOLE
	DB	%00000000 ;BHOL2
	DB	%10000000 ;FISHG
	DB	%00000000 ;SBOMB
	DB	%00000000 ;OBOMB
	DB	%00000000 ;NINJA
	DB	%00000000 ;NINTM
	DB	%10001000 ;HAYAB
	DB	%00001000 ;BGKAO
	DB	%00000000 ;BSLIM
	DB	%10000000 ;TBOSS
	DB	%10000000 ;BSNAK
	DB	%10000000 ;GORMA
	DB	%10101000 ;BSKEL
	DB	%10000000 ;DDNGO
	DB	%00000000 ;WARP 
	DB	%00000000 ;BFIRE
	DB	%00000000 ;BBIRD
	DB	%00000000 ;PSCRL
	DB	%00000000 ;BFISH
	DB	%00000000 ;ONOFS
	DB	%10000000 ;SWTRP
	DB	%00000000 ;MVHAS
	DB	%00000000 ;HIKUS
	DB	%10000000 ;IKADA
	DB	%10011000 ;TANABE
	DB	%00000000 ;NIWAT 
	DB	%10000000 ;WANWAN 
	DB	%00000000 ;BTFLY 
	DB	%00000000 ;FOXDOG
	DB	%10011000 ;KODOMA
	DB	%10011000 ;KODOMB
	DB	%10011000 ;KODOMC
	DB	%10011000 ;KODOMD
	DB	%10011000 ;MAMA0 
	DB	%10011000 ;MAMA1 
	DB	%10011000 ;PAPA1 
	DB	%10011000 ;URURI 
	DB	%10000000 ;OZWAN 
	DB	%10011000 ;MSWAN 
	DB	%00000000 ;KARAS 
	DB	%10011000 ;TRYCY 
	DB	%00001000 ;BHANA 
	DB	%00010000 ;BHFIR 
	DB	%00000000 ;SHANA 
	DB	%10000000 ;KAMEI 
	DB	%10011000 ;DENWA 
	DB	%00000000 ;OBAQ  
	DB	%00100000 ;OBQBAR  
	DB	%00000000 ;BEDIN    
	DB	%00000000 ;IZUMI    
	DB	%00000000 ;HATO0    
	DB	%00111000 ;FLYIT    
	DB	%00000000 ;RANEM    
	DB	%10001000 ;NOMOS    
	DB	%00001000 ;HINO0
	DB	%00000100 ;PANEL
	DB	%00000100 ;PANEL2
	DB	%10000100 ;SWBLK 
	DB	%10000100 ;SWBLK2
	DB	%10001000 ;MIZUB
	DB	%00000000 ;HEIHO 
	DB	%00000000 ;SLOT  
	DB	%00000000 ;KARBY 
	DB	%10000000 ;OCHAN
	DB	%00000000 ;HEISM
	DB	%00000000 ;HEISB
	DB	%10000000 ;RICHD
	DB	%10000000 ;KAERU
	DB	%00000000 ;SWIMP
	DB	%00000000 ;DAISU
	DB	%00000000 ;AMENB
	DB	%00000000 ;YUKAB
	DB	%00000000 ;YSLIM
	DB	%00000000 ;BALEE
	DB	%10100100 ;MOAI 
	DB	%00000000 ;TBEAM
	DB	%00000000 ;KURI0
	DB	%00000000 ;PIHAT
	DB	%00000000 ;LOPE 
	DB	%00000000 ;PACKN
	DB	%00101100 ;LIFTX
	DB	%00101100 ;LIFTY 
	DB	%00101100 ;LIFTD 
	DB	%00110000 ;LIFTT 
	DB	%10100100 ;HASIR 
	DB	%10000000 ;TAMA0 
	DB	%00000000 ;GESSO 
	DB	%00000000 ;PUKPK 
	DB	%00000000 ;PUKPV 
	DB	%00000000 ;PUKPJ 
	DB	%10000000 ;MONKY 
	DB	%00000000 ;OCTAJ 
	DB	%00011101 ;YOSSI
	DB	%00000000 ;AMUSI 
	DB	%10011000 ;YUKAS 
	DB	%00000000 ;AMUST 
	DB	%10011000 ;HANNY 
	DB	%10011000 ;PAPA2
	DB	%10110100 ;KUMA0
	DB	%10011000 ;PAPAL
	DB	%10011000 ;MAMAD
	DB	%10011000 ;TURI 
	DB	%00000000 ;NYORO 
	DB	%00000000 ;PKURI 
	DB	%00000000 ;SHIGE 
	DB	%00000000 ;TUKAI 
	DB	%00000000 ;ARIMA 
	DB	%10000000 ;BOXER 
	DB	%00000000 ;ZONBI 
	DB	%00000000 ;KHIMI 
	DB	%00011000 ;GIRL1
	DB	%00011000 ;GIRL2
	DB	%10110100 ;MAMUU
	DB	%10110100 ;TODD 
	DB	%00000110 ;UNIUNI
	DB	%00000000 ;KANI  
	DB	%00110100 ;MANBO
	DB	%10011000 ;USAGI
	DB	%00000000 ;ONPU  
	DB	%10000000 ;AKUMA 
	DB	%00000000 ;ZORA  
	DB	%00000000 ;BLANKA  
	DB	%10011000 ;WANI    
	DB	%10011000 ;MAMAD2  
	DB	%00000000 ;GAGE    
	DB	%10011000 ;USAG2
	DB	%10011000 ;KUMAS
	DB	%10011000 ;NTORI
	DB	%10011000 ;GMUSI
	DB	%00000000 ;OBAKE
	DB	%00011000 ;NIWAX
	DB	%10111101 ;YTUBO
	DB	%10000000 ;DOSNS
	DB	%00101101 ;DOSNB
	DB	%00101101 ;TAIAT
	DB	%00000000 ;FIREB
	DB	%00001010 ;BABUB
	DB	%00000000 ;KAZAM
	DB	%00000000 ;BOOK    
	DB	%00000000 ;SEIREN  
	DB	%00000000 ;KENBM
	DB	%00000000 ;SARUK 
	DB	%00000000 ;MOUSE 
	DB	%00000000 ;HODAI 
	DB	%00000000 ;SANBO 
	DB	%10000100 ;MBOSS 
	DB	%00111000 ;FLYIT2    
	DB	%00000000 ;BOSS  
	DB	%00000000 ;SIROS 
	DB	%00000000 ;EDAI    
ENMDD2
	DB	$00 ;PYAAA
	DB	$00 ;TEST 
	DB	$02 ;BOMBR
	DB	$00 ;FUCKS
	DB	$00 ;PRTBM
;
	DB	$00 ;KTOBJ
	DB	$00 ;BLOCK
	DB	$00 ;TAKAR
	DB	$00 ;POWDR
;
	DB	$00 ;OCTA1
	DB	$0D ;OCTAM
	DB	$01 ;MORI1
	DB	$0D ;MORYA
	DB	$01 ;TEKTA
	DB	$01 ;RIVER
	DB	$08 ;KUZUH
	DB	$13 ;GHOST
	DB	$13 ;GHOSB
	DB	$13 ;GHOSS
	DB	$00 ;BOMBO
	DB	$01 ;HEIS0
	DB	$06 ;BABUL
	DB	$2C ;SPARK
	DB	$2C ;SPAR2
	DB	$0C ;PORUS
	DB	$00 ;BLBAT
	DB	$2A ;SKEL0
	DB	$00 ;SLIMB
	DB	$00 ;SLIMS
	DB	$00 ;BASSF
	DB	$2A ;SKEL1
	DB	$2F ;MUMMY
	DB	$0B ;MOTOS
	DB	$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1B ;BFISH
	DB	$22 ;ONOFS
	DB	$00 ;SWTRP
	DB	$00 ;MVHAS
	DB	$00 ;HIKUS
	DB	$00 ;IKADA
	DB	$00 ;TANABE
	DB	$00 ;NIWAT 
	DB	$00 ;WANWAN
	DB	$00 ;BTFLY 
	DB	$00 ;FOXDOG
	DB	$00 ;KODOMA
	DB	$00 ;KODOMB
	DB	$00 ;KODOMC
	DB	$00 ;KODOMD
	DB	$00 ;MAMA0 
	DB	$00 ;MAMA1 
	DB	$00 ;PAPA1 
	DB	$00 ;URURI 
	DB	$00 ;OZWAN 
	DB	$00 ;MSWAN 
	DB	$21 ;KARAS 
	DB	$00 ;TRYCY 
	DB	$29 ;BHANA 
	DB	$00 ;BHFIR 
	DB	$29 ;SHANA 
	DB	$00 ;KAMEI 
	DB	$00 ;DENWA 
	DB	$13 ;OBAQ  
	DB	$00 ;OBQBAR  
	DB	$00 ;BEDIN   
	DB	$00 ;IZUMI   
	DB	$00 ;HATO0   
	DB	$00 ;FLYIT   
	DB	$13 ;RANEM   
	DB	$15 ;NOMOS   
	DB	$14 ;HINO0   
	DB	$01 ;PANEL   
	DB	$01 ;PANEL2   
	DB	$01 ;SWBLK    
	DB	$01 ;SWBLK2   
	DB	$13 ;MIZUB    
	DB	$24 ;HEIHO    
;;;	DB	$25 ;SLOT     
	DB	$2D ;SLOT     
	DB	$2E ;KARBY    
	DB	$13 ;OCHAN   
	DB	$25 ;HEISM   
	DB	$23 ;HEISB   
	DB	$00 ;RICHD   
	DB	$00 ;KAERU   
	DB	$00 ;SWIMP   
	DB	$00 ;DAISU   
	DB	$00 ;AMENB   
	DB	$00 ;YUKAB   
	DB	$00 ;YSLIM   
	DB	$00 ;BALEE   
	DB	$00 ;MOAI    
	DB	$00 ;TBEAM   
	DB	$00 ;KURI0   
	DB	$00 ;PIHAT   
	DB	$00 ;LOPE    
	DB	$00 ;PACKN   
	DB	$00 ;LIFTX   
	DB	$00 ;LIFTY   
	DB	$00 ;LIFTD   
	DB	$00 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A
;;	DB	%00000000 ;TEST 
	DB	%00010010 ;BUMER
	DB	%00001010 ;BOMBR
	DB	%00010010 ;FUCKS
	DB	%00010010 ;PRTBM
;
	DB	%00001010 ;KTOBJ
	DB	%00000010 ;BLOCK
	DB	%00000010 ;TAKAR 1
	DB	%00000010 ;POWDR 2
;
	DB	%00001000 ;OCTA1  3
	DB	%00010010 ;OCTAM 4
	DB	%00001000 ;MORI1  5
	DB	%00010010 ;MORYA
	DB	%00001000 ;TEKTA
	DB	%00000000 ;RIVER
	DB	%01000000 ;KUZUH
	DB	%00010001 ;GHOST
	DB	%00010001 ;GHOSB
	DB	%00010001 ;GHOSS
	DB	%00000000 ;BOMBO
	DB	%00001000 ;HEIS0
	DB	%00010010 ;BABUL
	DB	%00010010 ;SPARK
	DB	%00010010 ;SPAR2
	DB	%00001000 ;PORUS
	DB	%00010001 ;BLBAT
	DB	%00001000 ;SKEL0
	DB	%00001000 ;SLIMB
	DB	%00001000 ;SLIMS
	DB	%00010000 ;BASSF
	DB	%00001000 ;SKEL1
	DB	%00001000 ;MUMMY
	DB	%00001000 ;MOTOS
	DB	%00001000 ;MAGE0
	DB	%00010010 ;SONIC
	DB	%00001000 ;LAIKU
	DB	%00001000 ;HIPLP
	DB	%00001000 ;BOSS1
	DB	%00001000 ;KWUSO
	DB	%01010010 ;TRAP0
	DB	%00001000 ;COPYA
	DB	%00001000 ;HAYAM
	DB	%00001010 ;RENO7
	DB	%00010010 ;R7BEM
	DB	%00001000 ;INOSI
;
	DB	%00001010 ;HART1
	DB	%00001010 ;RUPY1
	DB	%00010011 ;YOSEI
	DB	%00001010 ;KEYSM
	DB	%00001010 ;PLTAT
	DB	%00001010 ;HMASK
	DB	%00001010 ;POWER
	DB	%00001010 ;KINOM
	DB	%00001010 ;KAKER
	DB	%00001000 ;HARTB
	DB	%00001010 ;ALOW1 
	DB	%00001010 ;BOMB1 
	DB	%00001000 ;GAKKI 
	DB	%00001010 ;KINOK 
	DB	%00001010 ;MGPOW 
	DB	%00011011 ;KAKIN 
	DB	%00011010 ;KAIIN 
	DB	%00000010 ;GIRL0 
	DB	%00000010 ;PAPA0 
	DB	%00000010 ;BABA0 
	DB	%00000010 ;FUKURO
	DB	%00000010 ;HINTO 
	DB	%00000010 ;EWOOD 
	DB	%00000010 ;MSPNT 
	DB	%01000010 ;IWAGO 
	DB	%00000010 ;SWBLKU
	DB	%00000010 ;SWBLKD
	DB	%00000010 ;SWBLKL
	DB	%00000010 ;SWBLKR
	DB	%00000010 ;;;STEST 
	DB	%00000010 ;MSTESF
	DB	%00010010 ;FRBAR
	DB	%00000000 ;NYAMA
	DB	%00000010 ;CHUNLI
	DB	%00000010 ;UFOCH
	DB	%00110000 ;TERSA
	DB	%00001000 ;TEKYU
	DB	%00000010 ;BHOLE
	DB	%00000010 ;BHOL2
	DB	%00000010 ;FISHG
	DB	%00001000 ;SBOMB
	DB	%00001000 ;OBOMB
	DB	%00001000 ;NINJA
	DB	%00010010 ;NINTM
	DB	%11010000 ;HAYAB
	DB	%10010000 ;BGKAO
	DB	%10010000 ;BSLIM
	DB	%11010000 ;TBOSS
	DB	%10010000 ;BSNAK
	DB	%11010100 ;GORMA
	DB	%10000100 ;BSKEL
	DB	%11010100 ;DDNGO
	DB	%00000010 ;WARP 
	DB	%11010000 ;BFIRE
	DB	%10010000 ;BBIRD
	DB	%00000010 ;PSCRL
	DB	%10000000 ;BFISH
	DB	%00000010 ;ONOFS
	DB	%01000010 ;SWTRP
	DB	%00010010 ;MVHAS
	DB	%00000010 ;HIKUS
	DB	%00000010 ;IKADA
	DB	%00000010 ;TANABE
	DB	%00000010 ;NIWAT 
	DB	%01000011 ;WANWAN
	DB	%00000000 ;BTFLY 
	DB	%00000000 ;FOXDOG
	DB	%00000000 ;KODOMA
	DB	%00000000 ;KODOMB
	DB	%00000000 ;KODOMC
	DB	%00000000 ;KODOMD
	DB	%00000000 ;MAMA0 
	DB	%00000000 ;MAMA1 
	DB	%00000000 ;PAPA1 
	DB	%00000000 ;URURI 
	DB	%00000000 ;OZWAN 
	DB	%00000000 ;MSWAN 
	DB	%00100000 ;KARAS 
	DB	%00000000 ;TRYCY 
	DB	%00000010 ;BHANA 
	DB	%00000010 ;BHFIR 
	DB	%00000010 ;SHANA 
	DB	%01000000 ;KAMEI 
	DB	%00000000 ;DENWA 
	DB	%10000100 ;OBAQ  
	DB	%01000000 ;OBQBAR  
	DB	%00000000 ;BEDIN   
	DB	%00000000 ;IZUMI   
	DB	%00000000 ;HATO0   
	DB	%00000010 ;FLYIT   
	DB	%10000100 ;RANEM   
	DB	%11000100 ;NOMOS   
	DB	%10010100 ;HINO0   
	DB	%00000000 ;PANEL   
	DB	%00000000 ;PANEL2   
	DB	%00000000 ;SWBLK    
	DB	%00000000 ;SWBLK2   
	DB	%10000100 ;MIZUB
	DB	%00000000 ;HEIHO   
	DB	%00000000 ;SLOT    
	DB	%00000000 ;KARBY   
	DB	%11000100 ;OCHAN  
	DB	%00010000 ;HEISM  
	DB	%00000000 ;HEISB  
	DB	%00000000 ;RICHD  
	DB	%00000000 ;KAERU  
	DB	%00000000 ;SWIMP  
	DB	%00000000 ;DAISU  
	DB	%00010000 ;AMENB  
	DB	%00000000 ;YUKAB  
	DB	%00000000 ;YSLIM  
	DB	%00000000 ;BALEE  
	DB	%01000010 ;MOAI  
	DB	%00000010 ;TBEAM  
	DB	%00000000 ;KURI0  
	DB	%00000000 ;PIHAT  
	DB	%00000000 ;LOPE   
	DB	%00000000 ;PACKN  
	DB	%00000010 ;LIFTX  
	DB	%00000010 ;LIFTY  
	DB	%00000010 ;LIFTD  
	DB	%00000010 ;LIFTT  
	DB	%01000010 ;HASIR  
	DB	%01000010 ;TAMA0  
	DB	%00000000 ;GESSO  
	DB	%00010000 ;PUKPK  
	DB	%00010000 ;PUKPV  
	DB	%00001000 ;PUKPJ  
	DB	%00011000 ;MONKY  
	DB	%00000000 ;OCTAJ  
	DB	%00010011 ;YOSSI
	DB	%00000000 ;AMUSI  
	DB	%00010010 ;YUKAS  
	DB	%00000000 ;AMUST  
	DB	%00000010 ;HANNY 
	DB	%00000010 ;PAPA2
	DB	%00000010 ;KUMA0
	DB	%00000010 ;PAPAL
	DB	%00000010 ;MAMAD
	DB	%00000010 ;TURI
	DB	%00000000 ;NYORO  
	DB	%00000001 ;PKURI  
	DB	%00000000 ;SHIGE  
	DB	%10000100 ;TUKAI  
	DB	%00010001 ;ARIMA  
	DB	%10000100 ;BOXER  
	DB	%00000000 ;ZONBI  
	DB	%00000000 ;KHIMI  
	DB	%00000011 ;GIRL1
	DB	%00000010 ;GIRL2
	DB	%00000010 ;MAMUU
	DB	%00000010 ;TODD
	DB	%00000010 ;UNIUNI
	DB	%00000010 ;KANI  
	DB	%00000010 ;MANBO 
	DB	%00000010 ;USAGI 
	DB	%00000010 ;ONPU  
	DB	%00000010 ;AKUMA 
	DB	%00000010 ;ZORA  
	DB	%00000010 ;BLANKA  
	DB	%00000010 ;WANI  
	DB	%00000010 ;MAMAD2
	DB	%00000010 ;GAGE  
	DB	$00 ;USAG2
	DB	$00 ;KUMAS
	DB	$00 ;NTORI
	DB	$00 ;GMUSI
	DB	$00 ;OBAKE
	DB	%00000011 ;NIWAX
	DB	%00000010 ;YTUBO  
	DB	%01000010 ;DOSNS  
	DB	%01000010 ;DOSNB  
	DB	%00000010 ;TAIAT  
	DB	%00000010 ;FIREB 
	DB	%00000010 ;BABUB 
	DB	%00000010 ;KAZAM 
	DB	%00000010 ;BOOK  
	DB	%00000010 ;SEIREN
	DB	%00010010 ;KENBM
	DB	%00000010 ;SARUK 
	DB	%00000010 ;MOUSE 
	DB	%00000010 ;HODAI 
	DB	%00000010 ;SANBO
	DB	%00000000 ;MBOSS
	DB	%00000010 ;FLYIT2   
	DB	%00000000 ;BOSS  
	DB	%00000010 ;SIROS  
	DB	%00000010 ;EDAI  
;------------------------------------------------
ITMHITD
;;		0 1 2 3 4 5 6 7 8 9 A B * * * *
	DB	1,1,1,0,0,1,2,1,2,3,3,2,0,0,0,0	;0
	DB	1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	0,0,0,0,0,0,0,2,4,0,2,2,0,0,0,0	;2E KARBY
	DB	1,1,1,1,1,1,1,2,4,0,3,2,0,0,0,0	;2F MUMMY
	DB	1,1,1,1,1,2,2,1,1,0,3,2,0,0,0,0	;30 NINJA
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ITMHITP
;;	 FF:Stop  FE:Fire  FD:Fairy
;;		  0   1   2   3   4   5   6   7
	DB	$00,$01,$02,$40,$00,$00,$00,$00 ;0
	DB	$00,$02,$01,$40,$00,$00,$00,$00 ;1
	DB	$00,$04,$02,$40,$00,$00,$00,$00 ;2
	DB	$00,$08,$04,$40,$00,$00,$00,$00 ;3
	DB	$00,$10,$08,$40,$00,$00,$00,$00 ;4
	DB	$00,$01,$04,$40,$00,$00,$00,$00 ;5
	DB	$00,$FF,$02,$40,$00,$00,$00,$00 ;6
	DB	$00,$01,$04,$40,$00,$00,$00,$00 ;7
	DB	$00,$FF,024,$FE,$02,$FD,$00,$00 ;8
	DB	$00,$FF,$FD,$FE,$00,$00,$00,$00 ;9
	DB	$00,$01,$04,$FE,$00,$00,$00,$00 ;A
	DB	$00,$FF,$02,$40,$00,$00,$00,$00 ;B
	DB	$00,$01,$02,$40,$00,$00,$00,$00 ;C
	DB	$00,$01,$02,$40,$00,$00,$00,$00 ;D
	DB	$00,$01,$02,$40,$00,$00,$00,$00 ;E
	DB	$00,$01,$02,$40,$00,$00,$00,$00 ;F
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LIFEDT	; 体力
;; 		0 1 2 3 4 5 6 7 8 9 A B C D E F 
	DB	1,2,2,4,4,4,4,4,4,4,4,4,4,4,4,4
;; 	        10 11 2 3  4  5 6 7 8 9 A  B C  D  E  F
	DB	12,63,8,8,08,12,0,0,4,6,8,10,4,20,10,24
;; 	        20 21 2 3 4 5  6  7 8 9 A B C D E F
	DB	4,02,08,8,2,4,$FF,0,2,4,2,3,1,1,8,6
;; 	        30 31 2 3 4 5  6  7 8 9 A B C D E F
	DB	2
ATCKDT	; 攻撃力
;; 		0 1 2 3  4 5 6 7  8 9  A B C D E F
	DB	4,4,8,8,24,8,4,8,16,8,16,8,8,4,8,8
;; 	       10 1 2 3 4  5 6 7 8 9  A  B  C  D  E  F
	DB	8,8,8,8,8,12,0,0,8,8,08,12,12,20,16,32
;; 	       20 1 2 3 4 5 6 7  8 9 A B C D E F
	DB	8,8,4,4,4,4,4,0,20,8,4,8,4,4,8,8
;; 	       30 1 2 3 4 5 6 7   8 9 A B C  D  E  F
	DB	4
ITSTDT	; 摘出アイテム
;;	0:00%  1:25%Rupy  2:50%Rupy  3:50%Heart 4:Heart100%
;;	5:25%Alow 6:25%heart 7:25%randam 8:50%randam 9:fairy50%
;;	A:100%Alow B:Bomb100% C:Rupy100% D:25%Fairy E:100%fairy
;
;; 		0 1 2 3 4 5  6 7  8 9 A  B C D E F
	DB	2,6,1,3,3,3,$D,8,$A,2,7,$B,0,4,0,8
;; 	       10  1  2  3  4  5 6 7 8 9 A B C D E F
	DB	4,$E,$E,$E,$E,$E,0,3,3,3,3,3,3,3,3,3
;; 	       20 1 2 3 4 5 6 7 8 9 A  B  C D E F
	DB	3,2,0,0,2,0,0,0,0,6,6,$D,$E,0,9,3
;; 	       30 1 2 3 4 5 6 7 8 9 A B  C D E F
	DB      6	
;- - - - - - - - - - - - - - - - - - - - - -
;-----------------------------------------
ENMDST
	CALL	ENRMCL
;
ENMDSTS
	LD	A,(GRNDPT)
	LD	HL,ENGRPT
	ADD	HL,BC
	LD	(HL),A
;
	LD	HL,ENJYUN
	ADD	HL,BC
	LD	(HL),$FF
;
ENMDSTS2
	LD	HL,ENMYNO
	ADD	HL,BC
	LD	E,(HL)
;
;;;	LD	E,A
	LD	D,B ;$0
;
	LD	HL,ENMDD0
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENMOD0
	ADD	HL,BC
	LD	(HL),A
;
	LD	HL,ENMDD1
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENMOD1
	ADD	HL,BC
	LD	(HL),A
;
;;	LD	HL,ENMDD2
;;	ADD	HL,DE
;;	LD	A,(HL)
;;	LD	HL,ENMOD2
;;	ADD	HL,BC
;;	LD	(HL),A
	CALL	ENSTST
;
	LD	HL,ENMDD3
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	(HL),A
;
	JP  	ENSZST	; Hit size set !!
;;	RET
;===============================================
;=	ステータス　セット		       =
;===============================================
ENSTST
	PUSH	DE
;
	LD	HL,ENMDD2
	ADD	HL,DE
	LD	E,(HL)
	LD	HL,ENMOD2
	ADD	HL,BC
	LD	(HL),E
;;	LD	E,A
	LD	D,B
	LD	HL,LIFEDT
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENLIFE
	ADD	HL,BC
	LD	(HL),A
;
	POP	DE
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BSKCLER
	LD	A,$01
	LD	(NAZOCL),A
	JP	ENCLER
;------------------------------------
ENINIT
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
	AND	%10000000
	JR	Z,EI09010	; Boss ?
;				; Yes !
	LD	A,(DJSVBF)
	AND	%00110000
	JR	Z,EI09008	; Already Boss fail chach ?
;				; yes ! not set
	JP	ENCLER
EI09008
	LD	A,(ENMYNO2)
	CP	BSKEL
	JR	NZ,EI0900A	;逃げるガイコツ？
;				;YES !
	LD	A,(GRNDPT)	;出現順番チェック！
	CP	$95
	JR	Z,EI0900A
	CP	$92
	JR	Z,EI0900A
	CP	$84
	JR	Z,EI0900B
;
	LD	A,(DJRMSV+$84)
	AND	%00110000
	JR	Z,BSKCLER
EI0900B
	LD	A,(DJRMSV+$92)
	AND	%00110000
	JR	Z,BSKCLER
	LD	A,(DJRMSV+$95)
	AND	%00110000
	JR	Z,BSKCLER
EI0900A
	LD	A,(DJFLAG)
	AND	A
	JR	Z,EI090A1
;
	LD	A,(BIRDFG)
	AND	A
	JR	NZ,EI09009
;
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
	AND	%00000100
	JR	Z,EI090A1	;中ボス？
;				;YES !
	LD	(DJSDON),A	;スクロールアウトBGMセットフラグ！
EI090A1
	CALL	SOUNDCLR	;(S)
;
EI09009
	XOR	A
	LD	(BSSDFG),A
;
	INC	A
	LD	(BOSSFG),A
;
	LD	A,$20
	LD	(BSSDTM),A
EI09010
	LD	HL,ENMODE
	ADD	HL,BC
;;	LD	A,EMOVE
	LD	(HL),EMOVE ;A
;
	LD	A,(ENMYNO2)
	RST	0
	DW	ENRET
	DW	ENRET ;IT ;ENRET
	DW	ENRET
	DW	ENRET
	DW	ENRET
	DW	ENRET
	DW	BLOCKIT
	DW	TAKARIT ;1
	DW	ENRET   ;2
;
	DW	OCTA1IT ;3
	DW	ENRET   ;4
	DW	MORI1IT ;5
	DW	ENRET
	DW	ENRET
	DW	RIVERIT
	DW	ENRET
	DW	GHOSTIT
	DW	GHOSBIT
	DW	GHOSSIT
	DW	BOMBOIT
	DW	HEIS0IT
	DW	BABULIT
	DW	SPARKIT
	DW	SPAR2IT
	DW	ENRET
	DW	ENRET
	DW	ENRET
	DW	SLIMBIT
	DW	ENRET
	DW	BASSFIT
	DW	STATINC	;SKEL1IT
	DW	STATINC ;MUMMYIT
	DW	ENRET
	DW	MAGE0IT
	DW	ENRET
	DW	STATINC ;LAIKUIT
	DW	ENRET
	DW	BOSS1IT
	DW	KWUSOIT
	DW	ENRET
	DW	ENRET
	DW	HAYAMITL
	DW	ENRET	; RENO7
	DW	ENRET	; R7BEM
	DW	ENRET	; INOSI
;
	DW	HART1IT ;ENRET
	DW	ITEMIT ;ENRET
	DW	ITEMIT ;ENRET
	DW	KEYSMIT;ENRET
	DW	PLTATIT ; ;PLTAT
	DW	ITEMIT ;HMASK
	DW	ITEMIT ;POWER
	DW	ITEMIT ;KINOM
	DW	ENRET2 ;KAKERIT  ;KAKER
	DW	ITEMIT ;HARTB
	DW	ITEMIT ;ALOW1  
	DW	ITEMIT ;BOMB1  
	DW	GAKKIIT ;GAKKI  
	DW	ENRET2 ;KINOK  
	DW	ANAINIT2 ;MGPOW
	DW	ANAINIT2 ;KAKIN  
	DW	KAIINIT ;ANAINIT2 ;KAIIN  
	DW	GIRL0IT ;GIRL0
	DW	PEOPLIT ;PAPA0
	DW	BABA0IT ;BABA0   
	DW	FUKUROIT ;FUKURO
	DW	ENRET  ;HINTO   
	DW	EWOODIT ;EWOOD
	DW	ENRET2 ;MSPNT   
	DW	ENRET2 ;IWAGO   
	DW	ENRET2 ;SWBLKU
	DW	ENRET2 ;SWBLKD
	DW	ENRET2 ;SWBLKL
	DW	ENRET2 ;SWBLKR
	DW	ENRET  ;;;STESTIT
	DW	ENRET  ;MSTESFIT
	DW	ENRET  ;FRBARIT
	DW	SHOPIT ;NYAMAIT
	DW	ENRET  ;CHUNLIIT
	DW	EVENTIT ;UFOCHIT
	DW	ENRET  ;TERSAIT
   	DW	ENRET  ;TEKYUIT
   	DW	ENRET  ;BHOLEIT
   	DW	ENRET  ;BHOL2IT
   	DW	EVENTIT ;FISHGIT
	DW	ENRET  ;SBOMBIT
	DW	ENRET  ;OBOMBIT
	DW	ENRET  ;NINJAIT
	DW	ENRET  ;NINTMIT
	DW	HAYABITL  ;HAYABIT
	DW	BGKAOITL  
	DW	BSLIMITL  
	DW	TBOSSITL  
	DW	BSNAKITL  
	DW	ENRET  ;GORMAITL
	DW	ENRET  ;BSKELITL
	DW	DDNGOITL
	DW	WARPIT ;STATINC  ;WARP  
	DW	BFIREITL
	DW	BBIRDITL
	DW	PSCRLIT	; Part scroll intial
	DW	BFISHITL
	DW	ENRET  ;ONOFS
	DW	ENRET2  ;SWTRP
	DW	ENRET2  ;MVHAS
	DW	HIKUSIT ;HIKUS
	DW	IKADAIT ;IKADA
	DW	ENRET2	; TANABE
	DW	ENRET2	; NIWAT
	DW	WANWANIT ; WANWAN
	DW	ENRET2	; BTFLY 
	DW	ENRET2	; FOXDOG
	DW	PEOPLIT	; KODOMA
	DW	KODOMBIT ; KODOMB
	DW	KODOMCIT ; KODOMC
	DW	PEOPLIT	; KODOMD
	DW	PEOPLIT ;MAMA0 
	DW	PEOPLIT ;MAMA1 
	DW	PAPA1IT ;PAPA1 
	DW	PEOPLIT ;URURI 
	DW	ENRET2 	; OZWAN 
	DW	MSWANIT ;PEOPLIT	; MSWAN 
	DW	ENRET2 	; KARAS 
	DW	PEOPLIT	; TRYCY 
	DW	BHANAIT	; BHANA 
	DW	ENRET2 	; BHFIR 
	DW	ENRET2 	; SHANA 
	DW	ENRET2 	; KAMEI 
	DW	DENWAIT	; DENWA 
	DW	ENRET2 	; OBAQ  
	DW	ENRET2 	; OBQBAR  
	DW	BEDINIT	; BEDIN   
	DW	IZUMIIT	; IZUMI   
	DW	ENRET2 	; HATO0   
	DW	FLYITIT	; FLYIT   
	DW	RANEMIT ; RANEM   
	DW	ENRET2 	; NOMOS   
	DW	ENRET2 	; HINO0 
	DW	ENRET2 	; PANEL 
	DW	ENRET2 	; PANEL2 
	DW	ENRET2 	; SWBLK 
	DW	ENRET2 	; SWBLK2
	DW	PSADD8 	; MIZUB
	DW	ENRET2 	; HEIHO 
	DW	ENRET2 	; SLOT  
	DW	KARBYIT	; KARBY 
	DW	ENRET2 	; OCHAN
	DW	ENRET2 	; HEISM
	DW	ENRET2 	; HEISB
	DW	RICHDIT	; RICHD
	DW	ENRET2 	; KAERU
	DW	ENRET2 	; SWIMP
	DW	DAISUIT ; DAISU
	DW	ENRET2  ; AMENB  	
	DW	ENRET2  ; YUKAB  	
	DW	ENRET2  ; YSLIM  	
	DW	BALEEIT ; BALEE  	
	DW	ENRET2  ; MOAI
	DW	TBEAMIT ; TBEAM
	DW	ENRET2  ; KURI0
	DW	ENRET2  ; PIHAT
	DW	LOPEIT  ; LOPE 
	DW	ENRET2  ; PACKN
	DW	ENRET2  ; LIFTX
	DW	LIFTYIT ; LIFTY
	DW	ENRET2  ; LIFTD
	DW	ENRET2  ; LIFTT
	DW	ENRET2  ; HASIR
	DW	ENRET2  ; TAMA0
	DW	ENRET2  ; GESSO
	DW	ENRET2  ; PUKPK 
	DW	ENRET2  ; PUKPV 
	DW	ENRET2  ; PUKPJ 
	DW	MONKYIT ; MONKY 
	DW	ENRET   ; OCTAJ 
	DW	YOSSIIT ; YOSSI 
	DW	ENRET2 	; AMUSI
	DW	ENRET2 	; YUKAS
	DW	ENRET2 	; AMUST
	DW	PSADD8	; HANNY
	DW	PAPA2IT	; PAPA2
	DW	ENRET2 	; KUMA0
	DW	ENRET2 	; PAPAL
	DW	ENRET2 	; MAMAD
	DW	TURIIT 	; TURI 
	DW	ENRET2 	; NYORO
	DW	PKURIIT	; PKURI
	DW	SHIGEIT	; SHIGE
	DW	PSADD8 	; TUKAI
	DW	ENRET2 	; ARIMA
	DW	ENRET2 	; BOXER
	DW	ENRET2 	; ZONBI
	DW	ENRET2 	; KHIMI
	DW	GIRL1IT	; GIRL1
	DW	GIRL2IT	; GIRL2
	DW	ENRET2	; MAMUU
	DW	ENRET2 	; TODD 
	DW	ENRET2 	; UNIUNI
	DW	ENRET2 	; KANI
	DW	ENRET2 	; MANBO 
	DW	ENRET2	; USAGI 
	DW	ENRET2 	; ONPU  
	DW	ENRET2 	; AKUMA 
	DW	ENRET2 	; ZORA  
	DW	ENRET2 	; BLANKA 
	DW	ENRET2 	; WANI  
	DW	ENRET2 	; MAMAD2
	DW	ENRET2 	; GAGE
	DW	ENRET2  ; USAG2
	DW	ENRET2  ; KUMAS
	DW	ENRET2  ; NTORI
	DW	ENRET2  ; GMUSI
	DW	ENRET2  ; OBAKE
	DW	ENRET2  ; NIWAX
	DW	ENRET2  ; YTUBO
	DW	ENRET2  ; DOSNS
	DW	ENRET2  ; DOSNB
	DW	ENRET2  ; TAIAT
	DW	ENRET2  ; FIREB
	DW	BABUBIT ; BABUB
	DW	ENRET2  ; KAZAM
	DW	ENRET2  ; BOOK 
	DW	ENRET2  ; SEIREN
	DW	ENRET2  ; KENBM
	DW	ENRET2  ; SARUK
	DW	ENRET2  ; MOUSE
	DW	ENRET2  ; HODAI
	DW	ENRET2  ; SANBO
	DW	ENRET2  ; MBOSS
	DW	FLYIT2IT; FLYIT2   
	DW	BOSSIT  ; BOSS 
	DW	ENRET2 	; SIROS
;- -Ending use --
	DW	ENRET2 	; EDAI
;------------------------------
DAIIPT
	DB	1,4
DAISUIT
	LD	HL,ENJYUN
	ADD	HL,BC
	LD	E,(HL)
;;	INC	A
	LD	D,B
	LD	HL,DAIIPT
	ADD	HL,DE
	LD	A,(HL)
	JP	ENPTST
;------------------------------
GIRL2IT
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(HL)
	SUB	$03
	LD	(HL),A
	RET
;------------------------------
LOPEIT
	CALL	LDTIM1
	LD	(HL),$30
	RET
;------------------------------
LIFTYIT
	LD	A,(GRNDPT)
	CP	$65
	RET	NZ
;
	LD	A,(ENDSYP)
	CP	$50
	RET	C
;
	LD	HL,ENWRK0
	ADD	HL,BC
	INC	(HL)
	RET
;------------------------------
SLIMBIT
	LD	HL,ENLIFE
	ADD	HL,BC
	LD	(HL),$02
	RET
;------------------------------
;USAGIIT
;	LD	A,(MARINOF)
;	AND	A
;	JP	Z,ENCLER
;
;ADDCHK
;	LD	A,(ENSVXL)
;	SWAP	A
;	AND	$01
;	LD	E,A
;	LD	A,(ENSVYL)
;	SWAP	A
;	INC	A
;	RLA
;	AND	$02
;	OR	E
;	LD	HL,ENWRK0
;	ADD	HL,BC
;	LD	(HL),A
;	RET	
;------------------------------
GIRL1IT
	LD	HL,MARINOF
	LD	A,(MARINFG)
;;;	AND	A
	OR	(HL)
	JP	NZ,ENCLER
	RET
;------------------------------
PKURIIT
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	(HL),$10
;
	CALL	RNDSUB
	LD	HL,ENCONT
	ADD	HL,BC
	LD	(HL),A
;;	RET
;------------------------------
SHIGEIT
;	LD	A,(ENSVXL)
;	RLA
;	RLA
;	AND	%01000000
;	PUSH	AF
;	LD	HL,ENMOD3
;	ADD	HL,BC
;	OR	(HL)
;	LD	(HL),A	;石は剣はねかえり！
;	POP	AF
;	SLA	A
;	LD	HL,ENMOD1
;	ADD	HL,BC
;	OR	(HL)
;	LD	(HL),A
;;
;	LD	A,(ENSVXL)
;	RRA
;	RRA
;	RRA
;	RRA
;	AND	%00000001
;	LD	HL,ENWRK3
;	ADD	HL,BC
;	LD	(HL),A	;0:草 1:石
	RET
;------------------------------
PAPA2IT
	CALL	PSADD8
;
	LD	A,$02
	JP	ENPTST
;------------------------------
DENWAIT
	LD	A,$33
	JR	ENBGMST
;------------------------------
RICHDIT
	LD	A,$40
ENBGMST
	LD	E,A
;
	LD	A,(KENLEV)
	AND	A
	RET	Z	;剣を持ってないときは専用BGM!
;
	LD	A,E
ENBGMST2
	LD	(SOUND4),A	;(S)
	LD	(BGMNO),A
	LD	(BGMNO2),A
	LD	(TODYFG),A
	RET
;------------------------------
BOSSIT
	XOR	A
	LD	(BOSSNO),A
;
	CALL	SOUNDCLR	;(S)
	RET
;	LD	A,$23
;	JR	ENBGMST2 ;(S)
;------------------------------
BEDINIT
	LD	A,$24
	JR	ENBGMST2
;;	LD	(SOUND4),A	;(S)
;;	RET
;------------------------------
TURIIT
	LD	A,$3A
	JR	ENBGMST2	;(S)
;-----------------------------
MONKYIT
	XOR	A
	LD	(SARUFG),A
;
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(HL)
	SUB	$04
	LD	(HL),A
	RET
;------------------------------
TBEAMIT
	CALL	RNDSUB
	JP	ENPTST
;------------------------------
KARBYIT
	CALL	LDTIM3
;
	CALL	RNDSUB
	AND	$3F
	ADD	A,$10
;;	LD	HL,ENTIM3
;;	ADD	HL,BC
	LD	(HL),A
	RET
;------------------------------
HIKUSIT
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(HL)
	ADD	A,$0A
	LD	(HL),A
	LD	HL,ENWRK1
	ADD	HL,BC
	LD	(HL),A
	RET
;------------------------------
RANEMIT
;	LD	A,(DJSVBF)
;	AND	%00010000
;	JP	NZ,ENCLER
;;
	XOR	A
	LD	(BGMNO),A
;;	LD	(BSSDFG),A
;
;;	CALL	SOUNDCLR	;(S)
	RET
;------------------------------
FLYIT2IT
	CALL	FII100
;
	LD	A,(ENSVXL)
	SWAP	A
	AND	$01
	ADD	A,$04
	JP  	ENPTST
;------------------------------
FLYITIT
	LD	A,(ENSVXL)
	SWAP	A
	AND	$01
	LD	E,A
	LD	A,(ENSVYL)
	SWAP	A
	INC	A
	RLA
	AND	$02
	OR	E
	CALL	ENPTST
	CP	$01
	JR	NZ,FII100
;
	LD	A,(KINOKFG)
	AND	A
	JP	NZ,ENCLER
FII100
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	(HL),$13
;
	RET
;------------------------------
KODOMBIT
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	(HL),$02
;
	CALL	STATINC
;
	CALL	LDTIM0
	LD	(HL),$20
KODOMCIT
	RET
;------------------------------
PAPA1IT
;;	LD	A,$??	;TODY
	LD	A,(GRNDPT)
	CP	$D9
	LD	A,$32	;ライト
	JR	NZ,PP1I10
	LD	A,$37	;ヤギ
PP1I10
	JR	ENITSD	;(S)
;------------------------------
;IZHARTD
;;                 3   4   5   6   7   8   9  10  11  12  13  14
;	DB	$18,$20,$28,$30,$38,$40,$48,$50,$58,$60,$68,$70
IZUMIIT
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	(HL),$10
;
;	LD	A,(HARTMX)
;	LD	E,A
;	LD	D,B
;	LD	HL,IZHARTD-3
;	ADD	HL,DE
;	LD	A,(HARTCT)
;	CP	(HL)
;	JP	Z,ENCLER
;
	LD	A,(HARTFUL)
	AND	A
	JP	NZ,ENCLER
;
	LD	A,$0C
ENITSD
	CALL	ENBGMST	;(S)
;	LD	(SOUND4),A	;(S)
;	LD	(BGMNO),A
;	LD	(BGMNO2),A
;;PAPA1IT
	LD	DE,ENXPSH
	LD	HL,ENXPSL
	JP	ITI010
;------------------------------
WANWANIT
	LD	A,(GRNDPT)
	CP	$E2
	JR	NZ,WANI08	;モリブリンに捕まっている？
;				; YES !
	LD	A,(WANFLG)
	CP	$80
	JR	Z,WANI0A
	JP	ENCLER
WANI08
	LD	A,(WANFLG)
	AND	A
	JP	NZ,ENCLER
;
WANI0A
	RET
;---------------------------------------
FUKUROIT	;
	LD	A,(DJSVBF)
;;	AND	%00100000
	RRA
	JR	ITSVCHK
;---------------------------------------
PLTATIT	; 浜べの剣
	LD	A,(DJSVBF)
ITSVCHK
	AND	%00010000
	JP	NZ,ENCLER	; Already have -> Not set !
	RET
;----------------------------------------
GIRL0IT
	LD	A,(GRNDPT)
	CP	$C0
	JR	C,GR0I10	; 動物村？
;				; YES !
	LD	A,(MARINOF)
	AND	A
	JP	Z,ENCLER
;
	LD	A,(MARINFG)
	AND	A
	JP	NZ,ENCLER ;GR0I10
;
	INC	A
	LD	(UTAFLG),A
;
;;	LD	A,$2F
;;	LD	(SOUND4),A	;(S)
	LD	A,$2F
	LD	(BGMSTF),A
	LD	(BGMNO),A
	LD	(BGMNO2),A
	CALL	SOUNDOUT  ;CLR	;(S)
GR0I10
	LD	A,(HIMITSU)
	AND	A
	JR	Z,PEOPLIT
;
	LD	A,(NAME)
	AND	A
	JR	NZ,PEOPLIT	; Message test ?
;				; yes !
	LD	A,(NAME+1)
	AND	A
	JR	NZ,GR0I11
;
	LD	(ITMODE),A
	LD	A,ENDG
	LD	(GMMODE),A
	RET
GR0I11	
	LD	HL,ENMYNO
	ADD	HL,BC
	LD	(HL),TANABE
	RET
;----------------------------------------
MSWANIT
	LD	A,(WANFLG)
	CP	$80
	JR	NZ,MSWI10	;逃げられ？
;				; yes !
	LD	A,$0E
	LD	(SOUND4),A	;(S)
MSWI10
	RET
;----------------------------------------
IKADAIT
	LD	A,(DJFLAG)
	AND	A
	JR	NZ,PEOPLIT
;
	LD	A,(IKADAFG)
	AND	A
	RET	NZ	
;
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(HL)
	SUB	$10
	LD	(HL),A
	RET
;
;	LD	A,(IKADAFG)
;	AND	A
;	JP	Z,ENCLER
PEOPLIT
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	(HL),$03
;-----------------------------
EVENTIT
;;	LD	A,(DJFLAG)
;;	AND	A
;;	JR	Z,EVI010	; 
;
	LD	A,(TATLEV)
	AND	A
	JR	NZ,EVI008	; First room?
;
;	LD	A,$0A		; Yes !
;EVI008
;;
	LD	A,$1C	;始めのBGM
;	LD	(SOUND4),A	;(S)
;	LD	(BGMNO),A
;	LD	(TODYFG),A	
	CALL	ENBGMST2	;(S)
EVI008
EVI010
	JR	LEFTMS
;;	RET
;-----------------------------
BABA0IT
;;	LD	A,$02
;;	LD	(SOUND4),A	;(S)
	RET
;-----------------------------
SHOPIT
;	CALL	RNDSUB
;	LD	E,$05
;	AND	$01
;	JR	Z,SHI010
;	LD	E,$07
;SHI010
;	LD	A,E
	LD	A,$07
;;	LD	(SOUND4),A	;(S)
	CALL	ENBGMST	;(S)
;
LEFTMS
	LD	A,$01
	JR	ENMKSET
;;	RET
;-----------------------------
ENRET
	CALL	RNDSUB
	AND	$03
ENMKSET
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	(HL),A
ENRET2
	RET
;=========================================
PSCRLIT
	LD	A,%00000011
	LD	(IE),A
;
	RET
;=========================================
RIVERIT
	LD	A,$FF
	JP	ENPTST
;----------------------------------------
;KAKERIT
;	LD	A,(DJSVBF)
;	AND	%00010000
;	JP	NZ,ENCLER
;	RET
;
;;	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%						       %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;FRBARIT
;	LD	A,(ENSVXL)
;	ADD	A,$00
;	LD	HL,ENWRK0 ;Center pos
;	ADD	HL,BC
;	LD	(HL),A
;	ADD	A,$06
;	LD	HL,ENX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%%%%%%%%%%%%%%%%
;%						       %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;GAKKIIT
;	LD	HL,ENXPSL
;	ADD	HL,BC
;	LD	A,(HL)
;	ADD	A,$08
;	LD	(HL),A
;	RET
;=============================
;=============================
;=============================
BOSS1IT
KWUSOIT
;;	CALL	LDTIM0
;;	LD	(HL),$28
;;
;	LD	HL,ENXPSL
;	ADD	HL,BC
;	LD	A,(HL)
;	ADD	A,$08
;	LD	(HL),A
;;
;	CALL	SBPTST
;	RET
;BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
;B					  B
;BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
;
BOSS1MV
KWUSOMV
;	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%					%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%					%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%					%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ENFIRECD
	DB	$34,$00,$34,$20
	DB	$34,$10,$34,$30
;;	DB	$34,$00,$36,$00
;;	DB	$36,$20,$34,$20
;- - - - - - - - - - - - - - - - - -
ENFIRE
	CALL	LDTIM0
	JR	Z,ENFRED
;
;;	CALL	ENMOVEL
;
;;	LD	A,(ENCHPT2)
;;	PUSH	AF
;
	LD	A,(FRCNT)
	RRA
	RRA
	RRA
	AND	%00000001
	LD	(ENCHPT2),A
;
;;	LD	A,(ENSVXL)
;;	PUSH	AF
;;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(HL)
;	SRA	A
;	SRA	A
;	SRA	A
;;;	SRA	A
;	LD	HL,ENXSPD
;	ADD	HL,BC
;	LD	(HL),A
;;
;	LD	HL,ENHNYS
;	ADD	HL,BC
;	LD	A,(HL)
;	SRA	A
;	SRA	A
;	SRA	A
;;;	SRA	A
;	LD	HL,ENYSPD
;	ADD	HL,BC
;	LD	(HL),A
;;
	CALL	ENMVCL
EFO090
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ENSHOT
	CALL	ENMOVEL
	CALL	ENSTCK2
;
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	(HL),$02	; For fole check !!
	CALL	ENBDCL		; Bounds sub & BG check !
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	(HL),B		; For fole check Off !!
;
	CALL	TURCHK
;
	CALL	SHBUTCK	;シャッターぶつけチェック！
;
	LD	A,(ENMYNO2)
	CP	TBOSS
	JR	NZ,ESH011
;
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,ESH011
;
	LD	HL,ENFLSH
	ADD	HL,BC
	LD	(HL),$20
;
	LD	HL,SOUND2
	LD	(HL),$07	;(S)
;
	LD	HL,ENWRK3
	ADD	HL,BC
	LD	A,(HL)
	INC	A
	LD	(HL),A
	CP	$03
	JR	Z,ESH070
;
ESH011
	LD	A,$B
	LD	(ATCKNO),A
	CALL	CRENEN
;
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENYSPD
	ADD	HL,BC
	OR	(HL)
	JR	NZ,ESHT10
;
	CALL	ESTOPST
;
	LD	A,(ENMYNO2)
	CP	TBOSS
	JR	NZ,ESHT10
;
ESH070
	LD	HL,ENMODE
	ADD	HL,BC
	LD	(HL),EMOVE
;
	CALL	STATINC
	LD	(HL),$01
;
	CALL	LDTIM0
	LD	(HL),$80
;
	LD	HL,ENWRK2
	ADD	HL,BC
	LD	(HL),B	; Center serch !
ESHT10
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ESTPXS
	DB	$10,$F0
;
ENSTOP
	CALL	ENMOVEL		; C set 
	CALL	ENSTCK2
	CALL	ENHNSB
;
	CALL	ENBDCL
	CALL	ENSDCL
;
	CALL	CRKNEN
;=====================================
;- - Cach check - -
	LD	A,(ITEMB)
	CP	PBULE
	JR	NZ,EST900	; Bulesret check !
;
	LD	A,(KEYA2)
	AND	%00100000
	JR	NZ,EST910
	JR	ESTP10
EST900
	LD	A,(ITEMA)
	CP	PBULE
	JR	NZ,ESTP10
;
	LD	A,(KEYA2)
	AND	%00010000
	JR	Z,ESTP10
;
CACHCK
EST910
	LD	A,(WPLCAMD)
	AND	A
	JR	NZ,ESTP10
;
	LD	HL,ENMOD0
	ADD	HL,BC
	LD	A,(HL)
	PUSH	HL
	PUSH	AF
	OR	%10000000
	LD	(HL),A
	CALL	CRENPLF
	RL	E
	POP	AF
	POP	HL
	LD	(HL),A
	RR	E
	JR	NC,ESTP10
;
	LD	A,$01
	LD	(WPLCAMD),A
;
	LD	HL,ENMODE
	ADD	HL,BC
	LD	(HL),ECACH
;
	LD	A,$02
	LD	(SOUND2),A	;(S)
;
	LD	HL,ENCAST
	ADD	HL,BC
	LD	(HL),B ;$00
;
	CALL	LDTIM0
	LD	(HL),$02
;
	LD	A,(PLCMKI)
	LD	(PLCAMK),A
	JP	ENCACH
;;	RET
;
ESTP10
	LD	HL,ENTIM2
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,ESTP20
;
;;;	LD	A,EMOVE
	LD	HL,ENMODE
	ADD	HL,BC
	LD	(HL),EMOVE ;A
;
	LD	HL,ENZSPD
	ADD	HL,BC
	LD	(HL),B
ESTP20
	CP	$3C
	JR	NC,ESTP30
;
	SRL	A
	SRL	A
	AND	$1
	LD	E,A
	LD	D,B ;$0
	LD	HL,ESTPXS
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
;
	CALL	ENXCLC
	CALL	ENSDCL
ESTP30
	RET
;;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;;%				    %
;;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;ENNOTH
;	RET
;===================================
BBIXSD
	DB	$0C,$0C,$F4,$F4
BBIYSD
	DB	$0C,$F4,$0C,$F4
;
BABULIT
BABUBIT
BALEEIT
;;	INITIAL
	CALL	RNDSUB
	AND	$03
	LD	E,A
	LD	D,B ;$0
	LD	HL,BBIXSD
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
	LD	HL,BBIYSD
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),A
	RET
;===================================
;===================================
;;	INITIAL
SPAR2IT
	LD	HL,ENWRK1
	ADD	HL,BC
;;;	LD	A,$04
	LD	(HL),$04 ;A
;
	LD	A,$03
	JR	SPIT10
;- - - - - - - - - - - - - - - -
SPARKIT
	LD	A,$FD
SPIT10
	LD	HL,ENYPSL
	ADD	HL,BC
	ADD	A,(HL)
	LD	(HL),A
	RET
;===================================
;===================================
;;	INITIAL
BASSFIT
;	LD	HL,ENCONT
;	ADD	HL,BC
;	CALL	RNDSUB
;;
;	AND	$01
;	LD	(HL),A
;	RET
;===================================
;===================================
;===================================
;===================================
;;	INITIAL
;LAIKUIT
;	LD	HL,ENSTAT
;	ADD	HL,BC
;;;;	LD	A,$01
;	LD	(HL),$01 ;A
;	RET
;===================================
;;	INITIAL
;SKEL1IT
;	LD	HL,ENSTAT
;	ADD	HL,BC
;;;;	LD	A,$01
;	LD	(HL),$01 ;A
;	RET
;===================================
;===================================
;===================================
;===================================
;;	INITIAL
;MUMMYIT
;	JP	STATINC
;
;	LD	HL,ENSTAT
;	ADD	HL,BC
;;;;	LD	A,$01
;	LD	(HL),$01 ;A
;	RET
;===================================
MAGE0IT
	CALL	LDTIM0
	LD	(HL),$80
;
	LD	HL,ENCHPT
	ADD	HL,BC
	DEC	(HL)
;;	LD	(HL),$FF
;
	RET
;===================================
;===================================
;===================================
;===================================
;===================================
;===================================
;===================================
;===================================
;===================================
;===================================
;===================================
;===================================
HEIS0IT 
	LD	A,(ENSVXL)
	AND	$10
	LD	A,$0
	JR	NZ,HEI010
;
	LD	A,$3
HEI010
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	(HL),A
	PUSH	HL
;
	CALL	MKPTST
;
	POP	HL
	LD	A,(HL)
	XOR	$1
	LD	(HL),A
	RET
;===============================================
;=					       =
;===============================================
;===============================
KAIINIT
	LD	HL,ENWRK2
	ADD	HL,BC
	LD	(HL),$02
;
	LD	A,(GRNDPT)
	CP	$A4
	JR	Z,KAII01
	CP	$D2  ;97
	JR	NZ,KAII10	;体当たり木？
;
KAII01
	DEC	(HL) ;$01
; 
	CALL	PSADD8
KAII10
	CALL	ANI0010
;
	RET
;------------------------------------
ANAINIT
	LD	HL,ENWRK2
	ADD	HL,BC
	LD	(HL),$01	;1:Dush check 2:Skop check&Tubo check
;
	LD	A,(DJFLAG)
	AND	A
	JR	Z,ANI0010
;--------------------------------------------
HART1IT
ANAINIT2
	LD	HL,ENWRK2
	ADD	HL,BC
	LD	(HL),$02	;1:Dush check 2:Skop check&Tubo check
ANI0010
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
	OR	%00010001
	LD	(HL),A
	RET
;===============================
KEYSMIT
	LD	A,(GRNDPT)
	CP	$F8
	JR	NZ,KSI000	;流さの下？
;
	LD	A,(DJSVBF)
	BIT	4,A
	JP	NZ,ENCLER
;
	BIT	5,A
	JP	Z,ENCLER
;
	LD	A,$02	;魚のかぎ！
	JP	ENPTST
;
KSI000
	CP	$7A
	JR	NZ,KSI001
;
	LD	A,(DJSVBF)
	AND	%00010000
	JP	NZ,ENCLER
;
	LD	A,$04	;鳥のかぎ！
	JP	ENPTST
;
KSI001
	CP	$7C
	JR	NZ,KSI010	
;
	LD	A,(DJRMSV+$69)
	AND	%00010000
	JP	Z,ENCLER	;上の部屋から落ちた後？
;				; YES !
	LD	A,(DJSVBF)
	AND	%00010000
	JP	NZ,ENCLER	;取ってへん？
;;	JR	ITEMIT2		; YES !
KSI010
	RET
;------------------------------
YOSSIIT
	LD	A,(MEGAF)
	CP	$0E
	JR	Z,PSADD8	;メガネ！
	RET
;===============================
WARPIT
	LD	A,(DJFLAG)
	AND	A
	RET	Z
;
	CALL	STATINC
	JR	PSADD8
;===============================
ITEMIT
	CALL	ANAINIT
;
	LD	A,(DJFLAG)
	AND	A
	JR	NZ,ITI028
;
;	LD	HL,ENWRK2
;	ADD	HL,BC
;	INC	(HL)
;;
;	LD	HL,ENMOD3
;	ADD	HL,BC
;	LD	A,(HL)
;	OR	%00010001
;	LD	(HL),A
;;
;=======================================
BHANAIT
PSADD8
	LD	DE,ENXPSH
	LD	HL,ENXPSL
	CALL	ITI010
;
ITI008
	LD	DE,ENYPSH
	LD	HL,ENYPSL
ITI010
	ADD	HL,BC
	LD	A,(HL)
	ADD	A,$08
	LD	(HL),A
;
	RLA
	PUSH	DE
	POP	HL
	ADD	HL,BC
;
	RRA
;
	LD	A,(HL)
	ADC	A,$00
	LD	(HL),A
	RET
;=============================
EWOODIT
GAKKIIT
	LD	DE,ENXPSH
	LD	HL,ENXPSL
	JR  	ITI010
;===============================================
ITI028
;;	LD	HL,ENTIM3
;;	ADD	HL,BC
	CALL	LDTIM3
	LD	(HL),$80
	RET
;===============================================
;=					       =
;===============================================
OCTA1IT
MORI1IT
;	CALL	RNDSUB
;	AND	$F
;	LD	HL,ENTIM0
;	ADD	HL,BC
;	LD	(HL),A
;	AND	$1
;	LD	HL,ENSTAT
;	ADD	HL,BC
;	LD	(HL),A
;
	CALL	LDTIM1
	LD	(HL),$A0
	RET
;===============================================
;=					       =
;===============================================
GHOSTIT
GHOSBIT
GHOSSIT
;	LD	A,(GRNDPT)
;	CP	$48
;	JR	Z,GHI010
;	CP	$49
;	JR	NZ,GHI020
;
GHI010
	LD	A,(ENMYNO2)
	CP	GHOSS
	JR	NZ,GHI018
;
	LD	HL,ENWRK2
	ADD	HL,BC
	LD	(HL),$01
GHI020
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	(HL),$10
	RET
GHI018
	CALL	STATINC
	RET
;===============================================
;=					       =
;===============================================
;---------------------------------------
;---------------------------------------
;===============================================
;=					       =
;===============================================
;===============================================
;=					       =
;===============================================
;===============================================
;===============================================
;=					       =
;===============================================
HIPLPCD
BOSS1CD
JIJIICD
KWUSOCD
CHUNLICD
	DB	$60,$00,$62,$00     ;下１
	DB	$62,$20,$60,$20     ;下２
;
	DB	$64,$00,$66,$00     ;上１
	DB	$66,$20,$64,$20     ;上２
;
	DB	$68,$00,$6A,$00     ;左１
	DB	$6C,$00,$6E,$00     ;左２
;
	DB	$6A,$20,$68,$20     ;右１
	DB	$6E,$20,$6C,$20     ;右２
;
HIPLP2CD
	DB	$70,$00,$72,$00	   ; MASK OFF
	DB	$72,$20,$70,$20	   ; MASK OFF
;- - - - - - - - - - - - - - - - - - - - - -
HP2XSD
	DB	$0C,$F4,$00,$00
HP2YSD
	DB	$00,$00,$F4,$0C
;-- -- -- -- -- -- -- -- -- -- -- -- --
HIPLPMV
	LD	HL,ENWRK1
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,HP1010
;
	LD	DE,HIPLP2CD
	CALL	EN2CST
;
	CALL	ENSTCK
	CALL	ENHNSB
;
	CALL	CREPKE
;
	CALL	ENMVCL
	CALL	ENBGCK
;
	CALL	LDTIM0
	JR	NZ,HP0010
;
	CALL	RNDSUB
	AND	$1F
	ADD	A,$20
	LD	(HL),A
;
	AND	$03
	LD	E,A
	LD	D,B
	LD	HL,HP2XSD
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
	LD	HL,HP2YSD
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),A
HP0010
	LD	A,(FRCNT)
	RRA
	RRA
	RRA
	RRA
	AND	$01
	CALL	ENPTST
	RET
;
HP1010
	LD	DE,HIPLPCD
	CALL	ENMVSB
	RET
;===============================================
;=					       =
;===============================================
;===============================================
;=					       =
;===============================================
;===============================================
;	
;===============================================
;=					       =
;===============================================
; Danjyon Takaramono data 
;
;BUL	EQU	$0 ; Buleslet
;TAT	EQU	$1 ; Seeld
;BOW	EQU	$2 ; Bow
;FUC	EQU	$3 ; Fuck shot
;ROD	EQU	$4 ; Rods
;KTU	EQU	$5 ; Kutsu
;FUE	EQU	$6 ; Okarina
;WNG	EQU	$7 ; Wing
;BOK	EQU	$8 ; Book
;TBO	EQU	$9 ; Tsubo
;BMB	EQU	$A ; Bomb
;KEN	EQU	$B ; Ken  
;HRE	EQU	$C ; Hire 
;MEG	EQU	$D ; Megane
;YSI	EQU	$E ; Yoshi
;VTR	EQU	$F ; Video tape
;BIN	EQU	$10 ; Kushori bin
;;
;GK1	EQU	$11 ; Ground key 1
;GK2	EQU	$12 ; " 2
;GK3	EQU	$13 ; " 3
;GK4	EQU	$14 ; " 4
;GK5	EQU	$15 ; " 5
;;
;DMP	EQU	$16 ; Danjyon map
;KNP	EQU	$17 ; Konpass
;PND	EQU	$18 ; Pendant
;BKY	EQU	$19 ; Boss key
;SKY	EQU	$1A ; Small key
;C01	EQU	$1B ; Coin 50
;C02	EQU	$1C ; Coin 20
;C10	EQU	$1D ; Coin 100
;C20	EQU	$1E ; Coin 200
;C50	EQU	$1F ; Coin 500
;KAI	EQU	$20 ; 貝殻
;NOT	EQU	$21 ; Nothing
;SLM  22
;TAR  23
;;
;;
TAKARBD
	DB	$62,$70,$63,$71
;- - - - - - - - - - - - - - - - - - -
;;TKSTAD
;;	DB	$5,$6,$7,$3,$FF,$FF,$FF,$FF,$FF,$8,$FF
ITGTDT
	DB	3,4,5,6,7,8,9,$A,$B,$C,$2,$1
;- - Coin up data - - 
COUPD1
;;		 50  20 100 200 500
	DB	$00,$00,$00,$00,$01
COUPD2
	DB	$32,$14,$64,$C8,$F4
;
TAKARIT
	LD	A,$2A
	LD	(ENSTTM),A
;
	LD	A,$04
	LD	(SOUND3),A	;(S)
;
	LD	DE,TAKARBD
	LD	B,DTOP0	
	CALL	BLBGST
;
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(HL)
	SUB	$08
	LD	(HL),A
;
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),$FC
;
	LD	HL,ENCHPT
	ADD	HL,BC
	LD	A,(HL)
	LD	(ENHELP),A
	LD	D,B
	CP	GK1
	JR	NZ,TKI0900	;地上鍵１?
;				;YES !
	PUSH	AF
	LD	A,(FKINDX)
	LD	E,A
	LD	HL,ENTIM1
	ADD	HL,DE
	LD	(HL),$38	;ふくろうセット待ち！
	POP	AF
TKI0900
	LD	E,A
	CP	NOT
	JP	NC,TSV058 ;TAKARRT
	CP	KAI
	JR	NZ,TSV003	; Kaigara ?
;				; Yes !
	JP	KAIINC
;	LD	HL,CLC20
;	LD	A,(HL)
;	ADD	A,$01
;	DAA
;	LD	(HL),A
;;
;	JP	SVDTST
TSV003
	CP	C01  ;$04
	JR	C,TSV020
	CP	C50+1  ;$05
	JR	NC,TSV020
TSV012
	LD	HL,COUPD2-$1B  ;CO1  ;$04
	ADD	HL,DE
	LD	A,(HL)
	LD	(COINU2),A
	LD	HL,COUPD1-$1B  ;CO1  ;$04
	ADD	HL,DE
	LD	A,(HL)
	LD	(COINU1),A
;
	LD	A,$18
	LD	(COINWT),A	;メッセージがでるまで待つ！
	JR	SVDTST
;
TSV020
	CP	DMP
	JR	C,TSV030
	CP	SKY+1
	JR	NC,TSV030 ; Danjyon item ?
;				; yes !
;;	PUSH	DE
;
	SUB	DMP
	LD	E,A
	LD	D,$00
	LD	HL,DMAPF	; For display use
	ADD	HL,DE
	INC	(HL)
;
;;	POP	DE
;;;
;;	LD	A,(DNJNNO)
;;	LD	D,A
;;	SLA	D
;;	SLA	D
;;	ADD	A,D	;x5
;;	ADD	A,E
;;	LD	E,A
;;	LD	D,$00
;;;
;;	LD	HL,ITEMB
;;	ADD	HL,DE
;;	INC	(HL)
	CALL	DJITRV	;Display buffer -> Main buffer!
	JR	SVDTST
;
TSV030
	CP	KEN+1
	JR	NC,TSV050	; Slect item ?
;------------------------------------
;	CP	TBO
;	JR	NZ,TSV032	; Yes!
;;
;	LD	HL,TUBOCT
;	LD	A,(HL)
;	ADD	A,$10
;	DAA
;	JR	NC,TBGT10
;	LD	A,$99
;TBGT10
;	LD	(HL),A
;;
;	LD	D,PMGIC
;	CALL	ITEMGETS
;;
;	LD	A,0B
;	LD	(CHTRF2),A
;-----------------------------------
;;	LD	HL,ITEMB
;;	LD	D,12
;;TSV031
;;	LD	A,(HLI)
;;	CP	PMGIC
;;	JR	Z,SVDTST
;;	DEC	D
;;	JR	NZ,TSV031	; Already have ?
;;	JR	TSV035
;				; no !
TSV032
	LD	A,(ENHELP)
	CP	TAT
	JR	NZ,TSV0324	; Yes!
;
	LD	HL,TATLEV
	INC	(HL)
TSV0324
	CP	BUL
	JR	NZ,TSV0325	; Yes!
;
	LD	A,(BULLEV)
	CP	$02
	JR	Z,TSV0325
;
	LD	HL,BULLEV
	INC	(HL)
TSV0325
	LD	A,(ENHELP)
	CP	BMB
	JR	NZ,TSV035	; Yes!
;
	LD	HL,BOMBCT
	LD	A,(HL)
	ADD	A,$01
	DAA
	LD	(HL),A
;
;	LD	HL,ITEMB
;	LD	D,12
;TSV033
;	LD	A,(HLI)
;	CP	PBOMB
;	JR	Z,SVDTST
;	DEC	D
;	JR	NZ,TSV033	; Already have ?
;				; no !
TSV035
	LD	D,B
	LD	HL,ITGTDT
	ADD	HL,DE
	LD	D,(HL)
	CALL	ITEMGET
	JR	SVDTST
TSV050
	LD	HL,ITEMB
	ADD	HL,DE
;;	LD	(HL),$1	; Have !!
	INC	(HL)
TSV058
;- - Save data set - - - -
SVDTST
	CALL	SVDSSB
;
	LD	A,(HL)
	OR	%00010000
	LD	(HL),A
	LD	(DJSVBF),A	; Save data buffer set !
TAKARRT
	RET
;==================================
SVDSSB
	LD	A,(DJFLAG)
	LD	D,A
	LD	HL,GRRMSV
	LD	A,(GRNDPT)
	LD	E,A
	LD	A,(DNJNNO)
	CP	DJROOM2 ;$20
	JR	NC,SVDS11
	CP	DJROOM ;$20
	JR	C,SVDS11
;
	INC	D
SVDS11
;;;;	LD	D,$00
	ADD	HL,DE
	RET
;
;===============================================
;=					       =
;===============================================
BLBGKAI	;かいだん
	DB	$6A,$7A,$6B,$7B
BLBGSP	;ゆか
	DB	$10,$12,$11,$13
BLBGBL	;ブロックBG
	DB	$F8,$F9,$FA,$FB
BLBGHK	;墓BG
	DB	$0E,$1E,$0F,$1F
BLBGGKAI ;地上かいだん！
	DB	$68,$77,$69,$4B
;- - - - - - - - - - - - - - - - - - -
BLOCKIT
	CALL	EPXYCK
;
	LD	D,$00
;
	LD	HL,BLMVXS
	ADD	HL,DE
	LD	A,(HL)
;
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
;
	LD	HL,BLMVYS
	ADD	HL,DE
	LD	A,(HL)
;
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),A
	CALL	BLOCKMV
;
	CALL	ENBGCK
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,BLS000
;
	JP	ENCLER
BLS000
	LD	A,$11
	LD	(SOUND3),A	;(S)
;
	LD	DE,BLBGGKAI
	LD	B,SINDO	;はか押し！
;
	LD	A,(DJFLAG)
	AND	A
	JR	Z,BLBGST
;
	LD	DE,BLBGSP
	LD	B,DTU08
;
	LD	A,(GRNDPT)
	CP	$0C7
	JR	NZ,BLBGST	;リチャード王子部屋？
;				;yes !
	LD	DE,BLBGKAI
	LD	B,DTKD0
BLBGST
	PUSH	DE
	LD	A,B
	PUSH	AF
;
	LD	B,$00
;
	LD	A,(ENSVYL)
	SUB	$10-1
	LD	(OBJYP),A
;
	LD	A,(ENSVXL)
	SUB	$8-1
	LD	(OBJXP),A
;
	SWAP	A
	AND	$0F
	LD	E,A
	LD	A,(OBJYP)
	AND	$F0
	OR	E
	LD	E,A
	LD	D,$0
	LD	HL,BGUNDT+$11
	ADD	HL,DE
;;	LD	A,(WORK0)
	POP	AF
	LD	(HL),A
;	CP	SINDO
;	JR	NZ,UNBGWT	;墓押し？
;;				;YES !
;	LD	A,$01		;階段当たり判定！
;	LD	(EXITFG),A
;	LD	A,(OBJYP)
;	AND	$F0
;	ADD	A,$10
;	LD	(EXITYP),A	
;;
;	LD	A,(OBJXP)
;	AND	$F0
;	ADD	A,$08
;	LD	(EXITXP),A
UNBGWT
	CALL	OBJBG
;
	LD	A,(VRAMD)
	LD	E,A
	LD	D,$00
	LD	HL,VRAMD+1
	ADD	HL,DE
;
	ADD	A,$0A
	LD	(VRAMD),A
;
	POP	DE
;
	LD	A,(VRAMH)
	LD	(HLI),A
	LD	A,(VRAML)
	LD	(HLI),A
	LD	A,$81
	LD	(HLI),A
	LD	A,(DE)
	INC	DE
	LD	(HLI),A
	LD	A,(DE)
	INC	DE
	LD	(HLI),A
;
	LD	A,(VRAMH)
	LD	(HLI),A
	LD	A,(VRAML)
	INC	A
	LD	(HLI),A
	LD	A,$81
	LD	(HLI),A
	LD	A,(DE)
	INC	DE
	LD	(HLI),A
	LD	A,(DE)
	LD	(HLI),A
	XOR	A
	LD	(HL),A
;;	CLC	; For rot beam tourou check !!
	RET
;###############################################
;#					       #
;###############################################
BLOCKCD
	DB	$6E,$00,$6E,$20	;墓！
	DB	$F8,$10,$FA,$10	;ブロック
BLMVXS
	DB	$F8,$08,$00,$00
BLMVYS
	DB	$00,$00,$08,$F8
;
BLOCKMV
	LD	A,(DJFLAG)
	LD	(ENCHPT2),A
	LD	DE,BLOCKCD
	CALL	EN2CST
;
	CALL	ENSTCK
;
	CALL	ENMVCL
;
	CALL	CRBLEN
;
	CALL	CRENPS
	JR	NC,BLM020
;
	CALL	PLPSRV
;
	LD	A,$3
	LD	(PLOSHI),A
BLM020
	LD	A,(GRNDPT)
	CP	$C7
	JR	Z,BLM021	;リチャード部屋？
;			
	LD	A,(DJFLAG)
	AND	A
	JR	NZ,BLM022	;ハカ？
;
BLM021
	LD	A,$02		;YES !
	LD	(PLSTOP),A	;階段出る為プレイヤー止める！
BLM022
	LD	HL,ENCONT
	ADD	HL,BC
;
	LD	A,(HL)
	INC	A
	LD	(HL),A
	CP	$20+1	;5/27
	JR	NZ,BLM090
;
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	(HL),A
;
	CALL	ENBGCK
	LD	HL,ENMODE
	ADD	HL,BC
	LD	A,(HL)
;;	CP	$00  
	AND	A
	JR	Z,BLM090
	CP	EFOLE
	JR	Z,BLM090
;
	CALL	ENCLER
;
	LD	DE,BLBGHK
	LD	B,OHAKA ;	墓復帰？
;
	LD	A,(DJFLAG)
	AND	A
	JR	Z,BLM032
;
	LD	DE,BLBGBL
	LD	B,DBL00 ;MV  ;
;
BLM032
	CALL	BLBGST
;
;;	LD	A,(DJSVBF)
;;	AND	%00010000
;;	JR	NZ,BLM090	; Already have ?
;				; no
	LD	A,(NAZOFG)
	AND	%00011111
	CP	$02
	JR	Z,BLM060	; block nazo ?
;;	JR	NZ,BLM022	; block nazo ?
;;				; yes !
;	LD	(NAZOCL),A	; Nazo clear flag !
;	RET
;BLM022
	CP	$7
	JR	NZ,BLM090	; Hit block vs block ?
;				; yes !
	CALL	ENBGCK
	LD	A,(ENBGLR)
	CP	DBLMV
	JR	Z,BLM060
	CP	DBL00
	JR	NZ,BLM090
;	
BLM060
;	LD	A,$01
;	LD	(NAZOCL),A	; Nazo clear flag !
	CALL	NAZOCLR	;(S)
BLM090
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				      %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CRBLEN
	LD	E,ENNO-1
	LD	D,B ;$00
BLE000
	LD	HL,ENMODE
	ADD	HL,DE
	LD	A,(HL)
	CP	EMOVE
	JR	C,BLE010
;
	LD	HL,ENMOD0
	ADD	HL,DE
	LD	A,(HL)
	AND	%01000000
	JR	NZ,BLE010
;
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	A,(ENSVXL)
	SUB	(HL)
	ADD	A,$0C
	CP	$18
	JR	NC,BLE010
;
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENZPSL
	ADD	HL,DE
	SUB	(HL)
;
	LD	HL,ENDSYP
;;;	LD	A,(ENSVYL)
	SUB	(HL)
	ADD	A,$0C
	CP	$18
	JR	NC,BLE010
;----------------------------------------
	LD	HL,ENMOD0
	ADD	HL,DE
	LD	A,(HL)
	AND	%00100000
	JR	NZ,BLE010	; Item ?
;				; NO,
	PUSH	BC
	PUSH	DE
	POP	BC
;
	PUSH	DE
	LD	A,$08
	CALL	ENHNST
	POP	DE
;
	POP	BC
BLE010
	DEC	E
	LD	A,E
	CP	$FF
	JP	NZ,BLE000
	RET
;###############################################
;#	対話的人物試験処置		       #
;###############################################
MSTESFMV
;	LD	A,$01
;	LD	(WORKA),A
;;
;	LD	DE,JIJIICD
;	CALL	EN2CST
;;
;	CALL	EPXYCK
;;
;	LD	A,(FRCNT)
;	AND	$1F
;	JR	NZ,MST1
;;
;	LD	A,E
;	LD	HL,ENMUKI
;	ADD	HL,BC
;	LD	(HL),A
;MST1
;	CALL	MKPTST
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,MD00F0
;;
;	LD	A,$29   ; 対話号番
;	CALL	MSGCHK
;;
;MD00F0
;;
;	RET
;###############################################
;#					       #
;###############################################
;###############################################
;#					       #
;###############################################
MSTESEMV
;	LD	DE,BOSS1CD
;	CALL	EN2CST
;;
;	LD	A,(FRCNT)
;	RRA
;	RRA
;	RRA
;	RRA
;	AND	$01
;;
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	LD	A,(ENSTAT2)
;	RST	0
;	DW	ME0000
;	DW	ME1000
;	DW	ME2000
;;=======================================
;ME0000
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,ME0090
;
;	LD	A,$18	; 対話号番
;	CALL	MSGCHK
;;
;	LD	HL,ENSTAT
;	ADD	HL,BC
;	INC	(HL)
;ME0090
;	RET
;;=======================================
;ME1000
;	LD	A,(MSGEFG)
;	AND	A
;	JR	NZ,ME1090
;;
;	LD	A,(MSANSR)
;	CP	$02
;	JR	Z,ME2000	; cancel !
;;
;	ADD	A,$19
;	CP	$19
;	JR	NZ,ME1222
;;
;	LD	A,(COINC1)
;	CP	$02
;	JR	C,ME1111
;;
;	LD	A,$03
;	LD	(DMAPF),A
;;
;	LD	A,$C8
;	LD	(COIND2),A
;;
;	LD	A,$23
;	JR	ME1222
;ME1111	
;	LD	A,$19
;ME1222
;	CALL	MSGCHK
;;
;	LD	HL,ENSTAT
;	ADD	HL,BC
;	INC	(HL)
;ME1090
;	RET
;;=======================================
;ME2000
;	CALL	STATCLR	; 終劇．
;	RET
;###############################################
;#					       #
;###############################################
MSTESDMV
;	LD	DE,BOSS1CD
;	CALL	EN2CST
;;
;	LD	A,(FRCNT)
;	RRA
;	RRA
;	RRA
;	RRA
;	AND	$01
;;
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,MD0090
;;
;	LD	A,$17   ; 対話号番
;	CALL	MSGCHK
;;
;MD0090
;;
;	RET
;###############################################
;#					       #
;###############################################
MSTESCMV
;	LD	DE,SKEL0CD
;	CALL	EN2CST
;;
;	LD	A,(FRCNT)
;	RRA
;	RRA
;	RRA
;	RRA
;	AND	$01
;
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,MC0090
;;
;	LD	A,$16   ; 対話号番
;	CALL	MSGCHK
;;
;MC0090
;;
;	RET
;###############################################
;#					       #
;###############################################
MSTESBMV
;	LD	DE,SKEL0CD
;	CALL	EN2CST
;;
;	LD	A,(FRCNT)
;	RRA
;	RRA
;	RRA
;	RRA
;	AND	$01
;;
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;;
;	CALL	MSCROS	; 障害物的衝突試験
;
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,MB0090
;;
;	LD	A,$15   ; 対話号番
;	CALL	MSGCHK
;;
;MB0090
;;
;	RET
;###############################################
;#					       #
;###############################################
MSTESAMV
;	LD	DE,CHUNLICD
;	CALL	EN2CST
;;
;	LD	A,(FRCNT)
;	RRA
;	RRA
;	RRA
;	RRA
;	AND	$01
;;
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,MA0090
;;
;	LD	A,$14   ; 対話号番
;	CALL	MSGCHK
;;
;MA0090
;;
;	RET
;###############################################
;#					       #
;###############################################
MSTES9MV
;	LD	A,(FRCNT)
;	RRA
;	RRA
;	RRA
;	AND	$01
;;
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,M90090
;;
;	LD	A,$13   ; 対話号番
;	CALL	MSGCHK
;;
;;;;;	LD	A,$20
;;;;;	LD	(COIND2),A
;M90090
;;
;	RET
;###############################################
;#					       #
;###############################################
;###############################################
;#					       #
;###############################################
MSTES8MV
;	LD	DE,BABULCD
;	CALL	EN2CST
;;
;	LD	A,(FRCNT)
;	RRA
;	AND	$01
;;
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,M80090
;
;	LD	HL,ENWRK0
;	ADD	HL,BC
;	LD	A,(HL)
;	AND	A
;	JR	Z,M80700
;;
;	LD	A,$40
;	LD	(COIND2),A
;;
;	LD	A,$22   ; 対話号番
;	JR	M80800
;
;M80700
;	LD	A,$32
;	LD	(COINU2),A
;;
;	LD	A,$12   ; 対話号番
;;
;M80800
;	CALL	MSGCHK
;
;	LD	HL,ENWRK0
;	ADD	HL,BC
;	INC	(HL)
;;
;M80090
;;
;	RET
;###############################################
;#					       #
;###############################################
;###############################################
;#					       #
;###############################################
;MSTES7MV
;	LD	DE,SKEL0CD
;	CALL	EN2CST
;;
;	LD	A,(FRCNT)
;	RRA
;	RRA
;	RRA
;	AND	$01
;;
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,M70090
;;
;	LD	A,(NAZOCL)
;	AND	A
;	LD	A,$11   ; 対話号番
;	JR	Z,M70080
;	LD	A,$1B
;M70080
;	CALL	MSGCHK
;;
;M70090
;;
;	RET
;###############################################
;#					       #
;###############################################
;MSTES6MV
;	LD	DE,MOTOSCD
;	CALL	EN2CST
;;
;	LD	A,(FRCNT)
;	RRA
;	RRA
;	RRA
;	AND	$01
;;
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	LD	A,(ENSTAT2)
;	RST	0
;	DW	M60000
;	DW	M61000
;	DW	M62000
;;=======================================
;M60000
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,M60090
;;
;	LD	A,$0E	; 対話号番
;	CALL	MSGCHK
;;
;	LD	HL,ENSTAT
;	ADD	HL,BC
;	INC	(HL)
;M60090
;	RET
;;=======================================
;M61000
;	LD	A,(MSGEFG)
;	AND	A
;	JR	NZ,M61090
;;
;	LD	A,(MSANSR)
;	CP	$02
;	JR	Z,M62000	; cancel !
;	ADD	A,$F
;	CALL	MSGCHK
;;
;	LD	HL,ENSTAT
;	ADD	HL,BC
;	INC	(HL)
;M61090
;	RET
;;=======================================
;M62000
;	CALL	STATCLR	; 終劇．
;	RET
;###############################################
;#					       #
;###############################################
MSTES5MV
;	LD	DE,BOSS1CD
;	CALL	EN2CST
;;
;	LD	A,(WORKA)
;	AND	A
;	JR	NZ,M50090
;;
;	CALL	EPXYCK
;;
;	LD	A,(FRCNT)
;	AND	$1F
;	JR	NZ,MSTE050
;;
;	LD	A,E
;	LD	HL,ENMUKI
;	ADD	HL,BC
;	LD	(HL),A
;MSTE050
;	CALL	MKPTST
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,M50090
;;
;	LD	A,$0C	; 対話号番
;	CALL	MSGCHK
;;;
;;;;	CALL	EPXYCK      ;
;   ;                        ;
;;;;	LD	HL,ENMUKI   ;
;;;;	ADD	HL,BC       ;
;;;;	LD	(HL),A      ;
;   ;                        
;;;;	LD	A,SONIC     ;
;;;;	CALL	ENBMST      ;
;;;;	JR	C,M50090    ;
;;
;;;;	LD 	A,(WORK2)   ;
;;;;	LD	HL,ENCHPT   ;
;;;;	ADD	HL,DE       ;
;;;;	LD	(HL),A      ;
;;
;M50090
;;
;	RET
;###############################################
;#					       #
;###############################################
MSTES4MV
;	LD	DE,SLIMBCD
;	CALL	EN2CST
;;
;	LD	A,(FRCNT)
;	RRA
;	RRA
;	RRA
;	RRA
;	AND	$01
;;
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;;
;	CALL	MSCROS	; 障害物的衝突試験
;;
;	LD	A,(ENSTAT2)
;	RST	0
;	DW	M40000
;	DW	M41000
;	DW	M42000
;;=======================================
;M40000
;	CALL	ENMSCK	; 対話的衝突試験
;	JR	NC,M40090
;;
;	LD	A,$09	; 対話号番
;	CALL	MSGCHK
;;
;	LD	HL,ENSTAT
;	ADD	HL,BC
;	INC	(HL)
;M40090
;	RET
;;=======================================
;M41000
;	LD	A,(MSGEFG)
;	AND	A
;	JR	NZ,M41090
;;
;	LD	A,(MSANSR)
;	CP	$02
;	JR	Z,M42000	; cancel !
;	ADD	A,$A
;	CALL	MSGCHK
;;
;	LD	HL,ENSTAT
;	ADD	HL,BC
;	INC	(HL)
;;
;	LD	A,$01
;	LD	(COIND2),A
;;
;M41090
;	RET
;;=======================================
;M42000
;	CALL	STATCLR	; 終劇．
;	RET
;###############################################
;#	メッセージテスト！		       #
;###############################################
;;===========================================
;M2ADDD
;	DB	$00,$01,$FF
;M2ADD2
;	DB	$00,$10,$F0
;GIRL0MV
;MSTES6MV
;TANABEMV
;	LD	DE,CHUNLICD
;	LD	A,(DJFLAG)
;	AND	A
;	JR	NZ,MST001
;;
;	LD	DE,MORI1CD
;MST001
;	CALL	EN2CST
;	CALL	EPXYCK
;;
;	LD	A,(FRCNT)
;	AND	$1F
;	JR	NZ,M2T0D0
;;
;	LD	A,E
;	LD	HL,ENMUKI
;	ADD	HL,BC
;	LD	(HL),A
;M2T0D0
;	CALL	MKPTST
;	CALL	MSCROS
;
;;;	LD	A,(ENSTAT2)
;;;	RST	0
;;	DW	M20000
;;	DW	M21000
;;	DW	M22000
;;	DW	M23000
;;M20000
;;TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
;;	LD	A,(NAME)
;;	CP	$00
;;	JR	NZ,M200002
;;
;	LD	A,$01
;	LD	(CHTRFG),A
;	LD	(PLSTOP),A
;;
;	LD	A,(KEYA2)
;	AND	$03
;	LD	E,A
;	LD	D,B
;	LD	HL,M2ADDD
;	ADD	HL,DE
;	LD	A,(MSTNO)
;	PUSH	AF
;	ADD	A,(HL)
;	AND	$0F
;	LD	E,A
;	POP	AF
;	AND	$F0
;	OR	E
;	LD	(MSTNO),A
;;
;	LD	A,(KEYA2)
;	RRA
;	RRA
;	AND	$03
;	LD	E,A
;	LD	D,B
;	LD	HL,M2ADD2
;	ADD	HL,DE
;	LD	A,(MSTNO)
;	ADD	A,(HL)
;	LD	(MSTNO),A
;;
;;;	CALL	ENMSCK
;;;	JR	NC,M20010
;;
;	LD	A,(MSGEFG)
;	AND	A
;	JR	NZ,M20010
;;
;	LD	A,(KEYA2)
;	AND	%00010000
;	JR	Z,M2000X
;;
;	LD	A,(MSTNO)
;	JP	MSGCHK
;M2000X
;	LD	A,(KEYA2)
;	AND	%00100000
;	JR	Z,M20010
;;
;	LD	A,(MSTNO)
;	JP	MSGCH2
;M20010
;	RET
;TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
;M200002
;	CALL	ENMSCK
;	JR	NC,M20010
;	LD	A,(DJFLAG)
;	AND	A
;	JR	NZ,M20001
;;
;	LD	A,$00
;	JP	MSGCHK
;M20001
;	LD	A,(HARTMX)
;	CP	$07
;	JR	NC,M20003
;;
;	LD	A,(DJSVBF)	; Save data buffer set !
;	AND	%00010000
;	LD	A,$54
;	JR	Z,M20008
;M20003
;	LD	A,$55
;;
;;	LD	HL,ENWRK3
;;	ADD	HL,BC
;;	LD	A,(HL)
;;	INC	(HL)
;;	ADD	A,$90
;;
;M20008
;	CALL	MSGCHK
;;
;	CALL	STATINC
;M20010
;	RET
;===========================================
;M21000
;	LD	A,(MSGEFG)
;	AND	A
;	JR	NZ,M21010
;
;	LD	A,(HARTMX)
;	CP	$07
;	JR	NC,M21020
;;
;	LD	A,(DJSVBF)
;	AND	%00010000
;	JR	NZ,M21020
;;
;	CALL	LDTIM0
;	LD	(HL),$70
;;
;	LD	A,$01
;	LD	(SOUND1),A	;(S)
;;
;	CALL	STATINC
;M21010
;	RET
;M21020
;	CALL	STATINC
;	LD	(HL),B
;	RET
;;===========================================
;KENCD
;	DB	$84,$10
;	DB	$86,$10
;;
;M22000
;	CALL	LDTIM0
;	JP	Z,STATINC
;	CP	$01
;	JR	NZ,M22010
;;
;	LD	A,(GRNDPT)
;	CP	$A3
;	JR	NZ,M22008
;;
;	LD	D,PTATE
;;;	LD	(ITEMB),A
;	CALL	ITEMGET
;;
;	LD	A,$01
;	LD	(TATLEV),A
;	JR	M2200A
;;
;M22008
;	LD	D,PKEN
;	CALL	ITEMGET
;;;	LD	(ITEMB),A
;;
;	LD	A,$01
;	LD	(KENLEV),A
;;
;M2200A
;	CALL	SVDTST
;;
;	RET
;;	JP	BGMSET
;M22010
;	LD	A,(PLXPSL)
;	LD	(ENSVXL),A
;	LD	A,(PLYPSL)
;	SUB	$0C
;	LD	(ENDSYP),A
;;
;	LD	A,(GRNDPT)
;	CP	$A3
;	LD	A,$00
;	JR	NZ,M22012
;	INC	A
;M22012
;	LD	(ENCHPT2),A
;
;	LD	DE,KENCD
;	CALL	EN1CST
;;
;	CALL	ENPSSV
;;
;	JP	JYANPS	; Player pause set !
;;
;;===========================================
;M23000
;	RET
;
;
;
;CHUNLIMV
;	LD	DE,CHUNLICD
;	CALL	EN2CST
;	JR	MST010
;
;
;MSTESTMV
;	LD	DE,MORI1CD
;	CALL	EN2CST
;MST010
;	CALL	EPXYCK
;;
;MST022
;	LD	A,(FRCNT)
;	AND	$1F
;	JR	NZ,MST0D0
;;
;	LD	A,E
;	LD	HL,ENMUKI
;	ADD	HL,BC
;	LD	(HL),A
;MST0D0
;	CALL	MKPTST
;;
;MST0D8
;	CALL	MSCROS
;
;	LD	A,(ENSTAT2) ;HL)
;	RST	0
;	DW	MS1000
;	DW	MS2000
;	DW	MS3000
;;==========================================
;MS1000
;	CALL	ENMSCK
;	JR	NC,MST0090
;;
;	LD	A,(ENMYNO2)
;	CP	HINTO
;	JR	NZ,MST0058
;;
;	LD	A,(PENDF)
;	AND	A
;	LD	A,$10
;	JR	Z,NST000	;ペンダント持っている？
;;				; yes !
;	LD	A,(DNJNNO)
;	ADD	A,$08
;NST000
;	CALL	MSGCH2
;	RET
;MST0058
;;	CP	MSTES2
;;	JR	NZ,MST0060
;
;	LD	A,$4
;	CALL	MSGCHK
;
;	LD	E,ENNO
;	LD	D,$00
;M2S008
;	LD	HL,ENMODE
;	ADD	HL,DE
;	LD	A,(HL)
;	AND	A
;	JR	Z,M2S010
;;
;	LD	HL,ENMOD0
;	ADD	HL,DE
;	LD	A,(HL)
;	AND	%00100000
;	JR	Z,M2S010
;;
;	LD	HL,ENWRK2
;	ADD	HL,DE
;	LD	A,(HL)
;	AND	A
;	JR	NZ,M2S010
;;
;	LD	A,(SPEKFG)
;	AND	A
;	LD	A,$04
;	JR	Z,M2S010
;;
;	INC	A
;;
;	PUSH	AF		;
;;				;
;	LD	A,$48		;
;	LD	(HARTDW),A	;
;;				;
;	POP	AF		;
;
;M2S010
;	CALL	MSGCHK
;	RET
;M2S010
;	DEC	E
;	LD	A,E
;	CP	$FF
;	JR	NZ,M2S008
;
;	RET
;MST0060
;	LD	HL,ENSTAT
;	ADD	HL,BC
;	INC	(HL)
;;
;	LD	A,$0
;	CALL	MSGCHK
;MST0090
;	RET
;;==========================================
;MS2000
;	LD	A,(MSGEFG)
;	AND	A
;	JR	NZ,MS2010
;;
;	LD	HL,ENSTAT
;	ADD	HL,BC
;	INC	(HL)
;;
;	LD	A,(MSANSR)
;	CP	$02
;	JR	Z,MS3000  ; Cansel ?
;	ADD	A,$1		; no !
;	CALL	MSGCHK2
;;
;MS2010
;	RET
;==========================================
;MS3000
;STATCLR
;	CALL	STATINC
;	LD	(HL),B
;;	XOR	A
;;	LD	HL,ENSTAT
;;	ADD	HL,BC
;	LD	(HL),A
;	RET
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
;MSCROS
;	CALL	CRENPS
;	JR	NC,MS20E0
;;
;	CALL	PLPSRV
;;
;	CALL	DUSHCL
;;
;	LD	A,(PFUCKID)
;	AND	A
;	JR	Z,MS20D0
;	
;	LD	E,A
;	LD	D,B
;	LD	HL,ENMYNO-1
;	ADD	HL,DE
;	LD	A,(HL)
;	CP	FUCKS
;	JR	NZ,MS20D0
;;
;	LD	HL,ENSTAT-1	; Fuck return
;	ADD	HL,DE
;	LD	(HL),$00
;MS20D0
;	SCF
;	RET	
;MS20E0
;	AND	A
;	RET
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
;ENMSCK
;	LD	A,(PLXPSL)
;	LD	HL,ENSVXL
;	SUB	(HL)
;	ADD	A,$10
;	CP	$20
;	JR	NC,EMC080
;;
;	LD	A,(PLYPSL)
;	LD	HL,ENSVYL
;	SUB	(HL)
;	ADD	A,$14
;	CP	$28
;	JR	NC,EMC080
;;
;	CALL	EPXYCK
;	LD	A,(PLCMKI)
;	XOR	$01
;	CP	E
;	JR	NZ,EMC080
;;
;	LD	HL,MSCRFG
;	INC	(HL)
;;
;	LD	A,(MSGEFG)
;	LD	HL,WNDFLG
;	OR	(HL)	;AND	A
;	LD	HL,MSOFTM
;	OR	(HL)	;AND	A
;	JR	NZ,EMC080
;
;	LD	A,(WNDYPS)
;	CP	$80
;	JR	NZ,EMC080
;;
;	LD	A,(KEYA2)
;	AND	%00010000
;	JR	Z,EMC080
;
;	SCF
;	RET
;EMC080
;	AND	A	; (C) reset !
;	RET
;###############################################
;#					       #
;###############################################
;- - - - - - - - - - - - - - - - - -
;- - - - - - - - - - - - - - - - - -
;- - - - - - - - - - - - - - - - - -
KTISCD
	DB	$16,$00
;
KTOBJMV
	LD	A,C
	LD	(KTINDX),A
;	LD	HL,ENWRK2
;	ADD	HL,BC
;	LD	A,(HL)
;	AND	A
;	JR	Z,KO0090	; Ishi hahen ?
;;				; yes !
;	LD	DE,KTISCD
;	CALL	EN1CST
;;
;	CALL	ENSTCK
;;
;	CALL	ENMVCL
;	CALL	ENZCLC
;	LD	HL,ENZSPD
;	ADD	HL,BC
;	DEC	(HL)
;	DEC	(HL)
;;
;	LD	HL,ENZPSL
;	ADD	HL,BC
;	LD	A,(HL)
;	AND	%10000000
;	JR	Z,KO0020
;;
;	CALL	ENCLER
;KO0020	
;	RET
;==========================================
KO0090
;;	LD	HL,ENTIM1
;;	ADD	HL,BC
;;	LD	A,(HL)
	CALL	LDTIM1
	LD	(WORK0),A
;;;	AND	A
	JP	Z,KOM010
;
	CP	$1
	JR	NZ,KOM008
;
	LD	HL,ENWRK4
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,KOM002	;シゲミン草？
;				;YES !
	CALL	RNDSUB		;ランダム妖精セット！
	AND	$03
	JR	NZ,KOM002
;
	LD	A,YOSEI
	CALL	ENIDSH
	JR	C,KOM002
;
	LD	A,(WORK0)
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	A,(WORK1)
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	A,(WORK3)
	LD	HL,ENZPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENTIM3
	ADD	HL,DE
	LD	(HL),$80 ;A
KOM002
	LD	A,(ENCHPT2)
	AND	A
	JR	NZ,KTO0111	;壷？
;				
	LD	A,(DNJNNO)
	CP	$1E
	JR	Z,KOM003
	CP	$10 ;DJMAX
	JR	NZ,KTO0111
;
KOM003
	LD	A,(MARINFG)	;yes!
	AND	A
	JR	Z,KTO0111	
;
	CALL	RNDSUB
	AND	$3F
	JR	NZ,KTO011M
;
	LD	A,$28
	CALL	MSGCHK	;マリンおこる！
	JP	ENCLER
KTO011M
	LD	A,$99
	CALL	MSGCH2	;マリンおこる！
KTO0111
	JP	ENCLER
;----------------------------------------
KOM008
	CALL	KTFLCSL
	RET
;------------------------------------------------
KTOBJCD
	DB	$F0,$10,$F2,$10
	DB	$F4,$10,$F6,$10
KOM010
	LD	DE,KTOBJCD
	CALL	EN2CST
;
	CALL	ENSTCK
;
;;;	CALL	ENMVCL
	LD	A,$B
	LD	(ATCKNO),A
	CALL	CRENEN
;;	CALL	ENBGCK
	CALL	ENBDCL
;
	LD	HL,ENMODE
	ADD	HL,BC
	LD	A,(HL)
	CP	EFOLE
	JP	Z,KTO090
;
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,KTO010
;
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,KTO090
;
	CALL	SHBUTCK	;シャッター(なぞ）にぶつけたか？
;;	JR	NC,KTO010
;;;
;;	CALL	NAZOCLR	;(S)	; YES !
;========================================
KTFLST
KTO010
;	PUSH	DE
;
;;	LD	HL,ENCHPT
;;	ADD	HL,BC
;L	LD	A,(ENCHPT2) ;HL)
;L	CP	$01
;L	JR	NZ,ISIBRK
;
	LD	HL,SOUND3
	LD	(HL),$05	;(S)
;
;
	LD	E,$1F	; Kusa break time
;
	LD	A,(ENCHPT2)
	CP	$FF
	JR	Z,KFSS10
	CP	$01
	JR	Z,KFSS10
;
;;	LD	HL,SOUND3
	LD	(HL),$09	;(S)
;
	LD	E,$0F	; Ishi break time 
KFSS10
	LD	HL,ENTIM1
	ADD	HL,BC
	LD	(HL),E  ;$1F
;
	LD	HL,ENMOD0
	ADD	HL,BC
	LD	A,(HL)
	ADD	A,$2
	LD	(HL),A
;
;	LD	A,OCTAM
;	LD	HL,ENMYNO
;	ADD	HL,BC
;	LD	(HL),A
;;
;	LD	HL,ENZPSL
;	ADD	HL,BC
;	LD	A,(HL)
;	PUSH	AF
;	PUSH	HL
;;
;	CALL	ENMDST
;;
;	POP	HL
;	POP	AF
;	LD	(HL),A
;;
;	LD	HL,ENTIM0
;	ADD	HL,BC
;	LD	A,$FF
;	LD	(HL),A
;;
;	POP	DE
KTO090
	RET
;=============================================
ISIBRK
	LD	A,KTOBJ
	CALL	ENIDSH
	JR	C,ISB090
;
	LD	A,(WORK0)
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	A,(WORK1)
	LD	HL,WORK3
	SUB	(HL)
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENCHPT
	ADD	HL,DE
	L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P	DE
;	DEC	E
;	LD	A,E
;	CP	$FF
;	JR	NZ,ISB010
;;
;	CALL	ENCLER
;;
;	RET
;=====================================
SHBUTCK
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,SHBC90
;
	LD	A,(NAZOFG)
	AND	%00011111
	CP	$0D
	JR	NZ,SHBC10	;宝箱にぶつける謎？
;				; YES !
	LD	A,(ENBGLR)
	CP	DTRE0
	JR	Z,SHBC08
	LD	A,(ENBGUD)
	CP	DTRE0
	JR	NZ,SHBC90
SHBC08
	LD	A,$30
	LD	(OBJXP),A
	LD	A,$20
	LD	(OBJYP),A
;
	LD	A,BKY
	LD	(WORK8),A
	CALL	TAKARSTL
	JP	NAZOCLR	;(S)
;--------------------------------------
SHBC10
	CP	$0B
	JR	NZ,SHBC90	;シャッターぶつけ謎？
;				; YES !
	LD	A,(ENBGUD)
	CP	DSHI0
	JR	C,SHBC90
	CP	DSHI7+1
	JR	C,SHBC80
;
SHBC70
	LD	A,(ENBGLR)
	CP	DSHI0
	JR	C,SHBC90
	CP	DSHI7+1
	JR	NC,SHBC90
SHBC80
;;	SCF
	CALL	NAZOCLR		;(S)
;;;	RET
SHBC90
;;;	AND	A
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ENFLCD
	DB	$32,$00,$32,$60
KEMRICD
	DB	$30,$00,$30,$60
;ENFLBCD
;	DB	$F8,$F8,$3E,$00
;	DB	$10,$F8,$3E,$00
;	DB	$F8,$10,$3E,$00
;	DB	$10,$10,$3E,$00
ENFLSCD
;0
	DB	$00,$00,$3C,$00
	DB	$00,$08,$3C,$20
	DB	$FF,$FF,$FF,$FF
	DB	$FF,$FF,$FF,$FF
;1
	DB	$00,$00,$3A,$00
	DB	$00,$08,$3A,$20
	DB	$FF,$FF,$FF,$FF
	DB	$FF,$FF,$FF,$FF
;2
	DB	$FA,$FA,$3A,$00
	DB	$FA,$02,$3A,$20
	DB	$06,$06,$3A,$00
	DB	$06,$0E,$3A,$20
;3
	DB	$04,$FC,$30,$00
	DB	$04,$04,$30,$20
	DB	$FC,$04,$30,$00
	DB	$FC,$0C,$30,$20
;;4
;	DB	$00,$00,$30,$00
;	DB	$00,$08,$30,$20
;	DB	$FF,$FF,$FF,$FF
;	DB	$FF,$FF,$FF,$FF
ENFLBCD
;;0
;	DB	$00,$00,$3A,$00
;	DB	$00,$08,$3A,$20
;	DB	$FF,$FF,$FF,$FF
;	DB	$FF,$FF,$FF,$FF
;;1
;	DB	$F8,$F8,$3A,$00
;	DB	$F8,$00,$3A,$20
;	DB	$08,$08,$3A,$00
;	DB	$08,$10,$3A,$20
;;2
;	DB	$08,$F8,$3A,$00
;	DB	$08,$00,$3A,$20
;	DB	$F8,$08,$3A,$00
;	DB	$F8,$10,$3A,$20
;;3
;	DB	$00,$00,$30,$00
;	DB	$00,$08,$30,$20
;	DB	$FF,$FF,$FF,$FF
;	DB	$FF,$FF,$FF,$FF
;0
	DB	$00,$00,$3A,$00
	DB	$00,$08,$3A,$20
	DB	$FF,$FF,$FF,$FF
	DB	$FF,$FF,$FF,$FF
;1
	DB	$F8,$F8,$3A,$00
	DB	$F8,$00,$3A,$20
	DB	$08,$08,$3A,$00
	DB	$08,$10,$3A,$20
;2
	DB	$08,$F8,$3A,$00
	DB	$08,$00,$3A,$20
	DB	$F8,$08,$3A,$00
	DB	$F8,$10,$3A,$20
;3
	DB	$F8,$F8,$10,$00
	DB	$F8,$00,$12,$00
	DB	$F8,$08,$12,$20
	DB	$F8,$10,$10,$20
	DB	$08,$F8,$10,$40
	DB	$08,$00,$12,$40
	DB	$08,$08,$12,$60
	DB	$08,$10,$10,$60
;---------------------------------------------
ENFAIL
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
	AND	%10000000
	JR	Z,EF0090
;
	JP	ENMOVE
EF0090
	LD	HL,ENTIM4
	ADD	HL,BC
	LD	A,(HL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2
;
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,ENFL11
;
;	LD	HL,ENHNMD
;	ADD	HL,BC
;	LD	A,(HL)
;
	LD	HL,ENTIM4
	ADD	HL,BC
;	LD	(HL),$10
;	AND	A
;	JR	Z,ENFL11	;Hi power ?
;				;yes !
	LD	(HL),$1F
;
	LD	A,(POWRFG)
;;	AND	A
	CP	$01
	JR	NZ,ENFL0C
;
	LD	A,$12
	LD	(SOUND2),A	;(S)
;;	LD	HL,SOUND1	;(S)
;;	LD	(HL),$06
;;	JR	ENFL11
;
ENFL0C
	LD	HL,SOUND3	;(S)
	LD	(HL),$13
ENFL11
	CALL	ENHNSB
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%	敵やられアイテムセット	   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;;	0:00%  1:25%Rupy  2:50%Rupy  3:50%Heart 4:Heart100%
;;	5:25%Alow 6:25%heart 7:25%randam 8:50%randam 9:fairy50%
;;	A:100%Alow B:Bomb100% C:Rupy100% D:Fairy25% E:100%fairy
ITMSNO
	DB	RUPY1,RUPY1,HART1,HART1
	DB	ALOW1,HART1,$FF,$FF
	DB	YOSEI,ALOW1,BOMB1,RUPY1,YOSEI,YOSEI
ITMSTD
	DB	$03,$01,$01,$00
	DB	$03,$03,$03,$03
	DB	$01,$00,$00,$00,$03,$00
ITMSTD2
	DB	$01,$01,$01,$00
	DB	$01,$01,$01,$01
	DB	$01,$00,$00,$00,$01,$00
ITRNDDT
	DB	RUPY1
	DB	HART1
	DB	BOMB1
	DB	YOSEI
	DB	RUPY1
	DB	HART1
	DB	BOMB1
	DB	ALOW1
;- - - - - - - - - - - - - - - - - - -
ENITMS
	LD	A,(ENMYNO2)
	CP	LAIKU
	JR	NZ,EITS010
;
	LD	HL,ENWRK0
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,EITS010
;
	LD	A,PLTAT
	JP	EITS020
;
EITS010
;	CP	GHOST
;	JR	Z,EITS12
;	CP	GHOSS
;	JR	Z,EITS12
;	CP	GHOSB
;	JR	NZ,EITS18
;;
;EITS12
;	LD	HL,ENWRK2
;	ADD	HL,BC
;	LD	A,(HL)
;	AND	A
;	JP	Z,RPS090	; Zenmetsu ?
;;				; yes !
;	CALL	RNDSUB		; All item set !
;	AND	$3
;	INC	A
;	LD	E,A
;	LD	D,B
;	JR	EITS1A
;- - - - - - - - - - - - - - - -
EITS18
	LD	HL,ENITMF
	ADD	HL,BC
	LD	A,(HL)
	CP	$FF
	RET 	Z
	AND	A
	JP	NZ,EITS020	;強制アイテムセット
;
	LD	A,(ENFLCT2)
	INC	A
	LD	(ENFLCT2),A	;守りの木のみセットカウント！
;;	CP	$08
	CP	12
	JR	C,KIMIS10
;
	XOR	A
	LD	(ENFLCT2),A
;
	LD	A,(BOSSFG)
	LD	HL,POWRFG
	OR	(HL)
	LD	HL,YKFLAG
	OR	(HL)
	JR	NZ,KIMIS10	;ボスへや or 横画面？
;
	LD	A,KINOM		;木のみ！
	JP	EITS020
;
KIMIS10
	LD	HL,ENMOD2
	ADD	HL,BC
	LD	D,B
	LD	E,(HL)
	LD	HL,ITSTDT
	ADD	HL,DE
	LD	A,(HL)
	AND	A
;;	JP	Z,RPS090	; Item set ok ?
	RET	Z
;				; yes !
	LD	E,A
;
	LD	D,30
	LD	A,(HARTMX)
	CP	07
	JR	C,EFE091
	LD	D,35
	CP	11
	JR	C,EFE091
	LD	D,40
EFE091
	LD	HL,ENFLCT	; All fail counter for level up !
	INC	(HL)
	LD	A,(HL)
	CP	D
	JR	C,EFE0911
;
	LD	(HL),B
;
	LD	A,(BOSSFG)
	LD	HL,YKFLAG
	OR	(HL)
	LD	HL,POWRFG
	OR	(HL)
	JR	NZ,EFE0911	;ボスへや or 横画面？
;				;NO
	LD	A,POWER	;POWER CHIP SET!
	JR	EITS020
EFE0911
	LD	D,B
	LD	HL,ITMSTD-1
	LD	A,(PINCHFG)
	AND	A
	JR	Z,EFE0912
	LD	HL,ITMSTD2-1
EFE0912
	ADD	HL,DE
;;	LD	A,(HL)
;;	CP	$04
;;	JR	Z,EITS1A	; 100%
	CALL	RNDSUB
	AND	(HL)
;;	JR	NZ,RPS090	; 確立当たり？
	RET	NZ
;               		；　ｙｅｓ
;
EITS1A
	LD	HL,ITMSNO-1
	ADD	HL,DE
	LD	A,(HL)
	CP	$FF
	JR	NZ,EITS020
;
	CALL	RNDSUB
	AND	$07
	LD	E,A
	LD	D,B
	LD	HL,ITRNDDT
	ADD	HL,DE
	LD	A,(HL)
EITS020
	CALL	ENIDSH
;;	JR	C,RPS090
	RET	C
;
	LD	HL,ENWRK0
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENWRK0	; For PLTAT level !!
	ADD	HL,DE
	LD	(HL),A
;
	LD	A,(WORK0)
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	A,(WORK1)
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	(HL),A
;
;;	LD	A,$80
	LD	HL,ENTIM3
	ADD	HL,DE
	LD	(HL),$80 ;A
;
	LD	HL,ENTIM1
	ADD	HL,DE
	LD	(HL),$18	;Hit protect !
;
	LD	HL,ENTIM4
	ADD	HL,DE
	LD	(HL),$03 ;A	; Water up protect !
;
	LD	A,(YKFLAG)
	AND	A
	JR	NZ,ITMS10
;
	LD	HL,ENMYNO
	ADD	HL,DE
	LD	A,(HL)
	CP	KEYSM
	JR	NZ,KSS010	;地上鍵！
;
	LD	A,(ENMYNO2)
	CP	NOMOS
	JR	NZ,KSS010
;
	LD	HL,ENCHPT
	ADD	HL,DE
	LD	(HL),$03
;;	LD	(HL),$04
KSS010
	CP	KAKIN
	JR	NZ,ITMS0C
;
	LD	A,(GRNDPT)
	CP	$58
	JR	Z,ITMS0BB
	CP	$5A
	JR	NZ,ITMS0C
;
ITMS0BB
	PUSH	BC
	PUSH	DE
	PUSH	DE
	POP	BC
;
	LD	A,$10
	CALL	PSERCH
;
	POP	DE
	POP	BC
ITMS0C
	LD	HL,ENZSPD
	ADD	HL,DE
;;      LD	A,$14
	LD	(HL),$18 ;A
	JR	ITMS20
ITMS10
	LD	HL,ENYSPD
	ADD	HL,DE
	LD	(HL),$EC ;A
;;;;	JR	ITMS20
ITMS20
;------------------------------------------
ENZPSR
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENZPSL
	ADD	HL,DE
	LD	(HL),A
RPS090
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ENCATM		; Normal speed pik up time !
	DB	$01,$08,$08,$10
ENCATM2		; Hi speed 
	DB	$01,$04,$04,$0A
ENCAPD
	DB	$37,$37,$37,$01
	DB	$39,$39,$39,$01
	DB	$3B,$3B,$3B,$01
	DB	$3D,$3D,$3D,$01
ENCAXD
	DB	$10,$10,$08,$00
	DB	$F0,$F0,$F8,$00
	DB	$00,$00,$00,$00
	DB	$FF,$FF,$FF,$FF
ENCAYD
	DB	$00,$00,$00,$00
	DB	$00,$00,$00,$00
	DB	$00,$00,$00,$00
	DB	$00,$00,$08,$00
ENCAZD
	DB	$00,$00,$08,$0E
	DB	$00,$00,$08,$0E
	DB	$00,$00,$08,$0E
	DB	$00,$00,$00,$0E
;-------------------------------------
ENCACH
	LD	A,(ENMYNO2)
	LD	(PLCANO),A
	CP	BOMBR
	JR	NZ,ECA0F00
;
	LD	HL,ENFLSH
	ADD	HL,BC
	LD	(HL),B
;
;;	LD	DE,BOMBRCD
;;	CALL	EN1CST
	CALL	BOMBRCS
	JR	ECA0F10
;
ECA0F00
	CALL	ENMOVEL
;
ECA0F10
;;;	CALL	ENSTCK2
;
	LD	HL,ENCAST ;STAT
	ADD	HL,BC
	LD	A,(HL)
;;;	LD	A,(ENSTAT2) ;HL)
	LD	E,A
	LD	D,B ;$0
	CP	$4
	JR	Z,ENCA30
;
	LD	A,(PL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A
	RET
;
;-------------------------------------
CAOFCK
	CALL	CAOFCKL
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;
;###############################################
;#					       #
;###############################################
OCTA1MV
	LD	DE,OCTA1CD2
	LD	A,(GMMODE)
	CP	ENDG
	JR	Z,OCT1100
;
;;	LD	DE,OCTA1CD
	LD	A,$30
	LD	(ENCHNO),A
OCT1100
;;	CALL	EN2CST
;
	CALL	ENMVSB
	RET
;
;	LD	A,$10
;	CALL	PSERCH
;	CALL	ENMVCL
;	RET
;===============================================
OCTA1CD
;	DB	$60,$00,$60,$20 ;D
;	DB	$62,$00,$62,$20
;	DB	$60,$40,$60,$60 ;U
;	DB	$62,$40,$62,$60
;	DB	$64,$00,$66,$00 ;L
;	DB	$68,$00,$6A,$00
;	DB	$66,$20,$64,$20 ;R
;	DB	$6A,$20,$68,$20
OCTA1CD2
	DB	$30,$00,$30,$20 ;D
	DB	$32,$00,$32,$20
	DB	$30,$40,$30,$60 ;U
	DB	$32,$40,$32,$60
	DB	$34,$00,$36,$00 ;L
	DB	$38,$00,$3A,$00
	DB	$36,$20,$34,$20 ;R
	DB	$3A,$20,$38,$20
;###############################################
;#					       #
;###############################################
MRMVXS
	DB	$08,$F8,$00,$00
MRMVYS
	DB	$00,$00,$F8,$08
MRMVPT
	DB	$06,$04,$02,$00
;
MORI1MV
	LD	A,(DNJNNO)
	CP	$15
	JR	NZ,M0M10E0	;洞窟？
;				;YES !
	LD	A,(WANFLG)
	CP	$80
	JP	NZ,ENCLER
;
M0M10E0
	LD	A,C
	LD	(WAINDX2),A	;ワンワン連れ用インデックス
;
	LD	DE,MORI1CD
ENMVSB
	CALL	EN2CST
;
	CALL	ENSTCK
;
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,EMVS10	;はねかえりストップ！
;
	LD	HL,ENSTAT
	ADD	HL,BC
	LD	A,$01
	LD	(HL),A
	LD	(ENSTAT2),A
;
	CALL	LDTIM0
	LD	(HL),$40
EMVS10
	CALL	ENHNSB
;
	CALL	CREPKE
;;	CALL	CRENPL
;;	CALL	CRKNEN
;
;;	LD	HL,ENSTAT
;;	ADD	HL,BC
	LD	A,(ENSTAT2) ;HL)
	AND	A
	JR	Z,MR1WLK
;- - STOP - -
;;	LD	HL,ENTIM0
;;	ADD	HL,BC
;;	LD	A,(HL)
	CALL	LDTIM0
;;	AND	A
	JR	Z,MR1S02
;
	CP	$0A
	JR	NZ,MR1S01	; Shot chance ?
;				; yes 
	CALL	LDTIM1
	JR	NZ,MR1S01
;
	CALL	EPXYCK
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	A,E
	CP	(HL)
	JR	NZ,MR1S01
;
	LD	A,(ENMYNO2)
	CP	HIPLP
	JR	Z,MR1S01
	CP	OCTA1
	JR	Z,OCTAMSS
;
	CALL	MORYAST
MR1S01
	CALL	ENBGCK
	RET
;--------------------------------
OCTAMSS
	LD	A,(GMMODE)
	CP	ENDG
	RET	Z
;
	CALL	OCTAMST
	RET
;--------------------------------
MR1S02
	CALL	RNDSUB
	AND	$1F
	OR	$20
	LD	(HL),A
;
	LD	HL,ENSTAT
	ADD	HL,BC
;;	LD	A,$0
	LD	(HL),$00 ;A
;
	LD	HL,ENWRK0
	ADD	HL,BC
	LD	A,(HL)
	INC	A
	AND	$3
	LD	(HL),A
	CP	$00
	JR	NZ,MR1S08	; 4 move 1 serch !
;
	CALL	EPXYCK
	JR	MR1S0A
MR1S08
	CALL	RNDSUB
MR1S0A
	AND	$03
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	(HL),A
;
	LD	E,A
	LD	D,B ;$0
	LD	HL,MRMVXS
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
	LD	HL,MRMVYS
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),A
MR1S10
	RET
;------------------------------------------
;- - WALK - -
MR1WLK
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	AND	%00001111
	JR	NZ,MR1STS
;
;;	LD	HL,ENTIM0
;;	ADD	HL,BC
;;	LD	A,(HL)
	CALL	LDTIM0
;;	AND	A	;CP	$00
	JR	NZ,MR1M10
MR1STS
	CALL	RNDSUB
	AND	$0F
	OR	$10
	LD	(HL),A
;
	LD	HL,ENSTAT
	ADD	HL,BC
;;;	LD	A,$1
	LD	(HL),$01 ;A
;
	CALL	ENSDCL
MR1M10
;
	CALL	ENMVCL
	CALL	ENBGCK
;
MKPTST
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	E,(HL)
;;	LD	E,A
	LD	D,B ;$0
	LD	HL,MRMVPT
	ADD	HL,DE
;
	PUSH	HL
	LD	HL,ENCONT
	ADD	HL,BC
	INC	(HL)
;
	LD	A,(HL)  ;(FRCNT)
	RRA	
	RRA	
	RRA	
	POP	HL
	AND	%00000001
	OR	(HL)
;
	CALL	ENPTST
;
	RET
;===============================================
MORI1CD
	DB	$60,$00,$62,$00
	DB	$62,$20,$60,$20
	DB	$64,$00,$66,$00
	DB	$66,$20,$64,$20
	DB	$68,$00,$6A,$00
	DB	$6C,$00,$6E,$00
	DB	$6A,$20,$68,$20
	DB	$6E,$20,$6C,$20
;###############################################
;#					       #
;###############################################
MYSXAD
	DB	$08,$F8,$04,$FC
MYSYAD
	DB	$FC,$FC,$F8,$00
MYSXSD
	DB	$20,$E0,$00,$00
MYSYSD
	DB	$00,$00,$E0,$20
;- - - - - - - - - - - - - - - - -
MORYAST
	LD	A,MORYA
	CALL	ENIDSH
	JR	C,MYS090
;
	PUSH	BC
;
	LD	A,(WORK2)
	LD	C,A
;
	LD	HL,MYSXAD
	ADD	HL,BC
;
	LD	A,(WORK0)
	ADD	A,(HL)
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,MYSYAD
	ADD	HL,BC
;
	LD	A,(WORK1)
	ADD	A,(HL)
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,MYSXSD
	ADD	HL,BC
;
	LD 	A,(HL)
	LD	HL,ENXSPD
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,MYSYSD
	ADD	HL,BC
;
	LD 	A,(HL)
	LD	HL,ENYSPD
	ADD	HL,DE
	LD	(HL),A
;
	LD 	A,(WORK2)
	LD	HL,ENCHPT
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENMUKI
	ADD	HL,DE
	LD	(HL),A
;
	POP	BC
MYS090
	RET
;###############################################
;#					       #
;###############################################
OTSXAD
	DB	$08,$F8 ;,$00,$00
OTSYAD
	DB	$00,$00,$F8,$08
OTSXSD
	DB	$20,$E0 ;,$00,$00
OTSYSD
	DB	$00,$00,$E0,$20
;- - - - - - - - - - - - - - - - -
OCTAMST
	LD	A,OCTAM
ENBMST
	CALL	ENIDSH
	JR	C,OTS090
;
	PUSH	BC
;
	LD	A,(WORK2)
	LD	HL,ENMUKI
	ADD	HL,DE
	LD	(HL),A
;
	LD	C,A
;
	LD	HL,OTSXAD
	ADD	HL,BC
;
	LD	A,(WORK0)
	ADD	A,(HL)
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,OTSYAD
	ADD	HL,BC
;
	LD	A,(WORK1)
	ADD	A,(HL)
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,OTSXSD
	ADD	HL,BC
;
	LD 	A,(HL)
	LD	HL,ENXSPD
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,OTSYSD
	ADD	HL,BC
;
	LD 	A,(HL)
	LD	HL,ENYSPD
	ADD	HL,DE
	LD	(HL),A
;
	POP	BC
	AND	A	; CLC
OTS090
	RET
;%%%%%%%%%%%%%%%%%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L)
;	AND	$1
;	LD	E,A
;	LD	HL,BBZSAD
;	ADD	HL,DE
;	LD	A,(HL)
;	LD	HL,ENZSPD
;	ADD	HL,BC
;	ADD	A,(HL)
;	LD	(HL),A
;	LD	HL,BBZSLM
;	ADD	HL,DE
;	CP	(HL)
;	POP	HL
;	JR	NZ,BBO080
;	INC	(HL)
;BBO080
;	CALL	ENZCLC
;;
;	CALL	YMVSUBL
;	XOR	A
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%	ハートの器		   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HARTBCD
	DB	$AA,$10,$AA,$30
HARTBMV
	LD	DE,HARTBCD
	CALL	EN2CST
;
;;	CALL	LDTIM3
	CALL	LDTIM0
	JP	Z,ITEMSUB
;
	DEC	A
	JR	NZ,HARTB10
;
	LD	A,$18
	LD	(SOUND4),A	;(S)
;
;;	CALL	BGMSET
;
;;	LD	A,$0C
;;	LD	(CHTRF2),A	;OBJ 楽器転送！
;
	LD	HL,HARTMX
	INC	(HL)
;
	LD	HL,HARTUP
	LD	(HL),$FF
;
	CALL	SVDSSB
;
	LD	A,(HL)
	OR	%00100000	; Boss fail on !
	LD	(HL),A
	LD	(DJSVBF),A	; Save data buffer set !
;
	LD	A,(DNJNNO)	;横画面のボス部屋！
	LD	HL,DJRMSV+$12E
	CP	$06		;塔
	JR	Z,HBSV10	
	CP	$03		;水
	JR	NZ,HBSV20
;
	LD	HL,DJRMSV+$66
HBSV10
	SET	5,(HL)
HBSV20
;
;
;
;	LD	A,(GRNDPT)
;	CP	$E8  ;1D	; BBIRD room!
;;;;	CP	$FF  ;1D
;	JR	NZ,HTBM10	; Bfish ROOM !
;;
;	LD	A,$20
;	LD	(DJCLTM),A
;HTBM10
	JP	ENCLER
HARTB10
PLJYAN
;	LD	A,(DJFLAG)
;	AND	A
;	JR	NZ,PLJY10
;;
;	LD	A,(GRNDPT)
;	CP	$78
;	JR	Z,JYPS090	;水中？
;;
PLJY10
	LD	A,(PLXPSL)
	LD	HL,ENXPSL
	ADD	HL,BC
	LD	(HL),A
;
	LD	A,(PLYPSL)
	LD	HL,ENYPSL
	ADD	HL,BC
	SUB	$0C
	LD	(HL),A
;
	LD	A,(PLZPSL)
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	(HL),A
;
JYANPS
	LD	A,$6C  ;
	LD	(PLCHPT),A
;
	LD	A,$03
	LD	(PLCMKI),A
;
	XOR	A
	LD	(PCUTFG),A
	LD	(WCUTFG),A
	LD	(SPCTWT),A
	LD	(SPCTTM),A
;
	LD	HL,ENWATR
	ADD	HL,BC
	LD	(HL),A
;
JYPS090
	LD	A,$02
	LD	(PLSTOP),A
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%	ハートのかけら		   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KAKERCD
	DB	$AC,$00,$AC,$20
;- - - - - - - - - - - - - - - - - - -
;KAKINMV
;	CALL	ITCLCK	; In data set see thruu
;;
;	LD	HL,ENMYNO
;	ADD	HL,BC
;	LD	(HL),KAKER
KAKERMV
	LD	A,(DJSVBF)
	AND	%00010000
	JP	NZ,ENCLER
;
	LD	A,(ENSTAT2)
;
	RST	0
	DW	KKM010
;
	DW	KK0600
	DW	KK0800

	DW	KK0900
	DW	KK1000
	DW	KK2000
	DW	KK3000
	DW	KK4000
	DW	KK4100
;===========================================
KK0600
	CALL	PLJYAN
;
	CALL	LDTIM0
	JR	NZ,KK6080
;
	CALL	STATINC
KK6080
	RET
;===========================================
KK0800
	LD	A,HRTC1		; Heart chr tr.
	LD	(BKCHFG),A
;
	CALL	STATINC
;
	RET
;===========================================
KK0900
	LD	A,HRTC2		; Heart chr tr.
	LD	(BKCHFG),A
;
	CALL	STATINC
;
	RET
;===========================================
KK1000
	LD	A,$4F
	CALL	MSGCHK
;
	CALL	STATINC
;
	LD	A,$01
	LD	(MSKYOF),A
;
	RET
;===========================================
KK2000
	CALL	PLJYAN
;
	LD	DE,KAKERCD
	CALL	EN2CST
;
	CALL	KAKERCS
;
	LD	HL,ENCONT
	ADD	HL,BC
	INC	(HL)
	LD	A,(HL)
	CP	$A8
;;	CP	$A0
	JP	Z,STATINC
	CP	$38
	JR	NZ,KK2010
;
	LD	A,(KAKERCT)
	INC	A
	LD	(KAKERCT),A
;	CP	$04
;	JR	NZ,KK2010
;;
;	XOR	A
;	LD	(KAKERCT),A
;;
;	LD	HL,HARTUP
;	LD	(HL),$40
;;
;	LD	HL,HARTMX
;	INC	(HL)
KK2010
	RET
;===========================================
KK3000
	CALL	PLJYAN
	LD	DE,KAKERCD
	CALL	EN2CST
;
	XOR	A
	LD	(MSKYOF),A
;
	CALL	KAKERCS
;
	LD	A,(MSGEFG)
	AND	A
	JR	NZ,KK3020
;
	LD	A,(KAKERCT)
	CP	$04
	JR	NZ,KK3010
;
	LD	A,$19
	LD	(SOUND1),A	;(S)
;
	XOR	A
	LD	(KAKERCT),A
;
	LD	HL,HARTUP
	LD	(HL),$40
;
	LD	HL,HARTMX
	INC	(HL)
;
	LD	A,$50
	CALL	MSGCHK
KK3010
;;	CALL	ENCLER
	CALL	STATINC
KK3020
	RET
;===========================================
KK4000
	CALL	PLJYAN
;
	LD	DE,KAKERCD
	CALL	EN2CST
;
	LD	A,(MSGEFG)
	AND	A
	JR	NZ,KK4080
;
	LD	A,HRTC3
	LD	(BKCHFG),A	; Heart chr revise
;
	CALL	STATINC
KK4080
	RET
;===========================================
KK4100
	LD	A,HRTC4
	LD	(BKCHFG),A	; Heart chr revise
;
	CALL	ENCLER
;
;;	CALL	BGMSET	;(S)
;
;	LD	A,(BGMNO)
;	LD	(SOUND4),A	;(S)
;
	LD	A,$0D
	LD	(CHTRF2),A	
;
	JP    	SVDTST
;;	RET
;===========================================
KAKERCD2
	DB	$9A,$00,$9A,$20
	DB	$9C,$00,$9A,$20
	DB	$9E,$00,$9A,$20
	DB	$9E,$00,$9C,$20
	DB	$9E,$00,$9E,$20
;
KAKERCS
	LD	A,(MSGEFG)
	AND	A
	JR	Z,KKCS90
	AND	%10000000
	LD	A,$23
	JR	Z,KKCS10
	LD	A,$6B
KKCS10
	LD	(ENDSYP),A
;
	LD	A,(KAKERCT)
	LD	(ENCHPT2),A
;
	LD	A,$8B
	LD	(ENSVXL),A
;
	LD	DE,KAKERCD2
	CALL	EN2CST
;
KKCS90
	RET
;
;===========================================
;===========================================
;
;
KKM010
	LD	DE,KAKERCD
	CALL	EN2CST
;
	JP	ITEMSUB
;- - - - - - - - - - - - - - - - - - -
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%	守りのかけら		   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KINOMCD
	DB	$AE,$10
;;	DB	$9E,$10
KINOMMV
	LD	DE,KINOMCD
	CALL	EN1CST
;
	JR	ITEMSBS
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%	力のかけら		   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
POWERCD
	DB	$14,$00,$14,$20
	DB	$14,$10,$14,$30
;- - - - - - - - - - - - - - - - - - -
POWERMV
	LD	DE,POWERCD
	CALL	EN2CST
;
	LD	A,(FRCNT)
	RRA
	RRA
	RRA
	AND	$01
	CALL	ENPTST
;
ITEMSBS
	JP	ITEMSUB
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HMASKCD
	DB	$74,$00,$76,$00
	DB	$76,$20,$74,$20
;- - - - - - - - - - - - - - - - - -
HMASKMV
	LD	DE,HMASKCD
	CALL	EN2CST
;
;;;	JP	ITEMSUB
	CALL	ENSTCK
;
	CALL	BUMECK
	RET	
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PLTATCD
	DB	$86,$10		; ライクライクからの楯
	DB	$84,$10		; 初めに拾う剣
;
PLTATMV
	LD	DE,PLTATCD
;
	LD	A,(KENLEV)
	AND	A
	JR	NZ,PTMV10
;
	LD	A,(DJSVBF)
	AND	%00010000
	JP	NZ,ENCLER
;
	LD	DE,PLTATCD+2
PTMV10
	CALL	EN1CST
;
	LD	A,(ENSTAT2)
	RST	00
	DW	IKN1000
	DW	IKN2000
	DW	IKN3000
	DW	IKN4000
;======================================
IKN1000
	CALL	LDTIM0
	JP	Z,ITEMSUB	;剣持ち上げ？
;				; ハイ
	CP	$10
	JR	NZ,PTMV18
;
	DEC	(HL)
;
	LD	A,$9B
	CALL	MSGCHK
;
	XOR	A
PTMV18
	DEC	A
	JR	NZ,PTMV20
;
	LD	A,$31
	LD	(SOUND4),A	;(S)
	LD	A,$05
	LD	(BGMNO),A
	LD	(TODYFG),A
;
	CALL	LDTIM3
	LD	(HL),$52
;
	CALL	STATINC
;;	JP	ENCLER
PTMV20
	JP	PLJYAN
;======================================
IKN2000
	CALL	PLJYAN
;
	CALL	LDTIM3
	JR	NZ,IKN2020
;
	LD	A,$FF
	CALL	ENPTST
;
	CALL	LDTIM0
	LD	(HL),$20
;
	LD	A,$20
	LD	(SPCTTM),A
;
	LD	A,$03
	LD	(SOUND3),A	;(S)
;
	CALL	STATINC
IKN2020
	RET
;======================================
IKN3000
	CALL	LDTIM0
	JR	NZ,IKN3010
;
	LD	(HL),$20
;
	LD	A,$00
	CALL	ENPTST
;
	CALL	STATINC
IKN3010
	RET
;======================================
IKN4000
	CALL	PLJYAN
;
	LD	A,$6B
	LD	(PLCHPT),A
;
	LD	HL,ENXPSL
	ADD	HL,BC
	LD	A,(PLXPSL)
	SUB	$04
	LD	(HL),A
;
	CALL	LDTIM0
	JR	NZ,IKN4010
;
	LD	(ITEMNOT),A
;
	LD	D,PKEN
	CALL	ITEMGET
;
	LD	A,$01
	LD	(KENLEV),A
;
	CALL	SVDTST
;
	JP	ENCLER
IKN4010
	CP	$1A
	JR	NZ,IKN4030
;
	LD	A,(ENSVYL)
	SUB	$0C
	CALL	EKFLSHS
;
	LD	A,$07
	LD	(SOUND1),A	;(S)
IKN4030
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PFUCKCD
	DB	$8A,$10
;
PFUCKMV
	LD	A,(DJSVBF)
	AND	%00010000
	JP	NZ,ENCLER
;
	LD	DE,PFUCKCD
	CALL	EN1CST
;
	CALL	LDTIM0
	JP	Z,ITEMSUB	;剣持ち上げ？
;				; ハイ
	CP	$10
	JR	NZ,PFMV18
;
	DEC	(HL)
;
	LD	A,$93
	CALL	MSGCHK
;
	XOR	A
PFMV18
	DEC	A
	JR	NZ,PFMV20
;
	LD	D,PFUCK
	CALL	ITEMGET
;
	CALL	SVDTST
;
	JP	ENCLER
PFMV20
	JP	PLJYAN
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KEYSMCD
	DB	$CA,$10
;
	DB	$C0,$10
	DB	$C2,$10
	DB	$C4,$10
	DB	$C6,$10
	DB	$CA,$10
;----------------------------
GKMSDT
	DB	$00,$A3,$A4,$A5,$00
KEYSMMV
;	LD	A,(ENCHPT2)
;	CP	$02
;	JR	NZ,KSMM100	;砂漠？
;
	CALL	ERCHK
	JR	NC,KSMM100	;流さ落ちた？
;
	LD	HL,GRRMSV+$CE
	SET	4,(HL)
	LD	HL,DJRMSV+$F8
	SET	5,(HL)
	RET	
KSMM100
	LD	A,(GRNDPT)
	CP	$80
	JP	Z,PFUCKMV
;
KSMM190
	LD	DE,KEYSMCD
	CALL	EN1CST
;
	CALL	LDTIM0
	JP	Z,GKMV10 	;持ち上げ？
;				; ハイ
	CP	$10
	JR	NZ,GKMV03
;
	DEC	(HL)
;
	LD	A,(ENCHPT2)
	DEC	A
	LD	E,A
	LD	D,B
	LD	HL,GKMSDT
	ADD	HL,DE
	LD	A,(HL)
	CALL	MSGCHK
;
	LD	A,(ENCHPT2)
	DEC	A
	LD	E,A
	LD	D,B
	LD	HL,GRKEY1
	ADD	HL,DE
	LD	(HL),$01
;
;;	CALL	SVDSSB
;;	SET	4,(HL)
	CALL	SVDTST	; Save bit on !
;
	XOR	A
GKMV03
	DEC	A
	JR	NZ,GKMV08
;
	JP	ENCLER
GKMV08
	JP	PLJYAN
;----------------------------
GKMV10
	CALL	ENSTCK
	CALL	BUMECK
;
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,KSMV10
;
	CALL	CRITPL
KSMV10
	JP	ENBDCL
;------------------------------				;YES !
ERCHK
	LD	A,(DJFLAG)
	AND	A
	JR	NZ,ERMM190
;
	LD	A,(GRNDPT)
	CP	$CE
	JR	NZ,ERMM190
;
	LD	A,(ENSVYL)
	SUB	$48
	ADD	A,$03
	CP	$06
	JR	NC,ERMM190
;
	LD	A,(ENSVXL)
	SUB	$50
	ADD	A,$03
	CP	$06
	JR	NC,ERMM190	;流さにはまる！
;
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,ERMM190	;流さにはまる！
;
	LD	HL,ENMODE
	ADD	HL,BC
	LD	A,(HL)
	CP	EMOVE
	JR	NZ,ERMM190	;流さにはまる！
;
	LD	(HL),EFOLE
;
	LD	HL,ENFLXP
	ADD	HL,BC
	LD	(HL),$50
	LD	HL,ENFLYP
	ADD	HL,BC
	LD	(HL),$48
;
	CALL	LDTIM0
	LD	(HL),$2F
;
	LD	A,$18
	LD	(SOUND1),A	;(S)
;
	SCF
	RET
ERMM190
	AND	A
	RET	
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HART1CD
	DB	$A8,$10
HART1MV
	CALL	ITCLCK	; In data set see thruu
;	LD	HL,ENTIM3
;	ADD	HL,BC
;	LD	A,(HL)
;	CP	$1C
;	JR	NC,HTM010
;;
;	AND	A
;	JP	Z,ENCLER
;	AND	$01
;	JR	NZ,HTM020
;HTM010
	CALL	ITTIMCK
;
	LD	DE,HART1CD
	CALL	EN1CST
HTM020
	JP	ITEMSUB
;	CALL	ENSTCK
;;
;	CALL	BUMECK
;	CALL	CRITPL
;;
;	CALL	ENBDCL
;	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KINOKCD
	DB	$5E,$00,$5E,$20
;
KINOKMV
	LD	HL,KINOKFG
	LD	A,(TUBOCT)
;;	AND	A
	OR	(HL)		;キノコ持ってる？
	JP	NZ,ENCLER	;魔法の粉を使い切った？
;				; YES!
	LD	DE,KINOKCD
	CALL	EN2CST
;
	CALL	LDTIM0
	JP	Z,ITEMSUB	;持ち上げ？
;				; ハイ
	CP	$10
	JR	NZ,KNMV18
;
	DEC	(HL)
;
	LD	A,$0F
	CALL	MSGCHK
;
	XOR	A
KNMV18
	DEC	A
	JR	NZ,KNMV20
;
	LD	A,$0A
	LD	(CHTRF2),A	;きのこキャラ転送！
;
	LD	D,PMGIC
	CALL	ITEMGET		; アイテム枠表示！
;
	LD	A,$01
	LD	(KINOKFG),A	;きのこを持っている！
;
	JP	ENCLER
KNMV20
	JP	PLJYAN
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%	楽器			   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GAKKICD
	DB	$70,$00,$72,$00	;LV 1
	DB	$74,$00,$76,$00	;LV 2
	DB	$78,$00,$7A,$00	;LV 3
	DB	$7C,$00,$7E,$00	;LV 4
;;	DB	$70,$00,$72,$00	;LV 5
;;	DB	$74,$00,$76,$00	;LV 6
;;	DB	$78,$00,$7A,$00	;LV 7
;;	DB	$7C,$00,$7E,$00	;LV 8
;
GAKKIMV
	LD	HL,ENWRK0
	ADD	HL,BC
	LD	A,(HL)
	RST	00
	DW	GKMAIN	;MAIN control
	DW	GKONPU	;Onpu
	DW	GKFLSHS	;Flash
;
GKBGCD
;0
	DB	%11100100
	DB	%11100100
	DB	%11100100
	DB	%11100100
;4
	DB	%10010000
	DB	%10010000
	DB	%10010000
	DB	%10010000
;8
	DB	%01000000
	DB	%01000000
	DB	%01000000
	DB	%01000000
;C
	DB	%00000000
	DB	%00000000
	DB	%00000000
	DB	%00000000
;10
	DB	%00000000
	DB	%00000000
	DB	%00000000
	DB	%00000000
;14
	DB	%00000000
	DB	%00000000
	DB	%00000000
	DB	%00000000
;18
	DB	%00000000
	DB	%00000000
	DB	%00000000
	DB	%00000000
	DB	%00000000
GKOBCD
;0
	DB	%00011100
	DB	%00011100
	DB	%00011100
	DB	%00011100
;4
	DB	%00011100
	DB	%00011100
	DB	%00011100
	DB	%00011100
;8
	DB	%00011100
	DB	%00011100
	DB	%00011100
	DB	%00011100
;C
	DB	%00011100
	DB	%00011100
	DB	%00011100
	DB	%00011100
;10
	DB	%00001000
	DB	%00001000
	DB	%00001000
	DB	%00001000
;14
	DB	%00000100
	DB	%00000100
	DB	%00000100
	DB	%00000100
;18
	DB	%00000000
	DB	%00000000
	DB	%00000000
	DB	%00000000
	DB	%00000000
;- - - - - - - - - - - - - -
GKFLSHS
	CALL	GKFLSH
;
	LD	A,$01
	LD	(ITEMNOT),A
;
;;	RET
;
;;	LD	HL,ENTIM3
;;	ADD	HL,BC
;;	LD	A,(HL)
;;	AND	A
	CALL	LDTIM3
	JR	NZ,GKFL008
;
	CALL	ENCLER
;
;	LD	A,(DNJNNO)
;	CP	$00
;	JR	NZ,GKFL002	;ダンジョン１クリアー？
;;				;yes !
;	LD	A,$01
;	LD	(FUKUROF),A	;出口ふくろうセット！
GKFL002
	XOR	A
	LD	(PLCHPT),A
;
	LD	A,(BSINDX)
	LD	E,A
	LD	D,B
	LD	HL,ENSTAT
	ADD	HL,DE
	INC	(HL)
;
	CALL	NXGOTO3
;
;-- ダンジョンクリアー後のイベント進行 ---
	LD	A,(DNJNNO)
	RST	00
	DW	DJ1CLR
	DW	DJ2CLR
	DW	DJ3CLR
	DW	DJ4CLR
	DW	DJ5CLR
	DW	DJ6CLR
	DW	DJ7CLR
	DW	DJ8CLR
;=====================================
DJ1CLR
	LD	A,$80
	LD	(WANFLG),A	;ワンワン連れさられる！
	RET
;=====================================
DJ2CLR
	LD	A,$02
	LD	(PAPA0FG),A	;タリンがバナナを食っている！
	RET
;=====================================
DJ3CLR
	RET
;=====================================
DJ4CLR
	LD	A,$02
	LD	(OBAKEFG),A	;オバケ転送セット！
;;	RET
;=====================================
DJ5CLR
;=====================================
DJ8CLR
	RET
;=====================================
DJ6CLR
	XOR	A
	LD	(MARINOF),A
	RET
;=====================================
DJ7CLR
	XOR	A
	LD	(NIWATFG),A	;ニワトリばいばい！
	RET
;
;=====================================
GKFL008
	CP	$50
;;	CP	$30
	JR	NC,GKFL100
;
	LD	HL,ENWRK1
	ADD	HL,BC
	LD	A,(HL)
	CP	$19
	JR	NC,GKFL100
;
	LD	A,(FRCNT)
	AND	$07
;;	AND	$0F
	JR	NZ,GKFL04C
;
	LD	A,(HL)
	AND	A
	JR	NZ,GKFL03C
;
	LD	A,$2C
	LD	(SOUND3),A	;(S)
	XOR	A
GKFL03C
	INC	(HL)
;
	CP	$18
	JR	NZ,GKFL04C
;
	LD	A,KURI0		;BG書き換え＆メッセージ！
	CALL	ENIDSH	
;
	LD	HL,ENWRK0
	ADD	HL,DE
	LD	(HL),$01
;
	LD	HL,ENTIM0
	ADD	HL,DE
	LD	(HL),$60
GKFL04C
	LD	A,(FRCNT)
	AND	$03
	LD	HL,ENWRK1
	ADD	HL,BC
	ADD	A,(HL)
	LD	E,A
	LD	D,B
	LD	HL,GKBGCD
	ADD	HL,DE
	LD	A,(HL)
	LD	(BGPFG),A
	LD	HL,GKOBCD
	ADD	HL,DE
	LD	A,(HL)
	LD	(OBP0FG),A
	XOR	A
	LD	(OBP1FG),A
;
;	POP	AF
;	CP	$04
;	JR	NZ,GKFL100
;;
;	LD	A,KURI0		;BG書き換え＆メッセージ！
;	CALL	ENIDSH	
;;
;	LD	HL,ENWRK0
;	ADD	HL,BC
;	LD	(HL),$01
GKFL100
	RET
;GKFL120
;	LD	A,$50
;	CALL	MSGCH2
;	RET
;
;===================================
;=================================
GKONPUCD
	DB	$6C,$00,$FF,$FF
	DB	$6C,$00,$6E,$00
;
GKONPU
	LD	DE,GKONPUCD
	CALL	EN2CST
;
	CALL	ENMVCL
;
	CALL	LDTIM0
	JP	Z,ENCLER
	RET
;==================================
GKMAIN
	LD	A,C
	LD	(BSINDX),A
;
	LD	A,(DJSVBF)
	AND	%00010000
	JP	NZ,ENCLER	; Already have ?
;				; Yes !
	LD	A,(DNJNNO)
	AND	$03
	LD	(ENCHPT2),A
;
	CALL	SHRVSE	;シャッター無理矢理補正！
;
	LD	DE,GAKKICD
	CALL	EN2CST
;
	LD	A,(ENSTAT2)
	RST	00
	DW	GK1000
	DW	GK2000
	DW	GK3000
	DW	GK4000
	DW	GK5000
;;	CP	$01
;;	JR	Z,GK2000
;;	CP	$02
;;	JR	Z,GK3000
;
GK1000
	CALL	LDTIM0
	JP	Z,ITEMSUB	;持ち上げ？
;				; ハイ
	CP	$10
	JR	NZ,GKMV18
;
	DEC	(HL)
;
;;	LD	A,$30
;;	LD	(DJCLTM),A	;自動クリアー！
;;;
;;	CALL	ENCLER
;
;;	LD	A,$FF
;;	CALL	ENPTST
;
;;	CALL	LDTIM0
;;	LD	(HL),$50
;
	CALL	STATINC
;
	LD	A,(DNJNNO)
	ADD	A,$00
	CALL	MSGCH2
;
	LD	A,(DNJNNO)
	LD	E,A
	LD	D,B
	LD	HL,WARPSV
	ADD	HL,DE
	LD	A,(HL)
	OR	%00000010
	LD	(HL),A
;
	CALL	SVDSSB
;
	LD	A,(HL)
	OR	%00010000	; Boss fail on !
	LD	(HL),A
;;;	LD	(DJSVBF),A	; Save data buffer set !
;
	XOR	A
GKMV18
	DEC	A
	JR	NZ,GKMV20
;
;;	JP	ENCLER
GKMV20
	JP	PLJYAN
;------------------------------------------
GKBGMD
;;;	    LEVEL 1   2   3   4   5   6   7   8
	DB	$20,$28,$29,$2A,$2B,$2C,$2D,$2E
GK2000
;;	CALL	LDTIM0
;;	JR	NZ,GK2010
	LD	A,($D369)
	AND	A
	JR	NZ,GK2010	; BGM end ?
;				; yes !
;;	CALL	ENSTCK
	LD	A,(MSGEFG)
	AND	A
	JR	NZ,GK2010
;
	LD	A,(DNJNNO)
	LD	E,A
	LD	D,B
	LD	HL,GKBGMD
	ADD	HL,DE
	LD	A,(HL)
;;	LD	A,$20
	LD	(SOUND4),A	;(S)
;
;;	LD	A,$80
;;	LD	(DJCLTM),A	;自動クリアー！
;
;;	CALL	ENCLER
;
	CALL	STATINC
;
	CALL	LDTIM0
	LD	(HL),$FF
GK2010
	JP	PLJYAN
;------------------------------------------
ONPUXD
	DB	$0A,$FA
ONPUXS
	DB	$04,$FC
;- - - - - - - - - - - - - -
GK3000
	CALL	LDTIM0
	JR	NZ,GK3010
;
	LD	A,$2B
	LD	(SOUND1),A	;(S)
;
	LD	A,GAKKI
	CALL	ENIDSH
;
	LD	A,(WORK0)
	DEC	A
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	A,(WORK1)
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENWRK0
	ADD	HL,DE
	LD	(HL),$02
;
	LD	HL,ENTIM3
	ADD	HL,DE
	LD	(HL),$80 ;$40
	JP  	STATINC
GK3010	
	LD	HL,ENWRK2
	ADD	HL,BC
	DEC	(HL)
	LD	A,(HL)
	CP	$FF
	JR	NZ,GK3020
;
	LD	(HL),$17
;
	LD	HL,ENWRK3
	ADD	HL,BC
	INC	(HL)
	LD	A,(HL)
	AND	$01
	LD	(ENHELP),A
;
	LD	A,GAKKI
	CALL	ENIDSH
;
	PUSH	BC
;
	LD	HL,ENWRK0
	ADD	HL,DE
	INC	(HL)
;
	LD	A,(ENHELP)
	LD	C,A
;
	LD	HL,ONPUXD
	ADD	HL,BC
	LD	A,(WORK0)
	ADD	A,(HL)
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ONPUXS
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENXSPD
	ADD	HL,DE
	LD	(HL),A
;
	LD	A,(WORK1)
	LD	HL,ENYPSL
	ADD	HL,DE
	ADD	A,$F8
	LD	(HL),A
;
	LD	HL,ENYSPD
	ADD	HL,DE
	LD	(HL),$FD
;
	LD	HL,ENTIM0
	ADD	HL,DE
	LD	(HL),$38
;
	CALL	RNDSUB
	AND	$01
	LD	HL,ENCHPT
	ADD	HL,DE
	LD	(HL),A
;
	POP	BC
GK3020
	JP	PLJYAN
;------------------------------------------
GK4000
	JP	PLJYAN
;------------------------------------------
GK5000
	RET
;;;	JP	PLJYAN
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BOMB1CD
	DB	$80,$10
BOMB1MV
	CALL	ITCLCK	; In data set see thruu
	CALL	ITTIMCK
;
	LD	DE,BOMB1CD
	CALL	EN1CST
;
	JP	ITEMSUB
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KAIINCD
	DB	$9E,$10
;;	DB	$AE,$10
;
KAIINMV
	LD	A,(KENLEV)
	CP	$02
	JP	NC,ENCLER	;剣レベル２取った後？
;				;NO!
	LD	A,(DJSVBF)
	AND	%00010000
	JP	NZ,ENCLER
;
	LD	A,(GRNDPT)
	CP	$E3
	JR	NZ,KIIM100	;お化けの家？
;				;YES !
	LD	A,(DJSVBF)
	AND	%01000000
	JP	Z,ENCLER    	;おばけが教えた後？
;			  	;YES !
KIIM100
	CALL	ITCLCK	; In data set see thruu
;;;	CALL	ITTIMCK
;
	LD	DE,KAIINCD
	CALL	EN1CST
;
	JP	ITEMSUB
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KAKINCD
	DB	$CA,$10
;
KAKINMV
	LD	A,(DJSVBF)
	AND	%00010000
	JP	NZ,ENCLER
;
	CALL	ITCLCK	; In data set see thruu
;;;	CALL	ITTIMCK
;
	LD	DE,KAKINCD
	CALL	EN1CST
;
	CALL	LDTIM0
	JP	Z,ITEMSUB	;剣持ち上げ？
;				; ハイ
	CP	$10
	JR	NZ,KKIMV18
;
	DEC	(HL)
;
	LD	A,(DJFLAG)
	AND	A
	JR	NZ,KKGT10
;
	LD	A,(GRNDPT)
	CP	$C6
	JR	NZ,KKGT10	;鍵 ５ ステージ？
;				;yes !
	LD	A,$06-1
	LD	(GRKEY5),A	;鍵 5 拾う！
KKGT10
	LD	HL,GRKEY5 ;KEYECT	;
	CALL	IUPSUB
;
	CALL	SVDTST
;
	LD	HL,DJSVBF
	RES	4,(HL)	;表示だけはしておく！
;
;;	LD	A,(GRNDPT)
;;	CP	$C6	;はっぱ
	LD	E,$A2
	LD	A,(GRKEY5)
	CP	$06
	JR	Z,KKIMV12
	LD	E,$E8
	CP	$05
	JR	NZ,KKIMV12
	INC	E	;さいごの１枚
KKIMV12
	LD	A,E
	CALL	MSGCHK
;
	XOR	A
KKIMV18
	DEC	A
	JR	NZ,KKIMV20
;
	JP	ENCLER
KKIMV20
	JP	PLJYAN
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MGPOWCD
	DB	$8E,$10
;
MGPOWMV
	LD	A,(KINOKFG)
	AND	A
	JP	NZ,ENCLER
;
	CALL	ITCLCK	; In data set see thruu
	CALL	ITTIMCK
;
	LD	DE,MGPOWCD
	CALL	EN1CST
;
	JP	ITEMSUB
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ALOW1CD
	DB	$2A,$40
	DB	$2A,$60
;
ALOW1MV
	CALL	ITCLCK	; In data set see thruu
	CALL	ITTIMCK
;
	LD	DE,ALOW1CD
	CALL	EN2CST
;
	JP	ITEMSUB
;======================================
ITTIMCK
;;	LD	HL,ENTIM3
;;	ADD	HL,BC
;;	LD	A,(HL)
	CALL	LDTIM3
	CP	$1C
	JR	NC,HTM010
;
	AND	A
	JP	Z,ENCLER
	AND	$01
	DEC	A
	CALL	ENPTST
HTM010
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RUPY1CD
	DB	$A6,$10
;
RUPY1MV
	CALL	ITCLCK	; In data set see thruu
;
;	LD	HL,ENTIM3
;	ADD	HL,BC
;	LD	A,(HL)
;	CP	$1C
;	JR	NC,R1M010
;;
;	AND	A
;	JP	Z,ENCLER
;	AND	$01
;	JR	NZ,R1M020
;R1M010
	CALL	ITTIMCK
;
	LD	DE,RUPY1CD
	CALL	EN1CST
ITEMSUB
R1M020
	CALL	ENSTCK
;
	CALL	BUMECK
	CALL	CRITPL
;
;------------------------------------------
ENBDCL
	CALL	ENMVCL
	CALL	ENGCLC
;
	CALL	ENBGCK
;
	LD	A,(YKFLAG)
	AND	A
	JR	Z,EBD010
;
;;;;	CALL	ENBGCK
;
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	AND	%00001000
	JP	Z,RP1M10
;
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(HL)
	AND	$F0
	ADD	A,$5
	LD	(HL),A
;
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	A,(HL)
	CPL
	SRA	A
	CP	$F8
	JR	C,RP1M08
	JR	EBD012
;
EBD010
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	A,(HL)
	AND	$80
	JR	Z,RP1M10
;
	XOR	A
	LD	(HL),A
;
	LD	HL,ENWATR
	ADD	HL,BC
	LD	A,(HL)
;
	LD	HL,ENZSPD
;;EBD011
	ADD	HL,BC
	CP	$02
	JR	Z,EBD012	; Asase in -> Not bounds !
	LD	A,(HL)
	SRA	A
	CPL
	CP	$07
	JR	NC,RP1M08
;
EBD012
	XOR	A
;
	PUSH	HL
;
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),A
;
	POP	HL
	JR	RP1M081
RP1M08
	PUSH	AF
	PUSH	HL
;
	LD	A,(ENMYNO2)
	CP	KEYSM
	JR	NZ,KYBD10
;
	LD	A,$17
	LD	(SOUND3),A	;(S)
	JR	RP1M080	
KYBD10
	CP	BOMBR
	JR	NZ,RP1M080
;
	LD	HL,ENMODE
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,RP1M080
	CP	EFOLE
	JR	Z,RP1M080
;
	LD	A,$09
	LD	(SOUND1),A	;(S)バウンド音！
RP1M080
	POP	HL
	POP	AF
RP1M081
	LD	(HL),A
;
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	A,(HL)
	SRA	A
	CP	$FF
	JR	NZ,RP1M09
	XOR	A
RP1M09
	LD	(HL),A
;
	LD	A,(YKFLAG)
	AND	A
	JR	NZ,RP1M10
;
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	A,(HL)
	SRA	A
	CP	$FF
	JR	NZ,RP1M0B
	XOR	A
RP1M0B
	LD	(HL),A
;
RP1M10
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				   %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
YOSEICD
	DB	$20,$20
	DB	$20,$00
;;	DB	$22,$00
;----------------------------
YOSEIMV
	CALL	ITCLCK	; In data set see thruu
;
;	LD	HL,ENTIM3
;	ADD	HL,BC
;	LD	A,(HL)
;	CP	$1C
;	JR	NC,YOM010
;;
;	AND	A
;	JP	Z,ENCLER
;	AND	$01
;	JR	NZ,YOM020
;YOM010
	CALL	ITTIMCK
;
;;	CALL	ENMKST
;
	LD	DE,YOSEICD
	CALL	EN1CST
YOM020
	CALL	ENSTCK
;
	CALL	BUMECK
	CALL	CRITPL
;
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	A,(HL)
	RLCA
	AND	$01
	CALL	ENPTST
;
	CALL	ENMVCL
	CALL	YOZCLC
	CALL	ENBGCK
;---------------------------
	CALL	EPXCHK
	LD	A,D
	BIT	7,A
	JR	Z,YI010
;	CPL
;	INC	A
YI010
	CP	$20
	JR	C,YMAIN
;
	CALL	EPYCHK
	LD	A,D
	BIT 	7,A
	JR	Z,YI020
;	CPL
;	INC	A
YI020
	CP	$20
	JR	NC,YEXIT
;---------------------------------------
YMAIN
;;	LD	HL,ENTIM0
;;	ADD	HL,BC
;;	LD	A,(HL)
	CALL	LDTIM0
;;	AND	A
	JR	NZ,YFIN
;
;;	LD	A,$30
	LD	(HL),$30 ;A
;
	CALL	RNDSUB
	AND	$0F
	SUB	$08
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
;
	CALL	RNDSUB
	AND	$0F
	SUB	$08
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),A
	JR	YFIN
;----Nigeru----------------------
YEXIT
	LD	A,$09
	CALL	PSERCH ;2
;	LD	A,(WORK0)
;	LD	HL,ENYSPD
;	ADD	HL,BC
;	LD	(HL),A
;	LD	A,(WORK1)
;	LD	HL,ENXSPD
;	ADD	HL,BC
;	LD	(HL),A
YFIN
;;	LD	HL,ENTIM0
;;	ADD	HL,BC
;;	LD	A,(HL)
;	CALL	LDTIM0
;	AND	$01
;	JR	Z,YGUSU
;	XOR	A
;	JR	YFIN2
;YGUSU
;	XOR	A
;;	LD	A,$1
;YFIN2	
;	LD	HL,ENCHPT
;	ADD	HL,BC
;	LD	(HL),A
;============================================
	RET
;============================================
YOZCLC
	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&&&&&&&&&&&&&&&&&&&&&&
BUMECK
	LD	HL,ENWRK4 ;STAT
	ADD	HL,BC
	LD	A,(HL)
;;	LD	A,(ENSTAT2) ;HL)
	AND	A
	JR	Z,RP1M06	; Bumeran hit ?
;				; yes ! 
	POP	DE	; Not return
;
	DEC	A
	LD	E,A
	LD	D,B ;$00
;
	LD	HL,ENMODE
	ADD	HL,DE
	LD	A,(HL)
	AND	A
	JR	Z,ITEMGT ;RP1GET
;
	LD	HL,ENMYNO
	ADD	HL,DE
	LD	A,(HL)
	CP	BUMER
	JR	Z,BUCK10
	CP	FUCKS
	JR	NZ,ITEMGT
;
BUCK10
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENXPSL
	ADD	HL,BC
	LD	(HL),A
;
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	(HL),A
;
	XOR	A
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	(HL),A
;
RP1M06
	RET
;======================================
CRITPL
;;	LD	HL,ENTIM1
;;	ADD	HL,BC
;;	LD	A,(HL)
;;	AND	A
	CALL	LDTIM1
	JR	NZ,RP1M06
;
	LD	A,(ENMYNO2)
	SUB	HART1
	LD	E,A
	LD	D,B
	LD	HL,ITKNHIT
	ADD	HL,DE
	LD	A,(HL)
	AND	A
	JR	Z,CIP1000	;Item ken hit check ?
;				;Yes !
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	A,(HL)
	PUSH	AF
	PUSH	HL
	LD	(HL),B
	CALL	CRKNEN
	POP	HL
	POP	AF
	LD	(HL),A
;
CIP1000
	CALL	CRENPL
	JR	NC,RP1M06
;-------------------------------------------
ITEMGT		; Item get sub 
;;	CALL	ENCLER
	LD	HL,ENJYUN
	ADD	HL,BC
	LD	A,(HL)
;
	CALL	ENDTON		;Bit on !
;
	LD	A,(ENMYNO2)
	SUB	HART1
;
	CP	$02
	JR	NC,ITGT00
;
	LD	HL,SOUND1	;(S)
	LD	(HL),$14
	JR	ITGT01
ITGT00
	LD	HL,SOUND2	;(S)
	LD	(HL),$01
ITGT01
	RST	00
	DW	HART1GT
	DW	COIN1GT
	DW	YOSEIGT
	DW	KEYSMGT
	DW	PLTATGT
	DW	HMASKGT
	DW	POWERGT
	DW	KINOMGT
	DW	KAKERGT
	DW	HARTBGT
	DW	ALOW1GT
	DW	BOMB1GT
	DW	GAKKIGT
	DW	KINOKGT
	DW	MGPOWGT
	DW	KAKINGT 	;KAKIN->KAKERGT!!
	DW	KAIINGT
;===========================
MGPOWGT
	LD	A,$0B
	LD	(CHTRF2),A
;
	LD	D,PMGIC
	CALL	ITEMGET
;
	LD	HL,PWMAX
	LD	DE,TUBOCT
;=======================================
MAXSUB
	LD	A,(DE)
	CP	(HL)
	JR	NC,MAXS10
	ADD	A,$01
	DAA
	LD	(DE),A
MAXS10
	RET
;
;
;
;
;;	LD	HL,TUBOCT
;;	JP	IUPSUB
;===========================
;KAKINGT	;はっぱ
;	CALL	JYANGET
;;
;;;	CALL	SVDTST	; BIT ON !
;;
;	LD	A,(DJFLAG)
;	AND	A
;	JR	NZ,KKGT10
;;
;	LD	A,(GRNDPT)
;	CP	$C6
;	JR	NZ,KKGT10	;鍵 ５ ステージ？
;;				;yes !
;	LD	A,$06-1
;	LD	(GRKEY5),A	;鍵 5 拾う！
;KKGT10
;	LD	HL,GRKEY5 ;KEYECT	;
;	JP	IUPSUB
;===========================
KAIINGT	;貝殻
	LD	A,$EF
	CALL	MSGCHK
KAIINC
	CALL	SVDTST	; BIT ON !
;
;;	LD	D,PROD
;;	CALL	ITEMGET
;
	LD	HL,CLC20	;かいがら
;-----------------------------
IUPSUB
	LD	A,(HL)
	CP	$99
	JR	Z,IUP010
	ADD	A,$01
	DAA
	LD	(HL),A
IUP010
	RET
;===========================
;===========================
;===========================
;GRKEYGT
;	LD	A,(ENCHPT2)
;	LD	E,A
;	LD	D,B
;	LD	HL,GRKEY1
;	ADD	HL,DE
;;;	LD	(HL),$01
;	INC	(HL)
;	RET
;===========================
ALOW1GT
	LD	HL,YAMAX
	LD	DE,YAAACT
	JR	MAXSUB
;
;;	LD	D,PYAST
;;	CALL	ITEMGET
;
;	LD	HL,YAAACT
;;;	INC	(HL)
;	JR	IUPSUB
;===========================
BOMB1GT
	LD	D,PBOMB
	CALL	ITEMGET
;
	LD	HL,BOMAX
	LD	DE,BOMBCT
	JR	MAXSUB
;
;	LD	HL,BOMBCT
;	CALL	IUPSUB
;
;	RET
;===========================
;===========================
GAKKIGT
	XOR	A
	LD	(BSFLFG2),A
	LD	(FADEON),A
;
	LD	A,$1B
	LD	(SOUND4),A	;(S)
	LD	(ITEMNOT),A
;
GKFLSHST
	LD	A,(PLXPSL)
	PUSH	AF
	ADD	A,$04
	LD	(PLXPSL),A
	CALL	DEMOFLST
	POP	AF
	LD	(PLXPSL),A
	JR	JG0010
HARTBGT
	XOR	A
	LD	(POWRFG),A
;
	LD	A,$25
	LD	(SOUND4),A	;(S)
	LD	(BSFLFG2),A
;;	LD	(MSSDWT),A
;;	LD	A,$18
;;	LD	(SOUND4),A	;(S)
;;	CALL	LDTIM3
	CALL	LDTIM0
;
	LD	A,$70
;;	LD	A,$9A
;;	LD	A,$9B+1
	LD	(HL),A
	LD	(ENSTTM),A
	JR	GTNEXT
KINOKGT	;キノコ
KAKINGT	;はっぱ
	LD	A,$10
	LD	(SOUND4),A	;(S)
	JR	JG0010
;- - - - -
JYANGET
	LD	A,$01
	LD	(SOUND1),A	;(S)
;
JG0010
	CALL	LDTIM0
;
	LD	A,$68
	LD	(HL),A
	LD	(ENSTTM),A
GTNEXT
	LD	HL,ENMODE
	ADD	HL,BC
	LD	(HL),EMOVE
;
;	LD	HL,ENWATR
;	ADD	HL,BC
;	LD	(HL),B
	JP	DUSHCL
;===========================
KAKERGT
	LD	A,$10
;;	LD	A,$25
;;	LD	($D368),A	;(S)
	LD	(SOUND4),A	;(S)
;;	LD	(MSSDWT),A
;
	CALL	STATINC
	JR	GTNEXT
;===========================
KPWFSXD
	DB	$E4,$14,$E4,$14
KPWFSYD
	DB	$D4,$D4,$04,$04
;- - - - - - - - - - - - - - -
KINOMGT
	LD	A,$02	;デフェンスアップ
	LD	E,$05
	JR	PWGT10
;- - - - - - - - - - - - - - -
POWERGT
	LD	A,$01	;剣パワーアップ
	LD	E,$01
PWGT10
	LD	(POWRFG),A
;;	LD	A,$01
	LD	A,E
	LD	(DEMOFG),A
	LD	A,$30
	LD	(DEMOTM),A
	LD	(ENSTTM),A
	XOR	A
	LD	(POWRCT),A
;
	LD	A,$27		;早く持ってきやがれ！
	LD	(SOUND4),A	;(S)
	LD	A,$49
	LD	(BGMNO2),A	;(S)
	LD	(TODYFG),A	;(S)
;-------------------------------------
DEMOFLST
	LD	E,$3
	LD	D,$00
PT0090
	PUSH	DE
;
	LD	HL,KPWFSXD
	ADD	HL,DE
	LD	A,(PLXPSL)
	ADD	A,(HL)
	LD	(WORK0),A
;
	LD	HL,KPWFSYD
	ADD	HL,DE
	LD	A,(PLYPSL)
	ADD	A,(HL)
	LD	(WORK1),A
;
	LD	A,KPWF
	CALL	EXIDSH
;
	LD	HL,EXTIM0
	ADD	HL,DE
	LD	(HL),$18+$A
;
	LD	HL,EXSTAT
	ADD	HL,DE
	POP	DE
	LD	(HL),E
;
	DEC	E
	LD	A,E
	CP	$FF
	JR	NZ,PT0090
;
HMASKGT
	RET
;===========================
PLTATGT
	LD	A,(KENLEV)
	AND	A
	JR	NZ,PTG0120	; 剣まだ持ってない？
;				； はい
;;	LD	A,$01
;;	LD	(SOUND1),A	;(S)
	LD	A,$0F
	LD	(SOUND4),A	;(S)
	LD	(ITEMNOT),A
;;	LD	(MSSDWT),A
	CALL  	GKFLSHST
	CALL	LDTIM0
	LD	(HL),$A0
;
;;;	XOR	A
	LD	A,$FF
	LD	(TODYFG),A	;(S)BGM復帰無し！
	RET
;;	JP	JYANGET
;	LD	D,PKEN
;	CALL	ITEMGET		; 浜べで拾う！
;;
;	LD	A,$01
;	LD	(KENLEV),A
;;
;	JP	SVDTST	; Bit on !
;
PTG0120
	LD	HL,ENWRK0	; ライクライクから返却！
	ADD	HL,BC
	LD	A,(HL)
	LD	(TATLEV),A
;
	LD	D,PTATE
;=====================================
ITEMGET
	LD	HL,ITEMB
	LD	E,$0C
PTG0E0
	LD	A,(HLI)
	CP	D
	JR	Z,PTG030	; Allready have ?
	DEC	E		
	JR	NZ,PTG0E0
;				; no
	LD	HL,ITEMB
;;	LD	E,$00
PTG010
	LD	A,(HL)
	AND	A
	JR	NZ,PTG020
;
	LD	(HL),D  ;$4
	RET
PTG020
	INC	HL
	INC	E
	LD	A,E
	CP	$0C
	JR	NZ,PTG010
PTG030
	RET
;===========================
;- - - - - - - - - - - - - - - - - - -
KEYSMGT
;;	LD	A,(DJFLAG)
;;	AND	A
;;	JP	Z,JYANGET	;猿の棒！
;
	LD	A,(GRNDPT)
	CP	$80
	JR	NZ,KSGT90	;ガイコツボス フックショット！
;
	LD	A,$10
	LD	(SOUND4),A	;(S)
	JP	JG0010
KSGT90
;;	CALL	SVDTST	; Save bit on !
;
	LD	A,(GRNDPT)
	CP	$7C
	JR	NZ,KSG008
;
	LD	HL,DJRMSV+$69
	SET	4,(HL)
KSG008
	LD	A,(ENCHPT2)
	AND	A
	JR	Z,KSG010
;
;	DEC	A
;	LD	E,A
;	LD	D,B
;	LD	HL,GRKEY1
;	ADD	HL,DE
;	LD	(HL),$01
;;
;	LD	HL,GKMSDT
;	ADD	HL,DE
;	LD	A,(HL)
;	CALL	MSGCHK
;;
;	CALL	SVDSSB
;	SET	4,(HL)
;
	LD	A,$10
	LD	(SOUND4),A	;(S)
	JP	JG0010
;
KSG010
	CALL	SVDTST	; Save bit on !
;
	LD	HL,SKEYF
	INC	(HL)	;Display count inc !
;
	CALL	DJITRV	;Display buffer->Main buffer
;
	RET
;===========================
HART1GT
	LD	A,$8
HTUPSUB
	LD	HL,HARTUP
ADDHL
	ADD	A,(HL)  ;$8
	LD	(HL),A
	RET
;===========================
COIN1GT
	LD	A,$1
	LD	HL,COINU2
	JR	ADDHL
;===========================
YOSEIGT
	LD	A,48
	JR	HTUPSUB
;###############################################
;#					       #
;###############################################
ENIDSH
	LD	E,<ENNO-1
ENIDSH2
	PUSH	AF
;
	LD	D,$00
EISH10
	LD	HL,ENMODE
	ADD	HL,DE
	LD	A,(HL)
	AND	A
	JR	Z,EISH20
	DEC	E
	LD	A,E
	CP	$FF
	JR	NZ,EISH10
;
	POP	AF
	SCF	; SEC
	RET
;
EISH20
;;;	LD	A,EMOVE
	LD	(HL),EMOVE ;A
	POP	AF
;
	LD	HL,ENMYNO
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENXPSL
	ADD	HL,BC
	LD	A,(HL)
	LD	(WORK0),A
;
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(HL)
	LD	(WORK1),A
;
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	A,(HL)
	LD	(WORK2),A
;
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	A,(HL)
	LD	(WORK3),A
;
	CALL	ENMDST2
;
	LD	HL,ENHNFG
	ADD	HL,DE
	LD	(HL),$01	; Fole check !
;
	LD	HL,ENXPSH
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENXPSH
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENYPSH
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENYPSH
	ADD	HL,DE
	LD	(HL),A
;
	SCF
	CCF	; CLC
	RET
;
;======================================
ENMDST2
	PUSH	BC
	PUSH	DE
	PUSH	DE
	POP	BC
	CALL	ENMDST
	POP	DE
	POP	BC
	RET
;==============================================
;###############################################
;#	PLAYER BOMBER			       #
;###############################################
BOMBRCD
	DB	$80,$10
;;	DB	$18,$00
BOMBKCD
;- -0 - -
	DB	$F8,$F8,$32,$00
	DB	$F8,$00,$32,$20
;
	DB	$F8,$08,$32,$00
	DB	$F8,$10,$32,$20
;
	DB	$08,$F8,$32,$00
	DB	$08,$00,$32,$20
;
	DB	$08,$08,$32,$00
	DB	$08,$10,$32,$20
;- -1 - -
	DB	$F8,$F8,$10,$00
	DB	$F8,$00,$12,$00
;
	DB	$F8,$08,$12,$20
	DB	$F8,$10,$10,$20
;
	DB	$08,$F8,$10,$40
	DB	$08,$00,$12,$40
;
	DB	$08,$08,$12,$60
	DB	$08,$10,$10,$60
;- -2 - -
	DB	$FC,$FC,$30,$10
	DB	$FC,$04,$30,$30
;
	DB	$FC,$04,$30,$10
	DB	$FC,$0C,$30,$30
;
	DB	$04,$FC,$30,$10
	DB	$04,$04,$30,$30
;
	DB	$04,$04,$30,$10
	DB	$04,$0C,$30,$30
;- -3 - -
	DB	$FC,$FC,$30,$00
	DB	$FC,$04,$30,$20
;
	DB	$FC,$04,$30,$00
	DB	$FC,$0C,$30,$20
;
	DB	$04,$FC,$30,$00
	DB	$04,$04,$30,$20
;
	DB	$04,$04,$30,$00
	DB	$04,$0C,$30,$20
;------------------------------------------
BOMBKCS
	LD	HL,ENCHPT
	ADD	HL,BC
	LD	A,(HL)  ;ENCHPT2) ;HL)
	SLA	A
	SLA	A
	SLA	A
	SLA	A
	SLA	A
	LD	E,A
	LD	D,B ;$0
	LD	HL,BOMBKCD
	ADD	HL,DE
	LD	C,$8
;
	CALL	ENOMST
	RET
;
;=======================================
BBRCMD
	DB	0,0,0,0
	DB	0,0,0,0
	DB	1,1,1,1
	DB	1,1,1,1
	DB	2,2,2,2
	DB	3,3,3,3
;
BOMBRBK
	CALL	BBRCS
;
	CALL	ENSTCK
;
	CALL	LDTIM0
	AND	A
	JP	NZ,BBRK10
;
	JP	ENCLER
BBRK10
	LD	E,A
	LD	HL,ENWRK3
	ADD	HL,BC
	LD	A,(HL)
	CP	$4C
	LD	A,E
	JP	Z,BBRK20
;
	CP	$0E
	JR	C,BBRK11
;
	CP	$17
	JR	NC,BBRK11
;
	PUSH	AF
	SUB	$0E
	LD	E,A
	LD	D,B
;
	PUSH	DE
	CALL	BOBGCK2	; KUSA BREAK CHECK 
	POP	DE
	CALL	BOBGCK	; Kabe !!
	POP	AF
BBRK11
	CP	$12
	JR	NZ,BBRK20
;
	LD	HL,ENWRK3
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,BBRK111
;
	CALL	CRBOEN
	JR	BBRK12
;
BBRK111
;;	CP	$4C
;;	JR	Z,BBRK12
;
	LD	A,(ENSVXL)
	LD	HL,PLXPSL
	SUB	(HL)
	ADD	A,$18
	CP	$30
	JR	NC,BBRK12
;
	LD	A,(ENSVYL)
	LD	HL,PLYPSL
	SUB	(HL)
	ADD	A,$18
	CP	$30
	JR	NC,BBRK12
;
	CALL	PLDMST2
;
	LD	HL,PLXSPD
	SLA	(HL)
	LD	HL,PLYSPD
	SLA	(HL)
BBRK12
	LD	A,$4
	LD	(OTOFLG),A	; Oto flag !
;
;;	LD	A,$12
BBRK20
	RET
;============================================
BBRCS
	CALL	LDTIM0
	LD	E,A
	LD	D,B ;$0
	LD	HL,BBRCMD
	ADD	HL,DE
	LD	A,(HL)
	CALL	ENPTST
;
	LD	HL,ENMOD0
	ADD	HL,BC
	LD	A,(HL)
	AND	%11110000
	OR	%00001000
	LD	(HL),A
;
	CALL	BOMBKCS
;
	LD	A,(DJFLAG)
	AND	A
	JR	Z,BRK100
;
	LD	E,$E4
;
	LD	A,(SCRLFG)
	AND	A
	JR	NZ,BRK088
;
	CALL	LDTIM0
	AND	%00000100
	JR	Z,BRK088
;
	LD	E,$84
BRK088
	LD	HL,BGPFG
	LD	(HL),E
;
BRK100
;;	CALL	ENSTCK
	RET
;==============================================
BOMBRB1
	LD	DE,KEMRICD
	CALL	EN2CST
	CALL	ENSTCK
	RET
;==============================================
BOMBRMV
	LD	A,(ENDSYP)
	ADD	A,$10
	CP	$90+$10
	JP	NC,ENCLER
;
;	LD	A,(BOMBFG)
;	INC	A
;	LD	(BOMBFG),A
;
;;	LD	HL,ENTIM0
;;	ADD	HL,BC
;;	LD	A,(HL)
	CALL	LDTIM0
	CP	$18
	JP	C,BOMBRBK
	JR	NZ,BBBB0
;
	DEC	(HL)
;;	LD	HL,SOUND3
;;	LD	(HL),$0C	;(S)
	CALL	BBSDST	;(S)
BBBB0
	LD	HL,BOMBFG
	INC	(HL)		; Bomb use count inc !
;
	CP	$22
	JR	C,BOMBRB1
;
	CP	$48
	JR	NZ,BBRM08
;
	LD	HL,ENFLSH
	ADD	HL,BC
;;	LD	A,$30
	LD	(HL),$30 ;A
BBRM08
;;	LD	DE,BOMBRCD
;;	CALL	EN1CST
	CALL	BOMBRCS
;
	CALL	ERCHK	;りゅうさ？
;
	CALL	ENSTCK
;
;;	CALL	ENMVCL
;;	CALL	ENBGCK
;
	CALL	ENBDCL
;
	LD	HL,ENTIM2
	ADD	HL,BC
	LD	(HL),$FF
;- - Cach check - -
	CALL	LDTIM1
;
	LD	HL,ENWRK3
	ADD	HL,BC
;;;	LD	A,(HL)
;;;;
;;;	LD	HL,ENTIM1
;;;	ADD	HL,BC
;;	LD	A,(HL)
;;	AND	A
	OR	(HL)
	JR	NZ,BSTP10
;
	LD	A,(ITEMB)
	CP	PBOMB
	JR	NZ,BST900	; Bulesret check !
;
	LD	A,(KEYA2)
	AND	%00100000
	JR	NZ,BST910
	JR	BSTP10
BST900
	LD	A,(ITEMA)
	CP	PBOMB
	JR	NZ,BSTP10
;
	LD	A,(KEYA2)
	AND	%00010000
	JR	Z,BSTP10
;
BST910
	CALL	CACHCK
BSTP10
TURCHK
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	AND	%00000011
	JR	Z,BBRM80
;
	CALL	ENXTUR
BBRM80
	LD	A,(YKFLAG)
	AND	A
	JR	NZ,BBRM90
;
	LD	A,(HL)
	AND	%00001100
	JR	Z,BBRM90
;
	CALL	ENYTUR
BBRM90
	RET
;============================================
BOMBRCS
	LD	HL,ENDSYP
	INC	(HL)
	INC	(HL)
;
;	LD	A,(YKFLAG)
;	AND	A
;	JR	NZ,BBSC10
;;
;	LD	A,(ENMODE2)
;	CP	ECACH
;	JR	Z,BBSC10
;;
;	INC	(HL)
;	INC	(HL)
;BBSC10
	LD	DE,BOMBRCD
	CALL	EN1CST
;
	JP	ENPSSV
;============================================
BBCKXD
	DB	$F8,$08,$18
	DB	$F8,$08,$18
	DB	$F8,$08,$18
BBCKYD
	DB	$F8,$F8,$F8
	DB	$08,$08,$08
	DB	$18,$18,$18
;
BBBRXP
	DB	$48,$48,$00,$90
BBBRYP
	DB	$00,$70,$38,$38
;	
BBBRUN
	DB	DBMUD 
	DB	DBMUD
	DB	DBMLR
	DB	DBMLR 
;;	DB	DHD00 
;;	DB	DHD02
;;	DB	DHD04
;;	DB	DHD06
BBBRCD	; For danjyon
	DB	$72,$72,$73,$73
	DB	$69,$79,$69,$79
BBBRCG	; For ground
	DB	$64,$66,$65,$67
BBBRSV
	DB	%00000100
	DB	%00001000
	DB	%00000010
	DB	%00000001
BBBRSV2
	DB	%00001000
	DB	%00000100
	DB	%00000001
	DB	%00000010
BBBRAD
	DB	$F8
	DB	$08
	DB	$FF
	DB	$01
BBGCDT
	DB	$72,$73,$73,$72
BBGXAD
	DB	$00,$10,$F0,$10
BBGYAD
	DB	$00,$00,$10,$00
;------------------------------------------
BOBGCK	 
	LD	A,(YKFLAG)
	AND	A
	JP	NZ,BOBCRT
;
;-- KABE BREAK CHECK - -
;	CALL	LDTIM0
;	AND	$07
;	LD	E,A
;	LD	D,B
;
	PUSH	BC
	LD	HL,ENXPSL
	ADD	HL,BC
	LD	A,(HL)
	SUB	$08
;
	LD	HL,BBCKXD
	ADD	HL,DE
	ADD	A,(HL)
	AND	$F0
	LD	(OBJXP),A
	SWAP	A
;
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	C,A
	LD	A,(HL)
	SUB	$10
	LD	HL,BBCKYD
	ADD	HL,DE
	ADD	A,(HL)
	AND	$F0
	LD	(OBJYP),A
	OR	C
	LD	C,A
;---------------------------------
	LD	B,$0
	LD	HL,BGUNDT+$11
	LD	A,H
	ADD	HL,BC
	LD	H,A
	LD	A,C
	LD	(ENHELP2),A
	LD	A,(HL)
	LD	(UNITNO),A
	LD	E,A
;
	CP	BOMG0
	JR	C,BBG310
	CP	BOMG3+1
	JR	NC,BBG310	; Big sekizoo ?
;				; yes !
	LD	A,(DJFLAG)
	AND	A
	JR	NZ,BBG310
;
	LD	A,$02
	LD	(SOUND1),A	;(S)
;
	LD	A,(OBJYP)
	AND	$E0
	LD	(OBJYP),A
	LD	A,(OBJXP)
	AND	$E0
	LD	(OBJXP),A
;
	CALL	BBGBRST
;
	LD	A,C
	AND	$EE
	LD	C,A
;
	LD	HL,BGUNDT+$11
	ADD	HL,BC
	LD	A,STON2
	LD	(HLI),A
	LD	(HLD),A
	LD	A,L
	ADD	A,$10
	LD	L,A
	LD	A,STON2
	LD	(HLI),A
	LD	(HL),STON2
;
	LD	C,$3
	LD	B,$00
BBG110
	CALL	BBBGSB
;
	LD	HL,BBGXAD
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,OBJXP
	ADD	A,(HL)
	LD	(HL),A
	LD	HL,BBGYAD
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,OBJYP
	ADD	A,(HL)
	LD	(HL),A
;
	DEC	C
	LD	A,C
	CP	$FF
	JR	NZ,BBG110
;
	JP	BBCK90
;- - - - - - - - - - - - - - - - - - - - -
BBBGSB
	LD	DE,BBGCDT
	JP	BBBGSV
;- - - - - - - - - - - - - - - - - - - - -
BBG310
	LD	A,(DJFLAG)
	LD	D,A
;	LD	HL,GRBGCR
;	ADD	HL,DE
;	LD	A,(HL)
	CALL	BGCRRD
;-----------------------------------
	SUB	$99
	JP	C,BBCK90
	CP	$9D-$99
	JP	NC,BBCK90	; Hibi ware BG ?
;				; yes !
	LD	C,A
;
	LD	A,$02
	LD	(SOUND1),A	;(S)
;
	LD	A,(DJFLAG)
	AND	A
	JR	NZ,BBGGRD	; Danjyon ?
;- - - -			; Yes !
	POP	BC
;
	LD	A,(ENHELP2)
	LD	E,A
	LD	D,B
	LD	HL,BGUNDT+$11
	ADD	HL,DE
	LD	(HL),ANA00
;
	LD	DE,BBBRCG
;
BBBGSV
	PUSH	DE
;
	LD	HL,GRRMSV
	LD	A,(GRNDPT)
	LD	E,A
	LD	D,$00
	ADD	HL,DE
;
	LD	A,(HL)
	OR	%00000100
	LD	(HL),A
	LD	(DJSVBF),A	; Save data buffer set !
;
	JP	UNBGWT
;----------------------------------------
BBGGRD
;;	LD	HL,BBBRYP
;;	ADD	HL,BC
;;	LD	A,(HL)
;;	LD	(OBJYP),A
;====
	LD	HL,DJRMSV
	LD	A,(GRNDPT)
	LD	E,A
	LD	D,$00
	LD	A,(DNJNNO)
	CP	DJROOM2
	JR	NC,BGBR10
	CP	DJROOM
	JR	C,BGBR10
	INC	D
BGBR10
	ADD	HL,DE
	PUSH	HL
	POP	DE
;
	LD	HL,BBBRSV
	ADD	HL,BC
;
	LD	A,(DE)
	OR	(HL)
	LD	(DE),A
	LD	(DJSVBF),A	; Save data buffer set !
;- -For next room open - -
	LD	HL,BBBRAD
	ADD	HL,BC
	LD	A,(DNJNPT)
	ADD	A,(HL)
	LD	E,A
	LD	D,$0
	CALL	DJRMRD	; In bank 0 FOR BANK 9 DATA READ !
	PUSH	HL
	POP	DE
;
	LD	HL,BBBRSV2
	ADD	HL,BC
;
	LD	A,(DE)
	OR	(HL)
	LD	(DE),A
;====ダンジョン内部爆弾壊れる壁書き換え======
;	LD	HL,BBBRXP
;	ADD	HL,BC
;	LD	A,(HL)
;	LD	(OBJXP),A
;	SWAP	A
;	AND	$0F
;	LD	E,A
;	LD	A,(OBJYP)
;	AND	$F0
;	OR	E
;	LD	E,A
;	LD	D,$0
;--
	LD	A,(OBJXP)
	SWAP	A
	AND	$0F
	LD	E,A
	LD	A,(OBJYP)
	AND	$F0
	OR	E
	LD	E,A
	LD	D,$00
;
	LD	HL,BGUNDT+$11
	ADD	HL,DE
;
	PUSH	HL
	POP	DE
;
	LD	HL,BBBRUN
	ADD	HL,BC
	LD	A,(HL)
	LD	(DE),A
;	LD	A,C
;	CP	$02
;	INC	E
;	JR	C,BBCK50
;;
;	LD	A,E
;	ADD	A,$10-1
;	LD	E,A
;BBCK50
;	LD	A,(HL)
;	INC	A
;	LD	(DE),A
;
	LD	A,C
	RLA
	AND	%00000100	
	LD	C,A
	LD	HL,BBBRCD
	ADD	HL,BC
	POP	BC
	PUSH	HL
;
	JP	UNBGWT
;-----------------------------------
BBCK90
	POP	BC
;
BOBCRT
	RET
;==============================================
BSBXAD
	DB	$08,$18 ;,$18
	DB	$08,$18 ;,$18
;;	DB	$08,$10,$18
BSBYAD
	DB	$10,$10 ;,$10
;;	DB	$18,$18 ;,$18
	DB	$20,$20 ;,$20
;BSBXSD
;	DB	$FD,$FE,$04
;	DB	$FB,$02,$06
;	DB	$FC,$FF,$05
;BSBYSD
;	DB	$FC,$FD,$FC
;	DB	$01,$FF,$00
;	DB	$03,$05,$04
;BSBZSD
;	DB	$14,$13,$15
;	DB	$15,$13,$16
;	DB	$16,$14,$13
;- - - - - - - - - - - - - - - - - - - - -
BBGBRST
	PUSH	BC
;
	LD	C,$3
	LD	B,$0
BSB010
	LD	A,KTOBJ
	CALL	ENIDSH
	JR	C,BSB090
;
	LD	HL,ENTIM1
	ADD	HL,DE
	LD	(HL),$0F
;
	LD	A,(OBJXP)
	LD	HL,BSBXAD
	ADD	HL,BC
	ADD	A,(HL)
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	A,(OBJYP)
	LD	HL,BSBYAD
	ADD	HL,BC
	ADD	A,(HL)
	LD	HL,WORK3
	SUB	(HL)
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	(HL),A
;
;	LD	HL,BSBXSD
;	ADD	HL,BC
;	LD	A,(HL)
;	LD	HL,ENXSPD
;	ADD	HL,DE
;	LD	(HL),A
;	LD	HL,BSBYSD
;	ADD	HL,BC
;	LD	A,(HL)
;	LD	HL,ENYSPD
;	ADD	HL,DE
;	LD	(HL),A
;	LD	HL,BSBZSD
;	ADD	HL,BC
;	LD	A,(HL)
;	LD	HL,ENZSPD
;	ADD	HL,DE
;	LD	(HL),A
;
;	LD	HL,ENWRK2
;	ADD	HL,DE
;	LD	(HL),$01
;
	LD	HL,ENMOD0
	ADD	HL,DE
	LD	(HL),%11000100
;
BSB090
	DEC	C
	LD	A,C
	CP	$FF
	JR	NZ,BSB010
;
	POP	BC
;
	RET
;==============================================
BOBGXD
	DB	$F8,$08,$18
	DB	$F8,$08,$18
	DB	$F8,$08,$18
BOBGYD
	DB	$F8,$F8,$F8
	DB	$08,$08,$08
	DB	$18,$18,$18
;- - - - - - - - - - - - - - - - - - - -
BOBGCK2
;;	LD	A,(DJFLAG)
;;	AND	A
;;	JP	NZ,B2CKF0
;
	PUSH	BC
;
	LD	HL,BOBGXD
	ADD	HL,DE
	LD	A,(ENSVXL)
	ADD	A,(HL)
	SUB	$08
	AND	$F0
	LD	(OBJXP),A
;
	SWAP	A
	LD	C,A
;
	LD	HL,BOBGYD
	ADD	HL,DE
	LD	A,(ENDSYP)
	ADD	A,(HL)
	SUB	$10
	AND	$F0
	LD	(OBJYP),A
;
	OR	C
	LD	E,A
	LD	HL,BGUNDT+$11
	ADD	HL,DE
	LD	A,H
	CP	$D7
	JP	NZ,B2CK80
;
	LD	A,(DJFLAG)
	AND	A
	LD	A,(HL)
	LD	(UNITNO),A
	JR	NZ,B2CK033
;
	LD	(ENHELP2),A
	CP	KUSA2
	JR	Z,B2CK05
	CP	ANFLW
	JR	Z,B2CK05
	CP	FLW00
	JR	Z,B2CK05
	JP	B2CK80
B2CK033
;	CP	DDBLK
;	JR	Z,B2CK05
;;	LD	A,(HL)
;
	CP	DBOMB
	JP	NZ,B2CK80
;
	LD	A,(GRNDPT)
	LD	C,A
	LD	B,$00
	LD	A,(DNJNNO)
	CP	DJROOM2
	JR	NC,B2CK334
	CP	DJROOM
	JR	C,B2CK334
;
	INC	B
B2CK334
	LD	HL,DJRMSV
	ADD	HL,BC
	LD	A,(HL)
	OR	%01000000
;;	OR	%00100000
	LD	(HL),A
	LD	(DJSVBF),A
B2CK05
	CALL	BG1CHG
;
;-- Kusa break --
	LD	A,KTOBJ
;;	CALL	PLSHST
	CALL	ENIDSH
	JR	C,B2CK80
;
	XOR	A
	LD	(POWDRTM),A
;
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	A,(OBJXP)
	ADD	A,$8
	LD	(HL),A
;
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	A,(OBJYP)
	ADD	A,$10
	LD	(HL),A
;
;;	LD	HL,ENTIM0
;;	ADD	HL,DE
;;	LD	(HL),$1F ;A
;
	LD	HL,ENCHPT
	ADD	HL,DE
	LD	A,(DJFLAG)
	XOR	$01
;;	LD	A,$1
	LD	(HL),A  ;$01  ;A
	LD	(ENCHPT2),A
;
	LD	A,(ENHELP2)
	CP	KUSA2
	JR	NZ,B2CK78
;
	LD	A,$FF
	LD	(HL),A  ;$01  ;A
	LD	(ENCHPT2),A
B2CK78
	PUSH	DE
	POP	BC
	CALL	KTFLST	
B2CK80
	POP	BC
B2CKF0
	RET
;###############################################
;#					       #
;###############################################
;===============================================
;=					       =
;===============================================
POWDRBD2
	DB	$6C,$74,$6D,$75
;TONDT2	
;	DB	$07,$06,$05
;;- - - - - - - - - - - - - -
;TOUROUOF2
;	LD	A,(TOURCT)
;	DEC	A
;	JR	TON0102
;TOUROUON2
;	LD	A,(TOURCT)
;	INC	A
;TON0102
;	LD	(TOURCT),A
;TRONSUB2
;	LD	E,A
;	LD	D,B
;	LD	HL,TONDT2
;	ADD	HL,DE
;	LD	A,(HL)
;
;	PUSH	BC
;;
;	CALL	TOURST
;;
;	POP	BC
;	RET
;==============================================
PRTBMCD
;;	DB	$A4,$00,$A4,$20
;;	DB	$A4,$10,$A4,$30
	DB	$36,$00,$36,$20
	DB	$36,$10,$36,$30
;- - - - - - - - - - - - - - - - - - - - -
PRTBMMV
	LD	HL,BUMEFG
;;	LD	HL,PFUCKFG
;;	LD	HL,PRTBMFG
	INC	(HL)
;
	LD	A,$A
	LD	(ATCKNO),A
	CALL	CRENEN
;
	LD	A,(FRCNT)
	RRA
	RRA
	RRA
	AND	%00000001
	LD	HL,ENCHPT
	ADD	HL,BC
	LD	(HL),A
;
;;	LD	HL,ENTIM1
;;	ADD	HL,BC
;;	LD	A,(HL)
;;	AND	A
	CALL	LDTIM1
	JR	Z,PRT010
;
	DEC	A
	JP	Z,ENCLER
;
	LD	DE,ENFIRECD
	JP	EN2CST
PRT010
	LD	DE,PRTBMCD
	CALL	MYM002
;
	CALL	ENSTCK
;-----------------------------------
RODSUB
	LD	A,(DJFLAG)
	AND	A
	LD	A,(UNITNO)
	JR	Z,PRT076
;
	CP	DHIMI	;氷！
	JR	Z,PRT088
	JR	PRT090
;
PRT076
	CP	ANFLW
	JR	Z,PRT088
	CP	FLW00
	JR	NZ,PRT090
;
PRT088
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	(HL),B
;
;;	LD	HL,ENTIM1
;;	ADD	HL,BC
	CALL	LDTIM1
	LD	(HL),B
;
	LD	A,(ENHELP2)
	LD	E,A
	LD	D,B
;
	CALL	BG1CHG
;
	LD	A,(OBJXP)
	ADD	A,$08
	LD	(WORK0),A
	LD	A,(OBJYP)
	ADD	A,$10
	LD	(WORK1),A
;
	LD	A,HNSM
	CALL	EXIDSH
;
	LD	A,$13
	LD	(SOUND3),A	;(S)
;;	LD	A,$06
;;	LD	(SOUND1),A	;(S)
PRT090
	RET
;==============================================
OCTAMCD
	DB	$6C,$00,$6C,$20
	DB	$5C,$00,$5C,$20
;;	DB	$6E,$00,$6E,$20
OCTAMMV
	CALL	LDTIM0
	JR	NZ,OCTM01
;
	CALL	CRENPL2
OCTM01
	LD	DE,OCTAMCD
	JP	MYM002
;==============================================
PYAAAMV
	LD	HL,BUMEFG
	INC	(HL)
;
	LD	A,(ENSTAT2)
	AND	A
	JR	NZ,BMYAAMV	; Bomber alow ?
;				; No
	CALL	LDTIM0
	JP	NZ,MYM001
;
	LD	A,$5
	LD	(ATCKNO),A
	CALL	CRENEN
	CALL	MYM001
;
	LD	A,(ENCHPT2)
	CP	$02
	JR	NZ,PYAM10	;上向き？
;				;YES !
	LD	A,(NAZOFG)
	AND	$1F
	CP	$0F
	JR	NZ,PYAM10	;メダマンは矢に弱い謎？
;				;YES !
	LD	A,(UNITNO)
	CP	DKNHT
	JR	NZ,PYAM10
;
	CALL	NAZOCLR	;(S)
;
	CALL	ENCLER
PYAM10
	RET
;==============================================
BMYAACD
	DB	$80,$10
BMYAXD
	DB	$04,$FC,$00,$00
BMYAYD
	DB	$FE,$FE,$FA,$04
;
BMYAAMV
	CALL	LDTIM0
	JR	Z,BMYA70
;
	LD	A,BOMBR
	CALL	ENIDSH
	JR	C,BMYA68
;
	LD	A,(WORK0)
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	A,(WORK1)
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENTIM0
	ADD	HL,DE
	LD	(HL),$17
;
;;	LD	A,$0C
;;	LD	(SOUND3),A	;(S)
	CALL	BBSDST	;(S)
BMYA68
	JP	ENCLER
;
BMYA70
	LD	A,(ENCHPT2)
	PUSH	AF
	LD	E,A
	LD	D,B
	XOR	A
	LD	(ENCHPT2),A
;
	LD	HL,BMYAXD
	ADD	HL,DE
	LD	A,(ENSVXL)
	ADD	A,(HL)
	LD	(ENSVXL),A
	LD	HL,BMYAYD
	ADD	HL,DE
	LD	A,(ENDSYP)
	ADD	A,(HL)
	LD	(ENDSYP),A
;
	LD	DE,BMYAACD
	CALL	EN1CST
;
	CALL	ENPSSV
;
	POP	AF
	LD	(ENCHPT2),A
;
	LD	DE,MORYACD
	CALL	EN2CST
;
	LD	A,$C
	LD	(ATCKNO),A
	CALL	CRENEN
;
	JR	MYM003
;==============================================
MORYAMV
	CALL	LDTIM0
	JR	NZ,MYM001
;
	CALL	CRENPL2
MYM001
	LD	DE,MORYACD
MYM002
	CALL	EN2CST
;
MYM003
	CALL	ENSTCK
;
	CALL	LDTIM0
	JR	NZ,MYM030
;
	CALL	ENMVCL
	CALL	ENBGCK2
;
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,MYM010
;
	CALL	LDTIM0
;
	LD	A,(ENMYNO2)
	CP	PRTBM
;;	JP	Z,PRTBMED
;;	CP	OCTAM
	JR	NZ,MYM012
;;;
;;	LD	A,$09
;;	LD	(SOUND3),A	;(S)
;;;
;;	LD	(HL),$FF ;A
;;	RET
;========================================
PRTBMED
;;	LD	HL,ENTIM1
;;	ADD	HL,BC
	CALL	LDTIM1
	LD	(HL),$30  ;50
	RET
;========================================
MYM012
	LD	(HL),$18 ;A
;
	LD	HL,ENZSPD
	ADD	HL,BC
	LD	(HL),$10 ;A
;
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	INC	A
	JR	Z,MYM1112	;FF:Tate hit !!
;				
	LD	A,$07		; BG hit !!
	LD	(SOUND1),A	;(S)
MYM1112
	CALL	OTOSET
;
	LD	A,(ENMYNO2)
	CP	PYAAA
	JR	NZ,ENXYTR
;-----------------------------------
ENXYT2
	CALL	ENYTU2
ENXTU2
	LD	HL,ENXSPD
TRSUB2
	ADD	HL,BC
	LD	A,(HL)
	CPL
	INC	A
	SRA	A
	SRA	A
	LD	(HL),A
	RET
;------------------------------------
ENYTU2
	LD	HL,ENYSPD
	JR	TRSUB2
;------------------------------------
ENXYTR
	CALL	ENYTUR
ENXTUR
	LD	HL,ENXSPD
TRSUB
	ADD	HL,BC
	LD	A,(HL)
	CPL
	INC	A
	SRA	A
	SRA	A
	SRA	A
	LD	(HL),A
MYM010
	RET
;------------------------------------
ENYTUR
	LD	HL,ENYSPD
	JR	TRSUB
;------------------------------------
MYSPDT
	DB	0,3,1,2
;
MYM030
;	CP	$F0
;	JR	Z,MYM033
;	JR	C,MYM032	; OCTAM break ?
;;				; yes !
;	LD	A,$01
;	CALL	ENPTST
;	RET
;MYM032
	CP	$01
	JR	NZ,MYM035
MYM033
	JP	ENCLER
MYM035
	LD	A,(ENMYNO2)
	CP	OCTAM
	JR	Z,MYM037
;
	CALL	LDTIM0
	SRL	A
	SRL	A
	SRL	A
	AND	$03
	LD	E,A
	LD	D,B ;$00
	LD	HL,MYSPDT
	ADD	HL,DE
	LD	A,(HL)
	CALL	ENPTST
MYM037
	CALL	ENMVCL
	JR	ENGCLC
;=====================================
ENGDAT
;;		Nrm Dep Srw Ksa
	DB	$02,$01,$02,$02
ENGMXD
	DB	$40,$08,$40,$40
;--------------------------------------
ENGCLC
	LD	A,(YKFLAG)
	AND	A
	JR	NZ,EGC010
;
	CALL	ENZCLC
;
	LD	HL,ENZSPD
	ADD	HL,BC
	LD	A,(HL)
	SUB	$2
	LD	(HL),A
	RET
EGC010
	LD	HL,ENWATR
	ADD	HL,BC
	LD	A,(HL)
;;	AND	$01
	LD	E,A
	LD	D,B
;
;;;	LD	A,E
	AND	A
	JR	Z,EGC012
;
	LD	A,(FRCNT)
	AND	$07
	JR	NZ,EGC012
;
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,EGC012
;
	AND	%10000000
	JR	Z,EGC011
;
	INC	(HL)
	INC	(HL)
EGC011
	DEC	(HL)
EGC012
	LD	HL,ENGDAT
	ADD	HL,DE
	LD	A,(HL)
;
	LD	HL,ENYSPD
	ADD	HL,BC
	ADD	A,(HL)
	LD	(HL),A
;
	LD	HL,ENGMXD
	ADD	HL,DE
	SUB	(HL)
	AND	%10000000
	JR	NZ,EGC020
;
	LD	A,(HL)
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),A
EGC020
	RET
;===============================================
MORYACD
	DB	$2E,$20,$2C,$20
	DB	$2C,$00,$2E,$00
	DB	$2A,$40,$2A,$60
	DB	$2A,$00,$2A,$20
;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				 %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CPMKCK
	DB	$1,$0,$3,$2
R7BCKD
	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
	LD	HL,CPMKCK
	ADD	HL,DE
	LD	A,(PLCMKI)
	CP	(HL)
	JR	NZ,CEP0E0	; muki -> seeld ?
;				; yes !
	LD	A,$16
	LD	(SOUND1),A	;(S)
CEP0D8
CBFGON
	LD	HL,ENCBFG
	ADD	HL,BC
;;	LD	A,$1
	LD	(HL),$FF ;A
CEPRET
	RET
CEP0E0
	CALL	CEP000
;
	LD	A,(ENMYNO2)
	CP	R7BEM
	JR	Z,CEP0EC
	CP	MORYA
	JR	NZ,CEP0D8
CEP0EC
	JP	ENCLER
;=====================================
CRENPL
	LD	A,(FRCNT)
	XOR	C
	RRA
	JP	NC,CEP010
;
CRENPLF
	LD	A,(PLZPSL)
	AND	A
	JR	NZ,CEPRET
;
CRENPS
	LD	A,(PLMODE)
	CP	PTOBI
	JR	NC,CEPRET
;- - X check - -
	PUSH	BC
;
	SLA	C
	SLA	C
	LD	HL,ENOJSZ
	ADD	HL,BC
;
	POP	BC
;
	LD	A,(ENSVXL)
	ADD	A,(HL)
	PUSH	HL
	LD	HL,PLXPSL
	SUB	(HL)
	SUB	$08
	CP	$80
	JR	C,CEP00C
;
	CPL
	INC	A
CEP00C
	POP	HL
	PUSH	AF
;
	INC	HL
	LD	A,$04
	ADD	A,(HL)
	LD	E,A
	POP	AF
	CP	E
	JP	NC,CEP010
;
	INC	HL
;- - Y check - -
	LD	A,(ENDSYP)
	ADD	A,(HL)
	PUSH	HL
	LD	HL,PLYPSL
	SUB	(HL)
	SUB	$08
	CP	$80
	JR	C,CEP00E
;
	CPL
	INC	A
CEP00E
	POP	HL
	PUSH	AF
;
	INC	HL
	LD	A,$04
	ADD	A,(HL)
	LD	E,A
	POP	AF
	CP	E
	JR	NC,CEP010
;-- OLD --
;	LD	HL,ENXPSL
;	ADD	HL,BC
;	LD	A,(PLXPSL)
;	SUB	(HL)
;	ADD	A,$0A
;	CP	$14
;	JR	NC,CEP010
;;
;	LD	HL,ENDSYP
;;;	ADD	HL,BC
;	LD	A,(PLYPSL)
;	SUB	(HL)
;	ADD	A,$0A
;	CP	$14
;	JR	NC,CEP010
;;----------------------------------------
CEP000
	LD	HL,ENMOD0
	ADD	HL,BC
	LD	A,(HL)
	AND	%10000000
	JR	Z,CEP008	; Only hit ?
;				; yes !
CEPSCF
	SCF
	RET
CEP010
	AND	A	;CLC
	RET
CEP008
	LD	A,(PLCHPT)
	SUB	$4E
	CP	$4F-$4E+1
	JR	C,CEPSCF
;- - - - - - - - - - - - - - - - - - - - - - -
PLDMST2
	LD	A,(ENMYNO2)
	CP	PUKPJ
	JR	NZ,PDS2100
;
	CALL	EPYCHK
	LD	A,E
	CP	$02
	JR	NZ,PLD201
;
	CALL	STATINC
	LD	(HL),$05
;
	LD	A,$02
	LD	(PLJPFG),A
	LD	A,$F0
	LD	(PLYSPD),A
;
	CALL	ENSDCL
;
	LD	A,$0E
	LD	(SOUND2),A	;(S)
	RET
;- - - - - - - - - - - - - - - - - - - - - - - - -
PDS2100
	LD	A,(ENMYNO2)
	CP	KURI0
	JR	NZ,PLD201	;クリボー上から踏む！
;
	LD	A,(PLJPFG)
	AND	A
	JR	Z,PLD201
;
	LD	A,(PLTIM0)
	AND	A
	JR	NZ,KURCR0C	;踏んだ瞬間？
;				;NO!
	LD	A,(YKFLAG)
	AND	A
	JR	NZ,KURCR08
;
	LD	A,(PLZSPD)
	XOR	%10000000
	JR	KURCR0A
;
KURCR08
	LD	A,(PLYSPD)
KURCR0A
	AND	%10000000
	JR	NZ,PLD201
;
KURCR0C
	LD	A,$02
	LD	(PLTIM0),A
;
	LD	HL,ENSTAT
	ADD	HL,BC
	LD	(HL),$02
;
	CALL	LDTIM0
	LD	(HL),$30
;
	LD	A,$0E
	LD	(SOUND2),A	;(S)
;
	LD	A,(YKFLAG)
	AND	A
	JR	NZ,KURCR10
;
	LD	A,$10
	LD	(PLZSPD),A
	RET
;
KURCR10
	LD	A,$F0
	LD	(PLYSPD),A
	RET
PLD201
	LD	A,(ENMYNO2)
	CP	SLIMS
	JR	NZ,PLD210	;小スライム？
;				;yes !
	CALL	LDTIM0		;ひっつき！
	LD	(HL),$80
;
	CALL	STATINC
	LD	(HL),$04
	RET
PLD210
	CP	MIZUB
	JR	Z,PDS0112	;オバＱバーは
	CP	OBQBAR
	JR	Z,PDS0112	;オバＱバーは
;				;楯にめりこんでもダメージ！
	LD	A,(HANEFG)
	AND	A
	JP	NZ,CEP010F
;
PDS0112
	LD	A,(ENMYNO2)
	CP	MBOSS
	JR	NZ,PDS0113
;
	LD	A,(ENSTAT2)
	CP	$04	;突撃？
	JR	NZ,PDS0113
;
	CALL	STATINC
	LD	(HL),$08
;
	LD	A,$03
	LD	(SOUND2),A	;(S)
	RET	
;
PDS0113
	LD	A,(PLFLSH)
;;	LD	HL,HANEFG
;;	OR	(HL)
	LD	HL,MUTEKI
	OR	(HL)
	LD	HL,OKARFG
	OR	(HL)
	LD	HL,DEMOFG
	OR	(HL)
	JP	NZ,CEP010F
;===========================================
PLDMST
	LD	A,$03
	LD	(SOUND2),A	;(S)
;
;;	LD	A,$2
;;	LD	(HARTDW),A
;
;;	LD	HL,ENMYNO
;;	ADD	HL,BC
;;	LD	E,(HL)
;;	LD	D,B
;;	LD	HL,ENMDD2
;;	ADD	HL,DE
	LD	HL,ENMOD2
	ADD	HL,BC
	LD	D,B
	LD	E,(HL)
;
	LD	HL,ATCKDT
	ADD	HL,DE
	LD	E,(HL)
;
	LD	A,(POWRFG)
	CP	$02
	JR	NZ,HTDS10
;
	LD	A,E
	CP	$04
	JR	NZ,HTDS08
;
	LD	E,$00
HTDS08
	SRL	E	; 1/2
HTDS10
	LD	A,(HARTDW)
	ADD	A,E
;;	LD	A,E
	LD	(HARTDW),A
;
	LD	A,$50
	LD	(PLFLSH),A
;
	XOR	A
	LD	(ENFLCT2),A	;守りの木のみセットカウントリセット！
;
	LD	A,(POWRFG)
	AND	A
	JR	Z,PDSS12
;
	LD	HL,POWRCT
	INC	(HL)
	LD	A,(HL)
	CP	$03
	JR	C,PDSS12	; Power up cip count !
;				; 3 times fail ?
	XOR	A		; yes ! Power up reset
	LD	(POWRFG),A
;
	LD	A,(BOSSFG)
	AND	A
	JR	NZ,PDSS12	;ボス部屋？
;				;No!
	LD	A,(BGMNO)	;BGM復帰！
	CP	$22
	JR	Z,PDSS11	;フクロウBGM?
;				;NO!
	LD	(SOUND4),A	;(S)
PDSS11
	LD	(TODYFG),A	;(S)
PDSS12
;------------------------------
PLHNST
	CALL	DUSHCL2
;
	LD	A,$10
	LD	(HANEFG),A
;
	LD	A,(ENMYNO2)
	LD	E,$18
	CP	OBQBAR
	JP	Z,OBQHNST
	CP	BGKAO
	JR	NZ,PHS002
;
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	(HL),$1
PHS002
	CP	HAYAB
	LD	A,$14
	JR	NZ,PDS010
;
	LD	A,$18
PDS010
;	CALL	PSERCH2
;;
;	LD	A,(WORK0)
;	LD	(PLYSPD),A
;	LD	A,(WORK1)
;	LD	(PLXSPD),A
	CALL	PSHST
;
;	LD	A,$02
;	LD	(PLJPFG),A
;
	LD	A,(YKFLAG)
	AND	A
	JR	NZ,CEP00F
;
;	LD	A,$04
;	LD	(PLZSPD),A
;;
;	LD	A,(PLZPSL)
;	INC	A
;	LD	(PLZPSL),A
;
CEP010F
	SCF
	RET
;----------------------------
PLYKHX
	DB	$0C,$F4
;- - - - - - - - - - - - - - -
CEP00F
	LD	A,(PLSTAT)
	CP	$02
	JR	Z,CEP010F	; In water -> Normal hanekairi
;
	CALL	EPXCHK
	LD	D,B
	LD	HL,PLYKHX
	ADD	HL,DE
	LD	A,(HL)
	LD	(PLXSPD),A
;
	LD	A,$F4
	LD	(PLYSPD),A
;
	XOR	A
	LD	(PLSTAT),A
;
	SCF
	RET
;================================================
CREPKE
	CALL	CRENPL
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				 %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;- - - - - - - - - - - - - - - - - -
CRKNEN
	LD	A,(PKCRX1)
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(PLCMKI)
	CP	$02
	RET	NZ
;
	LD	A,$04
	LD	(PLYSPD),A
;
	LD	A,$08
	LD	(HANEFG),A
;
	JP	STATINC
EHS21010
	CP	SBOMB
	JR	NZ,SBCR10
;
	LD	A,(ENSTAT2)
	CP	$02
	JP	NZ,EHS210
;
;;;	CALL	ENXYTR
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	A,(HL)
	CPL
	INC	A
	LD	(HL),A
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	A,(HL)
	CPL
	INC	A
	LD	(HL),A
;
	CALL	LDTIM0
	LD	(HL),$40
;
;;	LD	HL,ENTIM1
;;	ADD	HL,BC
	CALL	LDTIM1
	LD	(HL),$08
;
	RET
;- - - - - - - - - - - - - - - - -
SBCR10
	CP	TEKYU
	JR	NZ,TYCR10
;
	LD	HL,ENMOD3
	ADD	HL,BC
	AND	%01000000
	JP	Z,EHS210  ; Tekkyu hit ?
;				; yes !
TYCR90
	LD	HL,ENWRK0	; Chane speed turn !
	ADD	HL,BC
	LD	A,(HL)
	CPL
	INC	A
	LD	(HL),A
;
	CALL	EHS201 ; Only player hanekairi !
;
;;	LD	HL,ENTIM1
;;	ADD	HL,BC
	CALL	LDTIM1
	LD	(HL),$0C
;
	LD	A,$1
	LD	(PCUTOF),A
;
	XOR	A
	LD	(SPCTWT),A
;
	JP	EFLSST
;=============================================
TYCR10
	CP	NINTM
	JR	NZ,NTCR11
;
TYCR11
	CALL	EHS210
	JP	CBFGON
;
NTCR11
;;;;;;;;;	JR	NZ,EHS200
	CP	INOSI
	JR	NZ,EHS200
;
	LD	HL,ENSTAT
	ADD	HL,BC
	LD	A,(HL)
	CP	$03
	JR	Z,EHS201
;
	LD	(HL),$03
;
	LD	HL,ENZSPD
	ADD	HL,BC
	LD	(HL),$20
;
	CALL	LDTIM0
	LD	(HL),$FF
;
;;	CALL	ENXYTR
	LD	A,(PLCMKI)
	LD	E,A
	LD	D,B
	LD	HL,INHNXS
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
	LD	HL,INHNYS
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),A
EHS201
	CALL	EHS210
;
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	(HL),B
	RET
;=====================================
INHNXS
	DB	$10,$F0,$00,$00
INHNYS
	DB	$00,$00,$F0,$10
;- - - - - - - - - - - - - - - - - - - - -
EHS200	
	CP	BALEE
	JR	Z,TATMKT	; Balelina !!
	CP	BABUL
	JR	NZ,EHS208	; Babul !!
TATMKT
;-------楯はねかえり向き反転------
;
	LD	A,(PLCMKI)
	AND	$02
	JR	NZ,BAC008
;
	LD	HL,ENXSPD
	ADD	HL,BC
	JR	BAC010
BAC008
	LD	HL,ENYSPD
	ADD	HL,BC
BAC010
	LD	A,(HL)
	CPL	
	INC	A
	LD	(HL),A
;
	CALL	EHS210
;
	LD	(HL),B
	RET
;
;====================================
EHS208
	CP	BGKAO
	JP	Z,TYCR11
;
EHS210
	LD	A,$09
	LD	(SOUND1),A	;(S)
;
	CALL	DUSHCL2
;
	LD	A,$0C
	LD	(HANEFG),A
;
	LD	A,(ENMYNO2)
	CP	OBQBAR
	JR	NZ,EHS180
;
	LD	E,$10
;---------------------------------
OBQHNST
	PUSH	DE
	CALL	EPXCHK
	LD	A,E
	AND	A
	POP	DE
	LD	A,E
	JR	Z,EHS170
	CPL
	INC	A
EHS170
	LD	(PLXSPD),A
	XOR	A
	LD	(PLYSPD),A
	RET
;
EHS180
	LD	A,$12
;	CALL	PSERCH2
;;
;	LD	A,(WORK0)
;	LD	(PLYSPD),A
;	LD	A,(WORK1)
;	LD	(PLXSPD),A
	CALL	PSHST
;
	LD	HL,ENHELP2	;DUSHFG save!
;
	LD	A,(KEYA1)
	AND	$0F
	LD	A,$08
	OR	(HL)
	JR	Z,EHS181	;キーが入ってれば強く跳ね返る！
	LD	A,$20
EHS181
;---------------------------------
ENHNST
	CALL	PSERCH2
;
	LD	A,(WORK0)
	CPL
	INC	A
	LD	HL,ENHNYS
	ADD	HL,BC
	LD	(HL),A
;
	LD	A,(WORK1)
	CPL
	INC	A
	LD	HL,ENHNXS
	ADD	HL,BC
	LD	(HL),A
;
;	LD	HL,ENHNFG
;	ADD	HL,BC
;	LD	(HL),$0A ;A
;;
;	LD	HL,ENHNMD
;	ADD	HL,BC
;	LD	(HL),B
;
	CALL	ENDMST4
KNCRRT
	RET
;-------------------------------------
HPMKCK
	DB	$00,$01,$02,$03
;;	DB	$01,$00,$03,$02
KNCROS
;	LD	HL,TATEON
;;	
;	LD	A,(FRCNT)
;	AND	$01
;	AND	(HL)
;	JP	NZ,ENHNST2
;
	LD	A,(ENMYNO2)
	CP	HODAI
	RET	Z
	CP	BOSS	;ラストボス！
	JR	NZ,KCR0B90
;
	LD	A,(BOSSNO)
	RST	00
	DW	ENRET2
	DW	AMBCR	;アメーバ？
	DW	AGNCR	;アグニム
	DW	BHBCR	;ハヤムシ
	DW	GANCR	;ガノン
	DW	KCR0S00 ;BGRCR	;ゴーマ
;===============================================
AMBCR
	CALL	STATINC		;YES !
	LD	(HL),$06
	RET
;===============================================
AGNCR
	LD	A,(SPCTTM)
	AND	A
	JR	NZ,AGNCR10
;
	LD	A,(WCUTFG)
	CP	$04
	RET	NC
;
AGNCR10
	CALL	STATINC
	RET
;===============================================
GANCR
;===============================================
BHBCR
	LD	A,(ENMYNO2)
;================================================
KCR0B90
	CP	NYOROO
	JR	NZ,KCR0S00
;
;	LD	A,(ENSTAT2)
;	AND	A
;	JR	NZ,KCR0S00
;
	LD	A,(ENMODE2)
	CP	EMOVE
	JR	NZ,KCR0S00
;
	CALL	STATINC
	LD	(HL),$01
;
	CALL	LDTIM0
	LD	(HL),$40
	LD	A,$40
	LD	(NYOTIM),A
;
	XOR	A
	LD	(PCUTFG),A
	LD	(WCUTFG),A
	LD	(SPCTTM),A
;
	LD	A,$1C
	LD	(SOUND3),A	;(S)
;
	JP	PLDMST2	
;
KCR0S00
	LD	A,(ENMYNO2)
	CP	SBOMB
	JR	NZ,KCR0F0
;
	LD	A,$30
	CALL	PSERCH2
;
	LD	A,(WORK0)
	CPL
	INC	A
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),A
;
	LD	A,(WORK1)
	CPL
	INC	A
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
;
	CALL	STATINC
	LD	(HL),$02
;
	CALL	LDTIM0
	LD	(HL),$40
;
;;	LD	HL,ENTIM1
;;	ADD	HL,BC
	CALL	LDTIM1
	LD	(HL),$08
;
	RET	
;=======================================
KCR0F0
	CP	BFISH
	JR	NZ,KCRF01
;
	CALL	PLHNST
;
	LD	A,$08
	LD	(HANEFG),A	; 1/2 power 
	JR	KCR0F1
KCRF01
	CP	BSLIM
	JR	NZ,KCR0F1
;
;;	LD	A,$01
;;	LD	(KENOFF),A	; ONLY 1 COUNT CHECK !!
;
	LD	A,(ENHELP)
	AND	A
	JR	NZ,KCR0F2	; Body hit ?
;
	LD	HL,ENWRK0
	ADD	HL,BC
	LD	A,(HL)
	CP	$04
	JP	NZ,KCR0F3	; Chance ?
;				; yes !
	LD	A,(DUSHFG)
	AND	A
	JR	Z,KCR000	; Player dush ?
;				; yes !
;;	CALL	ENCLER	; TEST 
	LD	HL,ENTIM2	; 分身
	ADD	HL,BC
	LD	(HL),$0C
	RET
;
KCR0F3
	LD	A,(DUSHFG)
	AND	A
	JR	Z,KCRF33	; Player dush ?
;
	CALL	PLHNST
	JP	KCR000
;
KCR0F2
	CALL	PLHNST
	RET
KCRF33
	LD	A,$04
	LD	(HANEFG),A
;
	LD	A,$10
;	CALL	PSERCH2
;;
;	LD	A,(WORK0)
;	LD	(PLYSPD),A
;	LD	A,(WORK1)
;	LD	(PLXSPD),A
	CALL	PSHST
	JP	KCR000
;
;				; 
KCR0F1
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
	AND	%01000000
	JR	Z,KCR000	; Ken hanekairi ?
;				; yes !
	LD	A,(ENMYNO2)
	CP	TEKYU
	JP	Z,TYCR90
;
	CP	TBOSS
	JR	NZ,KCR0F21
;
	LD	A,(POWRFG)
;;	AND	A
	CP	$01
	LD	A,$20
	JR	NZ,KCR0F20
	LD	A,$30
KCR0F20
	CALL	ENHNST
;
	LD	HL,ENFLSH
	ADD	HL,BC
	LD	(HL),B
KCR0F21
;;	LD	A,$01
	LD	A,C
	INC	A
	LD	(KENOFF),A	; ONLY 1 COUNT CHECK !!
;
;;;	CALL	EFLSST
;	LD	A,(PKCRX1)
;	SUB	$04
;	LD	(WORK0),A
;	LD	A,(PKCRY1)
;	SUB	$04
;	LD	(WORK1),A
;	CALL	FLASHST
	CALL	KNFLSH
;
;;	LD	A,(ENMYNO2)
;;	JP	NZ,EHS210
;
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	(HL),$10	; Ken protect !!
;
	LD	HL,ENHNXS
	ADD	HL,BC
	LD	(HL),B
	LD	HL,ENHNYS
	ADD	HL,BC
	LD	(HL),B
;
	JP	PLHNST
;
;- - - - - - - - - - - - - - -
KCR000
;- - Ken Enemy damege - - 
	LD	A,(ENMYNO2)
	CP	MIZUB
	JR	NZ,CKPMIZ
;
	CALL	DUSHCL2
	JR	CKP012
CKPMIZ
	CP	HIPLP
	JR	NZ,CKP011
;
	LD	HL,ENWRK1
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,CKP011
;
	LD	A,(PLCMKI)
	LD	E,A
	LD	D,B
	LD	HL,HPMKCK
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENMUKI
	ADD	HL,BC
	CP	(HL)
	JR	Z,CKP012	; Mukai awase ?
;;	JR	NZ,CKP012	; Mukai awase ?
;				; yes !
	CALL	DUSHCL2
	LD	A,$10
	LD	(HANEFG),A
;
	LD	A,$10
;	CALL	PSERCH2
;;
;	LD	A,(WORK0)
;	LD	(PLYSPD),A
;	LD	A,(WORK1)
;	LD	(PLXSPD),A
	CALL	PSHST
;
	LD	A,$10
	CALL	ENHNST
;
EFLSST
	LD	A,(ENSVXL)
	LD	(WORK0),A
	LD	A,(ENDSYP)
	LD	(WORK1),A
	CALL	FLASHST
	RET
;- - - - - - - - - - - - - - - - - - - - -
CKP011
	LD	A,(ENMYNO2)
	CP	BABUL
	JP	Z,CKP090
;
CKP012
	LD	A,$1
	LD	(PCUTOF),A
;
	LD	A,(WCUTFG)
	CP	$04+1
	JR	NZ,KNCR09	; Kamae ?
;
	LD	A,CARITMD
	LD	(CARITM),A	; ken chari time set !
KNCR09
	XOR	A
	LD	(SPCTWT),A
;
	LD	A,$30
	CALL	ENHNST
;
	LD	HL,SOUND1	;(S)
	LD	(HL),$09	;ダメージがないときのための音！
;
	LD	A,(POWRFG)
;;	AND	A
	CP	$01
	JR	NZ,KNCR019	; Ken power up ?
;				; yes !
	CALL	KNCR019
;
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	(HL),$20
;
	LD	HL,ENHNMD
	ADD	HL,BC
	LD	(HL),$01
;
	LD	A,$11
	LD	(SOUND2),A	;(S)
;
	LD	HL,ENMODE
	ADD	HL,BC
	LD	A,(HL)
	CP	EFAIL
	JR	NZ,KNCR0A
;
	LD	HL,ENTIM4
	ADD	HL,BC
	LD	(HL),$40
KNCR0A
	RET
;----------------------------------
KNCR019
	LD	A,C
	INC	A
	LD	(KENOFF),A
;
	LD	A,(POWRFG)
	AND	$01
	LD	HL,SPCTTM
	OR	(HL)
	LD	HL,DUSHFG
	OR	(HL)
	LD	A,(KENLEV)
	JR	Z,KNCR1A
	INC	A
KNCR1A
	DEC	A
	LD	(ATCKNO),A
;- - - - - - - - - - - - - - - - - - - -
ENDMST2
;;	LD	HL,ENMYNO
;;	ADD	HL,BC
;;	LD	E,(HL)
;;	LD	D,B
;;	LD	HL,ENMDD2
;;	ADD	HL,DE
	LD	HL,ENMOD2
	ADD	HL,BC
	LD	E,(HL)
	LD	D,B
;
	SLA	E
	RL	D
	SLA	E
	RL	D
	SLA	E
	RL	D
	SLA	E
	RL	D
;
;
;
;;	SWAP	A
;;	AND	%11110000
;;	LD	E,A
	LD	HL,ITMHITD
	ADD	HL,DE
	LD	A,(ATCKNO)
	LD	E,A
	LD	D,B
	ADD	HL,DE
	LD	E,(HL)
	PUSH	DE
;
	LD	A,(ATCKNO)
	RLA
	RLA
	RLA
	AND	%11111000
	LD	E,A
;
	LD	HL,ITMHITP
	ADD	HL,DE
	POP	DE
	ADD	HL,DE
	LD	A,(HL)
	AND	A
	RET	Z
;;	JP	Z,CKP090	;ダメージある？
;				; YES 
	PUSH	AF
;
	LD	A,(ENMYNO2)
	CP	BOSS
	JR	NZ,CKP0BA
;
	LD	A,(BOSSNO)
	CP	$04	;ガノン
	JR	NZ,CKP0BA
;
	LD	A,(DUSHFG)
	PUSH	AF
	CALL	PLHNST
;
	POP	AF
	AND	A
	JR	NZ,CKP0BA
;
	LD	A,(SPCTTM)
	AND	A
	JR	NZ,CKP0BA
;
	POP	AF
	RET
;;	JP 	PLHNST
CKP0BA
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
;
	LD	HL,SOUND1	;(S)
	LD	(HL),$03
;
	AND	%10000000
	JR	Z,ED2210
;
	LD	HL,SOUND2	;(S)
	LD	(HL),$07
ED2210
	LD	HL,ENMYNO
	ADD	HL,BC
	LD	A,(HL)
	CP	NIWAT
	JR	NZ,ED22101
;
	LD	A,$13
	LD	(SOUND2),A	;(S)
ED22101
	POP	AF
;
	CP	$F0
	JR	C,CKP069	; Special atack ?
;;	 FF:Stop  FE:Fire  FD:Fairy
;				; yes !
	CP	$FE
	JR	NZ,CKP066
;
	LD	HL,SOUND3	;(S)
	LD	(HL),$12 ;(S)
;
	CALL	ENDMST4
	LD	HL,ENMODE
	ADD	HL,BC
	LD	(HL),EFIRE
;
	CALL	LDTIM0
	LD	(HL),$60
;
	LD	HL,ENMOD0
	ADD	HL,BC
	INC	(HL)
	INC	(HL)
;
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
	AND	%11000010
;;	OR	%00000000
	LD	(HL),A
;
	RET
CKP066
	CP	$FF
	JR	NZ,CKP060	; Stop ?
;				; yes !
	CALL	ENDMST4
;
;KKKKKKKKKKK	POP	AF	;  * 注
;======================================
ESTOPST
	LD	HL,ENMODE
	ADD	HL,BC
	LD	(HL),ESTOP ;A
	LD	HL,ENTIM2
	ADD	HL,BC
	LD	(HL),$FF ;A
;
	LD	HL,ENZSPD
	ADD	HL,BC
	LD	(HL),B
;
	RET
CKP060
	CP	$FD
	JR	NZ,CKP062	; 妖精 変身？
;				; YES !
	LD	HL,ENMYNO
	ADD	HL,BC
	LD	A,(HL)
	CP	NYOROO
	JR	NZ,CKP061
;
	LD	HL,ENWRK0
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,CKP062
;
	INC	(HL)
	JR	CKP0611
;
CKP061
;;	LD	HL,ENMYNO
;;	ADD	HL,BC
	LD	(HL),YOSEI
	CALL	ENMDST
;
;;	LD	HL,ENTIM3
;;	ADD	HL,BC
	CALL	LDTIM3
	LD	(HL),$80 ;A
;
;KKKKKKKK	POP	AF	;  * 注
;
CKP0611
;- - - Kemri set - - - -
	LD	HL,ENXPSL
	ADD	HL,BC
	LD	A,(HL)
	LD	(WORK0),A
;
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(HL)
;
	LD	HL,ENZPSL
	ADD	HL,BC
	SUB	(HL)
	LD	(WORK1),A
;
	LD	A,SMK1
	CALL	EXIDSH
;
	RET
CKP062
;--- Another - -
	RET
;
;==== 普通のダメージ========
CKP069
	LD	E,A
;
	LD	HL,ENLIFE
	ADD	HL,BC
	LD	A,(HL)
	SUB	E
	LD	(HL),A
	JR	C,CKP077
	JP	NZ,CKP088
;
CKP077
	LD	HL,ENMODE
	ADD	HL,BC
	LD	(HL),EFAIL ;A
;
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
;;	AND	%10000000
	BIT	7,A
	JR	Z,CKP078
;
	BIT	2,A
	JR	NZ,BSFS101
;
	LD	E,ENNO-1
	LD	D,B
BSFS0F0
	LD	A,E
	CP	C
	JR	Z,BSFS100
;
	LD	HL,ENMODE
	ADD	HL,DE
	LD	A,(HL)
;;	AND	A
	CP	EMOVE
	JR	NZ,BSFS100
;
	LD	HL,ENMOD3
	ADD	HL,DE
	LD	A,(HL)
	AND	%10000000
	JR	NZ,BSFS101
BSFS100
	DEC	E
	LD	A,E
	CP	$FF
	JR	NZ,BSFS0F0	;ボス全滅？
;				;YES !
	LD	A,(PBANK)
	PUSH	AF
	LD	A,$03
	CALL	PBSET
	CALL	SOUNDCLR	;(S)
	POP	AF
	LD	(PBANK),A
BSFS101
;;	LD	A,$10
;;	LD	(SOUND2),A	;(S)
;
	LD	A,$03
	LD	(BSFLSD),A	;(S) やられ音用！
;
;	LD	A,$5E
;	LD	(SOUND4),A	;(S)
;
	LD	HL,ENWRK1
	ADD	HL,BC
	LD	(HL),B	;やられ処理用！
;
;;	XOR	A
;;	LD	(DJSDON),A	;中ボス用サウンドセットクリアー
;
;;;	LD	A,(ENMYNO2)	
	LD	HL,ENMYNO
	ADD	HL,BC
	LD	A,(HL)
;	LD	E,$B5
;	CP	BSNAK	; L.5
;	JR	Z,CKP777
	LD	E,$B7
	CP	BGKAO	; L.6	
	JR	Z,CKP777
	LD	E,$B9
	CP	BBIRD	; L.7
	JR	Z,CKP7771
	LD	E,$BD
	CP	BFIRE	; L.8
	JR	NZ,CKP078
CKP777
	LD	A,E
	CALL	MSGCHK	;最後のあげきメッセージ
;
	LD	A,$5E
	LD	(SOUND4),A	;(S)
	JR	CKP078
CKP7771
	LD	A,(PLYPSL)
	PUSH	AF
;
	LD	A,$10
	LD	(PLYPSL),A
;
	LD	A,E
	CALL	MSGCHK	;最後のあげきメッセージ(むりやり下に出す！）
	POP	AF
	LD	(PLYPSL),A
CKP078
	CALL	STATINC
	LD	(HL),B
;
;;	CALL	LDTIM0
;
	LD	HL,ENTIM4
	ADD	HL,BC
	LD	(HL),$2F
;;	LD	(HL),$1F
;
	LD	HL,ENFLSH
	ADD	HL,BC
	XOR	A
	LD	(HL),A
;
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
	AND	%10000000
	JR	NZ,CKP079	; Normal fail ?(Boss not?)
;				; yes !
	LD	HL,ENMOD0
	ADD	HL,BC
	LD	A,(HL)
	AND	%11110000
	OR	$4
	LD	(HL),A		; OAM use count 4 of set !
CKP079
;KKKKKKK	POP	AF
;
;;	LD	A,(ENMYNO2)
	LD	HL,ENMYNO
	ADD	HL,BC
	LD	A,(HL)
	CP	GHOSS
	JR	NZ,CKP088
;
;LD	HL,ENWRK2
;ADD	HL,BC
;LD	A,(HL)
;AND	A
;JR	Z,CKP088	; Master ghost ?
;				; yes !
	LD	E,ENNO-1	; Zenmetsu !!
	LD	D,B
CKP087
	LD	A,E
	CP	C
	JR	Z,CKP0888
;
	LD	HL,ENMYNO
	ADD	HL,DE
	LD	A,(HL)
	CP	GHOST
	JR	Z,CKP0887
	CP	GHOSB
	JR	NZ,CKP0888
CKP0887
	LD	HL,ENSTAT
	ADD	HL,DE
	LD	A,(HL)
	AND	A
	JR	NZ,CKP0888
;
	LD	HL,ENMODE
	ADD	HL,DE
	LD	A,(HL)
	AND	A
	JR	Z,CKP0888
;
	LD	(HL),EFAIL
;
	LD	HL,ENTIM4
	ADD	HL,DE
	LD	(HL),$1F
;;	LD	(HL),$0F
;
;	LD	HL,ENWRK2
;	ADD	HL,DE
;	LD	(HL),$01
	CALL	RNDSUB
	AND	$03
	PUSH	BC
	LD	C,A
	LD	B,$00
	LD	HL,GHITDT
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENITMF
	ADD	HL,DE
	LD	(HL),A
	POP	BC
CKP0888
	DEC	E
	LD	A,E
	CP	$FF
	JR	NZ,CKP087
;
	LD	HL,ENITMF
	ADD	HL,BC
	LD	(HL),RUPY1
CKP088
;;	NOP
;----------------------------------
ENDMST3
;;	LD	A,(ENMYNO2)
	LD	HL,ENMYNO
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENFLSH
	ADD	HL,BC
	CP	BOSS
	JR	NZ,EDS30120
;
	LD	A,(BOSSNO)
	CP	$03
	JR	Z,EDS30130	;ラスト早MUSI？
	JR	EDS310
;
EDS30120
	CP	HAYAB
	JR	NZ,EDS310
;
EDS30130
	LD	(HL),$28
;
EDS3020
	LD	HL,ENTIM2
	ADD	HL,BC
	LD	(HL),$A0+$28
	RET
EDS310
	LD	(HL),$18 ;A
;
ENDMST4
	LD	HL,ENHNMD
	ADD	HL,BC
	LD	(HL),B
;
	LD	HL,ENHNFG
	ADD	HL,BC
;;	LD	A,$0A
	LD	(HL),$0A ;A
CKP090
	RET
;=================================
GHITDT	; ゴースト全滅アイテムセット
	DB	HART1,RUPY1,BOMB1,ALOW1
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%	剣と剣			 %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CRKNKN
	LD	HL,KENOFF
	LD	A,(HANEFG)
;;	AND	A
	OR	(HL)
	LD	HL,KNKNTM
	OR	(HL)
	LD	HL,SPCTTM
	OR	(HL)
	JP	NZ,CKK090
;
	LD	A,(PKCRX1)
	CP	$00
	JP	Z,CKK090
;- - X check - -
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	A,(PLCMKI)
	CP	(HL)
	JP	Z,CKK090
;
	LD	DE,ENSVXL
	LD	HL,ENKNSZ
;
	LD	A,(DE)
	ADD	A,(HL)
	PUSH	HL
	LD	HL,PKCRX1
	SUB	(HL)
	CP	$80
	JR	C,CKK020
;
	CPL
	INC	A
CKK020
	POP	HL
	PUSH	AF
;
	INC	HL
	LD	A,(PKCRX2)
	ADD	A,(HL)
	LD	E,A
	POP	AF
	CP	E
	JP	NC,CKK090
;
	INC	HL
;- - Y check - -
	LD	DE,ENDSYP
;
	LD	A,(DE)
	ADD	A,(HL)
	PUSH	HL
	LD	HL,PKCRY1
	SUB	(HL)
	CP	$80
	JR	C,CKK030
;
	CPL
	INC	A
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D	(WORK1),A
;
	CALL	FLASHST
;
;KKKKKKKKKK	POP	AF
;
CKK08A
	LD	A,$0C
	LD	(KNKNTM),A	; Protect time !
	RET
CKK090
	JP  	CRKNPL
;;	RET
;-------------------------------------
KKFLXD
	DB	$00,$F0,$F8,$FC
KKFLYD
	DB	$FC,$FC,$F0,$00
;=============================================
CRKNPL
	LD	A,(FRCNT)
	XOR	C
	RRA
	JR	NC,CKPL090
;
	LD	A,(PLXPSL)
	ADD	A,$08
	LD	(WORK0),A
	LD	A,(PLYPSL)
	ADD	A,$08
	LD	(WORK2),A
;
	LD	DE,ENSVXL
	LD	HL,ENKNSZ
;
	LD	A,(DE)
	ADD	A,(HL)
	PUSH	HL
	LD	HL,WORK0
	SUB	(HL)
	CP	$80
	JR	C,CKPL020
;
	CPL
	INC	A
CKPL020
	POP	HL
	PUSH	AF
;
	INC	HL
	LD	A,$04 ;(WORK1)
	ADD	A,(HL)
	LD	E,A
	POP	AF
	CP	E
	JR	NC,CKPL090
;
	INC	HL
;- - Y check - -
	LD	DE,ENDSYP
;
	LD	A,(DE)
	ADD	A,(HL)
	PUSH	HL
	LD	HL,WORK2
	SUB	(HL)
	CP	$80
	JR	C,CKPL030
;
	CPL
	INC	A
CKPL030
	POP	HL
	PUSH	AF
;
	INC	HL
	LD	A,$05 ;(WORK3)
	ADD	A,(HL)
	LD	E,A
	POP	AF
	CP	E
	JR	NC,CKPL090
;
	LD	A,(PLFLSH)
	AND	A
	JR	NZ,CKPL090
;
	CALL	PLDMST2
;
	LD	A,(ENMYNO2)
	CP	BOXER
	JR	NZ,CKPL090
;
	LD	A,(BDATNO)
	AND	A
	JR	Z,CKPL090
;
	CP	$01
	JR	Z,CKPL090
	CP	$04
	JR	Z,CKPL090
;
	CP	$02
	JR	NZ,CKPL080
;
	CALL	LDTIM1
	LD	(HL),$A0	;ピヨリ！
;
	LD	A,$20
	LD	(HANEFG),A
;
	LD	A,$30
PSHST
	CALL	PSERCH2
;
	LD	A,(WORK0)
	LD	(PLYSPD),A
	LD	A,(WORK1)
	LD	(PLXSPD),A
CKPL090
	RET
CKPL080
;---------------------------------------
PBOXST
	LD	HL,ENCONT
	ADD	HL,BC
	LD	A,(HL)
	CP	$22
	JR	C,CKPL090	;パワー？
;				;OK!
	LD	A,PBOXER
	LD	(PLMODE),A	;ぶっとび！
;
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	LD	A,$30
	JR	Z,CKPL088
	LD	A,$D0
CKPL088
	LD	(PLXSPD),A
;
	XOR	A
	LD	(PLYSPD),A
;
	LD	A,$30
	LD	(PLZSPD),A
;
	LD	A,$0B
	LD	(SOUND1),A	;(S)
	RET
;-----------------------------------------
CKPL0A0
	LD	A,$20
	LD	(HANEFG),A
;
	LD	A,$20
	JR	PSHST
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				      %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CRENEN
	LD	E,ENNO-1
	LD	D,$00
CEE000
	LD	A,E
	CP	C
	JP	Z,CEE010
;
	LD	A,(FRCNT)
	XOR	E
	AND	$01
	JP	NZ,CEE010
;
	LD	HL,ENMODE
	ADD	HL,DE
	LD	A,(HL)
	CP	EMOVE
	JP	C,CEE010
;
	LD	HL,ENMOD0
	ADD	HL,DE
	LD	A,(HL)
	AND	%01000000
	JP	NZ,CEE010
;
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	A,(ENSVXL)
	SUB	(HL)
	ADD	A,$0C
	CP	$18
	JP	NC,CEE010
;
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENZPSL
	ADD	HL,DE
	SUB	(HL)
;
	LD	HL,ENDSYP
;;;	LD	A,(ENSVYL)
	SUB	(HL)
	ADD	A,$0C
	CP	$18
	JP	NC,CEE010
;----------------------------------------
;	LD	HL,ENMOD3
;	ADD	HL,DE
;	LD	A,(HL)
;	CP	%01111111
;	JR	NZ,CEE1090	;飛び降りユニット通過？
;;				;YES !
;	LD	HL,ENTIM2
;	ADD	HL,BC
;	LD	A,(HL)
;	AND	A
;	JP	NZ,CEE010
;;
;	LD	(HL),$0C
;;
;	LD	HL,ENBCOF
;	ADD	HL,BC
;	LD	A,(HL)
;	XOR	$01
;	LD	(HL),A	;BG check xor
;	JP	CEE010	;
;CEE1090
	LD	HL,ENCHPT
	ADD	HL,DE
	LD	A,(HL)
	CP	$FF
	JP	Z,CEE010	; Not display ?
;				; yes !
	LD	A,(ENMYNO2)
	CP	SBOMB
	JR	NZ,CEE001
;
	CALL	LDTIM0
	LD	(HL),B
CEE001
	LD	HL,ENMYNO
	ADD	HL,DE
	LD	A,(HL)
	CP	SBOMB
	JR	NZ,CEE002
;
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENXSPD
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENYSPD
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENTIM0
	ADD	HL,DE
	LD	(HL),$40
;
	LD	HL,ENSTAT
	ADD	HL,DE
	LD	(HL),$02
;
	LD	HL,ENTIM1
	ADD	HL,DE
	LD	(HL),$08
;
	JP	CEE010
CEE002
;----------------------------------------
	LD	HL,ENMOD0
	ADD	HL,DE
	LD	A,(HL)
	AND	%00100000
	JP	NZ,CEE00A	; Item ?
;				; NO,
	LD	A,(ENMYNO2)
	CP	POWDR
	JR	Z,CEE009
;
	LD	HL,ENMYNO
	ADD	HL,DE
	LD	A,(HL)
	CP	BOSS
	JR	NZ,CEE0BS
;
	LD	A,(BOSSNO)
	CP	$05
	JR	NZ,CEE0BS	;ラストゴーマ？
;				;YES !
	LD	A,(ENCHPT2)
	CP	$02
	JR	NZ,CEE0082	;上むき？
;
CEE0BS				;YES!
	LD	HL,ENMOD1
	ADD	HL,DE
	LD	A,(HL)
	AND	%10000000
	JR	Z,CEE009	;Hanekairi ?
;				;Yes 
CEE0082
;;	PUSH	DE
;;	CALL	EFLSST
;;	POP	DE
;
	LD	HL,ENCBFG
	ADD	HL,BC
;;	LD	A,$1
	LD	(HL),$01 ;A
;;	JP	CEE00C
	JP	CEE0B8
CEE009
	LD	A,(ENMYNO2)
	CP	POWDR
	JR	NZ,EECRE0
;
	LD	HL,ENMYNO
	ADD	HL,DE
	LD	A,(HL)
	CP	AKUMA	;小悪魔！
	JR	NZ,CAK100
;
	LD	HL,ENSTAT
	ADD	HL,DE
	LD	A,(HL)
	AND	A
	JR	NZ,EECRE0
;
	INC	(HL)
CAK100
	CP	PAPA0	;狸タリン！
	JR	NZ,EECRE0
;
;;	LD	HL,PAPA0FG
	LD	A,(DJFLAG)
	AND	A
;;	OR	(HL)
	JR	NZ,EECRE0	; タヌキ？
;				; いぇす！
	LD	HL,ENSTAT
	ADD	HL,DE
	LD	A,(HL)
;;	CP	$00
	AND	A
	JR	NZ,EECRE0
;
	INC	(HL)		; おやじに変身！
;
	LD	HL,ENTIM3
	ADD	HL,DE
	LD	(HL),$7F
;
	LD	HL,ENFLSH
	ADD	HL,DE
	LD	(HL),$10
;
	LD	A,$03
	LD	(PBANK),A
	CALL	SOUNDCLR	;(S)
	LD	A,$18
	LD	(PBANK),A
;;
;	LD	A,$FF
;	LD	(BGMNO),A
;	LD	(BGMNO2),A
EECRE0
	LD	HL,ENMOD1	;For magic powder
	ADD	HL,DE
	LD	A,(HL)
	AND	%10000000
	JP	NZ,CEE010	;Hanekairi ?
;				;Yes 
	LD	HL,ENHNFG
	ADD	HL,DE
	LD	A,(HL)
	AND	A
	JP	NZ,CEE010
;
	LD	HL,ENMYNO
	ADD	HL,DE
	LD	A,(HL)
	CP	HIPLP
	JR	NZ,CEE0092
;
	LD	HL,ENMUKI
	ADD	HL,DE
	LD	A,(HL)
	XOR	$01
	LD	HL,ENMUKI
	ADD	HL,BC
	CP	(HL)
	JR	NZ,CEE0092	; Mask hit ?
;				; yes !
	LD	HL,ENWRK1
	ADD	HL,DE
	LD	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SRA	(HL)
	SRA	(HL)
	LD	A,(HL)
	CPL
	LD	(HL),A
;
	LD	HL,ENYSPD
	ADD	HL,BC
	SRA	(HL)
	SRA	(HL)
	LD	A,(HL)
	CPL
	LD	(HL),A
;
	LD	HL,ENSHMK
	ADD	HL,BC
	LD	(HL),%11111111	;段差チェック無し
;
	JR	CEE00C
CEE0BA
;	LD	HL,ENMOD1
;	ADD	HL,DE
;	LD	A,(HL)
;	AND	%10000000
;	JR	NZ,CEE00C	;Hanekairi ?
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,CEE00C	;Hanekairi ?
;				;NO 
	LD	A,(ENMYNO2)
	CP	PYAAA
	JR	NZ,CEE00DD
;
	LD	A,(ENSTAT2)
	AND	A
	JR	NZ,CEE00DE	; Bombr alow -> Not clear
CEE00DD
	CALL	ENCLER
CEE00DE
	JR	CEE010
CEE00C
	CALL	LDTIM0
	XOR	A
	LD	(HL),A
;
;;;	CALL	BUMERT	; Return player !!
;;;
;;	LD	HL,ENMOD0
;;	ADD	HL,DE
;;	LD	A,(HL)
;;	AND	%00100000
;;	JR	Z,CEE010	; Item chach ?
;;;				; yes !
;;	LD	A,C
;;	INC	A
;;	LD	HL,ENSTAT	; kuttsuki
;;	ADD	HL,DE
;;	LD	(HL),A
CEE010
	DEC	E
	LD	A,E
	CP	$FF
	JP	NZ,CEE000
	RET
;==============================================
ENENCR
	LD	A,(ENMYNO2)
	CP	PYAAA
	JR	NZ,EECRF1
;
	LD	A,(ENSTAT2)
	AND	A
	JR	Z,EECRF1	; Bomber alow ?
;				; yes !
	CALL	LDTIM0
	LD	(HL),$03	; Bomb !!!!
	RET
EECRF1
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENHNXS
	ADD	HL,DE
;;	SLA	A
	LD	(HL),A
;
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	A,(HL)
	LD	HL,ENHNYS
	ADD	HL,DE
;;	SLA	A
	LD	(HL),A
;- - - - - - - - - - - - - -
	PUSH	BC
	PUSH	DE
	POP	BC
;
;;	LD	A,(ENMYNO2)
;;	CP	BUMER
;;	JR	Z,EECR10
;
	PUSH	DE
	CALL	ENDMST22
	POP	DE
;
;;	JR	EECR20
;;EECR10	; Bumeran stoping !
;;	CALL	ENDMST3	
;;;
;;	LD	HL,ENMODE
;;	ADD	HL,BC
;;;;	LD	A,ESTOP
;;	LD	(HL),ESTOP ;A
;;	LD	HL,ENTIM2
;;	ADD	HL,BC
;;;;	LD	A,$FF
;;	LD	(HL),$FF ;A
;;EECR20
	POP	BC
;
EECR30
	RET
;=============================
ENDMST22
	CALL	ENDMST2
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				      %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CRBOEN
	LD	E,ENNO-1
	LD	D,$00
CBE000
	LD	HL,ENMODE
	ADD	HL,DE
	LD	A,(HL)
	CP	EMOVE
	JR	C,CBE010
;
	LD	HL,ENMOD0
	ADD	HL,DE
	LD	A,(HL)
	AND	%01100000
	JR	NZ,CBE010
;
	LD	HL,ENMOD1
	ADD	HL,DE
	LD	A,(HL)
	AND	%10000000
	JR	NZ,CBE010
;
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	A,(ENSVXL)
	SUB	(HL)
	ADD	A,$18
	CP	$30
	JR	NC,CBE010
;
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENZPSL
	ADD	HL,DE
	SUB	(HL)
;
	LD	HL,ENDSYP
;;;	LD	A,(ENSVYL)
	SUB	(HL)
	ADD	A,$18
	CP	$30
	JR	NC,CBE010
;----------------------------------------
	LD	A,$07
	LD	(ATCKNO),A
	CALL	ENENCR	; Enemy damege !
;
	LD	A,$30
	CALL	ESERCH
;
	LD	HL,ENHNYS
	ADD	HL,DE
	LD	A,(WORK0)
	LD	(HL),A
;
	LD	HL,ENHNXS
	ADD	HL,DE
	LD	A,(WORK1)
	LD	(HL),A
CBE010
	DEC	E
	LD	A,E
	CP	$FF
	JR	NZ,CBE000
	RET
;===============================
ESERCH
	LD	(WORK0),A
;
	LD	A,(PLXPSL)
	PUSH	AF
;
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	A,(HL)
	LD	(PLXPSL),A
;
	LD	A,(PLYPSL)
	PUSH	AF
;
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	A,(HL)
	LD	(PLYPSL),A
;
	PUSH	DE
	LD	A,(WORK0)
	CALL	PSERCH2
	POP	DE
;
	POP	AF
	LD	(PLYPSL),A
	POP	AF
	LD	(PLXPSL),A
;
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				 %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;---------------------------------
EBCKXD
	DB	$0D,$02,$08,$08	; Normal 
;
	DB	$0A,$06,$08,$08	; small
	DB	$10,$FF,$08,$08 ; BLOCK
;
	DB	$0D,$02,$08,$08	; Spark
;
;
;;	DB	$0B,$05,$08,$08
EBCKYD
	DB	$08,$08,$02,$0D
;
	DB	$08,$08,$06,$0A
	DB	$08,$08,$FF,$10
;
	DB	$08,$08,$02,$0D	; Spark
;
;
;;	DB	$08,$08,$05,$0B
ENCBBT
	DB	%00000001
	DB	%00000010
	DB	%00000100
	DB	%00001000
;
EBLTXD	; Belt revise data
	DB	$00,$00,$FF,$01
	DB	$01,$FF,$01,$FF
EBLTYD
	DB	$01,$FF,$00,$00
	DB	$01,$01,$FF,$FF
;---------------------------------
ENBGCK
	LD	HL,ENWATR
	ADD	HL,BC
	LD	A,(HL)
	LD	(WORK0),A
	XOR	A
	LD	(HL),A
	LD	(WORK1),A
	LD	(ENBGLR),A
	LD	(ENBGUD),A
;
;	LD	A,(YKFLAG)
;	AND	A
;	JR	Z,EBCK02
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	A,(HL)
	BIT	7,A
	JR	NZ,EFLD055
	AND	A
	JP	NZ,EFLD070
;
EFLD055
	LD	HL,ENBCOF
	ADD	HL,BC
	LD	(HL),B
;
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
	BIT	4,A
	JP	NZ,EFLD070	; Center check ok ?
;;	PUSH	AF
;				; yes !
;	LD	HL,ENWATR
;	ADD	HL,BC
;	LD	A,(HL)
;	LD	(WORK0),A
;	XOR	A
;	LD	(HL),A
;	LD	(WORK1),A
;- - - Center check - -
	CALL	ENCTBC  ;ENBGCK2	; Water & fole check !
;--------------------------------------------
;J	LD	A,(UNITNO)
;J;;	CP	DFIR0
;J;;	JP	Z,EBCE80	; Yogan ?
;J	CP	DFIR1
	JR	EBCF00
EBCE80				; Yes !
	LD	E,$02
;;	LD	E,$01
	LD	A,(ENMYNO2)
	CP	BLANKA
	JR	Z,MCK010
	CP	PIHAT 
	JR	Z,MCK010
	CP	NIWAX 
	JR	Z,MCK010
	CP	WANWAN
	JR	Z,MCK010
	CP	GIRL1 	;マリン！
	JR	Z,MCK010
;
	CALL	ENCLER		; Clear 
	JP	EWPSET		; Water up set !
;
EBCF00
	LD	E,$01
;
	LD	A,(UNITNO)
	CP	DYKH2
;;	CP	DYKH1
	JR	Z,MCK010
;
	LD	A,(WORK3)
	AND	A
	JP	Z,EFLD070
	CP	$0B	; 溶岩！　
	JR	Z,EBCE80
	CP	$07	; Deep water !
	JR	Z,EBCE80
	CP	$B0
	JR	Z,MCK010
	INC	E
	CP	$05
	JR	Z,MCK010	; Asase
	CP	$06
	JR	NZ,MCK020	; Kusamura ?
;				; yes !
	INC	E
MCK010
	LD	HL,ENWATR
	ADD	HL,BC
	LD	(HL),E  ;$1
;
MCK020
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
;;	POP	AF
	AND	%00001000
	JR	Z,EBCK02	; Water up set ?
;				; yes!
	LD	HL,ENWATR
	ADD	HL,BC
	LD	A,(WORK0)
	CP	(HL)
	JR	Z,EBCK02
;
	LD	A,(HL)
	CP	$03
	JR	Z,EBCK02	; Kusa -> not water up !
	LD	A,(WORK0)
	CP	$03
	JR	Z,EBCK02
;
	LD	A,(YKFLAG)
	AND	A
	JR	NZ,EWCK10
;
	LD	HL,ENZSPD
	ADD	HL,BC
	LD	A,(HL)
	BIT	7,A
	JR	Z,EBCK02
;
	CP	$E7
	JR	NC,EBCK02	; High down ?
;				; yes !
	JR	EBCK01	
;
EWCK10
	LD	A,(ENMYNO2)
	CP	PUKPJ
	JR	Z,EBCK01
;
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	A,(HL)
	BIT	7,A
	JR	NZ,EBCK01
;
	LD	(HL),$0
;
	LD	HL,ENXSPD
	ADD	HL,BC
	SRA	(HL)
;;	SRA	(HL)
;
EBCK01
	LD	HL,ENTIM4
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,EBCK02
;
EWPSET
	LD	HL,ENXPSL
	ADD	HL,BC
	LD	A,(HL)
	LD	(WORK0),A
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(HL)
	LD	(WORK1),A
;
	LD	A,$0E
	LD	(SOUND1),A	;(S)
;
	LD	A,WTUP
	CALL	EXIDSH
;;;	WATR UP SET 
EBCK02
;	LD	HL,ENZPSL
;	ADD	HL,BC
;	LD	A,(HL)
;	BIT	7,A
;	JR	NZ,EFLD055
;	AND	A
;	JR	NZ,EFLD070
;;
;EFLD055
	LD	A,(WORK3)
	INC	A
	CP	$F1
	JR	C,EBLC10	; Beltconv ?
;				; yes !
	SUB	$F1		; Move !!
	LD	E,A
	LD	D,B
;
	LD	A,(FRCNT)
	AND	$03
	JR	NZ,EFLD008
;
	LD	HL,EBLTXD
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENXPSL
	ADD	HL,BC
	ADD	A,(HL)
	LD	(HL),A
;
	LD	HL,EBLTYD
	ADD	HL,DE
	LD	A,(HL)
	LD	HL,ENYPSL
	ADD	HL,BC
	ADD	A,(HL)
	LD	(HL),A
EFLD008
	JR	EFLD070
;--------------------------------------
EBLC10
	LD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)
;;	LD	A,$0C
;;	LD	(SOUND2),A	;(S)
;===== MAIN CHECK ============
EFLD070
	LD	A,(ENMYNO2)
	CP	WANWAN
	JP	Z,EBCK50
;
	XOR	A
	LD	(ENBGLR),A
;
	LD	HL,ENMOD1
	ADD	HL,BC
	LD	A,(HL)
	AND	%00000011
	SLA	A
	SLA	A
	LD	(WORK0),A
;
	LD	HL,ENCBFG
	ADD	HL,BC
	XOR	A
	LD	(HL),A
;
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	A,(HL)
	CP	$00
	JR	Z,EBCK30
;
	LD	DE,$0000
;
	AND	%10000000
	JR	Z,EBCK10
;
	INC	E
EBCK10
	CALL	ENUNRD
	JR	C,EBCK30
;
	LD	A,(UNITNO)
	LD	(ENBGLR),A
;
;	LD	HL,ENMOD3
;	ADD	HL,BC
;	LD	A,(HL)
;	AND	%00000100
;	JR	NZ,EBCK30	; Position revise ?
	LD	A,(ENBGRV)
	AND	A
	JR	NZ,EBCK30	;
;				; yes !
	LD	HL,ENXPSL
	ADD	HL,BC
	LD	A,(ENSVXL)
	LD	(HL),A
EBCK30
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	A,(HL)
	CP	$00
	JR	Z,EBCK50
;
	LD	DE,$0002
;
	AND	%10000000
	JR	NZ,EBCK40
;
	INC	E
EBCK40
	CALL	ENUNRD
	JR	C,EBCK50
;
	LD	A,(UNITNO)
	LD	(ENBGUD),A
;
;;	LD	HL,ENMOD3
;;	ADD	HL,BC
;;	LD	A,(HL)
;;	AND	%00000100
	LD	A,(ENBGRV)
	AND	A
	JR	NZ,EBCK50
;
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(ENSVYL)
	LD	(HL),A
EBCK50
	RET
;==========================================
;====== BG check  特殊CHECK DATA ==
SPUNDT2
;7C
	DB	1,0
	DB	1,0
;7D
	DB	0,1
	DB	0,1
;E
	DB	1,1
	DB	0,0
;F
	DB	0,0
	DB	1,1
;80
	DB	1,0
	DB	1,0
;1
	DB	0,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	CP	IWA00
	JP	Z,EFUCKON
	PUSH	DE
	LD	E,A
	LD	A,(DJFLAG)
	LD	D,A
;;	LD	HL,GRBGCR
;;	ADD	HL,DE
	CALL	BGCRRD2
	POP	DE
;
;;;	LD	A,(HL)
	LD	(WORK3),A
;
	LD	A,(ENMYNO2)
	CP	BLANKA
	JR	Z,BLABCK	;ピラニアは水のみ
	CP	AMENB
	JR	NZ,EFOC0E	;あめんぼは水のみ!
;
BLABCK
	LD	A,(WORK3) ;BGCRNO) ;HL)
	CP	$05
	JP	Z,BUR010
	CP	$07
	JP	Z,BUR010
	JP	BUR00E
;
EFOC0E
	LD	A,(WORK3) ;BGCRNO) ;HL)
	AND	A
	JP	Z,BUR010
;;;	LD	(WORK3),A
	CP	$0B
	JR	Z,EFOC010	;溶岩！
	CP	$50
	JR	Z,EFOC010
	CP	$51
	JR	NZ,EFOC020	; Fole kabe ?
EFOC010				; yes !
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JP	NZ,BUR010
;
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JP	Z,BUR00E	; Hanekaeri not check !
;
	LD	A,(ENMYNO2)
	CP	HAYAB
	JP	Z,BUR00E
;
	JP	BUR010
EFOC020
	CP	$7C  ;80
	JP	C,EUR0FF	; Special BG ?
;				; yes !
	CP	$90
	JP	NC,EUR0FF
;
	CP	$80
	LD	A,(ENMYNO2)
	JR	C,EFOC022	;半当たり？
;				;YES !
;;	LD	A,(ENMYNO2)
	CP	TAMA0
	JP	Z,ENBGOFF
	CP	BOMBR
	JP	Z,ENBGOFF
	JR	EFOC023
;
EFOC022		;通路当たり！
	CP	SPARK
	JP	Z,ENBGON 
	CP	SPAR2
	JP	Z,ENBGON 
;
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
	AND	%10000000
	JP	NZ,ENBGON 	;ボス！
EFOC023
	PUSH	DE
;
	LD	A,(WORK3)
	SUB	$7C ;80
	SLA	A
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CP	DBL01
	JR	C,ENBGON
	CP	DBL02+1
	JR	NC,ENBGON
;				; yes !
	PUSH	DE
	SUB	DBL01
	LD	E,A
	LD	D,$00
	LD	HL,ONOFBDE
	ADD	HL,DE
	POP	DE
	LD	A,(ONOFFG)	; Swich on hit check !!
	XOR	(HL)
	JR	Z,BUR010	; which check !
BUR00E
	LD	A,(WORK3)
	CP	$60
	JR	NZ,EUR00F	; Fuck shot check ?
;				; yes!
EFUCKON
	LD	A,(ENMYNO2)
	CP	FUCKS
	JR	NZ,EUR00F	; Fuck ?
;				; yes !
;;	LD	HL,ENTIM0
;;	ADD	HL,BC
;;	LD	A,(HL)
	CALL	LDTIM0
	CP	$26
;;	CP	$1E
	JR	C,EUR0E0	; First time hit ?
;				; yes ! clear !
	CALL	ENCLER
EUR0E0
	LD	HL,ENSTAT
	ADD	HL,BC
;;	LD	A,$01
	LD	(HL),$01 ;A
EUR00F
	LD	HL,ENMOD3
	ADD	HL,BC
	LD	A,(HL)
	AND	%00000001	; Unit hit ok ?
	JR	NZ,BUR010
;				; yes !
;;	LD	HL,ENBCOF
;;	ADD	HL,BC
;;	LD	A,(HL)
;;	AND	A
;;	JR	NZ,BUR010
;
ENBGON
EUR010
;;;
;;	CP	HITBG
;;	JR	C,BUR010	; hit ?
;				; yes !
	LD	HL,ENCBBT
	ADD	HL,DE
	LD	A,(HL)
;
	LD	HL,ENCBFG
	ADD	HL,BC
;
	OR	(HL)
	LD	(HL),A
;
	AND	A	; CF claer !
	RET
ENBGOFF
BUR010
	SCF
	RET
;==========================================
ONOFBDE
	DB	$00,$02
;==========================================
;EBCKXD2
;	DB	$07
;EBCKYD2
;	DB	$07
;
ENBGCK2	; Only 1 point 
;	LD	HL,ENWATR
;	ADD	HL,BC
;	LD	A,(HL)
;	LD	(WORK0),A
;	XOR	A
;	LD	(HL),A
;	LD	(WORK1),A
;
;	LD	HL,ENCBFG
;	ADD	HL,BC
;	XOR	A
;	LD	(HL),A
;
	LD	DE,$0000
;
	PUS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TOUROUON2
	LD	HL,TOURCT
	INC	(HL)
;
	LD	A,(FADECT2)
	AND	A
	JR	Z,EUR121
;
	SUB	$04
	LD	(FADECT2),A
EUR121
	LD	DE,POWDRBD2
	PUSH	DE
	JP	UNBGWT
;
EUR122
	POP	HL
EUR123
	LD	A,(HL)
;;;	CP	DYKH1
;;;	JR	Z,BU2005
;
	LD	E,A
;;	LD	D,$0
	LD	A,(DJFLAG)
	LD	D,A
;;	LD	HL,GRBGCR
;;	ADD	HL,DE
;;	LD	A,(HL)
	CALL	BGCRRD2
	LD	(WORK1),A
	AND	A
	JP	Z,BU2010
	LD	(WORK3),A
	CP	$FF
	JP	Z,BU2020	; Display out ?
;	CP	$B0
;	JR	NZ,BU2001	; Yoko mizu ?
;;				; yes !
;BU2005
;	LD	HL,ENWATR
;	ADD	HL,BC
;	LD	(HL),$1
;	JR	BU2010	
;BU2001
	CP	$D0
	JR	C,ETO2190
	CP	$D3+1
	JR	NC,ETO2190
;
	SUB	$D0
;
	LD	HL,ENSHMK
	ADD	HL,BC
	CP	(HL)
	JR	Z,ETO2120
;;	JR	NZ,BU2008
;
	LD	HL,ENBCOF
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,BU2008
;
	LD	A,(FRCNT)
	AND	$03
	JR	Z,BU2010
;
	LD	A,(DJFLAG)
	AND	A
	JR	NZ,ETO2119
;
	LD	A,(FRCNT)
	AND	$01
	JR	Z,BU2010
ETO2119
	DEC	(HL)
	JP	BU2010	
ETO2120
	LD	HL,ENZPSL
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,BU2008
;
	LD	HL,ENBCOF
	ADD	HL,BC
	INC	(HL)
;
	JP	BU2010	
;
ETO2190
	CP	$7C
;;;	CP	$80
	JP	C,BU2003	; Special BG ?
;				; yes !
	CP	$90
	JP	NC,BU2003
;
	JP	BU2010
;
;	SUB	$80
;	SLA	A
;	SLA	A
;	LD	E,A
;	LD	D,$0
;	LD	HL,SPUNDT2	
;	ADD	HL,DE
;;
;	LD	A,(WORK4)
;	RRA
;	RRA
;	RRA
;	AND	$01
;	LD	E,A
;	LD	A,(WORK5)
;	RRA
;	RRA
;	AND	$02
;	OR	E
;	LD	E,A
;	LD	D,$0
;	ADD	HL,DE
;	LD	A,(HL)
;	AND	A
;	JR	Z,BU2010
;;
BU2003
	LD	A,(WORK3)
	CP	$A0
	JR	NC,BU2010
	CP	$50
	JR	Z,BU2010
	CP	$51
	JR	Z,BU2010
	CP	$10
	JR	NC,BU2008
;;	CP	$A0
;;	JR	Z,BU2010	; hit ?
	CP	$1
	JR	NZ,BU2010	; hit ?
;				; yes !
;				; NO.
BU2008
;	LD	HL,ENBCOF
;	ADD	HL,BC
;	LD	A,(HL)
;	AND	A
;	JR	NZ,BU2010	;段さ通過？
;				; no!
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	(HL),$01 ;A
;
	LD	A,(ENMYNO2)
	CP	BUMER
	JR	NZ,ENPSRV
;
	CALL	LDTIM0
	RET	Z
;-------------------------------------------
ENPSRV
	LD	HL,ENXPSL
	ADD	HL,BC
	LD	A,(ENSVXL)
	LD	(HL),A
;
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	A,(ENSVYL)
	LD	(HL),A
BU2099
	SCF
	RET
BU2010
	AND	A	; (CLC)
	RET
BU2020
	LD	A,(ENMYNO2)
	CP	BUMER
	JR	Z,BU2008
;
;	LD	HL,ENHNFG
;	ADD	HL,BC
;	LD	A,(HL)
;	CP	$02
;	JR	NC,ENPSRV
;
	JP  	ENCLER
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				 %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;==========================================
ENCTBC	; Center check  
	PUSH	BC
;
	LD	HL,ENXPSL
	ADD	HL,BC
	LD	A,(HL)
	SUB	$08-$07
;
;;	ADD	A,$07
	LD	(WORK4),A
	AND	$F0
	LD	(OBJXP),A
	SWAP	A
;
	LD	HL,ENYPSL
	ADD	HL,BC
	LD	C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A
	LD	A,(WORK0)
	JR	NZ,PS60
;
	CPL
	INC	A
	LD	(WORK0),A
PS60
	LD	A,(WORK3)
	AND	A
	LD	A,(WORK1)
	JR	Z,PS70
;
	CPL
	INC	A
	LD	(WORK1),A
PS70
	RET
PS90
	XOR	A
	LD	(WORK0),A
	RET
;=======================================
PSERCH
	CALL	PSERCH2
;
	LD	A,(WORK0)
	LD	HL,ENYSPD
	ADD	HL,BC
	LD	(HL),A
;
	LD	A,(WORK1)
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
	RET
;====================================
EPXCHK
	LD	E,$0
;
	LD	A,(PLXPSL)
	LD	HL,ENXPSL
	ADD	HL,BC
	SUB	(HL)
	BIT	7,A
	JR	Z,EPX010
;;	JR	NC,EPX010
	INC	E
EPX010
	LD	D,A
	RET
;====================================
EPYCHK
	LD	E,$2
;
	LD	A,(PLYPSL)
	LD	HL,ENYPSL
	ADD	HL,BC
	SUB	(HL)
	LD	HL,ENZPSL
	ADD	HL,BC
	ADD	A,(HL)
	BIT	7,A
	JR	NZ,EPY010
;;	JR	C,EPY010
	INC	E
EPY010
	LD	D,A
	RET
;====================================
EPXYCK
	CALL	EPXCHK
	LD	A,E
	LD	(WORK0),A
;
	LD	A,D
	BIT	7,A
	JR	Z,EXY010
	CPL
	INC	A
EXY010
	PUSH	AF
;
	CALL	EPYCHK
	LD	A,E
	LD	(WORK1),A
;
	LD	A,D
	BIT	7,A
	JR	Z,EXY020
	CPL
	INC	A
EXY020
	POP	DE
	CP	D
	JR	NC,EXY030
;
	LD	A,(WORK0)
	JR	EXY050
EXY030
	LD	A,(WORK1)
EXY050
	LD	E,A
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				 %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ENMVCL	
;
	CALL	ENXCLC 		; X calc
;
ENYCLC
	PUSH	BC
	LD	A,C
	ADD	A,<ENNO
	LD	C,A
	
	CALL	ENXCLC		; Y calc
	POP	BC
	RET
;-----------------------------------------
ENXCLC
	LD	HL,ENXSPD
	ADD	HL,BC 
;
	LD	A,(HL)
	AND	A
	JR	Z,ECL090
;
	PUSH	AF
	SWAP	A
	AND	$F0
	LD	HL,ENXSDR
	ADD	HL,BC 
	ADD	A,(HL)
	LD	(HL),A
	RL	D
;
	LD	HL,ENXPSL
ECL00
	ADD	HL,BC 
;
	POP	AF
;
	LD	E,$0
	BIT	7,A
	JR	Z,EXC00
	LD	E,$F0
EXC00
	SWAP	A
	AND	$0F
	OR	E
	RR	D
	ADC	A,(HL)
	LD	(HL),A
ECL090
	RET
;====================================================
ENZCLC
	LD	HL,ENZSPD
	ADD	HL,BC 
;
	LD	A,(HL)
	AND	A
	JR	Z,ECL090
;
	PUSH	AF
	SWAP	A
	AND	$F0
	LD	HL,ENZSDR
	ADD	HL,BC 
	ADD	A,(HL)
	LD	(HL),A
	RL	D
;
	LD	HL,ENZPSL
	JR	ECL00
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				 %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;---------------------------------
ENSTCK
	LD	A,(ENMODE2)
	CP	EMOVE
	JR	NZ,ESTC12
;
ENSTCK2
	LD	A,(GMMODE)
	CP	GMAP
	JR	Z,ESTC12
;
	LD	A,(MSGEFG)
;;	AND	A
	LD	HL,ENSTFG
	OR	(HL)
	LD	HL,WNDFLG
	OR	(HL)
	JR	NZ,ESTC12
;
	LD	A,(SCRLFG)
	AND	A
	JR	Z,ESTCF0
ESTC12
	POP	AF
ESTCF0
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%						    %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;ENHNSD
;	DB	$0,$0,$0,$0,$0
;;	DB	$7,$3,$1,$0,$0
ENHNSB
	LD	HL,ENHNFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	J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EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
	END
;
;
;
;-------------------------------------------
ENMKST
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	A,(HL)
	RL	A
	LD	A,$00
	JR	C,EMKS10
	LD	A,$20
EMKS10
	LD	HL,ENFLCL
	XOR	(HL)
	LD	(HL),A
	RET
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
BOSS1MV
KWUSOMV
	LD	DE,BOSS1CD
	CALL	EN2CST
;
	CALL	ENSTCK
;
	LD	A,(ENSTAT2)
	RST	0
	DW	BS1000
	DW	BS2000
	DW	BS3000
	DW	BS4000
	DW	BS5000
	DW	BS6000
;--------------------------------
;	DW	BS7000
	DW	BS8000
	DW	BS9000
;======================================
BS1000
	CALL	EPYCHK
;
	ADD	A,$18
	CP	$30
	JR	NC,BS1010
;
	LD	A,(ENMYNO2)
	CP	KWUSO
	LD	A,$25	; Nanda temeewa..
	JR	NZ,BS1001
	LD	A,$2A	; Watashi ni nanika..
BS1001
	CALL	MSGCHK
;
	CALL	STATINC
;
	LD	HL,ENMOD0
	ADD	HL,BC
	LD	(HL),%00000010
	LD	HL,ENMOD1
	ADD	HL,BC
	LD	(HL),%00000000
BS1010
SBPTST
	CALL	EPXYCK
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	(HL),A
;
	CALL	MKPTST
	RET
;======================================
BS2000
	LD	HL,ENFLSH
	ADD	HL,BC
	LD	A,(HL)
	CP	$15
	JR	NZ,BS2010
;
	LD	A,(ENMYNO2)
	CP	KWUSO
	LD	A,$26	; Kanbenshitekudase..
	JR	NZ,BS2002
	LD	A,$2B	; Na naniwosurunoda..
BS2002
	CALL	MSGCHK		
;
	LD	HL,ENLIFE
	ADD	HL,BC
	LD	(HL),$50
;
	CALL	STATINC
BS2010
	CALL	ENHNSB
	CALL	CRKNEN
	CALL	SBPTST
	RET
;======================================
BS3000
	LD	HL,ENFLSH
	ADD	HL,BC
	LD	A,(HL)
	CP	$15
	JR	NZ,BS3010
;
	LD	A,(ENMYNO2)
	CP	KWUSO
	JR	NZ,BS3003
;
	LD	A,$2C		; Sonnani watashino ..
	CALL	MSGCHK
;
	LD	A,$06
	LD	HL,ENSTAT
	ADD	HL,BC
	LD	(HL),A
;
	CALL	LDTIM0
	LD	(HL),$60
;
	LD	HL,ENMOD0
	ADD	HL,BC
	LD	A,(HL)
	OR	%01000000
	LD	(HL),A
	LD	HL,ENMOD1
	ADD	HL,BC
	LD	A,(HL)
	OR	%10000000
	LD	(HL),A
	RET
;
BS3003
	LD	A,$27		; Oboeteyagare!!
	CALL	MSGCHK
;
	CALL	STATINC
;
	LD	HL,ENFLSH
	ADD	HL,BC
	LD	(HL),$A0
;
	CALL	ENMDSTS
	RET
BS3010
	CALL	ENHNSB
	CALL	CRKNEN
;
	LD	A,$10
	CALL	PSERCH2
	LD	A,(WORK0)
	LD	HL,ENYSPD
	ADD	HL,BC
	CPL
	INC	A
	LD	(HL),A
	LD	A,(WORK1)
	LD	HL,ENXSPD
	ADD	HL,BC
	CPL
	INC	A
	LD	(HL),A
;
	CALL	EPXYCK
	XOR	$01
	LD	HL,ENMUKI
	ADD	HL,BC
	LD	(HL),A
;
	CALL	ENMVCL
	CALL	ENBGCK
;
	CALL	MKPTST
	CALL	MKPTST
	RET
;======================================
BS4000
	LD	HL,ENFLSH
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,BS4010
;
	LD	A,BOMBR
	CALL	ENIDSH
;
	LD	A,(WORK0)
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	(HL),A
	LD	A,(WORK1)
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENTIM0
	ADD	HL,DE
	LD	(HL),$17
;
	LD	HL,ENCHPT
	ADD	HL,BC
	LD	(HL),$FF
;
	CALL	LDTIM0
	LD	(HL),$70
;
	CALL	STATINC
BS4010
	RET
;======================================
BS5000
	CALL	LDTIM0
	JR	NZ,BS5010
;
	LD	(HL),$28
;
	CALL	STATINC
;
	LD	A,$28
	CALL	MSGCHK
BS5010
	RET
;======================================
BS6000
	CALL	LDTIM0
	LD	A,$01
	LD	(PLSTOP),A
	JR	NZ,BS6010
;
;;	LD	A,PINDR1
;;	LD	(PLMODE),A	; Goto next room !
;;;
;;	XOR	A
;;	LD	(SBHR),A
;;	LD	(SBCNT),A
	CALL	NXGOTO
;
	CALL	ENCLER
;
	LD	A,$3
	LD	(PLCMKI),A
BS6010
	RET
;
;
;
;	CALL	ENSTCK
;;
;	CALL	LDTIM0
;	CP	$2
;	JR	NZ,BSM008
;;
;	LD	A,$24
;	CALL	MSGCHK
;	RET
;BSM008
;	CP	$00
;	JR	NZ,BSM010
;;
;	LD	A,PINDR1
;	LD	(PLMODE),A	; Goto next room !
;;
;	XOR	A
;	LD	(SBHR),A
;	LD	(SBCNT),A
;;
;	CALL	ENCLER
;;
;	LD	A,$3
;	LD	(PLCMKI),A
;BSM010
;	RET
;===========================================
BS7000
	CALL	LDTIM0
	JR	Z,BS7020
;
	AND	%00000010
	LD	A,$10
	JR	NZ,BS7010
	LD	A,$F0
BS7010
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),A
	CALL	ENXCLC
;
	LD	HL,ENLIFE
	ADD	HL,BC
	LD	(HL),$10
;
	RET
;
BS7020
	CALL	ENHNSB
;
	CALL	ENMVCL
	CALL	ENBGCK
	CALL	CREPKE
	CALL	SBPTST
;
	LD	A,(FRCNT)
	AND	$01
	JR	NZ,BS7021
;
	LD	A,$10
	CALL	MOSUB
BS7021
	LD	A,(FRCNT)
	AND	%00000111
	JR	NZ,BS7030
;
	LD	A,KWUSO
	LD	E,ENNO-5
	CALL	ENIDSH2
	JR	C,BS7030
;
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	A,(WORK0)
	LD	(HL),A
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	A,(WORK1)
	LD	(HL),A
;
	LD	A,(WORK2)
	LD	HL,ENMUKI
	ADD	HL,DE
	LD	(HL),A
;
	LD	HL,ENSTAT
	ADD	HL,DE
	LD	(HL),$07
;
	LD	HL,ENTIM0
	ADD	HL,DE
	LD	(HL),$40
BS7030
	RET
;==========================================
BS8000
	CALL	MKPTST
	CALL	LDTIM0
	JP	Z,ENCLER
	RET
;==========================================
BS9000
	CALL	LDTIM0
	JR	NZ,BS9010
;
	LD	(HL),$20
;
	LD	A,$2D
	CALL	MSGCHK	; Doubutsuwo...
;
	LD	HL,ENSTAT
	ADD	HL,BC
	LD	(HL),$05
BS9010
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%				 %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ENITXS	
	DB	$10,$12,$13,$14
	DB	$F0,$EE,$EF,$ED
	DB	$10,$13,$12,$14
	DB	$08,$EF,$EE,$F0
	DB	$14,$13,$12,$10
	DB	$ED,$E8,$EE,$F0
	DB	$ED,$EF,$E8,$F0
	DB	$10,$12,$10,$11
ENITYS	
	DB	$14,$13,$12,$10
	DB	$ED,$EF,$EE,$F0
	DB	$ED,$E2,$EE,$E6
	DB	$10,$12,$16,$11
	DB	$10,$12,$13,$14
	DB	$F0,$EE,$EF,$ED
	DB	$10,$13,$16,$14
	DB	$ED,$E4,$E6,$F0
ENMAIN
	LD	HL,ENMODE
	ADD	HL,DE
	LD	A,(HL)
	AND	A
	JR	NZ,ENM000
;--- INITIAL - - -
	INC	A
	LD	(HL),A
;
	LD	HL,ENITXS
	ADD	HL,DE
	PUSH	HL
	POP	BC
;
	LD	HL,ENXSPD
	ADD	HL,DE
	LD	A,(BC)
	LD	(HL),A
;
	LD	HL,ENITYS
	ADD	HL,DE
	PUSH	HL
	POP	BC
;
	LD	HL,ENYSPD
	ADD	HL,DE
	LD	A,(BC)
	LD	(HL),A
;
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	A,$50
	LD	(HL),A
;
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	A,$30
	LD	(HL),A
ENM000	
	CALL	ENMVCL
;
	CALL	ENBGCK
;
	CALL	ENCSET
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
;
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ENBGCK
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	A,(HL)
	CP	$8
	JR	C,EBCK10
	CP	$91
	JR	NC,EBCK10
;
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	A,(HL)
	CP	$8
	JR	C,EBCK20
	CP	$81
	JR	NC,EBCK20
	RET
;-------------------------------------------
EBCK10				; X Cross !
	LD	HL,ENXSPD
	ADD	HL,DE
	LD	A,(HL)
	CPL
	INC	A
	LD	(HL),A
	RET
EBCK20
	LD	HL,ENYSPD
	ADD	HL,DE
	LD	A,(HL)
	CPL
	INC	A
	LD	(HL),A
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ENCSET	
	LD	B,D	;(0)
;
	LD	HL,ENOAM
;
	LD	C,E
	SLA	C
	SLA	C
	ADD	HL,BC
	PUSH	HL
	POP	BC
;
	LD	HL,ENYPSL
	ADD	HL,DE
	LD	A,(HL)
	ADD	A,$10
	LD	(BC),A		; YPOS
	INC	BC
;
	LD	HL,ENXPSL
	ADD	HL,DE
	LD	A,(HL)
	ADD	A,$08
	LD	(BC),A		; XPOS
	INC	BC
;
	LD	A,$00
	ADD	A,E
	LD	(BC),A		; CHR NO.
	INC	BC
;
	LD	A,$0 
	LD	(BC),A		; ATR.
;
ECRET
	RET
;----------------------------------------------------------------------
BBOMAD
	DB	$F8,$F0,$E8,$E0,$D8,$D0,$C8
BOMBOMV
	LD	DE,BOMBRCD
	CALL	EN1CST
;
	LD	HL,ENCONT
	ADD	HL,BC
	LD	A,(HL)
	AND	$3F
	LD	E,A
	LD	D,B ;$00
	LD	HL,XMVBUF
	ADD	HL,DE
	LD	A,(ENSVXL)
	LD	(HL),A
	LD	HL,YMVBUF
	ADD	HL,DE
	LD	A,(ENDSYP)
	LD	(HL),A
;
	LD	E,$07
	LD	D,$00
;
BBOM10
	PUSH	DE
;
	LD	HL,BBOMAD-1
	ADD	HL,DE
	LD	A,(HL)
;
	LD	HL,ENCONT
	ADD	HL,BC
	ADD	A,(HL)
	AND	$3F
	LD	E,A
	LD	D,B ;$00
	LD	HL,XMVBUF
	ADD	HL,DE
	LD	A,(HL)
	LD	(ENSVXL),A
	LD	HL,YMVBUF
	ADD	HL,DE
	LD	A,(HL)
	LD	(ENDSYP),A
;
	LD	DE,BOMBRCD
	CALL	EN1CST
;
	POP	DE
	DEC	E
;
	JR	NZ,BBOM10
;
	CALL	ENSTCK
;
	LD	HL,ENCONT
	ADD	HL,BC
	INC	(HL)
;
	CALL	YMVSUB
	XOR	A
	LD	HL,ENCHPT
	ADD	HL,BC
	LD	(HL),A
	RET
;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;%						       %
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
STESQCD
	DB	$50,$10
STESBCD
	DB	$70,$10,$70,$30
;
STESTMV
	LD	DE,BOSS1CD
	CALL	EN2CST
;
	LD	HL,ENWRK0
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JP	NZ,S20000
;
	LD	A,(ENSTAT2)
	RST	0
	DW	ST1000
	DW	ST2000
	DW	ST3000
	DW	ST4000
;
;=========================================
S20000
	LD	A,(ENSTAT2)
	RST	0
	DW	S21000
	DW	S22000
	DW	S23000
	DW	S24000
;-----------------------------------------
S21000
	CALL	ENMVCL
;
	CALL	LDTIM0
	JR	NZ,S21010
;
	LD	(HL),$80
	CALL	STATINC
S21010
	LD	A,(FRCNT)
	LD	HL,ENCHPT
	ADD	HL,BC
	RRA
	RRA
	RRA
	AND	%00000001
	ADD	A,$04
	LD	(HL),A
	RET
;-----------------------------------------
S22000
	CALL	LDTIM0
	JR	NZ,S22008
;
	LD	(HL),$20
	CALL	STATINC
	RET
S22008
	CP	$40
	JR	NC,S22010
;
	CALL	SQUEST
S22010
	RET
;-----------------------------------------
S23000
	CALL	LDTIM0
	JR	NZ,S23010
;
	CALL	STATINC
	LD	A,$10
	LD	(ENXSPD+$0E),A
S23010
	RET
;-----------------------------------------
S24000
	LD	A,(FRCNT)
	AND	%00011000
	JR	Z,S24010
;
	XOR	A
	LD	(ENCHPT2),A
;
	LD	A,(ENDSYP)
	SUB	$06
	LD	(ENDSYP),A
;
	LD	DE,STESBCD
	CALL	EN2CST
;
S24010
	CALL	ENMVCL
	CALL	STWKST
	RET
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;-----------------------------------------
ST1000
	LD	HL,ENTIM3
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	NZ,STT190
;
	CALL	LDTIM0
	LD	(HL),$50
;
	CALL	STATINC
;
;;	RET
;
	LD	A,STEST
	CALL	ENIDSH
;
	LD	A,$A8
	LD	(ENXPSL+$0E),A
	LD	A,$68
	LD	(ENYPSL+$0E),A
	LD	A,$F8
	LD	(ENXSPD+$0E),A
	LD	(ENWRK0+$0E),A
;
	LD	A,$40
	LD	(ENTIM0+$0E),A
SBPTST2
STT190
	LD	A,(FRCNT)
	LD	HL,ENCHPT
	ADD	HL,BC
	RRA
	RRA
	RRA
	AND	%00000001
	LD	(HL),A
;
	RET
;=============================
ST2000
	CALL	LDTIM0
	JR	NZ,ST2010
;
	LD	(HL),$80
;
	CALL	STATINC
ST2010
	CALL	SBPTST2
	RET
;=============================
ST3000
	LD	HL,ENCHPT
	ADD	HL,BC
	LD	(HL),$06
;
	CALL	LDTIM0
	JR	NZ,ST3010
;
	CALL	STATINC
	RET
ST3010
	CP	$40
	JR	NC,ST3020
;
SQUEST
	LD	A,(ENDSYP)
	SUB	$11
	LD	(ENDSYP),A
;
	LD	A,$00
	LD	(ENCHPT2),A
;
	LD	DE,STESQCD
	CALL	EN1CST
ST3020
	RET
;
;=============================
ST4000
	LD	HL,ENXSPD
	ADD	HL,BC
	LD	(HL),$10
	CALL	ENMVCL
;
STWKST
	LD	A,(FRCNT)
	LD	HL,ENCHPT
	ADD	HL,BC
	RRA
	RRA
	AND	%00000001
	ADD	A,$6
	LD	(HL),A
	RET
;=============================
;###############################################
;#					       #
;###############################################
BUMERCD
	DB	$38,$10,$38,$30
	DB	$A4,$10,$FF,$FF
	DB	$38,$50,$38,$70
	DB	$FF,$FF,$A4,$30
BUMERMV
	LD	A,$1
	LD	(BUMEFG),A
;
	LD	DE,BUMERCD
	CALL	EN2CST
;
	CALL	ENSTCK
;
	LD	A,(FRCNT)
	AND	$3
	JR	NZ,BRM010
;
	LD	HL,ENCHPT
	ADD	HL,BC
	LD	A,(HL)
	INC	A
	AND	$3
	LD	(HL),A
BRM010
	LD	A,$08
	LD	(ATCKNO),A
	CALL	CRENEN
;
	CALL	ENMVCL
	CALL	ENBGCK2
;
	CALL	RODSUB	;草とか当たりチェック！
;
;;	LD	HL,ENTIM0
;;	ADD	HL,BC
;;	LD	A,(HL)
	CALL	LDTIM0
;;	AND	A
	JR	Z,BRM080
;
	LD	HL,ENCBFG
	ADD	HL,BC
	LD	A,(HL)
	AND	A
	JR	Z,BRM030
;============================================
BUMERT
	PUSH	DE

;;	LD	HL,ENTIM0
;;	ADD	HL,BC
	CALL	LDTIM0
	XOR	A
	LD	(HL),A
;
	LD	A,$20
	CALL	PSERCH	;2
	POP	DE
BRM030
	RET
;- - Return player - - -
BRM080
;	LD	A,(FRCNT)
;	AND	$03
;	JR	NZ,BRM090
;
	LD	A,$20
	CALL	PSERCH	;2
;
	CALL	CRENPL
	JR	NC,BRM090
;
	CALL	ENCLER
BRM090
	RET
;------------------------------------------
;	LD	HL,ENYSPD
;	ADD	HL,BC
;	LD	A,(WORK0)
;	CALL	BRMSUB
;;
;	LD	HL,ENXSPD
;	ADD	HL,BC
;	LD	A,(WORK1)
;BRMSUB
;	SUB	(HL)
;	AND	%10000000
;	LD	A,(HL)
;	JR	NZ,BRM088
;
;	ADD	A,$2
;BRM088
;	SUB	$1
;	LD	(HL),A
;	RET
 