 DEFINT A-Z
DECLARE SUB mouse (cx%, dx%, bx%)
DECLARE SUB MOUSEPOINTER (SW%)
DECLARE SUB prockey (KE$)
COMMON SHARED h1, v1, HPOS, VPOS


        REM %%%%% SPECIAL THANKS TO  Jeff Barnette  %%%%%
        REM %%%%% FOR THIS MOUSE ROUTINE %%%%%
      
      
      
         DIM SHARED a(9): REM %%% FOR MOUSEROUTINE %%%
        
        DEF SEG = VARSEG(a(0))
    
        RESTORE
        FOR I = 0 TO 17
        READ r
        POKE VARPTR(a(0)) + I, r
        NEXT I
        DATA &HB8,&H00,&H00,&H55,&H8B,&HEC,&HCD,&H33,&H92
        DATA &H8B,&H5E,&H06,&H89,&H07,&H5D,&HCA,&H02,&H00
        CALL MOUSEPOINTER(0)      'Reset mouse and
        CALL MOUSEPOINTER(1)'show arrow
        'CALL MOUSEPOINTER(2)'show arrow


        'CALL MOUSEPOINTER(3)      'Get coordinates


SCREEN 13

 DIM SHARED BOX%(10, 10)
 
CLS

 FOR V = 0 TO 400 STEP 10
 FOR h = 250 TO 300 STEP 10
 c = c + 1

  LINE (h, V)-(h + 7, V + 7), c, BF





  NEXT h
 NEXT V

GET (0, 0)-(10, 10), BOX%
V = 1

HPOS = 20
VPOS = 20

DO

LOCATE 1, 1: PRINT HPOS, VPOS
KE$ = INKEY$


  IF KE$ <> "" THEN

  CALL prockey(KE$)
 
  END IF


LOOP UNTIL KE$ = CHR$(27)
DEFINT A-Z
'

SUB mouse (cx, dx, bx)
      
      
     

           POKE VARPTR(a(4)), &H92           'Swap code,Get CX setup
          CALL absolute(cx, VARPTR(a(0)))     'Run Code
              cx = cx                     'Adjust 25x80
           POKE VARPTR(a(4)), &H91           'Swap code,Get DX setup
          CALL absolute(dx, VARPTR(a(0)))     'Run Code
              dx = dx                     'Adjust 25x80
           POKE VARPTR(a(4)), &H93           'Swap code,Get BX setup
          CALL absolute(bx, VARPTR(a(0)))     'Run Code
END SUB

SUB MOUSEPOINTER (SW)
      
           POKE VARPTR(a(0)) + 1, SW         'Swap code,Set AX = (SW)
          CALL absolute(c, VARPTR(a(0)))     'Run Code

                                          'Note:
                                             'SW = 0-reset
                                             'SW = 1-on
                                             'SW = 2-off
                                             'SW = 3-coordinates


END SUB

SUB prockey (KE$)

      TARGET$ = "C7BU1U4BD10U4BU1BL5R4BR6L4"
  
   IF HPOS < 250 THEN HPOS = 250
  
  
   SELECT CASE KE$

   CASE IS = "J", CHR$(0) + "K"
  
    HPOS = HPOS - 5: IF HPOS < 250 THEN HPOS = 250
  
   CASE IS = "K", CHR$(0) + "M"
  
    HPOS = HPOS + 5: IF HPOS > 300 THEN HPOS = 300
  
   CASE IS = "M", CHR$(0) + "P"
    VPOS = VPOS + 5: IF VPOS > 185 THEN VPOS = 185
  
   CASE IS = "I", CHR$(0) + "H"
  
    VPOS = VPOS - 5: IF VPOS < 1 THEN VPOS = 1


   CASE IS = CHR$(13)
    PNCL = POINT(HPOS + 5, VPOS + 5): LINE (240, 0)-(248, 200), PNCL, BF



   END SELECT

      h$ = "R" + STR$(HPOS + 5)
      V$ = "D" + STR$(VPOS + 5)

  
  
    PUT (h1, v1), BOX%, PSET
  
    GET (HPOS, VPOS)-(HPOS + 10, VPOS + 10), BOX%

   DRAW "bm0,0b" + h$ + "b" + V$ + "c7" + TARGET$
      h1 = HPOS: v1 = VPOS

     
END SUB

