home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / qb4tb522 / demon.bas < prev    next >
Encoding:
BASIC Source File  |  1992-02-25  |  86.1 KB  |  2,158 lines

  1. ' DEMON.BAS     this program illustrates some of the ways that the routines
  2. '               provided in the Libraries in this package, can enhance your
  3. '               Extended QuickBASIC programs.
  4. '
  5. '   Author:     Christy Gemmell
  6. '   For:        Assembly-Language Toolbox for QuickBASIC
  7. '   Version:    5.22
  8. '   Date:       16/2/1992
  9. '
  10. '   For MicroSoft QuickBASIC and BASIC 7 Professional Development System.
  11. '   Assembler routines created with MicroSoft Macro Assembler MASM 6.0
  12. '
  13. '   Compile:    BC /E/Fs/O/S/X demon;
  14. '   Link:       Link /E/F demon,,,toolbox.lib mixed.lib;
  15. '
  16. '   $DYNAMIC                             ' required for stringsort routine
  17. '
  18. '┌────────────────────────────────────────────────────────────────────────┐
  19. '│      External Functions and Procedures.                                │
  20. '└────────────────────────────────────────────────────────────────────────┘
  21. '
  22. '   The following prototypes refer to assembly-language procedures which
  23. '   are in the library files MIXED.LIB and MIXED.QLB. One or other of these
  24. '   libraries must be linked to the program which calls them.
  25. '
  26.     DECLARE FUNCTION Attribute% (BYVAL Fore%, BYVAL Back%)
  27.     DECLARE FUNCTION CapsLock% (BYVAL Switch%)
  28.     DECLARE FUNCTION Cpu% ()
  29.     DECLARE FUNCTION EmsError% ()
  30.     DECLARE FUNCTION EmsFrame% ()
  31.     DECLARE FUNCTION EmsOwned% (BYVAL Handle%)
  32.     DECLARE FUNCTION EmsPages% (BYVAL Switch%)
  33.     DECLARE FUNCTION EmsPresent% ()
  34.     DECLARE FUNCTION EmsVersion% ()
  35.     DECLARE FUNCTION FarPeek% (BYVAL Segment&, BYVAL OffSet&)
  36.     DECLARE FUNCTION FreeSpace& (BYVAL DriveNo%)
  37.     DECLARE FUNCTION KeyFlags% ()
  38.     DECLARE FUNCTION KeyIn% ()
  39.     DECLARE FUNCTION KeyStat% ()
  40.     DECLARE FUNCTION MathsChip% ()
  41.     DECLARE FUNCTION MouseInit% ()
  42.     DECLARE FUNCTION NumLock% (BYVAL Switch%)
  43.     DECLARE FUNCTION PeekWord& (BYVAL Segment&, BYVAL OffSet&)
  44.     DECLARE FUNCTION PrinTest% (BYVAL Printer%)
  45.     DECLARE FUNCTION Rand% (BYVAL Lower%, BYVAL Higher%)
  46.     DECLARE FUNCTION ScrLock% (BYVAL Switch%)
  47.     DECLARE FUNCTION FileSize& (FileSpec$)
  48.     DECLARE FUNCTION StatusLine% (Message$)
  49.     DECLARE FUNCTION StringScan% (Trgt$, BYVAL Size%, BYVAL Strt%, BYVAL Addr%)
  50.     DECLARE FUNCTION Verify% (BYVAL Default%, BYVAL Row%, Prompt$, BYVAL Attr%, BYVAL Mouse%)
  51.     DECLARE SUB BackFill (BYVAL Row%, BYVAL Col%, BYVAL Rows%, BYVAL Cols%, BYVAL Attr%)
  52.     DECLARE SUB Cipher (Text$, KeyWord$)
  53.     DECLARE SUB ClearEnd (BYVAL Switch%, BYVAL Attr%)
  54.     DECLARE SUB Curtains (BYVAL Speed%, BYVAL Attr%)
  55.     DECLARE SUB EmsGet (BYVAL Segment%, BYVAL OffSet%, BYVAL Length%, BYVAL Page%, BYVAL Handle%, Done%)
  56.     DECLARE SUB EmsPut (BYVAL Segment%, BYVAL OffSet%, BYVAL Length%, BYVAL Page%, BYVAL Handle%, Done%)
  57.     DECLARE SUB EmsRelease (BYVAL Handle%)
  58.     DECLARE SUB EmsRequest (BYVAL Pages%, Handle%)
  59.     DECLARE SUB FastPrint (BYVAL Row%, BYVAL Col%, Message$, BYVAL Attr%)
  60.     DECLARE SUB GraPrint (BYVAL xLoc%, BYVAL yLoc%, Text$, BYVAL Attr%, BYVAL Scale%)
  61.     DECLARE SUB HelpMate (BYVAL Colour%, Title$, BYVAL Context%, Topic$)
  62.     DECLARE SUB KeyFlush ()
  63.     DECLARE SUB MisTake (BYVAL Row%, Message$, BYVAL Attr%, BYVAL Mouse%)
  64.     DECLARE SUB MouseHide ()
  65.     DECLARE SUB MouseNow (LeftButton%, RightButton%, xMouse%, yMouse%)
  66.     DECLARE SUB MouseShow ()
  67.     DECLARE SUB Pause (BYVAL Ticks%)
  68.     DECLARE SUB PerCentBox (BYVAL Switch%, Message$, BYVAL Attr%, BYVAL PerCent%)
  69.     DECLARE SUB PopUp (BYVAL Row%, BYVAL Col%, BYVAL Hght%, BYVAL Wdth%, BYVAL Attr%, BYVAL Brdr%, BYVAL Shdw%, BYVAL Zoom%)
  70.     DECLARE SUB PrintSet (BYVAL Row%, BYVAL Col%, BYVAL Attr%, BYVAL Printer%, BYVAL Mouse%)
  71.     DECLARE SUB ReSeed (BYVAL Seed&)
  72.     DECLARE SUB Scroll (BYVAL Dir%, BYVAL Y1%, BYVAL X1%, BYVAL Y2%, BYVAL X2%, BYVAL Units%, BYVAL Attr%)
  73.     DECLARE SUB ShutUp (BYVAL Speed%)
  74.     DECLARE SUB StringSort (BYVAL Dir%, BYVAL Size%, BYVAL Addr%)
  75.     DECLARE SUB VGALoad (File$)
  76.     DECLARE SUB VGAPan (BYVAL X%, BYVAL Y%)
  77.     DECLARE SUB VGASave (File$)
  78.  
  79. '   These are native QuickBASIC procedures which are also in MIXED.LIB/QLB
  80. '
  81.     DECLARE FUNCTION BinDec& (Binary$)
  82.     DECLARE FUNCTION BitTest% (Number%, Bit%)
  83.     DECLARE FUNCTION DateInput$ (Default$, Context%, Topic$, HotKey%)
  84.     DECLARE FUNCTION DosVersion$ ()
  85.     DECLARE FUNCTION FindFile$ (FileSpec$, Attr%, Mouse%)
  86.     DECLARE FUNCTION GetFlag% (Flag%)
  87.     DECLARE FUNCTION GrAttrib% (ForeGround%, BackGround%)
  88.     DECLARE FUNCTION IsDir% (Test$)
  89.     DECLARE FUNCTION LongDate$ (Day%, Month%, Year%)
  90.     DECLARE FUNCTION RevInput$ (Max%, Default$, Legal$, Ctx%, Topic$, Mask%, HotKey%)
  91.     DECLARE SUB BarMenu (P1%, P2%, P3%, Menu$(), P5%, P6%, P7%, P8$, Mouse%)
  92.     DECLARE SUB CheckPrinter (Printer%)
  93.     DECLARE SUB Panel (Row%, Col%, Rows%, Cols%, Border%, Attr%)
  94.     DECLARE SUB SetFlag (Flag%, Setting%)
  95.     DECLARE SUB SortFile (PathName$, OffSet%, FieldLen%, RecordLen%, Done%)
  96.     DECLARE SUB VerMenu (P1%, P2%, P3%, P4%, P5%, P6$, Menu$(), P8%, P9%, P10%, P11%, P12$, Mouse%)
  97.     DECLARE SUB VideoMode (Colour%, MaxRes%, VideoRam%)
  98.  
  99. '   Local, program-specific, functions and procedures.
  100. '
  101.     DECLARE SUB Frame (Title$, Switch%)
  102.  
  103. '┌────────────────────────────────────────────────────────────────────────┐
  104. '│      Initialisation.                                                   │
  105. '└────────────────────────────────────────────────────────────────────────┘
  106. '
  107.     CONST FALSE = 0, TRUE = NOT FALSE
  108.  
  109. '   Allow plenty of stack space for function and procedure calls.
  110. '
  111.     CLEAR , , &H2000
  112.  
  113. '   Establish error trapping and point to error handler.
  114. '
  115.     ON ERROR GOTO Trap
  116.  
  117. '   Check video capabilities of the host system (default to MDA).
  118. '
  119.     Colour% = FALSE                             ' Default to monochrome
  120.     MaxRes% = 0                                 ' Default to text only
  121.     VideoRam% = 4                               ' Default to 4K buffer
  122.  
  123.     VideoMode Colour%, MaxRes%, VideoRam%       ' Find what's installed
  124.  
  125. '   Set display colours for colour and monochrome displays.
  126. '
  127.     IF Colour% THEN
  128.        BarColour% = 48                          ' Black on Cyan
  129.        HeadColour% = 31                         ' Bright White on Blue
  130.        StatColour% = 48                         ' Black on Cyan
  131.        TextColour% = 112                        ' Black on White
  132.     ELSE
  133.        BarColour% = 112                         ' Reverse video
  134.        HeadColour% = 15                         ' Intense White on Black
  135.        StatColour% = 112                        ' Reverse video
  136.        TextColour% = 7                          ' White on Black
  137.     END IF
  138.  
  139. '   Check the type of display adaptor installed.
  140. '
  141.     SELECT CASE MaxRes%
  142.         CASE 13
  143.              IF VideoRam% = 64 THEN
  144.                 Adaptor$ = "Multi-Colour Graphics Array"
  145.              ELSE
  146.                 Adaptor$ = "Video Graphics Array"
  147.              END IF
  148.         CASE 7 TO 10
  149.              Adaptor$ = "Enhanced Graphics Adaptor"
  150.         CASE 3
  151.              Adaptor$ = "Hercules Graphics Card"
  152.         CASE 2
  153.              Adaptor$ = "Colour Graphics Adaptor"
  154.         CASE ELSE
  155.              Adaptor$ = "Monochrome Display Adaptor"
  156.     END SELECT
  157.  
  158.     Mouse% = MouseInit%                         ' See if a mouse is available
  159.  
  160.     DIM Menu$(0 TO 12)                          ' Dimension array for menus
  161.     Printer% = 1                                ' Use the first parallel port
  162.     RootName$ = "DEMON"                         ' Used for help topic files
  163.     DOS$ = "DOS " + DosVersion$                 ' Check current DOS version
  164.     Lc$ = "abcdefghijklmnopqrstuvwxyz"          ' Lowercase letters
  165.     Uc$ = UCASE$(Lc$)                           ' Uppercase letters
  166.     Nu$ = "0123456789"                          ' Numerals
  167.     VFln$ = "\._^$~!#%&-@`({})'"                ' Legal pathname characters
  168.  
  169.     DY$ = MID$(DATE$, 4, 2): DY% = VAL(DY$)     ' What day is this?
  170.     MO$ = LEFT$(DATE$, 2): MO% = VAL(MO$)       ' What month is this?
  171.     YR$ = RIGHT$(DATE$, 2): YR% = VAL(YR$)      ' What year is this?
  172.     Now$ = DY$ + "/" + MO$ + "/" + YR$          ' Format it as DD/MM/YY
  173.  
  174.     ToDay$ = LongDate$(DY%, MO%, YR%)           ' Translate date into words
  175.  
  176. '┌────────────────────────────────────────────────────────────────────────┐
  177. '│      Main Menu.                                                        │
  178. '└────────────────────────────────────────────────────────────────────────┘
  179. '
  180.     ReSeed TIMER
  181. D001:
  182.     Head$ = "ASSEMBLY-LANGUAGE TOOLBOX FOR QuickBASIC"
  183.     LOCATE , , 0: Frame Head$, 1: Bar% = 1
  184. D002:
  185.     IF MaxRes% < 1 THEN
  186.        Menu$(0) = "WSFKME X"
  187.     ELSE
  188.        Menu$(0) = "WSFKMEGX"
  189.     END IF
  190.     Menu$(1) = "&Windows": Menu$(2) = "&Screen"
  191.     Menu$(3) = "&Files": Menu$(4) = "&Keyboard"
  192.     Menu$(5) = "&Memory": Menu$(6) = "&Examples"
  193.     Menu$(7) = "&Graphics": Menu$(8) = "E&xit"
  194.     Abort% = FALSE: HotKey% = FALSE
  195.     IF Nxt% THEN
  196.        IF Bar% = 1 THEN Bar% = 8
  197.        IF Bar% = 9 THEN Bar% = 2
  198.     END IF
  199.     BarMenu 3, BarColour%, 8, Menu$(), Bar%, Nxt%, 1, RootName$, Mouse%
  200.     SELECT CASE Bar%
  201.         CASE 1
  202.              GOTO D100
  203.         CASE 2
  204.              GOTO D200
  205.         CASE 3
  206.              GOTO D300
  207.         CASE 4
  208.              GOTO D400
  209.         CASE 5
  210.              GOTO D500
  211.         CASE 6
  212.              GOTO D600
  213.         CASE 7
  214.              GOTO D700
  215.         CASE 8
  216.              GOTO D800
  217.         CASE 9
  218.              HelpMate 0, "", 0, ""
  219.         CASE ELSE
  220.              Ok% = Verify%(1, 9, "Exit program, are you sure", 0, Mouse%)
  221.              IF Ok% THEN GOTO Egress
  222.     END SELECT
  223. GOTO D002
  224.  
  225. '┌────────────────────────────────────────────────────────────────────────┐
  226. '│      Popup Window Demonstration.                                       │
  227. '└────────────────────────────────────────────────────────────────────────┘
  228. '
  229. D100:
  230.     A$ = STRING$(1680, "░"): FastPrint 4, 1, A$, 30
  231.     FastPrint 25, 1, SPACE$(80), StatColour%: A$ = ""
  232.     FastPrint 25, 2, Adaptor$, StatColour%
  233.     FastPrint 25, 71, DOS$, StatColour%
  234.     FOR M% = 1 TO 3
  235.         Area% = 0: O% = 0: B% = 1
  236.         DO
  237.             H% = Rand%(5, 10): W% = Rand%(14, 40)
  238.             Area% = Area% + (H% + 1) * (W% + 1)
  239.             IF Area% > 7200 THEN EXIT DO
  240.             K% = Rand%(4, 24 - H%): J% = Rand%(1, 79 - W%)
  241.             R% = Rand%(1, 4): S% = Rand%(1, 4)
  242.             Attrib% = Attribute%(15, B%)
  243.             PopUp K%, J%, H%, W%, Attrib%, R%, S%, -1
  244.             FastPrint K%, J% + ((W% \ 2) - 5), "[ WINDOW ]", Attrib%
  245.             O% = O% + 1: B% = B% + 1: IF B% > 6 THEN B% = 1
  246.          LOOP UNTIL O% = 30
  247.          IF (M% = 3) THEN SLEEP 3 ELSE SLEEP 1
  248.          FOR I% = O% TO 1 STEP -1
  249.              ShutUp -1
  250.          NEXT I%
  251.     NEXT M%
  252.     PopUp 4, 15, 10, 30, 52, 4, 1, -1: PopUp 3, 36, 13, 40, 47, 3, 1, -1
  253.     PopUp 9, 10, 13, 40, 31, 2, 1, -1: PopUp 12, 42, 11, 36, 67, 1, 1, -1
  254.     PopUp 2, 31, 5, 20, 78, 2, 1, -1: FastPrint 4, 34, "Presenting ...", 78
  255.     SLEEP 3: KeyFlush: Attrib% = Attribute%(0, 7)
  256.     PopUp 8, 20, 7, 40, Attrib%, 2, 1, -1
  257.     FastPrint 8, 31, "[ QUICK  WINDOWS ]", Attrib%
  258.     FastPrint 10, 29, "Windowing Routines for", Attrib%
  259.     FastPrint 11, 30, "Microsoft QuickBASIC", Attrib%
  260.     SLEEP 3: KeyFlush: Attrib% = Attribute%(0, 3)
  261.     PopUp 17, 55, 7, 24, Attrib%, 1, 3, -1
  262.     FastPrint 19, 66, "By", Attrib%
  263.     FastPrint 20, 59, "Christy  Gemmell", Attrib%
  264.     FastPrint 21, 57, "with acknowledgement", Attrib%
  265.     FastPrint 22, 58, "to Rick Fothergill", Attrib%
  266.     SLEEP 3: KeyFlush: Attrib% = Attribute%(14, 1)
  267.     PopUp 13, 2, 10, 23, Attrib%, 2, 4, 0
  268.     FastPrint 15, 4, "A Library of screen", Attrib%
  269.     FastPrint 16, 4, "handling procedures", Attrib%
  270.     FastPrint 17, 4, "and functions which", Attrib%
  271.     FastPrint 18, 4, "can be incorporated", Attrib%
  272.     FastPrint 19, 4, "in your QuickBASIC", Attrib%
  273.     FastPrint 20, 9, "programs.", Attrib%
  274.     SLEEP 4: KeyFlush: Attrib% = Attribute%(15, 1)
  275.     PopUp 16, 27, 5, 26, Attrib%, 2, 1, 0
  276.     FastPrint 18, 30, "HOLD ONTO YOUR HATS", Attrib%
  277.     SLEEP 2: KeyFlush: FOR I% = 1 TO 9: ShutUp -1: NEXT
  278.     Attrib% = 112: PopUp 9, 16, 8, 50, Attrib%, 2, 2, 0: RESTORE Blurb
  279.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, Attrib%: NEXT
  280.     SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, Attrib%
  281.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, Attrib%: NEXT
  282.     SLEEP 5: KeyFlush: IF Colour% THEN Attrib% = Attribute%(1, 2)
  283.     PopUp 5, 5, 6, 35, Attrib%, 0, 1, -1
  284.     SLEEP 3: ShutUp -1: Scroll 1, 10, 17, 15, 64, 0, 112
  285.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  286.     SLEEP 6: KeyFlush: IF Colour% THEN Attrib% = Attribute%(15, 6)
  287.     PopUp 6, 5, 8, 35, Attrib%, 0, 2, -1
  288.     FastPrint 6, 15, "[  No  Frame  ]", Attrib%
  289.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(11, 1)
  290.     PopUp 7, 8, 8, 35, Attrib%, 1, 2, -1
  291.     FastPrint 7, 17, "[ Frame Style 1 ]", Attrib%
  292.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(0, 2)
  293.     PopUp 8, 11, 8, 35, Attrib%, 2, 2, -1
  294.     FastPrint 8, 20, "[ Frame Style 2 ]", Attrib%
  295.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(0, 3)
  296.     PopUp 9, 14, 8, 35, Attrib%, 3, 2, -1
  297.     FastPrint 9, 23, "[ Frame Style 3 ]", Attrib%
  298.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(14, 4)
  299.     PopUp 10, 17, 8, 35, Attrib%, 4, 2, -1
  300.     FastPrint 10, 26, "[ Frame Style 4 ]", Attrib%
  301.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(12, 5)
  302.     PopUp 11, 20, 8, 35, Attrib%, 5, 2, -1
  303.     FastPrint 11, 29, "[ Frame Style 5 ]", Attrib%
  304.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(13, 6)
  305.     PopUp 12, 23, 8, 35, Attrib%, 6, 2, -1
  306.     FastPrint 12, 32, "[ Frame Style 6 ]", Attrib%
  307.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(15, 2)
  308.     PopUp 13, 26, 8, 35, Attrib%, 7, 2, -1
  309.     FastPrint 13, 35, "[ Frame Style 7 ]", Attrib%
  310.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(1, 3)
  311.     PopUp 14, 29, 8, 35, Attrib%, 8, 2, -1
  312.     FastPrint 14, 39, "[ Frame Style 8 ]", Attrib%
  313.     SLEEP 4: KeyFlush: FOR I% = 1 TO 9: ShutUp -1: NEXT
  314.     Scroll 1, 10, 17, 15, 64, 0, 112
  315.     FOR I% = 11 TO 13: READ Me$: FastPrint I%, 20, Me$, 112: NEXT
  316.     SLEEP 6: KeyFlush
  317.     FOR I% = 1 TO 15
  318.         Label$ = "[ Colour:" + STR$(I%) + " ]"
  319.         J% = Rand%(1, 51): K% = Rand%(1, 13)
  320.         Attrib% = Attribute%(I%, 0)
  321.         PopUp K% + 1, J% + 1, 7, 24, Attrib%, 4, 0, 0
  322.         FastPrint K% + 1, J% + 6, Label$, Attrib%
  323.         SLEEP 1: KeyFlush
  324.     NEXT I%
  325.     Attrib% = Attribute%(31, B%)
  326.     PopUp 7, 20, 7, 24, Attrib%, 4, 2, 0
  327.     FastPrint 7, 25, "[ Colour: 31 ]", Attrib%
  328.     SLEEP 4: KeyFlush: FOR I% = 1 TO 16: ShutUp 0: NEXT
  329.     Scroll 1, 10, 17, 15, 64, 0, 112
  330.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  331.     SLEEP 6: KeyFlush: Attrib% = Attribute%(15, 1)
  332.     PopUp 2, 2, 11, 30, Attrib%, 7, 0, 0
  333.     SLEEP 3: KeyFlush: ShutUp 0: Scroll 1, 10, 17, 15, 64, 0, 112
  334.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  335.     SLEEP 6: KeyFlush: Attrib% = Attribute%(14, 5)
  336.     PopUp 5, 5, 10, 30, Attrib%, 2, 1, 0
  337.     FastPrint 9, 14, "Left Shadow", Attrib%
  338.     SLEEP 2: KeyFlush: Attrib% = Attribute%(0, 2)
  339.     PopUp 5, 45, 10, 30, Attrib%, 2, 2, 0
  340.     FastPrint 9, 54, "Right Shadow", Attrib%
  341.     SLEEP 2: KeyFlush: ShutUp 0: ShutUp 0
  342.     Scroll 1, 10, 17, 15, 64, 0, 112
  343.     FastPrint 12, 31, "Windows can be zoomed", 112
  344.     FastPrint 13, 33, "onto the screen.", 112
  345.     SLEEP 3: KeyFlush: Attrib% = Attribute%(0, 2)
  346.     PopUp 2, 2, 15, 60, Attrib%, 2, 0, -1
  347.     SLEEP 2: KeyFlush: Attrib% = Attribute%(0, 3)
  348.     PopUp 13, 10, 10, 60, Attrib%, 3, 0, -1
  349.     SLEEP 2: KeyFlush: Attrib% = Attribute%(14, 5)
  350.     PopUp 7, 33, 10, 45, Attrib%, 1, 0, -1
  351.     SLEEP 2: KeyFlush: Attrib% = Attribute%(15, 4)
  352.     IF NOT Colour% THEN Attrib% = 112
  353.     PopUp 7, 10, 12, 63, Attrib%, 2, 1, -1
  354.     FastPrint 12, 32, "<<< W O W >>>", Attrib%
  355.     SLEEP 3: KeyFlush: FOR I% = 1 TO 4: ShutUp -1: NEXT
  356.     Scroll 1, 10, 17, 15, 64, 0, 112
  357.     FOR I% = 10 TO 14: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  358.     SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  359.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  360.     SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  361.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  362.     SLEEP 6: KeyFlush: Attrib% = Attribute%(0, 2)
  363.     PopUp 3, 5, 15, 45, Attrib%, 4, 1, -1
  364.     FastPrint 9, 14, "This is the first level ...", Attrib%
  365.     SLEEP 2: KeyFlush: Attrib% = Attribute%(15, 4)
  366.     PopUp 6, 29, 17, 50, Attrib%, 4, 1, -1
  367.     FastPrint 12, 40, "This is the second level ...", Attrib%
  368.     SLEEP 2: KeyFlush: Attrib% = Attribute%(0, 3)
  369.     PopUp 9, 22, 15, 35, Attrib%, 4, 1, -1
  370.     FastPrint 16, 26, "This is the third level ...", Attrib%
  371.     SLEEP 2: KeyFlush: FastPrint 16, 26, "Now to go back ...         ", Attrib%
  372.     SLEEP 1: ShutUp -1: SLEEP 1: ShutUp -1: SLEEP 1: ShutUp -1: SLEEP 2
  373.     Scroll 1, 10, 17, 15, 64, 0, 112: KeyFlush
  374.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  375.     Ok% = Verify%(1, 9, "Are you enjoying this program", 0, Mouse%)
  376.     Scroll 1, 10, 17, 15, 64, 0, 112
  377.     IF Ok% THEN
  378.        FastPrint 11, 28, "You sound very positive!", 112
  379.     ELSE
  380.        FastPrint 11, 28, "You sound very negative!", 112
  381.     END IF
  382.     SLEEP 2: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  383.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  384.     SLEEP 3: KeyFlush: SL% = StatusLine%("Want to carry on?")
  385.     IF SL% = 78 OR SL% = 110 OR SL% = 27 THEN
  386.        ShutUp -1
  387.     ELSE
  388.        A$ = STRING$(44, SL%)
  389.        FOR I% = 10 TO 15: FastPrint I%, 19, A$, 112: NEXT
  390.        SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  391.        FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  392.        SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  393.        Ready% = PrinTest%(Printer%)
  394.        IF Ready% THEN
  395.           FastPrint 11, 30, "PRINTER CONTROL MENU", 112
  396.           FastPrint 13, 24, "The Toolbox contains versions for", 112
  397.           FastPrint 14, 27, "two other popular printers.", 112
  398.           FastPrint 25, 2, "Press <ESC> to Abort       ", StatColour%
  399.           PrintSet 4, 51, 0, Printer%, Mouse%
  400.           FastPrint 25, 1, SPACE$(80), StatColour%
  401.           FastPrint 25, 2, Adaptor$, StatColour%
  402.           FastPrint 25, 71, DOS$, StatColour%
  403.           SLEEP 5: KeyFlush
  404.        END IF
  405.        ShutUp -1
  406.        PopUp 4, 15, 10, 30, 52, 4, 1, -1
  407.        PopUp 3, 36, 13, 40, 47, 3, 1, -1
  408.        PopUp 9, 10, 13, 40, 78, 2, 1, -1
  409.        PopUp 12, 42, 11, 36, 67, 1, 1, -1
  410.        PopUp 9, 16, 8, 52, 112, 2, 1, -1
  411.        FastPrint 11, 20, "The video routines in the Toolbox Library", 112
  412.        FastPrint 12, 20, "give you all you need to create powerful", 112
  413.        FastPrint 13, 20, "and professional screen displays in your", 112
  414.        FastPrint 14, 20, "QuickBASIC programs.", 112: SLEEP 9: KeyFlush
  415.        FOR I% = 1 TO 5: ShutUp -1: SLEEP 1: KeyFlush: NEXT
  416.        IF NOT Ready% THEN
  417.           PopUp 10, 18, 5, 44, 96, 1, 2, 0
  418.           Me$ = "Pity you didn't have a printer connected"
  419.           FastPrint 12, 20, Me$, 96: SLEEP 5: KeyFlush: ShutUp 0
  420.        END IF
  421.     END IF
  422. GOTO D001
  423.  
  424. '┌────────────────────────────────────────────────────────────────────────┐
  425. '│      Screen control functions.                                         │
  426. '└────────────────────────────────────────────────────────────────────────┘
  427. '
  428. D200:
  429.     Menu$(0) = "F#SC#B"
  430.     Menu$(1) = "&Fast screen printing"
  431.     Menu$(3) = "&Selective scrolling"
  432.     Menu$(4) = "&Clear to the end"
  433.     Menu$(6) = "&Background colours"
  434.     VerMenu 4, 3, BarColour%, 1, 6, "SCREEN CONTROL", Menu$(), Choice%, Nxt%, Bar%, 1, RootName$, Mouse%
  435.     IF Nxt% THEN GOTO D002
  436.     SELECT CASE Choice%
  437.         CASE 1
  438.              GOTO D210
  439.         CASE 3
  440.              GOTO D220
  441.         CASE 4
  442.              GOTO D230
  443.         CASE 6
  444.              GOTO D240
  445.         CASE ELSE
  446.     END SELECT
  447. GOTO D002
  448.  
  449. '   Screen print demonstration
  450. '
  451. D210:
  452.     A$ = STRING$(1680, "«"): B$ = STRING$(1680, "»")
  453.     FOR I% = 1 TO 255
  454.         FastPrint 4, 1, A$, I%: FastPrint 4, 1, B$, I%
  455.         IF INKEY$ = CHR$(27) THEN EXIT FOR
  456.     NEXT I%
  457.     IF I% = 256 THEN
  458.        A$ = "": B$ = "": C$ = STRING$(1680, "░"): Attrib% = 30
  459.        FastPrint 4, 1, C$, Attrib%: C$ = ""
  460.        IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  461.        PopUp 12, 21, 7, 40, Attrib%, 3, 4, -1
  462.        FastPrint 15, 33, "<<< W O W >>>", Attrib%
  463.        SLEEP 5: KeyFlush: ShutUp -1
  464.     END IF
  465. GOTO D200
  466.  
  467. '   Selective scrolling demonstration
  468. '
  469. D220:
  470.     Panel 4, 1, 21, 80, 1, TextColour%
  471.     IF Colour% THEN BackGround% = 7 ELSE BackGround% = 0
  472.     Clr% = 1: IF Mouse% THEN MouseShow
  473.     DO
  474.        Scroll 0, 4, 21, 7, 60, 1, Attribute%(0, Clr%)
  475.        Scroll 2, 9, 6, 19, 20, 1, Attribute%(0, Clr%)
  476.        Scroll 3, 9, 61, 19, 75, 1, Attribute%(0, Clr%)
  477.        Scroll 1, 21, 21, 24, 60, 1, Attribute%(0, Clr%)
  478.        COLOR Clr%, BackGround%
  479.        LOCATE 19, 25: PRINT "SCROLLING UP";
  480.        Scroll 0, 9, 23, 19, 38, 1, Attribute%(Clr%, BackGround%)
  481.        LOCATE 9, 43: PRINT "SCROLLING DOWN";
  482.        Scroll 1, 9, 41, 19, 58, 1, Attribute%(Clr%, BackGround%)
  483.        Pause 1: Clr% = Clr% + 1
  484.        IF Clr% = BackGround% THEN Clr% = Clr% + 1
  485.        IF Clr% > 7 THEN Clr% = 1
  486.        IF Mouse% THEN
  487.           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  488.           IF LeftButton% THEN
  489.              IF yMouse% > 15 AND yMouse% < 24 THEN
  490.                 Z$ = CHR$(32): EXIT DO
  491.              END IF
  492.           END IF
  493.        END IF
  494.        Z$ = INKEY$
  495.     LOOP UNTIL Z$ = CHR$(27)
  496.     IF Mouse% THEN
  497.        CALL MouseHide: IF Z$ <> CHR$(27) THEN GOTO D002
  498.     END IF
  499. GOTO D200
  500.  
  501. '   Clear to end of line or screen
  502. '
  503. D230:
  504.     Panel 4, 1, 24, 80, 1, TextColour%
  505.     IF Colour% THEN Attrib% = 15 ELSE Attrib% = 112
  506.     FastPrint 22, 30, "Press a key to do it", TextColour%
  507.     FastPrint 10, 3, "Clear end of line >", TextColour%
  508.     LOCATE 10, 22, 1: R$ = INPUT$(1): ClearEnd 0, Attrib%
  509.     FastPrint 15, 3, "Clear end of screen >", TextColour%
  510.     LOCATE 15, 24, 1: R$ = INPUT$(1): ClearEnd 1, Attrib%
  511.     LOCATE , , 0: Frame Head$, 0
  512. GOTO D200
  513.  
  514. D240:
  515.     FastPrint 25, 1, SPACE$(80), StatColour%
  516.     FastPrint 25, 3, "Press any key, <Esc> to abort", StatColour%
  517.     RANDOMIZE TIMER: IF Mouse% THEN MouseShow
  518.     DO
  519.        Row% = Rand%(5, 20): Col% = Rand%(2, 62): Rows% = Rand%(1, 16)
  520.        IF Row% + Rows% > 23 THEN Rows% = 24 - Row%
  521.        Cols% = Rand%(1, 60): IF Col% + Cols% > 78 THEN Cols% = 79 - Col%
  522.        Attrib% = Rand%(0, 255): BackFill Row%, Col%, Rows%, Cols%, Attrib%
  523.        DO
  524.           IF Mouse% THEN
  525.              MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  526.              IF LeftButton% THEN
  527.                 IF yMouse% > 15 AND yMouse% < 24 THEN
  528.                    Z$ = CHR$(27)
  529.                    EXIT DO
  530.                 ELSE
  531.                    Z$ = CHR$(32)
  532.                    EXIT DO
  533.                 END IF
  534.              END IF
  535.           END IF
  536.           Z$ = INKEY$
  537.        LOOP UNTIL Z$ <> ""
  538.     LOOP UNTIL Z$ = CHR$(27)
  539.     Frame Head$, 0: IF Mouse% THEN MouseHide:
  540.     IF Z$ <> CHR$(27) THEN GOTO D002
  541. GOTO D200
  542.  
  543. '┌────────────────────────────────────────────────────────────────────────┐
  544. '│      File Functions.                                                   │
  545. '└────────────────────────────────────────────────────────────────────────┘
  546. '
  547. D300:
  548.     Menu$(0) = "WH#S"
  549.     Menu$(1) = "&Where's that file?"
  550.     Menu$(2) = "&How big is that file?"
  551.     Menu$(4) = "&Sort that file"
  552.     Abort% = FALSE
  553.     VerMenu 4, 9, BarColour%, 1, 4, "FILE FUNCTIONS", Menu$(), Choice%, Nxt%, Bar%, 1, RootName$, Mouse%
  554.     IF Nxt% THEN GOTO D002
  555.     SELECT CASE Choice%
  556.         CASE 1
  557.              GOTO D310
  558.         CASE 2
  559.              GOTO D320
  560.         CASE 4
  561.              GOTO D330
  562.         CASE ELSE
  563.     END SELECT
  564. GOTO D002
  565.  
  566. '   File Finder
  567. '
  568. D310:
  569.     Panel 4, 1, 21, 80, 1, TextColour%
  570.     RESTORE Finder
  571.     FOR I% = 1 TO 13
  572.         READ Me$: FastPrint 5 + I%, 14, Me$, TextColour%
  573.     NEXT I%
  574.     Scroll 1, 19, 2, 21, 79, 0, TextColour%
  575.     PopUp 19, 19, 4, 44, 96, 2, 2, -1: HotKey% = FALSE
  576.     FastPrint 20, 28, "Enter name of file to find", 96
  577.     LOCATE 21, 21: Legal$ = Uc$ + Lc$ + Nu$ + VFln$ + ":*?"
  578.     PathName$ = RevInput$(40, "", Legal$, 1, "REVINPUT", 0, HotKey%)
  579.     ShutUp -1
  580.     IF HotKey% THEN
  581.        Abort% = TRUE
  582.     ELSE
  583.        PathName$ = RTRIM$(LTRIM$(PathName$))
  584.        Found$ = FindFile$(PathName$, 0, Mouse%)
  585.        IF Found$ <> "" THEN
  586.           Found$ = LTRIM$(RTRIM$(Found$))
  587.           OT% = 40 - (LEN(Found$) \ 2)
  588.           FastPrint 20, OT%, Found$, TextColour%
  589.        END IF
  590.     END IF
  591. GOTO D300
  592.  
  593. D320:
  594.     Panel 4, 1, 21, 80, 1, TextColour%
  595.     RESTORE Size
  596.     FOR I% = 1 TO 12
  597.         READ Me$: FastPrint 5 + I%, 8, Me$, TextColour%
  598.     NEXT I%
  599.     Scroll 1, 18, 3, 23, 78, 0, TextColour%: HotKey% = FALSE
  600.     LOCATE 20, 8: Legal$ = Uc$ + Lc$ + Nu$ + VFln$ + "*?"
  601.     PathName$ = RevInput$(64, "", Legal$, 1, "REVINPUT", 0, HotKey%)
  602.     IF HotKey% THEN
  603.        Abort% = TRUE
  604.     ELSE
  605.        PathName$ = LTRIM$(RTRIM$(PathName$))
  606.        IF PathName$ = "" THEN PathName$ = "*.*"
  607.        IF IsDir%(PathName$) THEN PathName$ = PathName$ + "\*.*"
  608.        FastPrint 20, 8, SPACE$(64), TextColour%
  609.        FastPrint 20, 8, PathName$, TextColour%
  610.        Bytes& = FileSize&(PathName$)
  611.        IF Bytes& > 0 THEN
  612.           Me$ = "Size = " + LTRIM$(RTRIM$(STR$(Bytes&))) + " bytes"
  613.           FastPrint 22, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  614.        ELSE
  615.           MisTake 9, "No match found!", 0, Mouse%
  616.        END IF
  617.     END IF
  618. GOTO D300
  619.  
  620. '   File sorter.
  621. '
  622. D330:
  623.     Panel 4, 1, 21, 80, 1, TextColour%
  624.     RESTORE Sorts
  625.     FOR I% = 1 TO 10
  626.         READ Me$: FastPrint 4 + I%, 8, Me$, TextColour%
  627.     NEXT I%
  628.     IF FileSize&("SAMPLE.DAT") < 1 THEN
  629.        MisTake 9, "Can't find SAMPLE data file to sort!", 0, Mouse%
  630.     ELSE
  631.        IF Colour% THEN Attrib% = 32 ELSE Attrib% = 112
  632.        PopUp 16, 3, 8, 74, Attrib%, 1, 4, -1
  633.        FastPrint 16, 36, " SAMPLE.DAT ", Attrib%
  634.        OPEN "SAMPLE.DAT" FOR INPUT AS #1
  635.        FOR I% = 1 TO 6
  636.            LINE INPUT #1, A$: OL% = LEN(A$)
  637.            Me$ = LEFT$(A$, OL% - 2)
  638.            FastPrint 16 + I%, 40 - (OL% \ 2) + 1, Me$, Attrib%
  639.        NEXT I%
  640.        CLOSE 1: SL% = StatusLine%("To begin sorting ...")
  641.        SortFile "SAMPLE.DAT", 1, 10, OL% + 2, Done%
  642.        IF Done% THEN
  643.           OPEN "SAMPLE.DAT" FOR INPUT AS #1
  644.           FOR I% = 1 TO 6
  645.               LINE INPUT #1, A$: OL% = LEN(A$)
  646.               Me$ = LEFT$(A$, OL% - 2)
  647.               FastPrint 16 + I%, 40 - (OL% \ 2) + 1, Me$, Attrib%
  648.           NEXT I%
  649.           CLOSE 1
  650.           SL% = StatusLine%("File successfully sorted"): ShutUp -1
  651.        ELSE
  652.           ShutUp -1
  653.           FastPrint 21, 30, "Unable to sort file", TextColour%
  654.        END IF
  655.     END IF
  656. GOTO D300
  657.  
  658. '┌────────────────────────────────────────────────────────────────────────┐
  659. '│      Keyboard functions and procedures.                                │
  660. '└────────────────────────────────────────────────────────────────────────┘
  661. '
  662. D400:
  663.     Menu$(0) = "AKT#M"
  664.     Menu$(1) = "&ASCII and scan codes"
  665.     Menu$(2) = "&Keyboard shift flags"
  666.     Menu$(3) = "&Typeahead buffer"
  667.     Menu$(5) = "&Mouse position and status"
  668.     VerMenu 4, 16, BarColour%, 1, 5, "KEYBOARD AND MOUSE", Menu$(), Choice%, Nxt%, Bar%, 1, RootName$, Mouse%
  669.     IF Nxt% THEN GOTO D002
  670.     SELECT CASE Choice%
  671.         CASE 1
  672.              GOTO D410
  673.         CASE 2
  674.              GOTO D420
  675.         CASE 3
  676.              GOTO D430
  677.         CASE 5
  678.              GOTO D440
  679.         CASE ELSE
  680.     END SELECT
  681. GOTO D002
  682.  
  683. '   Indexes to the font table in ROM-BIOS, then translates the pixel
  684. '   values of the character specified by a keypress, into a large-
  685. '   scale representation of that character.
  686. '
  687. D410:
  688.     Panel 4, 1, 21, 80, 1, TextColour%
  689.     Fore$ = STRING$(2, "█"): Back$ = STRING$(2, "░")
  690.     FastPrint 6, 31, "┌────────────────┐", TextColour%
  691.     FOR Row% = 7 TO 14
  692.         FastPrint Row%, 31, "│" + STRING$(16, "░") + "│", TextColour%
  693.     NEXT Row%
  694.     FastPrint 15, 31, "└────────────────┘", TextColour%
  695.     FastPrint 25, 1, SPACE$(80), StatColour%
  696.     FastPrint 25, 3, "Press any key, or <Esc> to abort", StatColour%
  697.     LOCATE 21, 40, 1: Abort% = FALSE: CALL KeyFlush
  698.     DO
  699.         Character% = KeyIn%: IF Character% = 27 THEN EXIT DO
  700.         FastPrint 21, 40, " ", TextColour%
  701.         FastPrint 16, 10, SPACE$(60), TextColour%
  702.         SELECT CASE Character%
  703.             CASE 0 TO 127
  704.                  FOR Row% = 1 TO 8
  705.                      Pixel% = FarPeek%(&HF000, &HFA6D + (Character% * 8) + Row%)
  706.                      IF Pixel% = 0 THEN
  707.                         FastPrint Row% + 6, 32, STRING$(16, "░"), TextColour%
  708.                      ELSE
  709.                         Col% = 32
  710.                         FOR Column% = 7 TO 0 STEP -1
  711.                             IF Pixel% < 2 ^ Column% THEN
  712.                                FastPrint Row% + 6, Col%, Back$, TextColour%
  713.                             ELSE
  714.                                FastPrint Row% + 6, Col%, Fore$, TextColour%
  715.                                Pixel% = Pixel% - 2 ^ Column%
  716.                             END IF
  717.                             Col% = Col% + 2
  718.                         NEXT Column%
  719.                      END IF
  720.                  NEXT Row%
  721.             CASE ELSE
  722.                  IF Character% < 0 THEN
  723.                     Me$ = SPACE$(16)
  724.                  ELSE
  725.                     Me$ = STRING$(16, Character%)
  726.                  END IF
  727.                  FOR Row% = 1 TO 8
  728.                      FastPrint Row% + 6, 32, Me$, TextColour%
  729.                  NEXT Row%
  730.         END SELECT
  731.         IF Character% < 0 THEN
  732.            Me$ = "Scan Code " + LTRIM$(RTRIM$(STR$(ABS(Character%))))
  733.         ELSE
  734.            Me$ = "ASCII Code " + LTRIM$(RTRIM$(STR$(Character%)))
  735.         END IF
  736.         FastPrint 16, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  737.     LOOP WHILE 1
  738.     LOCATE , , 0: Frame Head$, 0
  739. GOTO D400
  740.  
  741. '   Keyboard shift flags.
  742. '
  743. D420:
  744.     Panel 4, 1, 21, 80, 1, TextColour%
  745.     ShiftFlags% = KeyFlags%: Flag$ = STRING$(16, "0")
  746.     FOR I% = 15 TO 0 STEP -1
  747.         IF BitTest%(ShiftFlags%, I%) THEN
  748.            MID$(Flag$, 16 - I%, 1) = "1"
  749.         END IF
  750.     NEXT I%
  751.     FastPrint 5, 40, "Keyboard Status Word at 0040:0017", TextColour%
  752.     FastPrint 7, 40, "Bit settings (1 = set)", TextColour%
  753.     FastPrint 5, 3, " F E D C B A 9 8 7 6 5 4 3 2 1 0", TextColour%
  754.     FastPrint 6, 3, "┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐", TextColour%
  755.     FastPrint 7, 3, "│", TextColour%: Col% = 4
  756.     FOR I% = 1 TO 16
  757.         FastPrint 7, Col%, MID$(Flag$, I%, 1) + "│", TextColour%
  758.         Col% = Col% + 2
  759.     NEXT I%
  760.     FastPrint 8, 3, "└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘", TextColour%
  761.     FastPrint 9, 3, " │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─┴─", TextColour%
  762.     FastPrint 10, 3, " │ │ │ │ │ │ │ │ │ │ │ │ │ └─────", TextColour%
  763.     FastPrint 11, 3, " │ │ │ │ │ │ │ │ │ │ │ │ └───────", TextColour%
  764.     FastPrint 12, 3, " │ │ │ │ │ │ │ │ │ │ │ └─────────", TextColour%
  765.     FastPrint 13, 3, " │ │ │ │ │ │ │ │ │ │ └───────────", TextColour%
  766.     FastPrint 14, 3, " │ │ │ │ │ │ │ │ │ └─────────────", TextColour%
  767.     FastPrint 15, 3, " │ │ │ │ │ │ │ │ └───────────────", TextColour%
  768.     FastPrint 16, 3, " │ │ │ │ │ │ │ └─────────────────", TextColour%
  769.     FastPrint 17, 3, " │ │ │ │ │ │ └───────────────────", TextColour%
  770.     FastPrint 18, 3, " │ │ │ │ │ └─────────────────────", TextColour%
  771.     FastPrint 19, 3, " │ │ │ │ └───────────────────────", TextColour%
  772.     FastPrint 20, 3, " │ │ │ └─────────────────────────", TextColour%
  773.     FastPrint 21, 3, " │ │ └───────────────────────────", TextColour%
  774.     FastPrint 22, 3, " │ └─────────────────────────────", TextColour%
  775.     FastPrint 23, 3, " └───────────────────────────────", TextColour%
  776.     FastPrint 25, 1, SPACE$(80), StatColour%
  777.     FastPrint 25, 3, "Press <Esc> to abort", StatColour%
  778.     RESTORE Shift
  779.     FOR I% = 1 TO 15
  780.         READ Me$: FastPrint I% + 8, 40, Me$, TextColour%
  781.     NEXT I%
  782.     IF Mouse% THEN MouseShow
  783.     DO
  784.         ShiftFlags% = KeyFlags%
  785.         FOR I% = 15 TO 0 STEP -1
  786.             IF BitTest%(ShiftFlags%, I%) THEN
  787.                MID$(Flag$, 16 - I%, 1) = "1"
  788.             ELSE
  789.                MID$(Flag$, 16 - I%, 1) = "0"
  790.             END IF
  791.         NEXT I%
  792.         Col% = 4
  793.         FOR I% = 1 TO 16
  794.             FastPrint 7, Col%, MID$(Flag$, I%, 1) + "│", TextColour%
  795.             Col% = Col% + 2
  796.         NEXT I%
  797.         CL% = CapsLock%(2)
  798.         IF CL% THEN
  799.            FastPrint 25, 65, "CAPS", 14
  800.         ELSE
  801.            FastPrint 25, 65, "    ", StatColour%
  802.         END IF
  803.         NL% = NumLock%(2)
  804.         IF NL% THEN
  805.            FastPrint 25, 70, "NUM", 14
  806.         ELSE
  807.            FastPrint 25, 70, "   ", StatColour%
  808.         END IF
  809.         SL% = ScrLock%(2)
  810.         IF SL% THEN
  811.            FastPrint 25, 74, "SCRL", 14
  812.         ELSE
  813.            FastPrint 25, 74, "    ", StatColour%
  814.         END IF
  815.         IF Mouse% THEN
  816.            MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  817.            IF LeftButton% THEN
  818.               IF yMouse% > 15 AND yMouse% < 24 THEN
  819.                  Z$ = CHR$(32): EXIT DO
  820.               END IF
  821.            END IF
  822.         END IF
  823.         Z$ = INKEY$
  824.     LOOP UNTIL Z$ = CHR$(27)
  825.     Frame Head$, 0
  826.     IF Mouse% THEN
  827.        CALL MouseHide: IF Z$ <> CHR$(27) THEN GOTO D002
  828.     END IF
  829. GOTO D400
  830.  
  831. '   Keyboard typeahead buffer.
  832. '
  833. D430:
  834.     COLOR 7, 0: Panel 4, 1, 21, 80, 1, 14
  835.     RESTORE KeyBuff: READ Items%
  836.     FOR I% = 1 TO Items%
  837.         READ Row%, Col%, Me$: LOCATE Row%, Col%, 0: PRINT Me$;
  838.     NEXT I%
  839.     LOCATE 11, 68: COLOR 11
  840.     Start% = &H400 + FarPeek%(&H40, &H80)
  841.     Finish% = &H400 + FarPeek%(&H40, &H82)
  842.     PRINT RIGHT$("0000" + HEX$(Start%), 4); " ";
  843.     PRINT RIGHT$("0000" + HEX$(Finish%), 4);
  844.     DO
  845.         Hd% = &H400 + FarPeek%(&H40, &H1A)
  846.         Tl% = &H400 + FarPeek%(&H40, &H1C)
  847.         LOCATE 11, 4: COLOR 11
  848.         PRINT RIGHT$("0000" + HEX$(Hd%), 4); " ";
  849.         PRINT RIGHT$("0000" + HEX$(Tl%), 4);
  850.         COLOR 13: LOCATE 9, 17: PRINT SPACE$(48);
  851.         LOCATE 9, 17 + ((Hd% - &H41E) \ 2) * 3: PRINT CHR$(25);
  852.         COLOR 12: LOCATE 13, 17: PRINT SPACE$(48);
  853.         LOCATE 13, 17 + ((Tl% - &H41E) \ 2) * 3: PRINT CHR$(24);
  854.         FOR I% = 0 TO 15
  855.             C% = FarPeek%(&H40, &H1E + (I% * 2))
  856.             S% = FarPeek%(&H40, &H1E + (I% * 2) + 1)
  857.             IF C% < 32 THEN Ky$ = "  " ELSE Ky$ = CHR$(C%) + " "
  858.             LOCATE 11, 17 + (I% * 3): COLOR 14: PRINT Ky$;
  859.             LOCATE 14, 17 + (I% * 3): COLOR 9
  860.             PRINT RIGHT$("0" + HEX$(C%), 2);
  861.             LOCATE 15, 17 + (I% * 3): COLOR 10
  862.             PRINT RIGHT$("0" + HEX$(S%), 2);
  863.         NEXT I%
  864.         IF Hd% >= Tl% THEN
  865.            Kys% = 16 - ((Hd% - Tl%) \ 2)
  866.         ELSE
  867.            Kys% = (Tl% - Hd%) \ 2
  868.         END IF
  869.         LOCATE 14, 76: IF Kys% = 16 THEN Kys% = 0
  870.         PRINT RIGHT$(" " + LTRIM$(RTRIM$(STR$(Kys%))), 2);
  871.         IF Kys% = 15 THEN
  872.            LOCATE 15, 67: COLOR 28: PRINT "BUFFER FULL";
  873.            SLEEP 2: KeyFlush: LOCATE , 67: PRINT SPACE$(11);
  874.         END IF
  875.     LOOP UNTIL FarPeek%(&H40, (Tl% - &H400) - 2) = 27
  876.     COLOR 7, 0: LOCATE 20, 1, 0
  877.     Dummy$ = INPUT$(Kys%)
  878. GOTO D400
  879.  
  880. '   Report mouse cursor position and status.
  881. '
  882. D440:
  883.     IF Mouse% THEN
  884.        Panel 4, 1, 21, 80, 1, TextColour%
  885.        CALL MouseShow
  886.        DO
  887.           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  888.           Me$ = "x=" + LTRIM$(RTRIM$(STR$(xMouse%))) + "  "
  889.           FastPrint 12, 31, Me$, TextColour%
  890.           Me$ = "y=" + LTRIM$(RTRIM$(STR$(yMouse%))) + "  "
  891.           FastPrint 12, 41, Me$, TextColour%
  892.           IF LeftButton% THEN
  893.              IF yMouse% > 15 AND yMouse% < 24 THEN
  894.                 EXIT DO
  895.              ELSE
  896.                 Me$ = "Left button pressed"
  897.              END IF
  898.           ELSE
  899.              Me$ = "                   "
  900.           END IF
  901.           FastPrint 14, 31, Me$, TextColour%
  902.           IF RightButton% THEN
  903.              Me$ = "Right button pressed"
  904.           ELSE
  905.              Me$ = "                    "
  906.           END IF
  907.           FastPrint 15, 31, Me$, TextColour%: Z$ = INKEY$
  908.        LOOP UNTIL Z$ = CHR$(27)
  909.        CALL MouseHide
  910.        IF Z$ <> CHR$(27) THEN GOTO D002
  911.     ELSE
  912.        MisTake 9, "Mouse driver not installed", 0, Mouse%
  913.     END IF
  914. GOTO D400
  915.  
  916. '┌────────────────────────────────────────────────────────────────────────┐
  917. '│      Memory-related functions and procedures.                          │
  918. '└────────────────────────────────────────────────────────────────────────┘
  919. '
  920. D500:
  921.     IF EmsPresent% THEN Menu$(0) = "F#E" ELSE Menu$(0) = "F# "
  922.     Menu$(1) = "Operating system &Flags"
  923.     Menu$(3) = "&Expanded memory services"
  924.     Abort% = FALSE
  925.     VerMenu 4, 26, BarColour%, 1, 3, "MEMORY", Menu$(), Choice%, Nxt%, Bar%, 1, RootName$, Mouse%
  926.     IF Nxt% THEN GOTO D002
  927.     SELECT CASE Choice%
  928.         CASE 1
  929.              GOTO D510
  930.         CASE 3
  931.              GOTO D520
  932.         CASE ELSE
  933.     END SELECT
  934. GOTO D002
  935.  
  936. '┌────────────────────────────────────────────────────────────────────────┐
  937. '│      System Flags.                                                     │
  938. '└────────────────────────────────────────────────────────────────────────┘
  939. '
  940. D510:
  941.     DIM CoOrd%(16, 2): Context% = 1: Topic$ = "FLAGS"
  942.     Panel 4, 1, 21, 80, 1, TextColour%: RESTORE Flags
  943.     FOR I% = 6 TO 21
  944.         READ Me$: FastPrint I%, 6, Me$, TextColour%
  945.     NEXT I%
  946.     Panel 6, 50, 16, 27, 2, 48
  947.     FastPrint 7, 53, "CURRENT FLAG SETTINGS", 48
  948.     FastPrint 8, 50, "╟" + STRING$(25, "─") + "╢", 48
  949.     FOR I% = 10 TO 17
  950.         READ Me$: FastPrint I%, 52, Me$, 48
  951.     NEXT I%
  952.     FOR I% = 1 TO 16
  953.         READ CoOrd%(I%, 1), CoOrd%(I%, 2): F% = GetFlag%(I%)
  954.         F$ = LTRIM$(RTRIM$(STR$(F%))): F$ = RIGHT$("   " + F$, 3)
  955.         FastPrint CoOrd%(I%, 1), CoOrd%(I%, 2), F$, 48
  956.     NEXT I%
  957.     FastPrint 19, 52, "Enter Flag Number:", 48
  958.     FastPrint 25, 3, SPACE$(78), StatColour%
  959.     FastPrint 25, 3, "Press <ESC> to Abort", StatColour%
  960.     DO
  961.        LOCATE 19, 73: HotKey% = FALSE
  962.        Number$ = RevInput$(2, Number$, Nu$, 1, "REVINPUT", 0, HotKey%)
  963.        IF HotKey% THEN
  964.           Abort% = TRUE
  965.        ELSE
  966.           Number% = VAL(Number$)
  967.           IF Number% < 1 OR Number% > 16 THEN
  968.              BEEP
  969.           ELSE
  970.              Number$ = LTRIM$(RTRIM$(STR$(Number%)))
  971.              Number$ = RIGHT$("  " + Number$, 2)
  972.              FastPrint 19, 73, Number$, 48
  973.              Setting% = GetFlag%(Number%)
  974.              Setting$ = RIGHT$("   " + LTRIM$(RTRIM$(STR$(Setting%))), 3)
  975.              LOCATE CoOrd%(Number%, 1), CoOrd%(Number%, 2)
  976.              Setting$ = RevInput$(3, Setting$, Nu$, 1, "REVINPUT", 0, HotKey%)
  977.              IF HotKey% THEN
  978.                 Abort% = TRUE
  979.              ELSE
  980.                 Setting% = VAL(Setting$)
  981.                 IF Setting% < 0 OR Setting% > 255 THEN
  982.                    BEEP
  983.                 ELSE
  984.                    SetFlag Number%, Setting%
  985.                 END IF
  986.                 Setting% = GetFlag%(Number%)
  987.                 Setting$ = RIGHT$("   " + LTRIM$(RTRIM$(STR$(Setting%))), 3)
  988.                 FastPrint CoOrd%(Number%, 1), CoOrd%(Number%, 2), Setting$, 48
  989.              END IF
  990.           END IF
  991.        END IF
  992.     LOOP UNTIL Abort%
  993.     ERASE CoOrd%: Frame Head$, 0
  994. GOTO D500
  995.  
  996. '┌────────────────────────────────────────────────────────────────────────┐
  997. '│      Expanded Memory services.                                         │
  998. '└────────────────────────────────────────────────────────────────────────┘
  999. '
  1000. D520:
  1001.     Panel 4, 1, 21, 80, 1, TextColour%: Handle% = FALSE
  1002.     FastPrint 6, 23, "┌─────────────────────────────────┐", TextColour%
  1003.     FastPrint 7, 23, "│  EXPANDED MEMORY DEMONSTRATION  │", TextColour%
  1004.     FastPrint 8, 23, "└─────────────────────────────────┘", TextColour%
  1005.     Version% = EmsVersion%: PageFrame% = EmsFrame%
  1006.     EmsTotal% = EmsPages%(0): EmsFree% = EmsPages%(1)
  1007.     LIM$ = LTRIM$(RTRIM$(STR$(Version%))): L% = LEN(LIM$)
  1008.     IF L% > 1 THEN LIM$ = LEFT$(LIM$, L% - 1) + "." + RIGHT$(LIM$, 1)
  1009.     Me$ = "You have" + STR$(EmsTotal% * 16) + " KiloBytes of LIM " + LIM$ + " Expanded Memory installed."
  1010.     FastPrint 10, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1011.     Me$ = "The Page Frame segment is at address " + HEX$(PageFrame%) + " Hex,"
  1012.     FastPrint 11, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1013.     Me$ = "and there are" + STR$(EmsFree%) + " pages (" + LTRIM$(RTRIM$(STR$(EmsFree% * 16))) + "KB) free."
  1014.     FastPrint 12, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1015.     IF EmsFree% < 4 THEN
  1016.        Me$ = "Sorry, that's not enough for this demonstration."
  1017.        FastPrint 15, 40 - (LEN(Me$) \ 2), Me$, TextColour%: GOTO D525
  1018.     END IF
  1019.     SLEEP 1: KeyFlush: Me$ = "Requesting four pages for this demonstration,"
  1020.     FastPrint 14, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1021.     EmsRequest 4, Handle%: IF Handle% = 0 THEN GOTO D529
  1022.     Pages% = EmsOwned%(Handle%): IF Pages% < 4 THEN GOTO D529
  1023.     Me$ = "they have been assigned to Handle" + STR$(Handle%) + "."
  1024.     FastPrint 15, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1025.     Me$ = "Saving this screen to page 1": SLEEP 1: KeyFlush
  1026.     FastPrint 17, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1027.     IF Colour% THEN Segment% = &HB800 ELSE Segment% = &HB000
  1028.     SLEEP 1: KeyFlush: Me$ = "Drawing and saving three other screens ...."
  1029.     FastPrint 17, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1030.     EmsPut Segment%, 0, 4000, 1, Handle%, Done%
  1031.     IF NOT Done% THEN GOTO D529
  1032.     SLEEP 1: KeyFlush: FastPrint 25, 1, SPACE$(80), StatColour%
  1033.     Page% = 2: Row% = 11: Col% = 35
  1034.     RESTORE Numbers
  1035.     DO
  1036.         READ Columns%, BackGround%: IF NOT Colour% THEN BackGround% = 0
  1037.         Attr% = Attribute%(15, BackGround%)
  1038.         BackFill 4, 1, 21, 80, Attr%
  1039.         Scroll 1, 9, 2, 23, 79, 0, Attr%
  1040.         FastPrint 10, 36, "P A G E", Attr%
  1041.         FOR I% = 1 TO Columns%
  1042.             READ Item$: IF Item$ = "F" THEN Item$ = "12345678"
  1043.             FOR J% = 1 TO LEN(Item$)
  1044.                 Rows% = VAL(MID$(Item$, J%, 1))
  1045.                 FastPrint Row% + Rows%, Col% + I%, CHR$(219), Attr%
  1046.             NEXT J%
  1047.         NEXT I%
  1048.         EmsPut Segment%, 0, 4000, Page%, Handle%, Done%
  1049.         Page% = Page% + 1: IF NOT Done% THEN EXIT DO
  1050.         SLEEP 1: KeyFlush
  1051.     LOOP UNTIL Page% > 4
  1052.     IF NOT Done% THEN GOTO D529
  1053.     EmsGet Segment%, 0, 4000, 1, Handle%, Done%
  1054.     IF NOT Done% THEN GOTO D529
  1055.     Me$ = "Now I'll let YOU bring 'em back again ...."
  1056.     FastPrint 19, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1057.     FastPrint 22, 24, "Press a key when you're ready >", TextColour%
  1058.     LOCATE 22, 56, 1: Page% = 4: IF KeyIn% = 27 THEN GOTO D525
  1059.     DO
  1060.        EmsGet Segment%, 0, 4000, Page%, Handle%, Done%
  1061.        IF NOT Done% THEN EXIT DO
  1062.        FastPrint 25, 63, "Press a key >", StatColour%
  1063.        LOCATE 25, 77: KeyPress% = KeyIn%
  1064.        Page% = Page% - 1
  1065.     LOOP WHILE Page% > 1
  1066.     IF Done% THEN EmsGet Segment%, 0, 4000, 1, Handle%, Done%
  1067.     LOCATE , , 0: IF NOT Done% THEN GOTO D529
  1068.     Me$ = "The demonstration was completely successful, which proves that"
  1069.     FastPrint 17, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1070.     Me$ = "your Expanded Memory is in good working order."
  1071.     FastPrint 18, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1072. D525:
  1073.     IF Handle% THEN
  1074.        SLEEP 1: KeyFlush: EmsRelease Handle%
  1075.        Me$ = "We released all pages assigned to handle" + STR$(Handle%) + " before finishing,"
  1076.        FastPrint 20, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1077.        Me$ = "otherwise no other program would have been able to use them."
  1078.        FastPrint 21, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1079.     END IF
  1080.     SLEEP 2: KeyFlush
  1081. GOTO D500
  1082.  
  1083. D529:
  1084.     Me$ = "An EMM error" + STR$(EmsError%) + " has just occurred ..."
  1085.     MisTake 12, Me$, 0, Mouse%
  1086. GOTO D525
  1087.  
  1088. '┌────────────────────────────────────────────────────────────────────────┐
  1089. '│      Miscellaneous functions and procedures.                           │
  1090. '└────────────────────────────────────────────────────────────────────────┘
  1091. '
  1092. D600:
  1093.     Menu$(0) = "DHEFP"
  1094.     Menu$(1) = "&Date entry and validation"
  1095.     Menu$(2) = "&Hardware equipment list"
  1096.     Menu$(3) = "&Encryption of text"
  1097.     Menu$(4) = "&Fast string sorting"
  1098.     Menu$(5) = "&Percentage box"
  1099.     Abort% = FALSE
  1100.     VerMenu 4, 34, BarColour%, 1, 5, "EXAMPLES", Menu$(), Choice%, Nxt%, Bar%, 1, RootName$, Mouse%
  1101.     IF Nxt% THEN GOTO D002
  1102.     SELECT CASE Choice%
  1103.         CASE 1
  1104.              GOTO D610
  1105.         CASE 2
  1106.              GOTO D620
  1107.         CASE 3
  1108.              GOTO D630
  1109.         CASE 4
  1110.              GOTO D640
  1111.         CASE 5
  1112.              GOTO D650
  1113.         CASE ELSE
  1114.     END SELECT
  1115. GOTO D002
  1116.  
  1117. '┌────────────────────────────────────────────────────────────────────────┐
  1118. '│      Long Date Routine.                                                │
  1119. '└────────────────────────────────────────────────────────────────────────┘
  1120. '
  1121. D610:
  1122.     IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  1123.     HotKey% = FALSE: IF ToDay$ = "" THEN ToDay$ = SPACE$(20)
  1124.     Context% = 1: Topic$ = "LONGDATE": WW% = LEN(ToDay$)
  1125.     WT% = 41 - (WW% \ 2): PopUp 8, 24, 8, 34, Attrib%, 3, 2, -1
  1126.     FastPrint 9, 33, "Today's date is:", Attrib%
  1127.     FastPrint 10, WT%, ToDay$, Attrib%
  1128.     Ok% = Verify%(1, 12, "Is this correct", 0, Mouse%)
  1129.     IF NOT Ok% THEN
  1130.        FastPrint 12, 32, "Enter correct date", Attrib%
  1131.        Temp$ = "": LOCATE 14, 37
  1132.        Temp$ = DateInput$(Temp$, 1, "DATINPUT", HotKey%)
  1133.        IF HotKey% THEN
  1134.           Abort% = TRUE
  1135.        ELSE
  1136.           Now$ = Temp$: MO% = VAL(MID$(Temp$, 4, 2))
  1137.           DY% = VAL(LEFT$(Temp$, 2)): YR% = VAL(RIGHT$(Temp$, 2))
  1138.           ToDay$ = LongDate$(DY%, MO%, YR%): OL% = LEN(ToDay$)
  1139.           IF OL% > 0 THEN
  1140.              FastPrint 25, 41, SPACE$(40), StatColour%
  1141.              FastPrint 25, 79 - OL%, ToDay$, StatColour%
  1142.           END IF
  1143.        END IF
  1144.     END IF
  1145.     ShutUp -1
  1146. GOTO D600
  1147.  
  1148. '┌────────────────────────────────────────────────────────────────────────┐
  1149. '│      Equipment List.                                                   │
  1150. '└────────────────────────────────────────────────────────────────────────┘
  1151. '
  1152. D620:
  1153.     Panel 4, 1, 21, 80, 1, TextColour%
  1154.     Cols$ = "80": Video$ = "colour": REDIM Model(0 TO 8) AS STRING
  1155.     RESTORE HWare: FOR I% = 0 TO 8: READ Model(I%): NEXT
  1156.     Equipment% = PeekWord&(&H40, &H10): Flag$ = STRING$(16, "0")
  1157.     Computer% = FarPeek%(&HF000, &HFFFE)
  1158.     Computer% = Computer% - &HF8: IF Computer% < 0 THEN Computer% = 0
  1159.     FastPrint 8, 38, "IBM " + Model(Computer%) + " or compatible", TextColour%
  1160.     Chip% = Cpu%: CoPro% = MathsChip%
  1161.     SELECT CASE Chip%
  1162.         CASE IS < 0
  1163.              Me$ = " an Intel 80C" + LTRIM$(RTRIM$(STR$(ABS(Chip%))))
  1164.         CASE 20, 30
  1165.              Me$ = " a NEC V" + LTRIM$(RTRIM$(STR$(Chip%)))
  1166.         CASE 88 TO 486
  1167.              Me$ = " an Intel 80" + LTRIM$(RTRIM$(STR$(Chip%)))
  1168.         CASE ELSE
  1169.              Me$ = " an unknown"
  1170.     END SELECT
  1171.     Me$ = "with" + Me$ + " microprocessor"
  1172.     FastPrint 9, 38, Me$, TextColour%
  1173.     FOR I% = 15 TO 0 STEP -1
  1174.         IF BitTest%(Equipment%, I%) THEN
  1175.            MID$(Flag$, 16 - I%, 1) = "1"
  1176.         END IF
  1177.     NEXT I%
  1178.     FastPrint 8, 3, " F E D C B A 9 8 7 6 5 4 3 2 1 0", TextColour%
  1179.     FastPrint 9, 3, "┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐", TextColour%
  1180.     FastPrint 10, 3, "│", TextColour%: Col% = 4
  1181.     FOR I% = 1 TO 16
  1182.         FastPrint 10, Col%, MID$(Flag$, I%, 1) + "│", TextColour%
  1183.         Col% = Col% + 2
  1184.     NEXT I%
  1185.     FastPrint 10, 38, "ROM BIOS Equipment Flag at 0040:0010", TextColour%
  1186.     FastPrint 11, 3, "└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘", TextColour%
  1187.     FastPrint 12, 3, " │ │   │ │ │ │   │ │ │ │ │ │ │ │", TextColour%
  1188.     FastPrint 13, 3, " │ │   │ │ │ │   │ │ │ │ │ │ │ └─", TextColour%
  1189.     FastPrint 14, 3, " │ │   │ │ │ │   │ │ │ │ │ │ └───", TextColour%
  1190.     FastPrint 15, 3, " │ │   │ │ │ │   │ │ │ │ └─┴─────", TextColour%
  1191.     FastPrint 16, 3, " │ │   │ │ │ │   │ │ └─┴─────────", TextColour%
  1192.     FastPrint 17, 3, " │ │   │ │ │ │   └─┴─────────────", TextColour%
  1193.     FastPrint 18, 3, " │ │   │ └─┴─┴───────────────────", TextColour%
  1194.     FastPrint 19, 3, " │ │   └─────────────────────────", TextColour%
  1195.     FastPrint 20, 3, " └─┴─────────────────────────────", TextColour%
  1196.     FastPrint 13, 38, "Floppy drives installed?", TextColour%
  1197.     IF MID$(Flag$, 16, 1) = "1" THEN Me$ = "Yes" ELSE Me$ = "No"
  1198.     FastPrint 13, 68, Me$, TextColour%
  1199.     FastPrint 14, 38, "Maths coprocessor installed?", TextColour%
  1200.     IF MID$(Flag$, 15, 1) = "1" THEN Me$ = "Yes" ELSE Me$ = "No"
  1201.     IF CoPro% > 0 THEN Me$ = "80" + LTRIM$(RTRIM$(STR$(CoPro%)))
  1202.     FastPrint 14, 68, Me$, TextColour%
  1203.     FastPrint 15, 38, "Original PC motherboard RAM", TextColour%
  1204.     IF Computer% = 1 THEN
  1205.        Ram% = (BinDec&(MID$(Flag$, 13, 2)) + 1) * 16
  1206.        Me$ = RIGHT$("  " + LTRIM$(RTRIM$(STR$(Ram%))), 2) + "KB"
  1207.     ELSE
  1208.        Me$ = "n/a"
  1209.     END IF
  1210.     FastPrint 15, 68, Me$, TextColour%
  1211.     FastPrint 16, 38, "Initial Video mode", TextColour%
  1212.     Mode% = BinDec&(MID$(Flag$, 11, 2))
  1213.     IF Mode% = 1 THEN Cols$ = "40"
  1214.     IF Mode% = 7 THEN Video$ = "mono"
  1215.     FastPrint 16, 58, Cols$ + " column " + Video$, TextColour%
  1216.     FastPrint 17, 38, "Number of floppy drives", TextColour%
  1217.     Mode% = BinDec&(MID$(Flag$, 9, 2)) + 1
  1218.     Me$ = LTRIM$(RTRIM$(STR$(Mode%))): FastPrint 17, 68, Me$, TextColour%
  1219.     FastPrint 18, 38, "Number of serial ports", TextColour%
  1220.     Mode% = BinDec&(MID$(Flag$, 5, 3)) + 1
  1221.     Me$ = LTRIM$(RTRIM$(STR$(Mode%))): FastPrint 18, 68, Me$, TextColour%
  1222.     FastPrint 19, 38, "Games adaptor installed?", TextColour%
  1223.     IF MID$(Flag$, 3, 1) = "1" THEN Me$ = "Yes" ELSE Me$ = "No"
  1224.     FastPrint 19, 68, Me$, TextColour%
  1225.     FastPrint 20, 38, "Number of parallel printers", TextColour%
  1226.     Mode% = BinDec&(LEFT$(Flag$, 2))
  1227.     Me$ = LTRIM$(RTRIM$(STR$(Mode%))): FastPrint 20, 68, Me$, TextColour%
  1228.     FastPrint 25, 1, SPACE$(80), StatColour%
  1229.     FastPrint 25, 3, "Press a key to continue", StatColour%
  1230.     IF Mouse% THEN MouseShow
  1231.     DO
  1232.        IF Mouse% THEN
  1233.           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  1234.           IF LeftButton% THEN
  1235.              IF yMouse% > 15 AND yMouse% < 24 THEN
  1236.                 Z$ = "": EXIT DO
  1237.              END IF
  1238.           END IF
  1239.        END IF
  1240.        Z$ = INKEY$
  1241.     LOOP WHILE Z$ = ""
  1242.     Frame Head$, 0: ERASE Model
  1243.     IF Mouse% THEN
  1244.        CALL MouseHide: IF Z$ = "" THEN GOTO D002
  1245.     END IF
  1246. GOTO D600
  1247.  
  1248. '   Text Encryption.
  1249. '
  1250. D630:
  1251.     Panel 4, 1, 21, 80, 1, TextColour%
  1252.     Done% = FALSE: Abort% = FALSE: HotKey% = FALSE
  1253.     Text$ = "": Code$ = ""
  1254.     RESTORE Crypt
  1255.     FOR I% = 1 TO 5
  1256.         READ Me$: FastPrint 6 + I%, 11, Me$, TextColour%
  1257.     NEXT I%
  1258.     IF Colour% THEN Attrib% = 32 ELSE Attrib% = 112
  1259.     DO WHILE Text$ = ""
  1260.        PopUp 17, 19, 4, 44, Attrib%, 2, 2, -1
  1261.        FastPrint 18, 27, "Enter string to be encrypted", Attrib%
  1262.        LOCATE 19, 21
  1263.        Text$ = RevInput$(40, "", "", 1, "REVINPUT", -1, HotKey%)
  1264.        ShutUp -1: IF HotKey% THEN Abort% = TRUE: EXIT DO
  1265.        Text$ = LTRIM$(RTRIM$(Text$))
  1266.        IF Text$ = "" THEN
  1267.           MisTake 9, "You can't encrypt an empty string!", 0, Mouse%
  1268.        END IF
  1269.     LOOP
  1270.     IF NOT Abort% THEN
  1271.        IF Colour% THEN Attrib% = 78 ELSE Attrib% = 112
  1272.        DO WHILE Code$ = ""
  1273.           PopUp 17, 19, 4, 44, Attrib%, 2, 2, -1
  1274.           FastPrint 18, 25, "Enter string to encrypt it with", Attrib%
  1275.           LOCATE 19, 21
  1276.           Code$ = RevInput$(40, "", "", 1, "REVINPUT", -1, HotKey%)
  1277.           ShutUp -1: IF HotKey% THEN Abort% = TRUE: EXIT DO
  1278.           Code$ = LTRIM$(RTRIM$(Code$))
  1279.           IF Code$ = "" THEN
  1280.              MisTake 12, "An empty string is no use!", 0, Mouse%
  1281.           END IF
  1282.        LOOP
  1283.        IF NOT Abort% THEN
  1284.           Cipher Text$, Code$: Me$ = "Encrypted string >  " + Text$
  1285.           FastPrint 14, 11, Me$, TextColour%
  1286.           IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  1287.           DO
  1288.              DO
  1289.                 PopUp 19, 19, 4, 44, Attrib%, 2, 2, -1
  1290.                 FastPrint 20, 27, "Enter key string once again", Attrib%
  1291.                 LOCATE 21, 21
  1292.                 DeCode$ = RevInput$(40, "", "", 1, "REVINPUT", -1, HotKey%)
  1293.                 ShutUp -1: IF HotKey% THEN Abort% = TRUE: EXIT DO
  1294.                 DeCode$ = LTRIM$(RTRIM$(DeCode$))
  1295.                 IF DeCode$ = "" THEN
  1296.                    MisTake 12, "An empty string is no use!", 0, Mouse%
  1297.                 END IF
  1298.              LOOP WHILE DeCode$ = ""
  1299.              IF Abort% THEN
  1300.                 Done% = TRUE
  1301.              ELSE
  1302.                 Me$ = Text$: Cipher Me$, DeCode$
  1303.                 Me$ = "Decrypted string >  " + Me$
  1304.                 FastPrint 16, 11, Me$, TextColour%
  1305.                 IF Code$ = DeCode$ THEN
  1306.                    FastPrint 19, 33, "That's the one!", TextColour%
  1307.                    Done% = TRUE
  1308.                 ELSE
  1309.                    Me$ = "Whoops, that's not right"
  1310.                    IF MisMatch% THEN
  1311.                       Me$ = Me$ + " either"
  1312.                    END IF
  1313.                    MisTake 9, Me$ + "!", 0, Mouse%
  1314.                    MisMatch% = TRUE
  1315.                 END IF
  1316.              END IF
  1317.           LOOP UNTIL Done%
  1318.        END IF
  1319.     END IF
  1320. GOTO D600
  1321.  
  1322. '   Demonstrate string array sorting and scan routines.
  1323. '
  1324. D640:
  1325.     Room% = TRUE: Me$ = "Not enough memory for sort array"
  1326.     ON ERROR GOTO D645
  1327.     REDIM Array(1 TO 1000) AS STRING
  1328.     ON ERROR GOTO Trap
  1329.     IF NOT Room% THEN GOTO D600
  1330.     RESTORE Strings: IF Colour% THEN COLOR 0, 7
  1331.     Panel 4, 1, 21, 80, 1, TextColour%
  1332.     FOR Row% = 6 TO 7
  1333.         READ Me$: LOCATE Row%, 3: PRINT Me$
  1334.     NEXT Row%
  1335.     FOR I% = 1 TO 1000
  1336.         FOR J% = 1 TO Rand%(5, 11)
  1337.             Array(I%) = Array(I%) + CHR$(Rand%(0, 25) + 65)
  1338.         NEXT J%
  1339.     NEXT I%
  1340.     LOCATE 7, 50: PRINT "done!"
  1341.     LOCATE 9, 3: PRINT "Unsorted array"
  1342.     FOR I% = 1 TO 3
  1343.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1344.         LOCATE 10 + I%, 3: PRINT Me$; " "; Array(I%)
  1345.     NEXT I%
  1346.     LOCATE 14, 3: PRINT "  .": Row% = 15
  1347.     FOR I% = 998 TO 1000
  1348.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1349.         LOCATE Row%, 3: PRINT Me$; " "; Array(I%): Row% = Row% + 1
  1350.     NEXT I%
  1351.     PopUp 19, 13, 5, 53, BarColour%, 4, 4, 0
  1352.     READ Me$: FastPrint 21, 15, Me$, BarColour%
  1353.     LOCATE 21, 62: Legal$ = "AaDd"
  1354.     A$ = UCASE$(RevInput$(1, "A", Legal$, 1, "REVINPUT", 0, HotKey%))
  1355.     ShutUp 0: IF Colour% THEN COLOR 0, 7
  1356.     IF HotKey% THEN Abort% = TRUE: GOTO D642
  1357.     IF A$ = "D" THEN
  1358.        Direction% = 1: A$ = "descending"
  1359.     ELSE
  1360.        Direction% = 0: A$ = "ascending"
  1361.     END IF
  1362.     LOCATE 19, 3: PRINT "Sorting the array into "; A$; " order ....";
  1363.     First% = LBOUND(Array): Last% = UBOUND(Array)
  1364.     X! = TIMER
  1365.     StringSort Direction%, 1000, VARPTR(Array(First%))
  1366.     Y! = TIMER
  1367.     PRINT " done!": LOCATE 9, 41: PRINT "Sorted array"
  1368.     FOR I% = 1 TO 3
  1369.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1370.         LOCATE 10 + I%, 41: PRINT Me$; " "; Array(I%)
  1371.     NEXT I%
  1372.     LOCATE 14, 41: PRINT "  .": Row% = 15
  1373.     FOR I% = 998 TO 1000
  1374.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1375.         LOCATE Row%, 41: PRINT Me$; " "; Array(I%): Row% = Row% + 1
  1376.     NEXT I%
  1377.     LOCATE 20, 3: PRINT USING "The sort took ###.### seconds"; Y! - X!
  1378.     Ok% = Verify%(1, 16, "Search array", 0, Mouse%): IF NOT Ok% THEN GOTO D642
  1379. D641:
  1380.     PopUp 12, 17, 8, 46, BarColour%, 3, 4, -1: HotKey% = 0
  1381.     FastPrint 14, 20, "Enter a string to insert into the array", BarColour%
  1382.     LOCATE 15, 30: A$ = RevInput$(20, "", "", 1, "REVINPUT", 0, HotKey%)
  1383.     IF HotKey% THEN Abort% = TRUE: ShutUp -1: GOTO D642
  1384.     A$ = LTRIM$(RTRIM$(A$))
  1385.     Me$ = "Enter element to insert it into (1-" + LTRIM$(RTRIM$(STR$(Last%))) + ") "
  1386.     FastPrint 16, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1387.     LOCATE 17, 38: Temp$ = RevInput$(4, "", Nu$, 1, "REVINPUT", 0, HotKey%)
  1388.     ShutUp -1: IF Colour% THEN COLOR 0, 7
  1389.     IF HotKey% THEN
  1390.        Abort% = TRUE: GOTO D642
  1391.     ELSE
  1392.        S% = VAL(Temp$)
  1393.        IF S% < First% OR S% > Last% THEN
  1394.           MisTake 9, "OUT OF RANGE!", 0, Mouse%
  1395.           GOTO D641
  1396.        ELSE
  1397.           Array(S%) = A$
  1398.           IF S% < 4 THEN
  1399.              LOCATE 10 + S%, 54: PRINT SPACE$(12);
  1400.              LOCATE 10 + S%, 54: PRINT A$;
  1401.           ELSEIF S% > 997 THEN
  1402.              LOCATE S% - 983, 54: PRINT SPACE$(12);
  1403.              LOCATE S% - 983, 54: PRINT A$;
  1404.           END IF
  1405.        END IF
  1406.     END IF
  1407.     LOCATE 21, 3: PRINT "Scanning array for " + A$ + " .... ";
  1408.     X! = TIMER
  1409.     Match% = StringScan%(A$, 1000, First%, VARPTR(Array$(First%)))
  1410.     Y! = TIMER
  1411.     PRINT "found it at element"; Match%
  1412.     LOCATE 22, 3: PRINT USING "The search took ###.### seconds"; Y! - X!
  1413. D642:
  1414.     ERASE Array: IF Colour% THEN COLOR 7, 0
  1415. GOTO D002
  1416.  
  1417. D645:
  1418.     MisTake 9, Me$, 0, Mouse%
  1419.     Room% = FALSE
  1420. RESUME NEXT
  1421.  
  1422. '   Display a popup window with a percentage bar measuring the progress
  1423. '   of a function or procedure.
  1424. '
  1425. D650:
  1426.     PerCentBox 1, "Passing the time away", 0, 0
  1427.     StartTime& = TIMER
  1428.     DO
  1429.         ThisTime& = TIMER - StartTime&
  1430.         Percentage% = (ThisTime& / 30) * 100
  1431.         PerCentBox 2, "", 0, Percentage%
  1432.         IF INKEY$ = CHR$(27) THEN EXIT DO
  1433.     LOOP UNTIL ThisTime& > 30
  1434.     PerCentBox 3, "", 0, 0
  1435. GOTO D600
  1436.  
  1437. '┌────────────────────────────────────────────────────────────────────────┐
  1438. '│      Graphics examples.                                                │
  1439. '└────────────────────────────────────────────────────────────────────────┘
  1440. '
  1441. D700:
  1442.     VideoMode Colour%, MaxRes%, VideoRam%
  1443.     IF MaxRes% > 8 THEN
  1444.        Menu$(0) = "CP#SR"
  1445.     ELSEIF MaxRes% AND MaxRes% <> 3 THEN
  1446.        Menu$(0) = "C #  "
  1447.     ELSE
  1448.        Menu$(0) = "  #  "
  1449.     END IF
  1450.     Menu$(1) = "Graphics &characters"
  1451.     Menu$(2) = "Video &panning"
  1452.     Menu$(4) = "&Save screen to file"
  1453.     Menu$(5) = "&Restore screen"
  1454.     VerMenu 4, 47, BarColour%, 1, 5, "GRAPHICS", Menu$(), Choice%, Nxt%, Bar%, 1, RootName$, Mouse%
  1455.     IF Nxt% THEN GOTO D002
  1456.     SELECT CASE Choice%
  1457.         CASE 1
  1458.              GOTO D710
  1459.         CASE 2
  1460.              GOTO D720
  1461.         CASE 4, 5
  1462.              GOTO D730
  1463.         CASE ELSE
  1464.     END SELECT
  1465. GOTO D002
  1466.  
  1467. '┌────────────────────────────────────────────────────────────────────────┐
  1468. '│      Graphics characters.                                              │
  1469. '└────────────────────────────────────────────────────────────────────────┘
  1470. '
  1471. D710:
  1472.     SELECT CASE MaxRes%
  1473.         CASE 2                                  ' Colour Graphics Adaptor
  1474.              Mode = 1
  1475.              SCREEN 1                           ' 320 x 200   4-colour
  1476.         CASE 9                                  ' Enhanced Graphics Adaptor
  1477.              Mode = 2
  1478.              SCREEN 9                           ' 640 x 350  16-colour
  1479.              WINDOW SCREEN (0, 0)-(319, 199)
  1480.         CASE 13
  1481.              IF VideoRam% > 64 THEN
  1482.                 Mode = 3                        ' Video Graphics Array
  1483.                 SCREEN 12                       ' 640 X 480  16-colour
  1484.                 WINDOW SCREEN (0, 0)-(319, 199)
  1485.              ELSE
  1486.                 Mode = 4                        ' Multicolour Graphics Array
  1487.                 SCREEN 13                       ' 320 x 200 256-colour
  1488.              END IF
  1489.         CASE ELSE
  1490.              MisTake 9, "Incompatible Video Card!", 0, Mouse%
  1491.              GOTO D002
  1492.     END SELECT
  1493.  
  1494.     REDIM Hue(1 TO 4) AS INTEGER
  1495.     PLAY "mft240o3l8d#fgl8b-p8l8gl2b-"          ' Hoop-la!
  1496.     RESTORE Title
  1497.     PLAY "mbl8t255o3bo4cdo3bo4co3abgaf#t120gbt200dp8"
  1498.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1499.     READ Count%, X1%, Y1%, X2%, Y2%
  1500.     LINE (X1%, Y1%)-(X2%, Y2%), Hue(Mode)
  1501.     FOR I% = 1 TO Count%
  1502.         READ X%, Y%: LINE -(X%, Y%), Hue(Mode)
  1503.     NEXT I%
  1504.     LINE (0, 165)-(259, 165), Hue(Mode)
  1505.     IF Mode = 1 THEN
  1506.        Road$ = CHR$(&H22) + CHR$(11) + CHR$(&H88) + CHR$(44)
  1507.        Tree$ = CHR$(&H11) + CHR$(&H88) + CHR$(&H44) + CHR$(&H22)
  1508.        PAINT (5, 5), 2, Hue(Mode)
  1509.        PAINT (310, 100), 1, Hue(Mode)
  1510.        PAINT (250, 163), Road$, Hue(Mode)
  1511.        PAINT (10, 100), 1, Hue(Mode)
  1512.        LINE (0, 165)-(319, 165), 0
  1513.     ELSE
  1514.        PAINT (5, 5), 9, Hue(Mode)
  1515.        PAINT (310, 100), Hue(Mode), Hue(Mode)
  1516.        PAINT (250, 163), 8, Hue(Mode)
  1517.        PAINT (10, 100), Hue(Mode), Hue(Mode)
  1518.        LINE (0, 165)-(319, 165), 0
  1519.     END IF
  1520.     PSET (57, 113), Hue(Mode)
  1521.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1522.     READ Count%, X1%, Y1%, X2%, Y2%
  1523.     LINE (X1%, Y1%)-(X2%, Y2%), Hue(Mode)
  1524.     FOR I% = 1 TO Count%
  1525.         READ X%, Y%: LINE -(X%, Y%), Hue(Mode)
  1526.     NEXT I%
  1527.     CIRCLE (127, 109), 45, Hue(Mode), 1.35, 3.1, .3
  1528.     CIRCLE (166, 102), 35, Hue(Mode), 1, 2.8, .43
  1529.     CIRCLE (214, 95), 32, Hue(Mode), 1.1, 2.8, .39
  1530.     CIRCLE (259, 94), 38, Hue(Mode), .7, 2.6, .48
  1531.     CIRCLE (296, 96), 33, Hue(Mode), .1, 1.92, .45
  1532.     IF Mode = 1 THEN
  1533.        PAINT (215, 90), Tree$, Hue(Mode)
  1534.     ELSE
  1535.        PAINT (215, 90), Hue(Mode), Hue(Mode)
  1536.     END IF
  1537.     PSET (83, 108), Hue(Mode)
  1538.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1539.     READ Count%, X1%, Y1%, X2%, Y2%
  1540.     LINE (X1%, Y1%)-(X2%, Y2%), Hue(Mode)
  1541.     FOR I% = 1 TO Count%
  1542.         READ X%, Y%: LINE -(X%, Y%), Hue(Mode)
  1543.     NEXT I%
  1544.     LINE (270, 72)-(276, 86), Hue(Mode), BF
  1545.     PAINT (260, 95), Hue(Mode), Hue(Mode)
  1546.     IF Mode = 1 THEN
  1547.        LINE (215, 86)-(260, 73), 0: LINE -(305, 86), 0
  1548.        LINE (226, 88)-(246, 93), 1, BF: LINE (274, 88)-(294, 93), 1, BF
  1549.        LINE (255, 88)-(265, 98), 2, BF: LINE (271, 70)-(272, 71), 0, BF
  1550.        LINE (274, 70)-(275, 71), 0, BF
  1551.     ELSE
  1552.        LINE (215, 86)-(260, 73), 4: LINE -(305, 86), 4
  1553.        LINE (226, 88)-(246, 93), 26, BF: LINE (274, 88)-(294, 93), 26, BF
  1554.        LINE (255, 88)-(265, 98), 6, BF: LINE (271, 70)-(272, 71), 6, BF
  1555.        LINE (274, 70)-(275, 71), 6, BF: LINE (319, 98)-(220, 98), 8
  1556.        LINE -(186, 99), 8: LINE -(159, 101), 8: LINE -(210, 100), 8
  1557.        LINE -(319, 100), 8: PAINT (300, 99), 8, 8
  1558.     END IF
  1559.     PLAY "t255o4cdecdo3bo4co3abgt120f#at200dp8"
  1560.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1561.     LINE (320, 102)-(285, 102), Hue(Mode)
  1562.     CIRCLE (292, 102), 6, Hue(Mode), .8, 3.1415, .7
  1563.     CIRCLE (302, 102), 9, Hue(Mode), .8, 2.5, .75
  1564.     CIRCLE (318, 102), 16, Hue(Mode), .6, 2.7, .85
  1565.     IF Mode = 1 THEN
  1566.        LINE (320, 94)-(307, 93), 1
  1567.        PAINT (310, 95), Tree$, Hue(Mode), CHR$(&HAA)
  1568.        GraPrint 256, 78, "A", GrAttrib%(0, 3), 1
  1569.        LINE (76, 6)-(244, 32), 3, BF: LINE (76, 32)-(244, 52), 1, BF
  1570.     ELSE
  1571.        PAINT (310, 100), Hue(Mode), Hue(Mode)
  1572.        IF Mode = 2 THEN
  1573.           GraPrint 495, 136, "Club-PC", GrAttrib%(1, -1), 1
  1574.        ELSEIF Mode = 3 THEN
  1575.           GraPrint 495, 190, "Club-PC", GrAttrib%(1, -1), 1
  1576.        ELSE
  1577.           GraPrint 248, 78, "CPC", GrAttrib%(27, -1), 1
  1578.        END IF
  1579.        LINE (76, 6)-(244, 32), 14, BF: LINE (76, 32)-(244, 52), 15, BF
  1580.     END IF
  1581.     Me$ = "GRAPHICS": I% = 1: X% = 80: Y% = 9
  1582.     IF Mode = 1 THEN
  1583.        Clr% = GrAttrib%(0, 3): Box% = 0
  1584.     ELSE
  1585.        Clr% = GrAttrib%(1, -1): Box% = 1
  1586.     END IF
  1587.     DO
  1588.         LINE (X%, Y%)-(X% + 20, Y% + 20), Box%, B
  1589.         IF Mode = 2 THEN
  1590.            GraPrint ((X% * 2) + 8), (Y% * 1.4) + 3, MID$(Me$, I%, 1), Clr%, 3
  1591.         ELSEIF Mode = 3 THEN
  1592.            GraPrint ((X% * 2) + 8), (Y% * 2.4) + 3, MID$(Me$, I%, 1), Clr%, 3
  1593.         ELSE
  1594.            GraPrint X% + 3, Y% + 3, MID$(Me$, I%, 1), Clr%, 2
  1595.         END IF
  1596.         I% = I% + 1: X% = X% + 20
  1597.     LOOP UNTIL I% > 8
  1598.     Me$ = "CHARACTERS": I% = 1: X% = 78: Y% = 32
  1599.     IF Mode = 1 THEN
  1600.        Clr% = GrAttrib%(2, 1)
  1601.     ELSE
  1602.        Clr% = GrAttrib%(7, -1)
  1603.     END IF
  1604.     DO
  1605.         IF Mode = 2 THEN
  1606.            GraPrint ((X% * 2) + 8), (Y% * 1.6) + 3, MID$(Me$, I%, 1), Clr%, 3
  1607.         ELSEIF Mode = 3 THEN
  1608.            GraPrint ((X% * 2) + 9), (Y% * 2.4) + 3, MID$(Me$, I%, 1), Clr%, 3
  1609.         ELSE
  1610.            GraPrint X% + 5, Y% + 3, MID$(Me$, I%, 1), Clr%, 2
  1611.         END IF
  1612.         I% = I% + 1: X% = X% + 16
  1613.     LOOP UNTIL I% > 10
  1614.     IF Mode = 1 THEN
  1615.        LINE (5, 60)-(175, 145), 0, BF: LINE (4, 59)-(176, 146), 3, B
  1616.     END IF
  1617.     I% = 1: READ Count%
  1618.     DO
  1619.         READ X%, Y%, Me$, Fore%, Back%, Scale%
  1620.         IF Mode = 2 THEN
  1621.            GraPrint X% * 2, (Y% * 1.6), Me$, GrAttrib%(Fore%, -1), Scale%
  1622.         ELSEIF Mode = 3 THEN
  1623.            GraPrint X% * 2, (Y% * 2) + 30, Me$, GrAttrib%(Fore%, -1), Scale%
  1624.         ELSE
  1625.            GraPrint X%, Y%, Me$, GrAttrib%(Fore%, Back%), Scale%
  1626.         END IF
  1627.         I% = I% + 1
  1628.     LOOP UNTIL I% > Count%
  1629.     I% = 1: READ Count%
  1630.     DO
  1631.         READ X%, Y%, Me$, Fore%, Back%, Scale%
  1632.         IF Mode = 2 THEN
  1633.            GraPrint X% * 3, (Y% * 1.4), Me$, GrAttrib%(Fore%, -1), Scale%
  1634.         ELSEIF Mode = 3 THEN
  1635.            GraPrint X% * 3, Y% * 1.92, Me$, GrAttrib%(Fore%, -1), Scale%
  1636.         ELSE
  1637.            GraPrint X%, Y%, Me$, GrAttrib%(Fore%, Back%), Scale%
  1638.         END IF
  1639.         I% = I% + 1
  1640.     LOOP UNTIL I% > Count%
  1641.     PLAY "mft255ef#gdef#gef#g#aef#g#ag#abo4co3bo4cdeco3af#gdgbt120g"
  1642.     I% = 1: READ Count%
  1643.     DO
  1644.         READ X%, Y%, Me$, Fore%, Back%, Scale%
  1645.         IF Mode = 2 THEN
  1646.            GraPrint X% * 2, Y% * 1.6, Me$, GrAttrib%(Fore%, -1), 2
  1647.         ELSEIF Mode = 3 THEN
  1648.            GraPrint X% * 2, Y% * 2.2, Me$, GrAttrib%(Fore%, -1), 2
  1649.         ELSE
  1650.            GraPrint X%, Y%, Me$, GrAttrib%(Fore%, Back%), Scale%
  1651.         END IF
  1652.         I% = I% + 1
  1653.     LOOP UNTIL I% > Count%
  1654.     DO: LOOP UNTIL KeyIn% = 32
  1655.     SCREEN 0: WIDTH 80
  1656. GOTO D001
  1657.  
  1658. '┌────────────────────────────────────────────────────────────────────────┐
  1659. '│      Video Panning.                                                    │
  1660. '└────────────────────────────────────────────────────────────────────────┘
  1661. '
  1662. D720:
  1663.     IF (MaxRes% = 13 AND VideoRam% > 64) OR MaxRes% > 9 THEN
  1664.        SCREEN 9: LINE (0, 0)-(639, 349), 9, BF
  1665.        VIEW SCREEN (40, 25)-(600, 325), 0, 15
  1666.        CIRCLE (319, 174), 150, 14: PAINT (319, 174), 14, 14
  1667.        X% = 0: Y% = 0
  1668.        DO
  1669.           KeyPress% = KeyIn%: Pan% = TRUE
  1670.           SELECT CASE KeyPress%
  1671.               CASE -75
  1672.                    IF X% > 0 THEN X% = X% - 1
  1673.               CASE -77
  1674.                    IF X% < 79 THEN X% = X% + 1
  1675.               CASE -72
  1676.                    IF Y% > 0 THEN Y% = Y% - 1
  1677.               CASE -80
  1678.                    IF Y% < 22 THEN Y% = Y% + 1
  1679.               CASE ELSE
  1680.                    Pan% = FALSE
  1681.           END SELECT
  1682.           IF Pan% THEN VGAPan X%, Y% * 5
  1683.        LOOP UNTIL KeyPress% = 27
  1684.        SCREEN 0: WIDTH 80
  1685.     ELSE
  1686.        MisTake 9, "Incompatible Video Card!", 0, Mouse%
  1687.     END IF
  1688. GOTO D001
  1689.  
  1690. '┌────────────────────────────────────────────────────────────────────────┐
  1691. '│      Video Save and Restore.                                           │
  1692. '└────────────────────────────────────────────────────────────────────────┘
  1693. '
  1694. D730:
  1695.     SELECT CASE MaxRes%
  1696.         CASE 7
  1697.              xMax% = 319: yMax% = 199: SaveSize& = 32000
  1698.         CASE 8
  1699.              xMax% = 639: yMax% = 199: SaveSize& = 64000
  1700.         CASE 9, 10
  1701.              xMax% = 639: yMax% = 349: SaveSize& = 112000
  1702.         CASE 11, 12
  1703.              xMax% = 639: yMax% = 479: SaveSize& = 153600
  1704.         CASE 13
  1705.              IF VideoRam% > 64 THEN
  1706.                 xMax% = 639: yMax% = 479: SaveSize& = 153600
  1707.                 MaxRes% = 12
  1708.              ELSE
  1709.                 xMax% = 319: yMax% = 199: SaveSize& = 64000
  1710.              END IF
  1711.         CASE ELSE
  1712.              MisTake 9, "Incompatible Video Card!", 0, Mouse%
  1713.              GOTO D002
  1714.     END SELECT
  1715.     IF Choice% = 4 THEN
  1716.        IF FreeSpace&(0) > SaveSize& THEN
  1717.           SCREEN MaxRes%: RESTORE Escher
  1718.           LINE (0, 0)-(xMax%, yMax%), 6, BF
  1719.           VIEW (32, 4)-(xMax% - 32, yMax% - 4), 0, 5
  1720.           WINDOW SCREEN (0, 0)-(255, 191)
  1721.           FOR I% = 1 TO 40
  1722.               READ A%, B%, C%, D%: LINE (A%, B%)-(C%, D%), 1
  1723.           NEXT I%
  1724.           PAINT (56, 20), 1, 1: PAINT (136, 64), 1, 1
  1725.           PAINT (120, 80), 1, 1: PAINT (192, 88), 14, 1
  1726.           PAINT (76, 48), 14, 1: PAINT (124, 60), 14, 1
  1727.           PAINT (68, 12), 2, 1: PAINT (80, 84), 2, 1
  1728.           PAINT (92, 128), 2, 1: PAINT (36, 156), 12, 1
  1729.           PAINT (36, 168), 1, 1: PAINT (84, 178), 14, 1
  1730.           PAINT (88, 118), 12, 1: PAINT (144, 86), 12, 1
  1731.           VGASave "ESCHER.IMG": KeyPress% = KeyIn%
  1732.        ELSE
  1733.           MisTake 9, "Insufficient disk space!", 0, Mouse%
  1734.        END IF
  1735.     ELSE
  1736.        IF FileSize&("ESCHER.IMG") > 0 THEN
  1737.           SCREEN MaxRes%
  1738.           VGALoad "ESCHER.IMG"
  1739.           KeyPress% = KeyIn%
  1740.        ELSE
  1741.           MisTake 9, "Screen Image file not found!", 0, Mouse%
  1742.        END IF
  1743.     END IF
  1744.     SCREEN 0: WIDTH 80
  1745. GOTO D001
  1746.  
  1747. '┌────────────────────────────────────────────────────────────────────────┐
  1748. '│      Program Exit.                                                     │
  1749. '└────────────────────────────────────────────────────────────────────────┘
  1750. '
  1751. D800:
  1752.     Menu$(0) = "ED#A"
  1753.     Menu$(1) = "&Exit program"
  1754.     Menu$(2) = "&DOS shell"
  1755.     Menu$(4) = "&About DEMON"
  1756.     VerMenu 4, 59, BarColour%, 1, 4, "EXIT", Menu$(), Choice%, Nxt%, Bar%, 1, RootName$, Mouse%
  1757.     IF Nxt% THEN GOTO D002
  1758.     SELECT CASE Choice%
  1759.         CASE 1
  1760.              GOTO D810
  1761.         CASE 2
  1762.              GOTO D820
  1763.         CASE 4
  1764.              PopUp 9, 14, 9, 53, BarColour%, 4, 4, -1
  1765.              FastPrint 9, 35, " D E M O N ", BarColour%
  1766.              RESTORE About
  1767.              READ Me$: FastPrint 11, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1768.              READ Me$: FastPrint 12, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1769.              READ Me$: FastPrint 13, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1770.              FastPrint 14, 34, "┌──────────╖", BarColour%
  1771.              FastPrint 15, 34, "│    OK    ║", BarColour%
  1772.              FastPrint 16, 34, "╘══════════╝", BarColour%
  1773.              FastPrint 15, 38, " OK ", 14: Ky% = FALSE
  1774.              IF Mouse% THEN
  1775.                 xHot% = 37 * 8: yHot% = 13 * 8
  1776.                 CALL MouseShow
  1777.              END IF
  1778.              DO
  1779.                 IF KeyStat% THEN
  1780.                    Ky% = KeyIn%
  1781.                 ELSEIF Mouse% THEN
  1782.                    MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  1783.                    IF LeftButton% THEN
  1784.                       IF yMouse% > yHot% AND yMouse% < yHot% + 16 THEN
  1785.                          IF xMouse% > xHot% AND xMouse% < xHot% + 48 THEN
  1786.                             Ky% = 13
  1787.                          END IF
  1788.                       END IF
  1789.                       DO
  1790.                           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  1791.                       LOOP WHILE LeftButton%
  1792.                    END IF
  1793.                 END IF
  1794.              LOOP UNTIL Ky% = 13
  1795.              IF Mouse% THEN MouseHide
  1796.              ShutUp -1
  1797.         CASE ELSE
  1798.     END SELECT
  1799. GOTO D002
  1800.  
  1801. '   Program Exit
  1802. '
  1803. D810:
  1804.     IF Colour% THEN
  1805.        Scroll 1, 1, 1, 25, 80, 0, Attribute%(15, 1)
  1806.        COLOR , , 1: Attrib% = 32
  1807.     ELSE
  1808.        FOR I% = 1 TO 24
  1809.            FastPrint I%, 1, STRING$(80, "░"), 7
  1810.        NEXT I%
  1811.        Attrib% = 112
  1812.     END IF
  1813.     PopUp 3, 2, 9, 44, Attrib%, 3, 2, -1: RESTORE Credits
  1814.     FOR I% = 4 TO 9
  1815.         READ Me$: FastPrint I%, 4, Me$, Attrib%
  1816.     NEXT I%
  1817.     SLEEP 5: KeyFlush
  1818.     IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  1819.     PopUp 10, 29, 11, 50, Attrib%, 2, 1, -1
  1820.     FOR I% = 11 TO 19
  1821.         READ Me$: FastPrint I%, 31, Me$, Attrib%
  1822.     NEXT I%
  1823.     SLEEP 10: ShutUp -1: SLEEP 1: ShutUp -1: SLEEP 1
  1824.     CALL KeyFlush: CLS
  1825. GOTO Egress
  1826.  
  1827. '┌────────────────────────────────────────────────────────────────────────┐
  1828. '│      Operating System Shell.                                           │
  1829. '└────────────────────────────────────────────────────────────────────────┘
  1830. '
  1831. D820:
  1832.     Scroll 1, 3, 1, 25, 80, 0, 7
  1833.     Me$ = "Enter the command 'EXIT' when you are ready to return."
  1834.     FastPrint 10, 40 - (LEN(Me$) \ 2), Me$, 14
  1835.     LOCATE 13, 1, 1: ON ERROR GOTO D821
  1836.     SHELL
  1837.     ON ERROR GOTO Trap
  1838.     GOTO D001
  1839. D821:
  1840.     ON ERROR GOTO Trap
  1841.     IF ERR = 5 THEN
  1842.        MisTake 9, "Cannot load secondary Command Processor", 0, Mouse%
  1843.        RESUME D800
  1844.     END IF
  1845.  
  1846. '┌────────────────────────────────────────────────────────────────────────┐
  1847. '│      Error Trap.                                                       │
  1848. '└────────────────────────────────────────────────────────────────────────┘
  1849. '
  1850. Trap:
  1851.     Fatal% = TRUE
  1852.     SELECT CASE ERR
  1853.         CASE 7, 14
  1854.              Me$ = "Out of memory"
  1855.         CASE 27
  1856.              Me$ = "PRINTER NOT READY": Fatal% = FALSE
  1857.         CASE 61, 67
  1858.              Me$ = "Out of disk space"
  1859.         CASE 71
  1860.              Me$ = "DISK DRIVE NOT READY": Fatal% = FALSE
  1861.         CASE 72
  1862.              Me$ = "Disk media error"
  1863.         CASE ELSE
  1864.              A$ = STR$(ERR): Me$ = "A type" + A$ + " Error has just occurred"
  1865.     END SELECT
  1866.     IF Fatal% THEN
  1867.        Me$ = Me$ + ", aborting to DOS ..."
  1868.        SL% = StatusLine%(Me$)
  1869.        RESUME Egress
  1870.     ELSE
  1871.        ML% = LEN(Me$): MT% = 40 - (ML% \ 2)
  1872.        IF Colour% THEN Attrib% = 78 ELSE Attrib% = 112
  1873.        PopUp 9, 20, 7, 42, Attrib%, 3, 2, -1
  1874.        FastPrint 10, MT%, Me$, Attrib% + 128: BEEP
  1875.        Me$ = "Please correct this error if possible"
  1876.        FastPrint 12, 22, Me$, Attrib%
  1877.        FastPrint 13, 30, "Press a key when ready", Attrib%
  1878.        FastPrint 14, 32, "or <ESC> to Abort.", Attrib%
  1879.        Character% = KeyIn%: ShutUp -1
  1880.        IF Character% = 27 THEN RESUME Egress
  1881.        RESUME
  1882.     END IF
  1883. Egress:
  1884.     Attr% = SCREEN(20, 1, 1)
  1885.     Curtains 25, 255: Curtains 25, 31: Curtains 25, Attr%
  1886.     LOCATE 20, 1, 1: ClearEnd 1, Attr%
  1887. END
  1888.  
  1889. '┌────────────────────────────────────────────────────────────────────────┐
  1890. '│     Program specific functions and procedures.                         │
  1891. '└────────────────────────────────────────────────────────────────────────┘
  1892. '
  1893. '   Draws or refreshes the main display screen. If switch is zero, only the
  1894. '   status line is refreshed.
  1895. '
  1896. SUB Frame (Title$, Switch%) STATIC
  1897.     SHARED StatColour%, HeadColour%, TextColour%, ToDay$
  1898.     IF Switch% THEN
  1899.        Scroll 1, 1, 1, 3, 80, 0, HeadColour%
  1900.        IF Title$ <> "" THEN
  1901.           FastPrint 1, 40 - (LEN(Title$) \ 2), Title$, HeadColour%
  1902.        END IF
  1903.        FastPrint 2, 1, STRING$(80, "─"), HeadColour%
  1904.        Panel 4, 1, 21, 80, 1, TextColour%
  1905.     END IF
  1906.     FastPrint 25, 1, SPACE$(80), StatColour%
  1907.     FastPrint 25, 4, "Press <F1> for Help, <ESC> to Abort", StatColour%
  1908.     IF ToDay$ <> "" THEN
  1909.        FastPrint 25, 78 - LEN(ToDay$), ToDay$, StatColour%
  1910.     END IF
  1911. END SUB
  1912.  
  1913. '┌────────────────────────────────────────────────────────────────────────┐
  1914. '│     Data Division.                                                     │
  1915. '└────────────────────────────────────────────────────────────────────────┘
  1916. '
  1917. Blurb:
  1918.     DATA "The Library modules on this disk provide you"
  1919.     DATA "with all the facilities necessary for you to"
  1920.     DATA "implement a full range of window features in"
  1921.     DATA "your programs.  With just one statement, for"
  1922.     DATA "instance, you can 'Pop-up' a window onto the"
  1923.     DATA "screen."
  1924.     DATA "The window can be a simple rectangle, in any"
  1925.     DATA "the QuickBASIC background colors, such as .."
  1926.     DATA "Alternatively it may have a border in one of"
  1927.     DATA "eight styles ...."
  1928.     DATA "The border itself may be in any one of the"
  1929.     DATA "QuickBASIC foreground colors. It can blink"
  1930.     DATA "if you want it to ..."
  1931.     DATA "The window, too, can be presented in several"
  1932.     DATA "different ways. It can be flat..."
  1933.     DATA "or it can have a black shadow underneath, to"
  1934.     DATA "give a three-dimensional effect..."
  1935.     DATA "Once you have a window on the screen, simply"
  1936.     DATA "use FASTPRINT, also in the TOOLBOX Library, "
  1937.     DATA "to put text into it, in any colour you like."
  1938.     DATA "You can also use the SCROLL routine from the"
  1939.     DATA "same source, to clear the window's contents."
  1940.     DATA "All the functions in the Library are written"
  1941.     DATA "in fast assembly language, but this does not"
  1942.     DATA "prevent them from being very easy to use."
  1943.     DATA "This for instance, is the call to create the"
  1944.     DATA "present window ....."
  1945.     DATA "   PopUp 8, 14, 8, 52, 112, 2, 0, -1"
  1946.     DATA "Before opening a window, the function stores"
  1947.     DATA "the screen beneath it in an internal buffer."
  1948.     DATA "When you close a window, the screen contents"
  1949.     DATA "are restored to their original location. Use"
  1950.     DATA "the statement 'ShutUp -1' to close the last"
  1951.     DATA "window opened.  For example ...."
  1952.     DATA "The Library includes several functions which"
  1953.     DATA "apply windowing techniques. The HELP screen,"
  1954.     DATA "which is available at the front menu, is one"
  1955.     DATA "example. Another is the VERIFY BOX which you"
  1956.     DATA "can use to collect a Yes/No response from an"
  1957.     DATA "operator, without redrawing the display."
  1958.     DATA "Another utility is the STATUS LINE MESSAGE,"
  1959.     DATA "which can be used to pause execution of the"
  1960.     DATA "program until the operator presses a key."
  1961.     DATA "You can display any prompt message you like"
  1962.     DATA "and the function will return the ASCII code"
  1963.     DATA "of the key which was pressed."
  1964.     DATA "I often use StatusLine in conjunction with a"
  1965.     DATA "routine which checks if the printer is ready"
  1966.     DATA "or not.  This gives the user a chance to fix"
  1967.     DATA "the printer,  if it is just out of paper, or"
  1968.     DATA "to abandon printing, if it is a more serious"
  1969.     DATA "problem. PrinTest is included here too."
  1970.  
  1971. Flags:
  1972.     DATA "The ASSEMBLY-LANGUAGE TOOLBOX includes a"
  1973.     DATA "pair  of functions which give you access"
  1974.     DATA "to  the  INTRA-APPLICATION COMMUNICATION"
  1975.     DATA "AREA (IAC),  an area of memory which has"
  1976.     DATA "been reserved,  by DOS, so that programs"
  1977.     DATA "can communicate with each other. The IAC"
  1978.     DATA "is 16 bytes long and is located,  in low"
  1979.     DATA "RAM at addresses 0000:04F0 - 04FF (Hex)."
  1980.     DATA "Once set, an IAC flag retains it's value"
  1981.     DATA "until  you reset it,  or the computer is"
  1982.     DATA "rebooted."
  1983.     DATA "Since QuickBASIC programs, compiled with"
  1984.     DATA "the /O switch to run stand-alone, cannot"
  1985.     DATA "pass variables to chain modules, you can"
  1986.     DATA "use  this feature to implement a limited"
  1987.     DATA "form of parameter passing."
  1988.     DATA "1.4F0h       9.4F8h", "2.4F1h      10.4F9h"
  1989.     DATA "3.4F2h      11.4FAh", "4.4F3h      12.4FBh"
  1990.     DATA "5.4F4h      13.4FCh", "6.4F5h      14.4FDh"
  1991.     DATA "7.4F6h      15.4FEh", "8.4F7h      16.4FFh"
  1992.     DATA 10, 59, 11, 59, 12, 59, 13, 59, 14, 59, 15, 59
  1993.     DATA 16, 59, 17, 59, 10, 72, 11, 72, 12, 72, 13, 72
  1994.     DATA 14, 72, 15, 72, 16, 72, 17, 72
  1995.  
  1996. Finder:
  1997.     DATA "This function allows you to find out if a particular"
  1998.     DATA "file is present on any disk drive in the system."," "
  1999.     DATA "Enter the name of the file which you want to locate,"
  2000.     DATA "including the drive letter and directory pathname if"
  2001.     DATA "required.  You can use an ambiguous name,  including"
  2002.     DATA "the wildcard characters (* and ?).  In this case the"
  2003.     DATA "function will pop up a directory window containing a"
  2004.     DATA "list of all files that match. You can select the one"
  2005.     DATA "you are interested in,  by high-lighting it with the"
  2006.     DATA "cursor arrow keys and pressing <RETURN>. The routine"
  2007.     DATA "returns a string containing the full pathname of the"
  2008.     DATA "file which you have selected."
  2009.  
  2010. Sorts:
  2011.     DATA "SORTFILE sorts ASCII text files. You supply the name, which may"
  2012.     DATA "include a directory pathname, and the start position and length"
  2013.     DATA "of the field which the file is to be sorted on.", " "
  2014.     DATA "The program first checks the size of the file and the amount of"
  2015.     DATA "free disk space to see if the it can be sorted in memory, this"
  2016.     DATA "requires space for two copies of the file on disk. If it is too"
  2017.     DATA "large, the file is sorted in place so that no extra disk space"
  2018.     DATA "is required. Using this method, which is far slower, the file"
  2019.     DATA "may be of any size up to 4 Gigabytes."
  2020.  
  2021. Size:
  2022.     DATA "THIS PROGRAM REPORTS THE SIZE OF FILES WHICH YOU SPECIFY"
  2023.     DATA "--------------------------------------------------------", " "
  2024.     DATA "The filename can include a directory path and may be ambiguous,"
  2025.     DATA "using the wildcard characters '*' and '?'. The program will"
  2026.     DATA "return the size of the file, in bytes, or, if more than one"
  2027.     DATA "match is found, the total size of all the files. If a size of"
  2028.     DATA "zero is returned, the file does not exist (at least not in the"
  2029.     DATA "directory specified).", " "
  2030.     DATA "Type in the pathname required (no more than 64 characters) or"
  2031.     DATA "Enter an empty string to quit."
  2032.  
  2033. KeyBuff:
  2034.     DATA 19, 6, 4, "Head Tail", 6, 33, "Keyboard Buffer"
  2035.     DATA  6, 67, "Buffer Area", 8, 4, "041A 041C"
  2036.     DATA  8, 17, "1E 20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C"
  2037.     DATA  8, 68, "0480 0482", 10, 3, "┌────┬────┐"
  2038.     DATA 10, 16, "┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐"
  2039.     DATA 10, 67, "┌────┬────┐",11, 3,"│         │", 11, 16, "│"
  2040.     DATA 11, 64, "│", 11, 67, "│         │", 12, 3, "└────┴────┘"
  2041.     DATA 12, 16, "└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘"
  2042.     DATA 12, 67, "└────┴────┘", 14, 3, "ASCII Codes"
  2043.     DATA 14, 67, "Waiting", 15, 3, "Scan Codes"
  2044.  
  2045. HWare:
  2046.     DATA "Unknown computer type", "PC", "PC/XT", "PCjr"
  2047.     DATA "PC/AT, PS/2 Model 50/60", "PC/XT", "PS/2 Model 30"
  2048.     DATA "PC Convertible", "PS/2 Model 80"
  2049.  
  2050. Shift:
  2051.     DATA "Left & Right SHIFT keys pressed", "CTRL key pressed"
  2052.     DATA "ALT key pressed", "SCROLL LOCK active"
  2053.     DATA "NUM LOCK active", "CAPS LOCK active"
  2054.     DATA "INSERT key status", "Left CTRL key pressed"
  2055.     DATA "Left ALT key pressed", "SYS REQ key pressed"
  2056.     DATA "PAUSE (or CTRL-NUM LOCK) active", "SCROLL LOCK pressed"
  2057.     DATA "NUM LOCK pressed", "CAPS LOCK pressed"
  2058.     DATA "INSERT key pressed"
  2059.  
  2060. Numbers:
  2061.     DATA 8, 1, 125678, 125678, 158, 158, 158, 158, 123458, 123458
  2062.     DATA 8, 4, 1278, 1278, 18, 148, 148, 148, F, 1235678
  2063.     DATA 8, 5, 12345, 12345, 5, 5, 45678, 45678, 5, 5
  2064.     DATA 8, 6, 12348, 12348, 148, 148, 148, 148, 145678, 145678
  2065.  
  2066. Crypt:
  2067.     DATA "This routine requires that you supply two strings of
  2068.     DATA "characters. The first is the text to be encrypted, and"
  2069.     DATA "the second is one or more keywords which are used to"
  2070.     DATA "encipher the text. Thereafter, the text cannot be"
  2071.     DATA "decrypted until you supply the same key string again."
  2072.  
  2073. Strings:
  2074.     DATA "Building a 1000 element, variable-length, string array"
  2075.     DATA "in memory and filling it with random data .... "
  2076.     DATA "Sort into Ascending or Descending order (A/D) [ ]"
  2077.  
  2078. Path:
  2079.     DATA "By default, the Toolbox Help system looks for its'"
  2080.     DATA "topic files in a subdirectory called HELP, beneath"
  2081.     DATA "the currently-logged directory.  You can, however,"
  2082.     DATA "direct it to look elsewhere for files by setting a"
  2083.     DATA "HELP variable in the DOS environment table;",""
  2084.     DATA "e.g.  SET HELP=C:\BASIC\TOOLBOX\HELP",""
  2085.     DATA "Alternatively, you can use the QuickBASIC ENVIRON"
  2086.     DATA "statement within your program, to point HELPMATE to"
  2087.     DATA "the appropriate pathname. Remember, 'though, that"
  2088.     DATA "this method only remains in effect as long as the"
  2089.     DATA "current program is running."
  2090.     DATA "The current HELP environment pathname is"
  2091.     DATA "Enter replacement or press <Esc> to leave unchanged"
  2092.  
  2093. Title:
  2094.     DATA 1, 2, 2, 2, 29, 0, 92, 23, 95
  2095.     DATA 64, 98, 104, 101, 135, 103, 102, 106, 65, 112, 30, 115
  2096.     DATA 10, 119, 5, 122, 3, 125, 5, 128, 10, 131, 30, 136, 65, 142
  2097.     DATA 221, 165, 320, 165, 320, 156, 35, 125, 27, 122, 35, 119
  2098.     DATA 65, 112, 102, 106, 135, 103, 149, 102, 162, 101, 195, 98
  2099.     DATA 240, 92, 272, 90, 304, 92, 320, 94
  2100.     DATA 0, 6, 6, 167, 8, 320, 94, 304, 92
  2101.     DATA 272, 90, 240, 92, 195, 98, 162, 101, 149, 102, 135, 103
  2102.     DATA 102, 106, 82, 109
  2103.     DATA 3, 7, 7, 90, 6, 220, 85, 220, 98
  2104.     DATA 300, 98, 300, 86, 305, 86, 260, 73, 215, 86, 220, 86
  2105.     DATA 0, 6, 6, 167
  2106.  
  2107.     DATA 6
  2108.     DATA 15, 65, "Toolbox Users", 15, -1, 1
  2109.     DATA 15, 75, "register now at...", 15, -1, 1
  2110.     DATA 15, 95, "Club-PC BBS", 15, -1, 1
  2111.     DATA 15, 105, "1217 Crescent Drive", 15, -1, 1
  2112.     DATA 15, 115, "Smithfield VA 23430", 15, -1, 1
  2113.     DATA 15, 134, "Tel. (804) 357-0357", 15, -1, 1
  2114.     DATA 2
  2115.     DATA 8, 172, "for TOOLBOX support", 14, 0, 2
  2116.     DATA 8, 172, "    TOOLBOX", 13, -1, 2
  2117.     DATA 2
  2118.     DATA 39, 192, "Press the SPACE BAR to continue", 11, 0, 1
  2119.     DATA 39, 192, "          SPACE BAR", 15, -1, 1
  2120.  
  2121. Escher:
  2122.     DATA 68,4,200,76,52,12,112,44,128,52,172,76,128,52,68,84,112,44,84,60
  2123.     DATA 128,68,99,84,68,36,97,52,128,68,154,84,128,68,128,116,128,52,128
  2124.     DATA 68,68,4,52,12,172,76,142,90,142,76,142,108,142,108,200,76,200,76
  2125.     DATA 200,92,200,92,68,164,128,116,84,140,52,12,52,154,52,154,68,164
  2126.     DATA 68,164,68,100,68,36,68,84,84,45,84,76,84,109,84,140,68,100,97,116
  2127.     DATA 84,124,112,108,68,84,128,116,84,76,112,92,112,77,112,108,84,119
  2128.     DATA 92,114,142,86,151,82,180,66,186,62,186,62,236,90,236,90,68,184
  2129.     DATA 68,184,16,154,16,154,52,133,16,154,16,160,16,160,68,190,68,190
  2130.     DATA 68,184,68,190,236,96,236,96,236,90
  2131.  
  2132. About:
  2133.     DATA "Assembly-Language Toolbox demonstration program"
  2134.     DATA "(c)1988 Christy Gemmell and Singular Software"
  2135.     DATA "Release 5.22 - February 1992"
  2136.  
  2137. Credits:
  2138.     DATA "   The Assembly-Language Toolbox for   "
  2139.     DATA "          Microsoft QuickBASIC         "
  2140.     DATA "    Professional Edition, Release 5    "
  2141.     DATA "                                       "
  2142.     DATA "is available for QuickBASIC 4.5 and the"
  2143.     DATA "BASIC 7 Professional Development System"
  2144.  
  2145.     DATA "The Professional Edition contains source code,"
  2146.     DATA "object files, stand-alone and Quick libraries"
  2147.     DATA "and a complete set of documentation. To order"
  2148.     DATA "To order, contact:    James J. Kreyling"
  2149.     DATA "                      CPC Consulting Company"
  2150.     DATA "                      1217 Crescent Drive,"
  2151.     DATA "                      Smithfield  VA 23430"
  2152.     DATA "        or through... Club-PC BBS (8-N-1)"
  2153.     DATA "Tel (804) 357-9190    BBS (804) 357-0357"
  2154.  
  2155. '┌────────────────────────────────────────────────────────────────────────┐
  2156. '│      (c) 1988,1992 By Christy Gemmell and Singular Software.           │
  2157. '└────────────────────────────────────────────────────────────────────────┘
  2158.