*\  :ts=8 bk=0
* The color rotater for the New Art program.
* This was written in machine code for speed (Lattice has this odd habit
* of pessimizing code).
*
* Calling convention:
*  rotate ();
*
* Assembling:
*  df1:c/assem rotate.s -i df1:include -o rotate.o
*
* 8607.1
*/

		include	"exec/types.i"
		include	"exec/libraries.i"
		include "graphics/view.i"

xlib		macro
		xref	_LVO\1
		endm

callsys		macro
		CALLLIB	_LVO\1
		endm

		xdef	_rotate

		xref	_GfxBase
		xref	_vp

		xlib	LoadRGB4

		rorg	0


_rotate		movem.l	a2-a3/a6,-(sp)

		movea.l	_vp,a0
		movea.l a0,a1
		movea.l vp_ColorMap(a1),a1
		movea.l cm_ColorTable(a1),a1
		movea.l a1,a2
		adda.w	#1*2,a2		Point at the colors we want
		movea.l	a2,a3
		addq.w	#2,a3
		moveq	#13,d0
		move.w	(a2),d1
loop		move.w	(a3)+,(a2)+
		dbra	d0,loop
		move.w	d1,(a2)

		movea.l	_GfxBase,a6
		moveq	#32,d0
		callsys	LoadRGB4

		movem.l	(sp)+,a2-a3/a6
		rts

		end
