Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

33basic

English · 简体中文 · 日本語

A Teletype Model 33, and BASIC. You type a program on paper that cannot be edited, and that is why every line has a number.

▶ Run it in your browser: https://buildx100.github.io/33basic/

The paper tape punch and reader on the left with a punched tape hanging in the well, a roll of teletype paper above the keyboard showing a BASIC listing, and the speed, sound and machine controls on the right

33basic    machine 1963  <->  host 1975 (Altair BASIC)

A Model 33 ASR wired to an Altair 8800 running Microsoft 8K BASIC. Both halves of that really went together: the Altair's console was frequently an ASR-33, and Gates and Allen's BASIC printed its first output onto teletype paper.

Run it

npm run serve        # http://localhost:16003

Or open https://buildx100.github.io/33basic/, which is the same files: the Pages workflow uploads web/ as it stands.

There is no server side. The BASIC interpreter runs in the browser — no model, no API, no build step, no bundler. web/ is native ES modules, which means it does not work over file://; it has to be served over HTTP.

npm test             # the acceptance test

The point

Line numbers exist because the paper cannot be edited.

Retype line 20 and line 20 is replaced. There is no other way to change it, because ink on paper does not move. That is the only edit there is.

Everything else follows from it:

  • LIST exists because the paper has scrolled out of sight.
  • SAVE exists because the machine forgets.
  • Paper tape exists because SAVE has to put the program somewhere.

And there is no SAVE command at all, because there did not need to be. The punch is wired in parallel with the printer: switch it on, type LIST, and the program lands on the tape because the printer printed it.

And the things that are missing follow too. There is no backspace key — there is no mechanism to move the print head backwards at all. # erases the previous character and @ kills the line, but both of them print, because not printing is not an option. The paper keeps an honest record of every mistake you made. stty erase and stty kill are their direct descendants.

What this is not

  • Not a Model 33 emulator. If a feature only makes the emulation more complete and does not serve the teaching, it is out.
  • Not a full BASIC. Scope is whatever the ten acceptance programs need.
  • Not fast. Ten characters per second is the real speed, and it is why some programs work here and some do not. A game that prints one line a turn is fine; one that redraws a grid every turn takes over a minute. That is why people stopped using teletypes.

Documentation

docs/model33.md the machine — 72 columns, CR and LF, the bell, why @ is SHIFT+P, and which details are still uncertain
docs/basic.md the host — the dialect, what was checked against the 1975 manual and what was not, and why the interpreter is a generator
web/tapes/README.md the tape library: where the 103 listings come from and why they may be redistributed
docs/licensing.md which files are Apache-2.0 and which are public domain, and why the difference matters

Layout

web/
  index.html
  og.png, favicon.svg, robots.txt, sitemap.xml
                       for crawlers and link previews. The machine reads none of it
  css/                 six stylesheets, cascade order is link order
  js/
    main.js            boot and wiring only, no logic
    basic.js           the host: an original MS 8K BASIC, written to the manual
    machine.js         one Model 33 -- paper, carriage, bell, overstrike
    tape.js            the punch and the reader. Knows nothing about BASIC
    clock.js           THE metronome: one timer drives paper and host together
    format.js          the 64 glyphs the type drum carries, and 72 columns
    keyboard.js        the deck. BREAK is the one key wired to anything
    print.js           a print-only DOM at the real paper geometry
    audio.js           motor, keyclick, carriage and bell, synthesised live
    prefs.js           what survives a reload. The program deliberately does not
    config.js          the numbers nothing else may invent -- 72, 65, 10 CPS
    storage.js         every localStorage access, because Safari throws
    i18n.js, locales/  the chrome only -- the paper is never translated
  tapes/               103 tapes, and the manifest the tape box is drawn from
docs/                  why the machine and the host behave as they do
test/                  the acceptance test, and the library's own checks
deploy/                nginx and a Dockerfile. It is a static site

Licence

The code is Apache-2.0. See LICENSE and NOTICE.

The 103 BASIC listings in web/tapes/ are not. They are program listings from David H. Ahl's BASIC Computer Games (1978), which he placed in the public domain in 2022. They carry no licence and impose no conditions — the Apache terms do not apply to them, and neither does the attribution requirement.

docs/licensing.md sets out the boundary file by file; web/tapes/README.md has the evidence, the sources and the one caveat.

"Teletype" is a trademark and this project is not affiliated with its owner; that is why it is called 33basic. "Altair" and "Microsoft" are trademarks too — the banner the interpreter prints names the dialect it implements, nothing more.

Releases

Packages

Contributors

Languages