DESIGNING A SPRITE For design purposes, it is convenient to lay out the sprite on paper first. You can show the desired colors as numbers from 0 to 3. For example, the spaceship shown above might look like this: 0000122332210000 0001223333221000 0012223333222100 0001223333221000 0000122332210000 The next step is to convert the numbers 0-3 into binary numbers, which will be used to build the color descriptor words of the sprite data structure. The section below shows how to do this. BUILDING THE DATA STRUCTURE After defining the sprite, you need to build its data structure, which is a series of 16-bit words in a contiguous memory area.
Some of the words contain position and control information and some contain color descriptions. To create a sprite's data structure, you need to: o Write the horizontal and vertical position of the sprite into the first control word. o Write the vertical stopping position into the second control word. o Translate the decimal color numbers 0 - 3 in your sprite grid picture into binary color numbers. Use the binary values to build color descriptor (data) words and write these words into the data structure. o Write the control words that indicate the end of the sprite data structure. NOTE Sprite data, like all other data accessed by the custom chips, must be loaded into Chip RAM.
Be sure all of your sprite data structures are word aligned in Chip Memory. Table 4-1 shows a sprite data structure with the memory location and function of each word: - Sprite Hardware 101 -