	SUBTTL	Ship Fragments Defintion

;Macros

;ICBYTE VALUE
;   Function:
;	Internal macro used to generate a fragment display list.

DEFINE ICBYTE VALUE
%%BYTS==%%BYTS+1
%%WORD==%%WORD+<VALUE&17'>_<16.-4*%%BYTS>
IFE %%BYTS-4,{
    %%WORD+%%DISP
%%WORD==0 ? %%BYTS==0
}
TERMIN


;FRAGMENT [MOVES]
;   Function:
;	Generate the display list for a fragment.  The form of the frgament is determined
;	by the list MOVES.  A display-list pointer for the list is left in the FRGMTS
;	array.  The first worf of the list is a parameter mode command (RH) to set the
;	intensity and scale; the second word is a command to set the location of the
;	fragment (Y in LH, X in RH).
;   Inputs:
;	MOVES:	Controls the appearence of this fragment.  It is composed of a sequence
;		of symbols which are interpreted as follows:
;		ON:	Make points visible
;		OFF:	Make points invisible
;		U:	Move up one point
;		UR:	Move up and to the right one point
;		R:	Move right one point
;		DR:	Move down and right one point
;		D:	Move down one point
;		DL:	Move down and left one point
;		L:	Move left one point
;		UL:	Move up and left one point

DEFINE FRAGMENT MOVES
IF1,    $FRGMTS==$FRGMTS+1

%FRLOC==.
%%DISP==0
%%WORD==0
%%BYTS==0

.BYTE 18.
    GTOPRM
    SCALE(0)+INTSTY(0)+POINT
    SETY(0)+POINT
    SETX(0)+INCR

IRPS MOVE,,[MOVES]
    IFSE [MOVE][ON]   %%DISP==200000
    IFSE [MOVE][OFF]  %%DISP==0
    IFSE [MOVE][U]    ICBYTE 02'
    IFSE [MOVE][UR]   ICBYTE 12'
    IFSE [MOVE][R]    ICBYTE 10'
    IFSE [MOVE][DR]   ICBYTE 13'
    IFSE [MOVE][D]    ICBYTE 03'
    IFSE [MOVE][DL]   ICBYTE 17'
    IFSE [MOVE][L]    ICBYTE 14'
    IFSE [MOVE][UL]   ICBYTE 16'
TERMIN

IFN %%BYTS,    %%WORD
    ESCAPE

.WALGN
.BYTE

%FRLTH==.-%FRLOC
%%.==.

IF2,{
LOC FRGMTS+%FRGMTS
    -%FRLTH,,%FRLOC-1

LOC %%.
%FRGMTS==%FRGMTS+1
}
TERMIN


IF1,{
    $FRGMTS==0					;have yet to define any fragments
    %FRGMTS==0
}

;Definition of The Fragments

FRAGMENT [U,U,U,U,ON	DR,DR,DR,DR
	  DL,DL,DL,DL	UL,UL,UL,UL
	  UR,UR,UR,UR]


;Fragment Defintions Tables

FRGMTS:	BLOCK $FRGMTS				;contains display pointers for fragments
