Download Yasm User Manual

Transcript
Contents
I
Using Yasm
3
1
Running Yasm
1.1 yasm Synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3.1 General Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3.1.1 -a arch or --arch=arch: Select target architecture . . . . . . . . . . . . . .
1.3.1.2 -f format or --oformat=format: Select object format . . . . . . . . . . . .
1.3.1.3 -g debug or --dformat=debug : Select debugging format . . . . . . . . . .
1.3.1.4 -h or --help: Print a summary of options . . . . . . . . . . . . . . . . . . .
1.3.1.5 -L list or --lformat=list: Select list file format . . . . . . . . . . . . . .
1.3.1.6 -l listfile or --list=listfile: Specify list filename . . . . . . . . . . .
1.3.1.7 -m machine or --machine=machine: Select target machine architecture . .
1.3.1.8 -o filename or --objfile=filename: Specify object filename . . . . . . .
1.3.1.9 -p parser or --parser=parser : Select parser . . . . . . . . . . . . . . . .
1.3.1.10 -r preproc or --preproc=preproc: Select preprocessor . . . . . . . . . .
1.3.1.11 --version: Get the Yasm version . . . . . . . . . . . . . . . . . . . . . . . .
1.3.2 Warning Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3.2.1 -w: Inhibit all warning messages . . . . . . . . . . . . . . . . . . . . . . . . .
1.3.2.2 -Werror: Treat warnings as errors . . . . . . . . . . . . . . . . . . . . . . . .
1.3.2.3 -Wno-unrecognized-char: Do not warn on unrecognized input characters
1.3.2.4 -Worphan-labels: Warn on labels lacking a trailing colon . . . . . . . . .
1.3.2.5 -X style: Change error/warning reporting style . . . . . . . . . . . . . . .
1.3.3 Preprocessor Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3.3.1 -D macro[=value]: Pre-define a macro . . . . . . . . . . . . . . . . . . . . .
1.3.3.2 -e or --preproc-only: Only preprocess . . . . . . . . . . . . . . . . . . . .
1.3.3.3 -I path: Add include file path . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3.3.4 -P filename: Pre-include a file . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3.3.5 -U macro: Undefine a macro . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4 Supported Target Architectures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.5 Supported Parsers (Syntaxes) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.6 Supported Object Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.7 Supported Debugging Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
7
7
7
8
8
8
8
9
2
VSYASM - Yasm for Microsoft Visual Studio 2010
2.1 Integration Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Alternative Integration Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Using VSYASM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
II
3
NASM Syntax
11
11
11
12
13
The NASM Language
3.1 Layout of a NASM Source Line . . . . . . . . . . . . . .
3.2 Pseudo-Instructions . . . . . . . . . . . . . . . . . . . . .
3.2.1 DB and Friends: Declaring Initialized Data . . .
3.2.2 RESB and Friends: Declaring Uninitialized Data
3.2.3 INCBIN: Including External Binary Files . . . .
3.2.4 EQU: Defining Constants . . . . . . . . . . . . . .
iii
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
17
17
18
18
18
19
19