'=========================================================================== ' Subject: ASCII CODE EXAMPLE Date: Unknown Date (00:00) ' Author: Jeff Shantz Code: QB, QBasic, PDS ' Keys: ASCII,CODE,EXAMPLE Packet: TEXT.ABC '=========================================================================== 'Ascii Code Utility By Jeff Shantz ' 'Programmer's Note ' 'This Utility Was Programmed In About 2 Minutes. I Just Sat Down And Thought 'That It Would Be Nice To Make A Program That Shows User's Some Of The 'Commands In QuickBasic That Aren't Used Everyday. This Program Uses '3 Main Commands, STRING$, INKEY$ And ASC. Many Programmers In QuickBasic 'Who Are Moderately Good Actually Do Not Know Those Three Commands. They 'Are Quite Useful As INKEY$ And ASC Can Be Used To Make Programs With 'Hotkeys Etc. ' CLS N = 1 'sets the variable used to determine the ascii code to 1 1 FOR I = 1 TO 999999 'start the loop LOCATE 1, 1 'locates the coordinates 1,1 on the screen X$ = STRING$(1, N) 'sets the ascii code currently being displayed to X$ REM Titles And Instructions COLOR 4: LOCATE 1, 26: PRINT "Ascii Code Utility" LOCATE 5, 5 COLOR 15: PRINT ""; N; ": "; X$; " " 'prints the two columns COLOR 7: LOCATE 5, 25: PRINT "Use `[' And `]' To Scroll. Press Escape To Quit." COLOR 14: LOCATE 10, 5: PRINT "The Left Column Indicates The Decimal Scan Code And The Right" LOCATE 11, 5: PRINT "Column Indicates The Character That Accompagnies It." LOCATE 13, 5: COLOR 4: PRINT "Written By Jeff Shantz" 'The Following Will Set It So That The Program Acts Upon A Keypress A$ = INKEY$: IF LEN(A$) = 0 THEN 2 CLS 'the statement below sets it so that if [ is pressed, N is lowered by 1 IF ASC(A$) = 91 THEN N = N - 1 'the statement below sets it so that if ] is pressed, N is raised by 1 IF ASC(A$) = 93 THEN N = N + 1 ELSE N = N 'stays same if other keys pressed IF ASC(A$) = 27 THEN 3 'if escape is pressed, the program ends IF N = -1 THEN N = N + 1: GOTO 1 'makes it so that you can't go below 0 IF N = 256 THEN N = N - 1: GOTO 1 'makes it so that you can't go above 255 2 NEXT I 3 SYSTEM 'exits to dos when run from DOS, otherwise just ends the program. 'Written by Jeff Shantz ' 'A catalogue of other public domain programming examples and other types of 'public domain software written by Jeff Shantz can be obtained by sending '$2.00 (for shipping & handling) to: ' 'Programming Examples 'c/o Jeff Shantz '162 Ann Street 'Kitchener,Ontario 'N2B 1Y3, CANADA ' 'or by setting your modem to 8,N,1 and calling The Crypt at 1-(519)-576-3127