ùúùú  &  ö  C×  <ñ  6Ñ  "  (â  (â  (â  (â;code by Mr. Acryl of Anadune

;start	=	0

width_cone	equ	320
height_cone	equ	96
zoom_data_cone	equ	128
width_1x2	equ	320
height_1x2	equ	96
plsiz		equ	(width_1x2/8)*height_1x2
x_rot_centre	equ	width_1x2/2
y_rot_centre	equ	height_1x2/2
x_speed		equ	1
y_speed		equ	2
z_speed		equ	1
xmin		equ	000
xmax		equ	width_1x2-1
ymin		equ	000
ymax		equ	height_1x2-1
zoom_data	equ	512
maxz		equ	1024+512+512*5

x_rot_centre_h8	equ	160/2
y_rot_centre_h8	equ	96/2
xmin_h8		equ	000
xmax_h8		equ	640-1
ymin_h8		equ	000
ymax_h8		equ	96-1
zoom_data_h8	equ	128
maxz_h8		equ	1024+512+512*5

x_rot_centre_h8_blur	equ	160/2
y_rot_centre_h8_blur	equ	96/2
xmin_h8_blur		equ	000
xmax_h8_blur		equ	640-1
ymin_h8_blur		equ	000
ymax_h8_blur		equ	96-1
zoom_data_h8_blur	equ	128
maxz_h8_blur		equ	1024+512+512*5

OpenDevice		=	-444
CloseDevice		=	-450
FindTask		=	-294
OldOpenLibrary		=	-408
OpenLibrary		=	-552
CloseLibrary		=	-414
Open			=	-030
Close			=	-036
Write			=	-048
Read			=	-042

	incdir		include:
	include		rejestry.s

		section main_code,code_f
	
	move.l	$4.w,a6
	lea	GfxName,a1
	moveq	#0,d0
	jsr	OldOpenLibrary(a6)
	move.l	d0,a6			; Use Base-pointer
	move.l	34(a6),moni_pom		; Old view
	move.l	a6,moni_pom1

	sub.l	a1,a1
	jsr	-$de(a6)		; LoadView
	jsr	-$10e(a6)		; WaitTOF
	jsr	-$10e(a6)		; WaitTOF

	move.l	$4.w,a6
	lea	set_cache,a5
	jmp	-30(a6)
set_cache
	move.b	$129(a6),d0
	and.b	#%00001110,d0

	movec	cacr,d0
	move.l	d0,cacrs
	movec	vbr,d0
	move.l	d0,vbrs
	move.l	#$fffffdfd,d0
	movec	d0,cacr
	move	#0,sr

	bsr.l	kill_inten
	move.l	#pamiec,d0
	move.l	d0,bitplan
	lea	colory_1,a6
	move.l	#-2,(a6)+
	bsr	screen

	bsr.l	drzewko
	move.l	#-1,bltafwm(a0)
	bsr.l	pozelek2

	move.l	#pamiec_1,bitplan_cls
	move.l	#pamiec,bitplan_rys

	bsr	read_mod_intro
	bsr	read_yon_intro

	bsr.l	grajek
	lea	custom,a0
	bsr	intro

	tst.w	exit_demo_pom
	bne	exit_yon_demo
	bsr	endpart

exit_yon_demo:
	bsr.l	grajek_wyskocz
	move.l	$4.w,a6
	lea	rewrite_cache,a5
	jmp	-30(a6)

rewrite_cache

	move.l	cacrs,d0
	movec	d0,cacr
	move.l	vbrs,d0
	movec	d0,vbr	
	move	#0,sr

	move.l	moni_pom1,a6
	move.l	moni_pom,a1

	jsr	-$de(a6)		; Restore view
	jsr	-$10e(a6)		; WaitTOF
	jsr	-$10e(a6)		; WaitTOF

	move.l	a6,a1
	move.l	4.w,a6
	jsr	CloseLibrary(a6)	; Close graphics library
	moveq	#0,d0
	rts

moni_pom:	dc.l	0
moni_pom1:	dc.l	0
cacrs:		dc.l	0
vbrs:		dc.l	0

endpart:
	move.w	#0,env_cone_avail
	move.w	#0,paleta_inten_avail	
	move.w	#256,roz_p_pom
	bsr	rozjasnij_palete_64_d	

	tst.w	exit_demo_pom
	bne	end_exit

	move.l	#0*2*2,ws_pom
	moveq	#7,d6
	lea	colory_1,a6
	bsr	wstaw_palete_d_64_1

	bsr	rys_screen_1
	bsr	endpart_depak

	move.w	#256,roz_p_pom
	bsr	rozjasnij_palete_64_d	
	move.l	#0*2*2,ws_pom
	moveq	#7,d6
	lea	colory_1,a6
	bsr	wstaw_palete_d_64_1
	bsr	screen_intro
	bsr	paleta_roz

end_wait:
	btst	#6,$bfe001
	bne	end_wait

	bsr	paleta_zciem
end_exit:
	rts

endpart_depak:
	lea	endpart_data,a1
	move.l	#'BODY',d0
	bsr	szukaj_chunka
	move.l	#40*8*256-1,d3
	lea	pamiec,a6
	bsr	rozpakuj_bitplany
	
	lea	adventure_data,a1
	lea	endpart_data,a1
	move.l	#'CMAP',d0
	bsr	szukaj_chunka
	move.l	#255,d6
	bsr	make_kolory_bufor
	rts
	
yon_exit:
	bsr.l	no_music
	bsr	read_mod_main
	bsr	read_yon_I
	bsr	paleta_zciem

	lea	pamiec,a1
	lea	pamiec_1,a2
	move.l	#$ffff,d7
	moveq	#0,d0

cls_gfx_buf:
	move.l	d0,(a1)+
	move.l	d0,(a2)+
	dbr	d7,cls_gfx_buf
	
;	move.w	#256,roz_p_pom
;	bsr	rozjasnij_palete_64_d	

	move.l	#0*2*2,ws_pom
	moveq	#7,d6
	lea	colory_1,a6
	bsr	wstaw_palete_d_64_1

	bsr	part_I
	rts

read_yon_intro:
	move.w	#$8008,$dff09a
	move.l	4,a6
	lea	dos_name,a1
	moveq	#0,d0
	jsr	OpenLibrary(a6)
	tst	d0
	beq	no_file_mod_end_dat
	move.l	d0,dos_base
	move.l	dos_base,a6
	move.l	#yon_intro_name,d1
	move.l	#1005,d2
	jsr	Open(a6)
	tst	d0
	beq	no_file_mod_end_dat
	move.l	d0,info_handle
	move.l	info_handle,d1
	move.l	#intro_data,d2
	move.l	#$ffffff,d3
	jsr	Read(a6)
	move.l	info_handle,d1
	jsr	Close(a6)
	move.w	#$c008,$dff09a
	lea	custom,a0
	rts

read_mod_intro:
	move.w	#$8008,$dff09a
	move.l	4,a6
	lea	dos_name,a1
	moveq	#0,d0
	jsr	OpenLibrary(a6)
	tst	d0
	beq	no_file_mod_end_dat
	move.l	d0,dos_base
	move.l	dos_base,a6
	move.l	#yon_mod_intro_name,d1
	move.l	#1005,d2
	jsr	Open(a6)
	tst	d0
	beq	no_file_mod_end_dat
	move.l	d0,info_handle
	move.l	info_handle,d1
	move.l	#mod_data,d2
	move.l	#$ffffff,d3
	jsr	Read(a6)
	move.l	info_handle,d1
	jsr	Close(a6)
	move.w	#$c008,$dff09a
	lea	custom,a0
	rts

scroll:
rotacja:
	tst.w	activ_lace
	beq	no_activ_lace
	lea	custom,a0
	bsr	rys_lace_screen
	move.w	#0,activ_lace
	rts

no_activ_lace:
	tst.w	paleta_inten_avail
	beq	no_paleta_inten_avail
	cmpi.w	#5,paleta_inten_avail
	beq	paleta_inten_roz
	cmpi.w	#10,paleta_inten_avail
	beq	paleta_inten_zc
no_paleta_inten_avail:

	tst.w	intro_avail
	beq	no_intro_avail
	bsr	intro_control
	rts
no_intro_avail:

	tst.w	yon_avail
	beq	no_yon_avail
	bsr	yon_control
	rts
no_yon_avail:

	tst.w	env_cone_avail
	beq	no_env_cone_avail
	bsr	env_cone_control
	rts
no_env_cone_avail:

	tst.w	adventure_avail
	beq	no_adventure_avail
	bsr	adventure_control
	rts
no_adventure_avail:

	tst.w	szninkiel_avail
	beq	no_szninkiel_avail
	bsr	szninkiel_control
	rts
no_szninkiel_avail:

	tst.w	glass_avail
	beq	no_glass_avail
	bsr	glass_control
	rts
no_glass_avail:

	tst.w	wir_avail
	beq	rot_wir
	tst.w	bump_avail
	beq	rot_bump

	tst.w	env_h8_blur_avail
	beq	no_env_h8_blur_avail
	bsr	env_h8_blur_control
	rts

no_env_h8_blur_avail:
	tst.w	credits_avail
	beq	no_credits_avail
	bsr	credits_control
	rts
no_credits_avail:

	tst.w	ziemniaki_avail
	beq	no_ziemniaki_avail
	bsr	ziemniaki_control
	rts
no_ziemniaki_avail:

	tst.w	balls_avail
	beq	no_balls_avail
	bsr	balls_control
	rts
no_balls_avail:

	rts

rys_screen_1:
	lea	copperl,a6
	move.w	#$0038,dstrt(a6)
	move.w	#$00d0,dstop(a6)
	move.w	#$2c81,distrt(a6)
	move.w	#$2cc1,distop(a6)
	move.w	#-40,modbp(a6)
	move.w	#-40,modbn(a6)
	move.w	#$1001,bitcon(a6)
	move.w	#0,bitcon1(a6)
	move.w	#$00,bitcon2(a6)
	move.w	#$000,f_mode(a6)
	move.l	#zera,d5
	move.w	d5,bpl1l(a6)
	swap	d5
	move.w	d5,bpl1h(a6)
	rts

screen:
	lea	custom,a0
	move.w	#$87f0,dmacon(a0)
	lea	copperl,a6
	move.w	#$0038,dstrt(a6)
	move.w	#$00d0,dstop(a6)
	move.w	#$2c81,distrt(a6)
	move.w	#$2cc1,distop(a6)
	move.w	#-40-8,modbp(a6)
	move.w	#-40-8,modbn(a6)
	move.w	#$1001,bitcon(a6)
	move.w	#$0220,bitcon2(a6)
	move.w	#$003,f_mode(a6)
	move.l	bitplan,d5
	move.w	d5,bpl1l(a6)
	swap	d5
	move.w	d5,bpl1h(a6)
	lea	cooper_lista,a6
	move.l	a6,cop1lch(a0)
	rts

;includy
	include	lace.s
	include	yon_intro.s
	include	plasma_3.s
	include	yon_part_II_3.s
	include	yon_part_I.s
	include	balls_3.s
	include	yon_main_3.s
	include	env_blur_3.s
	include	make_chunk_kolory_3.s

pozelek2:
	move.l	vposr(a0),d7
	and.l	#$1ff00,d7
	cmpi.l	#$13600,d7
	bne.b	pozelek2
	rts

	include	iff.s
	include	c2h8_2.s
	include	c2p_cone.s
	include	env_cone_2.s
	include	env_h8_2.s
	include	chunky_2x2.s
	include	c2p_1x2.s
	include	p_61_yon.s
	include	drzewko_1.s
	even

wir_x:		dc.w	0
kat_ef1:	dc.w	80
bump_avail:	dc.w	10
wir_avail:	dc.w	10
glass_avail:	dc.w	0
glass_down:	dc.w	0
glass_pom:	dc.w	0
e1_tex_x:	dc.w	0
e1_tex_y:	dc.w	0
e1_tex_x_1:	dc.w	128
e1_tex_y_1:	dc.w	128
ef1_pom:	dc.l	10*95
ef3_pom:	dc.l	0
ef1_str:	dc.l	0
wir_calc_pom:	dc.w	2
bump_1_y:	dc.w	0
bump_2_y:	dc.w	0
bump_3_y:	dc.w	0
kat_1:		dc.w	360
kat_2:		dc.w	0
kat_3:		dc.w	12
kat_4:		dc.w	30

coders_avail:		dc.w	0
blur_pom:		dc.w	0
ziemniaki_avail:	dc.w	0
ziemniaki_pom:		dc.w	0
blw_tex_pom:		dc.l	0
ball_1_y:		dc.w	0
ball_2_y:		dc.w	0
ball_3_y:		dc.w	0
balls_avail:		dc.w	0
blur_p_exit:		dc.w	0
blur_y:			dc.l	100
credits_avail:		dc.w	0
bufor_blur_rys:		dc.l	0
bufor_blur_cls:		dc.l	0
env_h8_blur_pom:	dc.w	0
env_h8_blur_avail:	dc.w	0
chunky_blur_adr		dc.l	0
blur_adr:		dc.l	0
blur_env_pom:		dc.w	-1800

texture_env_cone_laczniki:	dc.w	0,1,1,2,2,3,3,0
texture_env_cone_topy:		dc.w	0
texture_env_cone_loopy:		dc.w	0
axis_cone:			dc.l	270*2,90*2,0
axis_cone2:			dc.l	270*2,90*2,0

texture_env_h8_blur_laczniki:	dc.w	0,1,1,2,2,3,3,0
texture_env_h8_blur_topy:		dc.w	0
texture_env_h8_blur_loopy:		dc.w	0
axis_h8_blur:			dc.l	270*2,90*2,0
axis_h8_blur2:			dc.l	270*2,90*2,0

texture_env_1x2_laczniki:	dc.w	0,1,1,2,2,3,3,0
texture_env_1x2_topy:		dc.w	0
texture_env_1x2_loopy:		dc.w	0
axis_1x2:			dc.l	270*2,90*2,0
axis_1x22:			dc.l	270*2,90*2,0

points_ile_zm:			dc.w	202
faces_ile_zm:			dc.w	400
texture_env_h8_laczniki:	dc.w	0,1,1,2,2,3,3,0
texture_env_h8_topy:		dc.w	0
texture_env_h8_loopy:		dc.w	0
axis_h8:			dc.l	270*2,90*2,0
axis_h82:			dc.l	270*2,90*2,0
przesxyz:
przes_x:			dc.w	-50
przes_y:			dc.w	3000
przes_z:			dc.w	1650
kat_ox_l:	dc.l	0
kat_oy_l:	dc.l	358
kat_oz_l:	dc.l	358

exit_demo_pom:		dc.w 0
p_a0:			dc.l 0
przerwania_rejestry:	ds.l	8+6
przerwania_rejestry_c:
pom_przerwania:		dc.w 0
przerwania:		dc.l 0

dos_base:		dc.l	0
info_handle:		dc.l	0

gfxname:		dc.b 'graphics.library',0
dos_name:		dc.b 'dos.library',0
	even
yon_I_name:		dc.b 'PROGDIR:yon_I.gfx',0
yon_II_name:		dc.b 'PROGDIR:yon_II.gfx',0
yon_intro_name:		dc.b 'PROGDIR:yon_intro.gfx',0
yon_adv_name:		dc.b 'PROGDIR:Adventure.iff',0
yon_mod_main_name:	dc.b 'PROGDIR:p61.main',0
yon_mod_intro_name:	dc.b 'PROGDIR:p61.intro',0
				even

bitplan_rys:		dc.l	0
bitplan_cls:		dc.l	0
rot_pom:		dc.w	0
kulka_rgb_fast:		dc.w 0
pom_kol:		dc.w 0
bitplan:        	dc.l 0
color_adr:		dc.l 0
kat_ox:			dc.w 0
kat_oy:			dc.w 0
kat_oz:			dc.w 0

		section zmienne_c,data_c

cooper_lista:
		dc.w $120
spr_0_h:	dc.w $0000
		dc.w $122
spr_0_l:	dc.w $0000
		dc.w $124
spr_1_h:	dc.w $0000
		dc.w $126
spr_1_l:	dc.w $0000
spr_2:		dc.w $128
spr_2_h:	dc.w $0000,$12a
spr_2_l:	dc.w $0000 
spr_3:		dc.w $12c
spr_3_h		dc.w $0000,$12e
spr_3_l:	dc.w $0000
spr_4:		dc.w $130
spr_4_h:	dc.w $0000,$132
spr_4_l:	dc.w $0000
spr_5:		dc.w $134
spr_5_h:	dc.w $0000,$136
spr_5_l:	dc.w $0000
spr_6:		dc.w $138
spr_6_h:	dc.w $0000,$13a
spr_6_l:	dc.w $0000
spr_7:		dc.w $13c
spr_7_h:	dc.w $0000,$13e
spr_7_l:	dc.w $0000
copperl:	
		dc.w $0e0,$000,$0e2,$000,$0e4,$000,$0e6,$000
		dc.w $0e8,$000,$0ea,$000,$0ec,$000,$0ee,$000
		dc.w $0f0,$000,$0f2,$000,$0f4,$000,$0f6,$000
		dc.w $100,$000,$102,$000,$104,$000,$08e,$000
		dc.w $090,$000,$092,$000,$094,$000,$108,$000
		dc.w $10a,$000,$1fc,$000,$0f8,$000,$0fa,$000
		dc.w $0fc,$000,$0fe,$000

colory_1:

		dc.w $82
		dc.w 0
		dc.w $80
		dc.w 0
		dc.w $88
		dc.w 0

colory_tlo_1_1:
		dc.w $82
		dc.w 0
		dc.w $80
		dc.w 0

colory_tlo_1:	ds.b 15000
		
colory_2:
		dc.w $82
		dc.w 0
		dc.w $80
		dc.w 0
colory_tlo_2:	ds.b 15000

cop_con:	dc.l -2

		include	yon_spr.s

		section bufory_f,bss_f

p_skladowa_r:				ds.b	256
p_skladowa_g:				ds.b	256
p_skladowa_b:				ds.b	256

p_kolory_bufor_1:			ds.w	256*2
p_kolory_bufor_2:			ds.w	32*2*256
p_kolory_bufor_3:			ds.w	32*2*256

bufor_blur_b:
bufor_tex_4:				ds.b	256*256
bufor_blur_a:
bufor_tex_3:				ds.b	256*256
bufor_tex_5:				ds.b	256*256
bufor_tex_6:
bufor_bump:				ds.b	256*390*4-256*256
bufor_bump_2:				ds.b	301824

env_cone_texture:
env_1x2_texture:			ds.b	256*256
tlo_cone:
tlo_1x2:				ds.b	320*100

bufor_tex:				ds.l	256*360
bufor_tex_2:				ds.l	256*360

ile_razy_z:				ds.w	10000*2
adresy_z:				ds.l	10000*2
points_new:				ds.w	3*2000
wersory_usrednione:			ds.w	3*2000
wersory_usrednione_new:			ds.w	3*2000
widocznosc_cone:
widocznosc_1x2:
widocznosc_h8_blur:
widocznosc_h8:				ds.w	2000
posortowane_adresy:			ds.l	2000
zety_usrednione:			ds.w	2000
punkty_ktore:				ds.w	3*2000


bufor_tex_1:				ds.l	160*96
bufor_pom:				ds.w	128*128
					ds.w	128*128
;bufor_cmap:				ds.w	256*2
intro_data:
bufor_osw:				ds.l	160*96
bufor_osw_1:				ds.w	256*256


texture_env_cone_vector_points:
texture_env_1x2_vector_points:
texture_env_h8_blur_vector_points:
texture_env_h8_vector_points:		ds.w	4*2

texture_env_cone_xdata1:
texture_env_1x2_xdata1:
texture_env_h8_blur_xdata1:
texture_env_h8_xdata1:			ds.w	320

texture_env_cone_xdata2:
texture_env_1x2_xdata2:
texture_env_h8_blur_xdata2:
texture_env_h8_xdata2:			ds.w	320

texture_env_cone_xydata1:
texture_env_1x2_xydata1:
texture_env_h8_blur_xydata1:
texture_env_h8_xydata1:			ds.w	320*2

texture_env_cone_xydata2:
texture_env_1x2_xydata2:
texture_env_h8_blur_xydata2:
texture_env_h8_xydata2:			ds.w	320*2

texture_env_cone_picture_points:
texture_env_1x2_picture_points:
texture_env_h8_blur_picture_points:
texture_env_h8_picture_points:		ds.w	4*2

texture_env_cone_picture_datas:
texture_env_1x2_picture_datas:
texture_env_h8_blur_picture_datas:
texture_env_h8_picture_datas:		ds.w	4*2

prec_env_cone_data:
prec_env_1x2_data:
prec_env_h8_blur_data:
prec_env_h8_data:			ds.l	9


topy:					ds.w	1
loopy:					ds.w	1
ile_scianek_widocznych:			ds.w	1

Adventure_data:
gfx_data:
env_h8_blur_texture:
env_h8_texture:			ds.l	256*256
tlo_h8:
tlo_h8_blur:			ds.l	160*96

		section	grafika,data_f
drzewko_data:			incbin	gfx:drzewko.bsh
endpart_data:			incbin	gfx:yon/ydune
acr:				incbin	gfx:yon/blur/acr_1.bsh
tlo_1x2_data:			incbin	gfx:chunky/iff/tlo_4_3.bsh
env_1x2_tex_data:		incbin	gfx:chunky/iff/env_4_3.bsh
tlo_cone_data:			incbin	gfx:chunky/iff/tlo_1.bsh
env_cone_tex_data:		incbin	gfx:chunky/iff/env_1_1.bsh
szninkiel_data:			incbin	gfx:yon/szninkiel

				include	include:includes/sin_zig.s
				include	sin_256.s
				include	sin.s

wersory_zm_h8:			incbin  lwob:objects/8.tn
points_zm_h8:			incbin	lwob:objects/8.tp
laczniki_zm_h8:			incbin	lwob:objects/8.tf

wersory_zm:			incbin  lwob:objects/blur.tn
points_zm:			incbin	lwob:objects/blur.tp
laczniki_zm:			incbin	lwob:objects/blur.tf

wersory_ziemniaki:		incbin  lwob:objects/kula5.tn
points_ziemniaki:		incbin	lwob:objects/kula5.tp
laczniki_ziemniaki:		incbin	lwob:objects/kula5.tf

wersory_zm_cone:		incbin  lwob:objects/cone.tn
points_zm_cone:			incbin	lwob:objects/cone.tp
laczniki_zm_cone:		incbin	lwob:objects/cone.tf

		section bufory_c,bss_c
mod_data:
p61_data_intro:
p61_data_2:
p61_data:			ds.b	570000

		cnop	0,8
zera:			ds.b	100
womoch_bufor:		ds.b	108*8*8
eye_bufor:		ds.b	90*8*4

samples
		cnop	0,8
;zera:			ds.b	100
;bufor_pom_c:		ds.w 128*128
		cnop	0,8
pamiec:				ds.b	8*40*256
pamiec_1:
dym_1_bufor:			ds.l	4*8*125
dym_bufor:			ds.l	40*8*375

