Home
Categories
EXPLORE
True Crime
Comedy
Society & Culture
Business
Sports
TV & Film
Technology
About Us
Contact Us
Copyright
© 2024 PodJoint
00:00 / 00:00
Sign in

or

Don't have an account?
Sign up
Forgot password
https://is1-ssl.mzstatic.com/image/thumb/Podcasts115/v4/d2/01/2f/d2012f8d-2bba-b9b1-e0e7-14a686e6e019/mza_12162428384170880572.jpg/600x600bb.jpg
Jay's Commodore Podcast
Jay Versluis
16 episodes
9 months ago
Join Jay Versluis for tips and tricks on programming in BASIC and Assembly on vintage Commodore systems.
Show more...
Technology
RSS
All content for Jay's Commodore Podcast is the property of Jay Versluis and is served directly from their servers with no modification, redirects, or rehosting. The podcast is not affiliated with or endorsed by Podjoint in any way.
Join Jay Versluis for tips and tricks on programming in BASIC and Assembly on vintage Commodore systems.
Show more...
Technology
https://wpguru.co.uk/wp-content/uploads/2018/08/Commodore-Podcast-Icon.jpg
How to write a text input routine in Commodore BASIC
Jay's Commodore Podcast
22 minutes 52 seconds
7 years ago
How to write a text input routine in Commodore BASIC

In this screencast I’ll show you how to write your own INPUT routine in Commodore BASIC. This comes in handy when you want to reject certain keys from being used when asking users for keyboard input. In my example I’m going to allow all alpha characters (A-Z), as well as SPACE, RETURN and the DELETE key.
Here’s the code:
.gist table { margin-bottom: 0; }













This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters

Show hidden characters













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






view raw

input.bas

hosted with ❤ by GitHub



Jay's Commodore Podcast
Join Jay Versluis for tips and tricks on programming in BASIC and Assembly on vintage Commodore systems.