Directives that Control File Use

The following directives provide some control over file use. In general, the linker provides more control over file use than the assembler, which assembles exactly one output file using input files as read from left to right on the command line.

.incbin

.incbin “file” [, skip [, count ]]

The .incbin directive includes the specified file verbatim at the current location. The file is included as it is, without being assembled. For example, you could use this directive to include executable files, literals, or arbitrary data. After the file is included, assembly continues at the line following the .incbin directive.

Quotation marks are required around file.

You can control the search path used to find the specified file with the -I command-line option, which adds a path to the list of directories the assembler searches for files specified in .include directives. You may use multiple -I options to point to a variety of locations. The current working directory is always searched first; after that, the assembler searches any -I directories in the same order they were specified (left to right) on the command line.

The skip argument skips that number of bytes from the start of the file.

The count argument indicates the maximum number of bytes to read.

Note that data that is included is not aligned in any way, so it is your responsibility to make sure that proper alignment is provided both before and after the .incbin directive.

.include

.include “file”

The .include directive provides a way to include supporting files at specified points in your source program. The code from file is assembled as if it followed the point of the .include directive. When the end of the included file is reached, assembly of the original file continues.

Quotation marks are required around file.

You can control the search path used to find the specified file with the -I command-line option, which adds a path to the list of directories the assembler searches for files specified in .include directives. You may use multiple -I options to point to a variety of locations. The current working directory is always searched first; after that, the assembler searches any -I directories in the same order they were specified (left to right) on the command line.