1 .\" $Id: i386_as.6,v 1.5 1994/06/24 14:01:54 ceriel Exp $
2 .TH I386_AS 6 "$Revision: 1.5 $"
5 i386_as \- assembler for Intel 80386
7 ~em/lib.bin/i386/as [options] argument ...
9 This assembler is made with the general framework
10 described in \fIuni_ass\fP(6). It is an assembler generating relocatable
11 object code in \fIack.out\fP(5) format.
14 An address on the Intel 80386 consists of two pieces:
15 a segment number and an offset.
16 Usually, the segment number resides in a segment register, and
17 assembly language addresses only give the offset, with the exception of
18 the address of an inter-segment jump or call (see \fIaddressing modes\fP
21 The Intel 80386 has the following 32-bit registers:
23 Four general registers: eax (accumulator), ebx (base), ecx (count), and edx (data).
24 The low- and high order bytes of the low order words of these registers
25 are separately addressable as ah, bh, ch, dh, and al, bl, cl, dl respectively.
27 Two pointer registers: esp (stack pointer) and ebp (base pointer).
29 Two index registers: esi (source index) and edi (destination index).
31 Six segment registers: cs (code), ds (data), ss (stack), es (extra),
32 fs (extra), and gs (extra).
33 .IP "addressing modes"
35 .ta 8n 16n 24n 32n 40n 48n
38 expr the value of \fIexpr\fP is immediate data or
39 an address offset. There is no special
40 notation for immediate data.
42 register one of the aforementioned general registers
43 or their upper or lower halves, or one of the
44 four segment registers.
46 (expr) the value of expr is the address of the operand.
49 expr (reg) the value of \fIexpr\fP (if present) + the contents of
50 \fIreg\fP (which must be a pointer or an index register)
51 is the address of the operand.
55 the value of \fIexpr\fP (if present) + the contents of
57 contents of \fIreg2\fP is the address of the operand.
60 expr (reg1) (reg2 * scale)
61 the value of \fIexpr\fP (if present) + the contents of
63 contents of \fIreg2\fP multiplied by \fIscale\fP,
64 is the address of the operand.
65 \fIscale\fP can be either 1, 2, 4, or 8.
66 This mode is only allowed for 32-bit addressing.
68 The next addressing mode is only allowed with the instructions
71 expr : expr the value of the first \fIexpr\fP is a segment number,
72 the value of the second \fIexpr\fP is an address offset.
74 The following two addressing modes are only allowed with Intel 80[23]87 floating
75 point processor instructions:
78 st(num) addresses the floating point processor stack. \fInum\fP
79 must be between 0 and 7. st is the same as st(0).
84 Each time an address is computed the processor decides which segment register
85 to use. You can override the processor's choice by prefixing the instruction
86 with one of eseg, cseg, sseg, dseg, fseg, or gseg; these prefixes indicate that the
87 processor should choose es, cs, ss, ds, fs, or gs instead.
93 There is also an address size toggle, which switches between 32-bit and
94 16-bit address generation: a16 or a32. Normally, the assembler generates
95 32-bit addresses; both of these toggles make it generate 16-bit addresses
96 for the next instruction, and also generate code to set the processor
97 temporarily in 16-bit address mode.
99 There is also an operand size toggle, which switches between 32-bit and
100 16-bit operands: o16 or o32. Normally, the assembler generates
101 32-bit operands; both of these toggles make it generate 16-bit operands
102 for the next instruction, and also generate code to set the processor
103 temporarily in 16-bit operand mode.
105 Prefixes only affect the next instruction.
107 There are also the .use32 and .use16 assembler directives, which do not
108 generate code, but change the assemblers default for operand and address sizes.
109 Obviously, .use16 gives 16-bit modes, .use32 gives 32-bit modes.
110 This is useful for assembling real mode 80386 code, or pure 16-bit
111 modules (that do not have the D-bit set in the segment descriptor).
112 These assembler directives stay in effect until there is another one.
118 80386 Programmer's Reference Manual, 1986, Intel Corporation