<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">;-------T-------T------------------------T----------------------------------;
;Name:      Chunky Pixel List (Buffered)
;Author:    Paul Manias
;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
;
;This demo is like the other pixel list demos but uses a CHUNKY8 screen type.
;Then screen size has been kept very small as the C2P routine is too slow,
;but this will be improved in the next version.  The good thing is that
;because the routine is transparent, using a graphics card would mean that
;this demo would run at the maximum possible speed.
;
;Press LMB to exit.

	INCDIR	"INCLUDES:"
	INCLUDE	"games/games_lib.i"
	INCLUDE	"games/games.i"

	SECTION	"Demo",CODE

;===========================================================================;
;                             INITIALISE DEMO
;===========================================================================;

	STARTGMS

Start:	MOVEM.L	A0-A6/D1-D7,-(SP)
	move.l	GMSBase(pc),a6
	CALL	AllocBlitter
	tst.l	d0
	bne.s	.Error_Blitter

	lea	ScreenTags(pc),a0
	CALL	ShowScreen
	tst.l	d0
	beq.s	.Error_Screen

	CALL	InitJoyPorts

	bsr.s	Main

.ReturnToDOS
	move.l	GMSBase(pc),a6
	move.l	Screen(pc),a0
	CALL	DeleteScreen
.Error_Screen
	CALL	FreeBlitter
.Error_Blitter
	MOVEM.L	(SP)+,A0-A6/D1-D7
	moveq	#ERR_OK,d0
	rts

;===========================================================================;
;                                MAIN LOOP
;===========================================================================;

Main:
.loop	move.l	Screen(pc),a1
	move.l	GS_Bitmap(a1),a0
	move.l	GS_MemPtr2(a1),BMP_Data(a0)
	CALL	ClearBitmap

	lea	MList(pc),a2	;a2 = Pointer to pixel list.
	move.l	a2,a3	;Drop the pixels here.
	moveq	#31-1,d7
.drop	addq.w	#1,2(a3)	;a3 = YCoord+1
	subq.l	#1,4(a3)	;a3 = (Colour)-1
	bge.s	.colok
	clr.l	4(a3)
.colok	addq.w	#8,a3
	dbra	d7,.drop

	lea	MouseX(pc),a5
	moveq	#JPORT1,d0
	moveq	#JT_ZBXY,d1
	CALL	ReadJoyPort
	btst	#MB_LMB,d0
	bne.s	.done
	move.w	d0,d1
	ext.w	d1	;d1 = Extend the Y byte.
	asr.w	#8,d0	;d0 = Extend the X byte.

	move.l	Screen(pc),a0	;a0 = Screen.
	add.w	(a5),d0	;d0 = (MouseX)+ChangeX
	add.w	2(a5),d1	;d1 = (MouseY)+ChangeY

.ChkRX	cmp.w	GS_ScrWidth(a0),d0
	blt.s	.ChkLX
	moveq	#$00,d0
	bra.s	.Calculate

.ChkLX	tst.w	d0
	bgt.s	.ChkTY
	move.w	GS_ScrWidth(a0),d0
	bra.s	.Calculate

.ChkTY	tst.w	d1
	bgt.s	.ChkBY
	move.w	GS_ScrHeight(a0),d1
	bra.s	.Calculate

.ChkBY	cmp.w	GS_ScrHeight(a0),d1
	blt.s	.Calculate
	moveq	#$00,d1

.Calculate
	move.w	d0,(a5)
	move.w	d1,2(a5)

	move.l	(a5),-(sp)
	moveq	#2,d1
	CALL	FastRandom
	subq.w	#1,d0
	add.w	d0,(a5)

	moveq	#2,d1
	CALL	FastRandom
	subq.w	#1,d0
	add.w	d0,2(a5)

	move.l	a2,a3
	moveq	#31-1,d7
.tloop	move.l	8(a3),(a3)
	move.l	12(a3),4(a3)
	addq.w	#8,a3
	dbra	d7,.tloop

	move.l	Screen(pc),a0
	move.l	GS_Bitmap(a0),a0
	lea	PixelList(pc),a1	;a1 = Pixel list.
	CALL	DrawPixelList	;&gt;&gt; = Draw pixels with clipping.
	move.l	(sp)+,(a5)

	CALL	WaitVBL

	move.l	Screen(pc),a0
	CALL	SwapBuffers
	bra	.loop
.done	rts

;===========================================================================;
;                                  DATA
;===========================================================================;

ScreenTags:
	dc.l	TAGS_GAMESCREEN
Screen:	dc.l	0
	dc.l	GSA_ScrWidth,128
	dc.l	GSA_ScrHeight,128
	dc.l	GSA_Palette,.palette
	dc.l	GSA_AmtColours,32
	dc.l	GSA_Attrib,DBLBUFFER|CENTRE
	dc.l	GSA_ScrType,CHUNKY8
	dc.l	TAGEND
.palette
	dc.l $000000,$101010,$171717,$202020,$272727,$303030,$373737,$404040
	dc.l $474747,$505050,$575757,$606060,$676767,$707070,$777777,$808080
	dc.l $878787,$909090,$979797,$a0a0a0,$a7a7a7,$b0b0b0,$b7b7b7,$c0c0c0
	dc.l $c7c7c7,$d0d0d0,$d7d7d7,$e0e0e0,$e0e0e0,$f0f0f0,$f7f7f7,$ffffff

PixelList:
	dc.w	32,PXL_SIZEOF	;Amount of entries, EntrySize.
	dc.l	MList	;Pointer to pixel list array.
MList	PIXEL	16,12,00	;First pixel to draw (at back)
	PIXEL	16,12,00	;X/Y/Colour
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
	PIXEL	16,12,00	;..
MouseX	PIXEL	16,12,31	;Last pixel to draw (in front)

</pre></body></html>