Pristine Ack-5.5
[Ack-5.5.git] / man / i86_as.6
1 .\" $Id: i86_as.6,v 1.5 1994/06/24 14:01:57 ceriel Exp $
2 .TH I86_AS 6 "$Revision: 1.5 $"
3 .ad
4 .SH NAME
5 i86_as \- assembler for Intel 8086
6 .SH SYNOPSIS
7 ~em/lib.bin/i86/as [options] argument ...
8 .SH DESCRIPTION
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.
12 .SH SYNTAX
13 .IP segments
14 An address on the Intel 8086 consists of two pieces:
15 a segment number and an offset. A memory address is computed as
16 the segment number shifted left 4 bits + the offset.
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
19 below).
20 .IP registers
21 The Intel 8086 has the following 16-bit registers:
22 .br
23 Four general registers: ax (accumulator), bx (base), cx (count), and dx (data).
24 The upper halves and lower halves of these registers are separately
25 addressable as ah, bh, ch, dh, and al, bl, cl, dl respectively.
26 .br
27 Two pointer registers: sp (stack pointer) and bp (base pointer).
28 .br
29 Two index registers: si (source index) and di (destination index).
30 .br
31 Four segment registers: cs (code), ds (data), ss (stack), and es (extra).
32 .IP "addressing modes"
33 .nf
34 .ta 8n 16n 24n 32n 40n 48n
35 syntax          meaning
36
37 expr            the value of \fIexpr\fP is immediate data or
38                 an address offset. There is no special
39                 notation for immediate data.
40
41 register        one of the aforementioned general registers
42                 or their upper or lower halves, or one of the
43                 four segment registers.
44
45 (expr)          the value of expr is the address of the operand.
46
47 (reg)
48 expr (reg)      the value of \fIexpr\fP (if present) + the contents of
49                 \fIreg\fP (which must be a pointer or an index register)
50                 is the address of the operand.
51
52 (preg) (ireg)
53 expr (preg) (ireg)
54                 the value of \fIexpr\fP (if present) + the contents of
55                 \fIpreg\fP (which must be a pointer register) + the
56                 contents of \fIireg\fP (which must be an index register)
57                 is the address of the operand.
58
59 The next addressing mode is only allowed with the instructions
60 "callf" or "jmpf".
61
62 expr : expr     the value of the first \fIexpr\fP is a segment number,
63                 the value of the second \fIexpr\fP is an address offset.
64                 The (absolute) address of the operand is computed
65                 as described above.
66 .fi
67
68 .IP instructions
69 Each time an address is computed the processor decides which segment register
70 to use. You can override the processor's choice by prefixing the instruction
71 with one of eseg, cseg, sseg, or dseg; these prefixes indicate that the
72 assembler should choose es, cs, ss, or ds instead.
73 .br
74 Example: 
75 .ti +8
76 dseg movs
77 .SH "SEE ALSO"
78 uni_ass(6),
79 ack(1),
80 ack.out(5),
81 .br
82 MCS-86 assembly language reference manual, 1978, Intel Corporation
83 .SH EXAMPLE
84 .nf
85 .ta 8n 16n 24n 32n 40n 48n
86 An example of Intel 8086 assembly language:
87
88         .sect .text
89         _panic:
90                 push    bp
91                 mov     bp,sp
92         .sect .data
93         _35:
94         .data2  24944
95         .data2  26990
96         .data2  14947
97         .data2  32
98         .sect .text
99         call _disable
100         mov ax,_35
101         push ax
102         call _str
103         pop si
104         push 4(bp)
105         call _str
106         pop si
107         call _nlcr
108         call _exit
109         mov sp,bp
110         pop bp
111         ret
112         .extern _nopanic
113         _nopanic:
114                 push    bp
115                 mov     bp,sp
116         .sect .data
117         _38:
118         .data2  28526
119         .data2  24944
120         .data2  26990
121         .data2  14947
122         .data2  32
123         .sect .text
124         mov ax,_38
125         push ax
126         call _str
127         pop si
128         push 4(bp)
129         call _str
130         pop si
131         push 6(bp)
132         call _octal
133         pop si
134         mov sp,bp
135         pop bp
136         ret
137 .fi