home *** CD-ROM | disk | FTP | other *** search
/ Global Amiga Experience / globalamigaexperience.iso / compressed / development / heliosdemodisk3.dms / heliosdemodisk3.adf / Source / AttachedHSpriteFromSCtrl.src < prev    next >
Text File  |  1995-01-24  |  18KB  |  675 lines

  1.  
  2.   \ ***********************************************************
  3.   \
  4.   \     ATTACHED HARDWARE SPRITE FROM SOFTWARE SPRITE DEMO
  5.   \
  6.   \ ***********************************************************
  7.   \
  8.   \ This code demonstrates how to create an attached hardware
  9.   \ sprite using imagery derived from a software sprite structure.
  10.   \
  11.   \ The software sprite used for the (8-colour) gun turret is also
  12.   \ used as the source of the attached hardware sprite imagery.
  13.   \
  14.   \ Notice that the process of getting a sixteen colour image from
  15.   \ an eight colour bitmapped object is perfectly "legal" but will
  16.   \ usually (as in this case) result in distorted colour rendition.
  17.   \
  18.   \ ***********************************************************
  19.  
  20.  
  21.   \ ***********************************************************
  22.   \ Re-initialise HeliOS dictionary to standard CORE vocabulary
  23.   \ ***********************************************************
  24.  
  25.   \ This should always be used at the start of any program which
  26.   \ is to be repeatedly recompiled.
  27.  
  28.   FORGET **CORE**
  29.  
  30.   \ *************************
  31.   \ Load include symbol files
  32.   \ *************************
  33.   \
  34.   \ These "include files" are pre-compiled (for speed) versions of the
  35.   \ Amiga includes and the Helios system includes.
  36.   \
  37.   \ Uncomment the lines below for standalone compilation, but otherwise
  38.   \ it is better to set these include files from the Helios Forth menus
  39.  
  40.   AMIGAINCLUDE Helios:Amiga_Include
  41.   USERINCLUDE  Helios:Helios_Include
  42.  
  43.   \ ****************************************
  44.   \ Create display imagery file name strings
  45.   \ ****************************************
  46.  
  47.   \ These files are ordinary IFF's (and may be "PowerPacked" if required)
  48.   \
  49.   \ The pictures here will be loaded into each of the display BitMaps.
  50.   \
  51.  
  52.   $CONSTANTL Slice1Pic $Helios:Source/Data/Pic1$
  53.  
  54.   \ **************************************
  55.   \ Create display configuration constants
  56.   \ **************************************
  57.   \
  58.   \ Collect all "display-specific" parameters here and generate "named"
  59.   \ constants which make references easier than using numeric values.
  60.   \
  61.   \ Collecting these together here makes it easier to adjust things at any
  62.   \ time without having to search source code to replace values individually.
  63.   \
  64.  
  65.  
  66.   256                      CONSTANT DisplayHeight      \ Full PAL display
  67.   320                      CONSTANT DisplayWidth       \ Lores display
  68.   44                       CONSTANT DisplayTopLine     \ Display start
  69.  
  70.   DisplayWidth             CONSTANT Slice1Width        \ Lores width
  71.   DisplayWidth 32 +        CONSTANT Slice1RasterWidth  \ Raster=SWidth+32
  72.   DisplayHeight            CONSTANT Slice1Height       \ Slice height
  73.   DisplayHeight 32 +       CONSTANT Slice1RasterHeight \ Slice Raster=DHgt+32
  74.   0                        CONSTANT Slice1Mode         \ Lores
  75.   3                        CONSTANT Slice1Planes       \ Slice bitplanes
  76.  
  77.   \ The calculation below takes the number of bitplanes and calculates
  78.   \ how many colours this represents.
  79.   \
  80.   \ One bitplane gives two colours.
  81.   \
  82.   \ Each additional bitplane multiplies the number of colours by two.
  83.   \
  84.   \ Performing a single LSL operation on any number multipies by 2, so we
  85.   \ have a quick method of multiplying by two for our colour calculation.
  86.   \
  87.   \ In this case, we need "2 to the power 3", which is 2*2*2=8.
  88.   \
  89.   \ e.g.                              2*2*2
  90.   \                                   ^ ^ ^
  91.   \                                   Total number of planes = 3
  92.   \
  93.   \
  94.   \ So, we take the first value two
  95.   \
  96.   \ e.g.                              2*2*2
  97.   \                                   ^
  98.   \                                  Initial start value of 2
  99.   \
  100.   \ and we now need to multiply it by two "the_number_of_planes minus_one"
  101.   \ more times.
  102.   \
  103.   \ e.g.                              2*2*2
  104.   \                                     ^ ^
  105.   \                                     Total planes minus one
  106.   \
  107.   \
  108.   \ So, Number of colours = 2 operated on by LSL NumberOfPlanes-1 times.
  109.   \
  110.  
  111.   2 Slice1Planes 1- LSL    CONSTANT Slice1Colours      \ A-slice colours
  112.  
  113.   \ ***********************
  114.   \ Error handling routines
  115.   \ ***********************
  116.  
  117.   \ This error handler allows all errors to be routed via a comprehensive
  118.   \ sequential closedown routine, which is associated with the HeliOS
  119.   \ system error handler word ERROR".
  120.   \
  121.   \ When ERROR" senses an error, it prints an associated error message
  122.   \ delimited by '"' characters, and then closes everything down using the
  123.   \ routine CLOSEDOWN below which you have supplied.
  124.   \
  125.   \ This simplifies errors checks to the use of a single word, ERROR", which
  126.   \ displays a text message and closes eveything down.
  127.   \
  128.  
  129.   0 VARIABLE (CLOSEDOWN)
  130.  
  131.   : ?CLOSEDOWNERROR
  132.  
  133.   IF
  134.     CR
  135.     CR
  136.     TYPE
  137.     CR
  138.     CR
  139.     ." Press <Space> to quit!"
  140.     CR
  141.     CR
  142.     WAITSPACE
  143.     (CLOSEDOWN) @EXECUTE
  144.     QUIT
  145.   ELSE
  146.     DDROP
  147.   THEN
  148.   ;
  149.  
  150.   LATESTCFA VARIABLE ERROR1
  151.  
  152.   \ ****************************************
  153.   \ Create display pointer storage variables
  154.   \ ****************************************
  155.  
  156.   \ Here we create a set of "pointers", initially set to a "null" value.
  157.   \
  158.   \ These "pointers" are set up as "long addresses" when various components
  159.   \ of the display system are allocated and initialised.
  160.   \
  161.   \ Note that initially these are all set to zero, and we clear them back
  162.   \ to zero when we de-allocate the associated resource.
  163.   \
  164.   \ These DPOINTERs are all initially set to "null" by using 'D0'.
  165.   \
  166.   \ When we allocate memory or Amiga system resources in the program at
  167.   \ run-time, these pointers are updated to contain the 32-bit address
  168.   \ of the newly allocated resource.
  169.   \
  170.   \ Subsequently the symbolic DPOINTER name can be used in your code to
  171.   \ represent the associated address.
  172.  
  173.   D0 DPOINTER Display1             \ Main Display structure pointer
  174.   D0 DPOINTER Slice1               \ Slice 1 Slice structure pointer
  175.  
  176.   D0 DPOINTER Slice1_ColorMap      \ Slice 1 ColourMap structure pointer
  177.  
  178.   D0 DPOINTER Slice1_RasInfo       \ Slice 1 RasInfo structure pointer
  179.  
  180.   D0 DPOINTER Slice1_BMap          \ Slice 1 BitMap structure pointer
  181.  
  182.   D0 DPOINTER Slice1_SliceControl  \ Slice 1 SliceControl structure pointer
  183.  
  184.   \ *************
  185.   \ Colour tables
  186.   \ *************
  187.  
  188.   \ Each colour entry requies 2 bytes of storage space
  189.  
  190.   CREATEL Slice1_ColorTable        \ Create longword pointer to table
  191.   Slice1Colours 2* 0 ALLOTFILL     \ Allocate Slice1 colours * 2 bytes
  192.  
  193.  
  194.   \ *************************************
  195.   \ Copper strip for graduated background
  196.   \ *************************************
  197.  
  198.   D0 DVARIABLE Copper              \ 32-bit CopperList pointer store
  199.   D0 DVARIABLE CopperLength        \ 32-bit CopperList length store
  200.  
  201.   : AddCopper                      \ Add custom copper list to display
  202.  
  203.   Display1                         \ We are adding CopperList to Display1
  204.   Copper D@
  205.   ADDCOPPERSTRIP
  206.   SORTSTRIPTABLE
  207.   LINKSTRIPS
  208.   DDROP
  209.   ;
  210.  
  211.   : RemCopper                      \ Remove custom copper list from display
  212.  
  213.   Display1                         \ We are removing CopperList from Display1
  214.   Copper D@
  215.   REMCOPPERSTRIP
  216.   LINKSTRIPS
  217.   DDROP
  218.   ;
  219.  
  220.   : Create_Copper
  221.  
  222.   COPPERSTART
  223.   Copper D!
  224.   0 [ DECIMAL ]  45 [ HEX ] FFFE COPPERWAIT  DROP   0100 18E COPPERMOVE  DROP
  225.   0 [ DECIMAL ]  60 [ HEX ] FFFE COPPERWAIT  DROP   0200 18E COPPERMOVE  DROP
  226.   0 [ DECIMAL ]  75 [ HEX ] FFFE COPPERWAIT  DROP   0300 18E COPPERMOVE  DROP
  227.   0 [ DECIMAL ]  90 [ HEX ] FFFE COPPERWAIT  DROP   0400 18E COPPERMOVE  DROP
  228.   0 [ DECIMAL ] 105 [ HEX ] FFFE COPPERWAIT  DROP   0500 18E COPPERMOVE  DROP
  229.   0 [ DECIMAL ] 120 [ HEX ] FFFE COPPERWAIT  DROP   0600 18E COPPERMOVE  DROP
  230.   0 [ DECIMAL ] 135 [ HEX ] FFFE COPPERWAIT  DROP   0700 18E COPPERMOVE  DROP
  231.   0 [ DECIMAL ] 150 [ HEX ] FFFE COPPERWAIT  DROP   0800 18E COPPERMOVE  DROP
  232.   0 [ DECIMAL ] 165 [ HEX ] FFFE COPPERWAIT  DROP   0900 18E COPPERMOVE  DROP
  233.   0 [ DECIMAL ] 180 [ HEX ] FFFE COPPERWAIT  DROP   0A00 18E COPPERMOVE  DROP
  234.   0 [ DECIMAL ] 195 [ HEX ] FFFE COPPERWAIT  DROP   0B00 18E COPPERMOVE  DROP
  235.   0 [ DECIMAL ] 210 [ HEX ] FFFE COPPERWAIT  DROP   0C00 18E COPPERMOVE  DROP
  236.   0 [ DECIMAL ] 225 [ HEX ] FFFE COPPERWAIT  DROP   0D00 18E COPPERMOVE  DROP
  237.   0 [ DECIMAL ] 240 [ HEX ] FFFE COPPERWAIT  DROP   0E00 18E COPPERMOVE  DROP
  238.   0 [ DECIMAL ] 255 [ HEX ] FFFE COPPERWAIT  DROP   0F00 18E COPPERMOVE  DROP
  239.   [ DECIMAL ]
  240.   COPPEREND
  241.   CopperLength D!   Copper D!
  242.   ADDCOPPER
  243.   ;
  244.  
  245.   : Free_Copper                  \ Closes down and frees copperlist memory
  246.  
  247.   RemCopper
  248.   Copper D@ FREEMEMORY
  249.   ;
  250.  
  251.   \ ***********************************
  252.   \ Create Display and Slice structures
  253.   \ ***********************************
  254.  
  255.   \ This routine simply makes blank structures, which then need to be
  256.   \ initialised later (in the CREATE_DISPLAY routine).
  257.  
  258.   : CREATE_DSLICES
  259.  
  260.   DS_SIZEOF MAKESTRUCTURE Display1 MAKEPOINTER  \ Main "Display" structure
  261.  
  262.   SL_SIZEOF MAKESTRUCTURE Slice1   MAKEPOINTER  \ Display "Slice" structure
  263.   ;
  264.  
  265.   : FREE_DSLICES
  266.  
  267.   Slice1    DDUP FREEMEMORY   CLEARPOINTER
  268.   Display1  DDUP FREEMEMORY   CLEARPOINTER
  269.   ;
  270.  
  271.   \ ******************************
  272.   \ Create RasInfo structures etc.
  273.   \ ******************************
  274.  
  275.   : CREATE_RASINFO
  276.  
  277.   \ First allocate and initialise complete RasInfo structures.
  278.   \
  279.   \ This routine automatically allocates all BitMaps etc.
  280.   \
  281.  
  282.   Slice1RasterWidth Slice1RasterHeight Slice1Planes  OPENRASINFO
  283.   DFLAG0= ERROR" Fail: RasInfo1"
  284.   Slice1_RasInfo MAKEPOINTER
  285.  
  286.   \ Set invisible area "sprite margins" for slice RasInfo
  287.  
  288.   16              Slice1_RasInfo         ri_RxOffset    INDEX!L
  289.   16              Slice1_RasInfo         ri_RyOffset    INDEX!L
  290.  
  291.   \ Store BitMap pointer - often useful for later reference
  292.  
  293.   Slice1_RasInfo  ri_BitMap INDEXD@L Slice1_BMap MAKEPOINTER
  294.   ;
  295.  
  296.   : FREE_RASINFO
  297.  
  298.   Slice1_RasInfo   DDUP CLOSERASINFO   CLEARPOINTER
  299.   ;
  300.  
  301.   \ ********************************
  302.   \ Create Display/Slice Copperlists
  303.   \ ********************************
  304.  
  305.   \ This function builds the main display copperlist by:
  306.   \
  307.   \ 1. Initialising the Slice data structure
  308.   \ 2. Calling MAKECOPSTRIP for the slice, to build a copperlist
  309.   \ 3. Calling MAKEDISPLAY to build the master Display copperlist
  310.   \
  311.  
  312.   : CREATE_DISPLAY
  313.  
  314.   \ First initialise main display structures
  315.  
  316.   Slice1                           Display1  DS_Slice     INDEXD!L
  317.  
  318.   Slice1Width                      Slice1    SL_DWidth    INDEX!L
  319.   Slice1Height                     Slice1    SL_DHeight   INDEX!L
  320.   DisplayTopLine                   Slice1    SL_DyOffset  INDEX!L
  321.   Slice1_RasInfo                   Slice1    SL_RasInfo   INDEXD!L
  322.   Slice1_ColorMap                  Slice1    SL_ColorMap  INDEXD!L
  323.   Slice1Mode                       Slice1    SL_Modes     INDEX!L
  324.  
  325.   \ Generate copper list information for each of the display slices
  326.  
  327.   Slice1 MAKECOPSTRIP
  328.   D0= ERROR" Fail: Slice1CopStrip"
  329.  
  330.   \ Make display
  331.  
  332.   Display1 MAKEDISPLAY
  333.   D0= ERROR" Fail: Display1"
  334.   ;
  335.  
  336.   : FREE_DISPLAY
  337.  
  338.   Display1                 FREEDISPLAY
  339.   Slice1                   FREECOPSTRIP
  340.   ;
  341.  
  342.   \ ********************************************************
  343.   \ Create SliceControl structures for double buffered slice
  344.   \ ********************************************************
  345.  
  346.   \ SliceControl structures are used to control any slices which perform
  347.   \ mapping or scrolling functions, or which require double or triple
  348.   \ playfield buffering.
  349.   \
  350.   \ In this case we have one slice which does not scroll, is not mapped,
  351.   \ but IS double buffered.
  352.   \
  353.  
  354.   : CREATE_SLICECONTROL
  355.  
  356.   \ Make SliceControl for double buffered bitmap display
  357.  
  358.   Slice1  0 0 MAKESLICECONTROL
  359.   DFLAG0= ERROR" Fail: SliceControl1"
  360.   Slice1_SliceControl MAKEPOINTER
  361.  
  362.   \ Install slice controls into HeliOS display control system
  363.  
  364.   Slice1_SliceControl  INSTALLSLICECONTROL
  365.   ;
  366.  
  367.   : FREE_SLICECONTROL
  368.  
  369.   CLEARSLICECONTROLS
  370.   Slice1_SliceControl  CLOSESLICECONTROL
  371.   ;
  372.  
  373.   \ These routines load an IFF picture into supplied BitMap, and correctly
  374.   \ initialises the supplied ColorTable.
  375.   \
  376.   \ The ColorTable is then used to create an initialised ColorMap structure.
  377.   \
  378.  
  379.   : CREATE_IMAGERY
  380.  
  381.   Slice1_BMap
  382.   Slice1_ColorTable
  383.   Slice1Pic
  384.   10 2 DOSLIB                        \ Call to internal HeliOS library
  385.   10 <> ERROR" Fail: Slice1Pic"
  386.  
  387.   Slice1_ColorTable  Slice1Colours MAKECOLORMAP  \ Allocate ColourMap
  388.   DFLAG0= ERROR" Fail: Slice1ColorMap"
  389.   Slice1_ColorMap MAKEPOINTER
  390.   ;
  391.  
  392.   : FREE_IMAGERY
  393.  
  394.   Slice1_ColorMap  DDUP FREECOLORMAP  CLEARPOINTER
  395.   ;
  396.  
  397.   \ ***********
  398.   \ Sprite Demo
  399.   \ ***********
  400.  
  401.   \ *********************
  402.   \ Sprite Demo constants
  403.   \ *********************
  404.  
  405.   \ Store the gun speed as a CONSTANT
  406.  
  407.   4  CONSTANT GunSpeed             \ Speed of Gun movement
  408.  
  409.   \ *************************************************
  410.   \ Create sprite demo pointers and storage variables
  411.   \ *************************************************
  412.  
  413.   D0 DPOINTER GunSpriteSet         \ Gun sprite image
  414.  
  415.   \ ***************************
  416.   \ User input response routine
  417.   \ ***************************
  418.  
  419.   : MoveGun
  420.  
  421.   RAWKEY @ 78 =
  422.   JOY1LEFTRIGHT 0>
  423.   OR
  424.   IF
  425.      GunSpeed
  426.      19 320
  427.      GunSpriteSet 8. D+ D@L SpriteCtrl_XPos D+
  428.      LIMIT+!L
  429.   ELSE
  430.     RAWKEY @ 79 =
  431.     JOY1LEFTRIGHT 0<
  432.     OR
  433.     IF
  434.      GunSpeed NEGATE
  435.      19 320
  436.      GunSpriteSet 8. D+ D@L SpriteCtrl_XPos D+
  437.      LIMIT+!L
  438.     THEN
  439.   THEN
  440.   ;
  441.  
  442.   \ ********************
  443.   \ Create sprite object
  444.   \ ********************
  445.  
  446.   : CREATE_SPRITE
  447.  
  448.   \ ----------
  449.   \ Gun sprite
  450.   \ ----------
  451.  
  452.   Slice1_BMap
  453.   154 272
  454.   13 15
  455.   1
  456.   MAKESPRITESET
  457.   DFLAG0= ERROR" Fail: Gun SpriteSet"
  458.   GunSpriteSet MAKEPOINTER
  459.  
  460.   GunSpriteSet 8. D+ D@L
  461.   DDUP  SpriteCtrl_XPos D+       170 -ROT !L
  462.         SpriteCtrl_YPos D+       239 -ROT !L
  463.  
  464.   Slice1_SliceControl   GunSpriteSet    INITSPRITESET
  465.   ;
  466.  
  467.   : FREE_SPRITE
  468.  
  469.   GunSpriteSet    DDUP FREESPRITESET CLEARPOINTER
  470.   ;
  471.  
  472.   \ ***********************************
  473.   \ Create hardware sprite colour table
  474.   \ ***********************************
  475.  
  476.   \ This colour table simply specifies a few arbitrary colours which we
  477.   \ will then set into colour registers 16 to 31
  478.  
  479.   CREATEL MySpriteColourTable
  480.  
  481.   HEX
  482.  
  483.   0000 ,  \ Colour 16
  484.   0FFF ,  \ Colour 17
  485.   0F00 ,  \ Colour 18
  486.   0222 ,  \ Colour 19
  487.   0CC0 ,  \ Colour 20
  488.   0555 ,  \ Colour 21
  489.   0666 ,  \ Colour 22
  490.   0009 ,  \ Colour 23
  491.   0666 ,  \ Colour 24
  492.   0555 ,  \ Colour 25
  493.   0444 ,  \ Colour 26
  494.   0333 ,  \ Colour 27
  495.   0222 ,  \ Colour 28
  496.   0111 ,  \ Colour 29
  497.   00F0 ,  \ Colour 30
  498.   000F ,  \ Colour 31
  499.  
  500.   DECIMAL
  501.  
  502.   \ ***********************
  503.   \ Allocate pointer stores
  504.   \ ***********************
  505.  
  506.   D0 DPOINTER  MyHSpriteData1
  507.   D0 DPOINTER  MyHSpriteData2
  508.  
  509.   \ MAKEATTHSPRITE  ( - - - HSpriteData1(l), HSpriteData2(l) )
  510.   \                         or two 32-bit nulls for failure
  511.  
  512.   : MAKEATTHSPRITE
  513.  
  514.     1 2                       \ IDs
  515.     1                         \ Number of images
  516.     GunSpriteSet 8. D+ D@L    \ SpriteCtrl
  517.     MAKEATTHSPRITEBLOCK_SCTL  \ Make HSprite definition blocks
  518.   ;
  519.  
  520.   \ **********************
  521.   \ Set up hardware sprite
  522.   \ **********************
  523.  
  524.   \ First we set sprite colours 16 to 31
  525.   \ Then we create hardware sprite definition blocks
  526.   \ Then we install the hardware sprites
  527.  
  528.   : SetupHSprite
  529.  
  530.   Slice1 MySpriteColourTable 16 16 SETSLICECOLOURS
  531.  
  532.   MAKEATTHSPRITE
  533.   DFLAG
  534.   IF
  535.     MyHSpriteData2 MAKEPOINTER
  536.     MyHSpriteData1 MAKEPOINTER
  537.  
  538.     MyHSpriteData1 0 HSPRITE_INSTALL
  539.     MyHSpriteData2 1 HSPRITE_INSTALL
  540.     1 REPORTMOUSE
  541.     0 HELIOSMPOINTER
  542.     0
  543.   ELSE
  544.     DDDROP
  545.     1
  546.   THEN
  547.   ;
  548.  
  549.   \ **************************
  550.   \ Close down hardware sprite
  551.   \ **************************
  552.  
  553.   \ First we remove the hardware sprites
  554.   \ Then we de-allocate the sprite definitions
  555.  
  556.   : FREE_HSPRITE
  557.  
  558.   MyHSpriteData1 HSPRITE_REMOVE
  559.   MyHSpriteData2 HSPRITE_REMOVE
  560.  
  561.   MyHSpriteData2  DDUP FREEHSPRITEBLOCK  CLEARPOINTER
  562.   MyHSpriteData1  DDUP FREEHSPRITEBLOCK  CLEARPOINTER
  563.   ;
  564.  
  565.   \ ********************************
  566.   \ Display and move hardware sprite
  567.   \ ********************************
  568.  
  569.   \ Switch on mouse position reporting
  570.   \ Switch off the HeliOS mouse pointer image
  571.   \ Repeatedly set the sprite to the current mouse pointer position
  572.  
  573.   : TestHSprite
  574.  
  575.     0 MOUSEX MOUSEY 0 MyHSpriteData1 HSPRITE_PLACE
  576.     1 MOUSEX MOUSEY 0 MyHSpriteData2 HSPRITE_PLACE
  577.   ;
  578.  
  579.   \ *********************
  580.   \ Close down everything
  581.   \ *********************
  582.  
  583.   : CLOSEDOWN
  584.  
  585.   FREE_HSPRITE
  586.   FREE_SPRITE
  587.   FREE_COPPER
  588.   FREE_SLICECONTROL
  589.   FREE_DISPLAY
  590.   FREE_IMAGERY
  591.   FREE_RASINFO
  592.   FREE_DSLICES
  593.   RESETERROR"
  594.   ;
  595.  
  596.   LATESTCFA (CLOSEDOWN) !
  597.  
  598.   : TestDisplay          \ Start of program
  599.  
  600.   SCRCLR
  601.   CR
  602.   ."        **********************************************************"
  603.   CR 6 FPENSET
  604.   ."            ATTACHED HARDWARE SPRITE FROM SOFTWARE SPRITE DEMO"
  605.   CR 1 FPENSET
  606.   ."        **********************************************************"
  607.   CR
  608.   CR
  609.   ."        This code demonstrates how to create an attached hardware"
  610.   CR
  611.   ."        sprite with imagery derived from a software sprite structure."
  612.   CR
  613.   CR
  614.   ."        **********************************************************"
  615.   CR 6 FPENSET
  616.   CR
  617.   ."                  Press <Space> or <L-Mouse> to see Demo          "
  618.   CR 3 FPENSET
  619.   CR
  620.   ."         Use a Joystick to move the gun turret from left to right"
  621.   CR
  622.   CR
  623.   ."         Use mouse to move the hardware sprite around the screen"
  624.   CR
  625.   CR
  626.   ."        **********************************************************"
  627.   CR
  628.  
  629.   WAITSPACE
  630.  
  631.   SCRCLR
  632.  
  633.   ERROR1 SETERROR"       \ Redirect system errors to our routine ERROR1
  634.  
  635.   CREATE_DSLICES
  636.   CREATE_RASINFO
  637.   CREATE_IMAGERY
  638.   CREATE_DISPLAY
  639.   CREATE_SLICECONTROL
  640.   CREATE_COPPER
  641.   CREATE_SPRITE
  642.  
  643.   SetupHSPrite ERROR" Failed to open HSprite!"
  644.  
  645.   HeliOS_On
  646.  
  647.   GunSpriteSet 8. D+ D@L INSTALLSPRITE
  648.  
  649.   1 FrameRate !L
  650.  
  651.   Display1 SHOWDISPLAY
  652.  
  653.   BEGIN
  654.     WAITFRAME
  655.  
  656.     TestHSprite
  657.  
  658.     MoveGun
  659.  
  660.     ?TERMINAL 27 =
  661.   UNTIL
  662.  
  663.   -3 GunSpriteSet 8. D+ D@L SpriteCtrl_Flags INDEX!L
  664.  
  665.   5 DELAY
  666.  
  667.   HeliOS_Off
  668.  
  669.   0 REPORTMOUSE
  670.  
  671.   CLOSEDOWN
  672.   ;
  673.  
  674.   TestDisplay
  675.