Sunday, September 23, 2018

Programming Inside the Lines

Why do people program computers?
  • Business - To automate a process or financial problem
  • Automation - To control homes, factories, machines
  • Research - Data mining, simulation, modeling
  • Communication - Email, telephony, broadcasting, journalism
  • Recreation - Games, movies, music
  • And for fun - Yes, programming is also an enjoyable recreational activity.
I was recently part of a social media thread where we were discussing, more or less, whether programming languages should remove all features that could lead to bad practices.  This was motivated by the perennial question, "Should GOTO be allowed in programming?"  GOTO is not bad.  GOTO is simply GOTO.  I'll leave it there, for now.

Let's compare programming to finger painting.  If you gave a child some finger paints and a sheet of paper and a smock, would you yell at the child for what was painted, or if the activity made a mess?

I started programming when I was 11 years old.  Nobody made me do it.  I sat down with my father's HP-67 calculator and the wonderful manual and I was hooked!  From that point forward I spent much less time on my electronics hobby and spent my energy programming.

So, what is fun about programming?  Here is a short list:
  • Programming involves learning, which lights up neurons all over and stimulates the feel good hormone dopamine.
  • Programming involves problem solving, which is also a kind of learning.
  • Programming is a creative activity, and people enjoy making things.
  • Programming is delightfully interactive.  Give to the computer and it gives back.
  • Programming as an enjoyable social activity, sharing/working/competing with others
I see people bashing programming languages because they have features that will "ruin the programming culture and practices of the masses".  Oh, please.  How many of us have enough experience to even begin to know what this means?  How we define 'ruin' in this context?  And why is it acceptable to 'prove' that something is good or bad by regurgitating some famous person's quote that says that it's so?  We should resist this sort of nearsighted ideology.

I learned programming using the so called bad languages, and I had a blast and nobody got hurt!  I learned a ton and nothing stopped me from learning the so called good languages later on.  I encourage everyone to learn new things but if you decide to only learn one programming language you have not committed a crime to society.  Don't let anyone ever tell you different.

I know that nobody needs my permission, but I'll give it to you anyway!  Go forth and have fun programming!  Color outside the lines and drum to your own beat!  Don't be afraid of the self appointed programming police!

Monday, September 17, 2018

Home Computers and Line Numbered BASIC Interpreters

If you're like me, you started using computers back in the early days when a computer was something you could hook up to your television set.  Turn it on and immediately it would greet you with something like:

Super Duper BASIC v2.02
28467 bytes free
Ready
_

This was the most typical way a computer would start up.  You are then in BASIC, ready to explore programming more or less instantly.  There was nothing to download or install.  There was no antivirus software to harass you before you could proceed, and you did not need to boot your computer from a hard disk, log in, and then use a menu system to launch your programming language.

Your computer came with a book (yes, really) that started you on your programming journey in friendly terms, and happy looking cartoons.

In a few minutes you could have a simple example program from the book typed in and then typed RUN to see it in action.  A couple of hours into the book and you were a budding programmer.

There was no need to learn large volumes of functions just to put anything on the screen.  Was it primitive?  You bet.  The good thing about it was that mastery was attainable without going to school.

With computers today?  Forget all that.  I guess you could say that only the most determined people will learn to program now because they have to go exploring into the expanses of the Internet to figure out how to start.

Home computers.  Yup, we called them that before the term personal computer became popular.

The built in BASIC language in these machines is like clay in your hands.
  • Turn on the computer and start coding in seconds.
  • Execute code without a program.  Just type some code by itself and press Enter.
  • Add code to your program one line at a time and just type RUN to try it.
  • Stop and restart a running program.  Change it and resume running.
  • Type a program in from one of many popular magazines.  Learn to program by changing the program to make it your own.  Copying and pasting code from the Internet is just not the same.
People like to say unkind things about that era and all the messy looking code that BASIC encouraged.  I say that interpreted BASIC was a natural fit for that time.  It probably would have been hard to do it any other way.

I think that there are lessons to be learned from all this.  The kinds of computer literacy that we have today is only enough to use the computer to consume.  We only think that we know how to use the computer, but we really only know enough to run apps.

How do we make the real power of computers accessible again?  How can we restore the immediacy and interactivity of a BASIC interpreter to the end user?

You know what?  You can go on ebay and just buy one of these computers.  Prepare to be charmed.  :-)

Sunday, September 16, 2018

Python - The Emperor's New Clothes

I recently posted a couple of examples of a starfield simulation written in BASIC.  One of these was written in Commodore BASIC for the VIC-20.  The other was written in Liberty BASIC for Windows.

BASIC gets a lot of flack from people with a certain kind of snob factor (yes, you know who you are).  And there is the infamous comment by Edsger Dijkstra, and BASIC has never lived it down.  Nowadays when you see people discussing what is the best first language I probably see Python mentioned most.  In these forum discussions someone always seems to snidely denounce BASIC as that old thing with the GOTO and the unreadable spaghetti code.  They don't seem to have a good reason to recommend Python, except that it isn't BASIC.

People also recommend C and it's derivatives such as C++ which also has GOTO.  So go figure.

Wait, here is something scandalous!  On the Python Software Foundation website, in their design and history FAQ page, they actually answer the question about why there is no GOTO in Python by encouraging people to use exception handling as a hack to simulate something like GOTO!  Ummmm.   See for yourself.  https://docs.python.org/3/faq/design.html#why-is-there-no-goto

Okay, getting back to the starfield simulation example.  If you look at the version of the starfield simulation written in Liberty BASIC, it addresses some of the things that BASIC is frowned on about.
  • GOTO - Uh oh, not really.  There is one GOTO, but in this case I'm not sure a WHILE/WEND forever loop is really better, so...  The Commodore BASIC version has three GOTOs.
  • Structure - The Liberty BASIC version uses control structures properly the way modern languages do.
  • Line numbers - Liberty BASIC programs do not require numbers.  You can give your routines meaningful names instead of numbers.
Okay, let's be frank.  Liberty BASIC was not the first version of BASIC to solve these problems.  There are many BASICs with modern features, and so it isn't fair to criticize BASIC as being a bad language for beginners.  BASIC has been a proper language for teaching good programming practices for a very long time now.

What do you think?  Comments welcome.  :-)


Tuesday, September 11, 2018

BASIC over at Rosetta Code

I was curious to see how many different BASIC dialects are represented over at rosettacode.org. Here is the list (excluding VB dialects) of languages with BASIC in the name. I also included RapidQ because I know that is a BASIC also.
Rosetta code is a really cool site.  If you're not familiar, it is a site showing how to solve many different kinds of problems in many programming languages, so if you like to solve problems you can help to add code to their site in your favorite BASIC.  :-)
If your favorite version of BASIC is not there, you might consider adding it!
My favorites are Liberty BASIC and Run BASIC because they are my own implementations of BASIC, but I am also a fan of Power BASIC and Commodore BASIC!
• Applesoft BASIC
• BASIC
• BASIC256
• BBC BASIC
• Commodore BASIC
• EhBASIC
• FreeBASIC
• FutureBasic
• FUZE BASIC
• GFA Basic
• GLBasic
• GW-BASIC
• Integer BASIC
• IWBASIC
• Liberty BASIC
• Locomotive Basic
• MSX Basic
• OxygenBasic
• PowerBASIC
• PureBasic
• QBasic
• Quite BASIC
• RapidQ
• REALbasic
• Run BASIC
• Script Basic
• Sinclair ZX81 BASIC
• Smart BASIC
• SmileBASIC
• Superbase BASIC
• TechBASIC
• TI-83 BASIC
• TI-89 BASIC
• True BASIC
• Yabasic
• ZX Spectrum Basic

Monday, September 10, 2018

Feels Like the First Time

I started soldering when was about 10 years old, and I have hundreds of hours of soldering experience under my belt.  Having said that, my first foray into surface mount soldering made me feel like a novice all over again.

The Final Expansion 3 cartridge (an SD card floppy drive emulator and RAM/flash memory card) build that I've started for use with my VIC-20 has several surface mount components, and two of these are capacitors so small that I was afraid I was going to lose them.  It's not an exaggeration to say they could be mistaken for salt crystals.  Perhaps the kit should have provided a spare or two just in case.  ;-)

Here are photos of my work.






What I found most difficult was holding the parts precisely in place while soldering them.  The way I tried was to flow solder onto the pads and then put a little flux on that and place the parts and touch them with the iron, reflowing the solder.  This was hard to do, and especially with the C6 and C7 capacitors.  They are so much smaller than I expected and it was very hard to center the parts over the pads.  Even with tweezers it was a task.  Notice in the photos above C7 is off center, but I checked it carefully with my meter and it seems okay so I decided to go with it.

Maybe pre-tinning the pads was a bad idea because it was hard to make the parts rest completely flat against the board.  Another idea might have been to use solder wick to remove excess solder before placing the parts, and then putting a tiny blob of solder on the tip of the iron and applying it to the capacitor?

So, if I'm going to become good at surface mount work I'm going to need a lot more practice but this project is mostly thru hole work.

Onward and upward!

Tuesday, September 4, 2018

The new 6502 Shack

I've create a new blog dedicated to the MOS 6502 microprocessor and the computers that are built on it, and also a new Facebook group for it.  Read more about it here.

Sunday, September 2, 2018

Taking Stock of the Final Expansion 3 Kit

I finally sat down yesterday and printed out the bill of materials for the Final Expansion 3 kit.  The assembly instructions can be found here.  https://www.lemon64.com/forum/viewtopic.php?p=767044

Note: This isn't a kit for the beginner, so if you are one you will have a better chance at success with help from someone with experience.  This is not a knock on the quality of the kit, which seems to be quite good.

So, I carefully examined each part on the bill of materials.  It was easy to identify most parts because they have markings that are listed.  There are three tiny parts without markings.  One is a crystal which is a tiny little metal can with two leads coming out of one end.  The other is a small white cardboard carrier with two tiny little rectangular dots.  These dots are two surface mount capacitors.

There are five surface mounted parts in this kit.  Assembling these is considered an advanced skill.  This will be my first time with surface mount components.  I am eager to give this a go.  YouTube videos showing how to do this are aplenty.

After carefully examining everything, I was able to account for all the parts in the kit.

Here is a photo of the unpopulated board.


I also posted a video about all this. 

Getting Ready to Build the Final Expansion 3 FE3 Kit for the VIC-20



Next stop - Assembly!  :-)