images/zoom.gif
images/stop.gif GAGS    v2.3                            by Gerrit Hillebrand

      

STATEMENTS
GAGS
  This statement shows the version number.


CLS
  Selects text mode and clears the screen.


ATKEY (A,B,C,....) (a,b,c,....)
  Using this statement, you can assign keys to linenumbers or labels. E.g.

    ATKEY (A,F,J) (100,k,90)

  If the [A]-key is pressed, a jump will be made to line 100. If the [F]-key
  is pressed, a jump will be made to label k.


JOYSTK A,B,C
  If a joystick is available, it will be scanned, and the appropriate
  variables will be update according to the joysticks position.
  A - variable A to Z: +1 if joystick right,
                       -1 if joystick left.
  B - variable A to Z: +1 if joystick up,
                       -1 if joystick down.
  C - variable A to Z: =0 if fire button not pressed,
                       <>0 if fire button pressed.


INV
  Inverts the screen, in each graphics mode.


BORDER x,y
  Draws a rectangle at a certain offset from the border.
  x - offset from left and right hand side of screen,
  y - offset from top and bottom of screen.


PAINT x,y
PAINT x,y,p
  Fills a closed area, using one of 32 user definable patterns.
  x - x coordinate of start position,
  y - y coordinate of start position,
  p - pattern number (see CREATE), solid fill if p omitted.


CUBE p,m,x,y,b,h
  Draws a rectangle or parts of it.
  p - plotting mode: 0=reset, 1=set, 2=invert.
  m - feature mode: 0=draw complete rectangle,
                    1=draw rectangle until first set pixel,
                    2=draw rectangle from first set pixel onwards,
                    3=draw rectangle until first set pixel, and from the
                      next set pixel onwards,
                    4=start drawing at first set pixel, until next set
                      pixel.
  x - x coordinate lower left corner,
  y - y coordinate lower left corner,
  b - width,
  h - height.


CIRCLE p,x,y,r
  Draws a circle in each graphics mode.
  p - plotting mode: 0=reset, 1=set, 2=invert.
  x = x coordinate center,
  y = y coordinate center,
  r = radius.


PIXEL x,y,z
  Checks whether a pixel is set or reset.
  x - x coordinate,
  y = y coordinate,
  Z = variable A to Z, result.


WINDOW m,x,y,b,h
  Defines a windows in which drawing is allowed or not.
  m = mode: =0 draw only outside window,
            =1 draw only inside window.
  x = x coordinate lower left corner,
  y = y coordinate lower left corner,
  b = width,
  h = height.


WOFF
  Disables window.


FILL a,b,x
  Fills memory from a to b with value x.


SCROLL e
  Scrolls the screen in every direction, depending on extension e:
  U - up, 8 pixels,
  D - down, 8 pixels,
  L - left, 8 pixels,
  R - right, 8 pixels.


HLINE p,x1,y1,x2,y2,l,f,A,B
  Draws a line from a start position to a position with a certain
  x coordinate, which lies on the line between start and end position.
  p     - plotting mode: 0=reset, 1=set, 2=invert,
  x1,y1 - coordinates start position,
  x2,y2 - coordinates end position,
  l     - x coordinate end pixel,
  f     - pixel feature: =0 draw until end pixel,
                         =1 draw until first set pixel.
  A,B   - variable A to Z. Filled with coordinates of last plotted pixel.


VLINE p,x1,y1,x2,y2,l,f,A,B
  Same as HLINE, except l = y coordinate end pixel.


INK a
  Draws in several colors.
  a - color (0-15)


PAPER a
  Selects background.
  a - color (0-3)


MODE a
  Select graphics mode, without clearing the screen.
  a - resolution: 0= 64* 48        ( 0  )
                  1= 64* 64 color  ( 1a )
                  2=128* 64        ( 1  )
                  3=128* 64 color  ( 2a )
                  4=128* 96        ( 2  )
                  5=128* 96 color  ( 3a )
                  6=128*192        ( 3  )
                  7=128*192 color  ( 4a )
                  8=256*192        ( 4  )


BLOCK m,x,y,b,h
  Draws a bar (solid filled rectangle).
  m - plotting mode: 0=reset, 1=set, 2=invert.
  x - x coordinate lower left corner,
  y - y coordinate lower left corner,
  b - width,
  h - height.


SOUND p,d
  Produces a sound according to:
  p - pitch 1  [1..255]
  d - duration [1..65535]


PAUSE t
  Delays execution during t/60 seconds, t = [1..65535].
  Pressing [Esc] exits the delay loop.


CREATE
  Creates sprites and fillpatterns
  -pattern
     CREATE/P:n a1,a2,a3,a4,a5,a6,a7,a8
     p - pattern number 0 to 31,
     a - 8 bytes, from top row to bottom row.

  -horizontal sprite
     CREATE <name>,a1,a2,a3,...,a15,a16
     CREATE/H <name>,a1,a2,a3,...,a15,a16
     <name>  - name of the sprite, maximum 8 characters,
     /H      - switch to define horizontal sprite (optional),
     a1..a16 - sprite definition, according to the following table:
               startposition -->| a8 | a16 |
                                | a7 | a15 |
                                | .. | ... |
                                | a2 | a10 |
                                | a1 | a9  |

  -vertical sprite
     CREATE /V <name>,a1,a2,a3,...,a15,a16
     <name>  - name of the sprite, maximum 8 characters,
     /V      - switch to define vertical sprite,
     a1..a16 - sprite definition, according to the following table:
               startposition -->| a16 |
                                | a15 |
                                | ... |
                                | a2  |
                                | a1  |

  -auto assignment
     CREATE/s <name>,a1,a2,a3,...,a15,a16/A:a
     <name>  - name of the sprite, maximum 8 characters,
     /s      - swithc to define sprite, horz or vert (H or V),
     a1..a16 - sprite definition,
     /A:     - assign switch
     a       - assignment number (1 to 255, see ASSIGN).


DEF <name>,0/1..-16*-..0/1
DEF:       0/1..-16*-..0/1
  Defines a horizontal sprite. A set pixel is defined as 1, a reset pixel
  is defined as 0. For a complete sprite eight DEFs are required.


BASE q
  Selects a memory block, where sprites and paint patterns will be stored
  (together 2 kB). Also resets map-byte for INT and ATTRG.
  q - high order byte of the start of the memory block.


ASSIGN:<name>,a
  Assigns a number to a sprite. The sprite is then accessible through both
  its name and its number.
  <name> - name of the sprite,
  a      - assignment number [1..255].


DEASS:<name>
  Disables the recognition of the sprite through an assignment number.
  <name> - name of the sprite.

KILL:<name>
KILL a
  Removes a sprite from the sprite administration.
  <name> - name of the sprite,
  a      - sprite assignment number.


SET:<name>,x,y
SET a,x,y
  Places a sprite on the screen.
  <name> - name of the sprite,
  a      - sprite assignment number,
  x      - x position of the sprite,
  y      - y position of the sprite.


UNSET:<name>
UNSET a
  Removes a sprite from the screen.
  <name> - name of the sprite,
  a      - sprite assignment number.


IMAGE:<name>,x,y
IMAGE a,x,y
  Same as SET, but now the sprite position is not stored in the sprite
  administration.
  <name> - name of the sprite,
  a      - sprite assignment number,
  x      - x coordinate of the sprite,
  y      - y coordinate of the sprite.


TURN:<name>
TURN a
  Flips a horizontal or vertical sprite, on screen (if it's there) as well
  as in the sprite administration.
  <name> - name of the sprite,
  a      - sprite assignment number.


CARRY:<name>,x,y
CARRY a,x,y
  Moves a sprite on screen (if it's there) to a new position.
  <name> - name of the sprite,
  a      - sprite assignment number,
  x      - x coordinate of the sprite,
  y      - y coordinate of the sprite.


SHOVE:<name>,dx,dy
SHOVE a,dx,dy
  Moves a sprite on screen, according to the entered displacements.
  <name> - name of the sprite,
  a      - sprite assignment number,
  dx     - horizontal displacement,
  dy     - verticale displacement.


POS:<name>,A,B
POS a,A,B
  Stores the coordinates of a certain sprite in the appropriate varables.
  A - variable A to Z : x coordinate,
  B - variable A to Z : y coordinate.


ATHIT:<name1>,<name2>
ATHIT:<name1>,a2
ATHIT a1,:<name2>
ATHIT a1,a2
  Checks a sprite collision.
  <name1> - name of sprite 1,
  <name2> - name of sprite 2,
  a1      - assignment number of sprite 1,
  a2      - assignment number of sprite 2.
  If the two sprites collide, the rest of the line is processed.


INT c,t (VIA required)
  Offers the possibility to use 3 so called channels, that will be called
  by the interrupts from timer 1 at specific times.
  c - channel number 0, 1 or 2.
  t - time [1..65535].
  During declaration of INT, the rest of the line is treated as comment.
  As soon as the desired time has elapsed, the statement that is being
  processed by the interpreter will be finished, after which execution will
  be continued at declaration-line right behind the parameters. The timer is
  immediately disabled. The user must turn it on manually.


INT:p (VIA required)
  Starts of stops the timer.
  p - =0 : stop timer,
      =1 : start timer.
  Note the colons (:)
  The timer runs at 50 Hz, which means the declared times must be multiplied
  by 0.02. For 1 seconds, t=50.


ATTRG (VIA required)
  (At Trigger) As INT, this is a declaration. If the timer is running and
  the space bar or the fire button is depressed, the interpreter will finish
  the current statement and will then jump to the first statement on the
  ATTRG line behind the declaration.

  Note: The interrupt handling uses a so called map-byte, which holds all
        information on activated channels and ATTRG declarations. This
        byte at address #0237 must be 0 at startup. This can be done through
        BASE. If one doesn't use the BASE statement, this location must be
        reset manually through: ?#237=0 or INT:0

  Example:
     10 INT:0
     20 INT 0,100 P."TWO SECONDS ELAPSED"';GOTO a
     30 INT 1,800 P."MAXIMUM RUN-TIME REACHED"';INT:0;END
     40 ATTRG GOTO 100
     50aINT:1
     60 P."DO NOTHING"';GOTO 60
    100 P."ALL IS OVER"';INT:0;END

  Please note: This program can only be run once. If you want to run it
  again, first press BREAK. The cause of this is that the interrupt vector
  is not restored by GAGS2.2. If run a second time without a BREAK, the
  program just keeps on going in circles.
Zero page usage:
  5F -   60  temporary pointers for CREATE etc,
  70 -   7F  temporary usage,
021C - 021D  counter channel 0,
021E - 021F  wake-up time channel 0,
0220 - 0221  counter channel 1,
0222 - 0223  wake-up time channel 1,
0224 - 0225  counter channel 2,
0226 - 0227  wake-up time channel 2,
0228 - 0229  pointer channel 0,
022A - 022B  pointer channel 1,
022C - 022D  pointer channel 2,
022E - 022F  pointer ATTRG,
0230 - 0233  window vectors,
0234 - 0235  plot vectors,
0236         window on/off,
0237         interrupt map-byte,
0238 - 0239  previous interrupt vector,
023A - 023C  ink items,
023D -       H.0 byte base
03F0 - 03F2  temporary bytes for INT and ATTRG
images/terug.gif