Technology sprites - Part 3: Format of sprites.

ZX Forum #04
      These different Sprite


   The time has come to deal with
formats sprites and methods
store them. We are with you most of the sprites found by
Search sprites and only one -
by searching for characters. From
What we can conclude - non-character storage format is more 
convenient than a character. To understand what their 
differences, let's look at the format in which they are stored 
in memory. For example, take the sprite size

2 familiarity in length and 1 in height:


          1 byte 2 bytes 1 byte 9 byte

          3 bytes 4 bytes 2 bytes 10 bytes

          5 byte 6 byte 3 bytes 11 bytes

          7 bytes 8 bytes 4 bytes 12 bytes

          9 bytes 10 bytes 5 bytes 13 bytes

         11 bytes 12 bytes 6 bytes 14 bytes

         13 bytes 14 bytes 7 bytes 15 bytes

         15 bytes 16 bytes 8 bytes 16 bytes


             non-character character


   If you look closely at the picture, you will see that
character sprite is stored in memory as a font your computer, 
then is in the form of a set of characters that are printed on 
the screen in sequence. These sprites can print a simple 
operator BASIC PRINT, if before that point in

variable, which stores the address of the font, the address of 
our sprite minus 256 bytes. In machine Codes can use the 
command RST # 10. The basic work Printing sprites we shift on 
ROM computer and it would seem, it's good. But such spraty very 
slowly printed on the screen, and if your program a lot of 
moving objects, will become very slow noticeable. This format 
is suitable Print static or low

moving sprites, such as in the program KRAKOUT. The logs we 
could see and excellent from those used in the ROM of the 
principles print, which work much faster, but still not fast 
enough. 

   With regard to non-character
format sprites, here you
ROM does not work, and a program for
Print You will have to create
themselves, but this method of storage
Sprite provides optimum speed for printing.

   There is another character format store sprites
which is even more sluggish,
than the previous one. I would not
dwell on it, but this
format advocated in the "ZX" Revue "(individual correspondents)
and in an interesting book
by "Peter" How to write a play
in assembler. "

   Let's look at this format.

   The method is based on the fact that empty familiarity 
(which can be seen dotted line) are ignored and a sprite not 
saved. This saves a few bytes, but brings in

procedure for printing complexity in its
organization, and complexity in the description of the sprite. 
Look how it is stored in memory:


TITLE:

DATA 26 (of familiarity in

         sprite).
DATA 0,0,7,0,1,7,0,4,7,0,5,7

         (First row familiarity)
DATA 1,0,7,1,1,7,1,2,7,1,3,7

         and so on.

DATA.


   Further data come from familiarity in
type font.


   A description of each familiarity, in addition to its data, 
is given another 3 bytes: the first - the coordinate Y, which 
is measured from the upper left corner, the second - the X, 
which is counted as from the upper left corner, and the third 
byte - attributes (ink, paper, bright,

flash in one). In our case
let them remain four familiarity, and
sprite occupies in the memory 287
byte, whereas if we
saved it in the form of non-character sprite, it would occupy
240 (although we did not save empty familiarity) bytes. Hence
Conclusion: The savings can be achieved only when a large 
number of empty familiarity that is extremely rare, but the 
printing process much more complicated. 

   Perhaps there is still any
Format sprites, but I do not
met, and we proceed to
Review of masks.