pouët.net

2^8 by Orb [web]

*****************************************************************************
* 2^8
*
* a small 256 byte effect for amiga ocs...
*
* i was quite surprised no 256 byte effect for ocs on pouet yet ?
* so here is my try...
*
* unforunately there wasn't enough memory space to setup all colors
* 2 colors are depending on the workbench colors...anyway
*
* the file is 256 bytes long (including header)
* (arf 36 bytes for nothing :) )
*
* the effect will not return after execution... start at your own risk !
* tested on a600 and winaue (not all configs)...
*
*
* ultra^orb 20110525
*
*****************************************************************************

release         equ     1
plane           equ     $1f00
sinus           equ     $2000
size		equ	120

	section	shortig, code_c
*****************************************************************************
start
	;create sin

	lea	copper+sinus(pc),a5
	move	#$385>>1,d0
	clr	d1
	moveq	#127,d3
createsin2
	add	d0,d1
	move	d1,d2
	lsr	#8,d2
	move.b	d2,(a5)+
	move.b	d2,256-1(a5)
	neg	d2
	move.b	d2,128-1(a5)
	subq	#7,d0
	dbf	d3,createsin2


mainloop:
	lea	$dff000+$40,a6
	lea	copper(pc),a0
	move.l	a0,$80-$40(a6)

sync
	tst.b	$06-$40(a6)
	bne.s	sync


	;clear bitmap
	;slower but shorter than blitter clear
	;(setup and wait)

	move	#$1f00,a1
	lea	(a1),a2
	move	#size*40/4,d0
clr
	clr.l	(a2)+
	dbf	d0,clr


	;draw points

	moveq	#size,d7
	move.l	d7,$180-$40(a6)
	move	d5,d6
	move	d5,d4
drawloop:
	addq	#1,d6
	subq	#2,d4

	ext.w	d6
	ext.w	d4

	move.b	64(a5,d6),d1
	add.b	64(a5,d4),d1
	bsr.s	setpixel
	move.b	(a5,d6),d1
	add.b	(a5,d4),d1
	bsr.s	setpixel

	lea	40(a1),a1
	dbf	d7,drawloop
	addq	#1,d5

	;area fill
	move.l	a1,$50-$40(a6)		;src
	move.l	a1,$54-$40(a6)		;dest
	clr.l	$64-$40(a6)		;src mod + dst mod
	move.l	#$09f00012,(a6)+
	move.l	d7,(a6)
	move	#20+(size<<6),$58-$40-4(a6)


	if	release
	bra.s	mainloop
	else
	btst	#6,$bfe001
	bne.s	mainloop
	illegal
	endc
*****************************************************************************
setpixel:
	ext.w	d1
	move	d1,d2
	eor	#$7,d2
	asr	#3,d1
	bchg	d2,20(a1,d1)
	rts
*****************************************************************************
copper
	dc.w	$009a,$7fff		; irqs off
	dc.w	$0096,$0020		; sprites off
	dc.w	$008e,$8b81             ; window start
	dc.w	$0090,$fcd1             ; window stop
	dc.w	$0092,$0040             ; fetch start
	dc.w	$0094,$00d8             ; fetch stop
	dc.w	$0108,$0000             ; modulo 1
	dc.w	$010a,-80		; modulo 2
	dc.w	$00e0,plane>>16
	dc.w	$00e2,(plane+80)&$ffff
	dc.w	$00e4,plane>>16
	dc.w	$00e6,(plane+80+116*40)&$ffff
	dc.w	$0100,$2200
	dc.l	-2
*****************************************************************************
	printt	"size:"
	printv	*-start
*****************************************************************************