CBASIC

When I got my first computer in 1980, there was nothing around that looked like accounting software at the time, so I bought a CBASIC compiler and acquired some public domain source code for bookkeeping and wrote 20,000 lines of code for a law office accounting system. Though now a bit dated, I have since moved that code over to DOS and recompiled it and am still running that code today.

CBASIC was an enhanced version of BASIC-E, sometimes called 'submarine basic' because the code (for BASIC-E) was first written by Gordon Eubanks (more recently of Symantec) while he was in the Naval Academy in Monterey. BASIC-E was his thesis computer project, and much of it was actually written on the bottom of the Pacific Ocean while he was on duty in the submarine service. Early documentation for BASIC-E consisted simply of a copy of his thesis.

BASIC-E was a p-code compiler which itself was written in PL1. Gordon's company was then known as Compiler Systems. Compiler Systems was later sold to the company founded by Gordon's college professor, Gary Kildal, which was, of course, Digital Research, the makers of CP/M.

The First versions of Cbasic were P-code as well and marketed by a company using the name "Compiler Systems" Which was ultimately sold out Digital Research. The compiler simply blew out all of the remarks and generated an intermediate code which would execute efficiently with an interpreter. This meant that the source code could be written with generous white space and with generous remarks without cluttering up the memory needed the executable. CBASIC was also notable for its dynamic memory management and use of Binary Coded Decimal (BCD) numbers for real numbers. This implied that CBASIC would handle math much more accurately than the Microsoft basic of the day which had a horrible reputation for math accuracy primarily because of its design.

CBASIC was converted into a true compiler in 1981 and it produced assembly language output which could be compiled in parts and linked with other overlays. Moreover, functions could be external so critical sections of code could be written in Assembler and then linked where performance was particularly critical. BCD math was particularly interesting in the way it was stored in memory. A Real Number always took 16 bytes of memory for storage. The least significant 14 bytes simply had 14 digits embedded in them, and as you might expect CBASIC could display 14 significant digits on all math operations which would be correct except for rounding/truncation errors on the last digit. The sign of the number was in the first bit followed followed by a positive or negative number which represented the offset of the decimal point which collectively implied that CBASIC could manage any numeric value which did not require more than 14 significant digits to be displayed and did not require that the decimal point be offset more than 127 digits form the significant digits which if you think of it is a pretty wide numeric range.

- - Updated 12/16/2012
- - Updated 04/25/2008
- - Updated 2/8/01
- - Updated 03/21/2008