7

I am wondering if anyone has a pointer to a good source of "classic" BASIC programs, in text format. One would think this would be easy to find, but unfortunately VB so pollutes the results as to render them useless, and no amount of -VBs fix that.

I was able to find 101 BASIC Games, which is specific enough, but MORE BASIC Games and What To Do After Hitting Return I can't find. I'm more interested in general code than just games.

The reason: I'm interested in running statistical measures against a large library of code to find the distribution of variable names, constants and so forth in an effort to improve a BASIC parser.

10
  • 2
    I have - or at least used to have 101 Basic Games. Ah, those were the days... Jul 3, 2019 at 14:54
  • I carried my copy, the yellow one, like my version of the bible. Jul 3, 2019 at 14:55
  • 2
    I think they're spread around archives of old BBSs, cd-roms. There is a bunch of CP/M MBASIC programs here - retroarchive.org/cpm/cdrom/CPM/BASIC - but one big archive eludes me
    – scruss
    Jul 3, 2019 at 15:11
  • 2
    These are in French but provide huge archives of type-in programs, already typed in for you, with quite a few Microsoft BASIC programs: Abandon-Listings and Hebogiciel. There’s also an English-language archive of type-in C64 programs, handily hosted on 8BitFiles so you can easily download everything. Jul 3, 2019 at 15:43
  • 1
    "find the distribution of variable names" My mother and a friend went on a BASIC programming course many years ago. The instructor talked about the importance of variable naming to which my Mum's friend said "John [my Dad] only has one variable and it's called Q$".
    – JeremyP
    Jul 4, 2019 at 18:17

4 Answers 4

5

Rosetta code has a category dedicated to programs written in Basic: http://rosettacode.org/wiki/Category:BASIC

2
  • This is VERY useful! Jul 4, 2019 at 18:18
  • Yes indeed. I think Rosetta code is a good site to know about for programmers of any language as you can get a better feel for algorithms if you can see them implemented in different ways Jul 4, 2019 at 18:22
2

There are a lot of vintage computer books (and magazines with type-in BASIC listings) for a variety of versions of BASIC on Archive.org which are available in a variety of formats including text. Search for BASIC books for any computers which had Microsoft BASIC in ROM. Here is the link to the text version of David Ahl's "More BASIC Computer Games" on Archive.org.

Here is a non-gaming one: 25 Graphics Programs in Microsoft BASIC.

Unfortunately they don't seem to have "What To Do After Hitting Return".

4
  • It looks like the “More Basic...” text is a non-proofread scan. Jul 4, 2019 at 17:54
  • Yes, it is not useful - it mixes text from multiple columns. I also tried a number of online and offline OCRs and they all had the same problems to one degree or another. It's somewhat surprising how poorly they work on printouts of fixed-width chars! Jul 4, 2019 at 18:18
  • I believe the "More BASIC..." text is an automatic conversion from one of the other formats.
    – Tim Locke
    Jul 5, 2019 at 13:56
  • I thought it would be useful if you simply strip each line of any preceding spaces and then check whether the line begins with a number.
    – Tim Locke
    Jul 5, 2019 at 13:56
2

Using "qbasic source archive" as a search turns up some potentially-useful links, including:

  • 48 files found in Library "Basic/QBasic Programming"

    Also includes files to do with PowerBasic. From a brief scan, the files seem to be more utility orientated (i.e. extending Quick/Power-basic) than pure source examples.

  • 134 files found in Library "Basic And Qbasic"

    Appears to be more focused on source code, including some GW-BASIC examples.

  • Pete's QBASIC/QuickBasic Site

    The "links" section of a site seemingly devoted to Quick Basic, listing other sites that have (or had... I've not followed any of those links) things to do with Quick Basic, including one that is/was "_ An absolutely MASSIVE QBasic archive run by a chap from Greece_".

Doing the same for "gwbasic source arcihve" produces some other promising results, including:

  • Gary Peek's BASIC Source Code Archive

    Which, according to its front-page blurb is:

    This section is dedicated to BASIC for the IBM PC and all the people who have written programs using it and its variations, like IBM BASIC and BASICA, GWBASIC, QBASIC, and the QuickBASIC compiler.

  • 68 files found in Library "Basic/Qbasic/Vbasic"

    Again, seems to be a more utility-focused collection, with more Visual Basic, but may be of interest.

  • if-archive/games/source/basic

    A collection of 35 Interactive Fiction (aka "Adventure") games written in various flavours of BASIC from TRS-80, C64 through BASICA, GW-BASIC and QBASIC.


Of more general interest to some on here, all the "xx files found in Library "xxx"" links above come from the "CD-ROM and FTP Site Archive" section of Retrocomputing Archive which seems to contain a whole host of potentially interesting stuff from times gone by.

1

(Not an Answer, but rather a way too long comment on the target)

The reason: I'm interested in running statistical measures against a large library of code to find the distribution of variable names, constants and so forth in an effort to improve a BASIC parser.

Using (very) old code to optimize a modern parser might be a less than good input - at least if the parser is meant to be used in actual (modern) programming.

Old BASICs had many quirks when it came to variable naming:

  • Most prominent the two letter restriction of most MS BASIC.
  • Others could just a single letter.

Both made programmers use rather cryptic names (*1), something that wouldn't happen with a BASIC capable of handling (more) meaningful names.

  • Then there were BASICs that requited the use of pseudo-arrays for certain variables - like A() holding all strings.

But beside source level reasons, there where many run time effects that influenced variable use back then, like

  • like reuse of variables for speed
    • reuse is faster than adding a new, as it reduces search time
  • placement of often used variables at program start for speed up
    • forcing their search time down

Other tricks include putting - multiple single values in an array - multiple arrays into a single array

Both relay on the fact that array access is (may be) faster in MS BASIC than accessing single variables (*2).

In addition to all of this, these lovable early books where even more restricted, as they tried to go along with an even more restricted BASIC standard than MS BASIC is - like using only single letter variable names.

All of this are methods that where quite popular back then and would never be used today - at least if the BASIC offers such conveniance as long variable names and more generic handling.

Bottom line: If your parser is meant to be used for actual (new) programs, using (very) old programs may lead to an optimization for cases no longer present.


*1 - More than once resulting in unintended reuse when the same abbreviation was used twice for different meanings - especially nasty when this happened in originally non overlapping sections, but later changes/extensions made them overlapping. A fricking hell to find this in large programs with tools of the time (aka almost none).

*2 - Arrays are stored separate from simple variables. When accessing a simple variable the whole list is searched until the variable is found. With arrays the array itself is as well searched in the array list (which usually is shorter) followed by an indexed access to the variable itself, speeding access quite a lot.

9
  • 1
    "Using (very) old code to optimize a modern parser" - optimizing Atari BASIC parser. Not so new. QBASIC actually implements what I'm thinking of already. Jul 5, 2019 at 14:32
  • @MauryMarkowitz Ah, Ok, cool. (Err, Atari 8 Bit or 16? If 8 bit, wouldn't A+ or Turbo already have solved that?). Still, that old code (like 101 BASIC GAMES) does voluntary restricts variable naming/usage might tilt the result - after all, the old Garbage-In leads to Garbage-Out saying is even more prominent in the age of neuronal networks - and valid everywhere :))
    – Raffzahn
    Jul 5, 2019 at 14:43
  • 8-bit. TURBO does lots of things, but I'm very interested in some very specific issues. For instance, AB encodes all numbers as a 40-bit constant, pre-tokenized. This means you don't have to re-tokenize a number every time you run a calculation. However, it also does this for line numbers in GOTO. So every GOTO/GOSUB requires a conversion down to 16-bit. My question is how many numeric constants will actually fit into 4 bits ( all those + 1 and = 0) and 16 bits (all those line numbers and many others) so is it worth it adding to the parser to store these as ints? Jul 5, 2019 at 15:18
  • @MauryMarkowitz Ouch. I get it. Now that's a different issue and quite worthwhile I think. My remarks are strictly about the variable NAMES and their distribution (as explained in the reason paragraph), not variable (and constant) content. That's a complete different issue - and offering many ways of optimization. For example I once made an extension to tweak all GOTO/GOSUB by adding a 16 bit field with the target address. RUN did once skim thru all lines and fill the actual value in, making GOTO/GOSUB almost free of cost.
    – Raffzahn
    Jul 5, 2019 at 15:30
  • @MauryMarkowitz Another Idea in that context I had, but never tried was to save at least the number 1 as a premade constants (float) and have the parser detect any occurrence of +/-1 and replace it by a direct call to increment/decrement the previous noted variable (in case of float using the constant) - myfeeling always was there is a lot of +/-1 in each BASIC program. Maybe something you could look out for as well (as a special case among all constants)?
    – Raffzahn
    Jul 5, 2019 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .