;	Hello Newsflash-readers,

;	This is a little source which shows you how to sample data
;	It's rapid but can be improved a lot ..

;	If you like this source , so why not spending 5 bytes of your
;	productions to write : GULLY ...

;		Mega greeting to GIGICAR and VCC

;	If you want to contact me write to :
;		LE DIOURIS MARC ( GULLY )		;do write gully !
;		CREFURIEN
;		22110 PLOUNEVEZ QUINTIN
;		FRANCE



	execbase=4
	chip=2
	allocmem=-198
	freemem=-210
	openlib=-552





o:	move.l	4,a6
	jsr	-120(a6)		;forbid tasks

	bsr	initall
	lea	presents,a0
	bsr	print

	lea	tabl,a1

 	CLR.B	$bfe301			;parallel in
	move.l	#7,d7
	clr.l	d6
	move.l	scradr,a0
	lea	50*80(a0),a0		;adress to the screen
	lea	$bfe001,a6

l1:	clr.l	d0
	move.b	#$c4,$bfd200		;SEL out
	move.b	#$c0,$bfd200		;SEL in
	btst	#2,$bfd000
	move.b	$bfe101,d0		;D0=sampled data

	bsr	set_pt
	lsr.w	#1,d0
	move.w	d0,$dff180		;color in the back ...

	btst	#6,(a6)			;mouse butom pressed ?
	bne.s	l1


	move.l	4,a6
	jsr	-126(a6)		;permit tasks
	bsr	saveall
	clr.l	d0
	rts				;end

;--------------------------------------------------------------
set_pt	move.l	d0,d1
	lsr.l	#1,d1
	mulu	#80,d1
	add.l	d6,d1
	bset	d7,(a0,d1.l)		;set new points

	clr.l	d2
	move.l	(a1),d2
	bclr	d7,(a0,d2.l)		;clear old point

	move.l	d1,(a1)+		;store new point

	subq.l	#1,d7			;increase adress
	cmpi.l	#-1,d7
	bne.s	noend1
	moveq.l	#7,d7
	addq.l	#1,d6
	cmp.l	#80,d6
	bne.s	noend1
	clr.l	d6
	lea	tabl,a1

noend1	rts

tabl	ds.l	80*8
;--------------------------------------------------------------
print:	clr.l	d0
	move.b	(a0)+,d0
	bne.s	not_end
	rts

not_end:cmp.b	#1,d0
	bne.s	not_move
	move.b	(a0)+,d0	;x
	clr.l	d1
	move.b	(a0)+,d1	;y
	mulu	#80*8,d1
	move.l	scradr,a1
	add.l	d1,a1
	add.l	d0,a1
	move.l	a1,a2
	bra.s	print

not_move:cmp.b	#10,d0
	bne.s	not_cr
	add.l	#80*8,a2
	move.l	a2,a1
	bra	print

not_cr:	move.l	fontadr,a3
	add.l	d0,a3
	move.b	0*$c0(a3),0*80(a1)
	move.b	1*$c0(a3),1*80(a1)
	move.b	2*$c0(a3),2*80(a1)
	move.b	3*$c0(a3),3*80(a1)
	move.b	4*$c0(a3),4*80(a1)
	move.b	5*$c0(a3),5*80(a1)
	move.b	6*$c0(a3),6*80(a1)
	move.b	7*$c0(a3),7*80(a1)
	lea	1(a1),a1
	bra	print

;--------------------------------------------------------------
initall:move.l	execbase,a6
	move.l	#chip,d1
	move.l	#endlist-coplist,d0
	jsr	allocmem(a6)
	move.l	d0,coplistadr
	move.l	d0,a1
	lea	coplist(pc),a0
	move.l	#[endlist-coplist]-1,d0
copper:	move.b	(a0)+,(a1)+
	dbra	d0,copper

	move.l	#$10002,d1
	move.l	#256*80,d0
	jsr	allocmem(a6)
	move.l	d0,scradr

	move.l	coplistadr,a0
	move.w	d0,6(a0)
	swap	d0
	move.w	d0,2(a0)


	move.w	#$20,$dff096		;vire les sprites
	move.l	coplistadr,$dff080
	clr.w	$dff088

	lea	$fc0000,a0		;this little
zob:	add.l	#2,a0			;routine was
	cmp.l	#$186c6c,$20(a0)	;coded by the wondefull
	bne	zob			;  VCC  ( thanks )
	move.l	a0,fontadr

	rts
;--------------------------------------------------------------
saveall:move.l	execbase,a6
	lea	gfxlib(pc),a1
	clr.l	d0
	jsr	openlib(a6)
	move.l	d0,a4
	move.l	38(a4),$dff080
	clr.w	$dff088
	move.w	#$83e0,$dff096

	move.l	execbase,a6
	move.l	scradr,a1
	move.l	#256*80,d0
	jsr	freemem(a6)

	move.l	coplistadr,a1
	move.l	#endlist-coplist,d0
	jsr	freemem(a6)

	clr.l	d0
	rts
;-------------------------------------------------------------------
coplist:	dc.w	$00e0,$0000,$00e2,$0000
		dc.w	$0180,$0000,$0182,$0fff
		dc.w	$0100,$9200
		dc.w	$0102,$0000
		dc.w	$0104,$0000
		dc.w	$008e,$2c81,$0090,$f5c1
		dc.w	$0092,$0038,$0094,$00d0
		dc.w	$ffff,$fffe
endlist:	dc.w	0



coplistadr:	dc.l	0
fontadr:	dc.l	0
scradr:		dc.l	0
gfxlib:		dc.b	'graphics.library',0
presents:
dc.b1,10,0
dc.b'***********************************************************',10
dc.b'             SAMPLER V0.01 . CODED BY GULLY',10
DC.B'***********************************************************',10
dc.b0

a:

