Skip to content

Instantly share code, notes, and snippets.

@versluis versluis/input.bas
Created May 4, 2018

Embed
What would you like to do?
a text input routine written in Commodore BASIC
5 print
10 w$=""
20 print "(greater than)_";
30 get a$:if a$="" then 30
40 a=asc(a$)
50 if a=13 then 200:rem return
60 if a=32 then 110:rem space
70 if a=20 then 300:rem backspace
100 if a<65 or a>90 then 30
110 print chr$(20);a$;"D";
115 w$=w$+a$
120 goto 30
200 rem handle return
210 print chr$(20)
215 if w$="" then print:print"you typed
nothing!":end
220 print:print"you typed:":print w$
230 end
300 rem handle backspace
305 if len(w$)=0 then 30
310 print chr$(20);chr$(20);"D";
320 w$=left$(w$,len(w$)-1)
330 goto 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.