home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / ezlib / ezscreen / example.bas < prev    next >
Encoding:
BASIC Source File  |  1988-05-21  |  3.8 KB  |  76 lines

  1. 100 ' ** This is an example program that demonstrates how a screen,
  2. 110 '    built with "EASY SCREENS", can be read into and displayed
  3. 120 '    by a Basic program.
  4. 130 '
  5. 140 WIDTH 40            'change screen width to 40
  6. 150 SCREEN ,,0,0:CLS    'set active and visual page to 0, clear screen
  7. 155 SCREEN ,,1,0:CLS    'set active page to 1 and clear
  8. 160 COLOR 2,0,0         'set color to green on black, boarder to black
  9. 170 LOCATE 1,1,,31      'start at line 1, column 1; make cursor invisible
  10. 180 PRINT "This is an example program that demon- "
  11. 190 PRINT "strates how a screen, built with `EASY "
  12. 200 PRINT "SCREENS', can be read and displayed by "
  13. 210 PRINT "a Basic program.  For this program to  "
  14. 220 PRINT "work properly, your `EASY SCREENS'     "
  15. 230 PRINT "master floppy diskette must be in drive"
  16. 240 PRINT "A:."
  17. 250 PRINT " "
  18. 260 PRINT "This example program loads and displays"
  19. 270 PRINT "the `EASY SCREENS' instruction screens."
  20. 280 PRINT " ":COLOR 10
  21. 290 PRINT "Enter page number of the instruction   "
  22. 300 PRINT "screen you want to have displayed.  A  "
  23. 310 PRINT "zero will cause the instructions table "
  24. 320 PRINT "of contents to be displayed.  If you   "
  25. 330 PRINT "want to quit now, enter 99.  Once the  "
  26. 340 PRINT "instruction screen is displayed, push  "
  27. 350 PRINT "<RETURN> to return to this screen.     "
  28. 360 PRINT " ":COLOR 9
  29. 370 PRINT "Enter page number (or 99 to quit):"
  30. 380 LOCATE 22,1,7,7:COLOR 1     'answer on line 22, in blue
  31. 390 SCREEN ,,1,1                'change active and visual page to 1
  32. 400 LOCATE ,,7,7                'make cursor visible
  33. 405 BEEP                        'make a beep
  34. 410 INPUT A                     'input page number
  35. 420 IF A=99 THEN 990            'quit if 99 was entered
  36. 430 IF A<>INT(A) THEN 700       'invalid if not a whole number
  37. 440 IF A<0 THEN 700             'invalid if less than zero
  38. 450 IF A>99 THEN 700            'invalid if greater than 99
  39. 460 FS$="a:instrc**.scn"        'initialize file spec
  40. 470 T$=STR$(A)                  'convert answer to a string
  41. 480 IF LEN(T$)=3 THEN 520       'answer is two digits
  42. 490 MID$(T$,1,1)="0"            'set leading space to a zero
  43. 500 MID$(FS$,9,2)=T$            'put number into file spec
  44. 510 GOTO 540
  45. 520 MID$(FS$,9,2)=MID$(T$,2,2)  'put number into file spec
  46. 540 DEF SEG=&HB800              'define screen memory segment
  47. 550 WIDTH 80                    'change screen width to 80
  48. 560 SCREEN ,,1,1                'set active and visual page to 1
  49. 570 LOCATE ,,,31                'make cursor invisible
  50. 580 ON ERROR GOTO 800           'if error on read, goto 800
  51. 590 BLOAD FS$,0                 'Binary load screen into page 0
  52. 600                             ' of screen memory.
  53. 610 ON ERROR GOTO 0             'clear error path
  54. 620 SCREEN ,,1,0                'set visual page to page 2
  55. 630 INPUT W$                    'wait for any input from keyboard
  56. 640 GOTO 140                    'start over
  57. 650                             '
  58. 700 LOCATE 24,1,,31             'print error message on line 24
  59. 710 COLOR 12                    'print message in bright red
  60. 720 PRINT "Not a valid page number, please re-enter"
  61. 730 LOCATE 22,1                 'clear answer line
  62. 740 PRINT "                                        "
  63. 750 GOTO 380                    'try again
  64. 800 LOCATE 7,1,,31             'print error message on line 7
  65. 810 COLOR 12                    'print message in bright red
  66. 820 PRINT "File Spec ";FS$;" not found on"
  67. 830 PRINT "on drive A.  Please try again.  Push    "
  68. 840 PRINT "<RETURN> when ready."
  69. 850 PRINT " "
  70. 855 INPUT W$
  71. 860 RESUME 140
  72. 990 WIDTH 80                    'reset width to 80
  73. 991 COLOR 2,0,0                 'set color to green on black
  74. 992 LOCATE ,,7,7                'make cursor visible
  75. 999 END                         'end program
  76.