home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l196 / 3.ddi / PLOTTER.BA$ / PLOTTER.bin
Encoding:
Text File  |  1990-06-24  |  1.5 KB  |  54 lines

  1. ' Values for keys on the numeric keypad and the spacebar:
  2. CONST UP = 72, DOWN = 80, LFT = 75, RGHT = 77
  3. CONST UPLFT = 71, UPRGHT = 73, DOWNLFT = 79, DOWNRGHT = 81
  4. CONST SPACEBAR = " "
  5.  
  6. ' Null$ is the first character of the two-character INKEY$
  7. ' value returned for direction keys such as UP and DOWN:
  8. Null$ = CHR$(0)
  9. ' Plot$ = "" means draw lines; Plot$ = "B" means
  10. ' move graphics cursor, but don't draw lines:
  11. Plot$ = ""
  12.  
  13. PRINT "Use the cursor movement keys to draw lines."
  14. PRINT "Press spacebar to toggle line drawing on and off."
  15. PRINT "Press <ENTER> to begin. Press q to end the program."
  16. DO : LOOP WHILE INKEY$ = ""
  17.  
  18. SCREEN 1
  19.  
  20. DO
  21.    SELECT CASE KeyVal$
  22.       CASE Null$ + CHR$(UP)
  23.          DRAW Plot$ + "C1 U2"
  24.       CASE Null$ + CHR$(DOWN)
  25.          DRAW Plot$ + "C1 D2"
  26.       CASE Null$ + CHR$(LFT)
  27.          DRAW Plot$ + "C2 L2"
  28.       CASE Null$ + CHR$(RGHT)
  29.          DRAW Plot$ + "C2 R2"
  30.       CASE Null$ + CHR$(UPLFT)
  31.          DRAW Plot$ + "C3 H2"
  32.       CASE Null$ + CHR$(UPRGHT)
  33.          DRAW Plot$ + "C3 E2"
  34.       CASE Null$ + CHR$(DOWNLFT)
  35.          DRAW Plot$ + "C3 G2"
  36.       CASE Null$ + CHR$(DOWNRGHT)
  37.          DRAW Plot$ + "C3 F2"
  38.       CASE SPACEBAR
  39.          IF Plot$ = "" THEN Plot$ = "B " ELSE Plot$ = ""
  40.       CASE ELSE
  41.          ' The user pressed some key other than one of the
  42.      ' direction keys, the spacebar, or "q," so
  43.      ' don't do anything.
  44.    END SELECT
  45.  
  46.    KeyVal$ = INKEY$
  47.  
  48. LOOP UNTIL KeyVal$ = "q"
  49.  
  50. SCREEN 0, 0        ' Restore the screen to 80-column
  51. WIDTH 80        ' text mode and end.
  52. END
  53.  
  54.