;*******************************
;* STAGE5 MAP DATA
;* LCD LINE0 DATA
;* LCD LINE1 DATA
;* LCD LINE2 DATA
;* LCD LINE3 DATA
;* EVENT NO
;*  EVENT NO &HFF - BOSS STAGE
;*******************************

INIT_DATA_STAGE5:
; INITIAL DATA(18POINT)
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,00,01,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,02,00,00,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,00,00,00
DB 00,00,01,00,00

STAGE5_MAP:
DB 00,00,00,00,00;READY,ERASE
DB 00,00,00,00,00;START,ERASE
DB 00,00,00,00,00;READY START DISPLAY END
DB 00,00,00,00,00;GAME START
;
DB 00,00,00,00,0
DB 00,00,00,00,1
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,&HF1
DB 01,00,00,00,2
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,3
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,02,00,1
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,03,00,00,&HF1
DB 00,00,00,00,2
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,3
;機雷原
DB 00,00,00,00,0
DB 01,00,00,00,0
DB 00,00,00,00,4
DB 00,00,03,00,5
DB 00,00,00,00,6
DB 00,00,00,00,7
DB 00,00,00,00,8
DB 00,03,00,00,9
DB 00,00,00,00,4
DB 00,00,00,03,5
DB 01,00,00,00,6
DB 01,00,00,00,7
DB 00,00,00,00,8
DB 00,00,00,00,9
DB 00,02,00,00,0
DB 00,00,00,00,0
DB 00,00,02,00,0
DB 00,02,00,00,0
DB 00,00,00,00,0
DB 00,00,02,00,0
;
DB 00,00,00,00,&HF0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,01,0
DB 00,00,00,00,0
DB 00,00,00,00,15
DB 00,00,00,00,15
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,&HF0
DB 00,02,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,15
DB 00,00,00,00,15
;
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,01,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,13
DB 00,00,00,00,0
DB 00,02,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,03,00,14
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,02,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,01,00,13
DB 00,00,00,01,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 03,00,00,00,0
DB 00,00,00,00,17
DB 00,00,00,00,14
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,02,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
;霧
DB 00,17,03,00,0
DB 17,00,00,00,0
DB 00,01,00,00,0
DB 00,00,00,17,0
DB 17,00,00,00,0
DB 00,19,19,19,0
DB 20,16,16,16,0
DB 16,16,18,16,0
DB 16,18,16,16,0
DB 16,16,16,16,0
DB 16,16,16,16,0
DB 16,18,16,16,0
DB 16,16,16,16,0
DB 16,16,16,16,0
DB 16,16,18,16,&HF1
DB 16,16,16,16,0
DB 16,16,16,16,0
DB 22,16,16,23,0
DB 00,24,24,00,0
DB 00,00,00,00,0
DB 00,00,00,17,16
;
DB 00,00,00,01,0
DB 00,00,00,00,0
DB 00,02,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,02,00,0
DB 03,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,01,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,03,00,0
DB 00,00,00,00,0
;
;森
DB 14,00,00,00,0
DB 15,00,00,04,0
DB 12,00,00,05,0
DB 13,11,10,06,0
DB 00,00,00,07,0
DB 14,00,00,08,0
DB 15,00,00,09,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,0
DB 14,00,00,00,0
DB 15,00,00,00,0
DB 00,00,00,00,0
DB 00,00,00,00,&HF2
DB 00,00,00,04,0
DB 12,00,00,05,0
DB 13,11,10,06,0
DB 00,00,00,07,0
DB 00,00,00,08,0
DB 00,00,00,09,0
DB 12,00,00,05,0
DB 13,11,10,06,0
DB 12,00,00,07,0
DB 13,11,10,06,0
DB 00,00,00,07,0
DB 00,00,00,08,0
DB 00,00,00,04,0
DB 12,00,00,05,0
DB 13,11,10,06,0
DB 00,00,00,07,0
DB 14,00,00,08,0
DB 15,00,00,09,0
DB 00,00,00,07,0
DB 00,00,00,08,0
DB 00,00,00,09,0
DB 12,00,00,05,0
DB 13,11,10,06,0
DB 00,00,00,07,0
DB 00,00,00,08,0
DB 00,00,00,09,0
DB 00,00,00,05,0
DB 00,00,00,07,0
DB 14,00,00,07,0
DB 15,00,00,09,0
DB 00,00,00,05,0
DB 00,00,00,04,0
DB 15,00,00,07,0
DB 00,00,00,08,0
DB 14,00,00,07,0
DB 13,11,10,06,0
DB 00,00,00,09,&HFF;BOSS

;******************************************************
;*              STAGE5 MAP CHARACTOR
;******************************************************
STAGE5_MAP_CHARA:
MAP5_CHR00:DB 0,0,0,0,0,0,0,0 ;無地背景
MAP5_CHR01:DB &H00,&H00,&H20,&H00,&H00,&H00,&H00,&H00 ;STAR1
MAP5_CHR02:DB &H00,&H00,&H00,&H00,&H00,&H00,&H04,&H00 ;STAR2
MAP5_CHR03:DB &H00,&H00,&H20,&H00,&H00,&H04,&H00,&H00 ;STAR3
MAP5_CHR04:DB &H54,&HAA,&H52,&HA4,&H52,&HA9,&H51,&HAA;TREE_1-1
MAP5_CHR05:DB &H44,&HA2,&H49,&HA1,&H55,&HAA,&H41,&HAA;TREE_2-1
MAP5_CHR06:DB &H55,&HA9,&H55,&HAA,&H40,&H12,&H45,&HA9;TREE_3-1
MAP5_CHR07:DB &H52,&HA9,&H52,&HA9,&H55,&HAA,&H51,&HA6;TREE_4-1
MAP5_CHR08:DB &H54,&HA8,&H44,&HAA,&H51,&HAA,&H51,&HAA;TREE_5-1
MAP5_CHR09:DB &H42,&HA4,&H52,&HA4,&H52,&HA4,&H68,&HD0;TREE_6-1
MAP5_CHR10:DB &H01,&H7E,&H80,&H00,&H38,&H80,&HFF,&H00;TREE_4-2
MAP5_CHR11:DB &H00,&HFF,&H00,&H40,&H02,&H00,&H7F,&H80;TREE_4-3
MAP5_CHR12:DB &H00,&H00,&H00,&H00,&H00,&H00,&H01,&H06;TREE_3-4
MAP5_CHR13:DB &HF8,&H01,&H04,&H10,&H04,&HE1,&H1E,&H01;TREE_4-4
MAP5_CHR14:DB &H3E,&H15,&H2E,&H55,&H2A,&H35,&H3A,&H56;BUSH_1
MAP5_CHR15:DB &H2D,&H56,&H29,&H56,&H3A,&H15,&H2A,&H1C;BUSH_2
MAP5_CHR16:
DB &HAA,&H55,&HAA,&H55,&HAA,&H55,&HAA,&H55;SMOKESCREEN
MAP5_CHR17:DB &H20,&H54,&H2A,&H54,&H2A,&H54,&H28,&H00;SMOKESCREEN_ONE
MAP5_CHR18:DB &HAA,&H55,&H82,&H41,&HA2,&H41,&H8A,&H55;SMOKESCREEN_HOLE
MAP5_CHR19:DB &H00,&H00,&H00,&H00,&H00,&H00,&H2A,&H55;SMOKESCREEN_LEND
MAP5_CHR20:DB &H00,&H80,&H50,&HA8,&H54,&HAA,&H55,&HAA;SMOKESCREEN_LUEND
MAP5_CHR21:DB &H00,&H01,&H0A,&H15,&H2A,&H55,&HAA,&H55;SMOKESCREEN_LAEND
MAP5_CHR22:DB &HAA,&H55,&HAA,&H54,&HA8,&H50,&H80,&H00;SMOKESCREEN_RUEND
MAP5_CHR23:DB &H55,&HAA,&H55,&H2A,&H15,&H0A,&H01,&H00;SMOKESCREEN_RAEND
MAP5_CHR24:DB &H55,&H2A,&H00,&H00,&H00,&H00,&H00,&H00;SMOKESCREEN_REND


;******************************************************
;*              STAGE5 ENEMY CHARACTOR
;******************************************************


;U-TURN
CHR_ST5_01:DB &HE7,&HBD,&HFF,&H66,&H66,&HFF,&HBD,&HE7
;MISSILE-SHIP
CHR_ST5_02:DB &HDB,&HA5,&HBD,&HA5,&HE7,&HBD,&HFF,&HE7
;NOT-CHNGE
CHR_ST5_03:DB &H42,&HFF,&HDB,&H7E,&H66,&HDB,&HDB,&HFF;NOT-CHNGE
CHR_ST5_04:DB &H7E,&HBD,&HDB,&HE7,&HE7,&HDB,&HBD,&H7E;NOT-CHNGE
;BACK-ATTACK
CHR_ST5_05:DB &HE7,&HBD,&H99,&H81,&HDB,&H42,&HE7,&H7E
;BF-SPEAR
CHR_ST5_06:DB &H24,&H7E,&H81,&HE7,&H24,&H66,&H81,&HFF
CHR_ST5_06_SMALL:;これはCPRINTで処理するためSUPER GPRINTに登録しない
DB &H00,&H7C,&H44,&H28,&H44,&H38,&H00,&H00
;機雷敷設機
CHR_ST5_07:DB &HE7,&HA5,&HA5,&HA5,&HBD,&HBD,&HE7,&H3C
;機雷
CHR_ST5_08:DB &H60,&H90,&H90,&H60,&H00,&H00,&H00,&H00

;キャノン砲;40*16
;キャノン砲はCPRINT_ORで表示するのでSGPRINTの登録は行わない
CHR_CANON_01:;8*8
DB &H18,&H18,&H18,&H18,&H18,&H18,&H18,&H18
CHR_CANON_02:;16*8
DB &H00,&H3C,&H18,&H34,&H34,&H24,&H2C,&H2C
DB &H2C,&H2C,&H2C,&H2C,&H24,&H18,&H3C,&H00
CHR_CANON_03:;24*8
DB &H00,&H00,&H3C,&H42,&H3C,&H7A,&H5A,&H4A
DB &H7E,&H4E,&H4E,&H66,&H46,&H46,&H4E,&H46
DB &H6E,&H66,&H4A,&H3C,&H56,&H7E,&H00,&H00
CHR_CANON_04:;32*8
DB &H00,&H00,&H00,&H7E,&H81,&H7E,&H81,&HDB
DB &HB9,&HA9,&HDF,&H8D,&HED,&HAD,&HE5,&HA5
DB &HA5,&HAD,&HA5,&HA5,&HA5,&HA5,&HED,&HC5
DB &H89,&H83,&H5E,&H95,&HFF,&H00,&H00,&H00
CHR_CANON_05:;32*16
DB &H0F,&H10,&H0F,&H10,&H08,&H1B,&H16,&H15,&H14,&H1B,&H11,&H1D
DB &H15,&H15,&H1C,&H14,&H14,&H14,&H14,&H14,&H1C,&H14,&H14,&H1C
DB &H14,&H18,&H10,&H11,&H12,&H0A,&H12,&H1F,&HF0,&H08,&HF0,&H08
DB &H50,&HD8,&HC8,&H48,&H48,&H78,&H68,&H68,&H68,&H68,&HA8,&H28
DB &H28,&H68,&HA8,&HA8,&HE8,&HA8,&HA8,&H68,&H28,&H28,&H48,&H98
DB &H20,&HF0,&HA8,&HF8
CHR_CANON_06:;40*16
DB &H00,&H00,&H1F,&H20,&H1F,&H20,&H17,&H18,&H3B,&H2A,&H29,&H24
DB &H33,&H21,&H2D,&H35,&H25,&H2D,&H2C,&H2C,&H2C,&H2C,&H2C,&H2C
DB &H34,&H24,&H2C,&H24,&H3C,&H24,&H38,&H20,&H21,&H12,&H0A,&H12
DB &H2A,&H3F,&H00,&H00,&H00,&H00,&HF8,&H04,&HF8,&H04,&HC8,&H48
DB &HCC,&HC4,&H44,&H44,&H7C,&H54,&H54,&H54,&H54,&H54,&H94,&H14
DB &H14,&H54,&HB4,&HB4,&HB4,&HF4,&HB4,&HB4,&H54,&H14,&H14,&H64
DB &HAC,&HF8,&H10,&HF8,&HB4,&HFC,&H00,&H00
CHR_CANON_07:;40*16
DB &H7F,&H80,&H7F,&H80,&H83,&H44,&H49,&HCA,&H8A,&H89,&H84,&HC3
DB &HA0,&H9C,&HA4,&HC4,&H8C,&H94,&H94,&H94,&H94,&H94,&H94,&H94
DB &H8C,&HC4,&HA4,&H9C,&H84,&HFC,&H8C,&HD0,&HA0,&HA9,&HAA,&H62
DB &H22,&H62,&HA2,&HFF,&HFE,&H01,&HFE,&H01,&HC1,&H22,&H92,&H53
DB &H51,&H91,&H11,&HA7,&HA5,&HA5,&HA5,&HA5,&HA5,&HA5,&H45,&H05
DB &H05,&H45,&HA5,&HA5,&HE5,&HA5,&HE5,&HA5,&HA5,&H45,&H05,&H05
DB &H79,&HAB,&HAA,&HEE,&H0C,&HEE,&HAD,&HFF

CHR_CANON_PA:DB	&H00,&H00,&H00,&H00,&H3F,&H7F,&HFF,&HFF
CHR_CANON_PU:DB	&H00,&H00,&H00,&H00,&HFC,&HFE,&HFF,&HFF

CHR_CANON_FIRE:
DB &H7F,&HDF,&HFF,&HFD,&HEF,&H7F,&H37,&H15
DB &HFE,&HFF,&HDF,&HFB,&HFF,&HBE,&HF4,&H50

;******************************************************
;*              STAGE5 BOSS CHARACTOR
;******************************************************
CHR_BOSS5:;16*24
CHR_BOSS5_1_1:DB &H01,&H7F,&HD7,&HB0,&HD0,&HB0,&HDF,&HA4
CHR_BOSS5_2_1:DB &HD9,&HAE,&HD5,&HAA,&HD5,&H6A,&H35,&H0F
CHR_BOSS5_1_2:DB &HF3,&HEC,&HAC,&H2C,&H6C,&HCF,&H15,&H6A
CHR_BOSS5_2_2:DB &HD5,&HAA,&H55,&HAB,&H50,&H80,&H80,&H80
CHR_BOSS5_1_3:DB &HF6,&H13,&H09,&H3F,&HFF,&HBE,&H5E,&HAB
CHR_BOSS5_2_3:DB &H55,&HAB,&H55,&HAA,&HD6,&HEA,&H95,&H8E

CHR_BOSS5_WO1:;8*16
DB &H41,&H81,&H01,&H02,&H04,&H08,&H10,&HE0
CHR_BOSS5_WO2:
DB &H03,&H0E,&H1D,&H3A,&H34,&H28,&H30,&H0F

CHR_BOSS5_WC1:;8*16
DB &H7F,&HD5,&HAA,&HD5,&HAA,&H7F,&H00,&H00
CHR_BOSS5_WC2:;8*16
DB &HF0,&H58,&HB0,&H60,&HC0,&H00,&H00,&H00

CHR_BOSS5_WING:;8*8
DB &H60,&HF0,&HD0,&H90,&H90,&H50,&H60,&H40

CHR_BOSS5_BEAM_U:;8*8
DB &H7F,&H80,&H80,&H7F,&H00,&H00,&H00,&H00

CHR_BOSS5_BEAM_C:;8*8
DB &HFF,&H00,&H00,&HFF,&H00,&H00,&H00,&H00

CHR_BOSS5_BEAM_L:;8*8
DB &HFE,&H01,&H01,&HFE,&H00,&H00,&H00,&H00


;******************************************************
;*              STAGE5 SENARIO INITIALIZE
;******************************************************
STAGE_5_INIT:
PRE IX,BASE_SENARIO_PTR
LDW $0,SCENARIO
STW $0,(IX+$31)

PRE IX,SCENARIO
LDW $0,ST5_SCENARIO_00 ;DUMMY
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_01
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_02
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_03
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_04
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_05
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_06
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_07
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_08
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_09
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_10
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_11
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_12
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_13
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_14
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_15
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_16
STIW $0,(IX+$31)
LDW $0,ST5_SCENARIO_17
STIW $0,(IX+$31)
;シナリオを追加する場合はここを修正(MAX64POINT)
RTN

;**********************************
;*    STAGE5 SCENARIO DATA
;*      (9BYTE:MAX64POINT)
;* 1:TIMING(出現タイミング+カウント(今回は1ドットスクロールなので0～7))
;* 2:ENEMY NO
;* 3:X
;* 4:Y
;* 5:LENGTH-X
;* 6:LENGTH-Y
;* 7:FREE
;* 8:FREE
;* 9:EXTRA
;* 10～18：0で自動初期化
;*
;*注意:1 必ず9BYTE定義すること
;*注意:2 10～18バイト目は自動的に0で初期化される
;*
;**********************************
ST5_SCENARIO_00: ;出現しない
ST5_SCENARIO_01:
DB 0,10,136,08,8,8,4,0,&H00,1,1
DB 0,10,136,24,8,8,4,0,&H00,1,1
DB 2,10,136,08,8,8,4,0,&H00,1,1
DB 2,10,136,24,8,8,4,0,&H00,1,1
DB 4,10,136,08,8,8,4,0,&H00,1,1
DB 4,10,136,24,8,8,4,0,&H00,1,1
DB 6,10,136,08,8,8,4,0,&H00,1,1
DB 6,10,136,24,8,8,4,0,&H00,1,1
DB &HFF ;END CODE

ST5_SCENARIO_02:
DB 0,11,136,32,8,8,4,0,&H00,1,1
DB 0,11,136,16,8,8,4,0,&H00,1,1
DB 2,11,136,32,8,8,4,0,&H00,1,1
DB 2,11,136,16,8,8,4,0,&H00,1,1
DB 4,11,136,32,8,8,4,0,&H00,1,1
DB 4,11,136,16,8,8,4,0,&H00,1,1
DB 6,11,136,32,8,8,4,0,&H00,1,1
DB 6,11,136,16,8,8,4,0,&H00,1,1
DB &HFF ;END CODE

ST5_SCENARIO_03:
DB 0,12,100,00,8,8,11,0,&H00,1,1
DB 0,13,116,40,8,8,11,0,&H00,1,1
DB 4,12,100,00,8,8,03,0,&H00,1,1
DB 4,13,116,40,8,8,03,0,&H00,1,1
DB &HFF ;END CODE

ST5_SCENARIO_04:;機雷原1
DB 0,14,136,12,4,4,11,0,&H00,1,1
DB 2,14,136,36,4,4,11,0,&H00,1,1
DB 4,14,136,22,4,4,11,0,&H00,1,1
DB 6,14,136,16,4,4,11,0,&H00,1,1
DB &HFF ;END CODE

ST5_SCENARIO_05:;機雷原2
DB 0,14,136,34,4,4,11,0,&H00,1,1
DB 2,14,136,14,4,4,11,0,&H00,1,1
DB 4,14,136,20,4,4,11,0,&H00,1,1
DB 6,14,136,30,4,4,11,0,&H00,1,1
DB &HFF ;END CODE

ST5_SCENARIO_06:;機雷原3
DB 0,14,136,14,4,4,11,0,&H00,1,1
DB 2,14,136,26,4,4,11,0,&H00,1,1
DB 4,14,136,36,4,4,11,0,&H00,1,1
DB 6,14,136,18,4,4,11,0,&H00,1,1
DB &HFF ;END CODE

ST5_SCENARIO_07:;機雷原4
DB 0,14,136,28,4,4,11,0,&H00,1,1
DB 2,14,136,12,4,4,11,0,&H00,1,1
DB 4,14,136,34,4,4,11,0,&H00,1,1
DB 6,14,136,10,4,4,11,0,&H00,1,1
DB &HFF ;END CODE

ST5_SCENARIO_08:;機雷原5
DB 0,14,136,18,4,4,11,0,&H00,1,1
DB 2,14,136,26,4,4,11,0,&H00,1,1
DB 4,14,136,16,4,4,11,0,&H00,1,1
DB 6,14,136,30,4,4,11,0,&H00,1,1
DB &HFF ;END CODE

ST5_SCENARIO_09:;機雷原6
DB 0,14,136,22,4,4,11,0,&H00,1,1
DB 2,14,136,14,4,4,11,0,&H00,1,1
DB 4,14,136,26,4,4,11,0,&H00,1,1
DB 6,14,136,12,4,4,11,0,&H00,1,1
DB &HFF ;END CODE

ST5_SCENARIO_10:
DB &HFF ;END CODE

ST5_SCENARIO_11:
DB &HFF ;END CODE

ST5_SCENARIO_12:
DB &HFF ;END CODE

ST5_SCENARIO_13:;BF-SPEAR1
;($14:0:上/1※反転後はCOUNTER(3))
;($15:TYPE)
DB 0,2,0,08,8,8,0,0,&H00,1,1;上
DB 0,2,0,24,8,8,1,1,&H00,1,1;下
DB 2,2,0,24,8,8,0,2,&H00,1,1;上
DB 2,2,0,16,8,8,1,0,&H00,1,1;下
DB 4,2,0,12,8,8,0,1,&H00,1,1;上
DB 4,2,0,34,8,8,1,2,&H00,1,1;下
DB 6,2,0,24,8,8,0,0,&H00,1,1;上
DB 6,2,0,18,8,8,1,1,&H00,1,1;下
DB &HFF ;END CODE
ST5_SCENARIO_14:;BF-SPEAR2
;($14:0:上/1※反転後はSECTION)
;($15:U-4BIT=3 L-4BIT=TYPE)
DB 0,2,0,16,8,8,0,2,&H00,1,1;上
DB 0,2,0,22,8,8,1,0,&H00,1,1;下
DB 2,2,0,34,8,8,0,1,&H00,1,1;上
DB 2,2,0,32,8,8,1,2,&H00,1,1;下
DB 4,2,0,20,8,8,0,0,&H00,1,1;上
DB 4,2,0,10,8,8,1,1,&H00,1,1;下
DB 6,2,0,12,8,8,0,2,&H00,1,1;上
DB 6,2,0,28,8,8,1,0,&H00,1,1;下
DB &HFF ;END CODE

ST5_SCENARIO_15:;BACK_ATTACK
DB 0,16,0,08,8,8,0,0,&H00,1,1;上
DB 0,17,0,32,8,8,0,0,&H00,1,1;下
DB 4,16,0,08,8,8,0,0,&H00,1,1;上
DB 4,17,0,32,8,8,0,0,&H00,1,1;下
DB &HFF ;END CODE

ST5_SCENARIO_16:;MINE-SETTER
DB 0,18,60,02,8,8,0,0,&H00,1,1;上
DB 0,19,76,38,8,8,0,0,&H00,1,1;下
DB &HFF ;END CODE

ST5_SCENARIO_17:;キャノン砲
DB 0,01,80,16,40,16,16,0,&H10,100,1
DB &HFF ;END CODE

;シナリオは64まで記述可(MAX64POINT)


;*********************************
;*        ENEMY MOVE
;*
;*********************************
ST5_ENEMY_MOVE:

LD $28,$31

ST5_ENEMYMOVE_LP:
PRE IX,ENEMY_DATA
;
PHU $28
;
LDM $9,(IX+$28),8
SBC $9,$31
JR Z,NEXT_ST5_ENEMY_M
;-------- NO JUDGE(1-7) ------------
SBC $9,1
JR Z,ST5_ENEMY01_MOVE;(出現中のキャノン砲)
SBC $9,2
JR Z,ST5_ENEMY02_MOVE;(背面移動中のBF-SPEAR)
;----------- BULLET(8) -------------
SBC $9,8
JP Z,ST5_ENEMY08_MOVE;BULLET
;---------- BOSS CORE(9) -----------
;---------- NORM(10-255)------------
SBC $9,10
JP Z,ST5_ENEMY10_MOVE;U-TURN ABOVE
SBC $9,11
JP Z,ST5_ENEMY11_MOVE;U-TURN UNDER
SBC $9,12
JP Z,ST5_ENEMY12_MOVE;MISSILE-SHIP ABOVE
SBC $9,13
JP Z,ST5_ENEMY13_MOVE;MISSILE-SHIP UNDER
SBC $9,14
JP Z,ST5_ENEMY14_MOVE;機雷
SBC $9,15
JP Z,ST5_ENEMY15_MOVE;BACK ATTACK UNDER
SBC $9,16
JP Z,ST5_ENEMY16_MOVE;BACK-ATTACK ABOVE
SBC $9,17
JP Z,ST5_ENEMY17_MOVE;BACK-ATTACK UNDER
SBC $9,18
JP Z,ST5_ENEMY18_MOVE;MINE-SETTER ABOVE
SBC $9,19
JP Z,ST5_ENEMY19_MOVE;MINE-SETTER UNDER
SBC $9,20
JP Z,ST5_ENEMY20_MOVE;BF-SPEAR
SBC $9,90
JP Z,ST5_ENEMY90_MOVE;キャノン砲(実体)
SBC $9,91
JP Z,ST5_ENEMY91_MOVE;キャノン砲(実体)が発射した弾

NEXT_ST5_ENEMY_M:
;
PPU $28
;
AD $28,ENEMY_STRUCT

JR NC,ST5_ENEMYMOVE_LP

RTN

ST5_ENEMY01_MOVE:;(出現中のキャノン砲)
SB $14,$30
JP NC,END_ST5ENEMYMOVE
AD $15,$30
SBC $15,8
JR Z,END_ST5_E01_MOVE
LD $14,16;出現時のWAIT=16
JP END_ST5ENEMYMOVE
END_ST5_E01_MOVE:
LD $9,90;実体化
LD $14,32;弾を撃つカウンター初期化
LD $15,$31
JP END_ST5ENEMYMOVE

ST5_ENEMY02_MOVE:;(背面移動中のBF-SPEAR)
AD $10,2
SBC $10,140
JP C,END_ST5ENEMYMOVE
LD $9,20;BF-SPEARの実体化
LD $14,3;COUNTER初期化
JP END_ST5ENEMYMOVE

ST5_ENEMY08_MOVE:;BULLET
CAL MOVE_BULLET
JP NEXT_ST5_ENEMY_M

ST5_ENEMY10_MOVE:
LD $0,2
JR ST5_ENEMYAB_COMN
ST5_ENEMY11_MOVE:
LD $0,&HFE;-2

ST5_ENEMYAB_COMN:

SBC $15,$30
JR Z,ST5_ENEMYAB_PH1
SBC $15,2
JR Z,ST5_ENEMYAB_PH2

ST5_ENEMYAB_PH0:
SB $10,3
SBC $10,14
JP NC,END_ST5ENEMYMOVE
LD $15,$30;PHASE1へ移行
JP END_ST5ENEMYMOVE

ST5_ENEMYAB_PH1:
AD $11,$0
SB $14,$30;COUNTER-=1
JP NZ,END_ST5ENEMYMOVE
LD $15,2;PHASE2へ移行
JP END_ST5ENEMYMOVE

ST5_ENEMYAB_PH2:
AD $10,3
SBC $10,128
JP NC,ST5_KILL_ENEMY
JP END_ST5ENEMYMOVE

ST5_ENEMY12_MOVE:;MISSILE-SHIP ABOVE
LD $0,2
JR ST5_ENEMYCD_COMN
ST5_ENEMY13_MOVE:;MISSILE-SHIP UNDER
LD $0,&HFE;-2

ST5_ENEMYCD_COMN:

SBC $15,$30
JR Z,ST5_ENEMYCD_PH1
SBC $15,2
JR Z,ST5_ENEMYCD_PH2
SBC $15,3
JR Z,ST5_ENEMYCD_PH3
SBC $15,4
JR Z,ST5_ENEMYCD_PH4

ST5_ENEMYCD_PH0:;上下移動
AD $11,$0
SB $14,$30
JP NC,END_ST5ENEMYMOVE
LD $15,$30
LD $14,16
JP END_ST5ENEMYMOVE

ST5_ENEMYCD_PH1:;WAIT
SB $14,$30
JP NC,END_ST5ENEMYMOVE
LD $15,2
JP END_ST5ENEMYMOVE

ST5_ENEMYCD_PH2:;FIRE
LD $5,4
PHU $11
AD $11,4
CAL INSERT_BULLET
PPU $11
LD $14,8
LD $15,3
JP END_ST5ENEMYMOVE

ST5_ENEMYCD_PH3:;WAIT
SB $14,$30
JP NC,END_ST5ENEMYMOVE
LD $14,16
LD $15,4
JP END_ST5ENEMYMOVE

ST5_ENEMYCD_PH4:;上下移動
AD $11,$0
SB $14,$30
JP C,ST5_KILL_ENEMY
JP END_ST5ENEMYMOVE

ST5_ENEMY14_MOVE:;機雷
SB $10,$30
JP NC,END_ST5ENEMYMOVE
JP ST5_KILL_ENEMY

ST5_ENEMY15_MOVE:
SB $10,$30
STM $9,(IX+$28),3
SBC $10,60
JP NC,END_ST5ENEMYMOVE
;ST $31,(IX+$28);KILL_ENEMY
CAL DELETE_OBJECT;自爆する場合は直接DELETE_OBJECTを呼ぶ

LD $5,7;BULLET DIR
PHUW $11
CAL INSERT_BULLET
PPUW $10

LD $5,9;BULLET DIR
PHUW $11
CAL INSERT_BULLET
PPUW $10

LD $5,3;BULLET DIR
PHUW $11
CAL INSERT_BULLET
PPUW $10

LD $5,1;BULLET DIR
CAL INSERT_BULLET
JP NEXT_ST5_ENEMY_M

ST5_ENEMY16_MOVE:;BACK-ATTACK1
SBC $15,$30
JR Z,ST5_ENEMY16_SEC1

ST5_ENEMY16_SEC0:
AD $10,2
PRE IX,MY_X
LD $0,(IX+$31)
SBC $10,$0
JP C,END_ST5ENEMYMOVE
LD $15,$30
JP END_ST5ENEMYMOVE

ST5_ENEMY16_SEC1:
AD $11,$30
SBC $11,40
JP NC,ST5_KILL_ENEMY
JP END_ST5ENEMYMOVE

ST5_ENEMY17_MOVE:;BACK-ATTACK2
SBC $15,$30
JR Z,ST5_ENEMY17_SEC1

ST5_ENEMY17_SEC0:
AD $10,2
PRE IX,MY_X
LD $0,(IX+$31)
SBC $10,$0
JP C,END_ST5ENEMYMOVE
LD $15,$30
JP END_ST5ENEMYMOVE

ST5_ENEMY17_SEC1:
SB $11,$30
JP C,ST5_KILL_ENEMY
JP END_ST5ENEMYMOVE


ST5_ENEMY14_DATA:
DB 14,0,0,4,4,11,0,&H00,1,1

ST5_ENEMY18_MOVE:;MINE-SETTER ABOVE
SBC $15,$31
JR Z,ST5_E18MOVE_SEC0
SBC $15,$30
JR Z,ST5_E18MOVE_SEC1

ST5_E18MOVE_SEC0:
AD $14,$30
SBC $14,3
CAL Z,ST5_E1819_MINE
AD $11,2
SBC $11,36
JP C,END_ST5ENEMYMOVE
LD $15,$30
LD $14,4
JP END_ST5ENEMYMOVE

ST5_E18MOVE_SEC1:
AD $10,2
SBC $10,136
JP NC,ST5_KILL_ENEMY
SB $14,$30
JP NC,END_ST5ENEMYMOVE
LD $9,19
LDW $14,0
JP END_ST5ENEMYMOVE

ST5_ENEMY19_MOVE:;MINE-SETTER UNDER
SBC $15,$31
JR Z,ST5_E19MOVE_SEC0
SBC $15,$30
JR Z,ST5_E19MOVE_SEC1

ST5_E19MOVE_SEC0:
AD $14,$30
SBC $14,3
CAL Z,ST5_E1819_MINE
SB $11,2
SBC $11,4
JP NC,END_ST5ENEMYMOVE
LD $15,$30
LD $14,4
JP END_ST5ENEMYMOVE

ST5_E19MOVE_SEC1:
AD $10,2
SBC $10,136
JP NC,ST5_KILL_ENEMY
SB $14,$30
JP NC,END_ST5ENEMYMOVE
LD $9,18
LDW $14,0
JP END_ST5ENEMYMOVE

ST5_E1819_MINE:
PRE IZ,ST5_ENEMY14_DATA
LDIM $17,(IZ+$31),8
LDM $25,(IZ+$31),2
LD $18,$10;X
AD $18,4
LD $19,$11;Y
AD $19,4
CAL INSERT_OBJECT
LD $14,$31
RTN

ST5_ENEMY20_MOVE:;BF-SPEAR
SB $10,4
JP C,ST5_KILL_ENEMY
SB $14,$30;COOUNTER-=1
JP NC,END_ST5ENEMYMOVE

;SELECT TYPE
SBC $15,$31
JR Z,ST5_ENEMY20_T0
SBC $15,$30
JP Z,END_ST5ENEMYMOVE
ST5_ENEMY20_T2:;(上昇)
SB $11,$30
LD $14,3;COUNTER1 RESET
JP C,ST5_KILL_ENEMY
JR END_ST5ENEMYMOVE
ST5_ENEMY20_T0:;(下降)
AD $11,$30
SBC $11,40
JR NC,ST5_KILL_ENEMY
LD $14,3;COUNTER1 RESET
JR END_ST5ENEMYMOVE


ST5_ENEMY91_DATA:
DB 91,72,16,8,16,0,0,&HFF,0,10

ST5_ENEMY90_MOVE:;キャノン砲
SBC $15,$31
JR Z,ST5_E90MOVE_SEC0;溜め
SBC $15,$30
JR Z,ST5_E90MOVE_SEC1;発射
SBC $15,2
JR Z,ST5_E90MOVE_SEC2;退場

ST5_E90MOVE_SEC0:
SB $14,$30
JR NC,END_ST5ENEMYMOVE
LD $15,$30
LD $14,$31
JR END_ST5ENEMYMOVE

ST5_E90MOVE_SEC1:
PRE IZ,GLOBAL_COUNTER
LD $0,(IZ+$31)
AN $0,&H3
JR NZ,END_ST5ENEMYMOVE

PRE IZ,ST5_ENEMY91_DATA
LDIM $17,(IZ+$31),8
LDM $25,(IZ+$31),2
CAL INSERT_OBJECT
LD $15,2
LD $14,$31
JR END_ST5ENEMYMOVE

ST5_E90MOVE_SEC2:;退場
AD $10,2
SBC $10,130
JR C,END_ST5ENEMYMOVE
JR ST5_KILL_ENEMY

ST5_ENEMY91_MOVE:;キャノン砲が発射した弾
SB $10,5
JP C,ST5_KILL_ENEMY
JR END_ST5ENEMYMOVE


END_ST5ENEMYMOVE:
;DATA SAVE & MAKE JUDGE DATA
PRE IX,ENEMY_DATA
STM $9,(IX+$28),8
JP NEXT_ST5_ENEMY_M

ST5_KILL_ENEMY:
CAL DELETE_OBJECT
JP NEXT_ST5_ENEMY_M

;*********************************
;*        STAGE5 ENEMY DISP
;*********************************
ST5_ENEMY_DISP:

LD $28,$31

ST5_ENEMYDISP_LP:
PRE IX,ENEMY_DATA

LDM $9,(IX+$28),8
SBC $9,$31
JR Z,NEXT_ST5_ENEMY_D
;
PHU $28
;
;GPRINTのRTN命令でRTN_ST5_EDISPに戻れるようにするため、RTN_ST5_EDISPのアドレスを
;SSPにPUSHしておく。
;なおGPRINTからの復帰はRTNでありSSPにスタックされたアドレス+1からプログラムを実行するため
;RTN_ST5_EDISPのアドレスから-1したものをSSPにPUSHする。
LDW $0,RTN_ST5_EDISP-1
PHSW $1

SBC $9,1
JR Z,ST5_ENEMY01_DISP;(出現中のキャノン砲)
SBC $9,2
JP Z,ST5_ENEMY02_DISP;(背面移動中のBF-SPEAR)
SBC $9,8
JR Z,ST5_ENEMY08_DISP;BULLET
SBC $9,10
JP Z,ST5_ENEMY10_DISP;U-TURN ABOVE
SBC $9,11
JP Z,ST5_ENEMY11_DISP;U-TURN UNDER
SBC $9,12
JP Z,ST5_ENEMY12_DISP;MISSILE-SHIP ABOVE
SBC $9,13
JP Z,ST5_ENEMY13_DISP;MISSILE-SHIP UNDER
SBC $9,14
JP Z,ST5_ENEMY14_DISP;機雷
SBC $9,15
JP Z,ST5_ENEMY15_DISP
SBC $9,18
JP C,ST5_ENEMY17_DISP;BACK_ATTACK(ST5_ENEMY16_DISP)
SBC $9,20
JP C,ST5_ENEMY18_DISP;MINE-SETTER(ST5_ENEMY19_DISP)
JP Z,ST5_ENEMY20_DISP;BF-SPEAR
SBC $9,90
JP Z,ST5_ENEMY90_DISP;キャノン砲(実体)
SBC $9,91
JP Z,ST5_ENEMY91_DISP;キャノン砲(実体)が発射した弾

;JUMPしなかった場合はSSPを戻す。
PPSW $0

RTN_ST5_EDISP:
;
PPU $28
;
NEXT_ST5_ENEMY_D:

AD $28,ENEMY_STRUCT

JR NC,ST5_ENEMYDISP_LP

RTN

ST5_ENEMY08_DISP:;BULLET
LDW $13,@CHR_BULLET
#if (USE_LIB=FAST_LIB)
JP SGPRINT_4
#else
LD $12,8
JP GPRINT
#endif

ST5_ENEMY01_DISP:;(背面移動中のBF-SPEAR)
;$14の値(0/1)で表示するY座標(8/32)を決める
SBC $15,1
JR Z,ST5_E1DISP_SEC1
SBC $15,2
JR Z,ST5_E1DISP_SEC2
SBC $15,3
JR Z,ST5_E1DISP_SEC3
SBC $15,4
JR Z,ST5_E1DISP_SEC4
SBC $15,5
JR Z,ST5_E1DISP_SEC5
SBC $15,6
JR Z,ST5_E1DISP_SEC6
SBC $15,7
JR Z,ST5_E1DISP_SEC7

ST5_E1DISP_SEC1:;8*8
AD $10,16
AD $11,4
LD $12,8
LDW $13,CHR_CANON_01
JP GPRINT

ST5_E1DISP_SEC2:;16*8
AD $10,12
AD $11,4
LD $12,16
LDW $13,CHR_CANON_02
JP GPRINT

ST5_E1DISP_SEC3:;24*8
AD $10,8
AD $11,4
LD $12,24
LDW $13,CHR_CANON_03
JP GPRINT

ST5_E1DISP_SEC4:;32*8
AD $10,4
AD $11,4
LD $12,32
LDW $13,CHR_CANON_04
JP GPRINT

ST5_E1DISP_SEC5:;32*16
AD $10,4
PHUW $11
LD $12,32
LDW $13,CHR_CANON_05
CAL CPRINT_OR
PPUW $10
AD $11,8
LD $12,32
LDW $13,CHR_CANON_05+32
JP CPRINT_OR

ST5_E1DISP_SEC6:;40*16
PHUW $11
LD $12,40
LDW $13,CHR_CANON_06
CAL CPRINT_OR
PPUW $10
LD $12,40
AD $11,8
LDW $13,CHR_CANON_06+40
JP CPRINT_OR

ST5_E1DISP_SEC7:;40*16
PHUW $11
LD $12,40
LDW $13,CHR_CANON_07
CAL CPRINT_OR
PPUW $10
AD $11,8
LD $12,40
LDW $13,CHR_CANON_07+40
JP CPRINT_OR


ST5_ENEMY02_DISP:;(背面移動中のBF-SPEAR)
;$14の値(0/1)で表示するY座標(8/32)を決める
LD $11,8
SBC $14,0
JR Z,ST5_ENEMY02_A
LD $11,32
ST5_ENEMY02_A:
LD $12,8
LDW $13,CHR_ST5_06_SMALL
JP CPRINT_OR

ST5_ENEMY10_DISP:;U-TURN ABOVE
LD $12,8
LDW $13,SG_CHR_DATA03
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

ST5_ENEMY11_DISP:;U-TURN UNDER
LD $12,8
LDW $13,SG_CHR_DATA03
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

ST5_ENEMY12_DISP:;MISSILE-SHIP ABOVE
LD $12,8
LDW $13,SG_CHR_DATA04
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

ST5_ENEMY13_DISP:;MISSILE-SHIP UNDER
LD $12,8
LDW $13,SG_CHR_DATA04
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

ST5_ENEMY14_DISP:;機雷
LDW $13,SG_CHR_DATA08
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

ST5_ENEMY15_DISP:
LD $12,8
LDW $13,SG_CHR_DATA13
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

ST5_ENEMY16_DISP:;BACK_ATTACK1
ST5_ENEMY17_DISP:;BACK_ATTACK2
LDW $13,SG_CHR_DATA05
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

ST5_ENEMY18_DISP:;MINE-SETTER ABOVE
ST5_ENEMY19_DISP:;MINE-SETTER UNDER
LDW $13,SG_CHR_DATA07
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

ST5_ENEMY20_DISP:;BF-SPEAR
LDW $13,SG_CHR_DATA06
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

ST5_ENEMY90_DISP:;キャノン砲(実体)
PHUW $15
PHUW $11
LD $12,40
LDW $13,CHR_CANON_07
CAL CPRINT_OR
PPUW $10
PHUW $11
AD $11,8
LD $12,40
LDW $13,CHR_CANON_07+40
CAL CPRINT_OR
PPUW $10
PPUW $14

SBC $15,$31;溜め
RTN NZ

;カウンター($14)の末尾1BIT=ACTIVEなら表示(点灯処理)
ANC $14,$30
RTN Z

PHUW $11
SB $10,8
LD $12,8
LDW $13,CHR_CANON_PA
CAL GPRINT
PPUW $10
SB $10,8
AD $11,8
LD $12,8
LDW $13,CHR_CANON_PU
JP GPRINT

ST5_ENEMY91_DISP:;キャノン砲(実体)が発射した弾
PHUW $11
LD $12,8
LDW $13,CHR_CANON_FIRE
CAL GPRINT
PPUW $10
AD $11,8
LD $12,8
LDW $13,CHR_CANON_FIRE+8
JP GPRINT

;*********************************
;*          BOSS5 INIT
;*  +0($9)  種類(0:未使用フラグ,&H01～&HFF)
;*  +1($10)  x(必須)
;*  +2($11)  y(必須)
;*  +3($12)  キャラのXサイズ
;*  +4($13)  キャラのYサイズ
;*  +5($14)  COUNTER1
;*  +6($15)  COUNTER2
;*  +7($16)  LIFE(Cフラグで破壊)
;*  +8($17)  SCORE
;*  +9($18)  DAMAGE
;**********************************
;NOTE
;
;BOSS5は1つのパーツで構成されている。
;PARTS Noは次のとおり
;
;          999 0
;          9990  <- &H09:CORE
;          999
;
;翼は表示のみで当たり判定はない
;
;動作の際は下記の各パーツのインデックスアドレスを
;直接指定してXを参照、変更している。
;
; 0:ENEMY_DATA_0 = &H09(09):BOSS5 CORE
;
; &H0B(10):拡大ビーム(上)
; &H0C(11):拡大ビーム(中)
; &H0D(12):拡大ビーム(下)
; &H0E(13):翼ミサイル
;
;ENEMY_DATA
;+0 Active Flag/CHARACTOR No(0:NO 1-8:NO JUDGE 9-:NORM)
;+1 X
;+2 Y
;+3 CHARACTOR X SIZE(当たり判定で使用するので必須)
;+4 CHARACTOR Y SIZE(当たり判定で使用するので必須)
;+5 COUNTER1
;+6 COUNTER2
;+7 LIFE
;------------------------------------------
;+8 SCORE
;+9 DAMAGE
;+A～+F FREE

BOSS5_X_ORG:EQU 96
BOSS5_Y_ORG:EQU 12

BOSS5_DATA:
DB 9,96,&HDC,16,24,0,0,&H14,1,10,0,0,0,0,0,0       ;CORE
BOSS5_DATA_END:

BOSS5_DATA_NUM:EQU 1;BOSS5のパーツ数

BOSS5_INIT:

;RXCNT
;ENEMY_DATA初期化
LDW $0,ENEMY_DATA
LDW $2,&H0FF
LDW $28,CLEME
CAL IOCS_CAL

;BOSS COREの位置データ等を転送
PRE IX,BOSS5_DATA
LDIM $17,(IX+$31),8
LDM $25,(IX+$31),2
CAL INSERT_OBJECT

;転送したBOSSデータを実体化する
CAL INSERT_OBJECT_ON

;ボス戦闘中フラグをONにする。
PRE IX,NOW_BOSS_FIGHT
ST $30,(IX+$31)
;ボス破壊フラグをOFFにする。
PRE IX,BOSS_DESTROY
ST $31,(IX+$31)
;ボスのデータ数(BOSS5:1)を設定にする。
PRE IX,BOSS_DATA_NUM
LD $0,BOSS5_DATA_NUM
ST $0,(IX+$31)
;翼を広げたままにするFLAGをOFF(0)にする
PRE IZ,EXTRA_FLAG
ST $31,(IZ+$31)
RTN

;************************************
;*              BOSS5 PRE
;*  (BOSS5 MOVE STANBY POSITION)
;************************************
BOSS5_PRE:

PRE IX,ENEMY_DATA_00;CORE
LD $0,2
LD $10,(IX+$0);BOSS5 CORE Y
AD $10,$30
ST $10,(IX+$0);BOSS5 CORE Y

;BOSS5のY座標が12になったらボス戦に突入
SBC $10,12
RTN NZ
PRE IX,PHASE
LD $0,3
ST $0,(IX+$31) ;PHASE2->3
ST $31,(IX+$30) ;PHASE_COUNTER->0
RTN

;*********************************
;*          MOVE BOSS5
;*
;*USE:
;*      $0      WORK
;*      $2,$3   JUMP TABLE
;*      $9-$16  ENEMY DATA
;*      $28     COUNTER
;*      IX
;*      IZ
;*********************************
MOVE_BOSS5:

LD $28,$31

MOVE_BOSS5_LOOP:
PHU $28
PRE IX,ENEMY_DATA

LDM $9,(IX+$28),8

SBC $9,$31
JR Z,NEXT_MOVE_BOSS5
SBC $9,BOSS_CORE_NO;(9)
JP Z,BOSS5_P09_MOVE;BOSS5 CORE
SBC $9,10
JP Z,BOSS5_P10_MOVE;拡大ビーム(上)
SBC $9,11
JP Z,BOSS5_P11_MOVE;拡大ビーム(中)
SBC $9,12
JP Z,BOSS5_P12_MOVE;拡大ビーム(下)
SBC $9,13
JP Z,BOSS5_P13_MOVE;翼ミサイル

NEXT_MOVE_BOSS5:
PPU $28
AD $28,ENEMY_STRUCT
JR NC,MOVE_BOSS5_LOOP

RTN

BOSS5_P09_MOVE:

;0:待機
;1:上下移動
;2:待機(翼を広げる)
;3:拡大ビーム発射
;4:待機
;5:前移動
;6:待機(翼を広げる)
;7:飛び掛かる
;8:待機
;9:元の位置に戻る
;10:待機
;11:上下移動しながら羽を飛ばす
;12:待機
;13:突撃
;14:元の位置に戻る

PRE IZ,SECTION
LDW $0,(IZ+$31);$0:PHASE $1:PHASE_COUNTER
SBC $0,0
JR Z,BOSS5_P09_SEC0;0:待機
SBC $0,1
JR Z,BOSS5_P09_SEC1;1:上下移動翼ミサイル発射
SBC $0,2
JP Z,BOSS5_P09_SEC2;2:待機(翼を広げる)
SBC $0,3
JP Z,BOSS5_P09_SEC3;3:拡大ビーム発射
SBC $0,4
JP Z,BOSS5_P09_SEC4;4:待機
SBC $0,5
JP Z,BOSS5_P09_SEC5;5:前移動
SBC $0,6
JP Z,BOSS5_P09_SEC6;6:待機(翼を広げる)
SBC $0,7
JP Z,BOSS5_P09_SEC7;7:突撃
SBC $0,8
JP Z,BOSS5_P09_SEC8;8:待機
JP BOSS5_P09_SEC9;9:元の位置に戻る

BOSS5_P09_SEC0:;0:待機
AD $14,$30
SBC $14,WAIT16
JP C,END_BOSS5_MOVE

END_BOSS50P1SE0:
PRE IZ,SECTION
LDW $0,&H0001;SECTION=1,SECTION_COUNTER=0
STW $0,(IZ+$31)
LDW $14,0
JP END_BOSS5_MOVE

BOSS5_WING_MIS:
DB 13,0,0,4,4,0,0,&H00,1,1;翼ミサイル

BOSS5_P09_SEC1:;上下移動

PRE IZ,GLOBAL_COUNTER
LD $0,(IZ+$31)
AN $0,3
JR NZ,BOSS5_P09SEC1_UD

PRE IZ,BOSS5_WING_MIS
LDIM $17,(IZ+$31),8
LDM $25,(IZ+$31),2
LD $18,$10
AD $18,16
LD $19,$11
AD $19,8
CAL INSERT_OBJECT;IX破壊
PRE IX,ENEMY_DATA

BOSS5_P09SEC1_UD:
CAL BOSS5_UP_DOWN
SBC $0,$31
JR Z,END_BOSS5_P09SE1
JP END_BOSS5_MOVE

END_BOSS5_P09SE1:
PRE IZ,SECTION
LDW $0,&H0002;SECTION=2,SECTION_COUNTER=0
STW $0,(IZ+$31)
LD $14,$31
PRE IZ,EXTRA_FLAG;翼を広げたままにする
ST $30,(IZ+$31)
JP END_BOSS5_MOVE

BOSS5_P09_SEC2:;2:待機(翼を広げた状態)
AD $14,$30
SBC $14,WAIT32
JP C,END_BOSS5_MOVE

END_BOSS5_P09SE2:
PRE IZ,SECTION
LDW $0,&H0003;SECTION=3,SECTION_COUNTER=0
STW $0,(IZ+$31)
LD $14,$31
JP END_BOSS5_MOVE

BOSS5_P09SEC3EM:
DB 10,0,0,4,4,0,0,&HFF,0,1;拡大ビーム


BOSS5_P09_SEC3:;3:拡大ビーム発射

PRE IZ,BOSS5_P09SEC3EM
LDIM $17,(IZ+$31),8
LDM $25,(IZ+$31),2
LD $18,$10
AD $18,4
LD $19,$11
AD $19,4
CAL INSERT_OBJECT;IX破壊

LD $17,11
CAL INSERT_OBJECT;IX破壊

LD $17,12
CAL INSERT_OBJECT;IX破壊

END_BOSS5_P09SE3:
PRE IZ,SECTION
LDW $0,&H0004;SECTION=4,SECTION_COUNTER=0
STW $0,(IZ+$31)
PRE IZ,EXTRA_FLAG;翼をはためかせる
ST $31,(IZ+$31)
PRE IX,ENEMY_DATA
LD $14,$31;COUNTER RESET
JP END_BOSS5_MOVE

BOSS5_P09_SEC4:;4:待機
AD $14,$30
SBC $14,WAIT32
JP C,END_BOSS5_MOVE

END_BOSS5_P09SE4:
PRE IZ,SECTION
LDW $0,&H0005;SECTION=5,SECTION_COUNTER=0
STW $0,(IZ+$31)
JP END_BOSS5_MOVE

BOSS5_P09_SEC5:;5:前移動
SB $10,$30
SBC $10,60
JP NZ,END_BOSS5_MOVE

END_BOSS5_P09SE5:
PRE IZ,SECTION
LDW $0,&H0006;SECTION=6,SECTION_COUNTER=0
STW $0,(IZ+$31)
PRE IZ,EXTRA_FLAG;翼を広げたままにする
ST $30,(IZ+$31)
LD $14,$31;COUNTER RESET
JP END_BOSS5_MOVE

BOSS5_P09_SEC6:;6:待機(翼を広げた状態)
AD $14,$30
SBC $14,WAIT32
JP C,END_BOSS5_MOVE

LD $15,&HFF;飛び掛かる方向を-に設定
;自機のY座標>16なら飛び掛かる方向を+に変更する
LD $0,16
PRE IZ,MY_Y
SBC (IZ+$31),$0
JR C,END_BOSS5_P09SE6
LD $15,$30;飛び掛かる方向を+に変更

END_BOSS5_P09SE6:
PRE IZ,SECTION
LDW $0,&H0007;SECTION=7,SECTION_COUNTER=0
STW $0,(IZ+$31)
JP END_BOSS5_MOVE

BOSS5_P09_SEC7:;飛び掛かる
SB $10,3
AD $11,$15

SBC $10,8
JP NC,END_BOSS5_MOVE

END_BOSS5_P10SE7:
PRE IZ,SECTION
LDW $0,&H0008;SECTION=8,SECTION_COUNTER=0
STW $0,(IZ+$31)
PRE IZ,EXTRA_FLAG;翼をはためかせる
ST $31,(IZ+$31)
LD $14,$31;COUNTER RESET
;$15はBOSS5が元も位置に戻る時のY変化量に使用するので初期化しないこと
JP END_BOSS5_MOVE

BOSS5_P09_SEC8:;待機

AD $14,$30
SBC $14,WAIT32
JP C,END_BOSS5_MOVE

END_BOSS5_P09SE8:
PRE IZ,SECTION
LDW $0,&H0009;SECTION=9,SECTION_COUNTER=0
STW $0,(IZ+$31)
;$15はBOSS5が元も位置に戻る時のY変化量に使用するので初期化しないこと
JP END_BOSS5_MOVE

BOSS5_P09_SEC9:;元の位置に戻る

BOSS5_P09SEC9XCK:
SBC $10,BOSS5_X_ORG
JR Z,BOSS5_P09SEC9YCK
AD $10,$30
JP END_BOSS5_MOVE
BOSS5_P09SEC9YCK:
SBC $11,BOSS5_Y_ORG
JR Z,END_BOSS5_P09SE9
SB $11,$15
JP END_BOSS5_MOVE

END_BOSS5_P09SE9:
PRE IZ,SECTION
LDW $0,&H0000;SECTION=0,SECTION_COUNTER=0
STW $0,(IZ+$31)
LD $14,$31;COUNTER RESET
JP END_BOSS5_MOVE


;*************************
;*     BOSS5_UP_DOWN
;*RET   $0:0=END,1:MOVING
;*************************
BOSS5_UP_DOWN:

;SET END CODE = MOVING
LD $0,$30

;$14=0:上移動,1:下移動,2:中央(Y=12)に戻る
;$15=下移動して下限に到達した回数

SBC $14,$31
JR Z,BOSS5_Y_UP
SBC $14,$30
JR Z,BOSS5_Y_DOWN
JR BOSS5_Y_CENTER

BOSS5_Y_UP:
SB $11,$30
SBC $11,4;Y_CENTER(12)-8
RTN NZ
LD $14,$30;下移動に切り替える
RTN

BOSS5_Y_DOWN:
AD $11,$30
SBC $11,36;Y_CENTER(12)+24
RTN NZ
AD $15,$30
;3回下移動の下限に到達したら中央に戻る処理へ移行(終了)
SBC $15,2
JR Z,BOSS5_YM_CTR
LD $14,$31;上移動に切り替える
RTN
BOSS5_YM_CTR:
LD $14,2;中央に戻るに切り替える
RTN

BOSS5_Y_CENTER:
SB $11,$30
SBC $11,12
RTN NZ
LD $0,$31;SET END CODE = END
RTN

BOSS5_P10_MOVE:
CAL BOSS5_PABC_MOVE
AD $14,$30
SBC $14,4
JP C,END_BOSS5_MOVE
SB $11,$30
LD $14,$31;COUNTER RESET
JP END_BOSS5_MOVE

BOSS5_P11_MOVE:
CAL BOSS5_PABC_MOVE
JP END_BOSS5_MOVE

BOSS5_P12_MOVE:
CAL BOSS5_PABC_MOVE
AD $14,$30
SBC $14,4
JP C,END_BOSS5_MOVE
AD $11,$30
LD $14,$31;COUNTER RESET
JP END_BOSS5_MOVE

BOSS5_PABC_MOVE:
SB $10,3
RTN NC
PPSW $0;CALLで呼ばれたスタックを解放
JR ST5_KILL_BOSS
;LD $9,$31;KILL_ENEMY
;RTN

BOSS5_P13_MOVE:;ATTACK WING
SB $10,4
JP NC,END_BOSS5_MOVE
;JR ST5_KILL_BOSS
;LD $9,$31;KILL_ENEMY
;JP END_BOSS5_MOVE

ST5_KILL_BOSS:
CAL DELETE_OBJECT
JP NEXT_MOVE_BOSS5

END_BOSS5_MOVE:
PRE IX,ENEMY_DATA
STM $9,(IX+$28),8
JP NEXT_MOVE_BOSS5

;*********************************
;*        DISP BOSS5
;*
;*USE:
;*      $0      WORK
;*      $2,$3   JUMP TABLE
;*      $9-$16  ENEMY DATA
;*      $28     COUNTER
;*      IX
;*      IZ
;*********************************
DISP_BOSS5:
LD $28,$31

DISP_BOSS5_LOOP:

PRE IX,ENEMY_DATA

LDM $9,(IX+$28),8
SBC $9,$31
JR Z,NEXT_DISP_BOSS5
;
PHU $28
;
;GPRINTのRTN命令でRTN_ST5_DBOSS5に戻れるようにするため、RTN_ST5_DBOSS5のアドレスを
;SSPにPUSHしておく。
;なおGPRINTからの復帰はRTNでありSSPにスタックされたアドレス+1からプログラムを実行するため
;RTN_ST5_DBOSS5のアドレスから-1したものをSSPにPUSHする。
LDW $0,RTN_ST5_DBOSS5-1
PHSW $1

SBC $9,BOSS_CORE_NO;(9)
JR Z,BOSS5_P09_DISP
SBC $9,10
JP Z,BOSS5_P10_DISP;拡大ビーム(上)
SBC $9,11
JP Z,BOSS5_P11_DISP;拡大ビーム(中)
SBC $9,12
JP Z,BOSS5_P12_DISP;拡大ビーム(下)
SBC $9,13
JP Z,BOSS5_P13_DISP;翼ミサイル

;JUMPしなかった場合はSSPを戻す。
PPSW $0

RTN_ST5_DBOSS5:

;
PPU $28
;
NEXT_DISP_BOSS5:
AD $28,ENEMY_STRUCT
JR NC,DISP_BOSS5_LOOP
RTN

BOSS5_P09_DISP:;(BOSS5_CORE)
PHUW $11
LD $12,8
LDW $13,SG_CHR_DATA17;CHAR_BOSS5_1_1
#if (USE_LIB=NORMAL_G)
CAL GPRINT
#endif
#if(USE_LIB=SUPER_GP)
CAL SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
CAL SGPRINT_FAST
#endif
;
PPUW $10
PHUW $11
;
LD $12,8
AD $10,8
LDW $13,SG_CHR_DATA18;CHAR_BOSS5_2_1
#if (USE_LIB=NORMAL_G)
CAL GPRINT
#endif
#if(USE_LIB=SUPER_GP)
CAL SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
CAL SGPRINT_FAST
#endif
;
PPUW $10
AD $11,8
PHUW $11
;
LD $12,8
LDW $13,SG_CHR_DATA19;CHAR_BOSS5_2_1
#if (USE_LIB=NORMAL_G)
CAL GPRINT
#endif
#if(USE_LIB=SUPER_GP)
CAL SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
CAL SGPRINT_FAST
#endif
;
PPUW $10
PHUW $11
;
LD $12,8
AD $10,8
LDW $13,SG_CHR_DATA20;CHAR_BOSS5_2_2
#if (USE_LIB=NORMAL_G)
CAL GPRINT
#endif
#if(USE_LIB=SUPER_GP)
CAL SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
CAL SGPRINT_FAST
#endif
;
PPUW $10
AD $11,8
PHUW $11
;
LD $12,8
LDW $13,SG_CHR_DATA21;CHAR_BOSS5_1_3
#if (USE_LIB=NORMAL_G)
CAL GPRINT
#endif
#if(USE_LIB=SUPER_GP)
CAL SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
CAL SGPRINT_FAST
#endif
;
PPUW $10
PHUW $11;
LD $12,8
AD $10,8
LDW $13,SG_CHR_DATA22;CHAR_BOSS5_2_3
#if (USE_LIB=NORMAL_G)
CAL GPRINT
#endif
#if(USE_LIB=SUPER_GP)
CAL SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
CAL SGPRINT_FAST
#endif
;
PPUW $10
;

;翼を広げたままにするFLAGをチェック
PRE IZ,EXTRA_FLAG
SBC (IZ+$31),$30
JR Z,BOSS5_WING_OPEN

;GLOBAL_COUNTERが偶数なら翼を閉じる、奇数なら広げる
PRE IZ,GLOBAL_COUNTER
LD $0,(IZ+$31)
AN $0,&H01
JR Z,BOSS5_WING_CLOSE

BOSS5_WING_OPEN:
LD $12,8
AD $10,16
SB $11,8
;
PHUW $11
;
LDW $13,SG_CHR_DATA13;CHR_BOSS5_WO1
#if (USE_LIB=NORMAL_G)
CAL GPRINT
#endif
#if(USE_LIB=SUPER_GP)
CAL SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
CAL SGPRINT_FAST
#endif
;
PPUW $10
SB $11,8
;
LDW $13,SG_CHR_DATA14;CHR_BOSS5_WO2
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

BOSS5_WING_CLOSE:
LD $12,8
AD $10,16
SB $11,8
;
PHUW $11
;
LDW $13,SG_CHR_DATA15;CHR_BOSS5_WC1
#if (USE_LIB=NORMAL_G)
CAL GPRINT
#endif
#if(USE_LIB=SUPER_GP)
CAL SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
CAL SGPRINT_FAST
#endif
;
PPUW $10
AD $11,8
;
LDW $13,SG_CHR_DATA16;CHR_BOSS5_WC2
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

BOSS5_P10_DISP:
LD $12,8
LDW $13,SG_CHR_DATA09;CHR_BOSS5_BEAM_U
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

BOSS5_P11_DISP:
LD $12,8
LDW $13,SG_CHR_DATA10;CHR_BOSS5_BEAM_C
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

BOSS5_P12_DISP:
LD $12,8
LDW $13,SG_CHR_DATA11;CHR_BOSS5_BEAM_L
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

BOSS5_P13_DISP:

LD $12,8
LDW $13,SG_CHR_DATA12;CHR_BOSS5_WING
#if (USE_LIB=NORMAL_G)
JP GPRINT
#endif
#if(USE_LIB=SUPER_GP)
JP SGPRINT
#endif
#if(USE_LIB=FAST_LIB)
JP SGPRINT_FAST
#endif

BOSS5_P15_DISP:
RTN

;**********************************
;*      BOSS5撃破時の処理
;**********************************
BOSS_DEF_ST5:

;RTN CODE 0:継続をセット
LD $5,$31

;下へ降下
LD $0,2
PRE IX,ENEMY_DATA_00;BOSS5 CORE
LD $11,(IX+$0)
AD $11,$30
ST $11,(IX+$0);BOSS5 CORE

PRE IX,EXTRA_COUNTER
AD (IX+$31),$30
LD $0,48
SBC (IX+$31),$0
RTN NZ
;RTN CODE 1:次のフェーズに移行をセット
LD $5,$30
RTN

;**********************************
;*      ST5_INIT_GRAPHIC
;**********************************

ST5_INIT_GRAPHIC:
LDW $0,0;自機
LDW $2,CHR_FIGHTER
CAL SET_SGPRINT_DATA

LDW $0,1;MY BOMB L
LDW $2,CHR_BOMB_L
CAL SET_SGPRINT_DATA

LDW $0,2;MY_BOMB_R
LDW $2,CHR_BOMB_R
CAL SET_SGPRINT_DATA

;ENEMY

LDW $0,3
LDW $2,CHR_ST5_01;U-TURN
CAL SET_SGPRINT_DATA

LDW $0,4
LDW $2,CHR_ST5_02;MISSILE-SHIP
CAL SET_SGPRINT_DATA

LDW $0,5
LDW $2,CHR_ST5_05;BACK ATTACK
CAL SET_SGPRINT_DATA

LDW $0,6
LDW $2,CHR_ST5_06;BF-SPEAR
CAL SET_SGPRINT_DATA

LDW $0,7
LDW $2,CHR_ST5_07;MINE-SETTER
CAL SET_SGPRINT_DATA

LDW $0,8
LDW $2,CHR_ST5_08;機雷
CAL SET_SGPRINT_DATA

;BOSS5 BEAM
LDW $0,9;BOSS
LDW $2,CHR_BOSS5_BEAM_U
CAL SET_SGPRINT_DATA

LDW $0,10;BOSS
LDW $2,CHR_BOSS5_BEAM_C
CAL SET_SGPRINT_DATA

LDW $0,11;BOSS
LDW $2,CHR_BOSS5_BEAM_L
CAL SET_SGPRINT_DATA

LDW $0,12;BOSS5 ATTACK WING
LDW $2,CHR_BOSS5_WING
CAL SET_SGPRINT_DATA

;BOSS5 WING
LDW $0,13;BOSS5 WING OPEN1
LDW $2,CHR_BOSS5_WO1
CAL SET_SGPRINT_DATA

LDW $0,14;BOSS5 WING OPEN2
LDW $2,CHR_BOSS5_WO2
CAL SET_SGPRINT_DATA

LDW $0,15;BOSS5 WING CLOSE1
LDW $2,CHR_BOSS5_WC1
CAL SET_SGPRINT_DATA

LDW $0,16;BOSS5 WING CLOSE2
LDW $2,CHR_BOSS5_WC2
CAL SET_SGPRINT_DATA

;BOSS5 CORE
LDW $0,17;BOSS
LDW $2,CHR_BOSS5_1_1
CAL SET_SGPRINT_DATA

LDW $0,18;BOSS
LDW $2,CHR_BOSS5_2_1
CAL SET_SGPRINT_DATA

LDW $0,19;BOSS
LDW $2,CHR_BOSS5_1_2
CAL SET_SGPRINT_DATA

LDW $0,20;BOSS
LDW $2,CHR_BOSS5_2_2
CAL SET_SGPRINT_DATA

LDW $0,21;BOSS
LDW $2,CHR_BOSS5_1_3
CAL SET_SGPRINT_DATA

LDW $0,22;BOSS
LDW $2,CHR_BOSS5_2_3
CAL SET_SGPRINT_DATA

RTN
