I86_AS(6)

NAME
i86_as - assembler for Intel 8086

SYNOPSIS
~em/lib.bin/i86/as [options] argument ...

DESCRIPTION
This assembler is made with the general framework described in uni_ass(6). It is an assembler generating relocatable object code in ack.out(5) format.

SYNTAX

segments
    An address on the Intel 8086 consists of two pieces: a segment number and an offset. A memory address is computed as the segment number shifted left 4 bits + the offset. Assembly language addresses only give the offset, with the exception of the address of an inter-segment jump or call (see addressing modes below).

registers
    The Intel 8086 has the following 16-bit registers:
    Four general registers: ax (accumulator), bx (base), cx (count), and dx (data). The upper halves and lower halves of these registers are separately addressable as ah, bh, ch, dh, and al, bl, cl, dl respectively.
    Two pointer registers: sp (stack pointer) and bp (base pointer).
    Two index registers: si (source index) and di (destination index).
    Four segment registers: cs (code), ds (data), ss (stack), and es (extra).

addressing modes
    syntax		meaning
    expr		the value of expr is immediate data or
    		an address offset. There is no special
    		notation for immediate data.
    register	one of the aforementioned general registers
    		or their upper or lower halves, or one of the
    		four segment registers.
    (expr)		the value of expr is the address of the operand.
    (reg)
    expr (reg)	the value of expr (if present) + the contents of
    		reg (which must be a pointer or an index register)
    		is the address of the operand.
    (preg) (ireg)
    expr (preg) (ireg)
    		the value of expr (if present) + the contents of
    		preg (which must be a pointer register) + the
    		contents of ireg (which must be an index register)
    		is the address of the operand.
    The next addressing mode is only allowed with the instructions
    "callf" or "jmpf".
    expr : expr	the value of the first expr is a segment number,
    		the value of the second expr is an address offset.
    		The (absolute) address of the operand is computed
    		as described above.

instructions
    Each time an address is computed the processor decides which segment register to use. You can override the processor's choice by prefixing the instruction with one of eseg, cseg, sseg, or dseg; these prefixes indicate that the assembler should choose es, cs, ss, or ds instead.
    Example:
    dseg movs

SEE ALSO
uni_ass(6), ack(1), ack.out(5),
MCS-86 assembly language reference manual, 1978, Intel Corporation

EXAMPLE
An example of Intel 8086 assembly language:
	.sect .text
	_panic:
		push	bp
		mov	bp,sp
	.sect .data
	_35:
	.data2	24944
	.data2	26990
	.data2	14947
	.data2	32
	.sect .text
	call _disable
	mov ax,_35
	push ax
	call _str
	pop si
	push 4(bp)
	call _str
	pop si
	call _nlcr
	call _exit
	mov sp,bp
	pop bp
	ret
	.extern _nopanic
	_nopanic:
		push	bp
		mov	bp,sp
	.sect .data
	_38:
	.data2	28526
	.data2	24944
	.data2	26990
	.data2	14947
	.data2	32
	.sect .text
	mov ax,_38
	push ax
	call _str
	pop si
	push 4(bp)
	call _str
	pop si
	push 6(bp)
	call _octal
	pop si
	mov sp,bp
	pop bp
	ret