Pascal compiler for the 8051 family of microcontrollers

turbo51

In 1979, Intel introduced the 8051 as the first member of the MCS-51 family of microcontrollers. Today, hundreds of inexpensive 8051 derivatives are available from dozens of manufacturers, making the MCS-51 architecture attractive to both professionals and hobbyists alike. Intel also defined the 8051 assembly language and provided a well-designed assembler, the legendary ASM51.

What is perhaps most surprising is that this 8-bit architecture is still widely used today. You can even find 8051 soft cores implemented in FPGA and ASIC designs. More than four decades after its introduction, the 8051 remains one of the world’s most popular microcontroller architectures.

Given the many excellent C compilers available for the 8051, you might wonder why I chose Pascal. The answer is simple: I like the language. My experience with the 8051 architecture began in the late 1980s while reverse engineering the firmware of various consumer electronics devices. At that time, almost everything was written in assembly language, and I often wished there was a high-quality Pascal compiler for the 8051. A few existed, but they were either expensive, limited, or produced poor code. Over the years, I worked on numerous projects based on 8051 derivatives, and my growing interest in compiler design eventually led me to study compiler construction in greater depth.

Development of Turbo51 began in 2000 when I realized there was no Pascal compiler for the 8051 family that met my expectations, so I decided to write one. Having extensive experience with Borland Turbo Pascal, I wanted to create a compiler for the 8051 that would be as fast as Turbo Pascal, use the same language syntax, and generate highly optimized machine code.

The first step was to create a compiler fully compatible with Turbo Pascal 7. Once that was complete, I modified the compiler to generate code for 8051 microcontrollers. Because one of the primary goals was to produce compact and efficient code, I implemented numerous advanced optimization techniques, including common subexpression elimination, instruction combining, loop-invariant code motion, code block reordering, and many others.

By 2005, Turbo51 had become stable and reliable enough to be used in a real-world project. In 2008, the compiler was released as freeware on Turbo51.com.

Scroll to Top