
- •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 |
313 |
|
|
Appendix B. Version Differences
This following appendix lists an overview of major product enhancements and differences between Version 5 and previous versions. The current version of the C51 compiler contains all enhancements listed below:
Version 4 Differences B
!Byte Order of Floating-point Numbers
Floating-point numbers are now stored in the big endian order. Previous releases of the C51 compiler stored floating-point numbers in little endian format. Refer to “Floating-point Numbers” on page 147 for more information.
!_chkfloat_ Library Function
The intrinsic function _chkfloat_ allows for fast testing of floating-point numbers for error (NaN), ±INF, zero and normal numbers. Refer to “_chkfloat_” on page 208 for more information.
!FLOATFUZZY Directive
C51 now supports the FLOATFUZZY directive. This directive controls the number of bits ignored during the execution of a floating-point compare. Refer to “FLOATFUZZY” on page 23 for more information.
!Floating-point Arithmetic is Fully Reentrant
Intrinsic floating-point arithmetic operations (add, subtract, multiply, divide, and compare) are now fully reentrant. The C library routines fpsave and fprestore are no longer needed. Several library routines are also reentrant. Refer to “Routines by Category” on page 182 for more information.
!Long and Floating-point Operations no Longer use an Arithmetic Stack
The long and floating-point arithmetic is more efficient; the code generated is now totally register-based and does not use a simulated arithmetic stack. This also reduces the memory needs of the generated code.
!Memory Types
The memory types have been changed to achieve better performance in the run-time library and to reflect the memory map of the MCS® 251 architecture.

314 |
Appendix B. Version Differences |
|
|
!Memory Type Bytes for Generic Pointers
The memory type bytes used in generic pointers have changed. The following table contains the memory type byte values and their associated memory type.
|
Memory Type |
idata |
data |
bdata |
xdata |
pdata |
code |
|
|
|
|
|
|
|
|
|
C51 V5 Value |
0x00 |
0x00 |
0x00 |
0x01 |
0xFE |
0xFF |
B |
C51 V4 Value |
0x01 |
0x04 |
0x04 |
0x02 |
0x03 |
0x05 |
|
|||||||
|
|
|
|
|
|
|
|
! WARNINGLEVEL Directive
C51 now supports the WARNINGLEVEL directive which lets you specify the strength of the warning detection for the C51 compiler. The C51 compiler now also checks for unused local variables, labels, and expressions. Refer to “WARNINGLEVEL” on page 55 for more information.

Keil Software — C51 Compiler User’s Guide |
315 |
|
|
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 152 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. Refer to “NOAMAKE” on page 35 for |
|
more information. |
|
!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. Refer to “OPTIMIZE” on page 39 for more information.
!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 42 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 47 for more information.
!vprintf and vsprint Library Functions
The vprintf and vsprintf library functions have been added. Refer to “vprintf” on page 304 and “vsprintf” on page 306 for more information.

316 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 |
|
|
B |
operations are similar on 16-bit CPUs. C51 supports this feature as the |
default and provides you with two new control 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 control |
|
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 control directives ASM and ENDASM to include source text to output to .SRC files generated using the SRC command directive.
!New Control Directives
The control 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.