Happy Birthday, BASIC, you wonderful language you!

I remember when I was ten or so years old. I asked my father a question that changed both of our lives. My Dad was an engineer. He was also what we would consider now to be a nerd. A geek.  Above all, though, he was very smart and he was MY Dad.  He could build anything out of what seemed to be random little bits of stuff.  To a ten year old, it was akin to magic.

So, what was that question?

“Dad, what’s a computer and how does it work?”

He didn’t give me a whole answer right away. If I remember, it was something like ‘a machine that can think, sort of.’ ‘Lets find out.’

Weeks later, he started getting packages. Those packages contained the magic wand, magic dust and … paper. Manuals, to be specific.

Out of those packages, my Dad built the Mark IV Mini-Computer, as written about in Radio-Electronics Magazine.  Now, this computer was primitive, even then. Something like 128 bytes of memory, which he expanded to 1K or something like that.  Anyway, that computer didn’t  answer our question.

So, he built another. And another.  That third computer, based on the Signetics 2650 microprocessor, was THE ticket.  This computer, had lots of memory (4K?) and, most importantly, had a keyboard and tv like screen. Oh, this thing called ‘Tiny Basic’.

I was hooked.  I eagerly soaked in all I could about this ‘Tiny Basic.’  I quickly learned that there were LOTS of Tiny Basics and even something just called ‘BASIC.’  So, what was this ‘BASIC’?

Simply put, BASIC was (well, IS) a computer programming language. And, during the 1970’s, it was pretty much the only way someone like myself could interact with the computer. It was easy to learn and use. I was typing in programs from my Dad’s books and magazine, having to alter them to work with the primitive version I had to use.  One day, I decided to start writing my own.  Finally, we had our answer. Collectively, we figured out what these computers were and what one could do with them. My Dad tackled the hardware, I tackled the software and, in the process, laid the foundation for my career.

And, it was all because of BASIC.

BASIC, developed in 1964 at Dartmouth University by John Kemeny and Thomas Kurtz. BASIC was designed for teaching the fundamentals of programming and to make the computer more accessible to non-programmer types.  It slowly grew out of Dartmouth and, by 1970, had spread all over the country.  It gained so much popularity, that it caught the eye and wrath of many professional who held it high in disdain. No matter, the genie was out of the bottle.

In the early 1970’s, when microprocessors became affordable and home computers took off, others were writing dialects of the language to run on these tiny machines.  The most notable being Micro-Soft Basic, co-developed by Bill Gates and Paul Allen and sold by MITS for the Altair computer. Unfortunately, it was priced so high that a black market for the language began, prompting a whiny ‘don’t copy our software’ letter from Bill Gates.  Whiny, but necessary. Software piracy was a huge deal at the time.

Around 1975-76, another dialect of the language came out and this one was affordable. Tiny Basic was a grass roots effort to develop the language so that it would work in very small memory footprints and on pretty much any computer.  Numerous version were released by companies and individuals.  Tom Pittman’s Tiny Basic was probably the most notable, followed by Lawrence Livermore Labs.  Oh, and the one that Steve Wozniak wrote for the Apple ][.

Kemeny and Kurtz hated the versions of their language for microcomputers, especially those of the ‘Tiny’ variety and anything out of Micro-Soft.  See, Micro-Soft, soon to be Microsoft, supplied a version of the language for pretty much all of the big commercial home computers: Apple, Atari, Tandy, Commodore, TI, Mattel and more.  Kemeny and Kurtz wanted to reel it back in with ‘True Basic’. Unfortunately, they discovered it was not that easy to do.

As time went on, however, the language grew and became a powerhouse for professional developers thanks to the efforts of Microsoft.

Microsoft included QBasic in its DOS product. They also had QuickBasic, which could compile code into true executables. For professional development, they had the Professional Development System, sort of a forerunner to todays Visual Studio product, only it was DOS based and character mode.

In the early nineties, they introduced Visual Basic, a Windows programming environment.  Shortly afterwards, Visual Basic for MSDOS was released. I had the opportunity to develop with this version for about two years. It was such a difference from what I was used to: object oriented and event driven. Suddenly, I had to think in terms of USER control of the application and not vice-versa.  It really opened my eyes as to how truly interactive computers could be.  Its overlapping text mode windows, mouse and relational database allowed me to create some really nice front end software for the video rental chain that employed me. It was a treat.

VBDOS didn’t live long.  Time and technology quickly outdated it.  VB for Windows evolved.  VB6 became THE development platform.  VB.NET was the future. Or, so we thought.

Microsoft’s run in with Sun Microsystems over Java led to the creation of C#: a modern programming language that was modeled after java with roots in C.  Interesting combo, but it wasn’t going to go anywhere. Microsoft was just trying to rattle Sun’s chains. That was my thinking. Boy, was I wrong.  Soon, the call for C# was on the rise while VB waned.

While BASIC no longer has the draw or the need, it is still there.  There’s a growing rank of people who are using as a hobby language again.  VBScript and VBA continue to dominate in the scripting arena. You really cannot beat it to do quick, repetitive tasks. It is great for automating mundane things.

And, Tiny Basic has made a come back of sorts. It is used on microcontrollers like the BasicStamp, Arduino and the PIC family of controllers.

While many probably wished it had died fifty years ago on May 1, it is far from death. In fact, this post is a celebration of not only its birthday, but the life it gave to an entire industry and its active future. 

I can’t say how much I owe this terrific language, it is truly immense. My life has been driven by many things, but I’d say BASIC was right up there with my parents and family as the most influential thing in my life.

Happy Birthday, BASIC!

Advertisements

LCD Character Editor for Parallax LCD panels

The Parallax 2×16 or 4×20 LCD panels are inexpensive and easy to use. While limited to 2 or 4 lines of text, they do provide for 8 definable characters. This allows a bit of ‘graphical’ manipulation but, doing so in code can be a bit tricky.  I have developed a small, Windows based editor that lets you specify the target for the code, the type of output you want and a graphical way of creating your character.

The LCD Character Editor

lcdchared

Using the application is simple: when it starts, you have a blank canvas. Click in the white squares to turn them on. Create your character this way. When you are done, click Add and the code to create the character appears in the large window. There are a few things you need to enter prior to Adding the character.

First, you need to name the character.  That really means assigning it a special character number (0 to 7.) Enter that in the ‘Special Character # box. Next, you need to tell it which platform to gen the code for … either the Basic Stamp, in which case it creates BASIC code or Arduino, which generates C like syntax. Next, select the type of code you want. The Source + Header option will create a nice beginning to a project file in BASIC Stamp mode or some generic starter code for Arduino.  Source Only just gives you the code that actually gets sent to the display. It uses the binary format. Hex Code APPENDS the hex version of the binary code. You can then cut the format you want.

Save and Load does just what they say.

Clear allows you to start a new character. And, since this is a one character at a time deal, that is why you have a choice of inserting the header code or not. You can create as many characters as you need, maybe create a library and import the characters you want into your project.

Finally, EXIT just shuts down the program.

All character files are stored as text files with the .BS2 extension, even for Arduino…sorry Arduino fans. This was an oversight and might get fixed in a later version.

I make no warranty about this application. It is free to use, even for commercial works, but you cannot sell it.

It was developed with Visual Studio 2005 and requires .net 2.5. You should not have to install anything if you are running Vista or better.

Code Samples:

I. BASIC STAMP, Header and Source:

=============================
‘   {$STAMP BS2}
‘   {$PBASIC 2.5}

‘ =========================================================================
‘ —–[ Program Description ]———————————————
‘ —–[ Revision History ]————————————————
‘ —–[ Variablew ]————————————————
baud            VAR     Byte            ‘ baud rate variable
‘ —–[ I/O Definitions ]————————————————-
TX              PIN     0               ‘ serial output to LCD
‘ —–[ Constants ]——————————————————-

#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
    T2400       CON    396
    T9600       CON     84
    T19K2       CON     32
#CASE BS2SX, BS2P
    T2400       CON     1021
    T9600       CON     240
    T19K2       CON     110
#ENDSELECT

baud=T9600

HIGH(TX)
PAUSE(100)

SEROUT TX, baud, [251]

SEROUT TX, baud, [%01110]
SEROUT TX, baud, [%11011]
SEROUT TX, baud, [%01110]
SEROUT TX, baud, [%10101]
SEROUT TX, baud, [%11111]
SEROUT TX, baud, [%10101]
SEROUT TX, baud, [%10001]
SEROUT TX, baud, [%10001]

II. BASIC STAMP, Source Only

SEROUT TX, baud, [248]

SEROUT TX, baud, [%01110]
SEROUT TX, baud, [%11011]
SEROUT TX, baud, [%01110]
SEROUT TX, baud, [%10101]
SEROUT TX, baud, [%11111]
SEROUT TX, baud, [%10101]
SEROUT TX, baud, [%10001]
SEROUT TX, baud, [%10001]

III. BASIC STAMP, Hex Code

SEROUT TX, baud, [0xE]
SEROUT TX, baud, [0x1B]
SEROUT TX, baud, [0xE]
SEROUT TX, baud, [0x15]
SEROUT TX, baud, [0x1F]
SEROUT TX, baud, [0x15]
SEROUT TX, baud, [0x11]
SEROUT TX, baud, [0x11]

IV. Arduino

#include <SoftwareSerial.h>

SoftwareSerial s(2,1); //receive on 2, and transmit on 1 aka ‘PB1’ aka pin 6
void setup() {
s.begin(9600);// set baud rate to 9600 baud
s.write(12);// clear screen
s.write(17);// turn on backlight

s.write(248)

s.write(B01110);
s.write(B11011);
s.write(B01110);
s.write(B10101);
s.write(B11111);
s.write(B10101);
s.write(B10001);
s.write(B10001);

You can download it, free, from here: LCD Char Editor

From patch cords and punch cards to GUI’s and Mice: how programming evolved

Software development has come a very long way since the early days of 1946 when Eniac was programmed via patch cords.  When more modern computers, such as Univac, hit the market, programming them was better, but still required skills that were just impossible to come by. The problem was so bad, that it nearly derailed the whole industry before it really got going.

IBM704That changed, though, in 1954 when John Backus of IBM developed the FORTRAN language.  Considered the first successful high level language, FORTRAN, short for FORmula TRANslator, was, initially, greeted with a bit of skepticism, but that was satiated with the optimizing compiler. There was a fear that the code it generated would not be as tight as the previously hand assembled code, so the optimizing compiler was developed to quell those fears.

The first FORTRAN was released in 1957, followed up the next year with FORTRAN II, which contained enhancements including the addition of procedural programming. Functions and subroutines allow the developer to create their own functions for the first time.

FORTRAN was a big step forward, but it had its limitations. Primarily, it was not very good with business uses. The solution would come from a committee that formed in 1959.  The committee was formed by people from the government and private industry.

FLOW-MATIC, a language developed by Grace Hopper, was used as the foundation for COBOL, or COmmon Business Oriented Language. FLOW-MATIC was drawn from more than other language specs mainly because it was the only one that had actually been deployed and used. COBOL gained wide acceptance in business and enjoyed a run that continues today, though it use has dramatically declined over the last couple of decades. 

Both FORTRAN and COBOL served both the science, research and business communities, but they were not all that easy to master. FORTRAN more than COBOL, but were still out of reach for many.  In 1962, John Kemeny and Thomas Kurtz developed the Beginners All-purpose Symbolic Instruction Code, or BASIC.  Panned by most ‘professional’ programmers and purists, BASIC, nonetheless, gained wide acceptance in the 1970’s with the advent of the microcomputer.

Initially, BASIC was both the operating system and language of many homebrew and early retail microcomputers. However, those machines were very limited in memory and power. The version of BASIC that was generally in use was called Tiny BASIC. These ‘tiny’ languages truly were tiny: most took only 2.5 to 4K of memory. They generally only handled integer numbers, limited or no string handling and only the ‘basic’ of statements (like IF-THEN, GOTO, PRINT, INPUT, etc.) were included. 

Things looked up, however, when the ALTAIR computer was introduced. Two kids decided they would supply a BASIC language for the computer. Paul Allen and Bill Gates set up shop in New Mexico and began Micro-Soft. Gates delivered the final bits of code the day they were supposed to meet with Ed Roberts, the owner of the MITS company, the producer of the Altair.  Micro-Soft Basic became the defacto ‘standard’ for microcomputer Basic for years to come. It was also one of the most pirated pieces of software.

Micro-soft, later changed to Microsoft, continually enhanced the language, adding low-res, monochrome graphics statements, then hi-res color, disk file handling and more. In 1991, the company introduced Visual Basic, a Windows based development environment. For the first time, Windows applications could be developed, quickly and without having to know ‘C’ or how the innards of Windows worked. It enabled companies, large and small, to embrace Windows without having spend lots of money developing or purchasing specialty applications. The company also continued to develop its DOS versions with the Professional Development System and a DOS version of Visual Basic called Visual Basic for DOS or VBDOS for short. I, personally, developed several applications with VBDOS and it was, by far, my favorite text based version other than NI/BL, a variation of Tiny Basic for the National Semiconductor SC/MP in the ‘70s.

Microsoft held VB in such high regard, that it became the built in scripting language of its Office Suite, a second scripting language in its browsers, and for Windows itself. VBScript, while it no longer is being developed by the company, is a highly versatile language and is under appreciated.

No discussion of programming languages would be complete without talking about C.

C was developed between 1969 and 1973 by Dennis Ritchie at Bell Labs. C is probably the most widely used language. It is used to develop everything from games to operating systems (such as Unix and Windows.) While it generally is considered a high level language, C more closely resembles cross between BASIC and Assembler. It requires knowledge of how the CPU works, things like pointers and other lower level objects than, say a BASIC or even COBOL.  It does, however, generate smaller and more efficient code.

C gained popularity in the 1980’s but it, too, had ‘Tiny’’ versions, but they did not catch on quite like Tiny Basic did. However, it did spawn a more powerful version called C++. C++ is an object oriented language that did catch on…like wildfire. C++ is a true modern language and was the inspiration for other modern languages like JAVA and C Sharp (C#).

Gone are the days of punch cards, magnetic tape and printouts. With our graphical development environments, mice, touch screens and languages like C Sharp, VB and web development technologies, programming has definitely come a long way. And, that shortage of programmers? Gone.

I must say, those days in the 1970’s and 80’s, and the underpowered computers, were a blast. For geeks like me, Tiny Basic was a godsend. I was able to learn something that, later, would provide a career. I got to experience, first hand, the birth of the modern computer era. I can remember, eagerly, getting a computer magazine and tediously entering BASIC code and then having to ‘fix’ it to work with my particular flavor of BASIC. But, I did. I got just about everything I entered to work. Yeah, I missed things like Prom and high school football, but I would not trade it for anything. I think the way I felt was pretty close to those early pioneers in the early ‘50s.  Amazing, that sums it up.