;-------T-------T------------------------T---------------------------------;
;Name:      Hi-Resolution Screen Display
;Author:    Paul Manias
;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
;
;Opens a screen in HIRES and LACED modes.  You can even try SuperHiRes
;(SHIRES) if you change the appropriate flag in the GameScreen structure.

	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
	lea	ScreenTags(pc),a0
	CALL	AddScreen
	tst.l	d0
	beq.s	.Error_Screen

	move.l	Screen(pc),a0
	lea	PictureTags(pc),a1
	move.l	GS_MemPtr1(a0),PicData
	CALL	LoadPic
	tst.l	d0
	beq.s	.Error_Picture

	move.l	Picture(pc),a1
	move.l	PIC_Palette(a1),GS_Palette(a0)
	CALL	UpdatePalette

	CALL	ShowScreen

	CALL	InitJoyPorts

	bsr.s	Main

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

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

Main:	CALL	WaitVBL
	moveq	#JPORT1,d0
	moveq	#JT_ZBXY,d1
	CALL	ReadJoyPort
	btst	#MB_LMB,d0
	beq.s	Main
	rts

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

ScreenTags:
	dc.l	TAGS_GAMESCREEN
Screen:	dc.l	0
	dc.l	GSA_AmtColours,16
	dc.l	GSA_ScrWidth,640
	dc.l	GSA_ScrHeight,256
	dc.l	GSA_Attrib,CENTRE
	dc.l	GSA_ScrMode,HIRES|LACED
	dc.l	TAGEND

PictureTags:
	dc.l	TAGS_PICTURE
Picture	dc.l	0
	dc.l	PCA_Data
PicData	dc.l	0
	dc.l	PCA_Width,640
	dc.l	PCA_Height,256
	dc.l	PCA_AmtColours,16
	dc.l	PCA_Options,GETPALETTE
	dc.l	PCA_File,.file
	dc.l	TAGEND

.file	dc.b	"GMS:demos/data/PIC.Pic640x256",0
	even
