•  Back 
  •  Line-A Function Reference 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  %About 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The ATARI Compendium
Author      : Scott Sanders / JAY Software
Version     : 1.25 (20/6/2003)
Subject     : Documentation
Nodes       : 1117
Index Size  : 32614
HCP-Version : 6
Compiled on : Atari
@charset    : UTF-8
@lang       : en
@default    : 
@help       : %About
@options    : +g -i -t4 +y +z
@width      : 100
View Ref-File$A00D - Draw Sprite                                                  Line-A

Function      Draw a 16x16 sprite on the screen.

Parameters    Prior to calling this function, four 68x00 registers must be
              initialized. D0 and D1 should contain the horizontal and
              vertical position respectively of the coordinates of the
              sprite to draw. This is relative to the 'hot spot' of the
              sprite as defined in the sprite definition block. A0 should
              contain a pointer to a sprite definition block defined as
              follows:

              Offset/Type     Meaning

              0x0000 (WORD)   X offset of 'hot spot'. This value is
                              subtracted from the value given in D0 to
                              yield the actual screen position of the
                              upper-left pixel.

              0x0002 (WORD)   Y offset of 'hot spot'. This value is
                              subtracted from the value given in D1 to
                              yield the actual screen position of the
                              upper-right pixel.

              0x0004 (WORD)   Format flag. This value specifies the mode
                              in which the mouse pointer will be drawn.
                              A value of 1 specifies 'VDI mode' whereas -1
                              specifies X-OR mode. The default is 1.

              0x0006 (WORD)   Background color of sprite.

              0x0008 (WORD)   Foreground color of sprite.

              0x000A          Sprite form data. The bitmap data consists
              (32 WORDs)      of two 16x16 rasters, one each for the mask
                              and data portion of the form. The data is
                              presented in interleaved format. The first
                              WORD of the mask portion is first, followed
                              by the first WORD of the data portion, and
                              so on.

              Register A2 is a pointer to a buffer which will be used to
              save the screen area where the sprite is drawn. The size of
              the buffer can be determined by the following formula:

                 ( 10 + ( VPLANES * 64 ) )

Example       ; Draw a sprite at ( 100, 100 ) whose data
Binding       ; is stored at spritedef with a valid save
              ; buffer at savebuf.

                 move.w   #100,d0        ; X position
                 move.w   #100,d1        ; Y position
                 move.l   #spritedef,a0  ; Sprite form
                 move.l   #savebuf,a2    ; Save buffer
                 .dc.w    $A00D

Caveats       Register A6 is destroyed as a result of this call.

Comments      In order to avoid the mouse form running into any sprites
              you draw, the mouse should be hidden before drawing and
              restored afterwards. It may also be advisable to call
              Vsync() prior to each call to avoid screen flicker.