From 9e4d68107fc6d929d1ba92dfc73323aa48181747 Mon Sep 17 00:00:00 2001 From: cuz Date: Sun, 3 Sep 2000 17:13:14 +0000 Subject: [PATCH] Working on the cc65 docs git-svn-id: svn://svn.cc65.org/cc65/trunk@320 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- doc/cc65.sgml | 226 ++++++++++++++++++++++++++------------------------ 1 file changed, 118 insertions(+), 108 deletions(-) diff --git a/doc/cc65.sgml b/doc/cc65.sgml index 09d3a1ad2..917600f53 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -65,7 +65,7 @@ Short options: -O Optimize code -Oi Optimize code, inline more code -Or Enable register variables - -Os Inline some known functions + -Os Inline some known functions -T Include source as comment -V Print the compiler version number -W Suppress warnings @@ -93,10 +93,7 @@ Here is a description of all the command line options: This option disables any compiler exensions. Have a look at section 5 for a discussion of compiler extensions. In addition, the macro - - __STRICT_ANSI__ - - is defined, when using one of these options. + --cpu CPU @@ -123,7 +120,7 @@ Here is a description of all the command line options: -g, --debug-info - This will cause the compiler to insert a .DEBUGINFO command into the + This will cause the compiler to insert a ). -t target, --target target @@ -149,17 +146,16 @@ Here is a description of all the command line options: determines things like the character set that is used for strings and character constants. The following target systems are supported: - none - c64 - c128 - ace (no library support) - plus4 - cbm610 - pet (all CBM PET systems except the 2001) - nes (Nintendo Entertainment System) - apple2 - geos - + + none + c64 + c128 + plus4 + cbm610 (all CBM series-II computers with 80 column video) + pet (all CBM PET systems except the 2001) + apple2 + geos + -v, --verbose @@ -172,31 +168,35 @@ Here is a description of all the command line options: Use static storage for local variables instead of storage on the stack. Since the stack is emulated in software, this gives shorter and usually faster code, but the code is no longer reentrant. The difference between - -Cl and declaring local variables as static yourself is, that + void f (void) { unsigned a = 1; ... } + the variable a will always have the value 1 when entering the function - and using -Cl, while in + and using void f (void) { static unsigned a = 1; .... } + the variable a will have the value 1 only the first time, the function is entered, and will keep the old value from one call of the function to the next. - You may also use #pragma staticlocals to change this setting in your - sources (see section 7). + You may also use ). -I dir, --include-dir dir @@ -216,32 +216,35 @@ Here is a description of all the command line options: Enable an optimizer run over the produced code. - Using -Oi, the code generator will inline some code where otherwise a + Using + + You may not use names of standard C functions in your own code. If you + do that, your program is not standard compliant anyway, but using + + The inlined string and memory functions will not handle strings or + memory areas larger than 255 bytes. Similar, the inlined + +

+ It is possible to concatenate the modifiers for -T @@ -273,8 +276,8 @@ the same base name, but with the extension replaced by ".s". The output file contains assembler code suitable for the use with the ca65 macro assembler. -In addition to the paths named in the -I option on the command line, the -directory named in the environment variable CC65_INC is added to the +In addition to the paths named in the The compiler allows single line comments that start with //. This feature is disabled in strict ANSI mode. - +

The compiler allows unnamed parameters in parameter lists. The compiler will not issue warnings about unused parameters that don't have a name. This feature is disabled in strict ANSI mode. - - The compiler has some additional keywords:

- - - + The compiler has some additional keywords: +

+ + +

The keywords without the underlines are disabled in strict ANSI mode. - +

The datatypes "float" and "double" are not available. - +

The compiler does not support bit fields. - +

Initialization of local variables is only possible for scalar data types (that is, not for arrays and structs). - +

Because of the "wrong" order of the parameters on the stack, there is an additional macro needed to access parameters in a variable parameter list in a C function. - +

Functions may not return structs. However, struct assignment *is* possible. - +

Part of the C library is available only with fastcall calling conventions (see below). This means, that you may not mix pointers to those functions with pointers to user written functions. - +

There may be some more minor differences, I'm currently not aware off. The @@ -334,48 +344,42 @@ This cc65 version has some extensions to the ISO C standard. The compiler allows // comments (like in C++ and in the proposed C9x - standard). This feature is disabled by The compiler allows to insert assembler statements into the output - file. The syntax is + file. The syntax is

- - - or -

- +

+ or +

+

- The first form is in the user namespace and is disabled if the There is a special calling convention named "fastcall". This calling - convention is currently only usable for functions written in - assembler. The syntax for a function declaration using fastcall is + convention is currently only usable for functions written in + assembler. The syntax for a function declaration using fastcall is +

+ - <return type> fastcall <function name> (<parameter list>) + or

- - or -

- <return type> __fastcall__ <function name> (<parameter list>) + An example would be - - - void __fastcall__ f (unsigned char c) - - +

+ The first form of the fastcall keyword is in the user namespace and is therefore disabled in strict ANSI mode. @@ -453,8 +457,7 @@ The compiler defines several macros at startup: __ATARI__ This macro is defined if the target is one of the Atari computers - (400/800/130XL/800XL). Note that there is no runtime and C library support - for atari systems. + (400/800/130XL/800XL). __APPLE2__ @@ -474,29 +477,29 @@ The compiler defines several macros at startup: __STRICT_ANSI__ - This macro is defined to 1 if the -A compiler option was given, and + This macro is defined to 1 if the __OPT__ - Is defined if the compiler was called with the -O command line option. + Is defined if the compiler was called with the __OPT_i__ - Is defined if the compiler was called with the -Oi command line option. + Is defined if the compiler was called with the __OPT_r__ - Is defined if the compiler was called with the -Or command line option. + Is defined if the compiler was called with the __OPT_s__ - Is defined if the compiler was called with the -Os command line option. + Is defined if the compiler was called with the -#pragmas

+#pragmas

The compiler understands some pragmas that may be used to change code generation and other stuff. @@ -518,8 +521,9 @@ generation and other stuff. uninitialized variables do not have the value zero. Example: - + #pragma bssseg ("MyBSS") + #pragma codeseg (<name>) @@ -533,8 +537,9 @@ generation and other stuff. configuration file. Example: - + #pragma bssseg ("MyCODE") + #pragma dataseg (<name>) @@ -548,8 +553,9 @@ generation and other stuff. configuration file. Example: - + #pragma bssseg ("MyDATA") + #pragma rodataseg (<name>) @@ -563,8 +569,9 @@ generation and other stuff. configuration file. Example: - + #pragma bssseg ("MyRODATA") + #pragma regvaraddr (<const int>) @@ -582,10 +589,11 @@ generation and other stuff. register variables. So be careful with this #pragma. Example: - + #pragma regvaraddr(1) /* Allow taking the address * of register variables */ + #pragma signedchars (<const int>) @@ -593,15 +601,16 @@ generation and other stuff. Changed the signedness of the default character type. If the argument is not zero, default characters are signed, otherwise characters are unsigned. The compiler default is to make characters unsigned since this - creates a lot better code. + creates a lot better code. This default may be overridden by the + #pragma staticlocals (<const int>) Use variables in the bss segment instead of variables on the stack. This - pragma changes the default set by the compiler option -Cl. If the argument - is not zero, local variables are allocated in the BSS segment, leading to - shorter and in most cases faster, but non-reentrant code. + pragma changes the default set by the compiler option #pragma zpsym (<name>) @@ -611,9 +620,10 @@ generation and other stuff. The compiler will create a matching import declaration for the assembler. Example: - - extern int foo; - #pragma zpsym ("foo"); /* foo is in the zeropage */ + + extern int foo; + #pragma zpsym ("foo"); /* foo is in the zeropage */ + -- 2.39.5