XYBASIC

History

I entered the Stanford Computer Science Department as a grad student in fall of 1968, but my interest waned before my Ph.D. dissertation waxed. I went to a lot of movies and worked at the wonderful Festival Cinema in downtown Palo Alto with a crazy group of friends. I loved to talk about classic film, write movie blurbs, and run the big projectors, but sweeping floors and cleaning bathrooms soon got old. I had been a T.A. for Don Knuth, and when Don came into the Festival in early February 1977 and asked what I was doing, I told him I was looking for a programming job. The following day, Don got a cold call from Bob Swartz, who was looking for a programmer. Don gave Bob my phone number.

mwclogo

Microprocessors had been around for a couple years by 1977, but homebrewed personal computers were in their infancy. Bob was an early adopter, starting with an 8008-based system, and he foresaw the growth potential of microprocessor-based systems. He wanted his startup Mark Williams Company to sell a BASIC interpreter for 8080s, to compete with Bill Gates' MITS BASIC. I told him I could write it for him in four months (just a wild guess). I hated BASIC but needed a job, Bob let me work from home, and I figured I could stand programming for a couple months. I still worked for Bob when Mark Williams Company closed 18 years later.

Because disk drives (that is, 8" floppy drives) were in short supply at the time, I commuted from Palo Alto to Pacific Grove to use Gary Kildall's machines for a couple months (see my CP/M source page). Soon I got my own machine; I've had computers in my house and worked from home since then (mid-1977).

XYBASIC

The BASIC interpreter I wrote was called XYBASIC. It predated the American National Standard for Minimal BASIC (ANSI X3.60-1978), but later I tried to make it comply to the Standard. The first version fit in 4K, with integer arithmetic only. It grew to 8K when I added a floating point package, and to 14K as I added more features. When the 9511 numeric coprocessor came along, I adapted XYBASIC to use it if present (using self-modifying code!). XYBASIC ran under CP/M (an operating system from Digital Research), under ISIS-II (an operating system from Intel), and in a standalone version; MS-DOS did not yet exist. XYBASIC was often used for process control applications. I performed custom modifications of it for several OEM customers, so the source is heavily conditionalized. Mark Williams marketed XYBASIC for several years, but over time its business migrated to C compilers and the COHERENT operating system, an early Unix look-alike.

Manual

Manual

I wrote the XYBASIC Programming Manual as well as the code. I no longer have the original source files for the manual, but I still have several hard copies. A tarball containing scanned manual pages is here. I converted the scanned pages to a manual webpage and to PDF.

Source resurrection

In the early days of personal computers, before PCs supported networking, moving bits between machines was nontrivial. I never migrated the XYBASIC source kit to more modern machines. I kept many boxes of 8" floppies, but eventually my last machine with an 8" floppy drive died. Many years later, I deep-sixed most of the floppies, but kept a set of XYBASIC source floppies (3 diskettes dated 11/8/81).

Diskettes

In March 2014, Emmanuel Roche contacted me after seeing references to XYBASIC on my website. Emmanuel put me in contact with Steven Hirsch, who said he could probably read the floppies. I mailed my floppies to Steven, who performed some magic incantations and sent me a tarball of the disk images and extracted files in May 2014. Source fp9511 as extracted from the scanned diskette images is incorrectly truncated, but the source referenced below is corrected.

Source kit

The XYBASIC source kit (identified in version as REV 2.14.00 5/27/81) contains 33 source files (ca. 21,000 lines) written in assembly language for the CP/M macro assembler (MAC), as listed below. All have © dates in the range 1978-1981. I wrote all except the floating point modules finout, fmath, fpbcd, and xmath. Each source begins with a comment giving last-modified date (maintained by hand, as CP/M filesystems did not have file timestamps at that time) and description:

File Date Description
aux 11/19/80 statement auxilliary routines
benddisk 12/12/80 routines for Bendix SDISK version under Monolitic Systems MSOS.
bendix 12/12/80 FILES, SAVE and LOAD routines for Bendix version under Monolithic Systems OS
cam 09/07/79 CAMAC / North Star version routines for SAVE, LOAD, GTFIL, and i/o
camac1 11/05/80 statement and function routines for CAMAC version
camac2 07/10/80 routines for CAMAC version
cpm 05/21/81 CP/M version SAVE and LOAD, including GTFIL
driver 10/22/80 interpreter driver
eval 06/10/80 expression evaluator
finout 10/10/80 floating point input/output routines
fmath 06/09/80 floating point math package
fnsops 11/05/80 arithmetic and control function and op routines
fp9511 12/21/79 floating point package for 9511 chip
fpbcd 11/19/80 BCD floating point package
initial 05/20/81 initialization dialog
inout 12/05/80 input / output & error routines
isis2 05/21/81 statement routines for ISIS-II version SAVE and LOAD, plus GTFIL
nonst 08/06/80 routines for nonstandard version SAVE and LOAD, plus GTFIL
packard 01/23/80 custom version for Packard Instruments
parsing 08/26/79 parsing routines
ram 05/20/81 RAM storage for non-ROM versions
rom 12/12/80 RAM EQUates for ROM version
sdisk 01/12/81 statement routines for CP/M SDISK version
stacks 05/23/79 symbol table and control stack manipulation routines
states1 12/02/80 statement routines for statements ASSIGN through EXEC
states2 05/21/81 statement routines for statements FOR through NULL
states3 12/05/80 statement routines for statements ON through WAIT
strings 11/01/79 string routines and functions
tables 01/12/81 tables
tokenize 10/22/80 tokenization and line editing
version 05/18/81 version EQUates
wild 10/22/80 routines for Wild Heerbrugg version
xmath 06/09/80 floating point extended function package

The source diskettes in the original tarball also include:

Object

Once I had the resurrected source, I used Udo Munk's z80pack CP/M emulation and Michael Haardt's CP/M tools to build a CP/M XYBASIC object and run it. I ran the emulator on my MacAir under OSX, but the emulation and tools packages support other systems. Here's the log I kept, and here's some sample output. Emulated CP/M XYBASIC runs about 15x faster on my MacAir than it ran on standard 8080-based hardware. Building a working ISIS-II XYBASIC should be straightforward, but I haven't done it yet.

Imsai 8080
Altair 8800

Udo built standalone XYBASIC objects (available on Udo's site) for Imsai 8080 and Altair 8800 emulators. Each displays an emulated front panel you can use to control XYBASIC while it runs, a real time machine trip; you can twiddle the Imsai's front panel lights with OUT 255, n in an XYBASIC program. These emulations are only slightly slower (.8x) than standard 8080 hardware when run on my MacAir.

Basically, you just concatenate the source files to make a source for assembly, but with a few constraints. Source version must be first, with the EQUates at the beginning set appropriately to specify the version you wish to build; in particular, exactly one of cpm, isis2, or nonst must be true to build the CP/M, ISIS-II, or standalone version, respectively. Source ram (for CP/M and ISIS-II versions) or rom (for standalone versions) must be next-to-last. Source initial must be last, as the initialization dialog code is overlayed by the user's growing XYBASIC program. Exclude the OEM-specific files benddisk, bendix, cam, camac1, camac2, packard, and wild.

Acknowledgments

XYBASIC source is © Mark Williams Company. It is posted as open source by generous permission of Robert Swartz, the current copyright holder.

Thanks to several people who made this page possible: