Path: nntp.hut.fi!news.funet.fi!sunic!pipex!howland.reston.ans.net!spool.mu.edu!sdd.hp.com!portal!cup.portal.com!Stephan_Derek_Schaem
From: Stephan_Derek_Schaem@cup.portal.com
Newsgroups: comp.sys.amiga.programmer
Subject: Re: Chunky to Planar conversion
Message-ID: <98745@cup.portal.com>
Date: Sat, 18 Dec 93 21:25:23 PST
Organization: The Portal System (TM)
Distribution: world
References: <1993Dec4.104439.1278@csc.canberra.edu.au>
  <PETERM.93Dec14122530@kea.grace.cri.nz>
  <1993Dec16.172634.20001@infodev.cam.ac.uk>
  <756171125snz@falcon.demon.co.uk>
Lines: 139


 Just for fun, and to show how to use addx for c2p (Not a good
solution anyway, even if its 65cycle for 1 8bit pixel).
 I have a similare routine for 32bit buss doing only write
access.
						Stephan
;------------------------------------------------------------------------------
;
; INPUT:	A0.l = Array of byte
;		A1.l = 8 Bitplane BLOCK
;		D0.w = HCount-1 (IN BYTE)
;		D1.w = VCount-1
;		D2.l = 1 Bitplane Size
;
; OUTPUT:	NONE
;
; NOTE:  (LOOP INCLUDED: 520 cycles for 8pixel) so 65 cycle per 8bit pixel
;
	xdef	_Block8Rotate000
	QUAD
_Block8Rotate000:			;Routine for All CPU, but 68000 design
	movem.l	d2-d7/a2-a6,-(sp)
	movea.l	d2,a6
	lea	(a1,d2.l),a2
	add.l	d2,d2
	lea	(a1,d2.l),a3
	lea	(a3,d2.l),a4
	lea	(a4,d2.l),a5
.YLoop	move.w	d0,d5
	swap	d0
	swap	d1
.XLoop	swap	d5
	move.b	(a0)+,d7
	move.b	(a0)+,d6
	move.b	(a0)+,d5
	move.b	(a0)+,d4
	move.b	(a0)+,d3
	move.b	(a0)+,d2
	move.b	(a0)+,d1
	move.b	(a0)+,d0
	add.b	d7,d7
	addx.b	d7,d7
	addx.b	d6,d6
	addx.b	d7,d7
	addx.b	d5,d5
	addx.b	d7,d7
	addx.b	d4,d4
	addx.b	d7,d7
	addx.b	d3,d3
	addx.b	d7,d7
	addx.b	d2,d2
	addx.b	d7,d7
	addx.b	d1,d1
	addx.b	d7,d7
	addx.b	d0,d0
	addx.b	d7,d7
	move.b	d7,(a1)+
	rol.b	#1,d6
	moveq	#-4,d7
	and.b	d6,d7
	add.b	d7,d6
	addx.b	d5,d5
	addx.b	d6,d6
	addx.b	d4,d4
	addx.b	d6,d6
	addx.b	d3,d3
	addx.b	d6,d6
	addx.b	d2,d2
	addx.b	d6,d6
	addx.b	d1,d1
	addx.b	d6,d6
	addx.b	d0,d0
	addx.b	d6,d6
	move.b	d6,(a2)+
	rol.b	#1,d5
	moveq	#-8,d7
	and.b	d5,d7
	add.b	d7,d5
	addx.b	d4,d4
	addx.b	d5,d5
	addx.b	d3,d3
	addx.b	d5,d5
	addx.b	d2,d2
	addx.b	d5,d5
	addx.b	d1,d1
	addx.b	d5,d5
	addx.b	d0,d0
	addx.b	d5,d5
	move.b	d5,(a3)+
	rol.b	#1,d4
	moveq	#-16,d7
	and.b	d4,d7
	add.b	d7,d4
	addx.b	d3,d3
	addx.b	d4,d4
	addx.b	d2,d2
	addx.b	d4,d4
	addx.b	d1,d1
	addx.b	d4,d4
	addx.b	d0,d0
	addx.b	d4,d4
	move.b	d4,-1(a3,a6.l)
	rol.b	#1,d3
	moveq	#-32,d7
	and.b	d3,d7
	add.b	d7,d3
	addx.b	d2,d2
	addx.b	d3,d3
	addx.b	d1,d1
	addx.b	d3,d3
	addx.b	d0,d0
	addx.b	d3,d3
	move.b	d3,(a4)+
	rol.b	#1,d2
	moveq	#-64,d7
	and.b	d2,d7
	add.b	d7,d2
	addx.b	d1,d1
	addx.b	d2,d2
	addx.b	d0,d0
	addx.b	d2,d2
	move.b	d2,-1(a4,a6.l)
	rol.b	#1,d1
	move.b	d1,d7
	add.b	d7,d7
	addx.b	d0,d0
	addx.b	d1,d1
	move.b	d1,(a5)+
	rol.b	#1,d0
	move.b	d0,-1(a5,a6.l)
	swap	d5
	dbra	d5,.XLoop
	swap	d1
	swap	d0
	dbra	d1,.YLoop
	movem.l	(sp)+,d2-d7/a2-a6
	rts

	end

