8051 C Compiler and Assembler User Guide
INTRODUCTION
C COMPILER
Running the Compiler from the Command Line
Compiler Command Line Options
Compile Only (/c)
Generate Assembler Code (/Fa)
Generate Assembler Code Listing (/Fc)
Generate Debug Information (/DEBUG)
Define Identifier (/D)
Warning as Errors (/WX)
Warning Level 0 (/W0)
Warning Level 1 (/W1)
Warning Level 2 (/W2)
Warning Level 3 (/W3)
Warning Level 4 (/W4)
Preserve Iram (/Oi)
Default to Reentrant Code (/Os)
Favour Faster Code (/Of)
Use Register Keywords (/Or)
Global Register Allocation (/Og)
Suppress Integral Promotion (/Op)
Large Memory Model (/AL)
Small Memory Model (/AS)
Small Memory Model Direct Addressing (/AD)
Use Acall/Ajmp (/AA)
Tiny Memory Model (/AT)
Interrupt Vector Offset (/VO:)
Disable Keil Keywords (/Kk)
Disable Tasking Keywords (/Kt)
C Language Definition
ANSI features
General Language Extensions
8051 Specific Language Extensions
Data Sizes
Pragmas
#pragma version
#pragma date
#pragma time
#pragma message
#pragma optimize
#pragma_bank
8051 Specific Features
Reentrant/Non-reentrant Functions
Memory Models Pointer Types and Smart Pointers
Memory Space Qualifiers
Default Memory Space Usage
Bit Objects
Bit Addressable Objects
Generic Pointers
Absolute Object Location
Compatibility Features
Support for Keil extensions
Support for Tasking extensions
Accessing the 8051 Internal Registers
SFR Bytes
SFR Words
SFR Bits
Predefined 8051 Internal Registers Variables
Compiler Data Formats
Compiler Data Formats
_bit/_sfrbit
char/unsigned char/_sfr
int/short/unsigned int/unsigned short/_sfrword
long/unsigned long
float
double
long double
enum
bit fields
pointer to data/idata/bdata
pointer to xdata/code
generic pointer
smart pointer
function pointer
Code Bank Switching
Code Bank Switching Method
Using the Bank Pragma
Restoration of the Previous Bank
Setting up the linker
Linker Optimisations
Using the Virtual Workshop
Example Project
Interrupt Functions
Manual Coding of Interrupt Vector
Automatic Coding of Interrupt Vector
Register Bank Switching
Call Tree Analysis
In Line Assembler Code
In Line Assembler Code
Accessing Global Variables
Accessing Static Variables
Accessing Local Variables and Function Parameters
OverView
Non-Reentrant Functions Large Memory Model
Non-Reentrant Functions Small Memory Model
Non-Reentrant Functions Mini and Tiny Memory Models
Reentrant Functions Large Memory Model
Reentrant Functions Small Mini and Tiny Memory Models
Function Return Value
Predefined Macros
ANSI Predefined Macros
Compiler Specific Predefined Macros
Compiler Support Files
Headers and Library Files
Startup Module
Console I/O
CROSS ASSEMBLER
Assembler Source Code Format
Assembler Source Code Format
Label Field
Operation Field
Operand Field
Comment Field
Assembler Expressions
Assembler Expressions
Integer Numbers
Literals
Symbols
Examples
Assembly List Format
Assembly List Format
Page Header
Source and Object Code list
Page Width
Error Line
Symbol Table
Predefined Symbols
Predefined Symbols
Predefined Bit Addresses for 8051
Predefined Bit Addresses for 8051
Predefined 8051 data addresses
Predefined 8052 data addresses
Conditional Assembly
Assembler Macros
Assembler Macros
Dummy Arguments
Dummy Labels
NARG Symbol
Bankable Segments
Running the Assembler from the Command Line
LINKER
Overview and Command Line Operation
Default Filenames
Linker Response File
Linker Command Line Options
Generate Intel Hex Output (/HEX)
Generate OMF51 Output (/OMF)
Generate S Record Output (/SREC)
Generate IEEE Binary Output (/IEEE)
Generate IEEE ASCII Output (/IEEEA)
Generate Plain Binary Output (/BIN)
Output Debug Information (/DEBUG)
Patch Listing Files (/PATCH)
Generate Error File (/Fe)
Specify Internal Ram Size (/IRAM:)
Specify External Ram Limits (/XRAM:)
Specify ROM Limits (/ROM:)
Place Program Code in External RAM (/NOROM)
Specify Stack Segment (/STACK:)
Specify Segment Addresses and Order (/CODE /XDATA /IDATA /DATA /BIT)
Sort Map File in Address Order (/MOa)
Sort Map File in Name Order (/MOn)
Cross Module Type Checking
C COMPILER LIBRARY FUNCTION REFERENCE
Introduction to Compiler Library Functions
Detailed Descriptions
Introducing Detailed Descriptions
abs() absl()
acos() acosl()
asin() asinl()
atan() atanl()
atan2() atan2l()
atoi() atol() atof()atolf()
ceil() ceill()
clearerr()
cos() cosl()
cosh() coshl()
_ecvt() _ecvtl
exit()
exp() expl()
fabs() fabsl()
_fcvt() _fcvtl
ferror()
fgetc()
fgets()
fileno()
floor() floorl()
fprintf()
fputs()
free()
frexp() frexpl()
fscanf()
getc()
getch()
getchar()
getche()
gets()
isalnum()
isalpha()
isascii()
iscntrl()
isdigit()
isgraph()
islower()
isprint()
ispunct()
isspace()
isupper()
isxdigit()
itoa()
kbhit()
ldexp() ldexpl()
log() logl()
log10() log10l()
ltoa()
malloc()
memchr()
memcmp()
memcpy()
memmove()
memset()
pow() powl()
printf()
putc()
putch()
putchar()
puts()
rand()
realloc()
sbrk()
scanf()
sin() sinl()
sinh() sinhl()
sprintf()
sqrt() sqrtl()
srand()
sscanf()
strcspn()
strcat()
strchr()
strcmp()
strcpy()
strlen()
strncat()
strncmp()
strncpy()
strpbrk()
strrchr()
strspn()
strstr()
tan() tanl()
tanh() tanhl()
time()
toascii()
tolower()
toupper()
ultoa()
ungetc()
ungetch()
MICROPROCESSOR INSTRUCTION REFERENCE
ACALL
ADD
ADDC
AJMP
ANL
CALL
CJNE
CLR
CPL
DA
DEC
DIV
DJNZ
INC
JB
JBC
JC
JMP
JNB
JNC
JNZ
JZ
LCALL
LJMP
MOV
MOVC
MOVX
MUL
NOP
ORL
POP
PUSH
RET
RETI
RL
RLC
RR
RRC
SETB
SJMP
SUBB
SWAP
XCH
XCHD
XRL
ASSEMBLER DIRECTIVES
Assembler Directives
Assembly Options
Introducing Assembly Options
CLIST/NOLIST
LIST/NOLIST
LISTF
MC/NOMC
MD/NOMD
MEX/NOMEX
MOD51/NOMOD51
OBJ/NOOBJ
PAGE/NOPAGE
PAGE
SYM
UNA/NOUNA
8051/8052/80535
Other Assembler Directives
Other Assembler Directives
BIT
BSEG
CSEG
DATA
DB
DBIT
DW
DS
DSEG
END
ENDC
ENDM
EQU
EXTRN
FAIL
FIELDS
IFC/IFNC/IFIC/IFINC
IFcc
INCLUDE
ISEG
MACR
NAME
OPT
ORG
PAGEWIDTH
PUBLIC
RSEG
SEGMENT
SET
SPC
TTL
USING
XSEG