Long options:
--auto-import Mark unresolved symbols as import
+ --bin-include-dir dir Set a search path for binary includes
--cpu type Set cpu type
--debug-info Add debug info to object file
--feature name Set an emulation feature
---------------------------------------------------------------------------
</verb></tscreen>
-
+
<sect1>Command line options in detail<p>
Here is a description of all the command line options:
<descrip>
+ <label id="option--bin-include-dir">
+ <tag><tt>--bin-include-dir dir</tt></tag>
+
+ Name a directory which is searched for binary include files. The option
+ may be used more than once to specify more than one directory to search. The
+ current directory is always searched first before considering any
+ additional directories. See also the section about <ref id="search-paths"
+ name="search paths">.
+
+
<label id="option--cpu">
<tag><tt>--cpu type</tt></tag>
command for a list of emulation features.
+ <label id="option--forget-inc-paths">
<tag><tt>--forget-inc-paths</tt></tag>
Forget the builtin include paths. This is most useful when building
monitor.
+ <label id="option-h">
<tag><tt>-h, --help</tt></tag>
Print the short option summary shown above.
+ <label id="option-i">
<tag><tt>-i, --ignore-case</tt></tag>
This option makes the assembler case insensitive on identifiers and labels.
<tt><ref id=".CASE" name=".CASE"></tt> control command.
+ <label id="option-l">
<tag><tt>-l, --listing</tt></tag>
Generate an assembler listing. The listing file will always have the
may change in future versions.
+ <label id="option--list-bytes">
<tag><tt>--list-bytes n</tt></tag>
Set the maximum number of bytes printed in the listing for one line of
number of printed bytes.
+ <label id="option--macpack-dir">
<tag><tt>--macpack-dir dir</tt></tag>
This options allows to specify a directory containing macro files that are
when debugging the builtin macro packages.
+ <label id="option-mm">
<tag><tt>-mm model, --memory-model model</tt></tag>
Define the default memory model. Possible model specifiers are near, far and
huge.
+ <label id="option-o">
<tag><tt>-o name</tt></tag>
The default output name is the name of the input file with the extension
the source file, or, if -o is given, the full path in this name is used.
+ <label id="option--pagelength">
<tag><tt>--pagelength n</tt></tag>
sets the length of a listing page in lines. See the <tt><ref
id=".PAGELENGTH" name=".PAGELENGTH"></tt> directive for more information.
+ <label id="option-s">
<tag><tt>-s, --smart-mode</tt></tag>
In smart mode (enabled by -s or the <tt><ref id=".SMART" name=".SMART"></tt>
compiler, see there for a list.
+ <label id="option-v">
<tag><tt>-v, --verbose</tt></tag>
Increase the assembler verbosity. Usually only needed for debugging
verbose output.
+ <label id="option-D">
<tag><tt>-D</tt></tag>
This option allows you to define symbols on the command line. Without a
you may have to quote the expression.
+ <label id="option-I">
<tag><tt>-I dir, --include-dir dir</tt></tag>
Name a directory which is searched for include files. The option may be
name="search paths">.
+ <label id="option-U">
<tag><tt>-U, --auto-import</tt></tag>
Mark symbols that are not defined in the sources as imported symbols. This
which is not always true for assembler programmers.
+ <label id="option-V">
<tag><tt>-V, --version</tt></tag>
Print the version number of the assembler. If you send any suggestions
<sect>Search paths<label id="search-paths"><p>
-Include files are searched in the following places:
+Normal include files are searched in the following places:
<enum>
<item>The current directory.
<item>The value of the environment variable <tt/CA65_INC/ if it is defined.
<item>A subdirectory named <tt/asminc/ of the directory defined in the
environment variable <tt/CC65_HOME/, if it is defined.
-<item>Any directory added with the <tt/-I/ option on the command line.
+<item>Any directory added with the <tt/<ref id="option-I" name="-I">/ option
+on the command line.
+</enum>
+
+Binary include files are searched in the following places:
+
+<enum>
+<item>The current directory.
+<item>Any directory added with the <tt/<ref id="option--bin-include-dir"
+name="--bin-include-dir">/ option on the command line.
</enum>
/* */
/* */
/* */
-/* (C) 2000-2009, Ullrich von Bassewitz */
+/* (C) 2000-2010, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
-/*****************************************************************************/
-/* Data */
-/*****************************************************************************/
-
-
-
-#define INC_STD 0x0001U
-
-
-
/*****************************************************************************/
/* Code */
/*****************************************************************************/
-void AddIncludePath (const char* NewPath)
+void AddIncludePath (const char* NewPath, unsigned Where)
/* Add a new include path to the existing one */
{
- AddSearchPath (NewPath, INC_STD);
+ AddSearchPath (NewPath, Where);
}
-char* FindInclude (const char* Name)
+char* FindInclude (const char* Name, unsigned Where)
/* Find an include file. Return a pointer to a malloced area that contains
* the complete path, if found, return 0 otherwise.
*/
{
/* Search in the include directories */
- return SearchFile (Name, INC_STD);
+ return SearchFile (Name, Where);
}
void ForgetAllIncludePaths (void)
/* Remove all include search paths. */
{
- ForgetAllSearchPaths (INC_STD);
+ ForgetAllSearchPaths (INC_STD | INC_BIN);
}
/* Initialize the include path search list */
{
/* Add some standard paths to the include search path */
- AddSearchPath ("", INC_STD); /* Current directory */
+ AddSearchPath ("", INC_STD); /* Current directory */
+ AddSearchPath ("", INC_BIN);
/* Add some compiled in search paths if defined at compile time */
#ifdef CA65_INC
/* */
/* */
/* */
-/* (C) 2000-2009, Ullrich von Bassewitz */
+/* (C) 2000-2010, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
+/*****************************************************************************/
+/* Data */
+/*****************************************************************************/
+
+
+
+#define INC_STD 0x0001U /* Add to standard include path */
+#define INC_BIN 0x0002U /* Add to binary include path */
+
+
+
/*****************************************************************************/
/* Code */
/*****************************************************************************/
-void AddIncludePath (const char* NewPath);
+void AddIncludePath (const char* NewPath, unsigned Where);
/* Add a new include path to the existing one */
-char* FindInclude (const char* Name);
+char* FindInclude (const char* Name, unsigned Where);
/* Find an include file. Return a pointer to a malloced area that contains
* the complete path, if found, return 0 otherwise.
*/
/* */
/* */
/* */
-/* (C) 1998-2009, Ullrich von Bassewitz */
+/* (C) 1998-2010, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
"\n"
"Long options:\n"
" --auto-import\t\tMark unresolved symbols as import\n"
+ " --bin-include-dir dir\tSet a search path for binary includes\n"
" --cpu type\t\tSet cpu type\n"
" --debug-info\t\tAdd debug info to object file\n"
" --feature name\tSet an emulation feature\n"
+static void OptBinIncludeDir (const char* Opt attribute ((unused)), const char* Arg)
+/* Add an include search path for binaries */
+{
+ AddIncludePath (Arg, INC_BIN);
+}
+
+
+
static void OptCPU (const char* Opt attribute ((unused)), const char* Arg)
/* Handle the --cpu option */
{
static void OptIncludeDir (const char* Opt attribute ((unused)), const char* Arg)
/* Add an include search path */
{
- AddIncludePath (Arg);
+ AddIncludePath (Arg, INC_STD);
}
/* Program long options */
static const LongOpt OptTab[] = {
{ "--auto-import", 0, OptAutoImport },
+ { "--bin-include-dir", 1, OptBinIncludeDir },
{ "--cpu", 1, OptCPU },
{ "--debug-info", 0, OptDebugInfo },
{ "--feature", 1, OptFeature },
/* */
/* */
/* */
-/* (C) 1998-2009, Ullrich von Bassewitz */
+/* (C) 1998-2010, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
F = fopen (SB_GetConstBuf (&Name), "rb");
if (F == 0) {
- /* Search for the file in the include directories. */
- char* PathName = FindInclude (SB_GetConstBuf (&Name));
+ /* Search for the file in the binary include directory */
+ char* PathName = FindInclude (SB_GetConstBuf (&Name), INC_BIN);
if (PathName == 0 || (F = fopen (PathName, "r")) == 0) {
/* Not found or cannot open, print an error and bail out */
ErrorSkip ("Cannot open include file `%m%p': %s", &Name, strerror (errno));
/* If a count was not given, calculate it now */
if (Count < 0) {
- Count = Size - Start;
- if (Count < 0) {
- /* Nothing to read - flag this as a range error */
- ErrorSkip ("Range error");
- goto Done;
- }
+ Count = Size - Start;
+ if (Count < 0) {
+ /* Nothing to read - flag this as a range error */
+ ErrorSkip ("Range error");
+ goto Done;
+ }
} else {
- /* Count was given, check if it is valid */
- if (Start + Count > Size) {
- ErrorSkip ("Range error");
- goto Done;
- }
+ /* Count was given, check if it is valid */
+ if (Start + Count > Size) {
+ ErrorSkip ("Range error");
+ goto Done;
+ }
}
/* Seek to the start position */
/* Read chunks and insert them into the output */
while (Count > 0) {
- unsigned char Buf [1024];
+ unsigned char Buf [1024];
- /* Calculate the number of bytes to read */
+ /* Calculate the number of bytes to read */
size_t BytesToRead = (Count > (long)sizeof(Buf))? sizeof(Buf) : (size_t) Count;
- /* Read chunk */
+ /* Read chunk */
size_t BytesRead = fread (Buf, 1, BytesToRead, F);
if (BytesToRead != BytesRead) {
/* Some sort of error */
/* */
/* */
/* */
-/* (C) 1998-2008 Ullrich von Bassewitz */
-/* Roemerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 1998-2010, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* We are on include level. Search for the file in the include
* directories.
*/
- PathName = FindInclude (Name);
+ PathName = FindInclude (Name, INC_STD);
if (PathName == 0 || (F = fopen (PathName, "r")) == 0) {
/* Not found or cannot open, print an error and bail out */
Error ("Cannot open include file `%s': %s", Name, strerror (errno));