GET_GMC

Related Articles: The Fame & The Glory
Developer(s): Shawn Byrne
Date: 1983
Type: Cassette
Platform(s): TS 1000

Machine language subroutine that can be used to get user input.

Gallery

GET_GMC

Source Code

   1 REM \02\57\A9\25\00\00\2A\10\40\3E\80\BE\C8\3E\4C\BE\28\24\CB\6E\28\18\CB\7E\28\0E\CB\76\28\05\11\12\00\18\08\23\CB\7E\28\FB\11\06\00\19\18\DB\23\5E\23\56\23\19\18\D3\23\5E\23\56\E5\19\22\7B\40\E1\23\22\82\40\21\00\00\22\84\40\3E\00\32\86\40\21\87\40\36\00\21\21\40\CB\C6\2A\84\40\11\01\00\19\22\84\40\30\07\3A\86\40\3C\32\86\40\2A\0E\40\3A\84\40\CB\77\20\04\36\00\18\02\36\80\CD\BB\02\44\4D\5D\21\21\40\CB\46\28\07\1C\20\CD\CB\86\18\C9\1C\28\C6\CD\BD\07\7E\FE\77\20\23\21\87\40\3E\00\BE\28\B1\35\2A\0E\40\36\00\2B\3E\76\BE\20\01\2B\22\0E\40\2A\82\40\2B\36\00\22\82\40\18\96\FE\76\20\07\2A\0E\40\36\00\18\57\5F\2A\29\40\23\23\46\05\23\23\23\10\02\18\E4\56\7B\BA\28\1D\23\10\02\18\DA\3E\16\BE\28\06\3E\1A\BE\C0\18\E6\23\10\02\18\CA\7E\BB\38\E7\7A\BB\30\E3\21\87\40\34\2A\0E\40\73\23\F5\3E\76\BE\20\01\23\22\0E\40\2A\82\40\F1\73\23\22\82\40\2B\ED\4B\7B\40\AF\ED\42\20\9C\06\00\21\87\40\4E\C9
   2 REM %G%E%T BY SHAWN BYRNE 1983
   3 LET GET=16520
   4 LET A$="ENTER %C%O%N%T TO CONTINUE, %S%T%O%P TO STOP "
  90 GOTO 1000
 100 PRINT AT 20,0;A$
 110 LET G$="    "
 120 PRINT AT 21,12;
 130 LET N$=G$( TO USR GET)
 140 REM C,N,O,P,S,T
 150 IF N$="" THEN GOTO 110
 160 IF N$="STOP" THEN STOP 
 170 IF N$<>"CONT" THEN GOTO 110
 180 CLS 
 190 RETURN 
1000 SLOW 
1010 PRINT "***\ :%G%E%T\: *** BY SHAWN BYRNE  1983"
1020 PRINT 
1030 PRINT "\ :%G%E%T\: IS A MACHINE LANGUAGE SUB- ROUTINE, 289 BYTES LONG, WHICH  CAN BE USED TO %G%E%T A USER INPUT.",,
1040 PRINT "LINE 1 OF THE BASIC PROGRAM MUSTBE A REM STATEMENT CONTAINING 6 BYTES USED AS VARIABLES.THE SUB-ROUTINE ITSELF IS RELOCATABLE   AND CAN RESIDE ABOVE RAMTOP,IN AREM STATEMENT OR BETWEEN A BASICPROGRAM AND THE DISPLAY FILE."
1050 PRINT 
1060 PRINT "IF %G%E%T IS USED IN A 1 REM STATE-MENT, POKE 16419,2 SO THE BASIC (STARTING AT LINE 2) CAN BE DIS-PLAYED. DO NOT LIST;USE LIST 2."
1070 GOSUB 100
1080 PRINT "BEFORE \ :%G%E%T\: IS CALLED FROM WITH-IN A BASIC PROGRAM,IT£S STARTINGLOCATION MUST BE DEFINED:"
1090 PRINT 
1100 PRINT "EXAMPLE: 10 LET GET=16520"
1110 GOSUB 100
1120 PRINT "THE FUNCTION ""USR GET"" WILL RE- TURN THE LENGTH OF THE RESPONSE.THE STRING G$ MUST BE DEFINED   (A STRING OF SPACES) BEFORE %G%E%T IS CALLED AND THE LENGTH OF THE RESPONSE IS LIMITED BY THE"
1130 PRINT "LENGTH OF G$. THE RESPONSE IS   RETURNED IN G$."
1140 PRINT 
1150 PRINT "THE RESPONSE IS INPUT ON THE    SCREEN WHEREVER THE PRINT"
1160 PRINT "POSITION IS LOCATED. THE DELETE KEY WILL WORK. EXIT FROM %G%E%T IS PERFORMED WHEN ENTER IS PRESSED OR THE LENGTH OF THE INPUT = G$."
1170 GOSUB 100
1180 PRINT "IF THE RESPONSE IS NOT NEEDED ONTHE SCREEN, THE PRINT POSITION  CAN BE MOVED OFFSCREEN BY:"
1190 PRINT 
1200 PRINT TAB 8;"POKE 16399,0"
1210 PRINT 
1220 PRINT "OTHERWISE, THE RESPONSE CAN BE  POSITIONED ON THE SCREEN BY:"
1230 PRINT 
1240 PRINT TAB 5;"PRINT AT (LINE),(COL.);"
1250 PRINT 
1260 PRINT "BEFORE THE ROUTINE IS CALLED."
1270 GOSUB 100
1280 PRINT "IMMEDIATELY FOLLOWING THE LINE  NUMBER IN WHICH %G%E%T IS CALLED,"
1290 PRINT "THERE MUST BE A REM LINE WHICH  SPECIFIES THE CHARACTER(S) WHICHARE TO BE USED IN THE RESPONSE. CHARACTERS MUST BE SEPARATED BY A COMMA OR A HYPHEN."
1300 PRINT 
1310 PRINT "EXAMPLE 1:  REM 0-9"
1320 PRINT 
1330 PRINT "WILL GIVE A RESPONSE TO ALL THE NUMBERS FROM 0 THROUGH 9."
1340 PRINT 
1350 PRINT "EXAMPLE 2:  REM 2,7,C,R"
1360 PRINT 
1370 PRINT "WILL GIVE A RESPONSE ONLY TO    THOSE CHARACTERS."
1380 GOSUB 100
1390 PRINT "EXAMPLE 3:  REM A-F"
1400 PRINT 
1410 PRINT "WILL GIVE A RESPONSE ONLY TO THELETTERS A THROUGH F."
1420 PRINT 
1430 PRINT "EXAMPLE 4:  REM 0-Z"
1440 PRINT 
1450 PRINT "WILL GIVE A RESPONSE TO ALL THE NUMBERS (0 THROUGH 9) AND TO ALLTHE LETTERS (A THROUGH Z)." 
1460 GOSUB 100
1470 PRINT "%G%E%T HAS A COUNTER WHICH CAN BE  USED AS A TIMER. AFTER %G%E%T HAS  EXECUTED, THIS COUNTER VALUE CANBE FOUND BY:"
1480 PRINT 
1490 PRINT "PEEK 16516+256*PEEK 16517+65536 *PEEK 16518"
1500 PRINT 
1510 PRINT "A %G%E%T EXECUTION TIME OF 1 MINUTEWILL RESULT IN A COUNT OF ABOUT 26,770."
1520 PRINT 
1530 PRINT "THE EXACT COUNT WILL VARY WITH  EACH COMPUTER AND WILL HAVE TO  BE DETERMINED BY EXPERIMENTING."
1540 GOSUB 100
1550 PRINT "EXAMPLE OF %G%E%T COUNTER:"
1560 PRINT 
1570 PRINT "PLEASE PRESS THE ""Q"" KEY."
1580 LET G$=" "
1590 PRINT AT 5,15;
1600 RAND USR GET
1610 REM Q
1620 PRINT 
1630 LET N=INT ((PEEK 16516+256*PEEK 16517+65536*PEEK 16518)/446.1667)
1640 PRINT 
1650 PRINT TAB 6;"YOUR RESPONSE TIME WAS "
1660 PRINT 
1670 PRINT TAB 10;N;" SECONDS."
1680 GOSUB 100
1690 POKE GET+113,CODE "S"
1700 PRINT "THE FLASHING CURSER USED ON THE SCREEN CAN BE ANY CHARACTER.    FOR EXAMPLE, FOR A FLASHING ""S"":"
1710 PRINT 
1720 PRINT "POKE GET+113,CODE ""S"""
1730 PRINT 
1740 PRINT "TO RETURN TO THE FLASHING SPACE:"
1750 PRINT 
1760 PRINT "POKE GET+113,0"
1770 GOSUB 100
1780 POKE GET+113,0
1790 PRINT "%G%E%T WILL NOT ACCEPT A CHARACTER UNTIL AFTER IT HAS RECIEVED THE SIGNAL THAT NO KEY IS BEING     PRESSED,SO UPON ENTERING %G%E%T,IF A KEY IS BEING PRESSED, IT WILL NOT BE ACCEPTED UNTIL THE FINGERIS LIFTED AND A KEY PRESSED     AGAIN."
1800 PRINT "THIS PREVENTS A CHARACTER FROM  BEING REPEATED RAPIDLY."
1810 PRINT "TO ALLOW A CHARACTER TO BE AC-  CEPTED ON ENTERING %G%E%T WHEN IT  IS ALREADY BEING PRESSED:"
1820 PRINT 
1830 PRINT TAB 4;"POKE GET+129,24"
1840 PRINT 
1850 PRINT "TO RETURN TO NORMAL:"
1860 PRINT 
1870 PRINT TAB 4;"POKE GET+129,40"
1880 GOSUB 100
1890 PRINT "AN EXAMPLE OF A BASIC LISTING TOUSE %G%E%T IS:"
1900 PRINT 
1910 PRINT "10 LET GET=16520"
1920 PRINT "100 LET G$="" """
1930 PRINT "110 PRINT AT 10,15;"
1940 PRINT "120 LET N$=G$( TO USR GET)"
1950 PRINT "130 REM N,Y"
1960 PRINT "140 IF N$="""" THEN GOTO 100"
1970 PRINT "150 IF N$=""N"" THEN GOTO 1000"
1980 PRINT "160 IF N$=""Y"" THEN GOSUB 60"
1990 PRINT 
2000 PRINT "LINE 140 PREVENTS A RESPONSE TO ENTER."
2010 PRINT "LINES 150 AND 160 DETERMINE THE RESPONSE ACTION."
2020 GOSUB 100
2030 PRINT "%G%E%T CAN BE USED AS MANY TIMES INA BASIC PROGRAM AS NEEDED. EACH TIME IT IS USED THE LENGTH OF   THE RESPONSE AND THE CHARACTERS CAN BE REDEFINED IN BASIC."
2040 PRINT 
2050 PRINT AT 10,10;"SHAWN A. BYRNE"
2060 PRINT TAB 10;"RT. 3  BOX 342"
2070 PRINT TAB 10;"COOKEVILLE, TN."
2080 PRINT TAB 20;"38501"
2090 PRINT 
2100 PRINT TAB 10;"615/526-7914"
2110 GOSUB 100
2120 RUN 
9997 STOP 
9998 SAVE "GE%T"
9999 RUN 
Scroll to Top