home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI07.ARJ / ictari.07 / ASSEMBLY / SPRITES / SPR_INIT.DOC < prev    next >
Text File  |  1993-09-03  |  3KB  |  61 lines

  1. SUB-ROUTINE NAME        sprite_init
  2. BRIEF DESCRIPTION       Load sprite file and initialise table
  3. FILENAME                SPRITE.S
  4. OTHER RESOURCES
  5. LANGUAGE                Assembler (Devpac)
  6. AUTHOR                  Peter Hibbs
  7.  
  8. ENTRY PARAMETERS        'sprite_file' string holds pathname for file
  9.  
  10. EXIT PARAMETERS         (screen) holds screen start address
  11.                         (sprite_tab..) holds sprite look-up table
  12.                         (sprite_data..) holds sprite data
  13.                         (sprite_mask..) holds sprite mask data
  14.                         various registers changed
  15.                         d0.L=0 if file loaded OK or neg value if not
  16. DETAILS -
  17.  
  18. This routine should be called near  the  start  of the program and before
  19. any sprites are displayed. It fetches the start address of the screen and
  20. stores it in (screen).  It  then  loads  the  sprite  file data from disk
  21. (using the filename defined in the  sprite_file  string) and stores it in
  22. the 'sprite_data' buffer which should be defined  in the data area of the
  23. source code. Make sure the buffer is  large enough to store the file data
  24. and place the sprite data file in  the same directory as the program. The
  25. routine then generates a look-up table  of addresses for each sprite data
  26. block and automatically generates a mask data block for each sprite which
  27. is required by  the  sprite  display  routines.  A  mask_buffer should be
  28. defined which is one quarter the size of the data buffer, the sprite data
  29. requires 4 planes  whereas  the  mask  only  requires  one plane. Another
  30. buffer, sprite_tab, should also be defined  for the sprite look-up table,
  31. the size of this should be 16 times  the number of sprites in the file as
  32. each sprite block uses 16 bytes.  If  the  m_sprite routine is to be used
  33. another temporary buffer (spr_buffer)  should  also  be  defined, see the
  34. m_sprite data sheet for further information.
  35.  
  36. Although the programmer does not need to know the layout of this table to
  37. use the routine, the information is shown below for reference purposes.
  38.  
  39.         sprite 1        width of sprite in bytes        1 word
  40.                         height of sprite in lines       1 word
  41.                         x offset value                  1 word
  42.                         y offset value                  1 word
  43.                         sprite data address             1 longword
  44.                         sprite mask address             1 longword
  45.         sprite 2        as above
  46.         ..
  47.         sprite n        as above
  48.  
  49. On return from the routine, register  d0.L  should be tested for an error
  50. code which is  generated  by  the  file  handling  BIOS  calls.  If d0 is
  51. negative an error occurred, the negative  value will indicate the type of
  52. error. A typical example code is shown below -
  53.  
  54.                 bsr     sprite_init     set up table and buffers
  55.                 tst.l   d0              check for error
  56.                 bmi     error_label     branch if load error
  57.                 ..      ..
  58.  
  59. sprite_file     dc.b    'SPRITES.OBJ',0
  60.                 even
  61.