home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 18 / 018.d81 / t.sprites.128 < prev    next >
Text File  |  2022-08-26  |  5KB  |  305 lines

  1.  
  2.       128 SPRITES AND UTILITIES
  3.       *************************
  4.  
  5.  
  6. Written by:  Louis F. Sander
  7.  
  8. Microcomputers Magazine, December 1985
  9. Page 46
  10.  
  11.  
  12.   In the 128, the memory locations
  13.  
  14. from 3584-4095 are reserved for eight
  15.  
  16. sprites, each using 64 bytes. These
  17.  
  18. locations hold only the shape of the
  19.  
  20. sprites; other attributes are
  21.  
  22. separately controlled by BASIC's
  23.  
  24. SPRITE statement. The eight sprites
  25.  
  26. are located as follows:
  27.  
  28. Sprite     Decimal      Hexidecimal
  29. ======    =========     ===========
  30.   1       3584-3647     $0E00-$0E3F
  31.   2       3648-3711     $0E40-$0E7F
  32.   3       3712-3775     $0E80-$0EBF
  33.   4       3776-3839     $0EC0-$0EFF
  34.   5       3840-3903     $0F00-$0F3F
  35.   6       3904-3967     $0F40-$0F7F
  36.   7       3968-4031     $0F80-$0FBF
  37.   8       4032-4095     $0FC0-$0FFF
  38.  
  39.  
  40.   Regardless of what is in the sprite
  41.  
  42. memory, the 128 treats it as a
  43.  
  44. sprite; therefore, it is up to you to
  45.  
  46. know which sprite has meaning. To see
  47.  
  48. what's in the sprite area at power
  49.  
  50. up, enter:
  51.  
  52. FORJ=1TO8:SPRITEJ,1,2
  53. MOVSPRJ,35*J,200:NEXT [RETURN]
  54.  
  55.  You have just made all eight sprites
  56.  
  57. white and printed them on the bottom
  58.  
  59. of the screen. Their shapes are
  60.  
  61. determined by whatever was in their
  62.  
  63. locations at the 128's power up. To
  64.  
  65. make them into squares, enter:
  66.  
  67.  
  68. FORJ=3584TO4095
  69. POKEJ,255:NEXT [RETURN]
  70.  
  71.  
  72.       SAVING AND LOADING SPRITES
  73. ======================================
  74.  
  75.  To save and load sprites to and from
  76.  
  77. disk, use the BSAVE and BLOAD
  78.  
  79. commands. To save your squares to
  80.  
  81. disk, enter:
  82.  
  83. BSAVE"SQUARES.SPR",B0,P3584
  84. TO P4096 [RETURN]
  85.  
  86.  Be sure to type it as shown; one of
  87.  
  88. the examples in your system guide
  89.  
  90. contains an error. Use the .SPR to
  91.  
  92. identify sprite files in the
  93.  
  94. directory. This identification is
  95.  
  96. important, because sprite files must
  97.  
  98. be BLOADed and not DLOADed which
  99.  
  100. causes them to crash.
  101.  
  102.      CONTROLLING THE SPRITES
  103. ======================================
  104.  
  105.  To turn your sprites on, use:
  106.  
  107. SPRITEx,1,z where x specifies the
  108.  
  109. sprite you are controlling and z is a
  110.  
  111. number from 1 to 16, corresponding to
  112.  
  113. the color you want the sprite to be.
  114.  
  115.  To turn off your sprite, enter:
  116.  
  117. SPRITEx,0 where x specifies the
  118.  
  119. sprite you wish to turn off.
  120.  
  121.  To move your sprite around, use the
  122.  
  123. MOVSPR statement. Since this
  124.  
  125. statement is complex, we will not
  126.  
  127. discuss it here. Refer to section 17
  128.  
  129. of your manual.
  130.  
  131.  
  132.          CREATING SPRITES
  133. ======================================
  134.  
  135.  To design your own sprites, you have
  136.  
  137. three options:
  138.  
  139.   1. Use SPRDEF, the built-in sprite
  140.      editor program.
  141.   2. Use the 128's high-resolution
  142.      graphics commands to create a
  143.      design on the screen, then use
  144.      the SSHAPE and SPRSAV commands
  145.      to turn it into a sprite.
  146.   3. Use the tried and true methods
  147.      that work with the 64.
  148.  
  149.  For a detailed description of SPRDEF
  150.  
  151. study pages 116-119 and page 293 in
  152.  
  153. your system guide. Keep in mind that
  154.  
  155. when SPRDEF says "saving" sprites, it
  156.  
  157. means storing them in memory.
  158.  
  159.  Pages 109-116 give examples of using
  160.  
  161. SSHAPE and SPRSAV, both are also
  162.  
  163. explained in section 17. However, in
  164.  
  165. these lines there is a minor bug that
  166.  
  167. causes the sprites to keep moving
  168.  
  169. even after you hit STOP/RESTORE. To
  170.  
  171. improve this program add these
  172.  
  173. lines:
  174.  
  175.  6 COLOR 1,8 : TRAP99
  176. 96 MOVSPR 1,0#0 : SPRITE 1,0
  177. 97 MOVSPR 2,0#0 : SPRITE 2,0
  178.  
  179.  For the 64 method, it is best to
  180.  
  181. study the 64's Programmer's Reference
  182.  
  183. Guide, plus the many articles that
  184.  
  185. have been written on sprites.
  186.  
  187.  
  188.              UTILITIES
  189. ======================================
  190.  
  191.   On Side 2 of this LOADSTRAR disk,
  192.  
  193. there are five useful tools for
  194.  
  195. managing your sprites. They are:
  196.  
  197. SPRITESEER.128; NUMBERS.BAS.128;
  198.  
  199. SPRITESAVER.128; HBARMULTI.128; and
  200.  
  201. VBARMULTI.128.
  202.  
  203.   SPRITESEER.128 displays stationary
  204.  
  205. sprites on the bottom of the screen
  206.  
  207. and allows you to manipulate their
  208.  
  209. attributes. At the top of the screen,
  210.  
  211. the program prints line 110, followed
  212.  
  213. by a line containing "RUN". On line
  214.  
  215. 110, set E=1 to expand the sprites in
  216.  
  217. the X and Y directions. To make them
  218.  
  219. multicolor, set M=1. If you want all
  220.  
  221. sprites to have the same color, then
  222.  
  223. change the third argument in the
  224.  
  225. SPRITE statement, on line 120, to
  226.  
  227. that color.
  228.  
  229.  NUMBER.BAS.128 makes and BSAVEs
  230.  
  231. sprites that are labeled with their
  232.  
  233. numbers. Very useful for testing
  234.  
  235. purposes.
  236.  
  237.  SPRITESAVER.128 lets you BSAVE all
  238.  
  239. the sprites, one sprite, or a
  240.  
  241. selected group of sprites. You answer
  242.  
  243. the prompts to specify which sprite
  244.  
  245. or group of sprites.
  246.  
  247.  HBARMULTI.128 creates and saves
  248.  
  249. sprites which, in Multicolor mode,
  250.  
  251. appear as flags with horizontal bars
  252.  
  253. in three colors: sprite color;
  254.  
  255. Multicolor 1; and Multicolor 2. If
  256.  
  257. you are familiar with the literature
  258.  
  259. on sprites then you will understand
  260.  
  261. the use for such a tool. If not, I
  262.  
  263. urge you to delve into it.
  264.  
  265.  VBARMULTI.128 does similiar to
  266.  
  267. HBARMULTI.128 except that the bars
  268.  
  269. are vertical instead of horizontal.
  270.  
  271. In both of these programs, if you are
  272.  
  273. in single-color mode these sprites
  274.  
  275. will have quite a different
  276.  
  277. appearance.
  278.  
  279.  
  280.    This program is copyrighted by
  281.  
  282. Commodore magazine.  All rights to it
  283.  
  284. are reserved.  LOADSTAR has relieved
  285.  
  286. you from the burden of keying in this
  287.  
  288.     program.  For more complete
  289.  
  290. information about this program, refer
  291.  
  292.    to the December 1985 issue of
  293.  
  294.      Microcomputers Magazine.
  295.  
  296.  
  297.  
  298. >Files used: SPRITESEER.128
  299.              NUMBER.BAS.128
  300.              SPRITESAVER.128
  301.              HBARMULTI.128
  302.              VBARMULTI.128
  303.  
  304. ---------< end of article >-----------
  305.