*                       THESE ROUTINES ARE NEEDED TO
*                       ACCESS ANY G.E.M. ROUTINES.
 MOVE.L   A7,A5
 MOVE.L   #NSTACK,A7
 MOVE.L   4(A5),A5
 MOVE.L   $C(A5),D0
 ADD.L    $14(A5),D0
 ADD.L    $1C(A5),D0
 ADD.L    #$100,D0
 MOVE.L   D0,-(SP)
 MOVE.L   A5,-(SP)
 MOVE     D0,-(SP)
 MOVE     #$4A,-(SP)
 TRAP#1
 ADD.L    #12,SP
 JSR      MAIN
 MOVE.L   #0,(A7)
 TRAP     #1
 
AES
 MOVE.L   #AESPB,D1
 MOVE     #$C8,D0
 TRAP     #2
 RTS
 
VDI
 MOVE.L   #VDIPB,D1
 MOVEQ.L  #$73,D0
 TRAP     #2
 RTS
 
MAIN
 MOVE.L   #0,AP1RESV
 MOVE.L   #0,AP2RESV
 MOVE.L   #0,AP3RESV
 MOVE.L   #0,AP4RESV
  
 MOVE     #10,OPCODE        * APPL_INIT
 MOVE     #0,SINTIN
 MOVE     #1,SINTOUT
 MOVE     #0,SADDRIN
 MOVE     #0,SADDROUT
 JSR      AES
 
 MOVE     #77,OPCODE        *GRAF_HANDLE
 MOVE     #0,SINTIN
 MOVE     #5,SINTOUT
 MOVE     #0,SADDRIN
 MOVE     #0,SADDROUT
 JSR      AES
 
 MOVE     INTOUT,GRHANDLE

 MOVE     #100,OPCODE       *OPEN_VWORK
 MOVE     #0,CONTRL+2
 MOVE     #11,CONTRL+6
 MOVE     GRHANDLE,CONTRL+12
 MOVE     #1,INTIN
 MOVE     #1,INTIN+2
 MOVE     #1,INTIN+4
 MOVE     #1,INTIN+6
 MOVE     #1,INTIN+8
 MOVE     #1,INTIN+10
 MOVE     #1,INTIN+12
 MOVE     #1,INTIN+14
 MOVE     #1,INTIN+16
 MOVE     #1,INTIN+18
 MOVE     #2,INTIN+20
 JSR      VDI

*     START LINES

   MOVE.W   #4,-(SP)             *GETREZ
   TRAP     #14
   ADDQ     #2,SP
   CMP      #0,D0
   BEQ      CONT                 * LOW RES?

*     HI RES   WARRNING

WARN   MOVE  #52,CONTRL        *FORM_ALERT
   MOVE  #1,CONTRL+2
   MOVE  #1,CONTRL+4
   MOVE  #1,CONTRL+6
   MOVE  #0,CONTRL+8
   MOVE  #1,INTIN
   MOVE.L  #HIWARN,ADDRIN
   JSR   AES
   RTS                           * RETURN TO DESK
               DATA
HIWARN
    DC.B  "[3][   Low rez      |   Colour ONLY!    ][IS OK.|IS NOT OK!]",0,0
               TEXT
CONT
   MOVE     #14,CONTRL           *BLACK
   MOVE     #0,CONTRL+2          * AS COLOR 0 (BACKGROUND)
   MOVE     #4,CONTRL+6
   MOVE     GRHANDLE,CONTRL+12
   MOVE     #0,INTIN
   MOVE     #0,INTIN+2
   MOVE     #0,INTIN+4
   MOVE     #0,INTIN+6
   JSR      VDI

   MOVE     #14,CONTRL           *WHITE
   MOVE     #0,CONTRL+2          * AS COLOR 1
   MOVE     #4,CONTRL+6
   MOVE     GRHANDLE,CONTRL+12
   MOVE     #1,INTIN
   MOVE     #868,INTIN+2
   MOVE     #868,INTIN+4
   MOVE     #868,INTIN+6
   JSR      VDI

   MOVE     #123,CONTRL          * HIDE CURSOR (MOUSE)
   MOVE     #0,CONTRL+2
   MOVE     #0,CONTRL+6
   MOVE     GRHANDLE,CONTRL+12
   JSR      VDI

   MOVE     #23,CONTRL           * FILL TYPE
   MOVE     #0,CONTRL+2
   MOVE     #1,CONTRL+6
   MOVE     GRHANDLE,CONTRL+12
   MOVE     #1,INTIN
   JSR      VDI

   MOVE     #114,CONTRL          * CLEAR SCREEN
   MOVE     #2,CONTRL+2
   MOVE     #0,CONTRL+6
   MOVE     GRHANDLE,CONTRL+12
   MOVE     #0,PTSIN
   MOVE     #0,PTSIN+2
   MOVE     #359,PTSIN+4
   MOVE     #199,PTSIN+6
   JSR      VDI

*    INITIALIZE

   MOVE.W   #17,-(SP)           *GET RANDOM #
   TRAP     #14
   ADDQ.L   #2,SP

   AND.W    #15,D0
   MOVE.W   D0,X                *X=RND(15)+1
   ADDI     #1,X

   MOVE.W   #17,-(SP)
   TRAP     #14
   ADDQ.L   #2,SP

   AND      #15,D0
   MOVE     D0,Y                 *Y=RND(15)
   ADDI     #1,Y

   MOVE.W   #17,-(SP)
   TRAP     #14
   ADDQ.L   #2,SP

   AND.W    #15,D0
   MOVE.W   D0,X1                *X1=RND(15)
   ADDI     #1,X1

   MOVE.W   #17,-(SP)
   TRAP     #14
   ADDQ.L   #2,SP

   AND      #15,D0
   MOVE     D0,Y1                *Y1=RND(15)
   ADDI     #1,Y1
   MOVE     #33,CONTRL           * SET KEYIN ( VSIN_MODE )
   MOVE     #0,CONTRL+2
   MOVE     #2,CONTRL+6
   MOVE     GRHANDLE,CONTRL+12
   MOVE     #4,INTIN
   MOVE     #2,INTIN+2
   JSR      VDI                  * SET KEYIN
*                        START MAIN LOOP
STARTMAIN
   MOVE.B   DRECT1,D0            * X + OR -   1=- 0=+
   BNE      NEGAX
   MOVE.W   X,D0
   ADD.W    D0,AL                 * A=A+X
   JMP      CHKB
NEGAX
   MOVE.W   X,D0
   SUB.W    D0,AL                 * A=A-X
   BCC      CHKB
   MOVE.W   #0,AL                * A=0
   MOVE.B   #0,DRECT1               * CHANGE DIRECTION
   MOVE.W   #17,-(SP)            * RANDOM
   TRAP     #14
   ADDQ.L   #2,SP
   AND.W    #15,D0
   MOVE.W   D0,X                 * X=RND(15)
   ADDI     #1,X
CHKB
   MOVE.B   DRECT2,D0            * Y + OR -
   BNE      NEGY
   MOVE     Y,D0
   ADD      D0,BL                 * B=B+Y
   JMP      CHKC
NEGY
   MOVE     Y,D0
   SUB      D0,BL                 * B=B-Y
   BCC      CHKC                 * B<0?
   MOVE     #0,BL                * B=0
   MOVE.B    #0,DRECT2           * CHANGE DIRECTION
   MOVE.W   #17,-(SP)            *\
   TRAP     #14                  * \
   ADDQ.L   #2,SP                *  Y=RND(15)
   AND      #15,D0               * /
   MOVE     D0,Y                 */
   ADDI     #1,Y
CHKC
   MOVE.B   DRECT3,D0            * X1 + OR -
   BNE      NEGX1
   MOVE.W   X1,D0
   ADD.W    D0,CL                * C=C+X1
   JMP      CHKD
NEGX1
   MOVE.W   X1,D0
   SUB.W    D0,CL                * C=C-X1
   BCC      CHKD                 * C<0?
   MOVE.W   #0,CL                * C=0
   MOVE.B   #0,DRECT3            * CHANGE DIRECTION
   MOVE.W   #17,-(SP)            *\
   TRAP     #14                  * \
   ADDQ.L   #2,SP                *  X1=RND(15)
   AND.W    #15,D0               * /
   MOVE.W   D0,X1                */
   ADDI     #1,X1
CHKD
   MOVE.B   DRECT4,D0            * Y1 + OR -
   BNE      NEGY1
   MOVE     Y1,D0
   ADD      D0,DL                * D=D+Y1
   JMP      IFS
NEGY1
   MOVE     Y1,D0
   SUB      D0,DL                * D=D-Y1
   BCC      IFS                  * D<0?
   MOVE     #0,DL                * D=0
   MOVE.B   #0,DRECT4            * CHANGE Y1 DIRECTION
   MOVE.W   #17,-(SP)            *\
   TRAP     #14                  * \
   ADDQ.L   #2,SP                *  Y1=RND(15)
   AND      #15,D0               * /
   MOVE     D0,Y1                */
   ADDI     #1,Y1
IFS
   MOVE.W   AL,D0
   CMP.W    #320,D0              *IF A=>320(END OF SCREEN)
   BLE      CONT1
   MOVE.W   #319,AL              *THEN A=320
   MOVE.B   #1,DRECT1            * (CHANGE DIRECTION)
   MOVE.W   #17,-(SP)            * RANDOM
   TRAP     #14
   ADDQ.L   #2,SP
   AND.W    #15,D0               * 15 MAX  'RND(15)'
   MOVE.W   D0,X                 * X=RND(15)
   ADDI     #1,X                 * +1
CONT1
   MOVE.W   BL,D0
   CMP      #200,D0              *IF B>199
   BLE      CONT2
   MOVE     #199,BL              *THEN B=199
   MOVE.B   #1,DRECT2            *(CHANGE DIRECTION)
   MOVE.W   #17,-(SP)            *RANDOM
   TRAP     #14
   ADDQ.L   #2,SP
   AND      #15,D0
   MOVE     D0,Y                 *Y=RND(15)+1
   ADDI     #1,Y
CONT2
   MOVE.W   CL,D0
   CMP.W    #320,D0              *IF C=>320
   BLE      CONT3
   MOVE.W   #320,CL              * C=320
   MOVE.B   #1,DRECT3            * CHANGE X1 DIRECTION
   MOVE.W   #17,-(SP)            *\
   TRAP     #14                  * \
   ADDQ.L   #2,SP                *  X1=RND(15)+1
   AND.W    #15,D0               * /
   MOVE.W   D0,X1                */
   ADDI     #1,X1
CONT3
   MOVE     DL,D0
   CMP      #200,D0              *IF D>199
   BLE      CONT4                *THEN
   MOVE     #200,DL              *D=199
   MOVE.B   #1,DRECT4            *CHANGE Y1 DIRECTION
   MOVE.W   #17,-(SP)            *\
   TRAP     #14                  * \
   ADDQ.L   #2,SP                *  Y1=RND(15)+1
   AND      #15,D0               * /
   MOVE     D0,Y1                */
   ADDI     #1,Y1
CONT4
   MOVE     #17,CONTRL           *\
   MOVE     #0,CONTRL+2          * \
   MOVE     #1,CONTRL+6          *  LINE COLOUR = COL ( vsl_color )
   MOVE     GRHANDLE,CONTRL+12   * /
   MOVE     COL,INTIN            */
   JSR      VDI
   MOVE     #6,CONTRL            *\
   MOVE     #2,CONTRL+2          * \
   MOVE     #0,CONTRL+6          * /
   MOVE     GRHANDLE,CONTRL+12   * \
*                                *  PLINE A,B-C,D  ( v_pline )
   MOVE     AL,PTSIN             * /
   MOVE     BL,PTSIN+2           * \
   MOVE     CL,PTSIN+4           * /
   MOVE     DL,PTSIN+6           */
   JSR      VDI
   MOVE.L   #RINGX,A1           * LOAD ARRAY ADDRESS
   MOVE.W   Z,D1
   MOVE.W   AL,0(A1,D1.W)        * RINGX(Z)=A
   MOVE.L   #RINGY,A1            *\
   MOVE.W   BL,0(A1,D1.W)        * RINGY(Z)=B
   MOVE.L   #RINGX1,A1           *\
   MOVE.W   CL,0(A1,D1.W)        * RINGX1(Z)=C
   MOVE.L   #RINGY1,A1           *\
   MOVE.W   DL,0(A1,D1.W)        * RINGY1(Z)=D
   ADD      #2,Z                 * Z=Z+1
   MOVE     NUM,D0
   CMP      Z,D0                 *IF Z=NUM (10-90 LINES)
   BNE      OPTIONS              * THEN
   MOVE     #0,Z                 * Z=0
OPTIONS
   CMP.B    #1,FLG1              *IS HORIZANTAL MIRROR INITIALIZED?
   BNE      GO_ON                * NO. GO ON.
   MOVE.W   #199,D1
   SUB.W    BL,D1                * STORE 199-B
   MOVE.W   #199,D2
   SUB.W    DL,D2                * STORE 199-D
   MOVE.W   #6,CONTRL            *\
   MOVE.W   #2,CONTRL+2          * \
   MOVE.W   #0,CONTRL+6          * /
   MOVE.W   GRHANDLE,CONTRL+12   * \
**                               *  PLINE A,199-B - C,199-D
   MOVE.W   AL,PTSIN             * /
   MOVE.W   D1,PTSIN+2           * \
   MOVE.W   CL,PTSIN+4           * /
   MOVE.W   D2,PTSIN+6           */
   JSR      VDI
GO_ON
   CMP.B    #1,FLG2              *VERTICAL MIRROR
   BNE      GO_ON1
   MOVE.W   #319,D1
   MOVE.W   D1,D2
   SUB.W    AL,D1                * STORE 319-A
   SUB.W    CL,D2                * STORE 319-C
   MOVE.W   #6,CONTRL            *\
   MOVE.W   #2,CONTRL+2          * \
   MOVE.W   #0,CONTRL+6          * /
   MOVE.W   GRHANDLE,CONTRL+12   * \
*                                *  PLINE 319-A,B - 319-C,D
   MOVE.W   D1,PTSIN             * /
   MOVE.W   BL,PTSIN+2           * \
   MOVE.W   D2,PTSIN+4           * /
   MOVE.W   DL,PTSIN+6           */
   JSR      VDI
GO_ON1
   CMP.B    #1,FLG3              * DIAGONAL MIRROR
   BNE      KEEPGOING
   MOVE.W   #319,D1
   MOVE.W   D1,D3
   MOVE.W   #199,D2
   MOVE.W   D2,D4
   SUB.W    AL,D1
   SUB.W    BL,D2
   SUB.W    CL,D3
   SUB.W    DL,D4
   MOVE.W   #6,CONTRL            *\
   MOVE.W   #2,CONTRL+2          * \
   MOVE.W   #0,CONTRL+6          * /
   MOVE.W   GRHANDLE,CONTRL+12   * \
**                               *  PLINE 319-A,199-B - 319-C,199-D
   MOVE.W   D1,PTSIN             * /
   MOVE.W   D2,PTSIN+2           * \
   MOVE.W   D3,PTSIN+4           * /
   MOVE.W   D4,PTSIN+6           */
   JSR      VDI
KEEPGOING
   MOVE.W   #17,CONTRL           *\
   MOVE.W   #0,CONTRL+2          * \
   MOVE.W   #1,CONTRL+6          *  LINE COLOUR = BACKGROUND(BLACK)
   MOVE.W   GRHANDLE,CONTRL+12   * /
   MOVE.W   #0,INTIN             */
   JSR      VDI
   MOVE.L   #RINGX,A1
   MOVE.W   V,D0
   MOVE.W   0(A1,D0.W),EX        * STORE RINGX(V)
   MOVE.L   #RINGY,A1
   MOVE.W   0(A1,D0.W),EY        * "        "Y(V)
   MOVE.L   #RINGX1,A1
   MOVE.W   0(A1,D0.W),EX1       * "        "X1...
   MOVE.L   #RINGY1,A1
   MOVE.W   0(A1,D0.W),EY1
   MOVE.W   #6,CONTRL            *\
   MOVE.W   #2,CONTRL+2          * \
   MOVE.W   #0,CONTRL+6          * /
   MOVE.W   GRHANDLE,CONTRL+12   * \
*                                *  PLINE X(V),Y(V),X1(V),Y1(V)
   MOVE.W   EX,PTSIN             * /
   MOVE.W   EY,PTSIN+2           * \
   MOVE.W   EX1,PTSIN+4          * /
   MOVE.W   EY1,PTSIN+6          */
   JSR      VDI
   CMP.B    #1,FLG1              * IF FLG=1
   BNE      OP2                  * THEN
   MOVE.W   #199,D5              * HORIZANTAL MIRROR
   MOVE.W   D5,D6
   SUB.W    EY,D5
   SUB.W    EY1,D6
   MOVE.W   #6,CONTRL            *\
   MOVE.W   #2,CONTRL+2          * \
   MOVE.W   #0,CONTRL+6          * /
   MOVE.W   GRHANDLE,CONTRL+12   * \
*                                *  PLINE X(V),199-Y(V),X1(V),199-Y1(V)
   MOVE.W   EX,PTSIN             * /
   MOVE.W   D5,PTSIN+2           * \
   MOVE.W   EX1,PTSIN+4          * /
   MOVE.W   D6,PTSIN+6           */
   JSR      VDI
OP2
   CMP.B    #1,FLG2              * IF FLG2=1
   BNE      OP3                  * THEN
   MOVE.W   #319,D5              * VERTICAL MIRROR
   MOVE.W   D5,D6
   SUB.W    EX,D5
   SUB.W    EX1,D6
   MOVE.W   #6,CONTRL            *\
   MOVE.W   #2,CONTRL+2          * \
   MOVE.W   #0,CONTRL+6          * /
   MOVE.W   GRHANDLE,CONTRL+12   * \
*                                *  PLINE 319-X(V),Y(V),319-X1(V),Y1(V)
   MOVE.W   D5,PTSIN             * /
   MOVE.W   EY,PTSIN+2           * \
   MOVE.W   D6,PTSIN+4           * /
   MOVE.W   EY1,PTSIN+6          */
   JSR      VDI
OP3
   CMP.B    #1,FLG3              * IF FLG3=1
   BNE      COUNTV               * THEN
   MOVE.W   #319,D1              * DIAGONAL MIRROR
   MOVE.W   D1,D2
   MOVE.W   #199,D0
   MOVE.W   D0,D3
   SUB.W    EX,D1
   SUB.W    EY,D0
   SUB.W    EX1,D2
   SUB.W    EY1,D3
   MOVE.W   #6,CONTRL            *\
   MOVE.W   #2,CONTRL+2          * \
   MOVE.W   #0,CONTRL+6          * /
   MOVE.W   GRHANDLE,CONTRL+12   * \
   MOVE.W   D1,PTSIN             *  PLINE319-X(V),199-Y(V),319-X1(V),199-Y1(V)
   MOVE.W   D0,PTSIN+2           * /
   MOVE.W   D2,PTSIN+4           * \
   MOVE.W   D3,PTSIN+6           * /
   JSR      VDI                  */
COUNTV
   ADDI     #2,V                 * V=V+1
   MOVE     NUM,D0
   CMP      V,D0                 * IF V=NUM
   BNE      COLOUR               * THEN
   MOVE     #0,V                 * V=0
COLOUR
   MOVE.W   #17,-(SP)
   TRAP     #14
   ADDQ.L   #2,SP
   AND      #255,D0
   CMP.W    #10,D0
   BHI      RGB
   MOVE.W   #17,-(SP)
   TRAP     #14
   ADDQ.L   #2,SP
   AND      #15,D0
   MOVE.W   D0,COL               * IF RND(255)=10 THEN COL=RND(15)
   BNE      RGB
   ADDI     #1,COL
RGB
   MOVE.W   #17,-(SP)            * IF RND(127)=20 THEN SETCOLOUR
   TRAP     #14
   ADDQ.L   #2,SP
   AND      #127,D0
   CMP.W    #5,D0
   BNE      KEYIN
   MOVE.W   #17,-(SP)            * R=RND(7)
   TRAP     #14
   ADDQ.L   #2,SP
   AND.W    #7,D0
   BNE      ROK                  * IF R=0 THEN R=1
   MOVE     #1,D0
ROK
   MULU.W   #142,D0              * R=R*143
   MOVE.W   D0,R
   MOVE.W   #17,-(SP)            * G=RND(7)
   TRAP     #14
   ADDQ.L   #2,SP
   AND.W    #7,D0
   BNE      GOK                  * IF G=0 THEN G=1
   MOVE     #1,D0
GOK
   MULU.W   #142,D0              * G=G*143
   MOVE.W   D0,G
   MOVE.W   #17,-(SP)            * B=RND(7)
   TRAP     #14
   ADDQ.L   #2,SP
   AND.W    #7,D0
   BNE      BOK                  * IF B=0 THEN B=1
   MOVE     #1,D0
BOK
   MULU.W   #142,D0              * B=B*143
   MOVE.W   D0,B
   MOVE.W   #17,-(SP)            *SETCOL=RND(15)
   TRAP     #14
   ADDQ.L   #2,SP
   AND.W    #15,D0
   BNE      SCOK                 * IF SETCOL=0(BACKG.) THEN SETCOL=1
   MOVE     #1,D0
SCOK
   MOVE.W   D0,SETCOL
   MOVE     #14,CONTRL           *\
   MOVE     #0,CONTRL+2          * \
   MOVE     #4,CONTRL+6          * /
   MOVE     GRHANDLE,CONTRL+12   * \
   MOVE.W   SETCOL,INTIN         *  SETCOL   ( vs_color )
   MOVE.W   R,INTIN+2            * /
   MOVE.W   G,INTIN+4            * \
   MOVE.W   B,INTIN+6            * /
   JSR      VDI                  */
KEYIN
   MOVE     #31,CONTRL           *\
   MOVE     #1,CONTRL+2          * \
   MOVE     #2,CONTRL+6          * /
   MOVE     GRHANDLE,CONTRL+12   * \
   MOVE     #1,INTIN             *  INKEY$ (ONE THAT WORKS) vsm_string
   MOVE     #0,INTIN+2           * /
   MOVE     #0,PTSIN             * \
   MOVE     #0,PTSIN+2           * /
   JSR      VDI                  */
   CMP      #1,CONTRL+8
   BEQ      SETS                 * KEY?
   JMP      STARTMAIN
SETS
   CMP      #':',INTOUT          * IF INTOUT$>":" AND INTOUT$<"0"
   BHI      ASCII
   CMP      #'0',INTOUT
   BLE      CLS
   MOVE     INTOUT,D0
   SUBI     #48,D0               * THEN NUM=(ASC(INTOUT$)-48)*10
   MULU.W   #20,D0               * 20 BECAUSE WE USE WORDS (2 BYTES)
   MOVE.W   D0,NUM
   MOVE     #0,V
   MOVE     D0,Z
   SUBI     #2,Z
   JMP      CLS
ASCII
   CMP      #'h',INTOUT          * IF INTOUT=h THEN FLG1=FLG1+1
   BNE      VER
   ADDI.B   #1,FLG1
   CMP.B    #2,FLG1              * IF FLG1=2 THEN FLG1=0
   BEQ      RESET1
   JMP      CLS
RESET1
   MOVE.B   #0,FLG1
   JMP      CLS
VER
   CMP      #'v',INTOUT          * IF INTOUT=v THEN FLG2=FLG2+1
   BEQ      VERT
   CMP      #'S',INTOUT          * IF INTOUT=S THEN END
   BEQ      EXIT
   JMP      STARTMAIN
EXIT
   MOVE.W   #17,CONTRL           *\
   MOVE.W   #0,CONTRL+2          * \
   MOVE.W   #1,CONTRL+6          *  LINE COLOUR = FOR GEM WINDOWS
   MOVE.W   GRHANDLE,CONTRL+12   * /
   MOVE.W   #2,INTIN             */
   JSR      VDI
   RTS
VERT
   ADDI.B   #1,FLG2              * IF FLG2=2 THEN FLG2=0
   CMP.B    #2,FLG2
   BEQ      RESET2
   JMP      CLS
RESET2
   MOVE.B   #0,FLG2
CLS
   CMP.B    #1,FLG1
   BNE      LO
   CMP.B    #1,FLG2              * IF FLG1=1 AND FLG2=1 THEN FLG3=1
   BNE      LO
   MOVE.B   #1,FLG3
CLS2
   MOVE     #114,CONTRL          * CLEAR SCREEN
   MOVE     #2,CONTRL+2
   MOVE     #0,CONTRL+6
   MOVE     GRHANDLE,CONTRL+12
   MOVE     #0,PTSIN
   MOVE     #0,PTSIN+2
   MOVE     #359,PTSIN+4
   MOVE     #199,PTSIN+6
   JSR      VDI
   JMP      STARTMAIN
LO
   MOVE.B   #0,FLG3              * ELSE FLG3=0 ( SEE IF ABOVE )
   JMP      CLS2
         DATA

AESPB
   DC.L  CONTRL,GLOBAL,INTIN,INTOUT,ADDRIN,ADDROUT

CONTRL
OPCODE   DS.W  1
SINTIN   DS.W  1
SINTOUT  DS.W  1
SADDRIN  DS.W  1
SADDROUT DS.L  1
 DS.W 5

GLOBAL
APVERSION   DS.W  1
APCOUNT     DS.W  1
APID        DS.W  1
APPRIVATE   DS.L  1
APPTREE     DS.L  1
AP1RESV     DS.L  1
AP2RESV     DS.L  1
AP3RESV     DS.L  1
AP4RESV     DS.L  1

INTIN DS.W  128
PTSIN DS.W  128
INTOUT   DS.W  128
PTSOUT   DS.W  128
ADDRIN   DS.W  128
ADDROUT  DS.W  128
VDIPB    DC.L  CONTRL,INTIN,PTSIN,INTOUT,PTSOUT
GRHANDLE DS.W  1

AL DC.W  200
BL DC.W  100
CL DC.W  0
DL DC.W  0
X  DS.W  1
Y  DS.W  1
X1 DS.W  1
Y1 DS.W  1
EX DS.W  1
EY DS.W  1
EX1   DS.W  1
EY1   DS.W  1
NUM  DC.W 20
Z    DC.W  0
V    DC.W  2
COL  DC.W  1
RINGX DS.W  100
RINGY DS.W  100
RINGX1   DS.W  100
RINGY1   DS.W  100
R  DS.W  1
G  DS.W  1
B  DS.W  1
SETCOL   DS.W  1
DRECT1   DC.B  0
 DS.B  1
DRECT2   DC.B  0
 DS.B  1
DRECT3   DC.B  0
 DS.B  1
DRECT4   DC.B  0
 DS.B  1
FLG1  DS.B  1
 DS.B  1
FLG2  DS.B  1
 DS.B  1
FLG3  DS.B  1
      BSS
  DS.L   300
NSTACK   DS.L  1
 DS.W 10
   END
