[updated after class]
I taught a two hour lab on BASIC for our DIKULT104: Computing Technology: History, Theory and Practice students today. This was the first time I’ve taught BASIC, but I’m thrilled to get the chance. I have nostalgic memories of dad teaching me simple programming in BASIC when I was a kid, and even of typing programs into my C64 from computing magazines. Thank goodness for the internet, eh? The aim of this class isn’t to create programmers: we want to give students a taste of a range of languages, and for them to learn what kinds of conceptual frameworks programs can be built around and something about how to read code. We certainly aren’t trying to create a new generation of BASIC programmers, but we do hope to teach a generation that has some understanding of how programming works and that knows about the history of programming languages.

 

The best web-based BASIC emulator I’ve found so far is this one for Applesoft BASIC, although it’s not perfect. For a very gentle tutorial for this dialect of BASIC, the book A Touch of AppleSoft, from 1986, is perfect, and chapters 1-3 and 5 are required reading for DIKULT104. You can read it on Scribd.com (or course website for DIKULT104 students.)

I taught two groups following this lesson plan, and it went very well. Next year I’d like to have a better emulator installed on the computers in the lab, because the browser-based emulator wasn’t very good. If we use the 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 again we should try to get a C64 emulator, too, as it relies on a C64-specific character set – or find the / and \ signs in the AppleSoft character set.

To start us off, let’s take a quick look at this ad for a Commodore 64 from 1983 – notice how the inclusion of “Introduction to BASIC – a teach yourself program for the whole family” is emphasised.

Here’s what I’m planning on doing in our lab session:

  1. Introduce BASIC. The blurb in the New Media Reader (which is on our syllabus) is a good start. Seymour Papert’s objections (BASIC is to programming what QWERTY is to typing) are interesting. And the fact that BASIC came installed on practically every personal computer for a long time – though no longer, which may be Why Johnny Can’t Code. (That link, btw, leads to a passionate essay I’d recommend reading. Here’s a snippet: “BASIC was close enough to the algorithm that you could actually follow the reasoning of the machine as it made choices and followed logical pathways.”). Moving on to syntax and structures, have a quick look at a knitting pattern for comparison – then look at this comparison of different languages which has some fairly simple examples at the start.
  2. OK, everyone: fire up an emulator. Look, there’s a Hello World program. Let’s run it. Try making it say other things. Make a GOTO loop. Add a few more words. See what FLASH does (eek!) See if there are other interesting commands you could add.
  3. What’s the difference between PRINT 2 + 2 and PRINT “2 + 2”?
  4. REM lets you add comments to your code. Add some.
  5. We need variables:
    10 print "Tell me a number"
    20 input X
    30 print "You like the number " X "?"
    If you want a variable to contain text and not just numbers, you need to put a $ at the end of it. When you run your program it will blink a prompt at you in the top windsomething in a number. Then try a text variable (a string).

    40 print "What is your name?"
    50 input Name$
    60 print "Hello " Name$

Play around and see what you can do with this. After a bit of messing around, we’ll see what people have come up with.

  1. Let’s try an IF-THEN loop:
    10 home
    20 INPUT "What is your name?" ; Name$
    30 IF name$ = "ENOUGH" then goto 50
    40 GOTO 20
    50 end

    You can use other operators than =
    IF NAME$ <> "JILL" THEN PRINT "The teacher's name is Jill"
    or
    IF X > 100 THEN NumberSize$="big"
    Play around a bit more.
  2. OK, now we’re going to look at an example. Type this program in and see what happens:10 PRINT CHR$(205.5+RND(1)); : GOTO 10How does this work? Hints: have a look at the RND command and the ASCII character set. Another hint: the Applesoft emulator may not be displaying the ASCII characters quite right – it’s supposed to look more like this (scroll down for the screenshot).
  3. Now, what can you make, using what we’ve learnt?

Further reading (and thanks for the inspiration)

8 thoughts on “lesson plan: BASIC for DIKULT104

  1. Valentin

    ASCII is about 7 bits. So what is more than 127 is not ASCII. The MSB is used for extended tables. There are lots of ways, to extend the table. But there is not an “ASCII” way. The most standards would be the ISO/IEC 8859 tables http://en.wikipedia.org/wiki/ISO/IEC_8859

    In the case of the link you provided, the program is apparently using the table of C64 which is:
    http://en.wikipedia.org/wiki/PETSCII

    You should try a C64 emulator like Vice:
    http://www.viceteam.org/

    Then you can run the program properly.

    As a side note, BASIC is not a good language at all. People should stay away from it.

  2. Jill Walker Rettberg

    Thanks, Valentin – you’re right, the characters referred to are actually part of the C64 character set. I’ll look into the Vice emulator. And we talked about how there are lots of problems with BASIC – the intention of this lab was certainly not to create a new generation of BASIC programmers but to teach students of computing history about computer languages of the past.

  3. William Patrick Wend

    WOW, I remember A Touch of Applesoft!!!! I got that book with my Apple IIC in the mid-eighties as a child. I knew BASIC so well as a kid that I taught my principal in forth grade.

  4. Jill Walker Rettberg

    Wonderful! So can you come up with an excuse to teach it to your students?

  5. Mark Sample

    I was sorry to hear the C64 in-browser emulator didn’t work! I found another Java emulator that runs right in a browser, and I entered the

    10 PRINT CHR$(205.5+RND(1)); : GOTO 10

    program, and it worked! (Though it ran much faster than it should.) Still, your best bet is an offline C64 emulator. VICE is probably the most popular option (it’s cross-platform).

  6. KDS

    Hmm, why do you have an ad for q500.no at the bottom of the page where I’m typing this?
    (I don’t think one had that on the Commodore 64…)

  7. Jill Walker Rettberg

    Yes, I know. It’s deeply embarrassing. I tried putting an ad into the template a few years ago and forgot to remove it and now I can’t figure out where the code is. I really, really need to upgrade the blog (which means moving it away from UiB’s web hotel as they don’t support current versions of php) and start over with a clean template. Oh dear.

  8. David Albrecht

    I haven’t used BASIC in nearly 30 years. Like you, I have fond memories of writing programs for my VIC029 and my C-64.

Leave a Reply to Mark Sample Cancel reply

Recommended Posts

Triple book talk: Watch James Dobson, Jussi Parikka and me discuss our 2023 books

Thanks to everyone who came to the triple book talk of three recent books on machine vision by James Dobson, Jussi Parikka and me, and thanks for excellent questions. Several people have emailed to asked if we recorded it, and yes we did! Here you go! James and Jussi’s books […]

Image on a black background of a human hand holding a graphic showing the word AI with a blue circuit board pattern inside surrounded by blurred blue and yellow dots and a concentric circular blue design.
AI and algorithmic culture Machine Vision

Four visual registers for imaginaries of machine vision

I’m thrilled to announce another publication from our European Research Council (ERC)-funded research project on Machine Vision: Gabriele de Setaand Anya Shchetvina‘s paper analysing how Chinese AI companies visually present machine vision technologies. They find that the Chinese machine vision imaginary is global, blue and competitive.  De Seta, Gabriele, and Anya Shchetvina. “Imagining Machine […]

Do people flock to talks about ChatGPT because they are scared?

Whenever I give talks about ChatGPT and LLMs, whether to ninth graders, businesses or journalists, I meet people who are hungry for information, who really want to understand this new technology. I’ve interpreted this as interest and a need to understand – but yesterday, Eirik Solheim said that every time […]