
- •Chapter 1. Introduction
- •Support for all 8051 Variants
- •Books About the C Language
- •Chapter 2. Compiling with the Cx51 Compiler
- •Environment Variables
- •Running Cx51 from the Command Prompt
- •ERRORLEVEL
- •Cx51 Output Files
- •Control Directives
- •Directive Categories
- •Reference
- •Chapter 3. Language Extensions
- •Keywords
- •Memory Areas
- •Program Memory
- •Internal Data Memory
- •External Data Memory
- •Far Memory
- •Special Function Register Memory
- •Memory Models
- •Small Model
- •Compact Model
- •Large Model
- •Memory Types
- •Explicitly Declared Memory Types
- •Implicit Memory Types
- •Data Types
- •Bit Types
- •Special Function Registers
- •sbit
- •Absolute Variable Location
- •Pointers
- •Generic Pointers
- •Pointer Conversions
- •Abstract Pointers
- •Function Declarations
- •Function Parameters and the Stack
- •Passing Parameters in Registers
- •Function Return Values
- •Specifying the Memory Model for a Function
- •Specifying the Register Bank for a Function
- •Register Bank Access
- •Interrupt Functions
- •Reentrant Functions
- •Chapter 4. Preprocessor
- •Directives
- •Stringize Operator
- •Predefined Macro Constants
- •Chapter 5. 8051 Derivatives
- •Analog Devices MicroConverter B2 Series
- •Atmel 89x8252 and Variants
- •Dallas 80C320, 420, 520, and 530
- •Arithmetic Accelerator
- •Data Pointers
- •Library Routines
- •Philips 8xC750, 8xC751, and 8xC752
- •Philips 80C51MX Architecture
- •Philips and Atmel WM Dual DPTR
- •Customization Files
- •STARTUP.A51
- •INIT.A51
- •XBANKING.A51
- •Basic I/O Functions
- •Memory Allocation Functions
- •Optimizer
- •General Optimizations
- •Options for Code Generation
- •Segment Naming Conventions
- •Data Objects
- •Program Objects
- •Interfacing C Programs to Assembler
- •Function Parameters
- •Parameter Passing in Registers
- •Parameter Passing in Fixed Memory Locations
- •Function Return Values
- •Using the SRC Directive
- •Register Usage
- •Overlaying Segments
- •Example Routines
- •Small Model Example
- •Compact Model Example
- •Large Model Example
- •Data Storage Formats
- •Bit Variables
- •Signed and Unsigned Long Integers
- •Generic and Far Pointers
- •Floating-point Numbers
- •Accessing Absolute Memory Locations
- •Absolute Memory Access Macros
- •Linker Location Controls
- •The _at_ Keyword
- •Debugging
- •Chapter 7. Error Messages
- •Fatal Errors
- •Actions
- •Errors
- •Syntax and Semantic Errors
- •Warnings
- •Chapter 8. Library Reference
- •Intrinsic Routines
- •Library Files
- •Standard Types
- •va_list
- •Absolute Memory Access Macros
- •CBYTE
- •CWORD
- •DBYTE
- •DWORD
- •FARRAY, FCARRAY
- •FVAR, FCVAR,
- •PBYTE
- •PWORD
- •XBYTE
- •XWORD
- •Routines by Category
- •Buffer Manipulation
- •Character Conversion and Classification
- •Data Conversion
- •Math Routines
- •Memory Allocation Routines
- •Stream Input and Output Routines
- •String Manipulation Routines
- •Miscellaneous Routines
- •Include Files
- •8051 Special Function Register Include Files
- •ABSACC.H
- •ASSERT.H
- •CTYPE.H
- •INTRINS.H
- •MATH.H
- •SETJMP.H
- •STDARG.H
- •STDDEF.H
- •STDIO.H
- •STDLIB.H
- •STRING.H
- •Reference
- •Compiler-related Differences
- •Library-related Differences
- •Appendix B. Version Differences
- •Version 6.0 Differences
- •Version 5 Differences
- •Version 4 Differences
- •Version 3.4 Differences
- •Version 3.2 Differences
- •Version 3.0 Differences
- •Version 2 Differences
- •Appendix C. Writing Optimum Code
- •Memory Model
- •Variable Location
- •Variable Size
- •Unsigned Types
- •Local Variables
- •Other Sources
- •Appendix D. Compiler Limits
- •Appendix E. Byte Ordering
- •Recursive Code Reference Error
- •Problems Using the printf Routines
- •Uncalled Functions
- •Using Monitor-51
- •Trouble with the bdata Memory Type
- •Function Pointers
- •Glossary
- •Index

Keil Software — Cx51 Compiler User’s Guide |
361 |
|
|
Version 3.4 Differences
_at_Keyword
C51 supports variable location using the _at_ keyword. This new keyword allows you to specify the address of a variable in a declaration. Refer to “The _at_ Keyword” on page 186 for more information.
NOAMAKE Directive |
B |
C51 now supports the NOAMAKE directive. This directive causes C51 to |
|
generate object modules without project information and register |
|
optimization records. This is necessary only if you want to use object files |
|
with older versions of C51 tools. |
|
OH51 Hex File Converter
The OHS51 Object-Hex-Symbol Converter provided with prior versions of C51 has been replaced with OH51.
Optimizer Level 6
C51 now supports optimizer level 6 which provides loop rotation. The resulting code is more efficient and executes faster.
ORDER Directive
When you specify the ORDER directive, C51 locates variables in memory in the order in which they are declared in your source file. Refer to “ORDER” on page 65 for more information.
REGFILE Directive
C51 now supports the REGFILE directive which lets you specify the name of the register definition file generated by the linker. This file contains information that is used to optimize the use of registers between functions in different modules. Refer to “REGFILE” on page 70 for more information.
vprintf and vsprint Library Functions
The vprintf and vsprintf library functions have been added. Refer to “vprintf” on page 349 and “vsprintf” on page 351 for more information.

362 |
Appendix B. Version Differences |
|
|
Version 3.2 Differences
ANSI Standard Automatic Integer Promotion
The latest version of the ANSI C Standard requires that calculations use int values if char or unsigned char values might overflow during the
calculation. This new requirement is based on the premise that int and char operations are similar on 16-bit CPUs. C51 supports this feature as the
B default and provides you with two new directives, INTPROMOTE and NOINTPROMOTE, to enable or disable integer promotion.
There is a big difference between 8-bit and 16-bit operations on the 8-bit 8051 in terms of code size and execution speed. For this reason, you might want to disable integer promotion by using the NOINTPROMOTE directive.
However, if you wish to retain maximum compatibility with other C compilers and platforms, leave integer promotions enabled.
Assembly Source Generation with In-Line Assembly
You may use the new directives ASM and ENDASM to include source text to output to .SRC files generated using the SRC command directive.
New Directives
The directives ASM, ENDASM, INTERVAL, INTPROMOTE, INTVECTOR, MAXARGS, and NOINTPROMOTE have been added or enhanced.
Offset and Interval Can Now Be Specified for Interrupt Vectors
You may now specify the offset and interval for the interrupt vector table. These features provide support for the SIECO-51 derivatives and allow you to specify a different location for the interrupt vector in situations where the interrupt table is not located at address 0000h.
Parameter Passing to Indirectly Called Functions
Function parameters may now be passed to indirectly called functions if all of the parameters can be passed in CPU registers. These functions do not have to be declared with the reentrant attribute.
Source Code Provided For Memory Allocation Functions
C source code for the memory allocation routines is now provided with the C51 compiler. You may now more easily adapt these functions to the hardware architecture of your embedded system.
Trigraphs
C51 now supports trigraph sequences.
Keil Software — Cx51 Compiler User’s Guide |
363 |
|
|
Variable-length Argument Lists for All Functions
Variable-length argument lists are now supported for all function types. Functions with a variable length argument list do not have to be declared using the reentrant attribute. The new command line directive MAXARGS determines the size of the parameter passing area.
Version 3.0 Differences |
B |
|
|
New Directive Added for Assembly Source File Output |
|
|
The SRC directive has been added to direct the compiler to generate an |
|
|
|
|
|
assembly language source file instead of an object file. |
|
|
New Library Functions |
|
|
The library functions calloc, free, init_mempool, malloc, and realloc have |
|
|
been added. |
|

364 Appendix B. Version Differences
Version 2 Differences
|
|
Absolute Register Addressing |
|
|
C51 now generates code that performs absolute register addressing. This |
|
|
improves execution speed. The directives AREGS and NOAREGS, |
|
|
respectively, enable or disable this feature. |
B |
|
|
Bit-addressable Memory Type |
||
|
Variable types of char and int can now be declared to reside in the |
|
|
bit-addressable internal memory area by using the bdata memory specifier. |
|
|
|
Intrinsic Functions |
|
|
Intrinsic functions have been added to the library to support some of the |
|
|
special instructions built in to the 8051. |
|
|
Mixed Memory Models |
|
|
Calls to and from functions of different memory models are now supported. |
|
|
New Optimizer Levels |
|
|
Two new levels of optimization have been added to the C51 compiler. These |
|
|
new levels support register variables, local common subexpression |
|
|
elimination, loop optimizations, and global common subexpression |
|
|
elimination, to name a few. |
|
|
New Predefined Macros |
|
|
The macros _ _C51_ _ and _ _MODEL_ _ are now defined by the |
|
|
preprocessor at compile time. |
|
Reentrant and Recursive Functions |
|
|
|
Individual functions may now be defined as being reentrant or recursive by |
|
|
using the reentrant function attribute. |
|
Registers Used for Parameter Passing |
|
|
|
C51 now passes up to 3 function arguments using registers. The |
|
|
REGPARMS and NOREGPARMS directives enable or disable this feature. |
|
Support for Memory-specific Pointers |
|
|
|
Pointers may now be defined to reference data in a particular memory area. |
|
Support for PL/M-51 Functions |
|
|
|
The alien keyword has been added to support PL/M-51 compatible functions |
|
|
and function calls. |
|
|
Volatile Type Specifier |
|
|
The volatile variable attribute may be used to enforce variable access and to |
|
|
prevent optimizations involving that variable. |

Keil Software — Cx51 Compiler User’s Guide |
365 |
|
|
B