Code: Select all
0 dim a$, b$, e$, i
10 e$="!;:()@[]'0123456789., "+chr$(13)
20 print">{reverse on} {reverse off}{left}";
30 gosub 250
40 print "final string: "; a$
50 end
250 get b$: if b$="" then goto 250
255 for i=1 to len(e$)
260 if b$=mid$(e$, i, 1) then goto 280
265 next i
270 if b$=chr$(20) and len(a$)>0 then a$=left$(a$, (len(a$)-1) ): goto 290
275 if b$<"a" or b$>"z" then goto 250
280 if b$=chr$(13) then print" ": return
290 print b$;"{reverse on} {reverse off}{left}";:if len(a$)<254 and b$<>chr$(20) then a$=a$+b$
300 goto 250
Lines 255 - 265 will check for the exceptions stored in E$ by checking the contents of B$ against each character.
Line 270 checks for the delete key and will work if there is something already in the variable A$, if so it will remove the last character from the string and goto 290.
Line 275 checks the keys A - Z by default.
Line 280 checks for the RETURN key to be pressed - if so, the last character is cleared and the sub-routine is returned.
Line 290 will output the contents of B$ as long as it's a 'legal entry', followed by an reversed space character. There is also a check that A$ is not exceeded the maximum length of a string in Commodore BASIC (ie, 255 characters).
I think that's it.
Regards,
Shaun.