Small-C

Last updated
Small-C
Developer(s) Ron Cain, James E. Hendrix
Initial release1980;44 years ago (1980)
Written in C programming language
Type Compiler
License Copyrighted but sharable

Small-C is both a subset of the C programming language, suitable for resource-limited microcomputers and embedded systems, and an implementation of that subset. Originally valuable as an early compiler for microcomputer systems available during the late 1970s and early 1980s, the implementation has also been useful as an example simple enough for teaching purposes.

Contents

The original compiler, written in Small-C for the Intel 8080 by Ron Cain, appeared in the May 1980 issue of Dr. Dobb's Journal . James E. Hendrix improved and extended the original compiler, and wrote The Small-C Handbook. Ron bootstrapped Small-C on the SRI International PDP 11/45 Unix system with an account provided by John Bass for Small C development. The provided source code was released with management permission into the public domain.[ citation needed ] Small-C was important for tiny computers in a manner somewhat analogous to the importance of GCC for larger computers. Just like its Unix counterparts, the compiler generates assembler code, which then must be translated to machine code by an available assembler.

Small-C is a retargetable compiler. Porting Small-C requires only that the back-end code generator and the library to operating system interface calls be rewritten for the target processor.

Language subset

"In May of 1980 Dr. Dobb's Journal ran an article entitled "A Small C Compiler for the 8080s" in which Ron Cain presented a small compiler for a subset of the C language. The most interesting feature of the compiler besides its small size was the language in which it was written—the one it compiled. It was a self-compiler! (Although this is commonplace today, it was a fairly novel idea at the time.) With a simple, one-pass algorithm, his compiler generated assembly language for the 8080 processor. Being small, however, it had its limitations. It recognized only characters, integers, and single dimension arrays of either type. The only loop controlling device was the while statement. There were no Boolean operators, so the bitwise logical operators & (AND) and | (OR) were used instead. But even with these limitations, it was a very capable language and a delight to use, especially compared to assembly language.

Recognizing the need for improvements, Ron encouraged me to produce a second version, and in December 1982 it also appeared in Dr. Dobb's Journal. The new compiler augmented Small C with (1) code optimizing, (2) data initializing, (3) conditional compiling, (4) the extern storage class, (5) the for, do/while, switch, and goto statements, (6) combination assignment operators, (7) Boolean operators, (8) the ones' complement operator, (9) block local variables, and (10) various other features. Then in 1984 Ernest Payne and I developed and published a CP/M compatible run-time library for the compiler. It consisted of over 80 functions and included most of those in the UNIX C Standard I/O Library—the ones that pertained to the CP/M environment. This became version 2.1 and the subject of The Small C Handbook. [1]

See also

Small-C variants

Related Research Articles

<span class="mw-page-title-main">Intel 8080</span> 8-bit microprocessor

The Intel 8080 ("eighty-eighty") is the second 8-bit microprocessor designed and manufactured by Intel. It first appeared in April 1974 and is an extended and enhanced variant of the earlier 8008 design, although without binary compatibility. The initial specified clock rate or frequency limit was 2 MHz, with common instructions using 4, 5, 7, 10, or 11 cycles. As a result, the processor is able to execute several hundred thousand instructions per second. Two faster variants, the 8080A-1 and 8080A-2, became available later with clock frequency limits of 3.125 MHz and 2.63 MHz respectively. The 8080 needs two support chips to function in most applications: the i8224 clock generator/driver and the i8228 bus controller. It is implemented in N-type metal–oxide–semiconductor logic (NMOS) using non-saturated enhancement mode transistors as loads thus demanding a +12 V and a −5 V voltage in addition to the main transistor–transistor logic (TTL) compatible +5 V.

<span class="mw-page-title-main">UCSD Pascal</span> Programming language released in 1977

UCSD Pascal is a Pascal programming language system that runs on the UCSD p-System, a portable, highly machine-independent operating system. UCSD Pascal was first released in 1977. It was developed at the University of California, San Diego (UCSD).

<span class="mw-page-title-main">Zilog Z80</span> 8-bit microprocessor

The Z80 is an 8-bit microprocessor introduced by Zilog as the startup company's first product. The Z80 was conceived by Federico Faggin in late 1974 and developed by him and his 11 employees starting in early 1975, before going on sale in July 1976. The processor is software-compatible with the Intel 8080 but with several enhancements and at a lower price. Like the 8080, the Z80 was mainly aimed at embedded systems, but it became one of the most widely used CPUs in home computers of the late 1970s and early 1980s. The Zilog Z80 was also common in military applications, musical equipment, and coin-operated arcade games of the era, including Pac-Man.

<span class="mw-page-title-main">CP/M</span> Discontinued family of computer operating systems

CP/M, originally standing for Control Program/Monitor and later Control Program for Microcomputers, is a mass-market operating system created in 1974 for Intel 8080/85-based microcomputers by Gary Kildall of Digital Research, Inc. CP/M is a disk operating system and its purpose is to organize files on a magnetic storage medium, and to load and run programs stored on a disk. Initially confined to single-tasking on 8-bit processors and no more than 64 kilobytes of memory, later versions of CP/M added multi-user variations and were migrated to 16-bit processors.

BBC BASIC is an interpreted version of the BASIC programming language. It was developed by Acorn Computers Ltd when they were selected by the BBC to supply the computer for their BBC Literacy Project in 1981.

<span class="mw-page-title-main">Zilog</span> American manufacturer of microprocessors

Zilog, Inc. is an American manufacturer of microprocessors and 8-bit and 16-bit microcontrollers. It is also a supplier of application-specific embedded system-on-chip (SoC) products.

Tiny BASIC is a family of dialects of the BASIC programming language that can fit into 4 or fewer KBs of memory. Tiny BASIC was designed by Dennis Allison and the People's Computer Company (PCC) in response to the open letter published by Bill Gates complaining about users pirating Altair BASIC, which sold for $150. Tiny BASIC was intended to be a completely free version of BASIC that would run on the same early microcomputers.

<span class="mw-page-title-main">Digital Research</span> Defunct American software company

Digital Research, Inc. was a privately held American software company created by Gary Kildall to market and develop his CP/M operating system and related 8-bit, 16-bit and 32-bit systems like MP/M, Concurrent DOS, FlexOS, Multiuser DOS, DOS Plus, DR DOS and GEM. It was the first large software company in the microcomputer world. Digital Research was originally based in Pacific Grove, California, later in Monterey, California.

<i>Dr. Dobbs Journal</i> American computer magazine

Dr. Dobb's Journal was a monthly magazine published in the United States by UBM Technology Group, part of UBM. It covered topics aimed at computer programmers. When launched in 1976, DDJ was the first regular periodical focused on microcomputer software, rather than hardware. In its last years of publication, it was distributed as a PDF monthly, although the principal delivery of Dr. Dobb's content was through the magazine's website. Publication ceased at the end of 2014, with the archived website continuing to be available online.

The PL/M programming language (an acronym of Programming Language for Microcomputers) is a high-level language conceived and developed by Gary Kildall in 1973 for Hank Smith at Intel for its microprocessors.

<span class="mw-page-title-main">IMSAI 8080</span> Microcomputer

The IMSAI 8080 is an early microcomputer released in late 1975, based on the Intel 8080 and S-100 bus. It is a clone of its main competitor, the earlier MITS Altair 8800. The IMSAI is largely regarded as the first "clone" microcomputer. The IMSAI machine runs a highly modified version of the CP/M operating system called IMDOS. It was developed, manufactured and sold by IMS Associates, Inc.. In total, between 17,000 and 20,000 units were produced from 1975 to 1978.

BDS C is a compiler for a sizeable subset of the C programming language, that ran on and generated code for the Intel 8080 and Zilog Z80 processors. It was the first C compiler for CP/M. It was written by Leor Zolman and first released in 1979 when he was 20 years old. "BDS" stands for "Brain Damage Software."

This is an incomplete comparison of assemblers. Some assemblers are components of a compiler system for a high-level programming language and may have limited or no usable functionality outside of the compiler system. Some assemblers are hosted on the target processor and operating system, while other assemblers (cross-assemblers) may run under an unrelated operating system or processor. For example, assemblers for embedded systems are not usually hosted on the target system since it would not have the storage and terminal I/O to permit entry of a program from a keyboard. An assembler may have a single target processor or may have options to support multiple processor types.

A source-to-source translator, source-to-source compiler, transcompiler, or transpiler is a type of translator that takes the source code of a program written in a programming language as its input and produces an equivalent source code in the same or a different programming language. A source-to-source translator converts between programming languages that operate at approximately the same level of abstraction, while a traditional compiler translates from a higher level programming language to a lower level programming language. For example, a source-to-source translator may perform a translation of a program from Python to JavaScript, while a traditional compiler translates from a language like C to assembly or Java to bytecode. An automatic parallelizing compiler will frequently take in a high level language program as an input and then transform the code and annotate it with parallel code annotations or language constructs.

The Dr. Dobb's Excellence in Programming Award was an annual prize given to individuals who, in the opinion of the editors of Dr. Dobb's Journal, "made significant contributions to the advancement of software development." The Excellence in Programming Award includes a $1,000 prize that was donated in the award winner's name to a charity of the winner's choice. The award was launched in 1995 in the print edition of Dr. Dobb's Journal and was given each year until 2009. In his March 1995 article introducing the awards, then editor-in-chief Jonathan Erickson wrote that the award was intended to recognize "achievement and excellence in the field of computer programming." Erickson explained that the winners were "selected by a special editorial committee" of the magazine. Because Dr. Dobb's serves an audience of software developers, the Excellence in Programming Award is specifically intended to recognize resources for programmers: languages, code libraries, tutorial books, and so on. Developers of shrinkwrap software intended for retail sale, custom software for corporate use, embedded software, or general-purpose applications were not considered for the award.

The Byte Sieve is a computer-based implementation of the Sieve of Eratosthenes published by Byte as a programming language performance benchmark. It first appeared in the September 1981 edition of the magazine and was revisited on occasion. Although intended to compare the performance of different languages on the same computers, it quickly became a widely used machine benchmark.

<span class="mw-page-title-main">BASIC interpreter</span> Interpreter that enables users to enter and run programs in the BASIC language

A BASIC interpreter is an interpreter that enables users to enter and run programs in the BASIC language and was, for the first part of the microcomputer era, the default application that computers would launch. Users were expected to use the BASIC interpreter to type in programs or to load programs from storage.

The Stratos was a Z80-based microcomputer introduced by Symbiotic Systems, Inc., in 1981.

References

  1. James E. Hendix. "Introduction". A Small-C Compiler: Language, Usage, Theory, and Design. M & T Books 1988 / Dr. Dobb's Journal Developer Network 2005.
  2. "C compilers for the BBC Computer". Mdfs.net.

Notes