
- •Chapter 1. Introduction
- •Books About the C Language
- •Chapter 2. Compiling with C51
- •Environment Settings
- •Running C51
- •DOS ERRORLEVEL
- •C51 Output Files
- •Control Directives
- •Directive Categories
- •Reference
- •Chapter 3. Language Extensions
- •Keywords
- •8051 Memory Areas
- •Program Memory
- •Internal Data Memory
- •External Data 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
- •Dallas 80C320, 80C520, and 80C530
- •Siemens 80C517 and 80C537
- •Data Pointers
- •Library Routines
- •Philips/Signetics 8xC750, 8xC751, and 8xC752
- •Customization Files
- •STARTUP.A51
- •START751.A51
- •INIT.A51
- •INIT751.A51
- •PUTCHAR.C
- •GETKEY.C
- •CALLOC.C
- •FREE.C
- •INIT_MEM.C
- •MALLOC.C
- •REALLOC.C
- •Optimizer
- •General Optimizations
- •8051 Specific 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 Pointers
- •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
- •PBYTE
- •PWORD
- •XBYTE
- •XWORD
- •Routines by Category
- •Buffer Manipulation
- •Character Conversion and Classification
- •Data Conversion
- •Math
- •Memory Allocation
- •Stream Input and Output
- •String Manipulation
- •Miscellaneous
- •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
- •Appendix A. Differences from ANSI C
- •Compiler-related Differences
- •Library-related Differences
- •Appendix B. Version 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
- •Trouble with the bdata Memory Type
- •Using Monitor-51
- •Function Pointers
- •Glossary
- •Index
Keil Software — C51 Compiler User’s Guide |
317 |
|
|
|
|
|
|
! Trigraphs |
|
|
|
C51 now supports trigraph sequences. |
|
|
|
! 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. |
|
|
B |
Version 3.0 Differences |
|
|
|
|
|
|
!New Control Directive Added for Assembly Source File Output
The SRC control 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.

318 Appendix B. Version Differences
Version 2 Differences
! Absolute Register Addressing
C51 now generates code that performs absolute register addressing. This improves execution speed. The control 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 — C51 Compiler User’s Guide |
319 |
|
|
Using C51 Version 5 with Previous
Versions
You may wish to use the C51 Version 5 with older versions of the 8051 development tools such as BL51, OHS51, or debugging tools and emulators. The new compiler adds object file records for register optimization which makes
the object format incompatible with the old tools. However, you can direct the B compiler and linker to generate object modules that are compatible with the old
tools.
1.Invoke C51 with the control NOAMAKE and do not use REGFILE. or
2.Invoke L51 or BL51 with the control NOAMAKE.
If you are using old debugging tools, you may have problems displaying floating-point numbers and pointers. Make sure that you have current versions of the debugging software.

320 |
Appendix B. Version Differences |
|
|
B