Skip to main content
Changed A$ to NA$ in line 50040.
Source Link
Tim Locke
  • 4.9k
  • 22
  • 36

Back in the day I wrote my own input code using GET. Over time I enhanced it to support various features. You start out with GET A$. Here is a simple one I just threw together:

10 NA$="":PR$="Name:"
20 GOSUB 50000
30 PRINT"Your name is ";NA$
40 END

50000 PRINT PR$;
50010 GET A$:IF A$="" THEN 50010
50020 IF A$=CHR$(13) THEN PRINT:RETURN
50030 IF A$<>CHR$(20) THEN 50050
50040 IF LEN(A$NA$)>0 THEN NA$=LEFT$(NA$,LEN(NA$)-1):? CHR$(157);" ";CHR$(157);
50050 IF A$>="a" AND A$<="z" THEN 50090
50060 IF A$>="A" AND A$<="Z" THEN 50090
50070 IF A$=" " THEN 50090
50080 GOTO 50010
50090 NA$=NA$+A$:PRINT A$;:GOTO 50010

BITD I had a blinking cursor implemented.

Back in the day I wrote my own input code using GET. Over time I enhanced it to support various features. You start out with GET A$. Here is a simple one I just threw together:

10 NA$="":PR$="Name:"
20 GOSUB 50000
30 PRINT"Your name is ";NA$
40 END

50000 PRINT PR$;
50010 GET A$:IF A$="" THEN 50010
50020 IF A$=CHR$(13) THEN PRINT:RETURN
50030 IF A$<>CHR$(20) THEN 50050
50040 IF LEN(A$)>0 THEN NA$=LEFT$(NA$,LEN(NA$)-1):? CHR$(157);" ";CHR$(157);
50050 IF A$>="a" AND A$<="z" THEN 50090
50060 IF A$>="A" AND A$<="Z" THEN 50090
50070 IF A$=" " THEN 50090
50080 GOTO 50010
50090 NA$=NA$+A$:PRINT A$;:GOTO 50010

BITD I had a blinking cursor implemented.

Back in the day I wrote my own input code using GET. Over time I enhanced it to support various features. You start out with GET A$. Here is a simple one I just threw together:

10 NA$="":PR$="Name:"
20 GOSUB 50000
30 PRINT"Your name is ";NA$
40 END

50000 PRINT PR$;
50010 GET A$:IF A$="" THEN 50010
50020 IF A$=CHR$(13) THEN PRINT:RETURN
50030 IF A$<>CHR$(20) THEN 50050
50040 IF LEN(NA$)>0 THEN NA$=LEFT$(NA$,LEN(NA$)-1):? CHR$(157);" ";CHR$(157);
50050 IF A$>="a" AND A$<="z" THEN 50090
50060 IF A$>="A" AND A$<="Z" THEN 50090
50070 IF A$=" " THEN 50090
50080 GOTO 50010
50090 NA$=NA$+A$:PRINT A$;:GOTO 50010

BITD I had a blinking cursor implemented.

Optimization and check for 0 length string before backspacing.
Source Link
Tim Locke
  • 4.9k
  • 22
  • 36

Back in the day I wrote my own input code using GET. Over time I enhanced it to support various features. You start out with GET A$. Here is a simple one I just threw together:

10 NA$="":PR$="Name:"
20 GOSUB 50000
30 PRINT"Your name is " NA$;";NA$
40 END

50000 PRINT PR$;
50010 GET A$:IF A$="" THEN 50010
50020 IF A$=CHR$(13) THEN PRINT:RETURN
50030 IF A$=CHR$A$<>CHR$(20) THEN 50050
50040 GOTOIF 50060
50050LEN(A$)>0 THEN NA$=LEFT$(NA$,LEN(NA$)-1):? CHR$(157);" ";CHR$(157);:GOTO 50010
5006050050 IF A$>="a" AND A$<="z" THEN 5010050090
5007050060 IF A$>="A" AND A$<="Z" THEN 5010050090
5008050070 IF A$=" " THEN 50100
50090
50080 GOTO 50010
5010050090 NA$=NA$+A$:PRINT A$;:GOTO 50010

BITD I had a blinking cursor implemented.

Back in the day I wrote my own input code using GET. Over time I enhanced it to support various features. You start out with GET A$. Here is a simple one I just threw together:

10 NA$="":PR$="Name:"
20 GOSUB 50000
30 PRINT"Your name is " NA$;
40 END

50000 PRINT PR$;
50010 GET A$:IF A$="" THEN 50010
50020 IF A$=CHR$(13) THEN PRINT:RETURN
50030 IF A$=CHR$(20) THEN 50050
50040 GOTO 50060
50050 NA$=LEFT$(NA$,LEN(NA$)-1):? CHR$(157);" ";CHR$(157);:GOTO 50010
50060 IF A$>="a" AND A$<="z" THEN 50100
50070 IF A$>="A" AND A$<="Z" THEN 50100
50080 IF A$=" " THEN 50100
50090 GOTO 50010
50100 NA$=NA$+A$:PRINT A$;:GOTO 50010

BITD I had a blinking cursor implemented.

Back in the day I wrote my own input code using GET. Over time I enhanced it to support various features. You start out with GET A$. Here is a simple one I just threw together:

10 NA$="":PR$="Name:"
20 GOSUB 50000
30 PRINT"Your name is ";NA$
40 END

50000 PRINT PR$;
50010 GET A$:IF A$="" THEN 50010
50020 IF A$=CHR$(13) THEN PRINT:RETURN
50030 IF A$<>CHR$(20) THEN 50050
50040 IF LEN(A$)>0 THEN NA$=LEFT$(NA$,LEN(NA$)-1):? CHR$(157);" ";CHR$(157);
50050 IF A$>="a" AND A$<="z" THEN 50090
50060 IF A$>="A" AND A$<="Z" THEN 50090
50070 IF A$=" " THEN 50090
50080 GOTO 50010
50090 NA$=NA$+A$:PRINT A$;:GOTO 50010

BITD I had a blinking cursor implemented.

The name was not actually displayed and there was a missing colon
Source Link
user6734
user6734

Back in the day I wrote my own input code using GET. Over time I enhanced it to support various features. You start out with GET A$. Here is a simple one I just threw together:

10 NA$="":PR$="Name:"
20 GOSUB 50000
30 PRINT"Your name is ";" NA$;
40 END

50000 PRINT PR$;
50010 GET A$:IF A$="" THEN 50010
50020 IF A$=CHR$(13) THEN PRINT:RETURN
50030 IF A$=CHR$(20) THEN 50050
50040 GOTO 50060
50050 NA$=LEFT$(NA$,LEN(NA$)-1):? CHR$(157);" ";CHR$(157);GOTO;:GOTO 50010
5004050060 IF A$>="a" AND A$<="z" THEN 5008050100
5005050070 IF A$>="A" AND A$<="Z" THEN 5008050100
5006050080 IF A$=" " THEN 5008050100
5007050090 GOTO 50010
5008050100 NA$=NA$+A$:PRINT A$;:GOTO 50010

You'll have to use the question mark in line 50030 to keep the line short enough for the BASIC editor to accept it. BITD I had a blinking cursor implemented.

Back in the day I wrote my own input code using GET. Over time I enhanced it to support various features. You start out with GET A$. Here is a simple one I just threw together:

10 NA$="":PR$="Name:"
20 GOSUB 50000
30 PRINT"Your name is ";
40 END

50000 PRINT PR$;
50010 GET A$:IF A$="" THEN 50010
50020 IF A$=CHR$(13) THEN PRINT:RETURN
50030 IF A$=CHR$(20) THEN NA$=LEFT$(NA$,LEN(NA$)-1):? CHR$(157);" ";CHR$(157);GOTO 50010
50040 IF A$>="a" AND A$<="z" THEN 50080
50050 IF A$>="A" AND A$<="Z" THEN 50080
50060 IF A$=" " THEN 50080
50070 GOTO 50010
50080 NA$=NA$+A$:PRINT A$;:GOTO 50010

You'll have to use the question mark in line 50030 to keep the line short enough for the BASIC editor to accept it. BITD I had a blinking cursor implemented.

Back in the day I wrote my own input code using GET. Over time I enhanced it to support various features. You start out with GET A$. Here is a simple one I just threw together:

10 NA$="":PR$="Name:"
20 GOSUB 50000
30 PRINT"Your name is " NA$;
40 END

50000 PRINT PR$;
50010 GET A$:IF A$="" THEN 50010
50020 IF A$=CHR$(13) THEN PRINT:RETURN
50030 IF A$=CHR$(20) THEN 50050
50040 GOTO 50060
50050 NA$=LEFT$(NA$,LEN(NA$)-1):? CHR$(157);" ";CHR$(157);:GOTO 50010
50060 IF A$>="a" AND A$<="z" THEN 50100
50070 IF A$>="A" AND A$<="Z" THEN 50100
50080 IF A$=" " THEN 50100
50090 GOTO 50010
50100 NA$=NA$+A$:PRINT A$;:GOTO 50010

BITD I had a blinking cursor implemented.

Removed extraneous brace
Source Link
Tim Locke
  • 4.9k
  • 22
  • 36
Loading
Source Link
Tim Locke
  • 4.9k
  • 22
  • 36
Loading