**************************************************************************
*		Amiga Apache Flight
**************************************************************************
* date:14/8/91
*
*
*
**************************************************************************
*		Amiga specific Equates
**************************************************************************


_LVOOpenLibrary	equ	-552
_LVOOpen		equ	-30
_LVOClose	equ	-36
_LVORead		equ	-42
_LVOWrite	equ	-48
_LVOAllocMem	equ	-198
_LVOFreeMem	equ	-210
_LVOLock		equ	-54
_LVOExamine	equ	-72
_LVOExNext	equ	-78
_SysBase		equ	4

; example of copper list

; customchip-register

intena		equ 	$9a	
dmacon		equ 	$96
dmaconr		equ	$002
color00		equ 	$180
vhposr		equ 	$6
custom		equ	$dff000
joy0dat		equ	$00a
joy1dat		equ	$00c
intenar		equ	$01c
intreqr		equ	$01e
intreq		equ	$09c

; copper register

cop1lc		equ $80
cop2lc		equ $84
copjmp1		equ $88
copjmp2		equ $8a

; bitplane register

bplcon0		equ 	$100	; bitplane control register 0
bplcon1		equ 	$102	; 1 (scroll value) 
bplcon2		equ 	$104	; 2 (sprite<>playfield priority)
bpl1pth		equ 	$0e0	; number of 1. bitplane 
bpl1ptl		equ 	$0e2
bpl2pth		equ	$0e4
bpl2ptl		equ	$0e6
bpl3pth		equ	$0e8
bpl3ptl		equ	$0ea
bpl4pth		equ	$0ec
bpl4ptl		equ	$0ee
bpl1mod		equ 	$108 	; modulo-value for odd bit planes
bpl2mod		equ 	$10a 	; modulo-value for even bit planes
diwstrt		equ 	$08e	; start of screen window
diwstop		equ 	$090	; end of screen window
ddfstrt		equ 	$092	; bit plane dma start
ddfstop		equ 	$094	; bit plane dma stop 

 ; blitter

bltcon0	equ	$040
bltcon1	equ	$042
bltafwm	equ	$044
bltalwm	equ	$046
bltcpth	equ	$048
bltbpth	equ	$04c
bltapth	equ	$050
bltdpth	equ	$054
bltsize	equ	$058
bltcmod	equ	$060
bltbmod	equ	$062
bltamod	equ	$064
bltdmod	equ	$066

; CIA-A port register A (mouse key)

ciaapra		equ $bfe001

; Exec library base offsets

openlib		equ -30-522
forbid		equ -30-102
permit		equ -30-108
allocmem		equ -30-168
freemem		equ -30-180

; graphics base

startlist	equ 38

; other labels

execbase		equ 4
chip		equ 2
planesize	equ 40*200
clsize		equ 800
clear		equ chip+$10000		* clear previouse chip ram

***************************************************************************
*		Amiga Macros
***************************************************************************

CALLEXEC	macro	name
	move.l	(_SysBase).w,a6
	jsr	_LVO\1(a6)
	endm

EXECNAME	macro
	dc.b	'exec.library',0
	even
	endm

CALLDOS	macro	name
	move.l	_DOSBase,a6
	jsr	_LVO\1(a6)
	endm

DOSNAME	MACRO
	DC.B  'dos.library',0
	even
	ENDM

CALLGRAF	macro
	move.l	_GfxBase,a6
	jsr	_LVO\1(a6)
	endm

GRAFNAME	macro
	dc.b	'graphics.library',0
	even
	endm

waitblit	MACRO
.w\@	btst	#14,dmaconr+custom
	bne.s	.w\@
	endm

cwait	macro	line,address register
	move.w	\1,d0
	lsl.w	#8,d0
	bset	#0,d0
	move.w	d0,(\2)+
	move.w	#$ff00,(\2)+
	endm

cmove	macro	amiga register, data, address register
	move.w	\1,(\3)+
	move.w	\2,(\3)+
	endm

s_cmove	macro	amiga register, data, address register, clist pos
	move.w	\1,(\3)+
	move.l	\3,\4
	move.w	\2,(\3)+
	endm

***************************************************************************
*		General Equates
***************************************************************************


big_reg		reg	d1-d7/a2-a4
most_regs	reg	d1-d7/a0-a6
all_regs		reg	d0-d7/a0-a6
screen_all	reg	d1-d7/a2-a6

out 		equ	1
in		equ	2
init_in		equ	3
init_out		equ	4

advance		equ	99
left		equ	2
right		equ	3
up		equ	0              
down		equ	1
up_left		equ	5
up_right		equ	6

fire		equ	7	

plat_low		equ	1
plat_hi		equ	10

inactive		equ	-1
x_off		equ	600
x_end		equ	601
end_list		equ	125
null		equ	0
steam		equ	2
dig_sound	equ	133


map_vector	equ	0
pixel_count	equ	4
data_vector	equ	6

***************************************************************************
*		General Macros
***************************************************************************

* return if EQ
rtseq		macro
		bne.s	.a\@
		rts
.a\@
		endm

* return if NE
rtsne		macro
		beq.s	.b\@
		rts
.b\@
		endm

* return if mi
rtsmi		macro
		bpl.s	.f\@
		rts
.f\@
		endm

rtspl		macro
		bmi.s	.g\@
		rts
.g\@
		endm

* return if ge
rtsge		macro
		blt.s	.h\@
		rts
.h\@
		endm

* return if lt
rtslt		macro
		bge.s	.i\@
		rts
.i\@
		endm

* return if le
rtsle		macro
		bgt.s	.j\@
		rts
.j\@
		endm

* return if gt
rtsgt		macro
		ble.s	.k\@
		rts
.k\@
		endm

* INC
inc		macro
		ifc	'','\1'
		fail
		mexit
		endc
		addq.\0	#1,\1
		endm

* DEC
dec		macro
		ifc	'','\1'
		fail
		mexit
		endc
		subq.\0	#1,\1
		endm

load		macro	path_name,f_object,f_length
		move.l	\1,path_name
		move.l	\2,f_object
		move.l	\3,f_length
		jsr	load_file
		endm

push		macro
		ifc	'','\1'
		fail
		mexit
		endc
		move.\0	\1,-(sp)
		endm

pop		macro
		ifc	'','\1'
		fail
		mexit
		endc
		move.\0	(sp)+,\1
		endm

pushm		macro
		ifc	'','\1'
		fail
		mexit
		endc
		movem.\0	\1,-(sp)
		endm

popm		macro
		ifc	'','\1'
		fail
		mexit
		endc
		movem.\0	(sp)+,\1
		endm

random		macro
		pushm.l	most_regs
		bsr	randomize
		popm.l	most_regs
		endm

fade_pal_out	macro	pal
		move.l	\1,a0
		move.b	#init_out,fade_flag
fade_again1\@	jsr	fade_pal
		jsr	vb_wait
		jsr	vb_wait
		jsr	vb_wait
		jsr	vb_wait
		jsr	vb_wait
		jsr	vb_wait
		tst.b	fade_flag
		bne	fade_again1\@
		endm

fade_pal_in	macro	pal
		move.l	\1,a0
		move.b	#init_in,fade_flag
fade_again\@	jsr	fade_pal
		jsr	vb_wait
		jsr	vb_wait
		jsr	vb_wait
		jsr	vb_wait
		jsr	vb_wait
		jsr	vb_wait
		tst.b	fade_flag
		bne	fade_again\@
		endm

dir_bull		macro	graphics,from_x,from_y,to_x,to_y
		pushm.l	all_regs
		move.w	\2,from_x
		move.w	\3,from_y
		move.w	\4,to_x
		move.w	\5,to_y
		move.l	\1,d0
		bsr	gen_dbull_setup
		popm.l	all_regs
		endm		

dis1_bull	macro	graphics,from_x,from_y,to_x,to_y,routine
		pushm.l	all_regs
		move.w	\2,from_x
		move.w	\3,from_y
		move.w	\4,dis_x
		move.w	\5,dis_y
		move.l	\1,d0
		bsr	\6
		popm.l	all_regs
		endm		

dis_bull		macro	graphics,from_x,from_y,dis_x,dis_y
		pushm.l	all_regs
		move.w	\2,from_x
		move.w	\3,from_y
		move.w	\4,dis_x
		move.w	\5,dis_y
		move.l	\1,d0
		bsr	gen_dsbull_setup
		popm.l	all_regs
		endm		

explode_24	macro	x,y
		pushm.l	all_regs
		move.w	\1,gen_x
		move.w	\2,gen_y
		bsr	init_explo_32
		popm.l	all_regs
		endm

explode_40	macro	x,y
		pushm.l	all_regs
		move.w	\1,gen_x
		move.w	\2,gen_y
		bsr	init_explo_40
		popm.l	all_regs
		endm

sound		macro	sample,length,freq_1,freq_2,priority
		pushm.l	all_regs
		move.b	\5,explo_flag
		tst.b	explo_flag
		bne	.sound_lop1\@
		tst.b	explo_cycle
		beq	.sound_lop4\@
		bra	.sound_exit\@
.sound_lop1\@	cmp.b	#3,explo_flag
		blt	.sound_lop2\@
		tst.b	explo_cycle
		bne	.sound_exit\@
		move.b	#10,explo_cycle
		bra	.sound_lop4\@
.sound_lop2\@	cmp.b	#2,explo_flag
		bne	.sound_lop3\@
		move.b	#24,explo_cycle
		bra	.sound_lop4\@
.sound_lop3\@	move.b	#15,explo_cycle
.sound_lop4\@	move.l	\1,samaddr
		move.l	\2,samlen
		move.b	\3,frequency_1
		move.b	\4,frequency_2
		jsr	start
.sound_exit\@	popm.l	all_regs
		endm

unpack		macro
		pushm.l	all_regs
		move.l	\1,d0
		addi.l	#\2,d0
		move.l	d0,a0
		move.l	\3,a1
		jsr	unpac
		popm.l	all_regs
		endm
	
pause		macro	outer_loop,inner_loop
		move.w	#\1,d0
pause_1\@	move.w	#\2,d1
pause_2\@	dbra.w	d1,pause_2\@
		dbra.w	d0,pause_1\@
		endm

print_text	macro	text address,screen x
		lea	\1,a0
		move.l	#\2,d1
		bsr	print_char
		endm

***************************************************************************
*		Main initialise
***************************************************************************
		
		bsr	init_all
		bsr	init_memory
		bsr	build_y_table
		bsr	init_key_int
		bsr	clear_screens
		clr.b	pal_choice
		move.l	#clear_pal,d0
		bsr	set_fade_pal
		lea	custom,a5
		move.w	#$3081,diwstrt(a5)
		move.w	#$2cc1,diwstop(a5)

		load	#front_char_name,train_buff,#4160
		load	#front_end_fname,high_entry_pre,#27614

		move.l	high_entry_pre,a0
		move.l	big_chopper,a1
		bsr	iffdcp

		move.l	screena,screenx
		bsr	print_front_screen
		move.l	screenb,screenx
		bsr	print_front_screen
		fade_pal_in	#high_entry_pal
		pause	1000,150

		lea	fade_char_in,a1
		move.w	#11,d6
		jsr	text_fade_1
		pause	3500,150
		lea	fade_char_out,a1
		move.w	#11,d6
		jsr	text_fade_1

		pause	1000,100

		lea	fade_char_in,a1
		move.w	#11,d6
		jsr	text_fade_2
		pause	3500,150
		lea	fade_char_out,a1
		move.w	#11,d6
		jsr	text_fade_2

		bsr	load_grfx
		bra	jump_for_choice_screen

***************************************************************************
*		Main control
***************************************************************************

_main
		bsr	game_control
_main1
*		bsr	explo_soundproirity
		bsr	joystick
		bsr	joystick_respond
		bsr	palette_up_down
		bsr	__scroll
		bsr 	random_animations
		bsr	init_rotating_gun	
		bsr	rotating_gun_control
		tst.b	landing_flag
		beq	_main2
		bsr	print_one
_main2
		bsr	enemys
		bsr	one_player
		bsr	disable_rotating_gun
		bsr	update_explo_40
		bsr	print_bull_flash
		jsr	print_get_ready
		move.l	cycle_count,score
		bsr	print_score
		bsr	options
		bsr	print_small_chop
		bsr	print_display_missile
		bsr	flip_control
       		bra	_main

***************************************************************************
*		Print small chopper(lives)
***************************************************************************

print_small_chop	move.w	#25,gen_x
		move.w	#224,gen_y
		move.l	schop,a1
		lea	small_c_list,a0
		move.w	small_chop_fr,d0
		lsl.w	#1,d0
		add.w	(a0,d0.w),a1
		move.w	#31,d6
		bsr	blit_sprite_16
		cmp.w	#2,small_c_cycle
		beq	pnt_sc_inc_fr
		inc.w	small_c_cycle
		rts
pnt_sc_inc_fr	clr.w	small_c_cycle	increase frame
		cmp.w	#3,small_chop_fr
		beq	pnt_smallc_reset
		inc.w	small_chop_fr
		rts
pnt_smallc_reset	clr.w	small_chop_fr
		rts

small_chop_fr	dc.w	0
small_c_cycle	dc.w	0
small_c_list	dc.w	0,310,620,930

***************************************************************************
*		Print missile for amount of missiles left
***************************************************************************

print_display_missile
		move.w	#226,gen_x
		move.w	#224,gen_y
		move.w	#14,d6
		move.l	missile_display,a1
		bsr	blit_sprite_16
		rts

***************************************************************************
*		Palette going up & down
***************************************************************************

palette_up_down	tst.b	pal_up_down
		rtseq
		move.l	level1_pal_list_temp,a0
		cmp.l	#x_end,(a0)
		beq	pal_upd_reset
		move.l	(a0),d0
		pushm.l	a0
		jsr	set_fade_pal
		popm.l	a0
		addq.l	#4,a0
		move.l	a0,level1_pal_list_temp
		rts

pal_upd_reset	clr.b	pal_up_down
		rts

***************************************************************************
*		One player
***************************************************************************

one_player	bsr	icon_control
		bsr	pickup_control
		bsr	droids
		bsr	two_droids
		bsr	multiple_droids
		tst.b	landing_flag
		bne	one_player1
		bsr	print_one
one_player1	
		bsr	p_bull
		bsr	p_coll
		bsr	update_rocket
		bsr	update_guided
		bsr	guided_limits
		bsr	all_back_col
		rts

print_one	tst.b	land_last_frn
		beq	print_one1
		clr.b	land_last_frn
		rts
print_one1	inc.w	main_frame
		cmp.w	#4,main_frame
		bne	.lop
		clr.w	main_frame
.lop		tst.b	landing_flag
		bne	land
		tst.b	flip_flag
		beq.s	.next1
		tst.w	fuel
		bne	.next
		bsr	dis_p_ship
.next		dec.w	fuel
.next1		dec.l	distance
		move.l	main_x,gen_x
		addi.w	#15,gen_y
		subi.w	#12,gen_x
		tst.b	p_free_life
		beq	.print_main_s
		tst.b	flip_flag
		bne	.print_main_s1
.print_main_s	bsr	p_main_shadow
.print_main_s1	move.l	main_x,gen_x
		tst.b	p_free_life
		beq	.print_main
		tst.b	flip_flag
		bne	.print_main1
.print_main	move.w	main_frame,d0
		bsr	p_hel_pla_sprite
.print_main1	tst.b	p_free_life
		rtseq
		dec.b	p_free_life
		rts

land		move.w	#4,d0
		move.w	#6,d1
		cmp.b	#up,land_dir
		beq	land_up
		cmp.b	#3,landing_flag
		bne	landing_cont
		cmp.w	#999,fuel
		blt	.land_1
		move.w	#999,fuel
.land_1		cmp.w	#999,fuel
		beq	print_landing
		addq.w	#3,fuel
		bra	print_landing
landing_cont	clr.w	d2
		move.b	landing_flag,d2
		asl.w	#2,d2
		lea	landing_shadow_dis,a0
		move.w	(a0,d2.w),d0
		move.w	2(a0,d2.w),d1
		inc.b	landing_flag

print_landing	move.l	main_x,gen_x
		add.w	d1,gen_y
		sub.w	d0,gen_x
		tst.b	p_free_life
		beq	.print_land_s
		tst.b	flip_flag
		bne	.print_land_s1
.print_land_s	bsr	p_main_shadow
.print_land_s1	move.l	main_x,gen_x
		tst.b	p_free_life
		beq	.print_land
		tst.b	flip_flag
		bne	.print_land1
.print_land	move.w	main_frame,d0
		bsr	p_hel_pla_sprite
.print_land1	tst.b	p_free_life
		rtseq
		dec.b	p_free_life
		rts

land_up		move.l	landing_address,a0
		move.b	land1_mod,d2
		cmp.b	(a0),d2
		beq	lu_add
		blt	lu_miss
		move.b	d2,(a0)
		bra	lu_miss
lu_add		move.b	d2,(a0)
		addq.b	#1,(a0)

lu_miss		dec.b	landing_flag
		tst.b	landing_flag
		bne	lu_miss1
		move.b	#1,land_last_frn
lu_miss1		moveq.w	#0,d2
		move.b	landing_flag,d2
		asl.w	#2,d2
		lea	landing_shadow_dis,a0
		move.w	(a0,d2.w),d0
		move.w	2(a0,d2.w),d1
		bra	print_landing

land_last_frn	dc.b	0,0

****************************************************************************
*		Control of explosion sound priority
****************************************************************************

explo_soundproirity
		tst.b	explo_cycle
		rtseq
		dec.b	explo_cycle
		rts

****************************************************************************
*		     Game  control
****************************************************************************

game_control	tst.b	game_flag
		rtsne
		lea	variables,a6
		move.l	map_end,a1
		sub.l	#94,a1
		move.l	a1,map_vector(a6)
		move.l	#enemy_list,setup_pointer
		move.b	#1,game_flag
		move.l	#64,cycle_count
		move.w	#192*32,map_y
		jsr	init_level
		move.l	screena,screenx
		bsr	__scroll
		bsr	one_player
		bsr	print_score
		move.l	screenb,screenx
		bsr	__scroll
		bsr	one_player
		bsr	print_score
		fade_pal_in	level_pal
		rts

****************************************************************************
*		Initialise a Pickup from routine
****************************************************************************

init_pickup	lea	pickup_xys,a0
		lea	pickup_type,a1
		lea	pickup_shadow,a2
ip_top		cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		beq	ip_set_it
		addq.w	#4,a0
		addq.w	#2,a2
		addq.w	#1,a1
		bra	ip_top
ip_set_it	move.l	gen_x,(a0)
		random
		and.l	#3,d0
		move.b	d0,(a1)
		clr.w	(a2)
		rts

****************************************************************************
*		Initialise a Pickup from enemy lists
****************************************************************************

init_pickup_el	lea	pickup_xys,a1
		lea	pickup_type,a2
		lea	pickup_shadow,a3
.ip_top		cmp.w	#x_end,(a1)
		rtseq
		cmp.w	#x_off,(a1)
		beq	.ip_set_it
		addq.w	#4,a1
		addq.w	#2,a3
		addq.w	#1,a2
		bra	.ip_top
.ip_set_it	move.l	(a0)+,(a1)
		random
		and.l	#3,d0
		move.b	d0,(a2)
		clr.w	(a3)
		rts

****************************************************************************
*		Pickup update and collision
****************************************************************************

pickup_control	lea 	pickup_xys,a0
		lea	pickup_type,a1
		lea	pickup_shadow,a2
puc_top		cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		bne	puc_control
puc_update_vec	addq.w	#4,a0
		addq.w	#2,a2
		addq.w	#1,a1
		bra	puc_top
puc_control	tst.b	landing_flag
		bne	puc_land
		addi.w	#1,2(a0)
puc_land		cmp.w	#266,2(a0)
		ble	puc_cont
		move.w	#x_off,(a0)
		bra	puc_update_vec
puc_cont		cmp.w	#8,(a2)
		beq	puc_shadows_ok
		tst.b	flip_flag
		bne	puc_shadows_ok
		inc.w	(a2)
puc_shadows_ok
*	move.l	#pickup_data,shadow_data
		move.l	(a0),gen_x
		move.w	(a2),d5
		add.w	d5,gen_y
		sub.w	d5,gen_x
*		bsr	shadow_16
		move.l	(a0),gen_x
		moveq.l	#0,d0
		bsr	gen_sprite_16
		bra	puc_update_vec

***************************************************************************
*		Print score
***************************************************************************
* a0 = address of text

print_score	lea	point_txt,a0
		move.w	#24,gen_x
		move.w	#1,gen_y
		bsr	gpr1_score
		move.l	score,d0
		lea	point_txt,a0
		bsr	pre1_charget

pr_fuel		lea	fuels_txt,a0
		move.w	#238,gen_x
		move.w	#1,gen_y
		bsr	gpr1_score
		moveq	#0,d0
		move.w	fuel,d0
		lea	char_save,a0
		bsr	get1_char
		lea	char_save+3,a1
		lea	fuels_txt,a0
		move.b	(a1)+,(a0)+
		move.b	(a1)+,(a0)+
		move.b	(a1),(a0)

pr_lives		lea	lives_txt,a0
		move.w	#41,gen_x
		move.w	#224,gen_y
		bsr	gpr1_score
		moveq	#0,d0
		move.w	choppers,d0
		lea	char_save,a0
		bsr	get1_char
		lea	char_save+4,a1
		lea	lives_txt,a0
		move.b	(a1)+,(a0)+
		move.b	(a1),(a0)
		bra	pr_rockets

pr_guided_missile	lea	guided_m_txt,a0
		move.l	#30944,d1
		bsr	gpr1_score
		clr.l	d0
		move.w	guided_missiles,d0
		lea	char_save,a0
		bsr	get1_char
		lea	char_save+4,a1
		lea	guided_m_txt,a0
		move.b	(a1)+,(a0)+
		move.b	(a1)+,(a0)

pr_rockets	lea	missile_txt,a0
		move.w	#238,gen_x
		move.w	#224,gen_y
		bsr	gpr1_score
		moveq	#0,d0
		move.w	rockets,d0
		lea	char_save,a0
		bsr	get1_char
		lea	char_save+3,a1
		lea	missile_txt,a0
		move.b	(a1)+,(a0)+
		move.b	(a1)+,(a0)+
		move.b	(a1),(a0)
		rts

gpr1_score
pr1_s_top	moveq	#0,d0
		move.b	(a0)+,d0
		cmp.b	#11,d0
		rtseq
		lsl.w	#1,d0
		move.l	score_data,a1
		lea	score_data_list,a2
		add.w	(a2,d0.w),a1
		move.w	#16,d6
		move.w	gen_x,d1
		pushm.l	all_regs
		bsr	blit_sprite_16
		popm.l	all_regs
		add.w	#16,d1
		move.w	d1,gen_x
		bra.s	pr1_s_top

score_data_list	dc.w	0,160,160*2,160*3,160*4,160*5,160*6
		dc.w	160*7,160*8,160*9

***************************************************************************
*		Get char values
* d0 = number
* a0 = destination
pre1_charget	moveq.l	#0,d1
		clr.b	(a0)
		move.l	d0,d2
prec1_bk		cmp.l	#99999,D0
		ble	gc1_bypass	
		subi.l	#100000,D0
		addi.b	#1,(a0)
		bra	prec1_bk

get1_char	moveq.l	#0,d2
		moveq.l	#0,d1
gc1_bypass	move.l	d0,d2
		moveq.l	#0,d1
		clr.b	1(a0)
prec11_bk	CMP.L	#9999,D0
		BLE	gc1_next
		SUBI.L	#10000,D0
		ADDi.B	#1,1(a0)
		BRA.s	prec11_bk

gc1_next		move.w	d0,d2
		divs	#1000,d0
		move.b	d0,2(a0)
		moveq.l	#0,d0
		move.b	2(a0),d0
		muls	#1000,d0
		moveq.l	#0,d1
		move.w	d2,d1
		sub.w	d0,d1
		exg	d0,d1
		move.w	d0,d2

		divs	#100,d0
		move.b	d0,3(a0)
		moveq.l	#0,d0
		move.b	3(a0),d0
		muls	#100,d0
		moveq.l	#0,d1
		move.w	d2,d1
		sub.w	d0,d1
		exg	d0,d1
		move.w	d0,d2

		divs	#10,d0
		move.b	d0,4(a0)
		moveq.l	#0,d0
		move.b	4(a0),d0
		muls	#10,d0
		move.w	d2,d1
		sub.w	d0,d1
		exg	d0,d1
		move.w	d0,d2

		divs	#1,d0
		move.b	d0,5(a0)
		moveq.l	#0,d0
		move.b	5(a0),d0
		muls	#1,d0
		move.w	d2,d1
		sub.w	d0,d1
		exg	d0,d1
		move.w	d0,d2
		rts

****************************************************************************
*		Return coord's from map address	    		  *
****************************************************************************
* d0 = map
return_coords	lea 	variables,a6
		move.l	map_vector(a6),d1
		sub.l	d1,d0
		divu	#10,d0
		move.w	d0,d1	d1 = blocks down
		swap	d0	d0 = blocks  across		
		asl.w	#5,d0
		asl.w	#5,d1
		move.w	#32,d2
		sub.w	pixel_count(a6),d2
		sub.w	d2,d1
		rts

****************************************************************************
*		Init Random animations
****************************************************************************

animations_init	lea	variables,a6
		tst.w	pixel_count(a6)
		rtsne
		lea	active_animations,a2
		move.l	animations,a0
ra_top		cmp.l	#-1,(a0)
		rtseq
		move.l	(a0)+,a1
		move.w	#9,d1
		move.l	map_vector(a6),a3
		move.b	(a1),d3
ra_lop		bsr	ra_find_block	
		tst.b	d0
		beq	ra_top
ras_top		cmp.l	#x_end,(a2)
		rtseq
		cmp.l	#inactive,(a2)
		beq	ras_set_it
		adda.w	#12,a2
		bra	ras_top
ras_set_it	move.l	cycle_count,(a2)
		add.l	#272,(a2)+
		move.l	-4(a0),(a2)+
		lea	-1(a3),a4
		move.l	a4,(a2)+
		bra	ra_lop	

ra_find_block	cmp.b	(a3)+,d3
		beq	fb_got_it	
		dbra.w	d1,ra_find_block
		moveq.b	#0,d0
		rts		
fb_got_it	moveq.b	#1,d0
		rts

****************************************************************************
*		Init rotating guns
****************************************************************************

init_rotating_gun	lea	variables,a6
		tst.w	pixel_count(a6)
		rtsne
		lea	rotating_guns,a2
		lea	gun_forward_lev3,a1
		lea	gun_frame_lev3,a5
ai_top		move.w	#9,d1
		move.l	map_vector(a6),a3
		move.l	rotating_gun,a0
		move.b	(a0),d3
ai_lop		bra	ai_find_block	
ai_ret		tst.b	d0
		beq	ai_top
		lea	rotating_gun_pause,a0
ais_top		cmp.l	#x_end,(a2)
		rtseq
		cmp.l	#inactive,(a2)
		beq	ais_set_it
		addq.w	#8,a2
		addq.w	#1,a0
		cmp.w	#2,level
		bne	ais_top
		addq.w	#1,a1
		addq.w	#1,a5
		bra	ais_top
ais_set_it	move.l	cycle_count,(a2)
		add.l	#272,(a2)+
		lea	-1(a3),a4
		move.l	a4,(a2)+
		clr.b	(a0)
		cmp.w	#2,level
		bne	ai_lop
		clr.b	(a1)
		clr.b	(a5)
		bra	ai_lop	

ai_find_block	cmp.b	(a3)+,d3
		beq	fba_got_it	
		dbra.w	d1,ai_find_block
		rts
fba_got_it	moveq.b	#1,d0
		bra	ai_ret

****************************************************************************
*		Rotating gun control
****************************************************************************

rotating_gun_control	lea	rotating_guns,a0
		lea	gun_forward_lev3,a1
		lea	gun_frame_lev3,a2
		lea	rotating_gun_pause,a5
rgc_top		cmp.l	#x_end,(a0)
		rtseq
		cmp.l	#inactive,(a0)
		bne	rgc_update
rgc_update_vector	addq.w	#8,a0
		addq.w	#1,a5
		cmp.w	#2,level
		bne.s	rgc_top
		addq.w	#1,a1
		addq.w	#1,a2
		bra	rgc_top

rgc_update	move.l	cycle_count,d0
		cmp.l	(a0),d0
		blt	rgc_loop
		move.l	#inactive,(a0)
		bra	rgc_update_vector
rgc_loop		cmp.w	#2,level
		beq	gun_control_lev3
		move.l	4(a0),d0
		bsr	return_coords
		move.w	d0,gen1_x
		move.w	d1,gen1_y
		bsr	return_displacements
		move.w	gen_x,d2
		swap	d2
		move.w	gen_y,d2
		lea	rotating_gun_dis,a1
		lea	rotating_bullet_dis,a4
		move.l	rotating_gun,a2
rgd_top		cmp.l	(a1),d2
		beq	rgc_gotit
		addq.w	#4,a1
		addq.w	#1,a2
		addq.w	#8,a4
		bra	rgd_top
rgc_gotit	move.l	4(a0),a3
		move.b	(a2),(a3)
		tst.b	(a5)
		beq	rgc_slow_fire
		dec.b	(a5)
		bra	rgc_update_vector
rgc_slow_fire	random
		and.l	#$ff,d0
		cmp.w	#6,d0
		bgt	rgc_update_vector
		move.b	#10,(a5)
		move.w	(a4),d0
		move.w	2(a4),d1
		push.l	gen1_x
		add.w	d0,gen1_x
		add.w	d1,gen1_y
		dis_bull	#3,gen1_x,gen1_y,gen_x,gen_y
		sound	#rapidgun_dig,#703,#5,#5,#0
		pop.l	gen1_x
		cmp.w	#1,level
		beq	rgc_update_vector
		cmp.w	#3,level
		beq	rgc_update_vector
		move.w	4(a4),d0
		move.w	6(a4),d1
		add.w	d0,gen1_x
		add.w	d1,gen1_y
		dis_bull	#3,gen1_x,gen1_y,gen_x,gen_y
		sound	#rapidgun_dig,#703,#5,#5,#0
		bra	rgc_update_vector


gun_control_lev3	tst.b	(a2)
		bne	gun_con_next_frn
		random
		and.l	#$ff,d0
		cmp.w	#5,d0
		bgt	rgc_update_vector		get next gun
		move.b	#1,(a2)
		move.b	#1,(a1)
		bra	rgc_update_vector

gun_con_next_frn	tst.b	(a1)
		bne	gun_con_next_frn1
		cmp.b	#1,(a2)		reverse gun
		beq	gun_lev3_reset
		move.l	4(a0),a3
		subq.b	#1,(a3)
		subq.b	#1,(a2)
		bra	rgc_update_vector

gun_con_next_frn1	cmp.b	#8,(a2)	forward gun
		beq.s	gun_lev3_set_bull
		move.l	4(a0),a3
		addq.b	#1,(a3)
		addq.b	#1,(a2)
		bra	rgc_update_vector

gun_lev3_set_bull	move.l	4(a0),d0
		bsr	return_coords
		addi.w	#16,d0
		addi.w	#11,d1
		dir_bull	#3,d0,d1,main_x,main_y
		sound	#rapidgun_dig,#703,#5,#5,#0
		clr.b	(a1)	reverse frames
		bra	rgc_update_vector
		
gun_lev3_reset	clr.b	(a1)
		clr.b	(a2)
		bra	rgc_update_vector

****************************************************************************
*		Return displacements
****************************************************************************

return_displacements	move.w	main_x,d0
		move.w	main_y,d1
return_dis1	move.w	gen1_x,d2
		move.w	gen1_y,d3
		clr.w	d4	    0 = pos
		clr.w	d5
		sub.w	d2,d0
		bpl	rd_next
		moveq.w	#1,d4
		neg.w	d0
rd_next		sub.w	d3,d1
		bpl	rd_next1
		moveq.w	#1,d5
		neg.w	d1
rd_next1		cmp.w	d0,d1
		bgt	d1_is_greater
		move.w	d0,d2
		move.w	d1,d3
		move.w	#4,d0
		clr.w	d1
		asr.w	#1,d2
		cmp.w	d2,d3
		blt	rd_done
		move.w	#4,d1
rd_done		tst.b	d4
		beq	rd_try_y
		neg.w	d0
rd_try_y		move.w	d0,gen_x
		move.w	d1,gen_y
		tst.b	d5
		rtseq
		neg.w	gen_y
		rts
d1_is_greater	move.w	d0,d2
		move.w	d1,d3
		move.w	#4,d1
		clr.w	d0
		asr.w	#1,d2
		cmp.w	d3,d2
		blt	rd_done
		move.w	#4,d0
		bra	rd_done

****************************************************************************
*		Recoil gun
****************************************************************************

guns_control	lea 	active_animations,a0
		move.l	recoil_gun,d7
		move.b	recoil_mod,d6
rcgc_top		cmp.l	#x_end,(a0)
		rtseq
		cmp.l	#inactive,(a0)+
		bne	rgc_search
rgc_update_vec	adda.w	#8,a0
		bra	rcgc_top
rgc_search	cmp.l	(a0),d7
		bne	rgc_update_vec
		tst.b	flip_flag
		bne	rgc_update_vec
		move.l	4(a0),a1
		cmp.b	(a1),d6
		bne	rgc_update_vec
		move.l	a1,d0
		bsr	return_coords
		addi.w	#15,d0
		addi.w	#24,d1
		dis_bull	#3,d0,d1,#0,#5
		sound	#rapidgun_dig,#703,#5,#5,#0
		bra	rgc_update_vec

****************************************************************************
*		      Random animations	    		  *
****************************************************************************

random_animations	bsr	animations_init
		lea	active_animations,a0
aias_top		cmp.l	#x_end,(a0)
		rtseq
		cmp.l	#inactive,(a0)
		bne	ai_animate
ai_next		adda.w	#12,a0
		bra	aias_top
ai_animate	move.l	(a0),d0
		cmp.l	cycle_count,d0
		bgt	ai_active
		move.l	#inactive,(a0)
		bra	ai_next
ai_active	move.b	#-1,d7
		move.l	4(a0),a1
		move.l	a1,a2
		move.l	8(a0),a3
ai_top1		inc.b	d7
		cmp.b	#-1,(a1)
		beq	ai_next
		move.b	(a3),d5
		cmp.b	(a1)+,d5
		bne	ai_top1
		tst.b	d7
		beq	aia_init
		cmp.b	#-1,(a1)
		bne	ai_cont
		tst.b	flip_flag
		bne	ai_next
		move.b	(a2),(a3)
		bra	ai_next
ai_cont		tst.b	flip_flag
		bne	ai_next
		move.b	(a1),(a3)
		bra	ai_next
aia_init		random
		and.l	#$ff,d0
		cmp.w	#5,d0
		bgt	ai_next
		tst.b	flip_flag
		bne	ai_next
		move.b	(a1),(a3)
 		bra	ai_next

****************************************************************************
*		  All back collision    		  *
****************************************************************************

all_back_col	bsr	p_bull_back_col
		rts

p_bull_back_col	lea	rocket_xys,a5
		lea	srocket_dis,a4
pbb_top		cmp.w	#x_end,(a5)
		rtseq
		cmp.w	#9,(a4)
		bge	pbb_update_vector
		cmp.w	#x_off,(a5)
		bne	pbb_check_col
pbb_update_vector	addq.l	#4,a5
		addq.l	#2,a4
		bra	pbb_top
pbb_check_col	move.l	(a5),gen_x
		and.w	#$ffe0,gen_x
		addi.w	#32,gen_x
		lea	variables,a6
		
		move.w	pixel_count(a6),d1
		sub.w	d1,gen_y
		and.w	#$ffe0,gen_y
		add.w	d1,gen_y
		add.w	#32,gen_y

		bsr	main_back_col
		tst.b	d0
		beq	pbb_update_vector
		move.w	(a5),d0
		move.w	2(a5),d1
		and.w	#$ffe0,d0
		lea	variables,a6
		sub.w	pixel_count(a6),d1
		and.w	#$ffe0,d1
		add.w	pixel_count(a6),d1
		move.w	d0,gen_x
		move.w	d1,gen_y
		move.b	#1,explo_bckground	quick explode sound
		explode_24	d0,d1	
		cmp.b	#1,d3
		bne	pbb_loop
		bsr	init_pickup																	(a5),2(a5)
pbb_loop		move.w	#x_off,(a5)
		bra	pbb_update_vector
		
****************************************************************************
*		Main back collision and reaction
****************************************************************************
		
main_back_col	bsr	gen_map_col
		move.l	background_list,a0
		move.l	destruction_list,a2
		move.b	fuel_mod,d1
		clr.b	d0
		clr.b	d3
mbc_top		cmp.b	#-1,(a0)
		rtseq
		cmp.b	(a1),d1
		beq	hit_landing_pad
		move.b	(a0),d4
		cmp.b	(a1),d4
		beq	mbc_col
		inc.l	a0
		inc.l	a2
		bra	mbc_top
mbc_col		move.l	rotating_gun,a3
		move.b	(a3),d1
		move.b	7(a3),d2
		cmp.b	(a1),d1
		bgt	mbc_col1
		cmp.b	(a1),d2
		blt	mbc_col1
		bra	mbc_col_hit
mbc_col1		move.l	recoil_gun,a3
		move.b	(a3),d1
		move.b	3(a3),d2
		cmp.b	(a1),d1
		bgt	mbc_col1_1
		cmp.b	(a1),d2
		blt	mbc_col1_1
		bra	mbc_col_hit
mbc_col1_1	cmp.w	#1,level
		beq.s	mbc_col1_2
		cmp.w	#3,level
		bne	mbc_col_hit1
mbc_col1_2	lea	plane_pal_list,a3
		move.b	(a3),d1
		move.b	3(a3),d2
		cmp.b	(a1),d1
		bgt	mbc_col_hit1
		cmp.b	(a1),d2
		blt	mbc_col_hit1
mbc_col_hit	move.w	level,d1
		lsl.w	#2,d1
		lea	level_updown_list,a3
		move.l	(a3,d1.w),level1_pal_list_temp
		move.b	#1,pal_up_down
mbc_col_hit1	move.b	(a2),(a1)
		inc.b	d0
		addi.l	#5,score
		rts
hit_landing_pad	inc.b	d3
		clr.b	(a1)
		inc.b	d0
		rts

****************************************************************************
*	       	    Disable rotating gun 
****************************************************************************

disable_rotating_gun	move.b	rotating_gun_destroyed,d0
		lea	rotating_guns,a0
		lea	gun_forward_lev3,a4
		lea	gun_frame_lev3,a5
drg_top		cmp.l	#x_end,(a0)
		rtseq
		cmp.l	#inactive,(a0)
		bne	drg_cont
drg_update_vectors	addq.w	#8,a0
		addq.w	#1,a4
		addq.w	#1,a5
		bra	drg_top
drg_cont		move.l	4(a0),a1
		cmp.b	(a1),d0
		bne	drg_update_vectors
		move.l	#inactive,(a0)
		clr.b	(a4)
		clr.b	(a5)
		bra	drg_update_vectors

****************************************************************************
*		Droid control and print
****************************************************************************

droids		tst.b	droid_flag
		rtseq
		move.w	main_y,droid_y
		addi.w	#15,droid_y
		move.w	main_x,droid1_x
		addi.w	#10,droid2_x
		move.w	main_x,droid2_x
		cmp.w	#60,droid_distance
		bge	.no_further
		addi.w	#2,droid_distance
.no_further	move.w	droid_distance,d0
		add.w	d0,droid2_x
		addi.w	#32,droid2_x
		move.w	droid_distance,d0
		sub.w	d0,droid1_x
		cmp.w	#20,droid1_x
		bgt	.ones_ok
		move.w	#20,droid1_x
.ones_ok		cmp.w	#270,droid2_x
		blt	.twos_ok
		move.w	#270,droid2_x
.twos_ok		move.w	droid_y,gen_y
		move.w	droid1_x,gen_x
		moveq	#0,d0
		move.b	droid_frame,d0
		add.l	#6,d0
		bsr	gen_sprite_16
		move.w	droid_y,gen_y
		move.w	droid2_x,gen_x
		bsr	gen_sprite_16
		dec.b	droid_frame
		rtspl
		move.b	#3,droid_frame
		rts

***************************************************************************
*		Two droid control & print
***************************************************************************

two_droids	tst.b	two_droid_flag
		rtseq
		move.w	main_y,droid_y
		addi.w	#15,droid_y
		move.w	main_x,droid1_x
		addi.w	#10,droid2_x
		move.w	main_x,droid2_x
		cmp.w	#60,droid_distance
		bge	.no_further
		addi.w	#2,droid_distance
.no_further	move.w	droid_distance,d0
		add.w	d0,droid2_x
		addi.w	#32,droid2_x
		move.w	droid_distance,d0
		sub.w	d0,droid1_x
		cmp.w	#20,droid1_x
		bgt	.ones_ok
		move.w	#20,droid1_x
.ones_ok		cmp.w	#270,droid2_x
		blt	.twos_ok
		move.w	#270,droid2_x
.twos_ok		move.w	droid_y,gen_y
		move.w	droid1_x,gen_x
		move.l	gen_x,d0
		cmp.l	droidxy_temp,d0
		beq	prnt_droid_two
		
		move.l	multi_droid2,a0
		cmp.w	#x_end,(a0)
		bne.s	.next
		move.l	#droid_list+32,multi_droid2
		move.l	multi_droid2,a0
.next		move.l	gen_x,(a0)
		move.l	gen_x,droidxy_temp
		addq.l	#4,a0
		move.l	a0,multi_droid2
		move.l	multi_droid1,a0
		cmp.w	#x_end,(a0)
		bne.s	.next1
		move.l	#droid_list+32,multi_droid1
		bra	prnt_droid_two
.next1		addq.l	#4,a0
		move.l	a0,multi_droid1

prnt_droid_two	move.w	droid_y,gen_y
		move.w	droid1_x,gen_x
		moveq	#0,d0
		move.b	droid_frame,d0
		add.l	#6,d0
		bsr	gen_sprite_16

		pushm.l	d6/a0/a3
		move.l	multi_droid1,a0
		cmp.w	#x_end,(a0)
		bne.s	prnt_two_droid2
		move.l	#droid_list+32,multi_droid1
		move.l	multi_droid1,a0
prnt_two_droid2	move.l	(a0),gen_x
		bsr	gen_sprite_16
		popm.l	d6/a0/a3
		pushm.l	d6/a0/a3

		move.w	droid_y,gen_y
		move.w	droid2_x,gen_x
		move.l	gen_x,d0
		cmp.l	droidxy_temp1,d0
		beq	prnt_droid_two1
		
		move.l	multi_droid2_1,a0
		cmp.w	#x_end,(a0)
		bne.s	.next
		move.l	#droid_list1+32,multi_droid2_1
		move.l	multi_droid2_1,a0
.next		move.l	gen_x,(a0)
		move.l	gen_x,droidxy_temp1
		addq.l	#4,a0
		move.l	a0,multi_droid2_1
		move.l	multi_droid1_1,a0
		cmp.w	#x_end,(a0)
		bne.s	.next1
		move.l	#droid_list1+32,multi_droid1_1
		bra	prnt_droid_two1
.next1		addq.l	#4,a0
		move.l	a0,multi_droid1_1

prnt_droid_two1	move.w	droid_y,gen_y
		move.w	droid2_x,gen_x
		popm.l	d6/a0/a3
		pushm.l	d6/a0/a3
		bsr	gen_sprite_16
		popm.l	d6/a0/a3

		pushm.l	d6/a0/a3
		move.l	multi_droid1_1,a0
		cmp.w	#x_end,(a0)
		bne.s	prnt_droid_two1_1
		move.l	#droid_list1+32,multi_droid1_1
		move.l	multi_droid1_1,a0
prnt_droid_two1_1	move.l	(a0),gen_x
		bsr	gen_sprite_16
		popm.l	d6/a0/a3
		dec.b	droid_frame
		rtspl
		move.b	#3,droid_frame
		rts

***************************************************************************
*		Multiple droid control & print
***************************************************************************

multiple_droids	tst.b	multi_droid_flag
		rtseq
		move.w	main_y,droid_y
		addi.w	#15,droid_y
		move.w	main_x,droid1_x
		addi.w	#10,droid2_x
		move.w	main_x,droid2_x
		cmp.w	#60,droid_distance
		bge	.no_further
		addi.w	#2,droid_distance
.no_further	move.w	droid_distance,d0
		add.w	d0,droid2_x
		addi.w	#32,droid2_x
		move.w	droid_distance,d0
		sub.w	d0,droid1_x
		cmp.w	#20,droid1_x
		bgt	.ones_ok
		move.w	#20,droid1_x
.ones_ok		cmp.w	#270,droid2_x
		blt	.twos_ok
		move.w	#270,droid2_x
.twos_ok		move.w	droid_y,gen_y
		move.w	droid1_x,gen_x
		
		move.l	multi_droid3,a0
		cmp.w	#x_end,(a0)
		bne.s	.next
		move.l	#droid_list,multi_droid3
		move.l	multi_droid3,a0
.next		move.l	gen_x,(a0)
		addq.l	#4,a0
		move.l	a0,multi_droid3
		move.l	multi_droid2,a0
		cmp.w	#x_end,(a0)
		bne.s	.next1
		move.l	#droid_list,multi_droid2
		bra	.next2
.next1		addq.l	#4,a0
		move.l	a0,multi_droid2
.next2		move.l	multi_droid1,a0
		cmp.w	#x_end,(a0)
		bne.s	.next3
		move.l	#droid_list,multi_droid1
		bra	prnt_mult_droid
.next3		addq.l	#4,a0
		move.l	a0,multi_droid1


prnt_mult_droid	move.w	droid_y,gen_y
		move.w	droid1_x,gen_x
		moveq	#0,d0
		move.b	droid_frame,d0
		add.l	#6,d0
		bsr	gen_sprite_16

		pushm.l	d6/a0/a3
		move.l	multi_droid2,a0
		cmp.w	#x_end,(a0)
		bne.s	prnt_m_droid1
		move.l	#droid_list,multi_droid2
		move.l	multi_droid2,a0
prnt_m_droid1	move.l	(a0),gen_x
		bsr	gen_sprite_16
		popm.l	d6/a0/a3

		pushm.l	d6/a0/a3
		move.l	multi_droid1,a0
		cmp.w	#x_end,(a0)
		bne.s	prnt_m_droid2
		move.l	#droid_list,multi_droid1
		move.l	multi_droid1,a0
prnt_m_droid2	move.l	(a0),gen_x
		bsr	gen_sprite_16
		popm.l	d6/a0/a3
		pushm.l	d6/a0/a3

		move.w	droid_y,gen_y
		move.w	droid2_x,gen_x
		
		move.l	multi_droid3_1,a0
		cmp.w	#x_end,(a0)
		bne.s	.next
		move.l	#droid_list1,multi_droid3_1
		move.l	multi_droid3_1,a0
.next		move.l	gen_x,(a0)
		addq.l	#4,a0
		move.l	a0,multi_droid3_1
		move.l	multi_droid2_1,a0
		cmp.w	#x_end,(a0)
		bne.s	.next1
		move.l	#droid_list1,multi_droid2_1
		bra	.next2
.next1		addq.l	#4,a0
		move.l	a0,multi_droid2_1
.next2		move.l	multi_droid1_1,a0
		cmp.w	#x_end,(a0)
		bne.s	.next3
		move.l	#droid_list1,multi_droid1_1
		bra	prnt_mult_droid2
.next3		addq.l	#4,a0
		move.l	a0,multi_droid1_1


prnt_mult_droid2	move.w	droid_y,gen_y
		move.w	droid2_x,gen_x
		popm.l	d6/a0/a3
		pushm.l	d6/a0/a3
		bsr	gen_sprite_16
		popm.l	d6/a0/a3

		pushm.l	d6/a0/a3
		move.l	multi_droid2_1,a0
		cmp.w	#x_end,(a0)
		bne.s	prnt_m_droid2_1
		move.l	#droid_list1,multi_droid2_1
		move.l	multi_droid2_1,a0
prnt_m_droid2_1	move.l	(a0),gen_x
		bsr	gen_sprite_16
		popm.l	d6/a0/a3

		pushm.l	d6/a0/a3
		move.l	multi_droid1_1,a0
		cmp.w	#x_end,(a0)
		bne.s	prnt_m_droid2_2
		move.l	#droid_list1,multi_droid1_1
		move.l	multi_droid1_1,a0
prnt_m_droid2_2	move.l	(a0),gen_x
		bsr	gen_sprite_16
		popm.l	d6/a0/a3
		dec.b	droid_frame
		rtspl
		move.b	#3,droid_frame
		rts

***************************************************************************
*		Disable player one ship
***************************************************************************

dis_p_ship	tst.b	p_free_life
		beq	.lop
		rts
.lop		clr.b	get_ready_count
		clr.b	get_ready_count2
		move.b	#40,get_ready_pause
		clr.b	get_ready_reverse
		move.l	#fade_char_in,fade_in_get
		move.l	#fade_char_out,fade_out_get
		explode_40	main_x,main_y
		moveq	#0,d1
		move.w	level,d1
		lsl.w	#2,d1
		lea	level_updown_list,a3
		move.l	(a3,d1.w),level1_pal_list_temp
		move.b	#1,pal_up_down
		move.w	#132,main_x
		move.w	#255,main_y
		move.l	#auto_move,auto_move_list
		move.b	#20,auto_move_cycle
		move.b	#75,p_free_life
		move.w	#999,fuel
		cmp.w	#20,rockets
		bge.s	.dis_p_1
		move.w	#20,rockets
.dis_p_1		cmp.w	#2,guided_missiles
		bge.s	.dis_p_2
		move.w	#2,guided_missiles
.dis_p_2		lea	icon_xy,a0
		cmp.w	#x_off,(a0)
		beq	.dis_p_3
		cmp.b	#4,icon_type
		blt	.dis_p_3
		cmp.b	#7,icon_type
		beq	.dis_p_3
		move.b	#1,weapon_select
		move.b	#4,icon_type
		bra	.dis_p_4
.dis_p_3		clr.b	weapon_select
.dis_p_4		clr.b	landing_flag
		clr.b	droid_flag
		clr.b	multi_droid_flag
		clr.b	two_droid_flag
		clr.b	bullet_type
		tst.b	demo_mode
		bne.s	.lop1
		move.b	#1,auto_heli	bring on from bottom
		tst.w	choppers
		bne	dis_p_ship1
.lop1		fade_pal_out	level_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		move.w	#24,map_x
		bsr	__scroll
		bsr	clear_screens
		move.l	screenb,screenx
		clr.b	flip_flag
		bsr	flip_control
		print_text	failed_title,6400
		print_text	defeat1_title,11200
		print_text	enemy_title,16008
		fade_pal_in	#hi_score_pal
		pause	2500,500
		fade_pal_out	#hi_score_pal
		move.l	#clear_pal,d0
		jsr	set_pal
		bsr	clear_screens
		print_text	game_over_txt,11264
		print_text	game_over_txt1,14144
		fade_pal_in	#hi_score_pal
		pause	500,500
		tst.w	level
		beq	.lop2
		load	#scroll_fname,high_entry_pre,#21608
		unpack	high_entry_pre,21608,scroll_data
		move.w	#63,d0
		bsr	init_data
		unpack	choice_scr_packed,8552,high_entry_pre
.lop2		clr.w	level
		lea	enemy_off,a0
		jsr	all_enemys_off
		jsr	guns_radar_off
		unpack	packed_map,1312,pre_map
		fade_pal_out	#hi_score_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		bsr	clear_screens
		bra	jump_for_hi_score_con

dis_p_ship1	cmp.w	#99,choppers	cheat on
		rtseq
		subi.w	#1,choppers
	 	rts

***************************************************************************
*		Enemy to P collision
***************************************************************************

p_coll		tst.b	landing_flag
		bne	next2_col
		lea	enemy_xys,a0
.col_top		cmp.w	#x_end,(a0)
		beq	next2_col
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		bra	.col_top
.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#32,acolx
		addi.w	#40,acoly
		move.l	main_x,ix
		move.l	main_x,icolx
		addi.w	#32,icolx
		addi.w	#40,icoly
		bsr	gen_col	
		tst.b	d0
		beq	.next
		explode_40	(a0),2(a0)
		move.w	#x_off,(a0)
		bra	dis_p_ship

**********************
next2_col	lea	p_bull_xys,a1
		lea	p_bullet_type,a3
.col1_top	cmp.w	#x_end,(a1)
		beq	next3_col
		cmp.w	#x_off,(a1)
		bne	.col2
.next1		addq.w	#4,a1
		addq.w	#1,a3
		bra	.col1_top	

.col2		lea	enemy_xys,a0
		lea	enemy_hits,a2

.col_top		cmp.w	#x_end,(a0)
		beq	.next1
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		addq.l	#1,a2
		bra	.col_top
.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#32,acolx
		addi.w	#40,acoly
		move.l	(a1),ix
		move.l	(a1),icolx
		addi.w	#6,icolx
		addi.w	#5,icoly
		bsr	gen_col
		tst.b	d0
		beq	.next
		move.b	(a3),d0
		sub.b	d0,(a2)
		tst.b	(a2)
		bpl	.dis_bull
		addi.l	#50,score
		lea	guided_xys,a4
		lea	guided_to_xys,a2
		move.l	a0,d1
.guided_off_lop	cmp.w	#x_end,(a4)
		beq	.dis_bull01
		cmp.l	(a2),d1
		beq.s	.dis_bull0
		addq.l	#4,a2
		addq.l	#4,a4
		bra.s	.guided_off_lop
.dis_bull0	cmp.w	#x_off,(a4)
		beq.s	.dis_bull01
		explode_24	(a4),2(a4)
		move.w	#x_off,(a4)
		clr.l	(a2)
.dis_bull01	explode_40	(a0),2(a0)
		move.w	#x_off,(a0)
		move.w	#x_off,(a1)	explode sound
		bra	.next1
.dis_bull	sound	#gunhit_dig,#1323,#5,#5,#0
		bsr	bull_flash_setup
		move.w	#x_off,(a1)
		bra	.next

**********************
next3_col	lea	gen_bull_xys,a0
.col_top		cmp.w	#x_end,(a0)
		beq	next4_col
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		bra	.col_top
.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#6,acolx
		addi.w	#6,acoly
		move.l	main_x,ix
		move.l	main_x,icolx
		addi.w	#32,icolx
		addi.w	#40,icoly
		bsr	gen_col
		tst.b	d0
		beq	.next
		move.w	#x_off,(a0)
		bra	dis_p_ship
		bra	.next
***********************
next4_col	lea	rocket_xys,a1
		lea	srocket_dis,a2
n.col1_top	cmp.w	#x_end,(a1)
		beq	next5_col
		cmp.w	#7,(a2)
		bge	n.next1
		cmp.w	#x_off,(a1)
		bne	n.col2
n.next1		addq.w	#4,a1
		addq.w	#2,a2
		bra	n.col1_top	

n.col2		lea	tank_xys,a0

n.col_top	cmp.w	#x_end,(a0)
		beq	n.next1
		cmp.w	#x_off,(a0)
		bne	n.check_col
n.next		addq.l	#4,a0
		bra	n.col_top
n.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#32,acolx
		addi.w	#32,acoly
		move.l	(a1),ix
		move.l	(a1),icolx
		addi.w	#6,icolx
		addi.w	#5,icoly
		bsr	gen_col
		tst.b	d0
		beq	n.next
		addi.l	#25,score
		explode_24	(a0),2(a0)
		move.w	#x_off,(a0)
n.dis_bull	move.w	#x_off,(a1)
		bra	n.next1

*********************

next5_col	lea	guided_xys,a1
		lea	guided_to_xys,a2
q.col1_top	cmp.w	#x_end,(a1)
		beq	next6_col
		cmp.w	#x_off,(a1)
		bne	q.col2
q.next1		addq.w	#4,a1
		addq.w	#4,a2
		bra	q.col1_top	

q.col2		lea	enemy_xys,a0
q.col_top	cmp.w	#x_end,(a0)
		beq	q.next1
		cmp.w	#x_off,(a0)
		bne	q.check_col
q.next		addq.l	#4,a0
		bra	q.col_top
q.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#32,acolx
		addi.w	#40,acoly
		move.l	(a1),ix
		move.l	(a1),icolx
		addi.w	#6,icolx
		addi.w	#5,icoly
		bsr	gen_col
		tst.b	d0
		beq	q.next
		addi.l	#75,score
		explode_40	(a0),2(a0)
		move.w	#x_off,(a0)
q.dis_bull	clr.l	(a2)
		move.w	#x_off,(a1)
		bra	q.next1

*******************

next6_col	lea	pickup_xys,a0
		lea	pickup_shadow,a1
nn.col_top	cmp.w	#x_end,(a0)
		beq	next7_col
		cmp.w	#x_off,(a0)
		bne	nn.check_col
nn.next		addq.l	#4,a0
		addq.l	#2,a1
		bra	nn.col_top
nn.check_col	cmp.w	#8,(a1)
		bne	nn.next
		move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#16,acolx
		addi.w	#16,acoly
		move.l	main_x,ix
		move.l	main_x,icolx
		addi.w	#32,icolx
		addi.w	#40,icoly
		bsr	gen_col
		tst.b	d0
		beq	nn.next
		move.w	#x_off,(a0)
		addi.w	#20,rockets
		sound	#pickup_dig,#1061,#5,#5,#0
		bra	nn.next

***********************
next7_col	lea	p_bull_xys,a1
q2.col1_top	cmp.w	#x_end,(a1)
		beq	next8_col
		cmp.w	#x_off,(a1)
		bne	q2.col2
q2.next1		addq.w	#4,a1
		bra	q2.col1_top	

q2.col2		lea	plane_xys,a0

q2.col_top	cmp.w	#x_end,(a0)
		beq	q2.next1
		cmp.w	#x_off,(a0)
		bne	q2.check_col
q2.next		addq.l	#4,a0
		bra	q2.col_top
q2.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#32,acolx
		addi.w	#40,acoly
		move.l	(a1),ix
		move.l	(a1),icolx
		addi.w	#6,icolx
		addi.w	#5,icoly
		bsr	gen_col
		tst.b	d0
		beq	q2.next
		addi.l	#20,score
		move.l	(a0),gen_x
		explode_40	(a0),2(a0)
		move.w	#x_off,(a0)
		move.w	#x_off,(a1)
		tst.b	formation_flag
		beq	q2.next1
		lea	plane_xys,a4
qwe.		cmp.w	#x_end,(a4)
		beq	init.icon
		cmp.w	#x_off,(a4)
		bne	q2.next1
		addq.w	#4,a4
		bra	qwe.
init.icon	move.l	gen_x,icon_xy
		lea	plane_pickup,a0
		cmp.w	#4,(a0)
		beq.s	init_power_up
		clr.w	d0
		move.w	(a0),d0
		move.b	d0,icon_type
		rts

init_power_up	tst.b	weapon_select
		bne	init_power_up1
		move.b	#4,icon_type
		inc.b	weapon_select
		rts
init_power_up1	cmp.b	#1,weapon_select
		bne	init_power_up2
		move.b	#5,icon_type
		inc.b	weapon_select
		rts
init_power_up2	cmp.b	#2,weapon_select
		bne	init_extra
		move.b	#6,icon_type
		inc.b	weapon_select
		rts
init_extra	clr.b	icon_type
		rts

**************
* player buller to big enemy

next8_col	lea	p_bull_xys,a1
		lea	p_bullet_type,a4
.col1_top	cmp.w	#x_end,(a1)
		beq	next9_col
		cmp.w	#x_off,(a1)
		bne	.col2
.next1		addq.w	#4,a1
		addq.w	#1,a4
		bra	.col1_top

.col2		lea	big_enemy_xys,a0
		lea	big_enemy_hits,a2
		lea	big_enemy_explode,a3

.col_top		cmp.w	#x_end,(a0)
		beq	.next1
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		addq.l	#2,a2
		addq.l	#1,a3
		bra	.col_top
.check_col	tst.b	(a3)
		bne.s	.next
		move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#64,acolx
		addi.w	#68,acoly
		move.l	(a1),ix
		move.l	(a1),icolx
		addi.w	#6,icolx
		addi.w	#5,icoly
		bsr	gen_col
		tst.b	d0
		beq	.next
		clr.w	d0
		move.b	(a4),d0
		sub.w	d0,(a2)
		tst.w	(a2)
		bpl.s	.dis_bull
		move.b	#1,(a3)
		addi.l	#250,score
.dis_bull	sound	#gunhit_dig,#1323,#5,#5,#0
		bsr	bull_flash_setup
		move.w	#x_off,(a1)
		bra	.next

****************
* player rocket to big enemy

next9_col	lea	rocket_xys,a1
		lea	srocket_dis,a2
.col1_top	cmp.w	#x_end,(a1)
		beq	next10_col
		cmp.w	#7,(a2)
		bge	.next1
		cmp.w	#x_off,(a1)
		bne	.col2
.next1		addq.w	#4,a1
		addq.w	#2,a2
		bra	.col1_top

.col2		lea	big_enemy_xys,a0
		lea	big_enemy_hits,a3
		lea	big_enemy_explode,a4

.col_top		cmp.w	#x_end,(a0)
		beq	.next1
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		addq.l	#2,a3
		addq.l	#1,a4
		bra	.col_top
.check_col	tst.b	(a4)
		bne.s	.next
		move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#64,acolx
		addi.w	#68,acoly
		move.l	(a1),ix
		move.l	(a1),icolx
		addi.w	#6,icolx
		addi.w	#5,icoly
		bsr	gen_col
		tst.b	d0
		beq	.next
		subq.w	#2,(a3)
		tst.w	(a3)
		bpl.s	.dis_bull
		move.b	#1,(a4)
		addi.l	#250,score
.dis_bull	move.w	#x_off,(a1)
		bra	.next

************************
* player coll with big ship

next10_col	tst.b	landing_flag
		bne	next11_col
		lea	big_enemy_xys,a0
.col_top		cmp.w	#x_end,(a0)
		beq	next11_col
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		bra	.col_top
.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#64,acolx
		addi.w	#68,acoly
		move.l	main_x,ix
		move.l	main_x,icolx
		addi.w	#32,icolx
		addi.w	#40,icoly
		bsr	gen_col	
		tst.b	d0
		beq	.next
		bra	dis_p_ship

**********************
* player bullet to big chopper

next11_col	lea	p_bull_xys,a1
		lea	p_bullet_type,a3
.col1_top	cmp.w	#x_end,(a1)
		beq	next12_col
		cmp.w	#x_off,(a1)
		bne	.col2
.next1		addq.w	#4,a1
		addq.w	#1,a3
		bra	.col1_top

.col2		lea	big_chop_xys,a0
		lea	big_chop_hits,a2

.col_top		cmp.w	#x_end,(a0)
		beq	.next1
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		addq.l	#2,a2
		bra	.col_top
.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#64,acolx
		addi.w	#57,acoly
		move.l	(a1),ix
		move.l	(a1),icolx
		addi.w	#6,icolx
		addi.w	#5,icoly
		bsr	gen_col
		tst.b	d0
		beq	.next
		moveq.w	#0,d0
		move.b	(a3),d0
		sub.w	d0,(a2)
		tst.w	(a2)
		bpl.s	.dis_bull
		addi.l	#50,score
		subq.w	#7,(a0)
		subq.w	#8,2(a0)
		explode_24	(a0),2(a0)
		addq.w	#7,(a0)
		addq.w	#8,2(a0)
		explode_40	(a0),2(a0)
		move.w	#x_off,(a0)
		move.w	#x_off,(a1)
		bra	.next
.dis_bull	sound	#gunhit_dig,#1323,#5,#5,#0
		bsr	bull_flash_setup
		move.w	#x_off,(a1)
		bra	.next

************************
* player coll with big chopper

next12_col	tst.b	landing_flag
		bne	next13_col
		lea	big_chop_xys,a0
.col_top		cmp.w	#x_end,(a0)
		beq	next13_col
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		bra	.col_top
.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#64,acolx
		addi.w	#57,acoly
		move.l	main_x,ix
		move.l	main_x,icolx
		addi.w	#32,icolx
		addi.w	#40,icoly
		bsr	gen_col	
		tst.b	d0
		beq	.next
		explode_40	(a0),2(a0)
		move.w	#x_off,(a0)
		bra	dis_p_ship

***************
* player rocket to train

next13_col	lea	rocket_xys,a1
		lea	srocket_dis,a2
.col1_top	cmp.w	#x_end,(a1)
		beq	next14_col
		cmp.w	#7,(a2)
		bge	.next1
		cmp.w	#x_off,(a1)
		bne	.col2
.next1		addq.w	#4,a1
		addq.w	#2,a2
		bra	.col1_top	

.col2		lea	train_xys,a0
		lea	train_seq_vectors,a3

.col_top		cmp.w	#x_end,(a0)
		beq	.next1
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		addq.l	#4,a3
		bra	.col_top
.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#32,acolx
		addi.w	#21,acoly
		move.l	(a1),ix
		move.l	(a1),icolx
		addi.w	#6,icolx
		addi.w	#5,icoly
		bsr	gen_col
		tst.b	d0
		beq	.next
		addi.l	#20,score
		explode_24	(a0),2(a0)
		move.w	#x_off,(a0)
		move.w	#x_off,(a1)
		addq.l	#4,a0
		addq.l	#4,a3
.train_still	cmp.w	#x_end,(a0)
		beq	.next1
		cmp.w	#x_off,(a0)
		bne.s	.train_still1
		bra	.next1
.train_still1	move.l	#still_train,(a3)
		addq.l	#4,a3
		addq.l	#4,a0
		bra	.train_still

************************
* player coll with plane

next14_col	tst.b	landing_flag
		bne	next15_col
		lea	plane_xys,a0
.col_top		cmp.w	#x_end,(a0)
		beq	next15_col
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		bra	.col_top
.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#32,acolx
		addi.w	#40,acoly
		move.l	main_x,ix
		move.l	main_x,icolx
		addi.w	#32,icolx
		addi.w	#40,icoly
		bsr	gen_col	
		tst.b	d0
		beq	.next
		explode_40	(a0),2(a0)
		move.w	#x_off,(a0)
		bra	dis_p_ship
		tst.b	formation_flag
		beq	.next
		lea	plane_xys,a4
.qwe.		cmp.w	#x_end,(a4)
		beq	.init.icon
		cmp.w	#x_off,(a4)
		bne	.next
		addq.w	#4,a4
		bra	.qwe.
.init.icon	move.l	gen_x,icon_xy
		lea	plane_pickup,a0
		cmp.w	#4,(a0)
		beq.s	.init_power_up
		moveq.w	#0,d0
		move.w	(a0),d0
		move.b	d0,icon_type
		rts

.init_power_up	tst.b	weapon_select
		bne	.init_power_up1
		move.b	#4,icon_type
		inc.b	weapon_select
		rts
.init_power_up1	cmp.b	#1,weapon_select
		bne	.init_power_up2
		move.b	#5,icon_type
		inc.b	weapon_select
		rts
.init_power_up2	cmp.b	#2,weapon_select
		bne	.init_extra
		move.b	#6,icon_type
		inc.b	weapon_select
		rts
.init_extra	clr.b	icon_type
		rts

**********************
* Player collision with enemy formation

next15_col	tst.b	landing_flag
		bne	next16_col
		lea	enemyf_xys,a0
.col_top		cmp.w	#x_end,(a0)
		beq	next16_col
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.l	#4,a0
		bra	.col_top
.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#16,acolx
		addi.w	#16,acoly
		move.l	main_x,ix
		move.l	main_x,icolx
		addi.w	#32,icolx
		addi.w	#40,icoly
		bsr	gen_col	
		tst.b	d0
		beq	.next
		explode_24	(a0),2(a0)
		move.w	#x_off,(a0)
		bra	dis_p_ship

************************
* Player bullet to enemy formations

next16_col	lea	p_bull_xys,a1
		lea	p_bullet_type,a3
.col1_top	cmp.w	#x_end,(a1)
		rtseq
		cmp.w	#x_off,(a1)
		bne	.col2
.next1		addq.w	#4,a1
		addq.w	#1,a3
		bra	.col1_top

.col2		lea	enemyf_xys,a0
		lea	enemyf_hits,a2

.col_top		cmp.w	#x_end,(a0)
		beq	.next1
		cmp.w	#x_off,(a0)
		bne	.check_col
.next		addq.w	#4,a0
		addq.w	#1,a2
		bra	.col_top
.check_col	move.l	(a0),ax
		move.l	(a0),acolx
		addi.w	#16,acolx
		addi.w	#16,acoly
		move.l	(a1),ix
		move.l	(a1),icolx
		addi.w	#6,icolx
		addi.w	#5,icoly
		bsr	gen_col
		tst.b	d0
		beq	.next
		moveq.w	#0,d0
		move.b	(a3),d0
		sub.b	d0,(a2)
		tst.b	(a2)
		bpl.s	.dis_bull
		addi.l	#10,score
		sub.w	#4,(a0)
		sub.w	#4,2(a0)
		explode_24	(a0),2(a0)
		move.w	#x_off,(a0)
		move.w	#x_off,(a1)
		bra	.next
.dis_bull	sound	#gunhit_dig,#1323,#5,#5,#0
		bsr	bull_flash_setup
		move.w	#x_off,(a1)
		bra	.next

***************************************************************************
* 		 Icon control and collision			 		* 
***************************************************************************

icon_control	cmp.w	#x_off,icon_xy
		rtseq
		cmp.b	#7,icon_type
		beq	._con1
		tst.b	landing_flag
		bne	._con
._con1		add.w	#1,icon_xy+2
._con		cmp.w	#190,icon_xy+2
		ble	ic.lop
		move.w	#x_off,icon_xy
		rts
ic.lop		move.l	icon_xy,gen_x
		moveq	#0,d0
		lea	icon_data,a0
		move.b	icon_type,d0
		lsl.w	#2,d0
		move.l	(a0,d0.l),d0
		bsr	gen_sprite_16
		move.l	icon_xy,ax
		move.l	icon_xy,acolx
		add.w	#16,acolx
		add.w	#16,acoly
		move.l	main_x,ix
		move.l	main_x,icolx
		add.w	#32,icolx
		add.w	#44,icoly
		bsr	gen_col
		tst.b	d0
		rtseq
*		sound	#pickup_dig,#1061,#5,#5,#0
		move.w	#x_off,icon_xy
		tst.b	icon_type
		bne	loop..
		move.w	#999,fuel
		rts
loop..		cmp.b	#1,icon_type
		bne	loop..1
		add.w	#20,rockets
		rts		
loop..1		cmp.b	#2,icon_type
		bne	loop..2
		add.w	#5,guided_missiles
		rts		
loop..2		cmp.b	#3,icon_type
		bne	loop..3
		lea	smart_off_list,a0
		move.l	(a0),a1
.smart_bomb_top	cmp.w	#x_end,(a1)
		beq.s	.next_enemy
		cmp.w	#x_off,(a1)
		bne.s	.explode_enemy
.smart_bomb_top1	addq.l	#4,a1
		bra.s	.smart_bomb_top
.explode_enemy	move.w	(a1),d0
		move.w	2(a1),d1
		explode_40	d0,d1
		bra.s	.smart_bomb_top1
.next_enemy	addq.l	#4,a0
		cmp.l	#end_list,(a0)
		bne	.next_addr
		lea	enemy_off1,a0
		bsr	all_enemys_off
		moveq	#0,d1
		move.w	level,d1
		lsl.w	#2,d1
		lea	level_smart_pal_l,a3
		move.l	(a3,d1.w),level1_pal_list_temp
		move.b	#1,pal_up_down
		rts
.next_addr	move.l	(a0),a1
		bra	.smart_bomb_top

loop..3		cmp.b	#4,icon_type	single droid
		bne	loop..4
		move.b	#1,droid_flag
		move.w	#2,droid_distance
		rts

loop..4		cmp.b	#5,icon_type	double droid
		bne	loop..5
		move.b	#1,two_droid_flag
		clr.b	droid_flag
		move.w	#2,droid_distance
		move.w	main_y,droidxy_temp+2
		move.w	main_y,droidxy_temp1+2
		addi.w	#15,droidxy_temp+2
		move.w	main_x,droidxy_temp
		addi.w	#10,droidxy_temp1
		move.w	main_x,droidxy_temp1
		lea	droid_list+32,a0
		lea	droid_list1+32,a1
		move.w	#7,d0
.lop		move.l	droidxy_temp,(a0)+
		move.l	droidxy_temp1,(a1)+
		dbra.w	d0,.lop
		move.l	#droid_list+32,multi_droid1
		move.l	#droid_list+64,multi_droid2
		move.l	#droid_list1+32,multi_droid1_1
		move.l	#droid_list1+64,multi_droid2_1
		rts
		
loop..5		cmp.b	#6,icon_type	multi droid
		bne	loop..6
		clr.b	two_droid_flag
		move.b	#1,multi_droid_flag
		move.w	#2,droid_distance
		move.w	main_y,droidxy_temp+2
		move.w	main_y,droidxy_temp1+2
		addi.w	#15,droidxy_temp+2
		move.w	main_x,droidxy_temp
		addi.w	#10,droidxy_temp1
		move.w	main_x,droidxy_temp1
		lea	droid_list,a0
		lea	droid_list1,a1
		move.w	#15,d0
.lop		move.l	droidxy_temp,(a0)+
		move.l	droidxy_temp1,(a1)+
		dbra.w	d0,.lop
		move.l	#droid_list,multi_droid1
		move.l	#droid_list+32,multi_droid2
		move.l	#droid_list+64,multi_droid3
		move.l	#droid_list1,multi_droid1_1
		move.l	#droid_list1+32,multi_droid2_1
		move.l	#droid_list1+64,multi_droid3_1
		rts

loop..6		cmp.b	#7,icon_type	power bullets
		rtsne
		cmp.b	#2,bullet_type
		rtseq
		inc.b	bullet_type
		rts

***************************************************************************
*		Options
***************************************************************************

options		cmp.b	#$50,key
		bne	op1_lop
*		move.l	variables,map_temp
*		move.l	#infinite_scroll_map,variables
*		move.b	#1,infinite_scroll
		move.w	#99,choppers
		rts
op1_lop		cmp.b	#$51,key
		bne	op_lop
*		move.l	map_temp,variables
*		move.b	#0,infinite_scroll
		move.b	#1,droid_flag
		move.w	#2,droid_distance
		move.b	#1,weapon_select
		rts
op_lop		cmp.b	#$40,key
		bne	op2_lop
		eor.b	#1,game_flag
		rts

op2_lop		cmp.b	#$59,key
		bne	op3_lop
		move.l	#6140,cycle_count
		rts

op3_lop		cmp.b	#$52,key
		bne	op4_lop
		move.b	#3,icon_type
		lea	icon_xy,a0
		move.w	#100,(a0)
		move.w	#20,2(a0)
		rts

op4_lop		cmp.b	#$53,key
		bne	op5_lop
		move.b	#4,icon_type
		move.b	#2,weapon_select
		lea	icon_xy,a0
		move.w	#100,(a0)
		move.w	#20,2(a0)
		rts

op5_lop		cmp.b	#$19,key		pause
		bne	op6_lop
		fade_pal_out	level_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		bsr	clear_screens
		move.l	screena,screenx
		print_text	pause_txt,11216
		move.l	screenb,screenx
		print_text	pause_txt,11216
		fade_pal_in	#hi_score_pal
op5_lop1		jsr	joy_init
		btst	#7,d0
		beq	op5_lop1
		fade_pal_out	#hi_score_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		move.l	screena,screenx
		bsr	__scroll
		bsr	one_player
		bsr	enemys
		bsr	update_explo_40
		bsr	print_score
		bsr	print_small_chop
		move.l	screenb,screenx
		bsr	__scroll
		bsr	one_player
		bsr	enemys
		bsr	update_explo_40
		bsr	print_score
		bsr	print_small_chop
		fade_pal_in	level_pal
		rts

op6_lop		cmp.b	#$0f,key
		bne	op7_lop
		lea	variables,a6
		subi.l	#60,map_vector(a6)
		addi.l	#192,cycle_count
		subi.w	#6*32,map_y
		rts

op7_lop		cmp.b	#$45,key		quit
		rtsne
		clr.b	p_free_life
		clr.w	choppers
		bra	dis_p_ship

***************************************************************************
*		Clear screens
***************************************************************************

clear_screens	move.l	screena,a0
		move.l	screenb,a1
		move.w	#10240,d0
.lop		clr.l	(a0)+
		clr.l	(a1)+
		dbra.w	d0,.lop
		rts

quick_clear	movem.l	screenx,a0-a1	routine for hi-score table
		lea	7208(a0),a0
		lea	7336(a1),a1
		move.w	#17,d0
quick_lop0	clr.l	(a0)
		clr.l	4(a0)
		clr.l	(a1)
		clr.l	4(a1)
		lea	160(a0),a0
		lea	160(a1),a1
		dbra.w	d0,quick_lop0

		move.l	screenx,a0
		lea	10080(a0),a0
		move.w	#605,d0
quick_lop	clr.l	(a0)+
		clr.l	(a0)+
		clr.l	(a0)+
		clr.l	(a0)+
		clr.l	(a0)+
		clr.l	(a0)+
		clr.l	(a0)+
		clr.l	(a0)+
		clr.l	(a0)+
		clr.l	(a0)+
		dbra.w	d0,quick_lop
		rts

****************************************************************************
*		Enemy calls
****************************************************************************

enemys		bsr	enemy_setup
		bsr	train_control
		bsr	tank_control
		bsr	big_chop_control
		bsr	update_explo_24
		bsr	enemy_control
		bsr	enemyf_control
		bsr	enemy_limits
		bsr	big_enemy_control
		bsr	big_enemy_exploding
		bsr	big_e_scroll_stop
		bsr	guns_control
		bsr	plane_control
		bsr	gen_enemy_bull
		rts

****************************************************************************
*		Enemy setup
****************************************************************************

enemy_setup	move.l	setup_pointer,a0
		move.l	cycle_count,d0
		cmp.l	(a0),d0
		rtsle
		add.l	#8,setup_pointer
		move.l	4(a0),a0
		move.l	(a0)+,a1
		jmp	(a1)

****************************************************************************
*		Setup bullet flash on enemy
****************************************************************************

bull_flash_setup	pushm.l	all_regs
		lea	bull_flash_xys,a4
		lea	bull_flash_frn,a5
		lea	bull_flash_pause,a6
bull_flash_updte	cmp.w	#x_end,(a4)
		beq	bull_flash_end
		cmp.w	#x_off,(a4)
		beq	.set_it
		addq.w	#4,a4
		addq.w	#1,a5
		addq.w	#1,a6
		bra	bull_flash_updte

.set_it		move.l	(a1),(a4)
		move.b	#0,(a5)
		move.b	#0,(a6)
bull_flash_end	popm.l	all_regs
		rts

****************************************************************************
*		Print bullet flash on enemy
****************************************************************************

print_bull_flash	lea	bull_flash_xys,a3
		lea	bull_flash_frn,a4
		lea	bull_flash_pause,a5
.p_top		cmp.w	#x_end,(a3)
		rtseq
		cmp.w	#x_off,(a3)
		bne	.p_bull_go
.p_update_vector	addq.w	#4,a3
		addq.w	#1,a4
		addq.w	#1,a5
		bra	.p_top

.p_bull_go	move.l	(a3),gen_x
		moveq.l	#0,d0
		move.b	(a4),d0
		bsr	bull_flash_sprite
		cmp.b	#0,(a5)
		beq	.update_frn
		subq.b	#1,(a5)
		bra	.p_update_vector

.update_frn	cmp.b	#2,(a4)
		beq	.switch_off
		addq.b	#1,(a4)
		move.b	#0,(a5)
		bra	.p_update_vector

.switch_off	move.w	#x_off,(a3)
		bra	.p_update_vector

****************************************************************************
*		Small Formations setup
****************************************************************************

enemyf_setup	lea	enemyf_hits,a6
		lea	enemyf_xys,a2
		lea	enemyf_seq_vectors,a3
		lea	enemyf_frame_numbers,a5
		lea	enemyf_seq_rept,a1
		lea	enemyf_pause,a4
.set_it		move.l	(a0),(a2)+
		move.l	(a0),(a2)+
		move.l	(a0),(a2)+
		move.l	(a0),(a2)+
		move.l	(a0),(a2)+
		move.l	(a0)+,(a2)

		move.l	(a0),(a3)+
		move.l	#form_vec,(a3)+
		move.l	#form1_vec,(a3)+
		move.l	#form2_vec,(a3)+
		move.l	#form3_vec,(a3)+
		move.l	#form4_vec,(a3)+
		move.l	(a0),form_add
		move.l	(a0),form1_add
		move.l	(a0),form2_add
		move.l	(a0),form3_add
		move.l	(a0)+,form4_add

		move.w	#5,d0
enemyf_setup_1	clr.b	(a5)+
		move.b	enemyf_hit,(a6)+
		move.b	#-1,(a1)+
		move.b	#2,(a4)
		dbra.w	d0,enemyf_setup_1
		rts

****************************************************************************
*		Enemy Formation Control
****************************************************************************

enemyf_control	lea	enemyf_xys,a2		
		lea	enemyf_seq_vectors,a3	
		lea	enemyf_frame_numbers,a5
		lea	enemyf_seq_rept,a1
		lea	enemyf_pause,a4
shcf_top		cmp.w	#x_end,(a2)
		rtseq
		cmp.w	#x_off,(a2)
		bne	update_itef
update_vectorsef	addq.w	#4,a2
		addq.w	#4,a3
		addq.w	#1,a5
		addq.w	#1,a4
		addq.w	#1,a1
		bra.s	shcf_top

update_itef	move.l	(a3),a6
		cmp.b	#$ff,(a6)
		beq	link_sequencesef
		cmp.w	#x_end,(a6)
		bne	.move_it
		move.w	#x_off,(a2)
		bra.s	update_vectorsef

.move_it		cmp.b	#-1,(a1)
		beq	.move_it1
		subq.l	#2,(a3)
		move.l	(a3),a6
		tst.b	(a1)
		bne	.move_it0
		addq.l	#4,(a3)
		move.l	(a3),a6
		move.b	#-1,(a1)
		bra.s	.move_it1
.move_it0	addq.l	#2,(a3)
		subq.b	#1,(a1)
		bra.s	ef.frame_done
.move_it1	addq.l	#2,(a3)
		cmp.b	#99,2(a6)
		bne.s	ef.frame_done
		move.b	3(a6),(a1)

ef.frame_done	tst.b	landing_flag
		bne	p.tc_con
		addi.w	#1,2(a2)
ef.tc_con	moveq.w	#0,d0
		moveq.w	#0,d1
		move.b	(a6)+,d0
		move.b	(a6),d1
		ext.w	d0
		ext.w	d1
		add.w	d0,(a2)
		add.w	d1,2(a2)		x,y calaculated

		
		tst.b	(a4)
		beq	enemyf_cont
		subi.b	#1,(a4)
		bra	enemyf_pnt_it

enemyf_cont	move.b	#2,(a4)
		cmp.b	#3,(a5)		do frames
		bne	incr_enyffrm
		clr.b	(a5)
		bra	enemyf_pnt_it
incr_enyffrm	addi.b	#1,(a5)
enemyf_pnt_it	move.l	(a2),gen_x	print it
		moveq.l	#0,d0
		move.b	(a5),d0
		addi.l	#13,d0
		bsr	bull_sprite
		bra	update_vectorsef

link_sequencesef	move.l	2(a6),(a3)
		bra	update_itef

****************************************************************************
*		Plane setup
****************************************************************************

plane_setup	lea	plane_seq_rept,a1
		lea	plane_xys,a2
		lea	plane_seq_vectors,a3
.set_it		move.l	(a0)+,(a2)+
		move.l	(a0)+,(a2)+
		move.l	(a0)+,(a2)+
		move.l	(a0),(a2)+

		move.l	4(a0),(a3)+
		move.l	4(a0),(a3)+
		move.l	4(a0),(a3)+
		move.l	4(a0),(a3)+

		lea	plane_frame_bases,a4
		move.l	8(a0),(a4)
		lea	plane_pickup,a5
		move.w	12(a0),(a5)
		move.b	#1,formation_flag
		move.b	#-1,(a1)
		move.b	#-1,1(a1)
		move.b	#-1,2(a1)
		move.b	#-1,3(a1)
		rts

****************************************************************************
*		Plane formation control
****************************************************************************

plane_control	lea	plane_seq_rept,a1
		lea	plane_xys,a2
		lea	plane_seq_vectors,a3
		lea	plane_frame_bases,a4
hcf_top		cmp.w	#x_end,(a2)
		rtseq
		cmp.w	#x_off,(a2)
		bne	p.update_it
p.update_vectors	addq.w	#4,a2
		addq.w	#4,a3
		addq.w	#1,a1
		bra	hcf_top
p.update_it	move.l	(a3),a6
		cmp.w	#$ff,(a6)
		beq	p.link_sequences
		cmp.w	#x_end,(a6)
		bne	p.move_it
		move.w	#x_off,(a2)
		clr.b	formation_flag
		bra	p.update_vectors
p.move_it	cmp.b	#-1,(a1)
		beq	.move_it1
		subq.l	#2,(a3)
		move.l	(a3),a6
		tst.b	(a1)
		bne	.move_it0
		addq.l	#4,(a3)
		move.l	(a3),a6
		move.b	#-1,(a1)
		bra.s	.move_it1
.move_it0	addq.l	#2,(a3)
		subq.b	#1,(a1)
		bra.s	p.frame_done
.move_it1	addq.l	#2,(a3)
		cmp.b	#99,2(a6)
		bne.s	p.frame_done
		move.b	3(a6),(a1)

p.frame_done	tst.b	landing_flag
		bne	p.tc_con
		addi.w	#1,2(a2)
p.tc_con		clr.w	d0
		clr.w	d1
		move.b	(a6)+,d0
		move.b	(a6),d1
		ext.w	d0
		ext.w	d1
		add.w	d0,(a2)
		add.w	d1,2(a2)
		move.l	(a2),gen_x
*		pushm.l	all_regs
*		move.l	(a4),a1
*		lea	7296(a1),a1		
*		add.w	#12,gen_y
*		sub.w	#15,gen_x
*		bsr	sp_hel_pla_sprite
*		popm.l	all_regs
		move.l	(a2),gen_x
		move.l	#12,d0
		bsr	p_hel_pla_sprite
		bra	p.update_vectors
p.link_sequences	move.l	2(a6),(a3)
		bra	p.update_it

****************************************************************************
*		Train sprite setup
****************************************************************************

train_setup	lea	train_xys,a2		
		lea	train_seq_vectors,a3
		lea	train_frames,a4
		lea	train_switch_off,a5
		move.l	(a0),(a2)+
		move.l	(a0),(a2)+
		move.l	(a0),(a2)+
		move.l	(a0),(a2)+
		move.l	(a0),(a2)

		move.l	4(a0),(a3)+
		move.l	#tform_vec,(a3)+
		move.l	#tform1_vec,(a3)+
		move.l	#tform2_vec,(a3)+
		move.l	#tform3_vec,(a3)
		move.l	4(a0),tform_add
		move.l	4(a0),tform1_add
		move.l	4(a0),tform2_add
		move.l	4(a0),tform3_add
		move.l	8(a0),(a4)+
		move.b	12(a0),(a4)
		move.l	cycle_count,d0
		addi.l	#256,d0
		move.l	d0,(a5)
		rts

****************************************************************************
*		Train formation control
****************************************************************************

train_control	lea	train_xys,a2		
		lea	train_seq_vectors,a3	
		lea	train_frame_bases,a4
		lea	train_frames,a5
thcf_top		cmp.w	#x_end,(a2)
		rtseq
		cmp.w	#x_off,(a2)
		bne	t.update_it
t.update_vectors	addq.w	#4,a2
		addq.w	#4,a3
		addq.l	#1,a5
		bra	thcf_top
t.update_it	lea	train_switch_off,a6
		move.l	(a6),d0
		cmp.l	cycle_count,d0
		blt	train_off
		move.l	(a3),a6
		cmp.w	#$ff,(a6)
		beq	t.link_sequences
		cmp.w	#x_end,(a6)
		bne	t.move_it
		move.w	#x_off,(a2)
		clr.b	formation_flag
		bra	t.update_vectors
t.move_it	add.l	#2,(a3)
		
t.frame_done	tst.b	landing_flag
		bne	t.tc_con
		addi.w	#1,2(a2)
t.tc_con		move.w	(a6),d0
		add.w	d0,(a2)
		pushm.l	all_regs
		move.l	(a2),gen_x
		clr.l	d0
		move.b	(a5),d0
*		lsl.w	#2,d0
*		move.l	(a4,d0.w),a1
		bsr	train_sprite
		popm.l	all_regs
		random
		and.l	#$ff,d0
		cmp.w	#15,d0
		bgt	t.update_vectors
		move.w	(a2),d3
		move.w	2(a2),d4
		lea	train_gun_dir,a1
		lea	train_gun_pos,a6
		clr.l	d0
		move.b	(a5),d0
		lsl.w	#2,d0
		move.w	(a1,d0.w),d1
		move.w	2(a1,d0.w),d2
		tst.w	d1
		beq	t.update_vectors
		add.w	(a6,d0.w),d3
		add.w	2(a6,d0.w),d4
		dis_bull	#3,d3,d4,d1,d2
*		sound	#rapidgun_dig,#703,#5,#5,#0
		bra	t.update_vectors
t.link_sequences	move.l	2(a6),(a3)
		bra	t.update_it

train_off	lea	train_xys,a0	switch off train sequence
		move.w	#x_off,(a0)
		move.w	#x_off,4(a0)
		move.w	#x_off,8(a0)
		move.w	#x_off,12(a0)
		move.w	#x_off,16(a0)
		rts

****************************************************************************
*		Small tank setup
****************************************************************************

tank_setup	lea	tank_xys,a2		
		lea	tank_seq_vectors,a3	
		lea	tank_frame_bases,a4
		lea	tank_frame_numbers,a5
		lea	tank_seq_rept,a6
tnk_top		cmp.w	#x_end,(a2)
		rtseq
		cmp.w	#x_off,(a2)
		beq	.set_it
		addq.w	#4,a2
		addq.w	#4,a3
		addq.w	#4,a4
		addq.w	#1,a5
		addq.w	#1,a6
		bra.s	tnk_top
.set_it		move.l	(a0)+,(a2)
		move.l	(a0)+,(a3)
		move.l	(a0),(a4)
		move.b	#2,(a5)
		move.b	#-1,(a6)
		rts

****************************************************************************
*		Tank control
****************************************************************************

tank_control	lea	tank_seq_rept,a1
		lea	tank_xys,a2
		lea	tank_seq_vectors,a3
		lea	tank_frame_bases,a4
		lea	tank_frame_numbers,a5
		lea	tank_bull_dis,a0
		eor.b	#$1,tank_frame_toggle
tc_top		cmp.w	#x_end,(a2)
		rtseq
		cmp.w	#x_off,(a2)
		bne	.tank_update_it
.update_vectors	addq.w	#4,a2
		addq.w	#4,a3
		addq.w	#4,a4
		addq.w	#1,a5
		addq.w	#1,a1
		bra	tc_top
.tank_update_it	move.l	(a3),a6
		cmp.w	#$ff,(a6)
		beq	.tank_link_seq
		cmp.w	#255,2(a2)         
		bge	.disable_it
		cmp.w	#x_end,(a6)
		bne	.move_it
.disable_it	move.w	#x_off,(a2)
		bra	.update_vectors
.move_it		cmp.b	#-1,(a1)
		beq	.move_it1
		subq.l	#2,(a3)
		move.l	(a3),a6
		tst.b	(a1)
		bne	.move_it0
		addq.l	#4,(a3)
		move.l	(a3),a6
		move.b	#-1,(a1)
		bra.s	.move_it1
.move_it0	addq.l	#2,(a3)
		subq.b	#1,(a1)
		bra.s	.move_it2
.move_it1	addq.l	#2,(a3)
		cmp.b	#99,2(a6)
		bne.s	.move_it2
		move.b	3(a6),(a1)
.move_it2	clr.w	d0
		clr.w	d1
		move.b	(a6)+,d0
		move.b	(a6),d1
		ext.w	d0
		ext.w	d1
		tst.w	d0
		blt	.x_neg
		beq	.no_x
.x_pos		tst.w	d1
		blt	.y_neg
		beq	.no_y
.y_pos		move.b	#3,(a5)
		bra	.anim_done
.y_neg		move.b	#1,(a5)
		bra	.anim_done	
.no_y		move.b	#2,(a5)
		bra	.anim_done

.x_neg		tst.w	d1
		blt	.y_neg1
		beq	.no_y1
.y_pos1		move.b	#5,(a5)
		bra	.anim_done
.y_neg1		move.b	#7,(a5)
		bra	.anim_done	
.no_y1		move.b	#6,(a5)
		bra	.anim_done

.no_x		tst.w	d1
		blt	.y_neg2
		beq	.anim_done
.y_pos2		move.b	#4,(a5)
		bra	.anim_done
.y_neg2		clr.b	(a5)
		bra	.anim_done	


.anim_done	add.w	d0,(a2)
		add.w	d1,2(a2)
		tst.b	landing_flag
		bne	.tc_con
		addi.w	#1,2(a2)
.tc_con		move.l	(a2),gen_x
		pushm.l	all_regs
*		move.l	(a4),a2
		clr.l	d1
		tst.b	flip_flag
		beq	.continue
		addq.l	#8,d1
.continue	clr.l	d0
		move.b	(a5),d0
		add.l	d1,d0
		bsr	tank_sprite
		popm.l	all_regs
		random
		and.l	#$ff,d0
		cmp.w	#15,d0
		bgt	.update_vectors
		move.b	(a5),d0
		asl.w	#2,d0
		push.l	a6
		lea	tank_xy_bull_dis,a6
		move.w	(a6,d0.w),d1
		move.w	(a2),d2
		add.w	d1,d2
		move.w	2(a6,d0.w),d1
		move.w	2(a2),d3
		add.w	d1,d3
		pop.l	a6
		move.w	2(a0,d0.w),d1
		move.w	(a0,d0.w),d0
		dis_bull	#3,d2,d3,d0,d1
*		sound	#rapidgun_dig,#703,#5,#5,#0
		bra	.update_vectors
.tank_link_seq	move.l	2(a6),(a3)
		bra	.tank_update_it

****************************************************************************
*		Big chopper setup
****************************************************************************

big_chop_setup	lea	big_chop_seq_rept,a1
		lea	big_chop_xys,a2		
		lea	big_chop_seq_vectors,a3	
		lea	big_chop_frame_bases,a4
		lea	big_chop_frame_numbers,a5
		lea	big_chop_hits,a6
bc_top		cmp.w	#x_end,(a2)
		rtseq
		cmp.w	#x_off,(a2)
		beq	bc.set_it
		addq.w	#4,a2
		addq.w	#4,a3
		addq.w	#4,a4
		addq.w	#1,a5
		addq.w	#2,a6
		addq.w	#1,a1
		bra.s	bc_top
bc.set_it	move.l	(a0)+,(a2)
		move.w	(a0)+,(a6)
		move.l	(a0)+,(a3)
		move.l	(a0),(a4)
		move.b	#-1,(a1)
		move.b	#2,(a5)
*		tst.b	infinite_scroll
*		rtsne
*		move.l	variables,map_temp
*		move.l	#infinite_scroll_map,variables
*		move.b	#1,infinite_scroll
		rts

****************************************************************************
*		Big chopper control
****************************************************************************

big_chop_control	cmp.w	#x_off,big_chop_xys
		bne	.loppp
		tst.b	infinite_scroll
		rtseq
		lea	variables,a6
		cmp.w	#30,pixel_count(a6)
		rtsne
		move.l	map_temp,variables
		move.b	#0,infinite_scroll
		rts
.loppp		lea	big_chop_seq_rept,a1
		lea	big_chop_xys,a2
		lea	big_chop_seq_vectors,a3
		lea	big_chop_frame_bases,a4
		lea	big_chop_frame_numbers,a5
		lea	big_chop_bull_dis,a0
bcc_top		cmp.w	#x_end,(a2)
		rtseq
		cmp.w	#x_off,(a2)
		bne	.update_it
.update_vectors	addq.w	#4,a2
		addq.w	#4,a3
		addq.w	#4,a4
		addq.w	#1,a5
		bra	bcc_top
.update_it	move.l	(a3),a6
		cmp.w	#$ff,(a6)
		beq	.link_sequences
		cmp.w	#255,2(a2)         
		bge	.disable_it
		cmp.w	#x_end,(a6)
		bne	.move_it
.disable_it	move.w	#x_off,(a2)
		bra	.update_vectors
.move_it		cmp.b	#-1,(a1)
		beq	.move_it1
		subq.l	#2,(a3)
		move.l	(a3),a6
		tst.b	(a1)
		bne	.move_it0
		addq.l	#4,(a3)
		move.l	(a3),a6
		move.b	#-1,(a1)
		bra.s	.move_it1
.move_it0	addq.l	#2,(a3)
		subq.b	#1,(a1)
		bra.s	.move_it2
.move_it1	addq.l	#2,(a3)
		cmp.b	#99,2(a6)
		bne.s	.move_it2
		move.b	3(a6),(a1)
.move_it2	clr.w	d0
		clr.w	d1
		move.b	(a6)+,d0
		move.b	(a6),d1
		ext.w	d0
		ext.w	d1
		tst.w	d0
		blt	.x_neg
		beq	.no_x
.x_pos		tst.w	d1
		blt	.y_neg
		beq	.no_y
.y_pos		move.b	#3,(a5)
		bra	.anim_done
.y_neg		move.b	#1,(a5)
		bra	.anim_done	
.no_y		move.b	#2,(a5)
		bra	.anim_done

.x_neg		tst.w	d1
		blt	.y_neg1
		beq	.no_y1
.y_pos1		move.b	#5,(a5)
		bra	.anim_done
.y_neg1		move.b	#7,(a5)
		bra	.anim_done	
.no_y1		move.b	#6,(a5)
		bra	.anim_done

.no_x		tst.w	d1
		blt	.y_neg2
		beq	.anim_done
.y_pos2		move.b	#4,(a5)
		bra	.anim_done
.y_neg2		clr.b	(a5)
		bra	.anim_done	


.anim_done	add.w	d0,(a2)
		add.w	d1,2(a2)
		tst.b	landing_flag
		bne	.tc_con
		addi.w	#1,2(a2)
.tc_con		move.l	(a2),gen_x
		pushm.l	all_regs
		move.l	(a4),a2
		clr.l	d1
		tst.b	flip_flag
		beq	.continue
		moveq	#8,d1
.continue	clr.l	d0
		move.b	(a5),d0
		add.l	d1,d0
		bsr	p_big_c_sprite
*		move.l	(a2,d0.w),a1
*		adda.l	#big_chopper,a1
*		move.w	#57,count1
*		bsr	sprite_64n
		popm.l	all_regs
		random
		and.l	#$ff,d0
		cmp.w	#15,d0
		bgt	.update_vectors
		move.b	(a5),d0
		asl.w	#2,d0
		move.w	2(a0,d0.w),d1
		move.w	(a0,d0.w),d0
		bra	.update_vectors
.link_sequences	move.l	2(a6),(a3)
		bra	.update_it

****************************************************************************
*		Enemy init
****************************************************************************

enemy_init	lea	enemy_seq_rept,a1
		lea	enemy_xys,a2		
		lea	enemy_seq_vectors,a3	
		lea	enemy_frame_bases,a4
		lea	enemy_hits,a5
		lea	enemy_frames,a6
shb_top		cmp.w	#x_end,(a2)
		rtseq
		cmp.w	#x_off,(a2)
		beq	.set_it
		addq.w	#4,a2
		addq.w	#4,a3
		addq.w	#4,a4
		addq.w	#1,a5
		addq.w	#1,a6
		addq.w	#1,a1
		bra.s	shb_top
.set_it		move.l	(a0)+,(a2)
		move.l	(a0)+,(a3)
		move.l	(a0),(a4)
		move.b	level_enemy_hit,(a5)
		clr.b	(a6)
		move.b	#-1,(a1)
		rts

****************************************************************************
*		Enemy control
****************************************************************************

enemy_control	lea	enemy_seq_rept,a0
		lea	enemy_xys,a2
		lea	enemy_seq_vectors,a3
		lea	enemy_frame_bases,a4
		lea	enemy_frames,a1
		lea	enemy_dis,a5
hcb_top		cmp.w	#x_end,(a2)
		rtseq
		cmp.w	#x_off,(a2)
		bne	.update_it
.update_vectors	addq.w	#4,a2
		addq.w	#4,a3
		addq.w	#4,a4
		addq.w	#1,a1
		addq.w	#1,a0
		bra	hcb_top
.update_it	move.l	(a3),a6
		cmp.w	#$ff,(a6)
		beq	.link_sequences
		cmp.w	#x_end,(a6)
		bne	.move_it
		move.w	#x_off,(a2)
		bra	.update_vectors
.move_it		cmp.b	#-1,(a0)
		beq	.move_it1
		subq.l	#2,(a3)
		move.l	(a3),a6
		tst.b	(a0)
		bne	.move_it0
		addq.l	#4,(a3)
		move.l	(a3),a6
		move.b	#-1,(a0)
		bra.s	.move_it1
.move_it0	addq.l	#2,(a3)
		subq.b	#1,(a0)
		bra.s	.move_it2
.move_it1	addq.l	#2,(a3)
		cmp.b	#99,2(a6)
		bne.s	.move_it2
		move.b	3(a6),(a0)
.move_it2	random
		and.l	#$ff,d0
		cmp.w	#7,d0
		bgt	.frame_done
		move.w	(a2),gen_x
		move.w	2(a2),gen_y
		add.w	#14,gen_x
		add.w	#14,gen_y
.frame_done	inc.b	(a1)
		cmp.b	#4,(a1)
		bne	.hcb_lop
		clr.b	(a1)
.hcb_lop		clr.w	d4
		clr.w	d5
		move.b	(a6)+,d4
		move.b	(a6),d5
		ext.w	d4
		ext.w	d5
		add.w	d4,(a2)
		add.w	d5,2(a2)
		tst.b	landing_flag
		bne	.hcb_lop1
		addi.w	#1,2(a2)	
.hcb_lop1	move.l	(a2),gen_x
		pushm.l	all_regs
		clr.l	d3
		move.b	(a1),d3
*		pushm.l	a1/a5/d3
*		subi.w	#12,gen_x
*		addi.w	#12,gen_y
*		bsr	enemy_shadow
*		popm.l	a1/a5/d3
*		addi.w	#12,gen_x
*		subi.w	#15,gen_y
		move.l	d3,d0
		cmp.l	#1,(a4)
		beq	.enemy_control_1
		add.l	#4,d0		chopper 2
.enemy_control_1	add.l	#4,d0		chopper 1
		bsr	p_hel_pla_sprite
		popm.l	all_regs
		bra	.update_vectors
.link_sequences	move.l	2(a6),(a3)
		bra	.update_it

****************************************************************************
*		Enemy limits
****************************************************************************

enemy_limits	lea	enemy_limit_list,a1
.top0		move.l	(a1),a0
.top		cmp.w	#x_end,(a0)
		beq.s	.next
		cmp.w	#x_off,(a0)
		bne.s	.check_it
.top1		addq.l	#4,a0
		bra	.top
.next		addq.l	#4,a1
		cmp.l	#end_list,(a1)
		rtseq
		bra	.top0

.check_it	cmp.w	#-60,2(a0)
		blt.s	.switch_off
		cmp.w	#255,2(a0)
		bgt	.switch_off
		cmp.w	#-60,(a0)
		blt	.switch_off
		cmp.w	#320,(a0)
		bgt	.switch_off
		bra	.top1

.switch_off	move.w	#x_off,(a0)
		bra	.top1

***************************************************************************
*		Big enemy setup (gunship)
***************************************************************************

big_enemy_setup	lea	big_enemy_xys,a1
		lea	big_enemy_hits,a2
		lea	big_enemy_pointer,a3
		lea	big_enemy_frn,a4
		lea	big_e_bull_dis,a5
		lea	big_e_cycle_bull,a6
		moveq.l	#0,d0
big_en_setup1	cmp.w	#x_end,(a1)
		rtseq
		cmp.w	#x_off,(a1)
		beq.s	big_enemy_set
		addq.l	#4,a1
		addq.l	#2,a2
		addq.l	#4,a3
		addq.l	#1,a4
		lea	20(a5),a5
		addq.l	#1,a6
		addq.b	#1,d0
		bra.s	big_en_setup1

big_enemy_set	move.l	(a0)+,(a1)
		move.w	(a0)+,(a2)
		move.l	(a0)+,(a3)
		move.l	(a0)+,(a5)+
		move.l	(a0)+,(a5)+
		move.l	(a0)+,(a5)+
		move.l	(a0)+,(a5)+
		move.l	(a0)+,(a5)+
		move.b	(a0)+,(a6)
		clr.b	(a4)
		lea	big_e_cycle_count,a0
		adda.l	d0,a0
		clr.b	(a0)
		lea	big_enemy_explode,a0
		adda.l	d0,a0
		clr.b	(a0)

		lea	big_e_expl_point,a0
		lea	big_e_explo_delay,a2
		tst.b	d0
		beq.s	.lop
		lea	big_e_explo_pause1,a1
		bra.s	.lop1
.lop		lea	big_e_explo_pause,a1
.lop1		move.l	(a2)+,(a1)
		move.l	(a2)+,4(a1)
		lsl.w	#2,d0
		adda.l	d0,a0
		move.l	a1,(a0)

		lea	big_e_expl_dis_point,a0
		adda.l	d0,a0
		move.l	#big_e_explo_dis,(a0)
		clr.b	big_enemy_on
		rts

***************************************************************************
*		Jump re-route routine
***************************************************************************

jump_for_main	bra	_main1
jump_for_choice_screen
		bra	choice_screen
jump_for_hi_score_con
		bra	hi_score_control

***************************************************************************
*		Big enemy control
***************************************************************************

big_enemy_control	lea	big_enemy_xys,a0
		lea	big_enemy_pointer,a1
		lea	big_enemy_frn,a3
		lea	big_enemy_explode,a4
		lea	big_e_bull_dis,a5
		lea	big_e_cycle_bull,a2
		lea	big_e_cycle_count,a6
big_e_con	cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		bne.s	big_enemy_go
big_e_con1	addq.l	#4,a0
		addq.l	#4,a1
		addq.l	#1,a2
		addq.l	#1,a6
		addq.l	#1,a3
		addq.l	#1,a4
		lea	20(a5),a5
		bra.s	big_e_con

big_enemy_go	push.l	a5
		clr.l	d0
		move.b	(a3),d0

		move.l	(a0),gen_x
		move.w	gen_y,d1
		addi.w	#70,d1
		tst.w	d1
		bpl.s	.big_e_cont
		move.b	#1,big_enemy_on
		bra.s	.big_e_update

.big_e_cont	pushm.l	all_regs
		bsr	sprite_80x70
		popm.l	all_regs

.big_e_update	pop.l	a5
		tst.b	(a4)	1 = big enemy exploding
		bne	big_e_con1
		push.l	a6
		move.l	(a1),a6
		cmp.w	#$ff,(a6)
		beq	big_link_sequence
		move.w	(a6)+,d0
		move.w	(a6),d1
		move.w	d1,d2
		add.w	d0,(a0)
		add.w	d1,2(a0)
		addq.l	#4,(a1)

		move.l	(a0),gen1_x	direction bullets
		pop.l	a6
		tst.w	gen1_y
		bmi	big_enemy_frame1
		move.b	(a6),d0
		cmp.b	(a2),d0
		bne	big_enemy_frame
		clr.b	(a6)
		add.w	#35,gen1_x
		add.w	#25,gen1_y
		dis_bull	#3,gen1_x,gen1_y,(a5),2(a5)
		dis_bull	#3,gen1_x,gen1_y,4(a5),6(a5)
		dis_bull	#3,gen1_x,gen1_y,8(a5),10(a5)
		dis_bull	#3,gen1_x,gen1_y,12(a5),14(a5)
		dis_bull	#3,gen1_x,gen1_y,16(a5),18(a5)
*		sound	#rapidgun_dig,#703,#5,#5,#0

big_enemy_frame	addq.b	#1,(a6)
big_enemy_frame1	tst.w	d2		work out frames
		bpl.s	big_flip_forward
		tst.b	(a3)
		beq.s	big_e_flip_back
		clr.b	(a3)
		bra	big_e_con1
big_e_flip_back	move.b	#1,(a3)
		bra	big_e_con1

big_flip_forward	tst.b	(a3)
		beq.s	big_flip_forward1
		clr.b	(a3)
		bra	big_e_con1
big_flip_forward1	move.b	#1,(a3)		
		bra	big_e_con1

big_link_sequence	move.l	2(a6),(a1)
		pop.l	a6
		bra	big_e_con1

***************************************************************************
*		Big enemy exploding
***************************************************************************

big_enemy_exploding
		lea	big_enemy_xys,a0
		lea	big_enemy_explode,a1
		lea	big_e_expl_point,a2
		lea	big_e_expl_dis_point,a3
big_e_explo_top	cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		beq.s	big_e_explo_top1
		tst.b	(a1)
		bne.s	big_e_explo
big_e_explo_top1	addq.l	#4,a0
		addq.l	#1,a1
		addq.l	#4,a2
		addq.l	#4,a3
		bra.s	big_e_explo_top

big_e_explo	move.l	(a2),a4
		cmp.b	#255,(a4)
		beq.s	big_e_final_explo
		tst.b	(a4)
		beq.s	big_set_explo
		dec.b	(a4)
		bra	big_e_explo_top1

big_set_explo	move.l	(a3),a5
		move.l	(a0),gen_x
		move.w	(a5),d0
		move.w	2(a5),d1
		addq.l	#4,(a3)
		addq.l	#1,(a2)
		add.w	d0,gen_x
		add.w	d1,gen_y
		explode_40	gen_x,gen_y
		bra	big_e_explo_top1

big_e_final_explo	move.w	(a0),d0
		move.w	2(a0),d1
		explode_24	d0,d1
		add.w	#3,d0
		add.w	#2,d1
		explode_40	d0,d1
		add.w	#8,d0
		add.w	#8,d1
		explode_24	d0,d1
		add.w	#5,d0
		sub.w	#2,d1
		explode_40	d0,d1
		add.w	#8,d0
		add.w	#15,d1
		explode_40	d0,d1
		sub.w	#20,d0
		add.w	#5,d1
		explode_24	d0,d1
		sub.w	#6,d0
		add.w	#1,d1
		explode_40	d0,d1

		lea	big_enemy_xys,a6
		cmp.w	#x_off,(a6)
		beq	big_explod_final0
		cmp.w	#x_off,4(a6)
		bne	big_explod_final3
big_explod_final0	cmp.b	#2,bullet_type
		bne	big_explod_final1
		move.b	#1,icon_type
		bra	big_explod_final2
big_explod_final1	move.b	#7,icon_type
big_explod_final2	move.w	(a0),d0
		move.w	2(a0),d1
		addi.w	#32,d0
		addi.w	#35,d1
		lea	icon_xy,a6
		move.w	d0,(a6)
		move.w	d1,2(a6)
big_explod_final3	move.w	#x_off,(a0)
		clr.b	(a1)
		bra	big_e_explo_top1

***************************************************************************
*		Check if to start scrolling
***************************************************************************

big_e_scroll_stop	lea	big_enemy_xys,a0
		cmp.w	#x_off,(a0)
		rtsne
		cmp.w	#x_off,4(a0)
		rtsne
		clr.b	big_enemy_on
		rts

***************************************************************************
*		Init big explosion
***************************************************************************

init_explo_32	lea	explo24_xys,a0
		lea	explo24_frames,a1
ie32_top		cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		beq	.set_it
		addq.w	#4,a0
		addq.w	#1,a1
		bra	ie32_top
.set_it		move.l	gen_x,(a0)
		clr.b	(a1)
		tst.b	explo_bckground
		beq	set_explo32_1
		sound	#quick_explo_dig,#4542,#6,#5,#1
		clr.b	explo_bckground
		rts
set_explo32_1	sound	#explo_dig,#5659,#6,#5,#2
		rts

***************************************************************************
*		Update small explosion
***************************************************************************

update_explo_24	lea	explo24_xys,a0
		lea	explo24_frames,a1
		lea	explo24_list,a2
ieu32_top	cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		bne	.update_it
.next		addq.w	#4,a0
		addq.w	#1,a1
		bra	ieu32_top
.update_it	inc.b	(a1)
		cmp.b	#8,(a1)
		bne	.print_it
		move.w	#x_off,(a0)
		bra	.next
.print_it	tst.b	landing_flag
		bne	.ieu_lop
		addi.w	#1,2(a0)
.ieu_lop		move.l	(a0),gen_x
		clr.w	d1
		move.b	(a1),d1
		asl.w	#2,d1
		move.l	(a2,d1.w),d0
		bsr	explo_sprite	
		bra	.next

***************************************************************************
*		Init big explosion
***************************************************************************

init_explo_40	lea	explo40_xys,a0
		lea	explo40_frames,a1
ie40_top		cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		beq	ie_set_it
		addq.w	#4,a0
		addq.w	#1,a1
		bra	ie40_top
ie_set_it	move.l	gen_x,(a0)
		clr.b	(a1)
		sound	#explo_dig,#5659,#6,#5,#2
		rts

***************************************************************************
*		Update big explosion
***************************************************************************

update_explo_40	lea	explo40_xys,a0
		lea	explo40_frames,a1
		lea	explo40_list,a2
ieu40_top	cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		bne	.update_it	
.next		addq.w	#4,a0
		addq.w	#1,a1
		bra	ieu40_top
.update_it	tst.b	big_enemy_on
		bne	.update_it1
		tst.b	flip_flag
		beq	.update_it2
.update_it1	inc.b	(a1)
.update_it2	cmp.b	#8,(a1)
		bne	.print_it
		move.w	#x_off,(a0)
		bra	.next
.print_it	tst.b	landing_flag
		bne	.ieu_lop
		addi.w	#1,2(a0)
.ieu_lop		move.l	(a0),gen_x
		clr.w	d1
		move.b	(a1),d1
		asl.w	#2,d1
		move.l	(a2,d1.w),d0
		bsr	explo_sprite
		bra	.next

***************************************************************************
*		Sprite for helicopters & plane
***************************************************************************

p_hel_pla_sprite	pushm.l	all_regs
		lea	hel_plane_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

***************************************************************************
*		Sprite for Big helicopter
***************************************************************************

p_big_c_sprite	pushm.l	all_regs
		lea	big_chop_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

***************************************************************************
*		Sprite for tank
***************************************************************************

tank_sprite	pushm.l	all_regs
		lea	tank_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

***************************************************************************
* 		            SPRITE			 		* 
***************************************************************************

p_main_shadow	rts
		move.w	gen_y,d3
		move.w	gen_x,D1
		move.w	d1,D2

		and.w	#$000F,D1	 
		and.w	#$FFF0,D2
		asr.w	#3,D2	 

		lea	y_table,a2
		asl.w	#1,d3
		move.w	(a2,d3),d4
		move.l	screenx,a0
		add.w	D2,D4	 
		move.w	D1,a3		a3 = count
		adda.w	D4,A0
		
		lea	mains_frame_table,a3
		asr.w	#1,d1
*		lea	main_shadow,a1
		add.w	(a3,d1.w),a1
		move.w	#40,d6
		cmp.w	#151+56,gen_y
		ble	t.sp_lop1
		move.w	#191+56,d6
		sub.w	gen_y,d6
		rtsle
t.sp_lop1	move.w	#2,d5
t.sp_lop		move.w	(a1),d4
		not.w	d4
		and.w	D4,(A0)
		and.w	D4,40(A0)
		and.w	D4,80(A0)
		and.w	D4,120(A0)
		move.w	(A1)+,d0
		or.w	D0,80(A0)
		addq.w	#2,a0
		dbra.w	d5,t.sp_lop
		ADDA.w	#154,A0
		DBRA.w	D6,t.sp_lop1
		rts

***************************************************************************
* 		            SPRITE			 		* 
***************************************************************************

shadow_16	pushm.l	a0-a4
		move.l	shadow_data,a1
		move.w	#15,d6
		move.w	gen_y,d3
		move.w	d3,d4
		bpl	es_try_lower_clip
		cmp.w	#-15,d4
		ble	es_leave_sp
		neg.w	d4
		move.w	#15,d6
		sub.w	d4,d6
		asl.w	#2,d4
		add.w	d4,a1
		clr.w	d3
		bra	es_clip_done
es_try_lower_clip	cmp.w	#191,gen_y
		bge	es_leave_sp
		cmp.w	#175,gen_y
		blt	es_clip_done
		move.w	#191,d6
		sub.w	gen_y,d6		

es_clip_done	move.w	gen_x,D1
		move.w	d1,D2

		and.w	#$000F,D1	 
		and.w	#$FFF0,D2
		asr.w	#1,D2	 

		lea	y_table,a2
		asl.w	#1,d3
		move.w	(a2,d3),d4
		move.l	screenx,a0
		add.w	D2,D4	 
		adda.w	D4,A0
		
		asl.w	#6,d1
		add.w	d1,a1
r.sp_lop1	move.w	#1,d5
r.sp_lop		move.w	(a1),d4
		not.w	d4
		and.w	D4,(A0)+
		and.w	D4,(A0)+
		and.w	D4,(A0)
		and.w	D4,2(A0)
		move.w	(A1)+,d0
		or.w	D0,(A0)
		addq.w	#4,a0
		dbra.w	d5,r.sp_lop
		ADDA.w	#144,A0
		DBRA.w	D6,r.sp_lop1
es_leave_sp	popm.l	a0-a4
		rts

***************************************************************************
*		Train sprite
***************************************************************************

train_sprite	pushm.l	all_regs
		lea	train_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

***************************************************************************
*		Explosion sprite
***************************************************************************

explo_sprite	pushm.l	all_regs
		lea	explo_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

***************************************************************************
*		Bullets,16x16,spare 16x16,rocket,guided rocket sprite
***************************************************************************

bull_sprite	pushm.l	all_regs
		lea	bullet_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts		

***************************************************************************
*		Print pickups,droids & hi-score pointer
***************************************************************************

gen_sprite_16	pushm.l	all_regs
		lea	pick_dr_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

***************************************************************************
*		Guided sprite
***************************************************************************

guided_sprite	pushm.l	all_regs
		lea	bullet_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

***************************************************************************
*		Bullet flash sprite
***************************************************************************

bull_flash_sprite	pushm.l	all_regs
		lea	bull_flash_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

****************************************************************************
*		             Build Y table 		   		  *
****************************************************************************

build_y_table	lea	y_table,a0
		clr.w	d0
		move.w	#255,d4
.loop		move.w	d0,d1
		move.w	d1,d2
		asl.w	#5,d1
		asl.w	#7,d2
		add.w	d1,d2
		move.w	d2,(a0)+
		inc.w	d0
		dbra.w	d4,.loop
		rts

***************************************************************************
*	           General Enemy Bullet Routine
****************************************************************************

gen_enemy_bull	lea	gen_bull_xys,a0
		lea	gen_bull_dis,a1
		lea	gen_bull_grfx,a2
gb_top		cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		bne	.update_bull
.update_vectors	addq.l	#4,a0
		addq.l	#4,a1
		addq.l	#4,a2
		bra	gb_top
.update_bull	move.w	(a1),d0
		move.w	2(a1),d1
		add.w	d0,(a0)
		add.w	d1,2(a0)
		tst.b	landing_flag
		bne	.its.landing
		addi.w	#1,2(a0)
.its.landing	cmp.w	#6,(a0)
		blt	.disable_it
		cmp.w	#4,2(a0)
		blt	.disable_it
		cmp.w	#316,(a0)
		bge	.disable_it
		cmp.w	#255,2(a0)
		bge	.disable_it
		move.l	(a0),gen_x
		move.l	(a2),d0
		bsr	bull_sprite
		bra	.update_vectors
.disable_it	move.w	#x_off,(a0)
		bra	.update_vectors

***************************************************************************
*	        General Enemy directional Bullet setup	              *
****************************************************************************

gen_dbull_setup	pushm.l	a0-a2
		lea	gen_bull_xys,a0
		lea	gen_bull_dis,a1
		lea	gen_bull_grfx,a2
ges_top		cmp.w	#x_end,(a0)
		bne	.continue
		popm.l	a0-a2
		rts
.continue	cmp.w	#x_off,(a0)
		beq	.set_it
		addq.l	#4,a0
		addq.l	#4,a1
		addq.l	#4,a2
		bra	ges_top
.set_it		move.l	d0,(a2)
		move.l	from_x,(a0)
		move.l	from_x,gen1_x
		bsr	return_displacements
.lop1		move.w	gen_x,(a1)+
		move.w	gen_y,(a1)
		popm.l	a0-a2
		rts

***************************************************************************
*	        General Enemy displacement Bullet setup	              *
****************************************************************************

gen_dsbull_setup	pushm.l	a0-a2
		lea	gen_bull_xys,a0
		lea	gen_bull_dis,a1
		lea	gen_bull_grfx,a2
gdes_top		cmp.w	#x_end,(a0)
		bne	.continue
		popm.l	a0-a2
		rts
.continue	cmp.w	#x_off,(a0)
		beq	.set_it
		addq.l	#4,a0
		addq.l	#4,a1
		addq.l	#4,a2
		bra	gdes_top
.set_it		move.l	d0,(a2)
		move.l	from_x,(a0)
		move.l	dis_x,(a1)
		popm.l	a0-a2
		rts

***************************************************************************
* 		       General collision			    * 		
***************************************************************************

GEN_COL		MOVEM.L	D1-D7,-(sp)
		MOVE.W	AX,D0
		MOVE.W	AY,D1
		MOVE.W	ACOLX,D2
		MOVE.W	ACOLY,D3

		CMP.W	IX,D0
		BLT	GENXT
		CMP.W	ICOLX,D0
		BGT	GENXT
		CMP.W	IY,D1
		BLT	GENXT
		CMP.W	ICOLY,D1
		BLT	GECOL

GENXT		CMP.W	IX,D2
		BLT	GENXT1
		CMP.W	ICOLX,D2
		BGT	GENXT1
		CMP.W	IY,D1
		BLT	GENXT1
		CMP.W	ICOLY,D1
		BLT	GECOL

GENXT1		CMP.W	IX,D2
		BLT	GENXT2
		CMP.W	ICOLX,D2
		BGT	GENXT2
		CMP.W	IY,D3
		BLT	GENXT2
		CMP.W	ICOLY,D3
		BLT	GECOL

GENXT2		CMP.W	IX,D0
		BLT	GENXT3
		CMP.W	ICOLX,D0
		BGT	GENXT3
		CMP.W	IY,D3
		BLT	GENXT3
		CMP.W	ICOLY,D3
		BLT	GECOL

GENXT3		MOVE.W	IX,D0
		MOVE.W	IY,D1
		MOVE.W	ICOLX,D2
		MOVE.W	ICOLY,D3

		CMP.W	AX,D2
		BLT	GENXT4
		CMP.W	ACOLX,D2
		BGT	GENXT4
		CMP.W	AY,D3
		BLT	GENXT4
		CMP.W	ACOLY,D3
		BLT	GECOL

GENXT4		CMP.W	AX,D0
		BLT	GENXT5
		CMP.W	ACOLX,D0
		BGT	GENXT5
		CMP.W	AY,D3
		BLT	GENXT5
		CMP.W	ACOLY,D3
		BLT	GECOL

GENXT5		CMP.W	AX,D2
		BLT	GENXT6
		CMP.W	ACOLX,D2
		BGT	GENXT6
		CMP.W	AY,D1
		BLT	GENXT6
		CMP.W	ACOLY,D1
		BLT	GECOL

GENXT6		CMP.W	AX,D0
		BLT	GENOCOL
		CMP.W	ACOLX,D0
		BGT	GENOCOL
		CMP.W	AY,D1
		BLT	GENOCOL
		CMP.W	ACOLY,D1
		BGT	GENOCOL
	
GECOL		MOVE.B	#1,D0
		MOVEM.L	(sp)+,D1-D7
		RTS
 	
GENOCOL		CLR.B	D0
		MOVEM.L	(sp)+,D1-D7
		RTS

***************************************************************************
* 	          Return map address from x,y	 	  * 
***************************************************************************

gen_map_col 	lea	variables,a6
		move.w	pixel_count(a6),d0
		move.l	map_vector(a6),a1
		move.w	gen_y,d1
		cmp.w	d0,d1
		ble	gmc_x
		sub.w	d0,d1
		move.w	d1,d2
		and.w	#$1f,d1
		beq	gmc_y
		adda.l	#10,a1
gmc_y		and.w	#$ffe0,d2
		lsr.w	#5,d2
		move.w	d2,d1
		asl.w	#3,d1
		asl.w	#1,d2
		add.w	d1,d2
		adda.w	d2,a1
gmc_x		move.w	gen_x,d0
		move.w	d0,d1
		and.w	#$1f,d0
		beq	gm_nxt
		inc.l	a1
gm_nxt		and.w	#$ffe0,d1
		lsr.w	#5,d1
		adda.w	d1,a1
		dec.l	a1
		rts

***************************************************************************
*		Scroll
***************************************************************************

__scroll		cmp.l	#6140,cycle_count
		bne	__scroll1
		pause	2500,250
		clr.b	game_flag
		inc.w	level
		fade_pal_out	level_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		bsr	clear_screens
		move.l	screenb,screenx
		clr.b	flip_flag
		bsr	flip_control
		cmp.w	#1,level
		beq	ld_scr2
		cmp.w	#2,level
		beq	ld_scr1
		cmp.w	#3,level
		beq	ld_level_4
		bra	end_sequence

ld_level_4	print_text	load_level4,11216
		fade_pal_in	#hi_score_pal
		load	#scroll3_fname,high_entry_pre,#21532
		unpack	high_entry_pre,21532,scroll_data
		move.w	#63,d0
		bsr	init_data
		load	#map3_fname,high_entry_pre,#1124
		unpack	high_entry_pre,1124,pre_map
		bra	ld_scroll_cont
		
ld_scr1		print_text	load_level3,11216
		fade_pal_in	#hi_score_pal
		load	#scroll2_fname,high_entry_pre,#21576
		unpack	high_entry_pre,21576,scroll_data
		move.w	#63,d0
		bsr	init_data
		load	#map2_fname,high_entry_pre,#1180
		unpack	high_entry_pre,1180,pre_map
		bra	ld_scroll_cont

ld_scr2		print_text	load_level2,11216
		fade_pal_in	#hi_score_pal

		load	#scroll1_fname,high_entry_pre,#23504
		unpack	high_entry_pre,23504,scroll_data
		move.w	#63,d0
		bsr	init_data
		load	#map1_fname,high_entry_pre,#1236
		unpack	high_entry_pre,1236,pre_map

ld_scroll_cont	fade_pal_out	#hi_score_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		bsr	clear_screens
		lea	enemy_off,a0
		bsr	all_enemys_off
		bsr	guns_radar_off
		move.w	#999,fuel
		move.w	#132,main_x
		move.w	#255,main_y
		move.b	#20,auto_move_cycle
		move.l	#auto_move,auto_move_list
		move.b	#75,p_free_life
		cmp.w	#20,rockets
		bge.s	ld_scroll_cont1
		move.w	#20,rockets
ld_scroll_cont1	cmp.w	#2,guided_missiles
		bge.s	ld_scroll_cont2
		move.w	#2,guided_missiles
ld_scroll_cont2	clr.b	game_flag
		move.b	#1,auto_heli
		move.w	#24,map_x
		clr.b	mid_count
		clr.b	landing_flag
		clr.b	big_enemy_on
		clr.b	pal_up_down
		move.l	#64,cycle_count
		move.w	#192*32,map_y	**********
		move.w	#10,map_width
		move.w	#24,map_x
		clr.w	temp1
		rts

__scroll1	tst.b	landing_flag
		bne	__lop

		tst.b	big_enemy_on
		bne.s	__lop

		tst.b	infinite_scroll
		bne	__lop
		inc.l	cycle_count
		dec.w	map_y
		
__lop		lea	variables,a6
		move.l	screenx,a0
		move.l	data_vector(a6),a5
		move.l	map_vector(a6),a2
		tst.b	landing_flag
		bne	__lop1
		tst.b	big_enemy_on
		bne.s	__lop1
		addi.w	#1,pixel_count(a6)
__lop1		cmp.w	#32,pixel_count(a6)
		bne	clip_it
		clr.w	pixel_count(a6)
		tst.b	infinite_scroll
		bne	__scroll_forever
		subi.l	#10,map_vector(a6)
__scroll_forever	move.l	map_vector(a6),a2
		bra	clip_it		

clip_it		move.w	pixel_count(a6),d1
		move.w	#32,d0
		sub.w	d1,d0
		asl.w	#4,d0
		bsr	print_clipped_strip
		move.w	pixel_count(a6),d0
		move.w	d0,d1
		asl.w	#5,d0
		asl.w	#7,d1
		add.w	d1,d0
		adda.w	d0,a0
		lea	10(a2),a2
		bsr	mid_5
		move.w	pixel_count(a6),d0
		move.w	#31,d1
		sub.w	d0,d1
		moveq.w	#0,d0
		bsr	print_clipped_strip
		rts

mid_5		bsr	multi_scroll
		rts		

***************************************************************************
*		Strip print routines
***************************************************************************

print_whole_strip		rts

print_clipped_strip	rts			

***************************************************************************
*		Initialise joystick routine
***************************************************************************

joy_init		lea	joyport1,a1
		move.w	joy1dat+custom,d4
		btst	#7,$bfe001
		Bne	clr_fire
		bset	#fire,(a1)
		bra	tst_left
clr_fire		bclr	#fire,(a1)

tst_left		btst	#9,d4
		Beq	clr_left
		bset	#left,(a1)
		bra	tst_right
clr_left		bclr	#left,(a1)

tst_right	btst	#1,d4
		Beq	clr_right
		bset	#right,(a1)
		bra	tst_down
clr_right	bclr	#right,(a1)

tst_down		move.w	d4,d5
		lsr.w	#1,d5
		eor.w	d4,d5
		btst	#0,d5
		Beq	clr_down
		bset	#down,(a1)
		bra	tst_up
clr_down		bclr	#down,(a1)

tst_up		move.w	d4,d5
		lsr.w	#1,d5
		eor.w	d4,d5
		btst	#8,d5
		Beq	clr_up
		bset	#up,(a1)
		move.b	joyport1,d0
		rts
clr_up		bclr	#up,(a1)
		move.b	joyport1,d0
		rts

oldpack		ds.l	1
joyport0		ds.b	1
joyport1		ds.b	1
		ds.w	1


***************************************************************************
*		Init keyboard interupt
***************************************************************************

init_key_int	move.w	#$4008,$dff09a
		move.l	$6c,old_vect
		move.l	#int,$6c
		clr.b	$bfee01
		move.b	#$88,$bfed01
		move.l	$68,old_vect+4
		move.l	#keyscan,$68
		move.w	#$c028,$dff09a
		move.w	#$4028,$dff09c
		rts

int_off		move.w	#$4028,$dff09a
		move.l	old_vect,$6c
		move.l	old_vect+4,$68
		move.w	#$c028,$dff09a
		rts

keyscan:		move.w	d0,-(sp)
		clr.w	d0
		move.b	$bfec01,d0
		not.b	d0
		ror.b	#1,d0

.cont		move.b	d0,key
		move.w	(sp)+,d0
		move.l	old_vect+4,-(a7)
		rts

int		move.l	old_vect,-(a7)
		rts

old_vect:	dc.l	0,0
key		dc.b	0
		even

***************************************************************************
*		One player joystick control
***************************************************************************

joystick		tst.b	auto_heli
		bne	auto_heli_joy
		tst.b	demo_mode
		bne	joystick_demo
		jsr	joy_init
		move.b	d0,main_dir
		rts

joystick_demo	jsr	joy_init
		btst	#fire,d0
		beq.s	joystick_demo1
		bra	dis_p_ship
joystick_demo1	lea	demo_move_list,a1
		move.l	(a1),a0
		move.b	(a0),main_dir
		tst.b	demo_move_cycle
		beq.s	.joy_move_update
		dec.b	demo_move_cycle
		rts
		
.joy_move_update	addq.l	#2,(a1)
		move.l	(a1),a0
		move.b	1(a0),demo_move_cycle
		rts

auto_heli_joy	lea	auto_move_list,a1
		move.l	(a1),a0
		move.b	(a0),main_dir
		tst.b	auto_move_cycle
		beq.s	.joy_auto_off
		dec.b	auto_move_cycle
		rts
		
.joy_auto_off	addq.l	#2,(a1)
		move.l	(a1),a0
		cmp.b	#255,(a0)
		beq	.joy_auto_off1
		move.b	1(a0),auto_move_cycle
		rts
.joy_auto_off1	clr.b	auto_heli
		rts

***************************************************************************
*		One player Joystick respond routine
***************************************************************************

joystick_respond	move.b	main_dir,d0

j_fire		btst	#fire,d0
		beq	j_no_fire
		move.l	main_x,gen_x
		addi.w	#15,gen_x
		addi.w	#18,gen_y
		bsr	gen_map_col
		move.b	fuel_mod,d0
		cmp.b	(a1),d0
		bne	go_weapons
		move.l	a1,landing_address
go_down		tst.b	landing_flag
		rtsne
		move.b	#1,landing_flag
		move.b	#down,land_dir
		rts
go_weapons	bsr	p_weapons
		move.b	main_dir,d0
		bra	j_up
j_no_fire	tst.b	landing_flag
		beq	cont
		cmp.b	#3,landing_flag
		rtsne
		move.b	#up,land_dir
		rts		

cont		tst.b	landing_flag
		rtsne
		clr.b	p_fire_flag

j_up		clr.b	up_down_move
		cmp.w	#7,main_y
		ble	j_down
		btst	#up,d0
		beq	j_down
		move.b	#1,up_down_move
		sub.w	#2,main_speed_y
		cmp.w	#-8,main_speed_y
		bne	j_up_2
j_up_1		move.w	#-6,main_speed_y
j_up_2		move.w	main_speed_y,d1
		add.w	d1,main_y
		bra	j_left

j_down		cmp.w	#184+64,main_y
		bge	j_left
		btst	#down,d0
		beq	j_left
		move.b	#1,up_down_move
		add.w	#2,main_speed_y
		cmp.w	#8,main_speed_y
		bne	j_down_2
j_down_1		move.w	#6,main_speed_y
j_down_2		move.w	main_speed_y,d1
		add.w	d1,main_y
		bra	j_left
		

j_left		
*cmp.w	#16,main_x
*		ble	j_move_scr_left
		btst	#left,d0
		beq	j_right
		sub.w	#2,main_speed_x
		cmp.w	#-8,main_speed_x
		bne	j_left_2
j_left_1		move.w	#-6,main_speed_x
j_left_2		move.w	main_speed_x,d1

		tst.w	map_x
		beq	.asd

		add.w	d1,map_x
		bpl	.asd
		move.w	#0,map_x
*		bra	no_j_try_y1
.asd		add.w	d1,main_x
		bra	no_j_try_y1

j_move_scr_left	cmp.w	#0,map_x
		ble	j_right
		subq.w	#2,map_x
		rts


j_right	
*	cmp.w	#228,main_x
*		bge	j_move_scr_right
		btst	#right,d0
		beq	no_joy
		add.w	#2,main_speed_x
		cmp.w	#8,main_speed_x
		bne	j_right_2
j_right_1	move.w	#6,main_speed_x
j_right_2	move.w	main_speed_x,d1
		cmp.w	#48,map_x
		bge	.asd

		add.w	d1,map_x
		cmp.w	#48,map_x
		ble	.asd
		move.w	#48,map_x
*		bra	no_j_try_y1
.asd		add.w	d1,main_x
		bra	no_j_try_y1

j_move_scr_right	cmp.w	#48,map_x
		bge	no_joy
		addq.w	#2,map_x
		rts


no_joy		tst.w	main_speed_x
		beq	no_j_try_y
		bpl	no_j_1
		add.w	#2,main_speed_x
		bra	no_j_try_y
no_j_1		sub.w	#2,main_speed_x
no_j_try_y	tst.b	up_down_move
		bne	no_j_exit_1
		tst.w	main_speed_y
		beq	no_j_exit
		bpl	no_j_2
		add.w	#2,main_speed_y
		bra	no_j_exit
no_j_2		sub.w	#2,main_speed_y
no_j_exit	move.w	main_speed_y,d0
		add.w	d0,main_y
no_j_exit_1	move.w	main_speed_x,d0
		add.w	d0,main_x
		rts

no_j_try_y1	tst.b	up_down_move
		rtsne
		tst.w	main_speed_y
		beq	ano_j_exit
		bpl	ano_j_2
		add.w	#2,main_speed_y
		bra	ano_j_exit
ano_j_2		sub.w	#2,main_speed_y
ano_j_exit	move.w	main_speed_y,d0
		add.w	d0,main_y
		rts

up_down_move	dc.b	0	if there is up or down joystick move.
main_speed_x	dc.w	0
main_speed_y	dc.w	0

***************************************************************************
*		Player One Weapons
***************************************************************************

p_weapons	tst.b	p_fire_flag
		beq	first_fire
		addi.b	#1,p_fire_flag
		cmp.b	#7,p_fire_flag
		rtslt
		tst.b	rocket_flag
		rtseq		
		move.w	main_x,d0
		addi.w	#13,d0
		dis1_bull	#4,d0,main_y,#0,#-8,init_rocket
		bsr	init_guided
		rts

first_fire	move.b	#1,p_fire_flag
*		tst.b	p_laser_flag
*		beq	a.next_weapon
*		bsr	p_set_laser
a.next_weapon	tst.b	p_bullet_flag
		beq	a.next1_weapon
		move.w	main_x,d0
		move.w	main_y,d1
		addi.w	#8,d0
		addi.w	#12,d1
		tst.b	bullet_type
		beq	norm_bullet_main
		cmp.b	#1,bullet_type
		bne	bullet_two_main
		move.b	#2,main_bullet_fire
		addq.w	#5,d0
		dis1_bull	#1,d0,d1,#0,#-8,p_bull_setup
		bra	continue_bullet
bullet_two_main	move.b	#3,main_bullet_fire
		addq.w	#4,d0
		dis1_bull	#2,d0,d1,#0,#-8,p_bull_setup
		bra	continue_bullet
norm_bullet_main	move.b	#1,main_bullet_fire
		addq.w	#6,d0
		dis1_bull	#0,d0,d1,#0,#-8,p_bull_setup
continue_bullet	sound	#gun_dig,#1269,#5,#5,#0
		tst.b	two_droid_flag
		bne	two_droid_fire
		tst.b	multi_droid_flag
		bne	multi_fire_weapon
		tst.b	droid_flag
		rtseq
		move.b	#1,main_bullet_fire
		dis1_bull	#3,droid1_x,droid_y,#0,#-8,pb1_top
		dis1_bull	#3,droid2_x,droid_y,#0,#-8,pb1_top
a.next1_weapon	rts

two_droid_fire	move.b	#1,main_bullet_fire
		dis1_bull	#3,droid1_x,droid_y,#0,#-8,pb1_top
		dis1_bull	#3,droid2_x,droid_y,#0,#-8,pb1_top
		move.l	multi_droid1,a0
		move.l	(a0),gen_x
		dis1_bull	#3,gen_x,gen_y,#0,#-8,pb1_top
		move.l	multi_droid1_1,a0
		move.l	(a0),gen_x
		dis1_bull	#3,gen_x,gen_y,#0,#-8,pb1_top
		rts

multi_fire_weapon	move.b	#1,main_bullet_fire
		dis1_bull	#3,droid1_x,droid_y,#0,#-8,pb1_top
		dis1_bull	#3,droid2_x,droid_y,#0,#-8,pb1_top
		move.l	multi_droid1,a0
		move.l	(a0),gen_x
		dis1_bull	#3,gen_x,gen_y,#0,#-8,pb1_top
		move.l	multi_droid1_1,a0
		move.l	(a0),gen_x
		dis1_bull	#3,gen_x,gen_y,#0,#-8,pb1_top
		move.l	multi_droid2,a0
		move.l	(a0),gen_x
		dis1_bull	#3,gen_x,gen_y,#0,#-8,pb1_top
		move.l	multi_droid2_1,a0
		move.l	(a0),gen_x
		dis1_bull	#3,gen_x,gen_y,#0,#-8,pb1_top
		rts
pb1_top		pushm.l	a0-a3
		bra	pb_top

***************************************************************************
*	        	Initialise Guided Missile
****************************************************************************

init_guided	bsr	ig_main
		tst.b	d0
		rtseq
		tst.w	guided_missiles
		rtseq
		subq.w	#1,guided_missiles
		move.l	main_x,(a0)
		move.l	a2,(a1)
		rts

ig_main		clr.b	d0
		lea	guided_xys,a0
		lea	guided_to_xys,a1
ig_top		cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		beq	ig_set
		addq.w	#4,a0
		addq.w	#4,a1
		bra	ig_top
ig_set		lea 	enemy_xys,a2
ig1_top		cmp.w	#x_end,(a2)
		rtseq	
		cmp.w	#x_off,(a2)
		bne	ig1_setit
ig1_update_vector	addq.w	#4,a2
		bra	ig1_top
ig1_setit	lea	guided_to_xys,a3
ig2_top		tst.l	(a3)
		bne	ig...
		move.b	#1,d0
		rts
ig...		move.l	a2,d2
		cmp.l	(a3),d2
		beq	ig1_update_vector
		addq.l	#4,a3
		bra	ig2_top

***************************************************************************
*	        	  Update Guided Missile
****************************************************************************

update_guided	lea	guided_xys,a0
		lea	guided_to_xys,a4
		lea	guided_8,a3
gd_top		cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		bne	gd_next
gd_update_vector	addq.w	#4,a0
		addq.w	#4,a4
		bra	gd_top
gd_next		move.l	(a4),a5
		cmp.w	#x_off,(a5)
		bne	gd_update
		explode_24	(a0),2(a0)
		move.w	#x_off,(a0)
		clr.l	(a4)
		bra	gd_update_vector

gd_update	move.w	(a5),d0
		move.w	2(a5),d1
		move.l	(a0),gen1_x
		bsr	return_dis1
		move.w	gen_x,d2
		add.w	d2,(a0)
		swap	d2
		move.w	gen_y,d2
		add.w	d2,2(a0)
		lea	guided_frames,a1
		lea	guided_dis,a2
gd1_update	cmp.l	(a2)+,d2
		beq	gd_gotit	
		addq.w	#4,a1
		bra	gd1_update
gd_gotit		move.l	(a0),gen_x
		move.l	(a1),d0
*		move.w	#11,d6
		cmp.w	#256,gen_y
		bge	gd_update_vector
		bsr	guided_sprite
		bra	gd_update_vector

***************************************************************************
*		Check if missile goes off screen
***************************************************************************

guided_limits	lea	guided_xys,a0
		lea	guided_to_xys,a4
gd_limit_top	cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		bne	gd_limit
gd_limit_top1	addq.w	#4,a0
		addq.w	#4,a4
		bra	gd_limit_top

gd_limit		move.l	(a0),gen_x
		cmp.w	#10,gen_x
		blt	gd_limit_off
		cmp.w	#0,gen_y
		blt	gd_limit_off
		cmp.w	#300,gen_x
		bge	gd_limit_off
		cmp.w	#270,gen_y
		bge	gd_limit_off
		bra	gd_limit_top1
gd_limit_off	move.w	#x_off,(a0)
		clr.l	(a4)
		bra	gd_limit_top1
	
***************************************************************************
*	        General Enemy displacement Bullet setup	              *
****************************************************************************

p_bull_setup	pushm.l	a0-a3
		move.w	from_y,d1
		sub.w	#20,d1
		lea	p_bull_xys,a0
		lea	p_bull_dis,a1
		lea	p_bull_grfx,a2
		lea	p_bullet_type,a3
.pb_top		cmp.w	#x_end,(a0)
		bne	.continue
		bra	pb_top
.leave		popm.l	a0-a3
		rts
.continue	cmp.w	#x_off,(a0)
		bne	.check_it	
.next		addq.l	#4,a0
		addq.l	#4,a1
		addq.l	#4,a2
		addq.l	#1,a3
		bra	.pb_top
.check_it	cmp.w	2(a0),d1
		blt	.leave
		bra	.next		

pb_top		lea	p_bull_xys,a0
		lea	p_bull_dis,a1
		lea	p_bull_grfx,a2
		lea	p_bullet_type,a3
pb_top2		cmp.w	#x_end,(a0)
		bne	.continue
		popm.l	a0-a3
		rts
.continue	cmp.w	#x_off,(a0)
		beq	.set_it
.next		addq.l	#4,a0
		addq.l	#4,a1
		addq.l	#4,a2
		addq.l	#1,a3
		bra	pb_top2
.set_it		move.l	d0,(a2)
		move.l	from_x,(a0)
		move.l	dis_x,(a1)
		move.b	main_bullet_fire,(a3)
		popm.l	a0-a3
		rts

***************************************************************************
*		Player One  Bullet Routine
****************************************************************************

p_bull		lea	p_bull_xys,a0
		lea	p_bull_dis,a1
		lea	p_bull_grfx,a2
pbu_top		cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		bne	.update_bull
.update_vectors	addq.l	#4,a0
		addq.l	#4,a1
		addq.l	#4,a2
		bra	pbu_top
.update_bull	move.w	(a1),d0
		move.w	2(a1),d1
		add.w	d0,(a0)
		add.w	d1,2(a0)
		cmp.w	#10,2(a0)
		ble	.disable_it
		move.l	(a0),gen_x
		clr.l	d0
		move.l	(a2),d0
		bsr	bull_sprite
		bra	.update_vectors
.disable_it	move.w	#x_off,(a0)
		bra	.update_vectors

***************************************************************************
*	        General Enemy displacement Bullet setup	              *
****************************************************************************

init_rocket	tst.w	rockets
		rtseq
		pushm.l	a0-a4
		move.w	from_y,d1
		sub.w	#50,d1
		lea	rocket_xys,a0
		lea	rocket_dis,a1
ir_pb_top	cmp.w	#x_end,(a0)
		bne	ir_continue
		bra	ir1_pb_top
ir_leave		popm.l	a0-a4
		rts
ir_continue	cmp.w	#x_off,(a0)
		bne	ir_check_it	
ir_next		addq.l	#4,a0
		addq.l	#4,a1
		bra	ir_pb_top
ir_check_it	cmp.w	2(a0),d1
		blt	ir_leave
		bra	ir_next		

ir1_pb_top	lea	rocket_xys,a0
		lea	rocket_dis,a1
		lea	rocket_grfx,a2
		lea	srocket_dis,a4
ir_pb_top2	cmp.w	#x_end,(a0)
		bne	ir_.continue
		popm.l	a0-a4
		rts
ir_.continue	cmp.w	#x_off,(a0)
		beq	ir_.set_it
ir_.next		addq.l	#4,a0
		addq.l	#4,a1
		addq.l	#2,a4
		addq.l	#4,a2
		bra	ir_pb_top2
ir_.set_it	dec.w	rockets
		move.l	d0,(a2)
		move.l	from_x,(a0)
		move.l	dis_x,(a1)
		move.w	#12,(a4)
		popm.l	a0-a4
		sound	#missile_dig,#3604,#6,#5,#3
		rts

***************************************************************************
*		Player One  Bullet Routine
****************************************************************************

update_rocket	lea	rocket_xys,a0
		lea	rocket_dis,a1
		lea	rocket_grfx,a2
		lea	srocket_dis,a4
ur_pbu_top	cmp.w	#x_end,(a0)
		rtseq
		cmp.w	#x_off,(a0)
		bne	ur_update_bull
ur_update_vectors	addq.l	#4,a0
		addq.l	#4,a1
		addq.l	#4,a2
		addq.l	#2,a4
		bra	ur_pbu_top
ur_update_bull	move.w	(a1),d0
		move.w	2(a1),d1
		add.w	d0,(a0)
		add.w	d1,2(a0)
		cmp.w	#0,2(a0)
		ble	ur_disable_it
		tst.b	landing_flag
		beq	ur_loop
		add.w	#2,2(a0)
ur_loop		move.l	(a0),gen_x
*		move.l	(a2),a3
		tst.w	(a4)
		beq	ur_disable_it
		pushm.l	all_regs
		move.w	(a4),d5
		sub.w	d5,gen_x
		add.w	d5,gen_y
*		tst.b	flip_flag
*		bne	ur_shadow
	 	dec.w	(a4)
ur_shadow
*	move.l	#srocket_data,shadow_data
*		bsr	shadow_16
ur_no_shadow	popm.l	all_regs
		move.l	(a0),gen_x
		clr.l	d0
		move.l	(a2),d0
		bsr	bull_sprite
		bra	ur_update_vectors
ur_disable_it	move.w	#x_off,(a0)
		bra	ur_update_vectors

***************************************************************************
*		Big enemy sprite
***************************************************************************

sprite_80x70	pushm.l	all_regs
		lea	b_enemy_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

***************************************************************************
* 		      Multidirectional Scroll routine
***************************************************************************

vert_blocks	equ	6
max_mid_count	dc.w	9		8	
left_add		dc.l	34		32
map_add		dc.l	9		8*2
temp1		ds.w	1
				
multi_scroll	move.l	scroll_data,a0
		move.l	pre_map,a1
		add.l	#28,a1
		move.l	screenx,a2

		clr.l	top_size
		clr.l	bottom_size
		clr.l	top_screen_offset
		clr.w	top_block_offset
********
		move.w	map_x,d0
		move.w	map_y,d1

		move.w	d0,d7
		and.l	#$f,d7	frame
		move.w	#15,d2
		sub.w	d7,d2
		move.w	d2,temp1
		move.w	d2,d3
		lsl.w	#4,d3
		or.w	d2,d3
		move.w	d3,temp


		move.w	max_mid_count,mid_count
		btst	#4,d0
		beq	.cont
		dec.w	mid_count   set mid_count
.cont		and.w	#$ffe0,d0
		asr.w	#5,d0
		lea	(a1,d0.w),a1
		move.w	d1,d2
		and.w	#$ffe0,d1
		and.w	#31,d2
		move.w	#32,d3
		sub.w	d2,d3
		move.w	d2,d4
		beq	.top_done
		asl.w	#2,d2
		asl.w	#6,d2
		add.w	#2,d2		
		move.w	d2,bottom_size	set bottom blocks height
		sub.w	#1,d2
		move.w	d2,small_bottom_size

.top_done	move.w	d3,d5
		beq	.bottom_done
		mulu	#160,d5
		move.l	d5,top_screen_offset
		asl.w	#2,d3
		asl.w	#6,d3
		add.w	#2,d3
		move.w	d3,top_size
		sub.w	#1,d3
		move.w	d3,small_top_size
		asl.w	#4,d4
		move.w	d4,top_block_offset

.bottom_done	move.l	#9,d7
		clr.l	d6
		move.w	map_width,d6
*		asl.w	#1,d6

		asr.w	#5,d1
		mulu	map_width,d1
		lea	(a1,d1.l),a1   map address
		
		move.w	max_mid_count,d0
		cmp.w	mid_count,d0
		beq	.mid_blocks

* DISPLAY LEFT 16 PIXEL STRIP

		pushm.l	a1/a2	

		tst.w	top_size
		beq	.nxt

		clr.l	d0
		move.b	(a1),d0
		asl.l	d7,d0
		lea	2(a0,d0.l),a3
		move.w	top_block_offset,d4
		add.w	d4,a3
		
		waitblit
		move.w	#38,bltdmod+custom	
		move.w	#2,bltamod+custom	
		move.l	#$9f00000,bltcon0+custom
		move.l	#-1,bltafwm+custom
		move.l	a3,bltapth+custom
		move.l	a2,bltdpth+custom
		move.w	small_top_size,bltsize+custom
		add.l	top_screen_offset,a2
.nxt		add.l	d6,a1		map_width
	
   		move.w	#vert_blocks,d5
.loop		clr.l	d0
		move.b	(a1),d0
		asl.l	d7,d0
		lea	2(a0,d0.l),a3
		
		waitblit
		move.w	#38,bltdmod+custom	
		move.w	#2,bltamod+custom	
		move.l	#$9f00000,bltcon0+custom
		move.l	#-1,bltafwm+custom
		move.l	a3,bltapth+custom
		move.l	a2,bltdpth+custom
		move.w	#128*64+1,bltsize+custom
		lea	32*160(a2),a2
		add.l	d6,a1		map_width
	
		dbf	d5,.loop

		tst.w	bottom_size
		beq	.nxt1

		clr.l	d0
		move.b	(a1),d0
		asl.l	d7,d0
		lea	2(a0,d0.l),a3
		
		waitblit
		move.w	#38,bltdmod+custom	
		move.w	#2,bltamod+custom	
		move.l	#$9f00000,bltcon0+custom
		move.l	#-1,bltafwm+custom
		move.l	a3,bltapth+custom
		move.l	a2,bltdpth+custom
		move.w	small_bottom_size,bltsize+custom
.nxt1		popm.l	a1/a2
		addq	#2,a2
		addq	#1,a1
		pushm.l	a1/a2
		add.l	left_add,a2
		add.l	map_add,a1


*  DISPLAY RIGHT 16 PIXEL STRIP


		tst.w	top_size
		beq	.nxt2

		clr.l	d0
		move.b	(a1),d0
		asl.l	d7,d0
		lea	(a0,d0.l),a3
		move.w	top_block_offset,d4
		add.w	d4,a3
		
		waitblit
		move.w	#38,bltdmod+custom	
		move.w	#2,bltamod+custom	
		move.l	#$9f00000,bltcon0+custom
		move.l	#-1,bltafwm+custom
		move.l	a3,bltapth+custom
		move.l	a2,bltdpth+custom
		move.w	small_top_size,bltsize+custom
		add.l	top_screen_offset,a2
.nxt2		add.l	d6,a1		map_width
	
  		move.w	#vert_blocks,d5
.loop1		clr.l	d0
		move.b	(a1),d0
		asl.l	d7,d0
		lea	(a0,d0.l),a3
		
		waitblit
		move.w	#38,bltdmod+custom	
		move.w	#2,bltamod+custom	
		move.l	#$9f00000,bltcon0+custom
		move.l	#-1,bltafwm+custom
		move.l	a3,bltapth+custom
		move.l	a2,bltdpth+custom
		move.w	#128*64+1,bltsize+custom
		lea	32*160(a2),a2
		add.l	d6,a1		map_width
	
		dbf	d5,.loop1

		tst.w	bottom_size
		beq	.nxt3

		clr.l	d0
		move.b	(a1),d0
		asl.l	d7,d0
		lea	(a0,d0.l),a3
		
		waitblit
		move.w	#38,bltdmod+custom	
		move.w	#2,bltamod+custom	
		move.l	#$9f00000,bltcon0+custom
		move.l	#-1,bltafwm+custom
		move.l	a3,bltapth+custom
		move.l	a2,bltdpth+custom
		move.w	small_bottom_size,bltsize+custom
.nxt3		popm.l	a1/a2


* DISPLAY MID SECTION

.mid_blocks	move.w	mid_count,d3

.mid_loop	pushm.l	a1/a2	

		tst.w	top_size
		beq	.nxt4

		clr.l	d0
		move.b	(a1),d0
		asl.l	d7,d0
		lea	(a0,d0.l),a3
		move.w	top_block_offset,d4
		add.w	d4,a3
		
		waitblit
		move.w	#36,bltdmod+custom	
		move.w	#0,bltamod+custom	
		move.l	#$9f00000,bltcon0+custom
		move.l	#-1,bltafwm+custom
		move.l	a3,bltapth+custom
		move.l	a2,bltdpth+custom
		move.w	top_size,bltsize+custom
		add.l	top_screen_offset,a2
.nxt4		add.l	d6,a1		map_width
	
  		move.w	#vert_blocks,d5
.loop2		clr.l	d0
		move.b	(a1),d0
		asl.l	d7,d0
		lea	(a0,d0.l),a3
		
		waitblit
		move.w	#36,bltdmod+custom	
		move.w	#0,bltamod+custom	
		move.l	#$9f00000,bltcon0+custom
		move.l	#-1,bltafwm+custom
		move.l	a3,bltapth+custom
		move.l	a2,bltdpth+custom
		move.w	#128*64+2,bltsize+custom
		lea	32*160(a2),a2
		add.l	d6,a1		map_width
	
		dbf	d5,.loop2

		tst.w	bottom_size
		beq	.nxt5

		clr.l	d0
		move.b	(a1),d0
		asl.l	d7,d0
		lea	(a0,d0.l),a3
		
		waitblit
		move.w	#36,bltdmod+custom	
		move.w	#0,bltamod+custom	
		move.l	#$9f00000,bltcon0+custom
		move.l	#-1,bltafwm+custom
		move.l	a3,bltapth+custom
		move.l	a2,bltdpth+custom
		move.w	bottom_size,bltsize+custom
.nxt5		popm.l	a1/a2
		addq	#4,a2
		addq	#1,a1
	
		dbf	d3,.mid_loop
		waitblit
		rts



map_width		dc.w	10
top_screen_offset		ds.l	1
top_size			ds.w	1
small_top_size		ds.w	1
bottom_size		ds.w	1
small_bottom_size		ds.w	1
top_block_offset		ds.w	1
map_x			dc.w	24
map_y			dc.w	192*32
mid_count		ds.b	1
			even
		
***************************************************************************************
;		Initialise all
***************************************************************************************
; initialise program

; request memory for bit planes and copper list

init_all		move.l	execbase,a6

		move.l	#clsize,d0
		move.l	#chip,d1
		jsr	allocmem(a6)
		move.l	d0,cladr
		addi.l	#400,d0
		move.l	d0,cladr1

		move.l	#512*160,d0
		move.l	#chip,d1
		jsr	allocmem(a6)
		move.l	d0,screena
		move.l	screena,screenx
		addi.l	#256*160,d0
		move.l	d0,screenb

		move.l	#64*512+18254+14330+2324+42190+11892+7038+6018+11798+3382+996+358+374,d0
		move.l	#chip,d1
		jsr	allocmem(a6)
		move.l	d0,scroll_data
		addi.l	#64*512,d0
		move.l	d0,main
		addi.l	#17096,d0
		move.l	d0,big_chopper
		addi.l	#42190,d0
		move.l	d0,train
		addi.l	#2324,d0
		move.l	d0,tank
		addi.l	#14330,d0
		move.l	d0,sprite1_80x70
		addi.l	#7038,d0
		move.l	d0,bullet
		addi.l	#6018,d0
		move.l	d0,explosion
		addi.l	#11798,d0
		move.l	d0,pick_dr
		add.l	#3382,d0
		move.l	d0,hi_pickup_data
		addi.l	#996,d0
		move.l	d0,pointers_data
		addi.l	#358,d0
		move.l	d0,bull_flash_data
		addi.l	#374,d0

		move.l	#314604-374-358-996-3382-11798-6018-7038-14330-2324-42190-11892-64000-64*512-16896,d0
		move.l	#clear,d1
		jsr	allocmem(a6)

		move.l	d0,memory_start	address of user memory
		bsr	build_clists

		move.l	#dname,a1
		moveq	#0,d0
		CALLEXEC	OpenLibrary
		tst.l	d0
		move.l	d0,_DOSBase
		move.l	#grname,a1
		moveq	#0,d0
		CALLEXEC	OpenLibrary
		tst.l	d0
		move.l	d0,grafbase


		lea	custom,a5		
		move.w	#$03e0,dmacon(a5)	

		move.l	cladr,cop1lc(a5)		
		clr.w	copjmp1(a5)		

; playfield initialisation


		move.w	#$3091,diwstrt(a5)	9
		move.w	#$2ca1,diwstop(a5)	f4a1
		move.w	#$0038,ddfstrt(a5)
		move.w	#$00d0,ddfstop(a5)

		move.w	#%0100001000000000,bplcon0(a5)   
		clr.w	bplcon1(a5)		
		clr.w	bplcon2(a5)		
		move.w	#120,bpl1mod(a5)		
		move.w	#120,bpl2mod(a5)

; switch copper and bitplane dma on

		move.w	#$83c0,dmacon(a5)
		rts


temp		ds.w	1

***************************************************************************
*		Initialise memory
***************************************************************************

init_memory	move.l	memory_start,d0
		move.l	d0,pre_map
		addi.l	#2032,d0
		move.l	d0,map_end
		addi.l	#2,d0
		move.l	d0,packed_map
		addi.l	#1312,d0
		move.l	d0,train_buff
		addi.l	#4160,d0

		move.l	d0,score_data
		addi.l	#1600,d0
		move.l	d0,schop
		addi.l	#1240,d0
		move.l	d0,missile_display
		addi.l	#150,d0

* insert samples in here
		
		move.l	d0,high_entry_pre
		addi.l	#32,d0
		move.l	d0,high_entry_tab
		addi.l	#96,d0
		move.l	d0,high_entry
		addi.l	#32000,d0
		move.l	d0,high_characters
		addi.l	#5248,d0
		move.l	d0,high_space
		addi.l	#128,d0

		move.l	d0,choice_scr_packed
		addi.l	#8552,d0
		rts

***************************************************************************************
*		Convert ST data to Amiga interlace
***************************************************************************************
* d0=amount of blocks

init_data	move.l	scroll_data,a0
		bsr	word_to_line
		rts

***************************************************************************************
*		Word format to line format (32*32)
***************************************************************************************

word_to_line	move.w	#511,d1
		lea	pbuf,a2
.lop		move.b	(a0)+,(a2)+
		dbra	d1,.lop
		suba.l	#512,a0
		move.w	#31,d1
		lea	pbuf,a2
.lop1		move.w	(a2),(a0)+
		move.w	8(a2),(a0)+
		move.w	2(a2),(a0)+
		move.w	10(a2),(a0)+
		move.w	4(a2),(a0)+
		move.w	12(a2),(a0)+
		move.w	6(a2),(a0)+
		move.w	14(a2),(a0)+
		adda.l	#16,a2
		dbra	d1,.lop1
		dbra	d0,word_to_line
		rts

***************************************************************************
*		Screen flip
***************************************************************************

screen_flip	move.l	screenx,d1
		cmp.l	screena,d1
		beq	.show_a
.show_b		bsr	vb_wait
		move.l	cladr1,cop1lc+custom	
		clr.w	copjmp1+custom	
		rts
.show_a		bsr	vb_wait
		move.l	cladr,cop1lc+custom	
		clr.w	copjmp1+custom		
screen1_flip	rts

***************************************************************************
*		Vb Wait
***************************************************************************

vb_wait		move.w	vhposr+custom,d0
		and.w	#$ff00,d0
		cmp.w	#$2c00,d0
		bne.s	vb_wait
		btst	#0,$dff005
		beq.s	vb_wait
		move.w	temp,bplcon1+custom
		rts

**************************************************************************
*		Build copper lists
*************************************************************************

build_clists	moveq	#3,d4			; 5 planes for loop
		move.l	cladr,a0			; address of copper list
		move.l	cladr1,a2
		move.l	screena,d1
		move.l	screenb,d2
		move.w	#bpl1pth,d3		; first register
make_cl		move.w	d3,(a0)+		; pllXpth ins ram
		move.w	d3,(a2)+		; pllXpth ins ram
		addq.w	#2,d3			; next register
		swap	d1
		move.w	d1,(a0)+		; hi word of plane address
		move.w	d3,(a0)+		; bplXpth ins ram
		swap	d2
		move.w	d2,(a2)+		; hi word of plane address
		move.w	d3,(a2)+		; bplXpth ins ram
		addq.w	#2,d3			; next register
		swap	d1
		move.w	d1,(a0)+		; lo word of plane address
		add.l	#40,d1		; point to next plane
		swap	d2
		move.w	d2,(a2)+		; lo word of plane address
		add.l	#40,d2		; point to next plane
		dbf	d4,make_cl

* cwait		macro	line,copper info address register
* s_cmove	macro	amiga register, data, copper info address register, address to save copper info address

		cwait	#142,a0
		cwait	#142,a2
		s_cmove	#color00,#$000,a0,centre_pal_add	a0 = copper list for screena
		s_cmove	#color00,#$000,a2,centre_pal_add1	a2 = copper list for screenb
		cmove	#color00+2,#$6a6,a0
		cmove	#color00+2,#$6a6,a2
		cmove	#color00+4,#$ae0,a0
		cmove	#color00+4,#$af0,a2
		cmove	#color00+6,#$fff,a0
		cmove	#color00+6,#$fff,a2
		cmove	#color00+8,#$000,a0
		cmove	#color00+8,#$000,a2
		cmove	#color00+10,#$aaa,a0
		cmove	#color00+10,#$aaa,a2
		cmove	#color00+12,#$888,a0
		cmove	#color00+12,#$888,a2
		cmove	#color00+14,#$080,a0
		cmove	#color00+14,#$080,a2
		cmove	#color00+16,#$ca6,a0
		cmove	#color00+16,#$ca6,a2
		cmove	#color00+18,#$880,a0
		cmove	#color00+18,#$880,a2
		cmove	#color00+20,#$a00,a0
		cmove	#color00+20,#$a00,a2
		cmove	#color00+22,#$660,a0
		cmove	#color00+22,#$660,a2
		cmove	#color00+24,#$a84,a0
		cmove	#color00+24,#$a84,a2
		cmove	#color00+26,#$ff0,a0
		cmove	#color00+26,#$ff0,a2
		cmove	#color00+28,#$660,a0
		cmove	#color00+28,#$660,a2
		cmove	#color00+30,#$008,a0
		cmove	#color00+30,#$008,a2

		cwait	#220,a0
		cwait	#220,a2
		s_cmove	#color00,#$000,a0,main_pal_add
		s_cmove	#color00,#$000,a2,main_pal_add1
		cmove	#color00+2,#$c86,a0
		cmove	#color00+2,#$c86,a2
		cmove	#color00+4,#$888,a0
		cmove	#color00+4,#$888,a2
		cmove	#color00+6,#$fff,a0
		cmove	#color00+6,#$fff,a2
		cmove	#color00+8,#$aaa,a0
		cmove	#color00+8,#$aaa,a2
		cmove	#color00+10,#$866,a0
		cmove	#color00+10,#$866,a2
		cmove	#color00+12,#$644,a0
		cmove	#color00+12,#$644,a2
		cmove	#color00+14,#$844,a0
		cmove	#color00+14,#$844,a2
		cmove	#color00+16,#$8a4,a0
		cmove	#color00+16,#$8a4,a2
		cmove	#color00+18,#$208,a0
		cmove	#color00+18,#$208,a2
		cmove	#color00+20,#$06f,a0
		cmove	#color00+20,#$06f,a2
		cmove	#color00+22,#$860,a0
		cmove	#color00+22,#$860,a2
		cmove	#color00+24,#$640,a0
		cmove	#color00+24,#$640,a2
		cmove	#color00+26,#$844,a0
		cmove	#color00+26,#$844,a2
		cmove	#color00+28,#$886,a0
		cmove	#color00+28,#$886,a2
		cmove	#color00+30,#$fc4,a0
		cmove	#color00+30,#$fc4,a2

		move.l	#$fffffffe,(a0)		; end copper list
		move.l	#$fffffffe,(a2)		; end copper list
		rts

****************************************************************************
*			Randomize				 *
****************************************************************************

randomize	pushm.l	d1-d7/a0-a6
		move.w	vhposr+custom,d0
		and.l	#$000000ff,d0
		popm.l	d1-d7/a0-a6
		rts

***************************************************************************
*		Flip control
***************************************************************************

flip_control	bsr	screen_flip	
		tst.b	flip_flag
		beq	.set_b
		clr.b	flip_flag
.set_a		move.l	screena,screenx
		bra	.leave_flip_con
.set_b		move.b	#1,flip_flag
		move.l	screenb,screenx
.leave_flip_con	rts

***************************************************************************
*		Set pallete
***************************************************************************
* pal_choice :
*		0 = fade in whole screen
*		1 = fade in main pal
*		2 = fade in centre pal


set_fade_pal	cmp.b	#1,pal_choice
		blt	set_all_pals
		beq	set_pal

set_pal1		move.l	d0,a1
		move.l	centre_pal_add,a2
		move.l	centre_pal_add1,a3
		move.w	#15,d1
pallop1		move.w	(a1),(a3)
		move.w	(a1)+,(a2)
		addq.l	#4,a2
		addq.l	#4,a3
		dbf	d1,pallop1
		rts
		
pal_choice	ds.b	1
		even


set_pal		move.l	d0,a1
		lea	color00+custom,a0
		move.l	main_pal_add,a2
		move.l	main_pal_add1,a3
		move.w	#15,d1
pallop		move.w	(a1),(a0)+
		move.w	(a1),(a3)
		move.w	(a1)+,(a2)
		addq.l	#4,a2
		addq.l	#4,a3
		dbf	d1,pallop
		rts

set_all_pals	move.l	d0,a1
		lea	color00+custom,a0
		move.l	main_pal_add,a2
		move.l	main_pal_add1,a3
		move.l	centre_pal_add,a4
		move.l	centre_pal_add1,a5
		move.w	#15,d1
pallop2		move.w	(a1),(a0)+
		move.w	(a1),(a3)
		move.w	(a1),(a4)
		move.w	(a1),(a5)
		move.w	(a1)+,(a2)
		addq.l	#4,a2
		addq.l	#4,a3
		addq.l	#4,a4
		addq.l	#4,a5
		dbf	d1,pallop2
		rts

main_pal_add	ds.l	1
main_pal_add1	ds.l	1
centre_pal_add	ds.l	1
centre_pal_add1	ds.l	1

***************************************************************************
* 		Load all graphics
***************************************************************************

load_grfx	
*load	#sample_fname1,#gun_dig,#1269
*		load	#sample_fname2,#explo_dig,#5659
*		load	#sample_fname3,#gunhit_dig,#1323
*		load	#sample_fname4,#pickup_dig,#1061
*		load	#sample_fname5,#quick_explo_dig,#4542
*		load	#sample_fname6,#rapidgun_dig,#703
*		load	#sample_fname7,#missile_dig,#3604

		load	#high_char_name,scroll_data,#2440
		unpack	scroll_data,2440,high_characters

		load	#scroll_fname,high_entry_pre,#21608
		unpack	high_entry_pre,21608,scroll_data

		load	#main_sprite_fname,main,#17096

		load	#big_chop_fname,big_chopper,#42190

		load	#tank_fname,tank,#14330

		load	#fname1_80x70,sprite1_80x70,#7038

		load	#bullet_fname,bullet,#6018

		load	#explo_fname,explosion,#11798

		load	#score_fname,score_data,#1600

		load	#pickup_fname,hi_pickup_data,#996

		load	#pick_dr_fname,pick_dr,#3382

		load	#train_fname,train,#2324

		load	#small_chop_fname,schop,#1240

		load	#miss_dis_fname,missile_display,#150

		load	#bull_flash_fname,bull_flash_data,#374

		load	#choice_fname,choice_scr_packed,#8552
		unpack	choice_scr_packed,8552,high_entry_pre

		load	#map_fname,packed_map,#1312
		unpack	packed_map,1312,pre_map

		load	#pointer_fname,pointers_data,#358

		move.w	#63,d0
		bsr	init_data
		bsr	make_helpla_list
		bsr	make_bigchop_list
		bsr	make_tank_list
		bsr	make_b_enemy_list
		bsr	make_bullet_list
		bsr	make_explo_list
		bsr	make_hi_pick_list
		bsr	make_pick_dr_list
		bsr	make_train_list
		bsr	make_point_list
		bsr	make_bull_flash_list
		move.l	score_data,a0
		move.w	#159,d0
.elk		not.w	(a0)
		add.l	#10,a0
		dbf	d0,.elk
		move.l	schop,a0
		move.w	#123,d0
.lk		not.w	(a0)
		add.l	#10,a0
		dbf	d0,.lk
		move.l	missile_display,a0
		move.w	#14,d0
.lk1		not.w	(a0)
		add.l	#10,a0
		dbf	d0,.lk1

		fade_pal_out	#high_entry_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		bsr	clear_screens
		rts

***************************************************************************
* 		      
***************************************************************************
* sprite list = a3          d0 = frame

df_datasize	equ	0
df_blitsize	equ	2
df_height	equ	4
df_width		equ	6
df_disx		equ	8
df_disy		equ	10
df_sprite_num	equ	12
df_height_dis	equ	14
df_null		equ	16		

dump_frame	move.w	map_x,d4
		sub.w	d4,gen_x
		
		cmp.w	#304,gen_x
		rtsge
		cmp.w	#256,gen_y
		rtsge
		asl.w	#2,d0
		move.l	(a3,d0.w),a1
				
		move.w	temp1,d4
		sub.w	d4,gen_x
		move.w	df_blitsize(a1),d6
		lea	sprite_prg_list,a4
		move.w	df_width(a1),d0
		asr.w	#1,d0
		move.l	-8(a4,d0.w),a0
		move.w	df_height(a1),d5
		lea	18(a1),a1
		jsr	(a0)
		rts


low_clip_line	dc.w	256
sprite_prg_list	dc.l	sprite_16,0,sprite_32,0
		dc.l	sprite_48,0,sprite_64,0
		dc.l	sprite_80,0
	

***************************************************************************
*		Blitter sprite 32*n
***************************************************************************
*** a5 = screen address     a1 = data
* d6 = blitsize 
* d5 = height          
				     
sprite_32	cmp.w	#-32,gen_x
		rtsle


		tst.w 	gen_y
		bge	.try_low_clip
		add.w	gen_y,d5
		rtsle
		move.w	gen_y,d0
		neg.w	d0
		move.w	d0,d1
		mulu	#30,d1
		add.l	d1,a1
		clr.w	gen_y
		asl.w	#6,d0
		sub.w	d0,d6

.try_low_clip	move.w	gen_y,d0
		cmp.w	low_clip_line,d0
		rtsge
		add.w	d5,d0
		cmp.w	low_clip_line,d0
		ble	.no_vert_clip
		sub.w	low_clip_line,d0
		asl.w	#6,d0
		sub.w	d0,d6
		
*****************************************************************************
.no_vert_clip	move.l	screenx,a5
		move.l	gen_x,d0
		asl.w	#1,d0
		lea	y_table,a0
		clr.l	d2
		move.w	(a0,d0.w),d2
		add.l	d2,a5
		swap	d0
		move.w	d0,d2
		bpl	.plus

		and.w	#$f,d2
		move.w	#15,d7
		add.w	d2,d7
		exg	d2,d7	
     		
.plus		and.w	#$f,d2
		lea	custom,a0
		move.w	d2,d7
		lsl.w	#8,d2
		lsl.w	#4,d2
		move.l	#$0fca0000,d1
		or.w	d2,d1
		swap	d1
		or.w	d2,d1
		swap	d1
		move.l	d1,bltcon0(a0)
		move.l	#$ffffffff,$44(a0)

.l_clip		move.w	#24,d1		a b
		move.w	#160-6,d2	c d

		move.w	clip_x,d3
		cmp.w	gen_x,d3
		ble	.r_clip

		move.w	gen_x,d3
		neg.w	d3
.noz		and.w	#$fff0,d3
		asr.w	#3,d3
		add.w	d3,d1
		add.w	d3,d2
		add.w	d3,a1
		asr.w	#1,d3
		sub.w	d3,d6

		move.l	#$0000ffff,d3
		asl.l	d7,d3
		move.l	d3,$44(a0)
		lea	-2(a5),a5  
		bra	.ok
 	
.r_clip		and.w	#$fff0,d0
		asr.w	#3,d0
		add.w	d0,a5

		move.w	clip_x1,d3
		sub.w	#32,d3
		cmp.w	gen_x,d3
		bge	.ok
		add.w	#32,d3		
		sub.w	gen_x,d3
		and.w	#$fff0,d3
		move.w	#32,d4
		sub.w	d3,d4
		asr.w	#3,d4
		add.w	d4,d1
		add.w	d4,d2
		asr.w	#1,d4
		sub.w	d4,d6


		move.l	#$ffffffff,d3
		asl.l	d7,d3
		move.l	d3,$44(a0)
 

.ok		move.w	d1,bltamod(a0)
		move.w	d1,bltbmod(a0)
		move.w	d2,bltcmod(a0)
		move.w	d2,bltdmod(a0)
		
***************************************************************************

		lea	6(a1),a6

		move.l	a1,bltapth(a0)
		move.l	a6,bltbpth(a0)
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	6(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit	

		lea	6(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	6(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit		
		rts

clip_x		dc.w	0
clip_x1		dc.w	304

***************************************************************************
*		Blitter sprite 48*n    
***************************************************************************
*** a5 = screen address     a1 = data
* d6 = blitsize           
				     
sprite_48	cmp.w	#-48,gen_x
		rtsle

		tst.w 	gen_y
		bge	.try_low_clip
		add.w	gen_y,d5
		rtsle
		move.w	gen_y,d0
		neg.w	d0
		move.w	d0,d1
		mulu	#40,d1
		add.l	d1,a1
		clr.w	gen_y
		asl.w	#6,d0
		sub.w	d0,d6
		bra	.no_vert_clip

.try_low_clip	move.w	gen_y,d0
		cmp.w	low_clip_line,d0
		rtsge
		add.w	d5,d0
		cmp.w	low_clip_line,d0
		ble	.no_vert_clip
		sub.w	low_clip_line,d0
		asl.w	#6,d0
		sub.w	d0,d6
		
		
*****************************************************************************
.no_vert_clip	move.l	screenx,a5
		move.l	gen_x,d0
		asl.w	#1,d0
		lea	y_table,a0
		clr.l	d2
		move.w	(a0,d0.w),d2
		add.l	d2,a5
		swap	d0
		move.w	d0,d2
		bpl	.plus

		and.w	#$f,d2
		move.w	#15,d7
		add.w	d2,d7
		exg	d2,d7	
     		
.plus		and.w	#$f,d2
		lea	custom,a0
		move.w	d2,d7
		lsl.w	#8,d2
		lsl.w	#4,d2
		move.l	#$0fca0000,d1
		or.w	d2,d1
		swap	d1
		or.w	d2,d1
		swap	d1
		move.l	d1,bltcon0(a0)
		move.l	#$ffffffff,$44(a0)

.l_clip		move.w	#32,d1		a b
		move.w	#160-8,d2	c d

		move.w	clip_x,d3
		cmp.w	gen_x,d3
		ble	.r_clip

		move.w	gen_x,d3
		neg.w	d3
.noz		and.w	#$fff0,d3
		asr.w	#3,d3
		add.w	d3,d1
		add.w	d3,d2
		add.w	d3,a1
		asr.w	#1,d3
		sub.w	d3,d6

		move.l	#$0000ffff,d3
		asl.l	d7,d3
		move.l	d3,$44(a0)
		lea	-2(a5),a5  
		bra	.ok
 	
.r_clip		and.w	#$fff0,d0
		asr.w	#3,d0
		add.w	d0,a5

		move.w	clip_x1,d3
		sub.w	#48,d3
		cmp.w	gen_x,d3
		bge	.ok
		add.w	#48,d3		
		sub.w	gen_x,d3
		and.w	#$fff0,d3
		move.w	#48,d4
		sub.w	d3,d4
		asr.w	#3,d4
		add.w	d4,d1
		add.w	d4,d2
		asr.w	#1,d4
		sub.w	d4,d6


		move.l	#$ffffffff,d3
		asl.l	d7,d3
		move.l	d3,$44(a0)
 

.ok		move.w	d1,bltamod(a0)
		move.w	d1,bltbmod(a0)
		move.w	d2,bltcmod(a0)
		move.w	d2,bltdmod(a0)
		
***************************************************************************

		lea	8(a1),a6

		move.l	a1,bltapth(a0)
		move.l	a6,bltbpth(a0)
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	8(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit	

		lea	8(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	8(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit		
		rts

***************************************************************************
*		Blitter sprite 64*n
***************************************************************************
* a5 = screen address     a1 = data
* d6 = blitsize           

sprite_64	cmp.w	#-64,gen_x
		rtsle
		tst.w 	gen_y
		bge	.try_low_clip
		add.w	gen_y,d5
		rtsle
		move.w	gen_y,d0
		neg.w	d0
		move.w	d0,d1
		mulu	#50,d1
		add.l	d1,a1
		clr.w	gen_y
		asl.w	#6,d0
		sub.w	d0,d6
		bra	.no_vert_clip

.try_low_clip	move.w	gen_y,d0
		cmp.w	low_clip_line,d0
		rtsge
		add.w	d5,d0
		cmp.w	low_clip_line,d0
		ble	.no_vert_clip
		sub.w	low_clip_line,d0
		asl.w	#6,d0
		sub.w	d0,d6
		
		
*****************************************************************************
.no_vert_clip	move.l	screenx,a5
		move.l	gen_x,d0
		asl.w	#1,d0
		lea	y_table,a0
		clr.l	d2
		move.w	(a0,d0.w),d2
		add.l	d2,a5
		swap	d0
		move.w	d0,d2
		bpl	.plus

		and.w	#$f,d2
		move.w	#15,d7
		add.w	d2,d7
		exg	d2,d7	
     		
.plus		and.w	#$f,d2
		lea	custom,a0
		move.w	d2,d7
		lsl.w	#8,d2
		lsl.w	#4,d2
		move.l	#$0fca0000,d1
		or.w	d2,d1
		swap	d1
		or.w	d2,d1
		swap	d1
		move.l	d1,bltcon0(a0)
		move.l	#$ffffffff,$44(a0)

.l_clip		move.w	#40,d1		a b
		move.w	#160-10,d2	c d

		move.w	clip_x,d3
		cmp.w	gen_x,d3
		ble	.r_clip

		move.w	gen_x,d3
		neg.w	d3
.noz		and.w	#$fff0,d3
		asr.w	#3,d3
		add.w	d3,d1
		add.w	d3,d2
		add.w	d3,a1
		asr.w	#1,d3
		sub.w	d3,d6

		move.l	#$0000ffff,d3
		asl.l	d7,d3
		move.l	d3,$44(a0)
		lea	-2(a5),a5  
		bra	.ok
 	
.r_clip		and.w	#$fff0,d0
		asr.w	#3,d0
		add.w	d0,a5

		move.w	clip_x1,d3
		sub.w	#64,d3
		cmp.w	gen_x,d3
		bge	.ok
		add.w	#64,d3		
		sub.w	gen_x,d3
		and.w	#$fff0,d3
		move.w	#64,d4
		sub.w	d3,d4
		asr.w	#3,d4
		add.w	d4,d1
		add.w	d4,d2
		asr.w	#1,d4
		sub.w	d4,d6


		move.l	#$ffffffff,d3
		asl.l	d7,d3
		move.l	d3,$44(a0)
 

.ok		move.w	d1,bltamod(a0)
		move.w	d1,bltbmod(a0)
		move.w	d2,bltcmod(a0)
		move.w	d2,bltdmod(a0)
		
***************************************************************************

		lea	10(a1),a6

		move.l	a1,bltapth(a0)
		move.l	a6,bltbpth(a0)
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	10(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit	

		lea	10(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	10(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit		
		rts

***************************************************************************
*		Blitter sprite 16*n
***************************************************************************
* a5 = screen address     a1 = data
* d6 = blitsize           

sprite_16	cmp.w	#-16,gen_x
		rtsle

		tst.w 	gen_y
		bge	.try_low_clip
		add.w	gen_y,d5
		rtsle
		move.w	gen_y,d0
		neg.w	d0
		move.w	d0,d1
		mulu	#20,d1
		add.l	d1,a1
		clr.w	gen_y
		asl.w	#6,d0
		sub.w	d0,d6
		bra	.no_vert_clip

.try_low_clip	move.w	gen_y,d0
		cmp.w	low_clip_line,d0
		rtsge
		add.w	d5,d0
		cmp.w	low_clip_line,d0
		ble	.no_vert_clip
		sub.w	low_clip_line,d0
		asl.w	#6,d0
		sub.w	d0,d6

		
*****************************************************************************
.no_vert_clip	move.l	screenx,a5
		move.l	gen_x,d0
		asl.w	#1,d0
		lea	y_table,a0
		clr.l	d2
		move.w	(a0,d0.w),d2
		add.l	d2,a5
		swap	d0
		move.w	d0,d2
		bpl	.plus

		and.w	#$f,d2
		move.w	#15,d7
		add.w	d2,d7
		exg	d2,d7	
     		
.plus		and.w	#$f,d2
		lea	custom,a0
		move.w	d2,d7
		lsl.w	#8,d2
		lsl.w	#4,d2
		move.l	#$0fca0000,d1
		or.w	d2,d1
		swap	d1
		or.w	d2,d1
		swap	d1
		move.l	d1,bltcon0(a0)
		move.l	#$ffffffff,$44(a0)

.l_clip		move.w	#16,d1		a b
		move.w	#160-4,d2	c d

		move.w	clip_x,d3
		cmp.w	gen_x,d3
		ble	.r_clip

		move.w	gen_x,d3
		neg.w	d3
.noz		and.w	#$fff0,d3
		asr.w	#3,d3
		add.w	d3,d1
		add.w	d3,d2
		add.w	d3,a1
		asr.w	#1,d3
		sub.w	d3,d6

		move.l	#$0000ffff,d3
		asl.l	d7,d3
		move.l	d3,$44(a0)
		lea	-2(a5),a5  
		bra	.ok
 	
.r_clip		and.w	#$fff0,d0
		asr.w	#3,d0
		add.w	d0,a5

		move.w	clip_x1,d3
		sub.w	#16,d3
		cmp.w	g`*
-i!"_X6" Xj*:_XX0 !j"Xr #h!"XX_XX" 7j"X" *
-h!"_XX0*!j"Xr`""#%h!"_XX(*" j"Xr #h!		sub.w	d3,d4
		asr.w	#3,d4
		add.w	d4,d1
		add.w	d4,d2
		asr.w	#1,d4
		sub.w	d4,d6


		move.l	#$ffffffff,d3
		asl.l	d7,d3
		move.l	d3,$44(a0)
 

.ok		move.w	d1,bltamod(a0)
		move.w	d1,bltbmod(a0)
		move.w	d2,bltcmod(a0)
		move.w	d2,bltdmod(a0)
		
***************************************************************************

		lea	4(a1),a6

		move.l	a1,bltapth(a0)
		move.l	a6,bltbpth(a0)
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	4(a6),a  		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit	

		lea	4(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	4(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit		
		rts

***  ************************************************************************
*		Blitter line sprite 16*n
***************************************************************************
* a1 = data
* d6 = height

blit_sprite_16	move.l	screenx,a5
		move.l	gen_x,d0
		asl.w	#1,d0
		lea	y_table,a0
		moveq.l	#0,d2
		move.w 	(a0,d0.w),d2
		add.l	d2,a5
		swap	d0


		move.w	d0,d2
		and.w	#$fff0,d0
		asr.w	#3,d0
		add.w	d0,a5

		and.w	#$f,d2

		asl.w	#6,d6
		or.w	#1,d6

		lea	custom,a0
		move.l	#$0fca0000,d0
		move.l	d0,bltcon0(a0)
		move.l	#$ffffffff,$dff044


		move.w	#8,bltamod(a0)
		move.w	#8,bltbmod(a0)
		move.w	#160-2,bltcmod(a0)
		move.w	#160-2,bltdmod(a0)

		lea	2(a1),a6

		move.l	a1,bltapth(a0)
		move.l	a6,bltbpth(a0)
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	2(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit	

		lea	2(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	2(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit		
		rts


***************************************************************************
*		Blitter sprite 80*n
***************************************************************************
* a5 = screen address     a1 = data
* d6 = blitsize

sprite_80:	move.w	gen_y,d0
		cmp.w	low_clip_line,d0
		rtsge
		add.w	d5,d0
		cmp.w	low_clip_line,d0
		ble	.no_vert_clip
		sub.w	low_clip_line,d0
		asl.w	#6,d0
		sub.w	d0,d6
.no_vert_clip	move.l	screenx,a5
		move.l	gen_x,d0
		asl.w	#1,d0
		lea	y_table,a0
		add.w	(a0,d0.w),a5
		swap	d0


		move.w	d0,d2
		and.w	#$fff0,d0
		asr.w	#3,d0
		add.w	d0,a5

		and.w	#$f,d2


		lea	custom,a0
		lsl.w	#8,d2
		lsl.w	#4,d2
		move.l	#$0fca0000,d0
		or.w	d2,d0
		swap	d0
		or.w	d2,d0
		swap	d0
		move.l	d0,bltcon0(a0)
		move.l	#$ffffffff,$dff044


		move.w	#48,bltamod(a0)
		move.w	#48,bltbmod(a0)
		move.w	#160-12,bltcmod(a0)
		move.w	#160-12,bltdmod(a0)

		lea	12(a1),a6

		move.l	a1,bltapth(a0)
		move.l	a6,bltbpth(a0)
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	12(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	12(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit

		lea	12(a6),a6
		move.l	a6,bltbpth(a0)
		move.l	a1,bltapth(a0)
		lea	40(a5),a5
		move.l	a5,bltcpth(a0)
		move.l	a5,bltdpth(a0)
		move.w	d6,bltsize(a0)
		waitblit
		rts

***************************************************************************
*		Initialise helicopters & plane for blitting
***************************************************************************

make_helpla_list	move.l	main,a0
		lea	hel_plane_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

hel_plane_list	ds.l	14

***************************************************************************
*		Initialise big chopper for blitting
***************************************************************************

make_bigchop_list	move.l	big_chopper,a0
		lea	big_chop_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

big_chop_list	ds.l	17

***************************************************************************
*		Initialise train for blitting
***************************************************************************

make_train_list	move.l	train,a0
		lea	train_blit_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

train_blit_list	ds.l	5

***************************************************************************
*		Initialise tank for blitting
***************************************************************************

make_tank_list	move.l	tank,a0
		lea	tank_blit_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

tank_blit_list	ds.l	17

***************************************************************************
*		Initialise big enemy for blitting
***************************************************************************

make_b_enemy_list	move.l	sprite1_80x70,a0
		lea	b_enemy_blit_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

b_enemy_blit_list	ds.l	3

***************************************************************************
*		Initialise bullets & rockets for blitting
***************************************************************************

make_bullet_list	move.l	bullet,a0
		lea	bullet_blit_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

bullet_blit_list	ds.l	23


***************************************************************************
*		Initialise Explosions for blitting
***************************************************************************

make_explo_list	move.l	explosion,a0
		lea	explo_blit_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

explo_blit_list	ds.l	13

***************************************************************************
*		Initialise pickups & droids for blitting
***************************************************************************

make_pick_dr_list	move.l	pick_dr,a0
		lea	pick_dr_blit_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

pick_dr_blit_list	ds.l	11

***************************************************************************
*		Initialise hi-score pointer & missile pickup for blitting
***************************************************************************

make_hi_pick_list	move.l	hi_pickup_data,a0
		lea	hi_pick_blit_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

hi_pick_blit_list	ds.l	4

***************************************************************************
*		Initialise Front screen pointers
***************************************************************************

make_point_list	move.l	pointers_data,a0
		lea	point_blit_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

point_blit_list	ds.l	3

***************************************************************************
*		Initialise bullet flash graphics
***************************************************************************

make_bull_flash_list
		move.l	bull_flash_data,a0
		lea	bull_flash_blit_list,a1
.top1		cmp.w	#-1,(a0)
		rtseq
		move.l	a0,(a1)+
		clr.l	d0
		move.w	(a0),d0
		add.l	d0,a0
		bra	.top1

bull_flash_blit_list	ds.l	4

***************************************************************************
*		Set Level
***************************************************************************

init_level	moveq	#0,d0
		move.w	level,d0
		asl.w	#2,d0
		lea	level_info,a0
		lea	variables,a6
		move.l	(a0,d0.w),a0
		move.l	(a0)+,data_filename
		move.l	(a0)+,map_filename
		move.l	(a0)+,rotating_gun
		move.l	(a0)+,a1
		move.l	(a1),a1
		sub.l	#94,a1
		move.l	a1,map_vector(a6)
		clr.w	pixel_count(a6)
		move.l	(a0)+,a1
		move.l	(a1),data_vector(a6)
		move.l	(a0)+,background_list
		move.l	(a0)+,destruction_list
		move.l	(a0)+,setup_pointer
		move.l	(a0)+,recoil_gun
		move.l	(a0)+,animations
		move.l	(a0)+,level_pal
		move.b	(a0)+,recoil_mod
		move.b	(a0)+,land1_mod
		move.b	(a0)+,rotating_gun_destroyed
		move.b	(a0)+,fuel_mod
		move.b	(a0)+,level_enemy_hit
		move.b	(a0),enemyf_hit
		rts

***************************************************************************
*		Choice screen
***************************************************************************

choice_screen	lea	custom,a5
		move.w	#$3081,diwstrt(a5)
		move.w	#$2cc1,diwstop(a5)
		move.w	#24,map_x
		bsr	__scroll
		bsr	guns_radar_off
		lea	enemy_off,a0
		bsr	all_enemys_off
		lea	guided_to_xys,a0
		clr.l	(a0)
		clr.l	4(a0)
		clr.l	8(a0)
		clr.l	12(a0)
		cmp.w	#99,choppers
		beq	choice_screen1
		move.w	#9,choppers
choice_screen1	move.w	#999,fuel
		move.l	#64,cycle_count
		move.w	#192*32,map_y
		clr.b	game_flag
		clr.b	demo_mode
		clr.b	pal_up_down
		move.w	#132,main_x
		move.w	#255,main_y
		move.b	#20,auto_move_cycle
		move.l	#auto_move,auto_move_list
		move.b	#1,auto_heli
		move.b	#75,p_free_life
		move.b	#1,rocket_flag
		move.w	#20,rockets
		move.w	#2,guided_missiles
		move.b	#1,guided_flag

		move.l	#clear_pal,d0
		bsr	set_pal1
		bsr	clear_screens
		move.l	screena,screenx
		move.l	high_entry,a0
		bsr	print_screen
		bsr	print_pointers
		clr.b	flip_flag
		bsr	flip_control
		move.b	#1,pal_choice
		fade_pal_in	#high_entry_pal
		pause	250,100
		move.b	#2,pal_choice
		fade_pal_in	#hi_score_pal
		clr.b	pal_choice

choice_loop	move.l	high_entry,a0
		bsr	print_screen
		bsr	print_pointers
		bsr	choice_scr_joy
		cmp.w	#10,front_pointer_no
		beq	choice_game_start
		cmp.w	#20,front_pointer_no
		beq	show_hi_table
		cmp.l	#500,cycle_count
		beq.s	start_demo
		inc.l	cycle_count
		dec.w	map_y
		bsr	flip_control
		bra.s	choice_loop

start_demo	move.l	#64,cycle_count
		move.w	#192*32,map_y
		clr.l	score
		move.b	#2,pal_choice
		fade_pal_out	#hi_score_pal
		pause	250,100
		move.b	#1,pal_choice
		fade_pal_out	#high_entry_pal
		clr.b	pal_choice
		bsr	clear_screens
		lea	custom,a5
		move.w	#$3091,diwstrt(a5)
		move.w	#$2ca1,diwstop(a5)
		move.b	#1,demo_mode
		move.b	#10,demo_move_cycle
		jsr	game_control
		move.l	#enemy_list_demo,setup_pointer
		move.l	#demo_moves,demo_move_list
		bra	jump_for_main


show_hi_table	move.b	#2,pal_choice
		fade_pal_out	#hi_score_pal
		pause	250,100
		move.b	#1,pal_choice
		fade_pal_out	#high_entry_pal
		clr.b	pal_choice
		move.l	#clear_pal,d0
		bsr	set_pal
		bsr	clear_screens
show_from_hi_score	move.w	#24,map_x
		bsr	__scroll
		bsr	clear_screens
		clr.w	front_pointer_no
		clr.l	cycle_count
		move.w	#192*32,map_y
		bsr	print_high_score
		fade_pal_in	#hi_score_pal

show_hi_loop	addq.l	#1,cycle_count
		dec.w	map_y
		cmp.l	#50000,cycle_count
		beq	show_hi_loop1
		jsr	joy_init
		btst	#fire,d0
		beq.s	show_hi_loop
show_hi_loop1	fade_pal_out	#hi_score_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		bsr	clear_screens
		bra	choice_screen

choice_game_start	clr.w	front_pointer_no
		move.l	#64,cycle_count
		move.w	#192*32,map_y
		clr.l	score
		move.b	#2,pal_choice
		fade_pal_out	#hi_score_pal
		pause	250,100
		move.b	#1,pal_choice
		fade_pal_out	#high_entry_pal
		clr.b	pal_choice
		bsr	clear_screens
		lea	custom,a5
		move.w	#$3091,diwstrt(a5)
		move.w	#$2ca1,diwstop(a5)
		bra	jump_for_main

***************************************************************************
*		Print screen
***************************************************************************
* a0 = source screen address

print_screen	move.l	screenx,a1
		move.l	a1,a2
		move.w	#199,d7
.lop		move.l	#19,d1
.lop1		move.w	(a0)+,(a1)
		move.w	(a0)+,40(a1)
		move.w	(a0)+,80(a1)
		move.w	(a0)+,120(a1)
		addq.l	#2,a1
		dbra	d1,.lop1
		adda.l	#160,a2
		move.l	a2,a1
		dbra.w	d7,.lop
		rts

***************************************************************************
*		Print front end screen
***************************************************************************

print_front_screen
		move.l	big_chopper,a0
		move.l	screenx,a1
		move.w	#10239,d0
.p_front_scr_lop	move.l	(a0)+,(a1)+
		dbra.w	d0,.p_front_scr_lop
		rts

***************************************************************************
*		       	
***************************************************************************

maxcol		equ	32


iffdcp		cmp.l	#'FORM',(a0)+
		bne	ifferr
		move.l	(a0)+,d1
		add.l	a0,d1
		cmp.l	#'ILBM',(a0)+
		bne	ifferr

		lea	colors(pc),a2
		moveq	#-1,d0
		moveq	#maxcol/2-1,d2
.1..		move.l	d0,(a2)+
		dbf	d2,.1..


bmhdlp		cmp.l	#'BMHD',(a0)+
		beq	.1..
		add.l	(a0)+,a0
		cmp.l	d1,a0
		bcs	bmhdlp
		bra	ifferr
.1..		move.w	4(a0),scrwid
		move.w	4+2(a0),scrhei
		move.b	4+8(a0),numbpl
		move.b	4+10(a0),comprs
		add.l	(a0)+,a0

cmaplp		cmp.l	#'CMAP',(a0)+
		beq	.1..
		add.l	(a0)+,a0
		cmp.l	d1,a0
		bcs	cmaplp
		bra	ifferr
.1..		move.l	(a0)+,d2
		move.l	a0,-(sp)
		add.l	d2,(sp)
		lea	colors(pc),a2
		divu	#3,d2
		cmp.w	#maxcol,d2
		bcs	cllpen
		moveq	#maxcol-1,d2
clloop		moveq	#0,d0
		move.b	(a0)+,d0
		lsl.w	#4,d0
		addq	#1,a0
		move.b	(a0)+,d0
		lsr.b	#4,d0
		or.b	-1-1(a0),d0
		move.w	d0,(a2)+
cllpen		dbf	d2,clloop
		move.l	(sp)+,a0
		

bodylp		cmp.l	#'BODY',(a0)+
		beq	.1..
		add.l	(A0)+,a0
		cmp.l	d1,a0
		bcs	bodylp
		bra	ifferr
.1..		move.l	(a0)+,d2
		move.b	comprs(pc),d0
		bne	dodcmp
		add.l	#15,d2
		lsr.l	#4,d2
		subq.w	#1,d2
		bcs	iffdrt
.2..		move.l	(a0)+,(a1)+
		move.l	(a0)+,(a1)+
		move.l	(a0)+,(a1)+
		move.l	(a0)+,(a1)+
		dbf	d2,.2..
		bra	iffdrt

dodcmp		add.l	a0,d2
dcomps		moveq	#0,d0
		move.b	(a0)+,d0
		bmi	iffneg
.1..		move.b	(a0)+,(a1)+
		dbf	d0,.1..
		bra	iffrjn
iffneg		neg.b	d0
		bmi	iffrjn
		move.b	(a0)+,d1
.1..		move.b	d1,(a1)+
		dbf	d0,.1..
iffrjn		cmp.l	a0,d2
		bhi	dcomps
		
iffdrt		moveq	#0,d0
		rts

ifferr		moveq	#-1,d0
		rts

scrwid		dc.w	0
scrhei		ds.w	0
numbpl		dc.b	0
comprs		dc.b	0
colors		ds.w	maxcol

***************************************************************************
*		Print front end pointers
***************************************************************************

print_pointers	lea	pointer_xys,a0
		moveq	#0,d1
		move.w	front_pointer_no,d1
		lsl.w	#3,d1
		move.l	(a0,d1.w),gen_x
		moveq	#0,d0
		pushm.l	all_regs
		lea	point_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		move.l	4(a0,d1.w),gen_x
		addq.l	#1,d0
		pushm.l	all_regs
		lea	point_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

***************************************************************************
*		Choice screen joystick
***************************************************************************

choice_scr_joy	cmp.w	#10,front_pointer_no
		rtseq

		jsr	joy_init
		btst	#up,d0
		beq.s	choice_down
		tst.w	front_pointer_no
		rtseq
		subq.w	#1,front_pointer_no
		rts

choice_down	jsr	joy_init
		btst	#down,d0
		beq.s	choice_fire
		cmp.w	#1,front_pointer_no
		rtseq
		addq.w	#1,front_pointer_no
		rts

choice_fire	jsr	joy_init
		btst	#fire,d0
		rtseq
		tst.w	front_pointer_no
		bne.s	choice_fire1
		move.w	#10,front_pointer_no
		rts
choice_fire1	move.w	#20,front_pointer_no
		rts

***************************************************************************
*		Print high score table entries
***************************************************************************

print_high_score	move.l	screena,screenx
		print_text	high_score_txt,40
		bsr	pnt_high_entries

		move.l	screenb,screenx
		print_text	high_score_txt,40
		bsr	pnt_high_entries
		rts

pnt_high_entries	lea	hi_entries,a0
		lea	high_score_pos,a2
		move.l	a0,a3
pnt_char_loop	cmp.b	#255,(a0)
		rtseq
		move.l	(a2),d1
		pushm.l	all_regs
		bsr	print_char
		popm.l	all_regs

		addq.l	#7,a3
		move.l	a3,a0
		addq.l	#4,a2
		bra	pnt_char_loop


***************************************************************************
*		Print characters
***************************************************************************
* a0 = text address, 0 at end to terminate
* d1 = position

print_char	move.l	d1,d2
		move.l	d2,d3
		divu	#160,d2
		mulu	#160,d2
		sub.l	d2,d3
		lsr.l	#2,d3
		add.l	d3,d2
		move.l	d2,d1
print_char1	move.l	high_characters,a1
		clr.l	d0
		move.b	(a0)+,d0
		tst.b	d0
		rtseq
		cmp.b	#32,d0
		bne.s	.cont1
		move.l	high_space,a1
		bra.s	.cont2

.cont1		cmp.b	#46,d0
		beq.s	.get_dot
		cmp.b	#57,d0
		ble	.get_number
		subi.b	#55,d0
.cont_it		lsl.w	#7,d0
		adda.l	d0,a1
.cont2		move.l	a1,a5
		move.l	screenx,a4
		adda.l	d1,a4
		move.l	a4,a6

		move.w	#15,d6		set height
.PcLOP5		moveq.w	#0,d7	 	* LET D7=WORDS ACROSS


* OR SCREEN DATA TOGETHER TO FIND OUT WHICH BITS ARE SET

.PcMLOP2		move.w	(a5),d3
		or.w	2(a5),d3
		or.w	4(a5),d3
		or.w	6(a5),d3

		eor.w	#$ffff,d3	 * CREATE MASK

* PLACE MASK ON SCREEN

		and.w	d3,(a4)
		and.w	d3,40(a4)
		and.w	d3,80(a4)
		and.w	d3,120(a4)

* OR SPRITE ONTO SCREEN
	
		movem.w	(a5)+,d2-d5
		or.w	d2,(a4)
		or.w	d3,40(a4)
		or.w	d4,80(a4)
		or.w	d5,120(a4)
		addq.l	#2,a4
		dbra.w	d7,.PcMLOP2
		adda.l	#160,a6
		move.l	a6,a4
		dbra.w	d6,.pcLOP5
		addq.l	#2,d1
		bra	print_char1

.get_number	subi.b	#48,d0
		bra	.cont_it

.get_dot		move.b	#36,d0
		bra	.cont_it

***************************************************************************
*		Print front screen fading in/out characters
***************************************************************************
* a0 = text address, 0 at end to terminate
* d1 = position

fade_print_char	pushm.l	all_regs
		move.l	d1,d2
		move.l	d2,d3
		divu	#160,d2
		mulu	#160,d2
		sub.l	d2,d3
		lsr.l	#2,d3
		add.l	d3,d2
		move.l	d2,d1
fade_print_char1	move.l	train_buff,a1
		moveq.l	#0,d0
		move.b	(a0)+,d0
		tst.b	d0
		beq	.pnt_end
		cmp.b	#32,d0
		bne.s	.cont1
		addq.l	#2,d1
		bra.s	fade_print_char1

.cont1		subi.b	#65,d0
.cont_it		mulu	#160,d0
		adda.l	d0,a1
.cont2		move.l	a1,a5
		move.l	screenx,a4
		adda.l	d1,a4
		move.l	a4,a6

		move.w	#15,d6		set height
		move.l	fade_mask,a3
.PcLOP5		moveq.w	#0,d7	 	* LET D7=WORDS ACROSS

* OR SCREEN DATA TOGETHER TO FIND OUT WHICH BITS ARE SET

.PcMLOP2		move.w	(a5)+,d3
		move.w	(a3),d2
		not.w	d2
		or.w	d2,d3

* PLACE MASK ON SCREEN

		and.w	d3,(a4)
		and.w	d3,40(a4)
		and.w	d3,80(a4)
		and.w	d3,120(a4)

* OR SPRITE ONTO SCREEN
	
		movem.w	(a5)+,d2-d5
		and.w	(a3),d2
		and.w	(a3),d3
		and.w	(a3),d4
		and.w	(a3)+,d5
		or.w	d2,(a4)
		or.w	d3,40(a4)
		or.w	d4,80(a4)
		or.w	d5,120(a4)
		addq.l	#2,a4
		dbra.w	d7,.PcMLOP2
		adda.l	#160,a6
		move.l	a6,a4
		dbra.w	d6,.pcLOP5
		addq.l	#2,d1
		bra	fade_print_char1

.pnt_end		popm.l	all_regs
		rts

fade_mask	dc.l	fm_1
fm_0		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000
		dc.w	%0000000000000000

fm_1		dc.w	%0000000000000001
		dc.w	%0000000000000010
		dc.w	%0000000000000100
		dc.w	%0000000000001000
		dc.w	%0000000000010000
		dc.w	%0000000000100000
		dc.w	%0000000001000000
		dc.w	%0000000010000000
		dc.w	%0000000100000000
		dc.w	%0000001000000000
		dc.w	%0000010000000000
		dc.w	%0000100000000000
		dc.w	%0001000000000000
		dc.w	%0010000000000000
		dc.w	%0100000000000000
		dc.w	%1000000000000000

fm_2		dc.w	%0000000000000101
		dc.w	%0000000000001010
		dc.w	%0000000000010101
		dc.w	%0000000000101010
		dc.w	%0000000001010100
		dc.w	%0000000010101000
		dc.w	%0000000101010000
		dc.w	%0000001010100000
		dc.w	%0000010101000000
		dc.w	%0000101010000000
		dc.w	%0001010100000000
		dc.w	%0010101000000000
		dc.w	%0101010000000000
		dc.w	%1010100000000000
		dc.w	%0101000000000000
		dc.w	%1010000000000000

fm_3		dc.w	%0000000000010101
		dc.w	%0000000000101010
		dc.w	%0000000001010101
		dc.w	%0000000010101010
		dc.w	%0000000101010101
		dc.w	%0000001010101010
		dc.w	%0000010101010100
		dc.w	%0000101010101000
		dc.w	%0001010101010000
		dc.w	%0010101010100000
		dc.w	%0101010101000000
		dc.w	%1010101010000000
		dc.w	%0101010100000000
		dc.w	%1010101000000000
		dc.w	%0101010000000000
		dc.w	%1010100000000000

fm_4		dc.w	%0000000001010111
		dc.w	%0000000010101111
		dc.w	%0000000101011111
		dc.w	%0000001010111110
		dc.w	%0000010101111101
		dc.w	%0000101011111010
		dc.w	%0001010111110101
		dc.w	%0010101111101010
		dc.w	%0101011111010100
		dc.w	%1010111110101000
		dc.w	%0101111101010000
		dc.w	%1011111010100000
		dc.w	%0111110101000000
		dc.w	%1111101010000000
		dc.w	%1111010100000000
		dc.w	%1110101000000000

fm_5		dc.w	%0000000101011111
		dc.w	%0000001010111111
		dc.w	%0000010101111111
		dc.w	%0000101011111111
		dc.w	%0001010111111111
		dc.w	%0010101111111110
		dc.w	%0101011111111101
		dc.w	%1010111111111010
		dc.w	%0101111111110101
		dc.w	%1011111111101010
		dc.w	%0111111111010100
		dc.w	%1111111110101000
		dc.w	%1111111101010000
		dc.w	%1111111010100000
		dc.w	%1111110101000000
		dc.w	%1111101010000000

fm_6		dc.w	%0000010101111111
		dc.w	%0000101011111111
		dc.w	%0001010111111111
		dc.w	%0010101111111111
		dc.w	%0101011111111111
		dc.w	%1010111111111111
		dc.w	%0101111111111111
		dc.w	%1011111111111110
		dc.w	%0111111111111101
		dc.w	%1111111111111010
		dc.w	%1111111111110101
		dc.w	%1111111111101010
		dc.w	%1111111111010100
		dc.w	%1111111110101000
		dc.w	%1111111101010000
		dc.w	%1111111010100000

fm_7		dc.w	%0001010111111111
		dc.w	%0010101111111111
		dc.w	%0101011111111111
		dc.w	%1010111111111111
		dc.w	%0101111111111111
		dc.w	%1011111111111111
		dc.w	%0111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111110
		dc.w	%1111111111111101
		dc.w	%1111111111111010
		dc.w	%1111111111110101
		dc.w	%1111111111101010
		dc.w	%1111111111010100
		dc.w	%1111111110101000

fm_8		dc.w	%0101011111111111
		dc.w	%1010111111111111
		dc.w	%0101111111111111
		dc.w	%1011111111111111
		dc.w	%0111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111110
		dc.w	%1111111111111101
		dc.w	%1111111111111010
		dc.w	%1111111111110101
		dc.w	%1111111111101010

fm_9		dc.w	%0101111111111111
		dc.w	%1011111111111111
		dc.w	%0111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111110
		dc.w	%1111111111111101
		dc.w	%1111111111111010

fm_10		dc.w	%0111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111110

fm_11		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111
		dc.w	%1111111111111111

fade_char_in	dc.l	fm_0,fm_1,fm_2,fm_3,fm_4,fm_5,fm_6,fm_7,fm_8
		dc.l	fm_9,fm_10,fm_11

fade_char_out	dc.l	fm_11,fm_10,fm_9,fm_8,fm_7,fm_6,fm_5,fm_4
		dc.l	fm_3,fm_2,fm_1,fm_0

fade_in_get	dc.l	fade_char_in
fade_out_get	dc.l	fade_char_out

***************************************************************************
*		The end sequence
***************************************************************************

end_sequence	clr.l	cycle_count
		clr.w	level
		move.w	#24,map_x
		bsr	__scroll
		bsr	clear_screens
		print_text	congrat_title,6408
		print_text	defeat_title,11208
		print_text	enemy_title,16000
		fade_pal_in	#hi_score_pal
		pause	3000,650
		fade_pal_out	#hi_score_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		bsr	clear_screens
		print_text	end_title,11224
		fade_pal_in	#hi_score_pal
		pause	500,500
		load	#scroll_fname,high_entry_pre,#21608
		unpack	high_entry_pre,21608,scroll_data
		move.w	#63,d0
		bsr	init_data
		unpack	choice_scr_packed,8552,high_entry_pre
		clr.w	level
		clr.b	weapon_select
		clr.b	landing_flag
		clr.b	droid_flag
		clr.b	multi_droid_flag
		clr.b	two_droid_flag
		clr.b	bullet_type
		unpack	packed_map,1312,pre_map
		bsr	guns_radar_off
		fade_pal_out	#hi_score_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		jsr	clear_screens
		bra	hi_score_control

***************************************************************************
*		Load File
***************************************************************************

load_file	pushm.l	all_regs
		move.l	path_name,d1
		move.l	#1005,d2
		CALLDOS	Open
		beq	eout
		move.l	d0,f_handle
		move.l	f_object,d2
		move.l	f_length,d3
		CALLDOS	Read
		move.l	f_handle,d1
		CALLDOS	Close
eout		popm.l	all_regs
		rts

***************************************************************************
*		Pallete Fade
***************************************************************************
* A0 = ADDRESS OF PALLETE

fade_main_pal	move.l	#pal_1,a0	
fade_pal		movem.l	d0-d7/a0-a6,gen_save
		tst.b	fade_flag
		bne.s	fade_con
fade_leave	movem.l	gen_save,d0-d7/a0-a6
		rts
fade_con		cmp.b	#out,fade_flag
		beq	fade_out
		cmp.b	#in,fade_flag
		beq	fade_in
		cmp.b	#init_out,fade_flag
		beq	init_fade_out	
		bra	init_fade_in

init_fade_out	move.l	#t_pal1,a1
		movem.l	(a0),d0-d7
		movem.l	d0-d7,(a1)
		move.b	#out,fade_flag
		bra.s	fade_leave

fade_out		clr.b	d1
		move.w	#15,d0
		move.l	#t_pal1,a0
out_top		tst.w	(a0)
		bne	no_zero
another_zero	addi.b	#1,d1
fade_back	addq.l	#2,a0
		dbra.w	d0,out_top
		cmp.b	#15,d1
		blt	cont_fade
		clr.b	fade_flag
cont_fade	cmp.b	#init_in,fade_flag
		beq.s	fade_leave
		move.l	#t_pal1,d0
		bsr	set_fade_pal
		bra	fade_leave

no_zero		move.w	(a0),d2	
		move.w	d2,d3
		and.w	#$f00,d3
		beq	nxt_f
		subi.w	#$100,d2
nxt_f		move.w	d2,d3
		and.w	#$0f0,d3
		beq	nxt_f1
		subi.w	#$010,d2
nxt_f1		move.w	d2,d3
		and.w	#$00f,d3
		beq	set_col
		subi.w	#$001,d2
set_col		move.w	d2,(a0)
		bra.s	fade_back

init_fade_in	move.l	#t_pal1,a1
		move.l	#in_pal1,a2
		movem.l	(a0),d0-d7
		movem.l	d0-d7,(a1)
		movem.l	d0-d7,(a2)
		bsr	fade_out

		move.l	#t_pal1,a1
		move.l	#in_pal2,a2
		movem.l	(a1),d0-d7
		movem.l	d0-d7,(a2)
		bsr	fade_out

		move.l	#t_pal1,a1
		move.l	#in_pal3,a2
		movem.l	(a1),d0-d7
		movem.l	d0-d7,(a2)
		bsr	fade_out

		move.l	#t_pal1,a1
		move.l	#in_pal4,a2
		movem.l	(a1),d0-d7
		movem.l	d0-d7,(a2)
		bsr	fade_out

		move.l	#t_pal1,a1
		move.l	#in_pal5,a2
		movem.l	(a1),d0-d7
		movem.l	d0-d7,(a2)
		bsr	fade_out

		move.l	#t_pal1,a1
		move.l	#in_pal6,a2
		movem.l	(a1),d0-d7
		movem.l	d0-d7,(a2)
		bsr	fade_out

		move.l	#t_pal1,a1
		move.l	#in_pal7,a2
		movem.l	(a1),d0-d7
		movem.l	d0-d7,(a2)
		move.b	#in,fade_flag
		move.l	#in_pal7,ftemp_pal
		bra	fade_leave

fade_in		move.l	ftemp_pal,d0
		bsr	set_fade_pal
		cmp.l	#in_pal1,ftemp_pal
		bne	updte_pal
		clr.b	fade_flag
		bra	fade_leave
updte_pal	addi.l	#32,ftemp_pal
		bra	fade_leave

****************************************************************************************
*		Fade in/out minds i text at front end
****************************************************************************************
* a1= address of fade blocks
* d6= amount of fade blocks

text_fade_1	pushm.l	all_regs
		bsr	print_front_screen
		popm.l	all_regs
		lea	apache_title,a0
		move.l	#9624,d1
		move.l	(a1),fade_mask
		bsr	fade_print_char
		lea	by_title,a0
		move.l	#16064,d1
		move.l	(a1),fade_mask
		bsr	fade_print_char
		lea	minds_i_title,a0
		move.l	#22448,d1
		move.l	(a1)+,fade_mask
		bsr	fade_print_char
		bsr	flip_control
		pause	200,50
		dbra.w	d6,text_fade_1
		rts

****************************************************************************************
*		Fade in/out graphics by text at front end
****************************************************************************************
* a1= address of fade blocks
* d6= amount of fade blocks

text_fade_2	pushm.l	all_regs
		bsr	print_front_screen
		popm.l	all_regs
		lea	graphic_title,a0
		move.l	#9640,d1
		move.l	(a1),fade_mask
		bsr	fade_print_char
		lea	by_title,a0
		move.l	#16064,d1
		move.l	(a1),fade_mask
		bsr	fade_print_char
		lea	m_wheel_title,a0
		move.l	#22416,d1
		move.l	(a1)+,fade_mask
		bsr	fade_print_char
		bsr	flip_control
		pause	200,50
		dbra.w	d6,text_fade_2
		rts

****************************************************************************************
*		Sample Player
****************************************************************************************

start		rts

* 6/5 = 5k
* 5/5 = 7.5k
* 5/4 = 10k
* 1/$29 = 15k
* 1/$1f = 20k
* 2/8 = 31k

samaddr	dc.l	0	; Address of sample
samlen	dc.l	0	; Length of sample
sound_flag	dc.w	0
frequency_1	ds.b	1
frequency_2	ds.b	1

***************************************************************************	
*		Unpack files
***************************************************************************

UNPAC		move.l	-(a0),a2
		move.l	-(a0),a2
		adda.l	a1,a2
		move.l	-(a0),d5
		move.l	-(a0),d0
		eor.l	d0,d5
plabel0		lsr.l	#1,d0
		bne.s	plabel1
		bsr.s	plabel2
plabel1		bcs.s	plabel3
		moveq	#8,d1
		moveq	#1,d3
		lsr.l	#1,d0
		bne.s	plabel4
		bsr.s	plabel2
plabel4		bcs.s	plabel5
		moveq	#3,d1
		moveq	#0,d4
plabel11		bsr.s	plabel6
		move.w	d2,d3
		add.w	d4,d3
ploop3		moveq	#7,d1
ploop2		lsr.l	#1,d0
		bne.s	plabel8
		bsr.s	plabel2
plabel8		roxl.l	#1,d2
		dbf	d1,ploop2
		move.b	d2,-(a2)
		dbf	d3,ploop3
		bra.s	plabel9
plabel12		moveq	#8,d1
		moveq	#8,d4
		bra.s	plabel11
plabel3		moveq	#2,d1
		bsr.s	plabel6
		cmpi.b	#2,d2
		blt.s	plabel10
		cmpi.b	#3,d2
		beq.s	plabel12
		moveq	#8,d1
		bsr.s	plabel6
		move.w	d2,d3
		move.w	#$C,d1
		bra.s	plabel5
plabel10		move.w	#9,d1
		add.w	d2,d1
		addq.w	#2,d2
		move.w	d2,d3
plabel5		bsr.s	plabel6
ploop4		subq.w	#1,a2
		move.b	0(a2,d2.w),(a2)
		dbf	d3,ploop4
plabel9		cmpa.l	a2,a1
		blt	plabel0
		rts
plabel2 		move.l	-(a0),d0
		eor.l	d0,d5
		move.b	#$10,ccr
		roxr.l	#1,d0
		rts
plabel6		subq.w	#1,d1
		moveq	#0,d2
ploop1		lsr.l	#1,d0
		bne.s	plabel7
		move.l	-(a0),d0
		eor.l	d0,d5
		move.b	#$10,ccr
		roxr.l	#1,d0
plabel7		roxl.l	#1,d2
		dbf	d1,ploop1
		rts

***************************************************************************
*		Turn off enemy xys
***************************************************************************
* a0= list of xys to be turned off

all_enemys_off	move.l	(a0),a1
all_enemy_off1	cmp.w	#x_end,(a1)
		beq.s	all_enemy_off4
		cmp.w	#x_off,(a1)
		bne.s	all_enemy_off3
all_enemy_off2	addq.l	#4,a1
		bra.s	all_enemy_off1

all_enemy_off3	move.w	#x_off,(a1)
		clr.w	2(a1)
		bra.s	all_enemy_off2

all_enemy_off4	addq.l	#4,a0
		cmp.l	#end_list,(a0)
		rtseq
		bra.s	all_enemys_off

guns_radar_off	lea	active_animations,a0
guns_radar_offtop	cmp.l	#x_end,(a0)
		beq	guns_radar_off_2
		cmp.l	#inactive,(a0)
		bne	guns_radar_off_1
		add.l	#12,a0
		bra	guns_radar_offtop

guns_radar_off_1	move.l	#inactive,(a0)
		clr.l	4(a0)
		clr.l	8(a0)
		add.l	#12,a0
		bra	guns_radar_offtop

guns_radar_off_2	lea	rotating_guns,a0
guns_radar_off_3	cmp.l	#x_end,(a0)
		rtseq
		cmp.l	#inactive,(a0)
		bne	guns_radar_off_4
		addq.l	#8,a0
		bra	guns_radar_off_3

guns_radar_off_4	move.l	#inactive,(a0)
		clr.l	4(a0)
		addq.l	#8,a0
		bra	guns_radar_off_3

***************************************************************************
*		High score sort & entry control routine
***************************************************************************

hi_score_control	tst.l	score
		bne	his_cont
		bra	choice_screen

his_cont		move.w	#24,map_x
		move.w	#192*32,map_y
		clr.l	score
		lea	hi_score_entries,a0
		lea	hi_score_entries_buff,a3
		moveq.w	#5,d0
his_lop2		lea	point_txt,a1
		move.l	a0,a2
		moveq.w	#5,d1
his_lop1		moveq.w	#0,d2
		moveq.l	#0,d3
		move.b	(a1)+,d2
		addi.b	#48,d2
		move.b	(a0)+,d3
		cmp.w	d2,d3
		bgt	sort_nxt
		blt	install_hi
		dbra.w	d1,his_lop1

install_hi	move.l	a3,gen1_save
		move.l	a2,gen_save

		lea	hi_entries,a0
		lea	hi_entries_buff,a1
		movem.l	(a0)+,screen_all
		movem.l	screen_all,(a1)
		movem.l	(a0)+,d1-d7/a2-a3
		movem.l	d1-d7/a2-a3,48(a1)

		move.l	gen1_save,a3
		move.l	gen_save,a2
		tst.w	d0
		beq.s	.next
		subq.w	#1,d0
		subq.l	#7,a2
		addq.l	#7,a3
.lop0		move.w	#13,d1
.lop		move.b	(a2)+,(a3)+
		dbra.w	d1,.lop
		dbra.w	d0,.lop0

.next		move.l	gen1_save,a0
		lea	point_txt,a1
		moveq.w	#5,d1
his_lop3		move.b	(a1)+,(a0)
		addi.b	#48,(a0)
		addq.l	#1,a0
		dbra.w	d1,his_lop3

draw_hientry
		move.l	#hi_name,hi_name_point	reset variables
		lea	pointer_xy,a0
		move.w	#32,(a0)
		move.w	#48,2(a0)
		lea	main_x,a0
		move.w	#24,(a0)
		move.w	#135,2(a0)
		clr.b	hi_point_cycle
		clr.b	hi_point_dir
		clr.b	pointer_pos
		clr.b	letter_select
		clr.w	main_frame
		clr.b	rocket_flag
		move.b	#1,char_amount

		move.l	screena,screenx
		bsr	pnt_table
		bsr	print_letter_buf
		bsr	prnt_hi_pointer
		bsr	print_hi_chop
		clr.b	flip_flag
		bsr	flip_control
		fade_pal_in	#hi_score_pal

* ENTER NAME
hi_score_loop	move.w	#10,rockets
*		jsr	explo_soundproirity
		bsr	quick_clear
		bsr	pnt_table	print letters ect
		bsr	print_letter_buf	print letters already selected
		bsr	prnt_hi_pointer	  ''  pointer
		bsr	hi_score_joy
		bsr	rocket_point_coll
		bsr	update_rocket
		move.b	#1,landing_flag
		bsr	update_explo_24
		clr.b	landing_flag
		bsr	print_hi_chop
		tst.b	letter_select
		bne.s	letter_selected
hi_score_loop1	bsr	flip_control
		bra.s	hi_score_loop
		
letter_selected	cmp.b	#2,letter_select
		beq.s	hi_score_loop1
		bsr	calc_letter
		cmp.b	#3,letter_select
		bne	hi_score_loop1
		
*		sound	#clear_dig,#2,#5,#5,#2
		lea	hi_name,a0
		lea	cheat,a1
		move.w	#5,d1
cheat_check	move.b	(a0)+,d0
		cmp.b	(a1)+,d0
		bne	score_cont
		dbra.w	d1,cheat_check
		move.w	#99,choppers

score_cont	move.l	gen1_save,a0
		suba.l	#7,a0
		lea	hi_name,a1
		move.w	#5,d1
his_lop7		move.b	(a1),(a0)+
		move.b	#46,(a1)+
		dbra.w	d1,his_lop7

		lea	hi_entries,a0
		lea	hi_entries_buff,a1
		movem.l	(a1)+,screen_all
		movem.l	screen_all,(a0)
		movem.l	(a1)+,d1-d7/a2-a3
		movem.l	d1-d7/a2-a3,48(a0)
		bra.s	hi_score_exit

sort_nxt		adda.l	#14,a2
		adda.l	#14,a3
		move.l	a2,a0
		dbra.w	d0,his_lop2
hi_score_exit	fade_pal_out	#hi_score_pal
		move.l	#clear_pal,d0
		bsr	set_pal
		bsr	clear_screens
		unpack	choice_scr_packed,8552,high_entry_pre
		bra	show_from_hi_score

***************************************************************************
*		Rocket to pointer collision
***************************************************************************

rocket_point_coll	lea	rocket_xys,a1
		lea	srocket_dis,a2
.col1_top	cmp.w	#x_end,(a1)
		rtseq
		cmp.w	#7,(a2)
		bge	.next1
		cmp.w	#x_off,(a1)
		bne	.col2
.next1		addq.w	#4,a1
		addq.w	#2,a2
		bra	.col1_top

.col2		lea	pointer_xy_temp,a0

		move.l	(a0),ax
		move.l	(a0),acolx
		add.w	#8,acolx
		add.w	#8,acoly
		move.l	(a1),ix
		move.l	(a1),icolx
		add.w	#6,icolx
		add.w	#5,icoly
		bsr	gen_col
		tst.b	d0
		beq	.next1
		subq.w	#6,(a1)
		subq.w	#6,2(a1)
		explode_24	(a1),2(a1)
		move.b	#1,letter_select
		clr.b	rocket_flag
.dis_bull	move.w	#x_off,(a1)
		bra	.next1

***************************************************************************
*		Hi score chopper control
***************************************************************************

print_hi_chop	inc.w	main_frame
		cmp.w	#4,main_frame
		bne	.lop
		clr.w	main_frame
.lop		move.l	main_x,gen_x
		moveq	#0,d0
		move.w	main_frame,d0
		bsr	p_hel_pla_sprite
		rts

***************************************************************************
*		Calculate which letter pointer is over
***************************************************************************

calc_letter	lea	letter_number,a0
		lea	hi_name_point,a1
		move.l	(a1),a3
		moveq	#0,d1
		move.b	pointer_pos_temp,d1
		adda.l	d1,a0
		move.b	(a0),d0
		cmp.b	#92,d0
		beq.s	.calc_delete
		cmp.b	#93,d0
		beq	.exit_entry
		cmp.b	#7,char_amount
		beq.s	.calc_clear
		move.b	d0,(a3)
		addq.l	#1,a3
		move.l	a3,hi_name_point
		addq.b	#1,char_amount
.calc_clear	move.b	#2,letter_select
		rts

.calc_delete	cmp.b	#1,char_amount
		rtseq
		move.b	#46,-1(a3)
		subq.l	#1,a3
.calc_delete1	move.b	#2,letter_select
		subq.b	#1,char_amount
		move.l	a3,hi_name_point
		rts

.exit_entry	move.b	#3,letter_select
		rts

***************************************************************************
*		Hi-score joystick routine
***************************************************************************

hi_score_joy	lea	explo24_xys,a0
hi_sc1		cmp.w	#x_end,(a0)
		beq	hi_sc2
		cmp.w	#x_off,(a0)
		rtsne
		addq.l	#4,a0
		bra.s	hi_sc1

hi_sc2		tst.b	rocket_flag
		rtsne
		clr.b	letter_select
		tst.b	hi_point_cycle
		bne	.update_pointer

		jsr	joy_init
		btst	#right,d0
		beq.s	.try_left
		cmp.b	#7,pointer_pos
		rtseq
		cmp.b	#15,pointer_pos
		rtseq
		cmp.b	#23,pointer_pos
		rtseq
		cmp.b	#28,pointer_pos
		rtseq
		addq.b	#1,pointer_pos
		move.b	#right,hi_point_dir
		move.b	#2,hi_point_cycle
		rts

.try_left	jsr	joy_init
		btst	#left,d0
		beq.s	.try_down
		tst.b	pointer_pos
		rtseq
		cmp.b	#8,pointer_pos
		rtseq
		cmp.b	#16,pointer_pos
		rtseq
		cmp.b	#24,pointer_pos
		rtseq
		subq.b	#1,pointer_pos
		move.b	#left,hi_point_dir
		move.b	#2,hi_point_cycle
		rts

.try_down	jsr	joy_init
		btst	#down,d0
		beq.s	.try_up
		cmp.b	#20,pointer_pos
		rtsgt
		addq.b	#8,pointer_pos
		move.b	#down,hi_point_dir
		move.b	#2,hi_point_cycle
		rts

.try_up		jsr	joy_init
		btst	#up,d0
		beq.s	.try_fire
		cmp.b	#8,pointer_pos
		rtslt
		subq.b	#8,pointer_pos
		move.b	#up,hi_point_dir
		move.b	#2,hi_point_cycle
		rts


.try_fire	jsr	joy_init
		btst	#fire,d0
		beq.s	.clear_lett
		move.w	main_x,d0
		addi.w	#13,d0
		dis1_bull	#4,d0,main_y,#0,#-8,init_rocket
		move.b	#1,rocket_flag
		move.l	pointer_xy,pointer_xy_temp
		move.b	pointer_pos,pointer_pos_temp
		rts

.clear_lett	clr.b	letter_select
		rts

.update_pointer	lea	pointer_xy,a0
		cmp.b	#right,hi_point_dir
		bne.s	.update_left
		addq.w	#4,(a0)
		addq.w	#4,main_x
		bra	.update_cycle

.update_left	cmp.b	#left,hi_point_dir
		bne.s	.update_down
		subq.w	#4,(a0)
		subq.w	#4,main_x
.update_cycle	cmp.b	#16,hi_point_cycle
		beq.s	.reset_cycle
		addq.b	#2,hi_point_cycle
		rts

.update_down	cmp.b	#down,hi_point_dir
		bne.s	.update_up
		addq.w	#4,2(a0)
		addq.w	#2,main_y
		bra	.update_cycle1

.update_up	subq.w	#4,2(a0)
		subq.w	#2,main_y
.update_cycle1	cmp.b	#12,hi_point_cycle
		beq.s	.reset_cycle
		addq.b	#2,hi_point_cycle
		rts

.reset_cycle	clr.b	hi_point_cycle
		rts

***************************************************************************
*		PRINT LETTERS IN BUFFER ALREADY SELECTED
***************************************************************************

PRINT_LETTER_BUF	print_text	hi_name,3840+48
		rts

***************************************************************************
*		Print hi-score pointer
***************************************************************************

prnt_hi_pointer	lea	pointer_xy,a0
		move.l	(a0),gen_x
		inc.l	pointer_frame
		cmp.l	#2,pointer_frame
		bne	prnt_hi_cont
		clr.l	pointer_frame
prnt_hi_cont	move.l	pointer_frame,d0
		pushm.l	all_regs
		lea	hi_pick_blit_list,a3
		bsr	dump_frame
		popm.l	all_regs
		rts

pointer_frame	dc.l	0

***************************************************************************
*		Print high score entry table
***************************************************************************

PNT_TABLE	print_text	high_score_title,16
		lea	high_score_lett1,a0
		lea	high_scor_lettpos,a1
		move.l	a0,a3
pnt_table1	cmp.b	#255,(a0)
		rtseq
		move.l	(a1),d1
		pushm.l	all_regs
		bsr	print_char
		popm.l	all_regs

		adda.l	#16,a3
		move.l	a3,a0
		addq.l	#4,a1
		bra.s	pnt_table1

***************************************************************************
*		Print the get ready plaque
***************************************************************************

print_get_ready	tst.b	p_free_life
		rtseq
		tst.b	get_ready_reverse
		bne	p_get_ready_out1
		move.l	fade_in_get,a1		fade in
		lea	get_ready_title,a0
		move.l	#9624,d1
		move.l	(a1),fade_mask
		bsr	fade_print_char
		cmp.b	#11,get_ready_count
		beq	p_get_ready_out
		addq.l	#4,a1
		move.l	a1,fade_in_get
		addq.b	#1,get_ready_count
		rts

p_get_ready_out	tst.b	get_ready_pause		pause
		beq	p_get_ready_out1
		subq.b	#1,get_ready_pause
		rts
p_get_ready_out1	move.b	#1,get_ready_reverse	fade out
		move.l	fade_out_get,a1
		lea	get_ready_title,a0
		move.l	#9624,d1
		move.l	(a1),fade_mask
		bsr	fade_print_char
		cmp.b	#11,get_ready_count2
		rtseq
		addq.b	#1,get_ready_count2
		addq.l	#4,a1
		move.l	a1,fade_out_get
		rts

get_ready_count	dc.b	0	list counter for fading in
get_ready_count2	dc.b	0	list counter for fading out
get_ready_pause	dc.b	40	pause between fade in & out
get_ready_reverse	dc.b	0	get ready is fading out

***************************************************************************
*		Variables
***************************************************************************
	SECTION DATA

* AMIGA BITS
c1_loop		ds.w	1
c_loop		ds.w	1
cladr		ds.l	1
cladr1		ds.l	1
memory_start	ds.l	1

f_source		ds.l	1		file write source data
f_object		ds.l	1		file read object ram
f_length		ds.l	1		file length
path_name	ds.l	1		file name
f_handle		ds.w	1		file handle
f_attr		ds.w	1		01/read 08/file 02/hidden
f_mode		ds.w	1		0/read 1/write 2/r,w


*		--------------
*		 FRONT SCREEN
*		--------------

pointer_xys	dc.w	250,105,68,105
		dc.w	250,130,68,130

front_pointer_no	dc.w	0

*		------------
*		 HIGH SCORE
*		------------

high_score_txt	dc.b	'HIGH SCORE',0
high_score_pos	dc.l	5600-320+16,5712-320-24
		dc.l	10400-320+16,10512-320-24
		dc.l	15200-320+16,15312-320-24
		dc.l	20000-320+16,20112-320-24
		dc.l	24800-320+16,24912-320-24
		dc.l	29600-320+16,29712-320-24

hi_entries	dc.b	'ROBERT',0
hi_score_entries	dc.b	'040000',0

		dc.b	'MARTIN',0
		dc.b	'030000',0

		dc.b	'MARCUS',0
		dc.b	'020000',0

		dc.b	'JOHN  ',0
		dc.b	'010000',0

		dc.b	'TRACEY',0
		dc.b	'005000',0

		dc.b	'MARVIN',0
		dc.b	'000005',0
		dc.b	255

		even
hi_entries_buff	ds.b	7
hi_score_entries_buff	ds.b	78

high_score_title	dc.b	'ENTER YOUR NAME',0
high_scor_lettpos	dc.l	7680+16,11520+16,15360+16,19200+16,0
high_score_lett1	dc.b	'A B C D E F G H',0
		dc.b	'I J K L M N O P',0
		dc.b	'Q R S T U V W X',0
		dc.b	'Y Z .',32,92,32,93,94,95,'    ',0
		dc.b	255

hi_name_point	dc.l	hi_name
hi_name		dc.b	'......',0
cheat		dc.b	'ROBERT',0
char_amount	dc.b	1

point_grfx_table	dc.w	0,256,256*2,256*3,256*4,256*5,256*6,256*7
pointer_xy	dc.w	32,48
pointer_xy_temp	dc.w	0,0
hi_point_cycle	dc.b	0
hi_point_dir	dc.b	0
pointer_pos	dc.b	0
pointer_pos_temp	dc.b	0
letter_select	dc.b	0
letter_number	dc.b	65,66,67,68,69,70,71,72
		dc.b	73,74,75,76,77,78,79,80
		dc.b	81,82,83,84,85,86,87,88
		dc.b	89,90,46,92,93

*		------
*		 DEMO
*		------

demo_move_list	dc.l	demo_moves
demo_move_cycle	dc.b	25
demo_mode	dc.b	0

demo_moves	dc.b	4,5,0,15,8,7,28,1,28,1,28,1,28,5
		dc.b	1,15,0,20,2,17,0,3,8,7
		dc.b	0,2,128,1,128,1,128,1,128,1
		dc.b	0,70,1,3,129,10,10,15,0,150
		dc.b	4,15,128,120,1,7,0,85
		dc.b	8,4,128,1,0,1,128,1,0,1,10,3,0,1
		dc.b	128,1,0,1,128,1,0,1,128,1,0,1
		dc.b	128,1,0,1,128,1,0,1,128,1,0,1
		dc.b	0,90,10,5,8,20,129,10,10,5,129,10
		dc.b	0,2,4,40,0,255,0,255,0,255


*		------------
*		   SCROLL
*		------------

variables	dc.l	map_end-94
		dc.w	0
		dc.l	scroll_data
infinite_scroll	dc.b	0
infinite_scroll_map	ds.b	80
map_temp		ds.l	1
explo_bckground	ds.b	1	init. quick explosion if 1

*		----------------
*		   MAIN SPRITE
*		----------------

auto_move_list	dc.l	auto_move
auto_move	dc.b	0,5,1,20,255
auto_heli	ds.b	1
auto_move_cycle	ds.b	1
landing_flag	ds.b	1
main_frame	ds.w	1
main_x		dc.w	120
main_y		dc.w	100
main_speed	dc.w	4
main_dir		dc.b	100
		dc.w	0
droid_flag	dc.b	0 
droid_y		ds.w	1
droid1_x		ds.w	1
droid2_x		ds.w	1
droid_frame	ds.b	1
droid_frames	dc.l	0,1,2,3
droid_8		dc.w	0,256,256*2,256*3,256*4,256*5,256*6,256*7
droid_distance	dc.w	2
multi_droid_flag	dc.b	0
droid_list	dc.w	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		dc.w	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		dc.w	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,x_end
multi_droid1	dc.l	droid_list
multi_droid2	dc.l	droid_list+32
multi_droid3	dc.l	droid_list+64
droidxy_temp	dc.w	0,0
droid_list1	dc.w	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		dc.w	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		dc.w	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,x_end
multi_droid1_1	dc.l	droid_list1
multi_droid2_1	dc.l	droid_list1+32
multi_droid3_1	dc.l	droid_list1+64
droidxy_temp1	dc.w	0,0
two_droid_flag	dc.b	0
landing_shadow_dis	dc.w	12,14,8,10,4,6
land_dir		ds.b	1
landing_address	ds.l	1

*		-------------
*		   GENERAL
*		-------------

gen_x		ds.w	1
gen_y		ds.w	1
gen1_x		ds.w	1
gen1_y		ds.w	1
sp_x		ds.w	1
sp_y		ds.w	1
gen_frame	ds.w	1
save_stack	ds.l	1
gen1_save	ds.l	15
gen_save		ds.l	15
cycle_count	ds.l	1


*		--------
*		  FADE
*		--------

fade_flag	ds.b	1
pal_up_down	ds.b	1
level_updown_list	dc.l	level1_pal_list,level2_pal_list
		dc.l	level3_pal_list,level2_pal_list
level1_pal_list_temp	ds.l	1
level1_pal_list	dc.l	pal_1_1,pal_1_1,pal_1_2
		dc.l	pal_1_2,pal_1_1,pal_1_1,pal_1,x_end
level2_pal_list	dc.l	pal_2_1,pal_2_1,pal_2_2
		dc.l	pal_2_2,pal_2_1,pal_2_1,swamp_pal,x_end
level3_pal_list	dc.l	pal_3_1,pal_3_1,pal_3_2
		dc.l	pal_3_2,pal_3_1,pal_3_1,level_3_pal,x_end
level_smart_pal_l	dc.l	lev1_smart_pal,lev2_smart_pal,lev3_smart_pal
		dc.l	lev2_smart_pal
lev1_smart_pal	dc.l	pal_1_1smart,pal_1_1smart,pal_1_2smart
		dc.l	pal_1_2smart,pal_1_1smart,pal_1_1smart
		dc.l	pal_1,x_end
lev2_smart_pal	dc.l	pal_2_1smart,pal_2_1smart,pal_2_2smart
		dc.l	pal_2_2smart,pal_2_1smart,pal_2_1smart
		dc.l	swamp_pal,x_end
lev3_smart_pal	dc.l	pal_3_1smart,pal_3_1smart,pal_3_2smart
		dc.l	pal_3_2smart,pal_3_1smart,pal_3_1smart
		dc.l	level_3_pal,x_end
active_pal	ds.l	1
ftemp_pal	ds.l	1
t_pal1		ds.w	16
in_pal7		ds.w	16
in_pal6		ds.w	16
in_pal5		ds.w	16
in_pal4		ds.w	16
in_pal3		ds.w	16
in_pal2		ds.w	16
in_pal1		ds.w	16
clr_pal		ds.w	16

*		--------------
*		  EXPLOSIONS
*		--------------

explo_flag	ds.b	1	give explode sound priority
explo_cycle	ds.b	1
explo24_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_end
explo24_frames	ds.b	6
explo24_list	dc.l	0,0,1,1,2,2,3,3
explo40_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_end
explo40_frames	ds.b	6
explo40_list	dc.l	4,5,6,7,8,9,10,11


*		--------------
*		   SCREENS
*		--------------

screena		ds.l	1
screenb		ds.l	1
screenc		ds.l	1	
screenx		ds.l	1	active screen
flip_flag	dc.b	1

*		-----------
*		  PLAYERS
*		-----------

game_flag	ds.b	1
players		dc.b	2

*		----------------
*		   ANIMATION
*		----------------

level_animations	dc.l	radar_seq,recoil_gun_seq,-1
level1_animations	dc.l	radar1_seq,recoil1_gun_seq,-1
level2_animations	dc.l	radar2_seq,recoil2_gun_seq,-1
level3_animations	dc.l	radar3_seq,recoil3_gun_seq,-1
recoil_gun_seq	dc.b	43,44,45,46,-1
recoil1_gun_seq	dc.b	40,41,42,43,-1
recoil2_gun_seq	dc.b	44,45,46,47,-1
recoil3_gun_seq	dc.b	40,41,42,43,-1
radar_seq	dc.b	48,49,50,51,52,53,54,-1
radar1_seq	dc.b	45,46,47,48,49,50,51,-1
radar2_seq	dc.b	48,49,50,51,52,53,54,-1
radar3_seq	dc.b	45,46,47,48,49,50,51,-1

active_animations	dc.l	inactive,0,0,inactive,0,0,inactive,0,0
		dc.l	inactive,0,0,inactive,0,0,inactive,0,0
		dc.l	inactive,0,0,inactive,0,0,inactive,0,0
		dc.l	inactive,0,0,x_end

*		------------------
*		   Rotating gun
*		------------------

rotating_guns	dc.l	inactive,0,inactive,0,inactive,0
		dc.l	inactive,0,inactive,0,inactive,0,x_end
rotating_gun_dis	dc.w	4,0,4,4,0,4,-4,4
		dc.w	-4,0,-4,-4,0,-4,4,-4
rotating_gun_seq	dc.b	26,27,28,29,30,31,32,33
rotating1_gun_seq	dc.b	16,17,18,19,20,21,22,23
rotating2_gun_seq	dc.b	20,21,22,23,24,25,26,27
rotating3_gun_seq	dc.b	16,17,18,19,20,21,22,23
rotating_gun_pause	ds.b	6
gun_forward_lev3	ds.b	6
gun_frame_lev3	ds.b	6
rotating_bullet_dis	dc.w	33,6,33,13
		dc.w	30,19,25,25
		dc.w	19,27,11,27
		dc.w	-2,19,3,25
		dc.w	-5,6,-5,13
		dc.w	-3,0,4,-5
		dc.w	10,-7,18,-7
		dc.w	27,-6,33,0

*		-----------------
*		   Level Info
*		-----------------

level		dc.w	0

data_filename	dc.l	scroll_fname
map_filename	dc.l	map_fname
rotating_gun	dc.l	rotating_gun_seq	
* map_address	dc.l	
* map_graphics	dc.l	
background_list	dc.l	level_background
destruction_list	dc.l	level_destruction
setup_pointer	dc.l	enemy_list
recoil_gun	dc.l	recoil_gun_seq
animations	dc.l	level_animations
level_pal	ds.l	1
recoil_mod	dc.b	44
land1_mod	dc.b	41
rotating_gun_destroyed	dc.b	34
fuel_mod		dc.b	8
level_enemy_hit	dc.b	5
enemyf_hit	dc.b	2
level_info	dc.l	desert,swamp,level_3,level_4

desert		dc.l	scroll_fname,map_fname
		dc.l	rotating_gun_seq,map_end
		dc.l	scroll_data,level_background
		dc.l	level_destruction,enemy_list
		dc.l	recoil_gun_seq,level_animations
		dc.l	pal_1
		dc.b	44,41,34,8,5,2

swamp		dc.l	scroll1_fname,map1_fname
		dc.l	rotating1_gun_seq,map_end
		dc.l	scroll_data,level1_background
		dc.l	level1_destruction,enemy1_list
		dc.l	recoil1_gun_seq,level1_animations
		dc.l	swamp_pal
		dc.b	41,38,24,2,6,3

level_3		dc.l	scroll2_fname,map2_fname
		dc.l	rotating2_gun_seq,map_end
		dc.l	scroll_data,level2_background
		dc.l	level2_destruction,enemy2_list
		dc.l	recoil2_gun_seq,level2_animations
		dc.l	level_3_pal
		dc.b	45,18,28,10,7,4

level_4		dc.l	scroll3_fname,map3_fname
		dc.l	rotating3_gun_seq,map_end
		dc.l	scroll_data,level3_background
		dc.l	level3_destruction,enemy3_list
		dc.l	recoil3_gun_seq,level3_animations
		dc.l	swamp_pal
		dc.b	41,38,24,2,8,4

*		------------------
*		  SPRITE ROUTINE
*		------------------

clip_table	dc.w	0,18,2*18,3*18,4*18,5*18,6*18,7*18
		dc.w	8*18,9*18,10*18,11*18,12*18,13*18,14*18,15*18
		dc.w	16*18,17*18,18*18,19*18,20*18,21*18,22*18,23*18
		dc.w	24*18,25*18,26*18,27*18,28*18,29*18,30*18
clip64_table	dc.w	0,30,2*30,3*30,4*30,5*30,6*30,7*30
		dc.w	8*30,9*30,10*30,11*30,12*30,13*30,14*30,15*30
		dc.w	16*30,17*30,18*30,19*30,20*30,21*30,22*30,23*30
		dc.w	24*30,25*30,26*30,27*30,28*30,29*30,30*30
		dc.w	31*30,32*30,33*30,34*30,35*30,36*30,37*30
		dc.w	38*30,39*30,40*30,41*30,42*30,43*30,44*30
		dc.w	45*30,46*30,47*30,48*30,49*30,50*30,51*30
		dc.w	52*30,53*30,54*30,55*30,56*30,57*30,58*30
rot_table	dc.b	left,7,left,6,left,5,left,4,left,3,left,2,left,1,left,0,0,0
		dc.b	right,0,right,1,right,2,right,3,right,4,right,5,right,6,right,7
p_free_life	dc.b	0
databuf		ds.w	24
count		ds.w	1
count1		ds.w	1
sp_dir		ds.b	1
mask_80		ds.l	1
mask_2416	ds.l	1
mask_4032	ds.l	1
y_table		ds.w	255
main_frame_table	dc.w	0,1056,2*1056,3*1056,4*1056,5*1056,6*1056,7*1056
main_anim_table	dc.w	0,4224,2*4224,3*4224
mains_frame_table	dc.w	0,246,2*246,3*246,4*246,5*246,6*246,7*246

*		--------------
*		     DOS
*		--------------

_DOSBase	dc.l	0

dname:
	DOSNAME
grafbase:
	dc.l	0

grname		dc.b	"graphics.library",0
		even


main_sprite_fname	dc.b	'hel_pla.spr',0
bullet_fname	dc.b	'bullets.spr',0
laser_dig1_fname	dc.b	'lasr1.dig',0
laser_dig2_fname	dc.b	'lasr2.dig',0
laser_dig3_fname	dc.b	'lasr3.dig',0
explo_dig2_fname	dc.b	'explo2.dig',0
explo_dig1_fname	dc.b	'explo2.dig',0
scroll_fname	dc.b	'scroll.dat',0
scroll1_fname	dc.b	'scroll1.dat',0
scroll2_fname	dc.b	'scroll2.dat',0
scroll3_fname	dc.b	'scroll3.dat',0
map_fname	dc.b	'scroll.map',0
map1_fname	dc.b	'scroll1.map',0
map2_fname	dc.b	'scroll2.map',0
map3_fname	dc.b	'scroll3.map',0
tank_fname	dc.b	'tanks.spr',0
score_fname	dc.b	'score.spr',0
pickup_fname	dc.b	'hi-miss.spr',0
big_chop_fname	dc.b	'big_chop.spr',0
pick_dr_fname	dc.b	'pick_dr.spr',0
train_fname	dc.b	'train.spr',0
choice_fname	dc.b	'logo.neo',0
small_chop_fname	dc.b	'schop.spr',0
miss_dis_fname	dc.b	'big_miss.dat',0
bull_flash_fname	dc.b	'bull_hit_hi.spr',0
front_end_fname	dc.b	'front_end.iff',0
front_char_name	dc.b	'front_chars.spr',0

pointer_fname	dc.b	'pointers.spr',0
fname1_80x70	dc.b	'80x70.spr',0
high_char_name	dc.b	'hi_chars.txt',0
sample_fname1	dc.b	'gun.spl',0
sample_fname2	dc.b	'explo3.spl',0
sample_fname3	dc.b	'gunhit.spl',0
sample_fname4	dc.b	'pickup.spl',0
sample_fname5	dc.b	'explo7.spl',0
sample_fname6	dc.b	'rapidgun.spl',0
sample_fname7	dc.b	'missile.spl',0
explo_fname	dc.b	'explo.spr',0
		even
bb_data		ds.b	80

*		--------------
*		  COLLISION
*		--------------

back_table	dc.b	18,19,22,23,26,27,36,38,40,41,42,255
ax		ds.w	1
ay		ds.w	1
acolx		ds.w	1
acoly		ds.w	1
ix		ds.w	1
iy		ds.w	1
icolx		ds.w	1
icoly		ds.w	1

level_background	dc.b	48,49,50,51,52,53,54
		dc.b	26,27,28,29,30,31,32,33
		dc.b	9,10,11,12,13,14,15,16
		dc.b	43,44,45,46
		dc.b	41,-1
level_destruction	dc.b	55,55,55,55,55,55,55
		dc.b	34,34,34,34,34,34,34,34
		dc.b	56,57,58,59,60,61,62,63
		dc.b	47,47,47,47
		dc.b	42

level1_background	dc.b	16,17,18,19,20,21,22,23
		dc.b	26
		dc.b	34,35,36,37
		dc.b	7,8,9,10,27
		dc.b	40,41,42,43
		dc.b	45,46,47,48,49,50,51
		dc.b	3,24
		dc.b	-1
level1_destruction	dc.b	24,24,24,24,24,24,24,24
		dc.b	25
		dc.b	60,61,62,63
		dc.b	56,57,58,59,57
		dc.b	44,44,44,44
		dc.b	44,44,44,44
		dc.b	52,52,52,52,52,52,52
		dc.b	0,1

level2_background	dc.b	11,12,13,14
		dc.b	20,21,22,23,24,25,26,27
		dc.b	32,33,34,35
		dc.b	42,43
		dc.b	44,45,46,47
		dc.b	48,49,50,51,52,53,54
		dc.b	37,29
		dc.b	-1
level2_destruction	dc.b	60,61,62,63
		dc.b	28,28,28,28,28,28,28,28
		dc.b	59,58,59,58
		dc.b	56,57
		dc.b	41,41,41,41
		dc.b	55,55,55,55,55,55,55
		dc.b	38,0

level3_background	dc.b	40,41,42,43
		dc.b	16,17,18,19,20,21,22,23
		dc.b	45,46,47,48,49,50,51
		dc.b	28,29,30,31,53
		dc.b	34,35,36,37
		dc.b	56,57,3,24,26
		dc.b	-1
level3_destruction	dc.b	44,44,44,44
		dc.b	24,24,24,24,24,24,24,24
		dc.b	52,52,52,52,52,52,52
		dc.b	33,32,32,32,54
		dc.b	60,61,62,63
		dc.b	58,59,0,1,25

*	       -----------
*		WEAPONS
*	       -----------

guided_flag	dc.b	1
guided_frames	dc.l	5,6,7,8,9,10,11,12
guided_8		dc.w	5,6,7,8,9,10,11,12
guided_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_end
guided_to_xys	dc.l	0,0,0,0
guided_dis	dc.w	0,-4,4,-4,4,0,4,4,0,4,-4,4
		dc.w	-4,0,-4,-4

p_fire_flag	dc.b	0
p_bullet_flag	dc.b	1
p_bull_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_end
p_bull_dis	ds.w	40
p_bull_grfx	ds.l	20
p_bullet_type	ds.b	20

rocket_flag	dc.b	1
rockets		dc.w	20
guided_missiles	dc.w	0
flares		dc.w	0
rocket_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_end
rocket_dis	ds.w	10
rocket_grfx	ds.l	5
srocket_dis	dc.w	12,12,12,12,12
		dc.w	x_end

main_bullet_fire	dc.b	0	what to sub from enemy hit amount
bullet_type	dc.b	0	0=normal 1=single power 2=double power
weapon_select	dc.b	0	0=droid 1=double droid 2=multi droid

*		---------------------------------
*		 SCROLL COUNTER INITIALISATIONS
*		---------------------------------

enemy_list	dc.l	197,tank_3
		dc.l	200,heli_8,320,heli_2,380,heli_7
		dc.l	413,tank_1,560,enemyf_2,700,heli_2
		dc.l	1040,heli_4,1100,heli_9
		dc.l	1220,big_chop1,1520,big_enemy1,1635,train_1
		dc.l	1650,heli_3,1782,heli_5,1783,heli_6
		dc.l	1920,heli_8,1965,heli_7
		dc.l	2220,enemyf_1,2265,heli_6,2360,heli_8
		dc.l	2445,plane5,2582,enemyf_2,2692,train_1
		dc.l	2790,heli_2,2865,heli_9,2970,heli_1
		dc.l	3040,heli_11,3120,big_chop2,3200,heli_2
		dc.l	3310,heli_5,3311,heli_6,3380,heli_4
		dc.l	3600,pickup_1,3655,tank_4
		dc.l	3780,heli_12,3800,heli_13,3860,big_chop3
		dc.l	3985,heli_8,4030,heli_1,4115,heli_6
		dc.l	4180,heli_7,4245,big_chop1,4390,heli_12
		dc.l	4440,heli_2,4530,heli_9,4630,enemyf_3
		dc.l	4705,heli_10,4910,heli_8,4957,train_2
		dc.l	5175,big_enemy2,5260,heli_15,5261,heli_16
		dc.l	5262,heli_17,5345,heli_7,5370,heli_18
		dc.l	5450,tank_5,5465,heli_12,5510,heli_19
		dc.l	5511,heli_20,5580,tank_6
		dc.l	5760,heli_8,5870,big_chop4
		dc.l	5930,heli_21,5970,heli_18,6053,train_1
		dc.l	25000,heli_1

enemy1_list	dc.l	180,enemyf_4,200,heli_2
		dc.l	250,tank_3,320,big_chop2,340,heli_20
		dc.l	395,heli_1,445,heli_21,500,heli_17
		dc.l	580,heli_5,581,heli_6,640,heli_4
		dc.l	765,heli_19,780,big_chop5,830,enemyf_5
		dc.l	900,heli_3,975,heli_16,976,heli_17
		dc.l	1080,heli_8,1180,plane1,1240,heli_1
		dc.l	1320,heli_7,1375,heli_18,1420,tank_4
		dc.l	1440,heli_6,1525,heli_13,1550,heli_19
		dc.l	1598,big_chop1,1683,heli_8,1685,tank_7
		dc.l	1722,heli_22,1755,heli_2,1830,heli_10
		dc.l	1872,heli_11,1883,heli_17,1940,heli_23
		dc.l	1941,heli_24,2045,heli_25,2055,heli_19
		dc.l	2110,heli_26,2111,heli_27,2215,heli_4
		dc.l	2300,heli_28,2420,heli_12,2440,heli_13
		dc.l	2563,tank_8,2562,heli_5,2563,heli_6
		dc.l	2670,tank_9,2690,enemyf_5,2691,heli_17
		dc.l	2730,heli_8,2758,tank_3,2830,big_chop1
		dc.l	2915,tank_5,2970,heli_8,3050,heli_26
		dc.l	3055,heli_11,3080,tank_10,3110,heli_29
		dc.l	3122,tank_11,3190,heli_7,3267,plane2
		dc.l	3380,heli_18,3381,heli_11,3450,heli_10
		dc.l	3465,heli_20,3551,heli_26,3575,heli_16
		dc.l	3682,heli_15,3683,heli_16,3684,heli_17
		dc.l	3754,tank_12,3755,heli_25,3810,heli_29
		dc.l	3868,big_chop4,3940,heli_12,3941,heli_13
		dc.l	3955,tank_13,3989,heli_4,4042,heli_9
		dc.l	4150,heli_17,4195,big_chop1,4275,heli_11
		dc.l	4350,heli_19,4410,heli_23,4411,heli_24
		dc.l	4500,tank_9,4510,heli_28,4558,heli_2
		dc.l	4561,tank_14,4562,tank_15,4640,heli_8
		dc.l	4715,heli_12,4716,heli_13,4850,big_enemy3
		dc.l	4937,plane2,5055,heli_26,5056,heli_27
		dc.l	5140,tank_13,5145,big_chop4,5220,heli_8
		dc.l	5262,heli_11,5317,plane1,5410,heli_1
		dc.l	5422,heli_25,5707,plane3
		dc.l	5788,heli_16,5798,heli_17,5850,heli_10
		dc.l	5928,heli_12,5955,heli_20
		dc.l	6005,heli_21,6075,pickup_1
		dc.l	6083,heli_13,6145,heli_11,25000,heli_1

enemy2_list	dc.l	130,heli_17
		dc.l	135,heli_11,200,heli_25,210,heli_24
		dc.l	285,big_chop2,335,heli_1,340,heli_11
		dc.l	410,heli_8,445,heli_16,446,heli_17
		dc.l	510,heli_22,530,heli_12,655,plane2
		dc.l	725,heli_29,775,heli_2,830,heli_16
		dc.l	888,heli_19,889,heli_20,925,heli_6
		dc.l	1000,heli_8,1070,heli_13,1080,heli_12
		dc.l	1135,heli_11,1200,heli_15,1201,heli_16
		dc.l	1202,heli_17,1285,heli_19,1290,heli_7
		dc.l	1350,heli_9,1351,heli_16,1420,heli_4
		dc.l	1450,heli_9,1495,heli_17,1535,heli_8
		dc.l	1605,big_chop6,1615,heli_11,1710,heli_26
		dc.l	1711,heli_27,1735,heli_15,1870,heli_1
		dc.l	1885,heli_7,1945,heli_25,1975,heli_20
		dc.l	2040,heli_23,2041,heli_24,2110,heli_9
		dc.l	2115,heli_11,2120,heli_15,2200,heli_12
		dc.l	2205,heli_16,2350,plane3,2390,heli_20
		dc.l	2410,heli_17,2465,heli_16,2535,heli_11
		dc.l	2545,heli_1,2630,big_chop1,2660,heli_9
		dc.l	2730,heli_8,2795,heli_30,2810,heli_31
		dc.l	2865,heli_8,2930,heli_7,2980,heli_15
		dc.l	2981,heli_16,2982,heli_17,3075,heli_29
		dc.l	3080,heli_11,3176,heli_8,3267,plane4
		dc.l	3374,heli_23,3380,heli_9,3470,heli_15
		dc.l	3485,heli_12,3500,heli_13,3620,heli_19
		dc.l	3630,heli_16,3660,big_chop2,3705,heli_31
		dc.l	3760,heli_3,3782,heli_17,3865,heli_9
		dc.l	3910,heli_8,3935,heli_27,4010,heli_9
		dc.l	4080,plane3,4175,heli_23,4176,heli_24
		dc.l	4235,heli_10,4245,heli_16,4305,heli_7
		dc.l	4320,heli_12,4325,heli_15,4380,heli_30
		dc.l	4430,heli_20,4440,heli_17,4488,heli_11
		dc.l	4540,heli_10,4570,heli_31,4635,heli_23
		dc.l	4670,heli_24,4690,heli_12,4705,heli_32
		dc.l	4715,heli_9,4825,heli_9,4835,heli_24
		dc.l	4900,heli_9,4915,heli_15,4920,heli_20
		dc.l	4980,plane2,5070,heli_21,5095,heli_17
		dc.l	5160,heli_9,5220,heli_19,5280,heli_15
		dc.l	5310,heli_16,5330,heli_12,5345,heli_11
		dc.l	5435,heli_7,5440,heli_26,5490,heli_16
		dc.l	5510,big_chop1,5530,heli_19,5630,heli_9
		dc.l	5856,big_enemy4,5945,heli_9
		dc.l	5946,heli_11,5947,heli_15,25000,heli_1

enemy3_list	dc.l	165,heli_16,166,heli_17
		dc.l	210,heli_12,275,big_chop2,295,heli_11
		dc.l	340,tank_12,345,heli_31,380,heli_19
		dc.l	430,plane1,480,big_chop1,495,heli_9
		dc.l	540,heli_11,600,heli_23,601,heli_24
		dc.l	604,train_2,685,heli_15,725,heli_30
		dc.l	730,heli_25,775,heli_2,830,heli_16
		dc.l	888,heli_19,889,heli_20,925,heli_6
		dc.l	1000,heli_8,1070,heli_13,1080,heli_12
		dc.l	1135,heli_11,1200,heli_15,1201,heli_16
		dc.l	1202,heli_17,1285,heli_19,1290,heli_7
		dc.l	1350,heli_9,1351,heli_16,1420,heli_4
		dc.l	1437,train_3,1445,tank_3,1520,heli_9
		dc.l	1570,tank_4,1608,tank_13,1630,heli_9
		dc.l	1635,heli_11,1683,heli_8,1685,tank_5
		dc.l	1715,tank_13,1722,heli_22,1755,heli_2
		dc.l	1830,heli_10,1872,heli_11,1883,heli_17
		dc.l	1940,heli_23,1941,heli_24,2045,heli_25
		dc.l	2055,heli_19,2110,heli_26,2111,heli_27
		dc.l	2215,heli_4,2300,heli_28,2420,heli_12
		dc.l	2435,tank_3,2440,heli_13,2525,plane5
		dc.l	2600,heli_17,2630,big_chop1,2660,heli_9
		dc.l	2730,heli_8,2795,heli_30,2810,heli_31
		dc.l	2865,heli_8,2930,heli_7,2980,heli_15
		dc.l	2981,heli_16,2982,heli_17,3075,heli_29
		dc.l	3080,heli_11,3105,tank_3,3160,heli_22
		dc.l	3193,heli_2,3268,heli_10,3310,heli_11
		dc.l	3321,heli_17,3378,heli_23,3379,heli_24
		dc.l	3483,heli_25,3493,heli_19,3548,heli_26
		dc.l	3549,heli_27,3653,heli_4,3738,heli_28
		dc.l	3840,heli_11,3858,heli_12,3878,heli_13
		dc.l	3955,heli_16,3956,heli_17,4017,heli_10
		dc.l	4027,heli_11,4095,heli_12,4122,heli_20
		dc.l	4172,heli_21,4192,heli_19,4242,heli_17
		dc.l	4250,heli_13,4312,heli_11,4355,train_1
		dc.l	4425,plane2,4500,heli_25,4545,heli_2
		dc.l	4600,heli_16,4650,heli_19,4651,heli_20
		dc.l	4725,big_enemy5,4795,tank_6
		dc.l	4896,tank_9,4820,heli_17,4875,heli_16
		dc.l	4945,heli_11,4955,heli_1,5040,big_chop1
		dc.l	5070,heli_9,5140,heli_8,5205,heli_30
		dc.l	5220,heli_31,5266,heli_8,5340,heli_7
		dc.l	5390,heli_15,5391,heli_16,5392,heli_17
		dc.l	5485,heli_29,5490,heli_11,5586,heli_8
		dc.l	5660,heli_23,5666,heli_9,5756,heli_15
		dc.l	5771,heli_12,5786,heli_13,5906,heli_19
		dc.l	5916,heli_16,5946,big_chop2,5991,heli_31
		dc.l	6046,heli_3,6068,heli_17,6151,heli_9
		dc.l	25000,heli_1

enemy_list_demo	dc.l	200,heli_10
		dc.l	500,heli_1
		dc.l	25000,heli_1


enemyf_1		dc.l	enemyf_setup	Formation sprites
		dc.w	64,-45
		dc.l	enemyf_seq1
enemyf_2		dc.l	enemyf_setup
		dc.w	-30,64
		dc.l	enemyf_seq2
enemyf_3		dc.l	enemyf_setup
		dc.w	-30,10
		dc.l	enemyf_seq3
enemyf_4		dc.l	enemyf_setup
		dc.w	224,-45
		dc.l	enemyf_seq4
enemyf_5		dc.l	enemyf_setup
		dc.w	320,32
		dc.l	enemyf_seq5


pickup_1		dc.l	init_pickup_el
		dc.w	50,-20

tank_1		dc.l	tank_setup
		dc.w	-25,45
		dc.l	t_seq1,tank_frames
tank_2		dc.l	tank_setup
		dc.w	320,10
		dc.l	t_seq2,tank_frames
tank_3		dc.l	tank_setup
		dc.w	320,5
		dc.l	off_left,tank_frames
tank_4		dc.l	tank_setup
		dc.w	-25,5
		dc.l	t_seq3,tank_frames
tank_5		dc.l	tank_setup
		dc.w	320,5
		dc.l	t_seq4,tank_frames
tank_6		dc.l	tank_setup
		dc.w	-25,43
		dc.l	t_seq5,tank_frames
tank_7		dc.l	tank_setup
		dc.w	224,-30
		dc.l	seq13,tank_frames
tank_8		dc.l	tank_setup
		dc.w	-25,5
		dc.l	t_seq6,tank_frames
tank_9		dc.l	tank_setup
		dc.w	224,-30
		dc.l	off_down,tank_frames
tank_10		dc.l	tank_setup
		dc.w	320,5
		dc.l	t_seq7,tank_frames
tank_11		dc.l	tank_setup
		dc.w	95,-30
		dc.l	t_seq8,tank_frames
tank_12		dc.l	tank_setup
		dc.w	35,-30
		dc.l	off_down,tank_frames
tank_13		dc.l	tank_setup
		dc.w	128,-30
		dc.l	off_down,tank_frames
tank_14		dc.l	tank_setup
		dc.w	66,-30
		dc.l	t_seq9,tank_frames
tank_15		dc.l	tank_setup
		dc.w	160,-30
		dc.l	t_seq9,tank_frames
heli_1		dc.l	enemy_init
		dc.w	40,-30
		dc.l	seq1,2
heli_2		dc.l	enemy_init
		dc.w	240,-30
		dc.l	seq2,2
heli_3		dc.l	enemy_init
		dc.w	128,-45
		dc.l	seq3,2
heli_4		dc.l	enemy_init
		dc.w	320,0
		dc.l	seq4,2
heli_5		dc.l	enemy_init
		dc.w	96,-45
		dc.l	off_down,2
heli_6		dc.l	enemy_init
		dc.w	192,-45
		dc.l	off_down,2
heli_7		dc.l	enemy_init
		dc.w	224,-45
		dc.l	seq6,2
heli_8		dc.l	enemy_init
		dc.w	320,32
		dc.l	fast_left,2
heli_9		dc.l	enemy_init
		dc.w	64,-45
		dc.l	fast_down,2
heli_10		dc.l	enemy_init
		dc.w	-30,20
		dc.l	seq5,2
heli_11		dc.l	enemy_init
		dc.w	228,-45
		dc.l	fast_down,2
heli_12		dc.l	enemy_init
		dc.w	32,-45
		dc.l	seq7,2
heli_13		dc.l	enemy_init
		dc.w	256,-45
		dc.l	seq8,2
heli_14		dc.l	enemy_init
		dc.w	-30,10
		dc.l	seq5,1
heli_15		dc.l	enemy_init
		dc.w	144,-45
		dc.l	off_down,1
heli_16		dc.l	enemy_init
		dc.w	144,-43
		dc.l	seq9,1
heli_17		dc.l	enemy_init
		dc.w	144,-41
		dc.l	seq10,1
heli_18		dc.l	enemy_init
		dc.w	-30,64
		dc.l	fast_right,2
heli_19		dc.l	enemy_init
		dc.w	-30,32
		dc.l	seq11,2
heli_20		dc.l	enemy_init
		dc.w	320,34
		dc.l	seq12,2
heli_21		dc.l	enemy_init
		dc.w	320,10
		dc.l	t_seq2,1
heli_22		dc.l	enemy_init
		dc.w	32,-45
		dc.l	seq9,1
heli_23		dc.l	enemy_init
		dc.w	0,-45
		dc.l	seq14,1
heli_24		dc.l	enemy_init
		dc.w	288,-45
		dc.l	seq15,1
heli_25		dc.l	enemy_init
		dc.w	192,-45
		dc.l	seq13,1
heli_26		dc.l	enemy_init
		dc.w	-32,30
		dc.l	seq16,2
heli_27		dc.l	enemy_init
		dc.w	320,30
		dc.l	seq17,2
heli_28		dc.l	enemy_init
		dc.w	-32,30
		dc.l	t_seq5,1
heli_29		dc.l	enemy_init
		dc.w	-32,5
		dc.l	t_seq3,1
heli_30		dc.l	enemy_init
		dc.w	64,-45
		dc.l	seq18,2
heli_31		dc.l	enemy_init
		dc.w	224,-45
		dc.l	seq19,1
heli_32		dc.l	enemy_init
		dc.w	256,-45
		dc.l	seq21,2
big_chop1	dc.l	big_chop_setup
		dc.w	128,-58
		dc.w	8		no. of hits
		dc.l	seq3,big_chop_frames
big_chop2	dc.l	big_chop_setup
		dc.w	-56,5
		dc.w	8
		dc.l	seq5,big_chop_frames
big_chop3	dc.l	big_chop_setup
		dc.w	320,5
		dc.w	10
		dc.l	t_seq2,big_chop_frames
big_chop4	dc.l	big_chop_setup
		dc.w	224,-45
		dc.w	12
		dc.l	seq6,big_chop_frames
big_chop5	dc.l	big_chop_setup
		dc.w	-56,192
		dc.w	14
		dc.l	seq13,big_chop_frames
big_chop6	dc.l	big_chop_setup
		dc.w	-56,30
		dc.w	17
		dc.l	t_seq5,big_chop_frames
plane1		dc.l	plane_setup
		dc.w	96,-36,144,-46,192,-46,240,-36
		dc.l	off_down,plane
		dc.w	3	smart
plane2		dc.l	plane_setup
		dc.w	96,-36,144,-46,192,-46,240,-36
		dc.l	off_down,plane
		dc.w	4	droid
plane3		dc.l	plane_setup
		dc.w	96,-36,144,-46,192,-46,240,-36
		dc.l	off_down,plane
		dc.w	1	rockets
plane4		dc.l	plane_setup
		dc.w	96,-36,144,-46,192,-46,240,-36
		dc.l	seq20,plane
		dc.w	4	droid
plane5		dc.l	plane_setup
		dc.w	96,-36,144,-46,192,-46,240,-36
		dc.l	seq20,plane
		dc.w	2	guided
train_1		dc.l	train_setup
		dc.w	-40,40
		dc.l	train_seq
		dc.b	0,1,0,2,3,200
train_2		dc.l	train_setup
		dc.w	-40,32
		dc.l	train_seq
		dc.b	3,0,2,1,3,200
train_3		dc.l	train_setup
		dc.w	-40,32
		dc.l	train_seq
		dc.b	1,0,3,2,0,200
big_enemy1	dc.l	big_enemy_setup
		dc.w	128,-72
		dc.w	20		no. of hits
		dc.l	big_enemy_list1
		dc.w	2,1,1,1,0,1,-1,1,-2,1	bull dis.
		dc.b	60,0	cycles before firing
big_enemy2	dc.l	big_enemy_setup
		dc.w	128,-72
		dc.w	35
		dc.l	big_enemy_list1
		dc.w	2,1,1,1,0,1,-1,1,-2,1
		dc.b	40,0
big_enemy3	dc.l	big_enemy_setup
		dc.w	128,-72
		dc.w	40
		dc.l	big_enemy_seq2
		dc.w	2,1,1,1,0,1,-1,1,-2,1
		dc.b	35,0
big_enemy4	dc.l	big_enemy_setup
		dc.w	128,-72
		dc.w	60
		dc.l	big_enemy_seq1
		dc.w	2,2,1,2,0,2,-1,2,-2,2
		dc.b	75,0
big_enemy5	dc.l	big_enemy_setup
		dc.w	128,-72
		dc.w	75
		dc.l	big_enemy_seq3
		dc.w	5,3,3,3,0,3,-3,3,-5,3
		dc.b	60,0

enemyf_seq1	dc.b	0,4,99,90,0,4,99,90,0,4,99,90,0,4,99,90
		dc.w	x_end
enemyf_seq2	dc.b	2,0,99,90,2,0,99,90,2,0,99,90,2,0,99,90
		dc.w	x_end
enemyf_seq3	dc.b	2,0,99,45,2,-2,99,15,2,0,99,15,2,2,99,13
		dc.b	-2,2,99,17,0,2,99,90,0,2,99,90,0,2,99,90
		dc.w	x_end
enemyf_seq4	dc.b	0,2,99,25,-2,2,99,25,0,2,99,90,0,2,99,90
		dc.b	0,2,99,90
		dc.w	x_end
enemyf_seq5	dc.b	-2,0,99,90,-2,0,99,90,-2,0,99,90,-2,0,99,90
		dc.w	x_end

seq1	dc.b	0,2,99,35,2,2,99,6,2,0,99,16,2,-2,99,31
	dc.b	2,0,99,17,2,2,99,6,2,0
	dc.w	$ff
	dc.l	off_right
seq2	dc.b	0,2,99,33,-2,2,99,9,-2,0,99,17,-2,-2,99,11
	dc.b	0,-2,99,11,-2,-2,99,11,-2,0
	dc.w	$ff
	dc.l	off_left
seq3	dc.b	0,2,99,36,4,4,99,4,4,0,99,6,4,-4,99,9,0,-4,99,6
	dc.b	-4,-4,99,7,-4,0,99,26,-4,4,99,7,0,4,99,6,4,4,99,9
	dc.b	4,0,99,6,4,-4,99,4,0,-4,99,11,4,0,99,7,2,0
	dc.w	$ff
	dc.l	off_right
seq4	dc.b	-2,0,99,35,-2,-2,99,11,-2,0,99,7,-2,2,99,4,0,2,99,5
	dc.b	2,2,99,3,2,0,99,6,2,-2,99,4,0,-2,99,3,-2,-2,99,4
	dc.b	-2,0,99,55,-2,2,99,4,0,2,99,5,2,2,99,5,2,0,99,6
	dc.b	2,-2,99,5,0,-2,99,4,-2,-2,99,6,-2,0
	dc.w	$ff
	dc.l	off_left
seq5	dc.b	2,0,99,45,2,-2,99,15,2,0,99,15,2,2,99,13
	dc.b	-2,2,99,17,0,2
	dc.w	$ff
	dc.l	off_down
seq6	dc.b	0,2,99,25,-2,2,99,25,0,2
	dc.w	$ff
	dc.l	off_down
seq7	dc.b	0,4,99,35,4,4,4,0,4,-4,99,90
	dc.w	x_end
seq8	dc.b	0,4,99,35,-4,4,-4,0,-4,-4,99,90
	dc.w	x_end
seq9	dc.b	0,2,99,10,2,2,99,98,2,2,99,98
	dc.w	x_end
seq10	dc.b	0,2,99,10,-2,2,99,98,-2,2,99,98
	dc.w	x_end
seq11	dc.b	2,0,99,45,2,2,0,2
	dc.w	$ff
	dc.l	off_down
seq12	dc.b	-2,0,99,45,-2,2,0,2
	dc.w	$ff
	dc.l	off_down
seq13	dc.b	0,2,99,44,-2,2,99,2,-2,0,-2,-2,99,27,-2,0,99,18,-2,2
	dc.b	99,2,0,2,99,7,0,2
	dc.w	$ff
	dc.l	off_down
seq14	dc.b	0,2,99,15,2,1,99,60,-2,1,99,30,0,2
	dc.w	$ff
	dc.l	off_down
seq15	dc.b	0,2,99,15,-2,1,99,60,2,1,99,30,0,2
	dc.w	$ff
	dc.l	off_down
seq16	dc.b	2,0,99,47,2,2,99,9,0,2,99,9,-2,2,99,8,-2,0,-2,-2
	dc.b	99,7,0,-2,99,9,2,-2,99,9,2,0,99,15,2,2,99,2,0,2
	dc.w	$ff
	dc.l	off_down
seq17	dc.b	-2,0,99,47,-2,2,99,9,0,2,99,9,2,2,99,8,2,0,2,-2
	dc.b	99,7,0,-2,99,9,-2,-2,99,9,-2,0,99,15,-2,2,99,2,0,2
	dc.w	$ff
	dc.l	off_down
seq18	dc.b	0,2,99,15,2,2,99,20,0,2
	dc.w	$ff
	dc.l	off_down
seq19	dc.b	0,2,99,15,-2,2,99,20,0,2
	dc.w	$ff
	dc.l	off_down
seq20	dc.b	0,2,99,12,-2,2,99,15
seq20_1	dc.b	2,2,99,30
	dc.b	-2,2,99,29,-2,2
	dc.w	$ff
	dc.l	seq20_1
seq21	dc.b	0,4,99,35,-4,4,-4,0,-4,-4,99,20,0,4
	dc.w	$ff
	dc.l	fast_down

t_seq1	dc.b	2,0,99,60,2,-2,99,25,2,0,99,19,2,-2,99,11
	dc.b	0,-2,99,14,-2,-2,99,8,-2,0,99,8,-2,2,99,7
	dc.b	0,2,99,10,2,2,99,6,2,0
	dc.w	$ff
	dc.l	off_right
t_seq2	dc.b	-2,0,99,55,2,-2,99,10,0,-2,99,8,-2,-2,99,9
	dc.b	-2,0,99,11,-2,2,99,8,0,2,99,9,2,2,99,10
	dc.b	-2,0,99,26,-2,2,99,8,0,2
	dc.w	$ff
	dc.l	off_down
t_seq3	dc.b	2,0,99,55,2,2,99,20,0,2
	dc.w	$ff
	dc.l	off_down
t_seq4	dc.b	-2,0,99,56,-2,-2,99,15,0,-2,2,-2,2,0,99,12,2,0
	dc.w	$ff
	dc.l	off_right
t_seq5	dc.b	2,0,99,56,2,-2,99,16,0,-2,99,10,-2,-2,99,8
	dc.b	-2,0,99,5,-2,2,99,8,0,2
	dc.w	$ff
	dc.l	off_down
t_seq6	dc.b	2,0,99,98,2,0,99,24,2,2,99,20,2,0
	dc.w	$ff
	dc.l	off_right
t_seq7	dc.b	-2,0,99,80,0,2
	dc.w	$ff
	dc.l	off_down
t_seq8	dc.b	0,2,99,40,2,0,99,31,0,2
	dc.w	$ff
	dc.l	off_down
t_seq9	dc.b	0,2,99,23,2,0
	dc.w	$ff
	dc.l	off_right

off_right	dc.b	2,0
		dc.w	$ff
		dc.l	off_right
off_down		dc.b	0,2
		dc.w	$ff
		dc.l	off_down
off_left		dc.b	-2,0
		dc.w	$ff
		dc.l	off_left
off_up		dc.b	0,-2
		dc.w	$ff
		dc.l	off_up
fast_left	dc.b	-4,0
		dc.w	$ff
		dc.l	fast_left
fast_down	dc.b	0,4
		dc.w	$ff
		dc.l	fast_down
fast_right	dc.b	4,0
		dc.w	$ff
		dc.l	fast_right


*		--------------------------
*		  BULLET FLASH ON ENEMYS
*		--------------------------

bull_flash_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_off,0,x_off,0,x_end
bull_flash_frn	ds.b	6
bull_flash_pause	ds.b	6


*		---------------------
*		  ENEMY HEILCOPTERS
*		---------------------

enemy_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_end
enemy_seq_vectors	ds.l	4
enemy_frame_bases	ds.l	4
enemy_hits	ds.b	4
enemy_frames	ds.b	4
enemy_seq_rept	ds.b	4
enemys_frame_dis	dc.w	0,270,2*270,3*270,4*270,5*270,6*270,7*270
enemy_dis	dc.w	0,8640,17280,25920


*		--------------------
*		  ENEMY FORMATIONS
*		--------------------


enemyf_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_off,0,x_end
enemyf_seq_vectors		ds.l	6
enemyf_frame_numbers	ds.b	6
enemyf_pause	ds.b	6
enemyf_hits	ds.b	6
enemyf_seq_rept	ds.b	6

*		Formation vectors

form_vec		ds.b	18
		dc.b	$ff
form_add		ds.l	1
form1_vec	ds.b	36
		dc.b	$ff
form1_add	ds.l	1
form2_vec	ds.b	54
		dc.b	$ff
form2_add	ds.l	1
form3_vec	ds.b	72
		dc.b	$ff
form3_add	ds.l	1
form4_vec	ds.b	90
		dc.b	$ff
form4_add	ds.l	1



*		----------------
*		   SMALL TANK
*		----------------

tank_frames	dc.l	tank
tank_bull_dis	dc.w	0,-6,6,-6,6,0,6,6,0,6,-6,6,-6,0,-6,-6
tank_xy_bull_dis	dc.w	1,-5,16,0,26,12,16,13,13,24,1,17,-5,10,0,0
tank_xys		dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_end
tank_seq_vectors	ds.l	4
tank_frame_bases	ds.l	4
tank_frame_numbers	ds.b	4
tank_seq_rept	ds.b	4
tank_frame_toggle	ds.b	1
		even

big_chop_frames	dc.l	0,1740,2*1740,3*1740,4*1740,5*1740,6*1740,7*1740
		dc.l	8*1740,9*1740,10*1740,11*1740,12*1740,13*1740,14*1740,15*1740
big_chop_bull_dis	dc.w	0,-6,6,-6,6,0,6,6,0,6,-6,6,-6,0,-6,-6
big_chop_xys	dc.w	x_off,0,x_end
big_chop_seq_vectors	ds.l	1
big_chop_frame_bases	ds.l	1
big_chop_hits		ds.w	1
big_chop_frame_numbers	ds.b	1
big_chop_frame_toggle	ds.b	1
big_chop_seq_rept		ds.b	2

*		----------------------
*		   PLANE FORMATIONS
*		----------------------

plane_pal_list	dc.b	34,35,36,37
plane_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0,x_end
plane_seq_vectors	ds.l	5
plane_frame_bases	ds.l	1
plane_seq_rept	ds.b	6
plane_pickup	dc.w	0
plane_8		dc.w	0,912,2*912,3*912,4*912,5*912,6*912,7*912
splane_8		dc.w	0,228,2*228,3*228,4*228,5*228,6*228,7*228
formation_flag	ds.b	1


*		---------------
*		  TRAIN ENEMY
*		---------------

tform_vec	ds.w	8
		dc.w	$ff
tform_add	ds.l	1
tform1_vec	ds.w	16
		dc.w	$ff
tform1_add	ds.l	1
tform2_vec	ds.w	24
		dc.w	$ff
tform2_add	ds.l	1
tform3_vec	ds.w	30
		dc.w	$ff
tform3_add	ds.l	1
tform4_vec	ds.w	36
		dc.w	$ff
tform4_add	ds.l	1

train_switch_off	dc.l	0	what cycle count to switck off train
train_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0,x_end
train_seq_vectors	ds.l	5
train_frames	ds.b	5
train_gun_dir	dc.w	0,0,-4,-4,-4,0,-4,4
train_gun_pos	dc.w	0,0,1,-4,-7,5,-3,16
train_frame_bases	dc.l	train,train+4224,train+8448,train+12672
train_8		dc.w	0,528,2*528,3*528,4*528,5*528,6*528,7*528

train_seq	dc.w	4,$ff
		dc.l	train_seq

still_train	dc.w	0,$ff		**** don't remove
		dc.l	still_train


*		-----------
*		 BIG ENEMY
*		-----------

big_enemy_xys	dc.w	x_off,0,x_off,0,x_end
big_enemy_frn	dc.b	0,0
big_enemy_hits	dc.w	0,0
big_e_cycle_bull	dc.b	0,0		when to trigger bullets
big_e_bull_dis	dc.w	0,1,0,1,0,1,0,1,0,1
		dc.w	0,1,0,1,0,1,0,1,0,1
big_enemy_pointer	dc.l	big_enemy_list1,big_enemy_list1
big_enemy_grfx	dc.l	0,1
big_e_cycle_count	dc.b	0,0	cycle counter for bullet trigger
big_enemy_explode	dc.b	0,0
big_e_expl_point	dc.l	big_e_explo_pause,big_e_explo_pause1
big_e_expl_dis_point	dc.l	big_e_explo_dis,big_e_explo_dis
big_e_explo_dis	dc.w	5,5,20,20,5,40,45,50,15,8,45,20,30,50
big_e_explo_pause	dc.b	6,5,4,4,5,3,2,255
big_e_explo_pause1	dc.b	6,5,4,4,5,3,2,255
big_e_explo_delay	dc.b	6,5,4,4,5,3,2,255
big_enemy_on	dc.b	0
big_enemy_list1	dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
big_enemy_l1_rep	dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2
		dc.w	$ff
		dc.l	big_enemy_l1_rep


big_enemy_seq1	dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2

big_enemy_seq1_1	dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,2,2,2,2,2
		dc.w	2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2
		dc.w	-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2
		dc.w	-2,-2,-2,-2,-2,-2,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2
		dc.w	-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,0,-2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,2,-2,2,-2,2,-2
		dc.w	2,-2,2,-2,2,-2,2,-2,2,-2,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,$ff
		dc.l	big_enemy_seq1_1


big_enemy_seq2	dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2

big_enemy_seq2_1	dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,2,2,2,2,2
		dc.w	2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
		dc.w	2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,-2,2,-2,2,-2,2
		dc.w	-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2
		dc.w	-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2
		dc.w	-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2
		dc.w	-2,-2,-2,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,2,-2
		dc.w	2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,-2
		dc.w	2,-2,2,-2,2,-2,2,-2,2,-2,2,-2,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,$ff
		dc.l	big_enemy_seq2_1

big_enemy_seq3	dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2

big_enemy_seq3_1	dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,2,-2,2,-2,2,-2,2,-2,2
		dc.w	-2,2,-2,2,-2,2,-2,2,-2,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
		dc.w	0,2,0,2,0,2,0,2,0,2,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,0,-2,0,-2,0,-2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,-2,-2,-2,-2,-2,-2,-2,-2
		dc.w	-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,0,-2,0,-2,0,-2,0
		dc.w	-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,0,-2,0,-2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2,0,-2
		dc.w	0,-2,0,-2,0,-2,0,-2,0,-2,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0
		dc.w	2,0,2,0,2,0,2,0,2,0,2,0,$ff
		dc.l	big_enemy_seq3_1



*		-----------
*		  HEAD UP
*		-----------

head_up_flag	dc.b	0
char_save	ds.b	12
score		dc.l	70000
choppers		dc.w	9
fuel		dc.w	999
distance		dc.l	6400
pilot		dc.b	1
point_txt	dc.b	0,0,0,0,0,0,11
distance_txt	dc.b	0,0,0,0,0,0,11
lives_txt	dc.b	0,0,11
fuels_txt	dc.b	0,0,0,11
missile_txt	dc.b	0,0,0,11
guided_m_txt	dc.b	0,0,11

*		------------
*		   PICKUP
*		------------

pickup_xys	dc.w	x_off,0,x_off,0,x_end
pickup_type	ds.b	2
pickup_shadow	ds.w	2
shadow_data	ds.l	1
icon_data	dc.l	0,1,2,3,4,4,4,5
icon_xy		dc.w	x_off,0
icon_type	ds.b	1
icon_8		dc.w	0,256,2*256,3*256,4*256,5*256,6*256,7*256
* fuel,missile,guided missle,smart bomb,power-up

smart_off_list	dc.l	enemy_xys,enemyf_xys,tank_xys,big_chop_xys
		dc.l	plane_xys,train_xys,big_enemy_xys
		dc.l	end_list

*		--------------------
*		    GEN_ENEMY_BULL
*		--------------------

gen_bull_xys	dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0
		dc.w	x_off,0,x_off,0,x_off,0,x_off,0,x_off,0,x_end
gen_bull_dis	ds.w	30
gen_bull_grfx	ds.l	15
from_x		ds.w	1
from_y		ds.w	1
to_x		ds.w	1
to_y		ds.w	1
dis_x		ds.w	1
dis_y		ds.w	1

*	        -----------------
*		Rotate frames
*	        -----------------

source		ds.l	1
object		ds.l	1
copys		ds.w	1
frame_dis	ds.w	1
spheight		ds.w	1				
frame2		ds.l	1

*		--------------------
*		 Enemy xys turn off
*		--------------------

enemy_off	dc.l	explo24_xys,explo40_xys,guided_xys,p_bull_xys
		dc.l	rocket_xys,enemy_xys,enemyf_xys
		dc.l	tank_xys,big_chop_xys,plane_xys
		dc.l	train_xys,big_enemy_xys,pickup_xys,gen_bull_xys
		dc.l	end_list

enemy_off1	dc.l	enemy_xys,enemyf_xys
		dc.l	tank_xys,big_chop_xys,plane_xys
		dc.l	train_xys,big_enemy_xys,gen_bull_xys
		dc.l	end_list

*		-----------------------
*		 Enemy limit addresses
*		-----------------------

enemy_limit_list	dc.l	enemy_xys,enemyf_xys,tank_xys
		dc.l	big_chop_xys,plane_xys,end_list

present_title	dc.b	'PRESENTS',0
apache_title	dc.b	'APACHE FLIGHT',0
by_title		dc.b	'BY',0
martin_title	dc.b	'MARTIN.J.BYSH',0
minds_i_title	dc.b	'MINDS I',0
graphic_title	dc.b	'GRAPHICS',0
m_wheel_title	dc.b	'MARTIN WHEELER',0
game_over_txt	dc.b	'GAME',0
game_over_txt1	dc.b	'OVER',0
load_level2	dc.b	'LOADING LEVEL 2',0
load_level3	dc.b	'LOADING LEVEL 3',0
load_level4	dc.b	'LOADING LEVEL 4',0
congrat_title	dc.b	'  WELL DONE YOU',0
defeat_title	dc.b	' HAVE KILLED ALL',0
enemy_title	dc.b	'   ENEMY FORCES',0
failed_title	dc.b	'  YOU HAVE FAILED',0
defeat1_title	dc.b	'   TO DEFEAT THE',0
end_title	dc.b	'    THE END',0
pause_txt	dc.b	'     PAUSE',0
get_ready_title	dc.b	'GET READY',0
		even

pbuf		ds.b	512

*********************************************************************************
*			 Palletes				    *
*********************************************************************************

pal_1		dc.w	$034,$353,$570,$777,$000,$555,$444,$040
		dc.w	$653,$540,$500,$005,$666,$700,$760,$046

pal_1_1		dc.w	$034,$353,$570,$777,$000,$555,$444,$340
		dc.w	$632,$540,$500,$005,$666,$700,$760,$046
pal_1_2		dc.w	$034,$653,$670,$777,$000,$555,$444,$540
		dc.w	$700,$760,$500,$005,$666,$700,$760,$046

pal_1_1smart	dc.w	$034,$353,$570,$777,$000,$555,$444,$444
		dc.w	$654,$544,$544,$445,$666,$744,$764,$556
pal_1_2smart	dc.w	$034,$353,$570,$777,$000,$555,$444,$666
		dc.w	$666,$565,$555,$555,$666,$766,$766,$666


swamp_pal	dc.w	$000,$353,$570,$777,$000,$555,$444,$040
		dc.w	$653,$440,$500,$330,$664,$700,$760,$044

pal_2_1		dc.w	$000,$453,$530,$777,$000,$555,$444,$440
		dc.w	$643,$420,$500,$330,$664,$700,$760,$044
pal_2_2		dc.w	$000,$653,$730,$777,$000,$555,$444,$640
		dc.w	$731,$640,$500,$330,$664,$700,$760,$044

pal_2_1smart	dc.w	$000,$353,$570,$777,$000,$555,$444,$444
		dc.w	$654,$444,$544,$444,$665,$744,$765,$544
pal_2_2smart	dc.w	$000,$353,$570,$777,$000,$555,$444,$666
		dc.w	$666,$555,$555,$666,$666,$766,$766,$666


level_3_pal	dc.w	$300,$353,$570,$777,$000,$555,$444,$040
		dc.w	$543,$430,$500,$330,$642,$700,$760,$554

pal_3_1		dc.w	$300,$353,$570,$777,$000,$655,$522,$040
		dc.w	$543,$630,$500,$433,$642,$700,$760,$554
pal_3_2		dc.w	$300,$353,$570,$777,$000,$755,$721,$040
		dc.w	$543,$720,$500,$710,$642,$700,$760,$554

pal_3_1smart	dc.w	$300,$353,$570,$777,$000,$555,$444,$444
		dc.w	$544,$544,$555,$444,$655,$744,$764,$555
pal_3_2smart	dc.w	$300,$353,$570,$777,$000,$555,$444,$666
		dc.w	$666,$555,$555,$666,$666,$766,$766,$666

hi_score_pal	dc.w	$000,$353,$570,$777,$000,$555,$444,$040
		dc.w	$653,$440,$500,$330,$542,$770,$330,$004

high_entry_pal	dc.w	$000,$643,$444,$777,$555,$433,$322,$422
		dc.w	$452,$104,$037,$430,$320,$422,$443,$762

front_end_pal	dc.w	$000,$643,$444,$777,$555,$433,$000,$422
		dc.w	$452,$104,$037,$430,$320,$422,$443,$762

apache_pal	dc.w	$000,$222,$222,$232,$223,$333,$333,$334
		dc.w	$443,$444,$344,$455,$455,$555,$556,$777

clear_pal	ds.w	16

*********************************************************************************
*		Maps
*********************************************************************************

* chip sprites

main		ds.l	1
main1		ds.l	1
main2		ds.l	1
main3		ds.l	1
chopper1		ds.l	1
chopper2		ds.l	1
plane		ds.l	1
big_chopper	ds.l	1
train		ds.l	1
tank		ds.l	1
sprite1_80x70	ds.l	1
bullet		ds.l	1
explosion	ds.l	1
pick_dr		ds.l	1
hi_pickup_data	ds.l	1
pointers_data	ds.l	1
bull_flash_data	ds.l	1

* clear memory

pre_map		ds.l	1
map_end		ds.l	1

packed_map	ds.l	1
train_buff	ds.l	1

score_data	ds.l	1
schop		ds.l	1
missile_display	ds.l	1

gun_dig		ds.l	1
explo_dig	ds.l	1
gunhit_dig	ds.l	1
pickup_dig	ds.l	1
quick_explo_dig	ds.l	1
rapidgun_dig	ds.l	1
missile_dig	ds.l	1
clear_dig	ds.l	1

high_entry_pre	ds.l	1
high_entry_tab	ds.l	1
high_entry	ds.l	1
high_characters	ds.l	1
high_space	ds.l	1

choice_scr_packed	ds.l	1

scroll_data	ds.l	1
main_choice_pal	ds.l	1
main_choice_screen	ds.l	1
