Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 15 submissions in the queue.
posted by janrinok on Sunday June 16 2019, @10:40PM   Printer-friendly
from the digital-archeology-now-before-its-too-late dept.

Programmer David Given has done the leg work to contact and ask R. T. Russel about releasing the Z80-based BBC BASIC as Free Software. It is now available under the non-reciprocal zlib license:

As part of the work I've been doing with cpmish I've been trying to track down the copyright holders of some of the more classic pieces of CP/M software and asking them to license it in a way that allows redistribution. One of the people I contacted was R.T. Russell, the author of the classic Z80 BBC BASIC, and he very kindly sent me the source and agreed to allow it to be distributed under the terms of the zlib license. So it's now open source!

[...] So the reason why this is important is that BASIC has, rightly, a reputation for being a pretty terrible language; but BBC BASIC was a dialect specifically commissioned by the BBC in 1981 as an educational aid. As a result, BBC BASIC supports named procedures, local variables, recursion, and other structured programming features. Unlike Microsoft BASIC, you can write proper structured, maintainable programs in BBC BASIC without needing to refer to any line numbers anywhere. And it'll run faster that way: [...]

[...] The original version was written by Sophie Wilson at Acorn in 1981 for their 6502-based range of BBC Micro computers and during the early eighties every school child in the United Kingdom was exposed to it, spawning a whole generation of bedroom programmers.

Earlier on SN:

[Ed's Comment: 170619-0724UTC. Added additional link to the original story]


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 2) by Snotnose on Sunday June 16 2019, @11:01PM (5 children)

    by Snotnose (1623) on Sunday June 16 2019, @11:01PM (#856380)

    Had a TRS-80 bought in '79 or so. Learning assembly, started disassembling the BASIC interpreter. Z-80 assembly had some 3 byte instructions, byte 1 would be jump or jumpSubroutine, the next 2 bytes were the address. In the TRS-80 BASIC it would jump into the middle of that 3 byte instruction. In other words, they crafted it such that an address or offset could also be an op-code for a subroutine.

    Don't know if it was Gates or Allen who did that, but kudos to whomever.

    --
    When the dust settled America realized it was saved by a porn star.
    • (Score: 0) by Anonymous Coward on Sunday June 16 2019, @11:30PM

      by Anonymous Coward on Sunday June 16 2019, @11:30PM (#856392)

      THINK about the implications of a hack like that.
      You better make damn sure the code doesn't change size so that your magic absolute jump address changes.

    • (Score: 0) by Anonymous Coward on Sunday June 16 2019, @11:42PM

      by Anonymous Coward on Sunday June 16 2019, @11:42PM (#856399)

      The BASIC interpreters of the era stored code in abbreviated form, basically calllng subs in interpreter/mointor. What you are describing is a scenario for compiled c-code doing something super evil and clever.

      Go take your metamucil and be quiet now.

    • (Score: 3, Interesting) by Anonymous Coward on Monday June 17 2019, @12:19AM

      by Anonymous Coward on Monday June 17 2019, @12:19AM (#856411)

      "In other words, they crafted it such that an address or offset could also be an op-code for a subroutine."

      Sounds a bit like http://www.catb.org/jargon/html/story-of-mel.html [catb.org]

    • (Score: 2) by mth on Monday June 17 2019, @12:52PM (1 child)

      by mth (2848) on Monday June 17 2019, @12:52PM (#856604) Homepage

      In general that kind of trick was only used with conditional jumps, where the condition is always false.

      Let's say you want to program the C-like expression "A = Z ? 3 : 4" in Z80 assembly, the obvious version would look like this:

          JR Z,SKIP
          LD A,3
          JR CONTINUE
      SKIP:
          LD A,4
      CONTINUE:
          ; next statement

      This is 8 bytes long (4 instructions that all happen to be 2 bytes each).

      The trick you described would make it look like this:

          JR Z,SKIP
          LD A,3
          JP Z,{truncated}
      SKIP:
          LD A,4
          ; next statement

      Where {truncated} means that the "LD A,4" is actually inside the 2-byte address of the "JP Z". In actual assembly you'd use "DB $CA", a literal containing the opcode for "JP Z,nnnn".

      This sequence is 7 bytes long ("JP Z" is 3 bytes, but effectively 1 because it overlaps the 2-byte LD), so it saves one byte. But when you have to fit your program in for example a 16K ROM, every byte can matter.

      • (Score: 2) by mth on Monday June 17 2019, @12:55PM

        by mth (2848) on Monday June 17 2019, @12:55PM (#856606) Homepage

        Eh, make that "A = Z ? 4 : 3". I broke the example when I tried to make it more clear.

  • (Score: 0) by Anonymous Coward on Sunday June 16 2019, @11:16PM (1 child)

    by Anonymous Coward on Sunday June 16 2019, @11:16PM (#856385)

    I encountered "computer" for the first time at the turn of 80s when I was a preteen/teenager, and I doubt I'd have grokked basic if it had recursion, scoping rules, etc.

    On the other hand, such features wouldn't have prevented kiddy me from writing ugly programs, i.e., I still could write ugly BASIC programs even if I don't understand those "advanced" features, so ....

    • (Score: 4, Insightful) by maxwell demon on Monday June 17 2019, @06:23AM

      by maxwell demon (1608) on Monday June 17 2019, @06:23AM (#856510) Journal

      Recursion was absolutely possible in BASIC. You did not have any local variables or function arguments, but nothing did prevent you from writing something like

      10 LET n=1
      20 GOSUB 100
      30 PRINT "Finished!"
      40 END

      100 PRINT n
      110 LET n=n+1
      120 IF n<5 THEN GOSUB 100
      130 LET n=n-1
      140 RETURN

      --
      The Tao of math: The numbers you can count are not the real numbers.
  • (Score: 0) by Anonymous Coward on Monday June 17 2019, @12:41AM (6 children)

    by Anonymous Coward on Monday June 17 2019, @12:41AM (#856420)

    "Along with Microsoft's very similar BASIC for the Apple Macintosh, AmigaBASIC was the first BASIC interpreter to not require line numbers..." https://en.wikipedia.org/wiki/AmigaBASIC [wikipedia.org]

    • (Score: 2) by stretch611 on Monday June 17 2019, @01:15AM (1 child)

      by stretch611 (6199) on Monday June 17 2019, @01:15AM (#856429)

      Without line numbers, how could I create the spaghetti logic I want through excessive GO TO ### commands?

      --
      Now with 5 covid vaccine shots/boosters altering my DNA :P
      • (Score: 1) by pTamok on Monday June 17 2019, @09:25AM

        by pTamok (3042) on Monday June 17 2019, @09:25AM (#856552)

        Basically, the target of a GOTO was a label

        GOTO target

        blah-blah

        target: PRINT "GOTO target reached"

        or something similar.

        Essentially, line numbers give a target at the beginning of each line, whether one is needed or not. Once you recognize that targets are only needed at the locations you wish to jump to, you can get rid of line numbers, and implement targets as unique labels, which is what BBC BASIC did.

        Of course, line numbers are useful for serialization of the program instructions, but the program source code in a text file tends not to get jumbled up, unlike 80-column punch cards.

    • (Score: 3, Informative) by theluggage on Monday June 17 2019, @01:35PM (3 children)

      by theluggage (1797) on Monday June 17 2019, @01:35PM (#856625)

      "Along with Microsoft's very similar BASIC for the Apple Macintosh, AmigaBASIC was the first BASIC interpreter to not require line numbers..."

      The Amiga was released in 1985 [wikipedia.org]

      The Mac is famously why 1984 wasn't going to be like 1984 [wikipedia.org]

      BBC BASIC was on the first BBC Micro released in 1981 [wikipedia.org]

      To be fair, though, the original BBC BASIC (and the Z80 version that TFA is about) didn't make line numbers completely optional (if nothing else, you needed them for program editing as there was no full-screen editor - bear in mind this was 1981 on a £400 home computer running off ROM and cassette tape), but the named procedures, functions and REPEAT/UNTIL structure removed most of the reliance on GOTO/GOSUB that made standard BASIC such a write-only language. Later versions added missing pieces like multi-line IF/THEN/ELSE/ENDIF, CASE and a screen editor - R.T. Russel has more "up-to-date" versions [bbcbasic.co.uk] available for modern systems - the Z80 version is strictly for retro hardware/emulation fans.

      • (Score: 0) by Anonymous Coward on Wednesday June 19 2019, @09:12PM (1 child)

        by Anonymous Coward on Wednesday June 19 2019, @09:12PM (#857606)
        http://www.bitsavers.org/pdf/dartmouth/BASIC_Oct64.pdf [bitsavers.org]

        That's a BASIC manual (not specification) from 1964, for the original BASIC implementation. Page 4-5 say (of the first example program) "all lines in the program start with a line number...we use only capital letters...spaces may be used, or not used, at will..."

        • (Score: 2) by theluggage on Thursday June 20 2019, @08:06PM

          by theluggage (1797) on Thursday June 20 2019, @08:06PM (#858184)

          That's a BASIC manual (not specification) from 1964,

          Not sure what your point is - we're talking about 1981 BBC BASIC, not 1960s Dartmouth BASIC or 1970s Microsoft BASIC. BBC BASIC was one of the first BASIC for micros/home computers to add named, multi-line procedures and functions with parameters and local variables, making it much easier to write comprehensible programs.

      • (Score: 0) by Anonymous Coward on Friday June 21 2019, @03:45AM

        by Anonymous Coward on Friday June 21 2019, @03:45AM (#858417)

        The summary says “Unlike Microsoft BASIC, you can write proper structured, maintainable programs in BBC BASIC without needing to refer to any line numbers anywhere.” It’s written in the present tense: “you can” rather than “you could.” MS BASIC for Macintosh (1984), QuickBASIC (1985) AmigaBASIC, and Visual Basic (1991), all of which came from Microsoft, don’t require line numbers. As for which was the first BASIC that didn’t require them, the claim in Wikipedia is supported by quotes from two articles from Compute! Magazine from 1986. The articles may be in error, but you haven’t shown that they are.

        From the AmigaBASIC manual (https://archive.org/details/AmigaBasic):

        Program lines do not require line numbers. Assigning labels to functional blocks lets you quickly see the control points in your program...Alphanumeric line labels beginning with an alphabetical character allow the use of mnemonic labels to make your programs easier to read and maintain.

        It is advisable to use control structures (IF... THEN... ELSE, WHILE ...WEND, and ON... GOTO) in lieu of GOTO statements as a way of
        branching, because a program with many GOTO statements can be difficult to read and debug.

  • (Score: 0) by Anonymous Coward on Monday June 17 2019, @01:52AM

    by Anonymous Coward on Monday June 17 2019, @01:52AM (#856439)

    20 goto 10

  • (Score: 0, Troll) by realDonaldTrump on Monday June 17 2019, @02:54AM

    by realDonaldTrump (6614) on Monday June 17 2019, @02:54AM (#856460) Homepage Journal

    And, another Anti U.S.A. Hate Fest. Trying to make U.S.A. look bad. And make our foe the E.U.( U.K.) look good. By saying things about Microsoft that, possibly, aren't even true. Whatever happened to, Submissions Guideline? It says, "be neutral and factual." Canopic Jug is never neutral. And many times, not factual. Look at the "story" they put up the other day. TOTALLY MADE UP, they call it "satirical." And they call it, pseudonymous. Fancy way of saying, it's lies and the person that wrote them won't put his real name.

    And this one, where is the article? They make it look like there was an article, like they left things out of an article. And put in the dots, right? They always say, "oh Donald, you didn't put a Link, you're so horrible." And they put so many Links in this one. And, I opened so many Links. All the Links. But, I don't see the article. There's NO LINK to the article. And possibly there is no article. So Fake!!!!

  • (Score: 2) by canopic jug on Monday June 17 2019, @03:08AM (3 children)

    by canopic jug (3949) Subscriber Badge on Monday June 17 2019, @03:08AM (#856468) Journal

    Strange. The actual link did not make it into the submission. Here is what should have been there in the top after the Z80 reference:

    --
    Money is not free speech. Elections should not be auctions.
    • (Score: 2) by mhajicek on Monday June 17 2019, @05:51AM

      by mhajicek (51) on Monday June 17 2019, @05:51AM (#856508)

      If you think BASIC is limited, try Fanuc Macro B.

      --
      The spacelike surfaces of time foliations can have a cusp at the surface of discontinuity. - P. Hajicek
    • (Score: 2) by janrinok on Monday June 17 2019, @07:25AM (1 child)

      by janrinok (52) Subscriber Badge on Monday June 17 2019, @07:25AM (#856521) Journal

      Corrected - thank you. The problem appeared to be nested URL links.

      --
      I am not interested in who people are or where they live. My interest starts and stops at our servers.
  • (Score: 1, Interesting) by Anonymous Coward on Monday June 17 2019, @03:43AM (2 children)

    by Anonymous Coward on Monday June 17 2019, @03:43AM (#856488)

    Years ago, I stumbled across a book in the local library that was written by the original creators of BASIC. “Back to BASIC: The History, Corruption, and Future of the Language.” As a child who grew up with 8-bits and their embedded BASICs, it was a real eye-opener.

    Executive Summary: That crap-mess you grew up with was a severely limited, crippled, stupidization of actual BASIC. You poor innocents were the victims of others shoe-horning something that sorta looked like BASIC into a tiny ROM. And just about every gripe you had with BASIC was due to those shoe-horned limitations, not BASIC as it was supposed to be.

    All that aside, awesome that this source code could see light of day. Crippled as they were, the shoe-horning was no easy feat.

    • (Score: 3, Interesting) by kazzie on Monday June 17 2019, @04:01AM

      by kazzie (5309) Subscriber Badge on Monday June 17 2019, @04:01AM (#856494)

      .You poor innocents were the victims of others shoe-horning something that sorta looked like BASIC into a tiny ROM.

      Typical versions of Microsoft BASIC were distributes on an 8K ROM, Microsoft Extended BASIC was 12K.

      BBC BASIC (the original 6502 version), came on a 16K ROM. No wonder it was a more complete programming language.

    • (Score: 0) by Anonymous Coward on Friday June 21 2019, @03:14AM

      by Anonymous Coward on Friday June 21 2019, @03:14AM (#858412)

      Reposting under the right comment.

      http://www.bitsavers.org/pdf/dartmouth/BASIC_Oct64.pdf [bitsavers.org] [bitsavers.org]

      That's a BASIC manual (not specification) from 1964, for the original BASIC implementation. Page 4-5 say (of the first example program) "all lines in the program start with a line number...we use only capital letters...spaces may be used, or not used, at will..."

  • (Score: 3, Insightful) by istartedi on Monday June 17 2019, @04:37AM (3 children)

    by istartedi (123) on Monday June 17 2019, @04:37AM (#856499) Journal

    The obvious bad was the kind of trouble you got into when you wanted to insert more lines in than you had numbers, requiring an ugly refactor or poor use of GOSUB if you had it.

    Perhaps the one good was that when you jumped down to assembly to get real speed, you were already familiar with the concept of addresses, so JMPing around in ASM programs was a familiar concept.

    We were working with less main memory than a typical JPEG or an annoying JavaScript, in order to run an entire operating system with a built-in programming language.

    Crippled languages were forgivable given those constraints, and as others have said here, the BBC version of BASIC took up more precious ROM space.

    --
    Appended to the end of comments you post. Max: 120 chars.
    • (Score: 3, Informative) by kazzie on Monday June 17 2019, @07:52AM (2 children)

      by kazzie (5309) Subscriber Badge on Monday June 17 2019, @07:52AM (#856527)

      The way the BBC Micro dealt with the lack of precious memory space was to have the BASIC ROM swap out with other ROMs, in a system called Sideways ROM. The original models chopped the 64K of address space into 16K for the OS, up to sixteen 16K Sideways ROM slots, and up to 32K of RAM. (Later models and expansions put extra RAM in some of the Sideways slots, and moved the display RAM into shadow memory instead.)

      The Z80 second processor add-on (which Z80 BBC BASIC was writen for) had its own 64K of RAM, with display and I/O tasks still handled by the BBC Micro.

      This flexibility came with a higher price tag, of course, which hampered the BBC Micro in the home marked.

      • (Score: 3, Informative) by choose another one on Monday June 17 2019, @03:35PM

        by choose another one (515) Subscriber Badge on Monday June 17 2019, @03:35PM (#856670)

        The fun thing about the paged / sideways ROMs was that there were spare ROM slots (3?) on the mother board and you could buy software on ROM. Before floppy disks became common a lot of more "serious" BBC micro software actually came that way. You _could_ copy it, but it was more expensive to buy 16K EEPROMs to copy it onto than it was to just buy new ROMs.

        Having your software in ROM was seriously cool because it left you tons and tons of data memory to play with (nearly 32K!), so much memory you could do _anything_.... Tricky bit was that you couldn't write BASIC software to run from ROM, because the BASIC ROM would be swapped out, so you had to do it all in assembler or cross-compile from serious (then) hardware.

      • (Score: 2) by theluggage on Thursday June 20 2019, @08:33PM

        by theluggage (1797) on Thursday June 20 2019, @08:33PM (#858205)

        The Z80 second processor add-on (which Z80 BBC BASIC was writen for) had its own 64K of RAM, with display and I/O tasks still handled by the BBC Micro.
        This flexibility came with a higher price tag, of course, which hampered the BBC Micro in the home marked.

        For some bizarre reason, Acorn decided that, because CP/M was for business, the Z80 processor needed to come with a complete business software suite 'worth' about £1000, including a wp/spreadsheet/database that you'd never heard of, an application generator (remember 'The Last One'? It wasn't that...) and the CIS COBOL compiler (which on its own retailed for over £400). I'm sure they licensed it at a fraction of retail price, but I doubt it was free (software was really expensive in those days). Of course, what people really wanted CP/M for was to run those copies of Wordstar and DBase 2 which they'd... acquired...

        There was a somewhat cheaper 6502 second processor too, with a clean 64K memory map and a souped-up 6502 running at something sick like 4MHz - now that was the fastest thing on 8 bits at the time (Best. Implementation. Ever. of Elite :-) )

  • (Score: 3, Insightful) by ledow on Monday June 17 2019, @12:33PM (4 children)

    by ledow (5567) on Monday June 17 2019, @12:33PM (#856597) Homepage

    I would argue that those who think unannotated, indechiperable Z80 assembly language is the language in which to distribute software, are significantly more worthy of ridicule than people who wrote things in BASIC.

    Never got the BASIC-hate. There's nothing wrong with it (line numbers? Fortran has line numbers in many implementations too... why does having optional line numbers make it "bad"?), it's just not very suited to complex tasks, multi-programmer interaction and huge performance, but it's not supposed to be (there's a kind of clue in the name).

    BBC BASIC, and many that emulated it, was a perfect bridge language from literally-never-written-code-people to people directly manipulating CPUs, memory and hardware.

    Any later abstraction and condemnation that because some implementation of it doesn't have explicitly named subroutines (except BBC BASIC) somehow makes it "bad" really needs to be weighed against that *self-same assembly code*, that does name some things (but calls them things like "PUSH" and "PUSH$" but doesn't tell you what the hell they are actually doing). There's a whole file for something that just says "Sorry", for instance.

    This was an era of at-home programmers, programming for themselves, to use the computer, to automate BASIC calculations and tasks, and allow them to control their computer. There is literally *nothing wrong with that*.

    You can complain that it may have encouraged some sloppy programming habits, but that's only when looked down upon from a perspective 30-40 years later... even C, Java, et al suffer that exact problem too.

    Fact is, without BASIC, I would never have bothered to learn to code. It's that simple. Because nothing else *was* that simple. I can now probably knock up any program you like, in any language you like, given enough time. I don't claim it'll be amazing and ground-breaking but it'll work. And there are places that are running my code years later which - let's be honest - nobody else understands *because they don't code*, not because I didn't leave behind the full source + documentation of what it did. Hell, I spend more time patching major commercial companies sloppy code than I do my own. I regularly get asked "How did you do that?" and then "Oh, our developer was just asking because they haven't done that yet and wondered how you fixed it". Some companies have actually asked to pay me for my code, and some others have actually included it in their offering to other customers.

    BASIC did exactly what it said on the tin - gave a beginner an all-purpose (bit-banging to high-level loop, I/O to memory manipulation) instruction code made of symbols they could understand (e.g. PRINT, INPUT, IF... THEN.. etc.). No, it's not suitable to run a huge commercial enterprise on, nobody ever said it was. No it's not supposed to be ideal. Neither was damn Excel and I've seen more than enough businesses built on it (without even using VBA!).

    This is history that needs to be preserved, not ridiculed. Equally... that code to *make* BASIC is absolute damn useless and unreadable. But to ridicule BASIC because it *could* be misused is only justification to say: Why did not one single home computer come bundled with a C compiler built into the ROM, then?

    • (Score: 3, Interesting) by opinionated_science on Monday June 17 2019, @12:43PM

      by opinionated_science (4031) on Monday June 17 2019, @12:43PM (#856601)

      In this age of machine learning getting cheaper every day, we are more likely to see a ML based explanation of assembler code.

      Kinda recursive ; the biological wet ware made the original machines and now are building machines to understand what was previously written by the wet ware!!

    • (Score: 3, Insightful) by theluggage on Monday June 17 2019, @02:51PM

      by theluggage (1797) on Monday June 17 2019, @02:51PM (#856655)

      Never got the BASIC-hate.

      Well, if - like many - you started with BBC BASIC then you missed out on the true horrors of regular BASIC:

      Before BBC BASIC:

      M$ = "Hello World": MX%=100: MY%=200: GOSUB 2160

      With BBC BASIC:

      PROCshowmessage("Hello World",100,200)

      ...it was hardly the same language. Not that I'm knocking the earlier BASICs - if you had a home computer with 4k RAM and a domestic cassette tape recorder, a Pascal or C compiler was hardly an option - even running an assembler was a bit of a juggle.

      Thing is, the language wars - which are still going today - aren't based on practicality and don't factor in the 'bad programmers can write bad programs in any language' element. Back in the day "Structured Programming" was the thing, and if a young person ever saw a GOTO statement they would be irrevocably damaged for life. These days, the language warriors are mostly on the "functional programming" bandwagon - better to scare off budding programmers with baffling Haskell than let them be corrupted by filthy procedural languages. This doesn't stop languages like C, PHP and Javascript getting mass adoption because they are practical solutions to practical problems. (PHP, in particular, is an abomination of a language, but its supported by your web hosting service and has a huge library of useful functions).

      Why did not one single home computer come bundled with a C compiler built into the ROM, then?

      ...not through the relative merits of C versus BASIC as a language, but because, running a compiled language - especially one with such reliance on libraries and header files as C - on a system with limited RAM and no floppy drives was hugely impractical, even if you could fit the compiler and run-time library into the usual 8 or 16k ROM. (C without stdio.h and clib is like... [metaphor excluded for space reasons]). That said, you could buy Pascal, COMAL, Logo, Lisp, BCPL, PROLOG and FORTH in ROM for the BBC Micro. Pascal was two ROMS (16-socket ROM expansion boards were a popular accessory for the BBC!) and was usable without disc, but that was about as much use as a chocolate teapot - you only got the minimal 'ISO level 0' version of the language* and your verbose Pascal source code had to share RAM with the compiled code - the full-blown compiler needed a floppy drive and the second processor add-on for the BBC.

      (*if anybody is about to wax lyrical about Pascal based on experience of extended implementations like VAX Pascal, Turbo Pascal or Delphi then you've never tried bog-standard Pascal).

    • (Score: 3, Interesting) by choose another one on Monday June 17 2019, @03:51PM (1 child)

      by choose another one (515) Subscriber Badge on Monday June 17 2019, @03:51PM (#856673)

      BBC BASIC, and many that emulated it, was a perfect bridge language from literally-never-written-code-people to people directly manipulating CPUs, memory and hardware.

      To that end it included inline assembler capability - a particularly awesome feature. It allowed you to work mostly in BASIC but drop down to ASM for writing tight loops, blits, IRQ handlers, or raw IO/control stuff. Wrote an entire CAD/CAM system for robot control in it once - all the UI was in BASIC and the stepper motor driver and control stuff in inline assembler.

      Without the BASIC intro / framework I would never have got into programming that sort of stuff, way too high an entry barrier, but without the assembler capability what I/we did wouldn't have been possible, it was indeed a perfect system for its time.

      Still got the code somewhere, on fan-fold paper. No idea what it does as in those days I subscribed to stuff like "Real Programmers don't need comments -- the code is obvious." (and yeah, I know, I was using BASIC...). And comments took up valuable memory, I think, maybe. Fun times.

(1)