Product specifications
Setting up the Sprite Attribute Table
The start address in VRAM of the sprite attribute table is determined by the contents
of VDP write only register 5, and is a fixed address. Given this fact and that there is a
proportional relationship between any sprite number and its position in the sprite
attribute table, it is easy to handle and manipulate sprites.
An important point to realise is that the contents of the sprite attribute table like any
other part of VRAM could assume any indeterminant value when the machine is
switched on and therefore must be cleared prior to use.
Clearing the sprite attribute table is not just a simple matter of setting each byte to
zero. If each byte is set to zero then all the sprites will have a location of 0,0 and will
all still be on screen when not active in the top left hand corner of the display.
It is far better to set the Y/X coords to 192,0 respectively which means that any non
active sprites will be hidden below the bottom border.
The hardware of the machine will service all sprites within the sprite attribute table,
including those which you may not be using. It is sometimes desirable to ‘lock off’ part
of the sprite attribute. This can be done by writing a 208 (Decimal) into the Y position
of the next sprite after the last sprite you wish to use.
If for example:
1. We were using 8 times 7 bit sprites
2. The first two shapes in the sprite generator table were a diamond and a square
in order
3. The sprite attribute table was located at £1C00 (Hex), 7K
4. We were using the VRAM I/O routines described in section 1
Then the routines to perform the following tasks are listed below.
1. Clear the sprite attribute table
2. Lock off all but the first two sprites within the sprite attribute table
3. Display :
a) A yellow diamond sprite in the top left hand corner of the screen
b) A blue circle sprite in the top right hand corner of the screen
;
; SPRITE – NO REGISTER SET-UP REQUIRED ON ETRY
AF,BC,DE AND HL REGISTERS AFFECTED ON EDIT
;
; USES TABLE VDTL (YELLOW DIAMOND TOP LEFT)
BCTR (BLUE CIRCLE TOP RIGHT)
;
; VARIABLES SATSAD
;
;
SPRITE: CALL CLRSPR ;Clear sprite attribute table
LD A,2 ;Lock off all but the first
;two sprites within the sprite
CALL BLKSPR ;attribute table