;--------------------------T------------------T---------------T
***** Chunky Conversion HW ***** $VER: v1.0 (02.08.95)

* I suggest you a little changes in your great code.
* Please make some v40 features for speed up in some systems, what has
* ChunkyToPlanar conversion hardware, ie.:
* - CD32 (+ SX-1) builtin Akiko
* - CyberVision 64 ( Not tested. Owner`s report are welcome.)
* - etc.

* Please INSERT this little `display-chunky` into your code, beacuse 
* Graphics/WriteChunkyPixels works 25 times faster, than the
* Graphics/WritePixelArray8 routine in CD32 (+ SX-1 ).
* In 640x480x8:
* WritePixelArray8  takes 3.86 sec
* WriteChunkyPixels takes 0.15 sec
* WriteChunkyPixels takes 0.27 sec in one line per CALL

* Graphics/WriteChunkyPixels works on top-speed,
* if you CALL it one time per Picture (ie. GIF).
* If you don`t want to decompress the whole Picture:
* - for instant, contignous displaying,
* - or not enough memory for puffer,
* I suggest: You must decompress more then one lines per CALL,
* beacuse the one line per CALLing will increase
* the displaying speed to 1.82 times slower.

* Bug reports and suggestions are welcome.

* code by McPhoton of CooL Software
* e-mail: szolim@dragon.klte.hu
* code generated by ASM-One V1.25
;------------------------------------------------------------------------------
VER_INCLUDES	EQU	40

	INCDIR	"INCLUDES:"

	INCLUDE	"graphics/gfxbase.i"
	INCLUDE	"lvos/graphics_lib.i"

	IFLT	VER_INCLUDES-40
_LVOWriteChunkyPixels	EQU	-1056
gb_ChunkyToPlanarPtr	EQU	508
	ENDC
;------------------------------------------------------------------------------
ALIGNED	MACRO
	CNOP	0,4
	ENDM

GETBASE	MACRO
	move.l	(\1LibraryBase,pc),a6
	ENDM

CALL	MACRO
	IFC	"\2",""
	jsr	_LVO\1(a6)
	ELSE
	move.l	(\1LibraryBase,pc),a6
	jsr	_LVO\2(a6)
	ENDC
	ENDM
;------------------------------------------------------------------------------
MyPicX=320
MyPicY=256
;------------------------------------------------------------------------------
Start	moveq	#0,d0
	rts
;------------------------------------------------------------------------------
	ALIGNED
DisplayChunky	GETBASE	Graphics
	cmp.w	#40,(LIB_VERSION,a6)
	blt.b	.NoGraphics40
*******************************************************************************
* NOTES:
* - Graphics/WriteChunkyPixels works the same speed as
*   Graphics/WritePixelArray8, if ChunkyToPlanarHW not presents.
*   Conclusion: Not realy need this two lines:

	tst.l	(gb_ChunkyToPlanarPtr,a6)
	beq.b	.NoChunkyToPlanarHW
*******************************************************************************
	bra	WriteChunkyPixels

.NoGraphics40
.NoChunkyToPlanarHW	bra	WritePixelArray8
;------------------------------------------------------------------------------
;WriteChunkyPixels(rp,xstart,ystart,xstop,ystop,array,bytesperrow)
;                  A0 D0     D1     D2    D3    A2     D4
;
;VOID WriteChunkyPixels(struct  RastPort *, LONG, LONG,
;     LONG, LONG, UBYTE *, LONG);

* NOTES:
* - Your array will not be modified.
* - Dont needs TmpRastPort ( WOW!!! shorter and simplier code).

	ALIGNED
WriteChunkyPixels	moveq	#0,d0
	moveq	#0,d1
	move.l	#MyPicX-1,d2
	move.l	#MyPicY-1,d3
	move.l	#MyPicX,d4
	move.l	(PtrMyRastPort,pc),a0
	lea	(ChunkyDatas,pc),a2
	CALL	Graphics,WriteChunkyPixels
	rts
;------------------------------------------------------------------------------
;count = WritePixelArray8(rp,xstart,ystart,xstop,ystop,array,temprp)
;D0                       A0 D0:16  D1:16  D2:16 D3:16  A2   A1
;
;LONG WritePixelArray8(struct  RastPort *, UWORD, UWORD,
;     UWORD, UWORD, UBYTE *, struct  RastPort *);

* NOTES:
* - Your array will be cleared.
* - Needs an allocated TmpRastPort.

	ALIGNED
WritePixelArray8	moveq	#0,d0
	moveq	#0,d1
	move.l	#MyPicX-1,d2
	move.l	#MyPicY-1,d3
	move.l	(PtrMyRastPort,pc),a0
	move.l	(PtrMyTmpRastPort,pc),a1
	lea	(ChunkyDatas,pc),a2
	CALL	Graphics,WritePixelArray8
	rts
;------------------------------------------------------------------------------
	ALIGNED
GraphicsLibraryBase	dc.l	0
PtrMyRastPort	dc.l	0
PtrMyTmpRastPort	dc.l	0

ChunkyDatas	dcb.b	MyPicX*MyPicY,0
;------------------------------------------------------------------------------
	END
