189 lines
6.0 KiB
Plaintext
189 lines
6.0 KiB
Plaintext
WILLIAMS Z-SYSTEM OBJECT DISPLAY UTILITY
|
||
DISPLAY VERSION 1.0 6/26/87 WARREN B. DAVIS
|
||
|
||
G E N E R A L D E S C R I P T I O N
|
||
_____________________________________
|
||
|
||
The routines comprising DISPLAY.ASM are designed to allow the creation
|
||
and maintenance of an object list. Normally, a process would create an
|
||
object block giving it a position and velocity and control flags and the
|
||
DISPLAY routine would take care of refreshing the image every tick.
|
||
The DISPLAY routine would also take care of the tedious computations
|
||
involving clipping and flipping. A Z position is included which is used
|
||
(along with the Y position) to prioritize objects.
|
||
|
||
Animation can be controlled by the creating process or can be automatic.
|
||
|
||
The DISPLAY routine should be called from within the end-of-screen interrupt
|
||
routine. Version 1.0 blows out all images on the screen at once with
|
||
no beam avoidance or mid-screen interrupts.
|
||
|
||
|
||
D A T A S T R U C T U R E
|
||
___________________________
|
||
|
||
The routine "OINIT" initializes the two object linked lists, active and free.
|
||
Initially all object blocks linked onto the free list; the active list is null.
|
||
The ram location "OFREE" points to the address of the first object block
|
||
on the free list; the ram location "OBJLST" points to the first cell on the
|
||
active list (00000000H=null pointer, end of list).
|
||
|
||
When an object block is added to the list, it is inserted based on its
|
||
priority (which is the 32 bit quantity Z:Y).
|
||
|
||
*
|
||
* GLOBAL VARIABLES
|
||
*
|
||
.BSS OFREE,32 ; pointer to free object block
|
||
.BSS OBJLST,32 ; POINTER TO ACTIVE OBJECT LIST
|
||
.BSS OBJSTR,NOBJ*OBSIZ ; PROCESS STORE ALLOCATION
|
||
*
|
||
* DATA STRUCTURE
|
||
*
|
||
OLINK .SET 0 ; Link to next object block 16 bits
|
||
OXVAL .set 20h ; To be used as a 32 bit quantity (XPOS:XFRAC)
|
||
OXFRAC .set 20h ; Fractional portion of X position 16 bits
|
||
OXPOS .set 30h ; Integer portion of X position 16 bits
|
||
OYVAL .set 40h ; 32 bit quantity (YPOS:YFRAC)
|
||
OYFRAC .set 40h ; Fractional portion of Y position 16 bits
|
||
OYPOS .SET 50h ; Integer portion of Y position 16 bits
|
||
OPRIO .set 50h ; Z:Y forms priority
|
||
OZPOS .SET 60h ; Z position of object 16 bits
|
||
OFLAGS .set 70h ; Flags (bits 0 - 5 mimic DMA CONTROL) 16 bits
|
||
OXVEL .set 80h ; X Velocity 32 bits
|
||
OYVEL .set 0A0h ; Y Velocity 32 bits
|
||
OWSTRT .set 0C0h ; Upper left of object's window 32 bits
|
||
OWEND .set 0E0H ; Lower rt of object's window 32 bits
|
||
OIMG .set 100h ; Pointer to image data table 32 bits
|
||
OCONST .set 120h ; Constant color if flag set 16 bits
|
||
OANITIM .set 130h ; Animation Time in Ticks (optional) 8 bits
|
||
OANICNT .set 138h ; Animation Counter (optional) 8 bits
|
||
OANITAB .set 140h ; Pointer to animation table (optional) 32 bits
|
||
OANIOFF .set 160H ; offset from start of anitab 16 bits
|
||
|
||
OBSIZ .SET 1C0H ; Object Block Size = 16 WORDS
|
||
NOBJ .SET 256 ; 256 POSSIBLE OBJECTS TO DISPLAY
|
||
|
||
|
||
Notes:
|
||
1) The first few words after the link along with their offsets are...
|
||
|
||
OXFRAC(20h), OXPOS(30h), OYFRAC(40h), OYPOS(50h) and OZPOS(60h)
|
||
|
||
These are all 16 bit quantities. If you read 32-bits at a chunk,
|
||
use the alternate offset name which is more descriptive of the
|
||
long word meaning.
|
||
|
||
OXVAL(20h), OYVAL(40h) and OPRIO(50h)
|
||
|
||
2) The OFLAGS word consists of the DMA CONTROL flags plus
|
||
the following...
|
||
|
||
ANIM - if 1, use object block animation
|
||
|
||
NODISP - if 1, object is maintained in list and its velocity
|
||
changed, but is not displayed.
|
||
|
||
NOMOV - if 1, object's position is not modified regardless of
|
||
velocity values
|
||
|
||
|
||
|
||
A D D I N G A N E W O B J E C T
|
||
_______________________________
|
||
|
||
There are two ways to add an object. You can ...
|
||
|
||
1) Get a free block (GETOBJ), stuff the necessary information, then
|
||
insert it. (INSOBJ)
|
||
|
||
OR
|
||
|
||
2) set up some parameters in registers and call ADDOBJ.
|
||
|
||
GETOBJ has no input parameters and returns the free block in A0.
|
||
If no blocks are available, it returns with the Z flag set.
|
||
|
||
INSOBJ needs A0 = a ptr to an object block with at least the Z
|
||
and Y positions stuffed.
|
||
|
||
ADDOBJ needs a1 = WEND
|
||
a2 = WSTART
|
||
a3 = YVEL
|
||
a4 = XVEL
|
||
a5 = FLAGS : ZPOS
|
||
a6 = YPOS : YFRAC
|
||
a7 = XPOS : XFRAC
|
||
Upon returning, A0 points to the new block. If none are available,
|
||
the Z flag is set.
|
||
|
||
|
||
Examples: Method 1
|
||
|
||
CALLA GETOBJ
|
||
movi A_Z_POS,a10,W
|
||
move a10,*a0(OZPOS)
|
||
movi A_Y_POS,a10,L ; a 32 bit quantity
|
||
move a10,*a0(OYVAL),L
|
||
CALLA INSOBJ
|
||
movi SOME_CONTROL_WORD,a10
|
||
move a10,*a0(OFLAGS)
|
||
etc.
|
||
|
||
|
||
Method 2
|
||
|
||
movi SOME_X_POS,a7
|
||
movi SOME_Y_POS,a6
|
||
movi SOME_CONTROL_WORD,a5
|
||
sll 16,a5
|
||
addk A_Z_POS,a5
|
||
movi SOME_X_VEL,a4
|
||
movi SOME_Y_VEL,a3
|
||
movi SOME_WINDOW_START,a2
|
||
movi SOME_WINDOW_END,a1
|
||
callA ADDOBJ
|
||
|
||
|
||
A N I M A T I O N
|
||
-----------------
|
||
|
||
If the ANIM flag is set, you must set up the block for animation.
|
||
The parameters are...
|
||
|
||
OANITIM - number of ticks of each frame in the table
|
||
OANITAB - animation table containing pointers to img tables.
|
||
( 0 indicates end of table )
|
||
OANICNT - counter which is reloaded with ANITIM when it reaches 0
|
||
OANIOFF - difference between current location in ANITAB and the
|
||
beginning of ANITAB.
|
||
|
||
Initially, OANITIM and OANITAB must be set to the desired values.
|
||
OANICNT is 1 and OANIOFF is 0.
|
||
|
||
If ANIM is not set, a pointer to the img table for the static image
|
||
to be displayed must be placed in OIMG.
|
||
|
||
|
||
|
||
|
||
O B J E C T B L O C K D E L E T I O N
|
||
-----------------------------------------
|
||
|
||
The routine "DELOBJ" removes an object from the list. The pointer to the
|
||
block is assumed to be in a0
|
||
|
||
|
||
|
||
P O S S I B I L I T I E S
|
||
--------------------------
|
||
|
||
An object is deleted when it goes offscreen.
|
||
|
||
An object is deleted when it's velocity is zero.
|
||
|
||
An object is wrapped around when it goes offscreen.
|
||
|
||
All objects share the same window for clipping.
|
||
|
||
|