The BASIC programming language turns 60

bebu

Ars Scholae Palatinae
958
Anyway, I remember eagerly awaiting my first algebra class and being one of the first ones to raise my hand when the teacher asked if we had questions. I asked her how variables could help me write programs and if she could explain pointers to me. All I got in response was a completely blank look. Sadly, I didn't figure these things out myself for another couple of years...
That is funniest thing I have read in a while. Might have been funnier if she were a full bottle on denotational semantics. :)
Your father might have been better off giving you a Scheme interpreter and a copy of Abelson and Sussman Structure and Interpretation of Computer Programs but then the challenge wouldn't have been there.
Explaining pointers is a perilous task at best. You are fortunate if they are as simple as a virtual memory address annotated with a type.
 
Upvote
2 (2 / 0)

zogus

Ars Tribunus Angusticlavius
7,184
Subscriptor
My father also gave me a book on C (I vaguely recall it was named something like "ANSI Standard C") when I was in middle school for mostly the same reason, and I remember getting totally stuck on the idea of a variable. I remember asking my dad what it meant and he gave me examples from algebra (dad was not a programmer) which I also had not yet studied. Now that I am an actual computer scientist, I can appreciate how that advice was a bit off the mark, especially as it related to C.

Anyway, I remember eagerly awaiting my first algebra class and being one of the first ones to raise my hand when the teacher asked if we had questions. I asked her how variables could help me write programs and if she could explain pointers to me. All I got in response was a completely blank look. Sadly, I didn't figure these things out myself for another couple of years...
Aw, she was just trying to find a nice way to tell you: "Son, if you have to have pointers explained to you, you stay away from pointers."

(Yes, I know, back in those days you couldn't go very far in programming without playing with naked pointers.)
 
Upvote
4 (4 / 0)

malor

Ars Legatus Legionis
16,093
Going full circle, a few years later, I had a C-64, but didn't have the money for the macro assembler cartridge. So I wrote an assembler in it's BASIC, along with a simple EDLN style text editor. Supported the complete 6502 instruction set and simple address labels. Best $35 I didn't spend.
I have to admit I'm quite curious about what you wrote. Was it an in-memory assembler only, ie while it was running? Or did you edit text files and then assemble those? Did you have named variables and jump targets?

I've sometimes thought about what it would take to write a 6502 assembler in BASIC, and I'm curious about your approach.
 
Upvote
0 (0 / 0)

bebu

Ars Scholae Palatinae
958
my first language was Ratfor (bastardized version of Fortran and C).
Not nice. ;) RATFOR - Rational Fortran was a macro preprocessor that added an element of structured programming to the existing Fortran (IV?) like while loops. ;)

The preprocessor was described with an implemention (in ratfor of course) in Kernighan and Plauger's Software Tools* (1976) which given the date possibly predates C.

My 7th Edition Unix manuals mention ratfor being on one of the tapes. :)

In the early noughties a worried researcher asked me locate a ratfor compiler for some source code he had been given but didn't realize it was essentially fortran. I had to laugh and explain that apart from the g77 compiler supporting it directly it was fairly simple to build the preprocessor.

* the Pascal version was 5 years later.
 
Upvote
1 (1 / 0)

bebu

Ars Scholae Palatinae
958
Correction: Line numbers were a leftover from a time when we didn't have text editors. Most of the BASICs people around here have been nostalgic for have been microcomputer BASICs that had screens -- but there was often no way to edit a text file. The line numbers told the interpreter the order in which to run the lines -- but it was also how you could replace a line of code when it didn't work.
You quickly learned to assign your line numbers in increments of 10 or 100. (To insert lines.)
I learnt Fortran and Algol-60 before seeing Basic on a teletype. The idea of an interpreter was new to me and the rapid type and run was really attractive compared to the glacial compiler, linker and loader processes on that pdp-10 platform.
Procedures (gosub) blighted basic for me although some later version implemented proper
parameterized procedures and local variables, or their function implementation could be pressed into service.
 
Upvote
4 (4 / 0)

fafalone

Ars Scholae Palatinae
817
Worth mentioning here, I'd like to give shout out to a project I'm a big fan of: twinBASIC.

With VBA still in common use and VB6 refusing to completely die, twinBASIC has finally appeared as a true successor. 100% backwards compatible (minus bugs and a couple missing features at its current late-beta phase state), it supports the Office 64bit VBA syntax and compiles 64bit binaries.

Certainly the problem with VB.NET and with many alternatives is that while syntax was quite similar, they were all still in effect entirely different BASIC dialects, and you couldn't use the massive existing VB6 codebase. tB is backwards compatible while adding a lengthy list of new language features like overloading, generics, basic inheritance, Unicode and modern image format support, multithreading, ability to define COM interfaces/coclasses instead of just consume them from typelibs, easily builds standard DLLs, and lots more, using a full featured modern editor (the Monaco editor, same one VSCode uses).

As mentioned before it's still in beta, but it already runs most VB6 stuff, including the most popular still actively used and maintained VB6 open source project, PhotoDemon.

What's the point now? Well there's actually still quite a bit of legacy VB6 apps in use, this opens up a path for modernization without total rewrites like any other option. It's also the only way to build 64bit ActiveX controls and addins for MS Office 64bit in the same language as VBA. And why I still cling to VB6 and this: They strike a balance between easy to use RAD and ready access to lower-level C-like ability that as far as I can tell, none of the very popular languages today do. There's things like FreeBASIC, but if you're not going to have that massive back catalog of source?

The FAQ is a good place to start if you wanted to find out more: https://github.com/twinbasic/documentation/wiki/twinBASIC-Frequently-Asked-Questions-(FAQs)

(I'm a volunteer mod for the Discord chat and GitHub but don't work for or have any financial stake in the project)
 
Upvote
6 (6 / 0)

AdrianS

Ars Tribunus Militum
3,741
Subscriptor
There are workshops out there still using machines controlled by a DOS PC running a compiled basic program I wrote in the late 80's / early 90's.

All the graphics was via a 32 bit assembly language library I also wrote - thank you Michael Abrash!

I then had to convince my boss that we could set a 386 + 387 as the minimum spec machine.

Trivia:
In the early mainframe BASIC interpreter I cut my teeth on in high scool, variable names took up part of your very limited RAM, so when you ran out, shortening the names gave you a bit more space.
So for a complex program, every variable ended up with a one or two character name...
 
Upvote
2 (2 / 0)
I leared NEC PC-8001 BASIC, my first programming language, only by the reading a thin booklet with comics without access to any computer. I was impressed with the Monte Calo simulation concept from the booklet. As soon as I got to lay a hand on an Apple II computer finally, I was already familar with Apple BASIC. Next was FORTRAN IV course on IBM/370 for engineering college freshmen. And K&R C on Unix verion 7 on PDP-11 and BSD 4.2 VAX-780. Most of programing concepts and skills I learned from the BASIC experience were very useful and pivotal throughout my college and professional life. Thanks and congratulation on diamond jubilee of BASIC.
 
Last edited:
Upvote
1 (1 / 0)
Honest question from a rank amateur who hasn’t written anything in Windows since VB6: is there any reason why anyone should be using VB.NET over C#?
It's been too long since I was working in VB.NET regularly to have a great answer for this, but basically the answer is "when you mostly have programmers who know VB.NET better". There are a handful of cases where I think Microsoft should have copied VB syntax in C# (for one, C#'s switch was basically cribbed from C/C++/Java and didn't get most of the functionality of VB's Select until switch expressions were added in 2019), and early on there were some other things that VB did better but mostly later C# fixed that.

But "go with what your developers know" is pretty much my answer to most language choice questions. If both languages can be reasonably used for a job (not always the case; sometimes you absolutely need features or tooling that don't exist in your normal language of choice or using your normal language of choice on the platform you're working on is otherwise not well supported), even if one's marginally less performant in the optimal case, using what your programmers know is going to be better. My C# (which I use every day) is going to be way better than my C++ (which I haven't touched since college) or even my VB.NET (which I haven't used regularly in fifteen years, even if it can use the same libraries as C# and is structurally quite similar).
 
Upvote
3 (3 / 0)
To everyone reading this article and thinking about resurrecting old computers from the shed/garage/attic/basement... old power supplies tend to have bad capacitors and little to no protection circuits. Be careful, it may mean some bright sparks and a very, very short "new life" after resurrection!

Older linear supplies pose less of a risk since there is the isolation provided by the transformer but a bad cap may still ruin your day. A bad cap in a switching power supply without any type of crowbar circuit may mean the logic board may receive voltages much higher than intended, with catastrophic results.

For one example, see the great CuriousMarc's series on his HP 9825 computer. I myself, in my lack of wisdom, severely damaged an Osborne 1 computer because of that several years ago.
 
Upvote
8 (8 / 0)

Hagen Stein

Ars Scholae Palatinae
680
Subscriptor
Meanwhile, other modern languages, such as [...] JavaScript, have taken on roles similar to those once filled by BASIC. These languages prioritize simplicity, readability [...]

Erhm ... nope!

Hunting down missing semicolons or curly brackets is the most frustrating part. "} expected" is such a useless compiler error message compared to the equivalent "End Sub / End If / End Select etc. expected"

That's why I still today prefer BASIC over any other language, because in my book, nothing beats BASIC when it comes to readability. Sadly enough it seems to be a dying language.
 
Upvote
1 (4 / -3)

Ed1024

Ars Scholae Palatinae
938
Subscriptor++
The buety about the days of basic, was that it just worked, no worrying about environmental variables, libraries, configuration files and settings. You could literally type sonething in from the magazines or tutorials of the day and they worked.
Also, the user interface was instant when you turned the computer on that used a BASIC-in-ROM model; you could have written a program in BASIC to solve a simple problem before Windows 2/3 had even booted on a 286.
 
Upvote
7 (7 / 0)

zuccini

Wise, Aged Ars Veteran
188
Ahh back in the days when using a computer more-or-less guaranteed that you would quickly become familiar with all of the powers of 2 up to 2^16 = 65536. Even today sometimes people are surprised if some power of 2 between 0 and 16 comes up and I just know what it is, no thought required. No higher than that, of course. 8-bit data bus and 16 bit address bus meant you could never go beyond 2^16-1 = 65535 ;-)
 
Upvote
7 (7 / 0)

zogus

Ars Tribunus Angusticlavius
7,184
Subscriptor
Also, the user interface was instant when you turned the computer on that used a BASIC-in-ROM model; you could have written a program in BASIC to solve a simple problem before Windows 2/3 had even booted on a 286.
Yeah, there was a continuous creep in bootup time in the 1980s that didn't stop until well into this century. Hardware speed finally started overtaking startup task requirements such that the boot time is going down, but we're still not where we were in the early 1980s. I remember my Mac Plus booted System 6.0 from floppies more quickly than a Quadra booted 7.0 from a hard disk.
 
Upvote
1 (1 / 0)

Dzov

Ars Legatus Legionis
16,028
Subscriptor++
Ahh back in the days when using a computer more-or-less guaranteed that you would quickly become familiar with all of the powers of 2 up to 2^16 = 65536. Even today sometimes people are surprised if some power of 2 between 0 and 16 comes up and I just know what it is, no thought required. No higher than that, of course. 8-bit data bus and 16 bit address bus meant you could never go beyond 2^16-1 = 65535 ;-)
Exactly! I would drill the powers of 2 into my brain. It still delights me when I come across numbers like 256 and I can tell people how that is 2 to the 8th power!
 
Upvote
4 (4 / 0)

brionl

Ars Tribunus Angusticlavius
9,173
You went to the Lawrence Hall of Science, at the top of Centennial Drive, overlooking Lawrence Berkeley Labs. Nothing Livermore about it.

@qazwart is probably conflating the Lawrence Hall of Science, in Berkeley, with the Lawrence Livermore National Labs, in Livermore. A lot of people do that, including me. I've been to the Hall of Science, my father did some work at LLNL, and I applied for jobs at LLNL a couple of times.
 
Upvote
2 (2 / 0)

MattGertz

Ars Praetorian
476
Subscriptor
It's been too long since I was working in VB.NET regularly to have a great answer for this, but basically the answer is "when you mostly have programmers who know VB.NET better". There are a handful of cases where I think Microsoft should have copied VB syntax in C# (for one, C#'s switch was basically cribbed from C/C++/Java and didn't get most of the functionality of VB's Select until switch expressions were added in 2019), and early on there were some other things that VB did better but mostly later C# fixed that.

But "go with what your developers know" is pretty much my answer to most language choice questions. If both languages can be reasonably used for a job (not always the case; sometimes you absolutely need features or tooling that don't exist in your normal language of choice or using your normal language of choice on the platform you're working on is otherwise not well supported), even if one's marginally less performant in the optimal case, using what your programmers know is going to be better. My C# (which I use every day) is going to be way better than my C++ (which I haven't touched since college) or even my VB.NET (which I haven't used regularly in fifteen years, even if it can use the same libraries as C# and is structurally quite similar).
Just to provide some clarity here: VB.NET had the jump on C#, given all of the VB history, even though technically they were being developed at the same time. The language teams weren't exactly separate (the C# folks were just a hallway over from us). but C# had the advantage in that Anders Hejlsberg could be very intentional with the language, without having to adhere to any previous practices. With VB.NET, we wanted to migrate a lot of VB developers, which therefore dictated the a lot of the direction we had to go. A lot (though not all) of the deviations between VB and VB.NET were dictated by the need to align with .NET, which was being developed at the same time -- otherwise, we tried to stick close to VB (though we didn't/couldn't reuse any VB code, as I've noted elsewhere in this comment section). This led to a lot of "interesting" compromises around the definition of short integers, whether or not arrays were base-0 or base-1 (we ended up just making arrays one size larger so that either would work & old ones would migrate correctly), and so on. The biggest change, though, was the exception-throwing model -- that irritated people to no end, although the resulting model was arguably a lot better, and certainly more in line with .NET.

This all took nearly 4 years, by which time the entire VB.NET team had turned over. (Seriously -- no one who started on the VB.NET compiler & editor teams was there at the finish line -- it was an age of high turnover.) To get even that much done, we had to delay implementing beloved VB features like Edit & Continue. (When I took over the editor team, I was told in no uncertain terms by upper management that I had two jobs -- fix the performance issues in the editor & debugger, and get Edit & Continue working for VB.NET.)

It was only when C# and VB.NET shared a codebase (Roslyn) that we could seriously think about any sort of language syntax convergence issues. By that time, C# generally took the lead (as it had far more customers and was also growing faster) -- since VB.NET was more focused on existing code, we mostly had to make sure that new functionality was possible and that the syntax for it felt VB-like. We had two sets of language design meetings -- C# meetings would focus on which new features to drive, and the VB.NET meetings would focus on how to make that work in VB.NET (although there were exceptions to this rule -- sometimes new features only made sense for the VB.NET customer base).
 
Upvote
8 (8 / 0)

Chuckstar

Ars Legatus Legionis
37,254
Subscriptor
Hmmm, can't remember if the TRS-80 had GOSUB. That was my first exposure to BASIC, so I may not have learned about it yet at the point. But definitely on the Commodore 64 and 128, and I learned to make use of it.

Sadly, not as well as I might've done has I understood the concept of studied languages at even a fraction of the level I do now.

But, if I were to write BASIC code today on those old systems, it would definitely look different!
TRS-80 definitely had GOSUB. At least on the version of their BASIC that I used. Didn’t realize how much more I should/could have been using it until I learned Pascal, though.
 
Upvote
3 (3 / 0)

el_oscuro

Ars Praefectus
3,129
Subscriptor++
I have to admit I'm quite curious about what you wrote. Was it an in-memory assembler only, ie while it was running? Or did you edit text files and then assemble those? Did you have named variables and jump targets?

I've sometimes thought about what it would take to write a 6502 assembler in BASIC, and I'm curious about your approach.
My assembler read text files. Since the C-64 didn't have a text editor, I wrote an EDLIN style one - also in BASIC. And it supported basic address labels for jump targets and variables. Using it, I was able to build a partial implementation of the first Q*Bert game level.

It also helped that the 6502 instruction set was pretty simple.
 
Upvote
2 (2 / 0)

malor

Ars Legatus Legionis
16,093
My assembler read text files. Since the C-64 didn't have a text editor, I wrote an EDLIN style one - also in BASIC. And it supported basic address labels for jump targets and variables. Using it, I was able to build a partial implementation of the first Q*Bert game level.

It also helped that the 6502 instruction set was pretty simple.
Neat! That must have been a ton of work. Do you remember the limits on file and output size?
 
Upvote
0 (0 / 0)

alansh42

Ars Praefectus
3,597
Subscriptor++
My assembler read text files. Since the C-64 didn't have a text editor, I wrote an EDLIN style one - also in BASIC. And it supported basic address labels for jump targets and variables. Using it, I was able to build a partial implementation of the first Q*Bert game level.

It also helped that the 6502 instruction set was pretty simple.
I did the exact same thing for the TI 99/4A. It required the Mini Memory cartridge, which had 4K of CPU RAM. As someone else noted, the 99/4A had only 256 bytes on the CPU bus. The built in 16K of RAM had to be accessed indirectly through the video chip.

It had an EDLIN-style text editor and saved the file to a RAM disk on the cartridge. Then the assembler would read it and poke it into memory.

The Mini Memory had a limited line by line assembler but couldn't save source code and had a very limited symbol table.

The "official" way to do assembly was the Editor/Assembler package, but that required the expansion box, 32K card, and a floppy drive, which was big bucks.

The most notable thing I did in assembly on it was a terminal emulator. TI had a terminal cartridge, but it was limited to 32 column text. The video chip supported a 40 column text mode which was fine on a B&W TV.

I didn't have the expansion box, I had a 3rd party sidecar serial port attached to an external modem.
 
Upvote
0 (0 / 0)

malor

Ars Legatus Legionis
16,093
The "official" way to do assembly was the Editor/Assembler package, but that required the expansion box, 32K card, and a floppy drive, which was big bucks.
TI eventually had a fire sale on those, and my parents jumped on it. It was a huge markdown, the box, 32K, and the floppy all together for like $300, when they were originally priced at like $1200 for all three. Man, what a difference that made.

But the computer still sucked. It had such nice chips that it should have been amazing, but the design work was ludicrously bad.
 
Upvote
2 (2 / 0)
It was only when C# and VB.NET shared a codebase (Roslyn) that we could seriously think about any sort of language syntax convergence issues. By that time, C# generally took the lead (as it had far more customers and was also growing faster) -- since VB.NET was more focused on existing code, we mostly had to make sure that new functionality was possible and that the syntax for it felt VB-like. We had two sets of language design meetings -- C# meetings would focus on which new features to drive, and the VB.NET meetings would focus on how to make that work in VB.NET (although there were exceptions to this rule -- sometimes new features only made sense for the VB.NET customer base).
I guess my I always felt (despite starting the .NET era as a VB partisan) that you really didn't stick the landing on this one. Some things felt like they changed when they didn't need to, some stuff I felt was broken was retained purely for backward compatibility we weren't actually getting, and there was a period where it seemed like a lot of stuff was added to VB with un-VB-like syntax that was just copying C# (nullable types were a big offender there) while with other really useful things they didn't really come up with a good syntax for at least while I was working in VB a lot (lambdas and generics come to mind here).
 
Upvote
1 (1 / 0)

malor

Ars Legatus Legionis
16,093
I guess my I always felt (despite starting the .NET era as a VB partisan) that you really didn't stick the landing on this one. Some things felt like they changed when they didn't need to, some stuff I felt was broken was retained purely for backward compatibility we weren't actually getting, and there was a period where it seemed like a lot of stuff was added to VB with un-VB-like syntax that was just copying C# (nullable types were a big offender there) while with other really useful things they didn't really come up with a good syntax for at least while I was working in VB a lot (lambdas and generics come to mind here).
As an aside, the thought of lambda functions in BASIC is kind of amusing. It sounds like adding a turbocharger to a horse and buggy.
 
Upvote
1 (1 / 0)
Though not nearly as popular; VB.NET is as functional a development language as C# (indeed, both compile to the same intermediate code and there are only a handful of functional differences, such as VB's support of shadowed classes), and easier for a new person (who lacks experience in a C-style language) to read. I do know of some places that use it for professional development.
VB has that disgustingly idiotic "integer division" operator, though. Just divide and store the result in an int. If the language is both untyped and can't cast to a hinted type, then the language sucks.
 
Last edited:
Upvote
-6 (0 / -6)

EhCanadian7

Smack-Fu Master, in training
3
BASIC got Gen X kids into programming. When I was 6, I got a TI 99/4A and a book with a cartoon alligator teaching BASIC. High school back then taught C. University taught C++, and most of the class had been programming since they were little kids like me.

Now programming is less accessible to kids. And anything made for kids 6 or 7 is dragging blocks on a tablet, which limits what they can learn and create. It feels like we've gone backwards, and younger generations are LESS computer literate, and the disappearance of BASIC built into computers is a big part of that.
 
Upvote
5 (5 / 0)

MattGertz

Ars Praetorian
476
Subscriptor
I guess my I always felt (despite starting the .NET era as a VB partisan) that you really didn't stick the landing on this one. Some things felt like they changed when they didn't need to, some stuff I felt was broken was retained purely for backward compatibility we weren't actually getting, and there was a period where it seemed like a lot of stuff was added to VB with un-VB-like syntax that was just copying C# (nullable types were a big offender there) while with other really useful things they didn't really come up with a good syntax for at least while I was working in VB a lot (lambdas and generics come to mind here).
I can't say you're wrong. There was certainly some of this. The VB language meetings were loud and vocal, but at that time we didn't have a lot of telemetry available to us (beyond qualitative opinions from MVPs who tried hard to represent the community) to guide us through the debates on what, whether, and how, and often we had to go with the best educated guesses. Even customers, when polled, were very divided on some of the approaches. (The most divisive one I can remember was the discussion on how to handle "private protected" variables -- that one went on for many months, to the point where I think we all wanted to chew our legs off to escape the conference room.)

I like to think that the outcomes were generally positive but (as I alluded to in my first comment on this article) there were some issues that we would have done differently, given what we know now. 'Twas always thus...
 
Upvote
3 (3 / 0)

malor

Ars Legatus Legionis
16,093
VB has that disgustingly idiotic "integer division" operator, though.
Python has that operator ( / is floating point, // is integer division), and it's sometimes very useful. And the % remainder operator is super useful for working with modulo math.

I have no idea how the VB team implemented theirs, they could certainly have screwed it up somehow, but both integer division and remainders are, IMO, great features. They're not hard to do manually, but the builtins are really handy.

Turbo Pascal filed off the rough edges. Delphi decided to bring them back by hewing closer to Object Pascal instead.

Delphi was a beautiful programming environment. Such a shame that the hobbyist money just wasn't there anymore.
 
Upvote
2 (3 / -1)