





						Instruction Summary



		 A.1  Introduction

		 MASM is an assembler for the  8086/186/286  family
		 of    microprocessors,	  capable   of	 assembling
		 instructions  for   the   8086,   186,	  and	286
		 microprocessors  and  the  8087  and  287 floating
		 point	coprocessors.	MASM  will   assemble	any
		 program   written   for   an  8086,  186,  or	286
		 microprocessor	environment as long as the  program
		 uses  the  instruction	 syntax	 described  in this
		 chapter.

		 By  default,  MASM  recognizes	  8086	 and   8087
		 instructions  only.   If a source program contains
		 186,  286,  or	 287  instructions,  one  or   more
		 Instruction  Set  directives  must  be	used in	the
		 source	  file	 to   enable   assembly	  of	the
		 instructions.	 The  following	 sections  list	the
		 syntax	of all instructions recognized by MASM	and
		 the Instruction Set directives.

		 Abbreviations used in the syntax descriptions are:
		 _______________________________________________________________
		 |Symbol    Meaning						|
		 |______________________________________________________________|
		 |accum	    accumulator: AX or AL				|
		 |reg	    byte or word register				|
		 |	      byte: AL,	AH, BL,	BH, CL,	CH, DL,	DH		|
		 |	      word: AX,	BX, CX,	DX, SI,	DI, BP,	SP		|
		 |segreg    segment register: CS, DS, SS, ES			|
		 |r/m	    general operand: register, memory address, indexed	|
		 |	    operand, based operand, or based indexed operand	|
		 |immed	    8- or 16-bit immediate value: constant or symbol	|
		 |mem	    memory operand: label, variable, or	symbol		|
		 |______________________________________________________________|







								A-1



















	      XENIX Macro Assembler Reference Manual



	      A.2  8086	Instructions

	      The following is	a  complete  list  of  the  8086
	      instructions.	MASM	assembles    all    8086
	      instructions by default.

	      _______________________________________________________________
	      AAA		   ASCII adjust	for addition
	      AAD		   ASCII adjust	for division
	      AAM		   ASCII adjust	for multiplication
	      AAS		   ASCII adjust	for subtraction
	      ADC  accum, immed	   Add immediate with carry to accumulator
	      ADC  r/m,	immed	   Add immediate with carry to operand
	      ADC  r/m,	reg	   Add register	with carry to operand
	      ADC  reg,	r/m	   Add operand with carry to register
	      ADD  accum, immed	   Add immediate to accumulator
	      ADD  r/m,	immed	   Add immediate to operand
	      ADD  r/m,	reg	   Add register	to operand
	      ADD  reg,	r/m	   Add operand to register
	      AND  accum, immed	   Bitwise And immediate with accumulator
	      AND  r/m,	immed	   Bitwise And immediate with operand
	      AND  r/m,	reg	   Bitwise And register	with operand
	      AND  reg,	r/m	   Bitwise And operand with register
	      CALL  label	   Call	instruction at label
	      CALL  r/m		   Call	instruction indirect
	      CBW		   Convert byte	to word
	      CLC		   Clear carry flag
	      CLD		   Clear direction flag
	      CLI		   Clear interrupt flag
	      CMC		   Complement carry flag
	      CMP  accum, immed	   Compare immediate with accumulator
	      CMP  r/m,	immed	   Compare immediate with operand
	      CMP  r/m,	reg	   Compare register with operand
	      CMP  reg,	r/m	   Compare operand with	register
	      CMPS  src, dest	   Compare strings
	      CMPSB		   Compare strings byte	for byte
	      CMPSW		   Compare strings word	for word
	      CWD		   Convert word	to double word
	      DAA		   Decimal adjust for addition



	      A-2



















						Instruction Summary



		 DAS		      Decimal adjust for subtraction
		 DEC  r/m	      Decrement	operand
		 DEC  reg	      Decrement	16-bit register
		 DIV  r/m	      Divide accumulator by operand
		 ESC  immed, r/m      Escape with 6-bit	immediate and operand
		 HLT		      Halt
		 IDIV  r/m	      Integer divide accumulator by operand
		 IMUL  r/m	      Integer multiply accumulator by operand
		 IN  accum, immed     Input from port (8-bit immediate)
		 IN  accum, DX	      Input from port given by DX
		 INC  r/m	      Increment	operand
		 INC  reg	      Increment	16-bit register
		 INT 3		      Software interrupt 3 (encoded as one byte)
		 INT  immed	      Software Interrupt 0 through 255
		 INTO		      Interrupt	on overflow
		 IRET		      Return from interrupt
		 JA  label	      Jump on above
		 JAE  label	      Jump on above or equal
		 JB  label	      Jump on below
		 JBE  label	      Jump on below or equal
		 JC  label	      Jump on carry
		 JCXZ  label	      Jump on CX zero
		 JE  label	      Jump on equal
		 JG  label	      Jump on greater
		 JGE  label	      Jump on greater or equal
		 JL  label	      Jump on less than
		 JLE  label	      Jump on less than	or equal
		 JMP  label	      Jump to instruction at label
		 JMP  r/m	      Jump to instruction indirect
		 JNA  label	      Jump on not above
		 JNAE  label	      Jump on not above	or equal
		 JNB  label	      Jump on not below
		 JNBE  label	      Jump on not below	or equal
		 JNC  label	      Jump on no carry
		 JNE  label	      Jump on not equal
		 JNG  label	      Jump on not greater
		 JNGE  label	      Jump on not greater or equal
		 JNL  label	      Jump on not less than
		 JNLE  label	      Jump on not less than or equal
		 JNO  label	      Jump on not overflow



								A-3


















	      XENIX Macro Assembler Reference Manual



	      JNP  label	   Jump	on not parity
	      JNS  label	   Jump	on not sign
	      JNZ  label	   Jump	on not zero
	      JO  label		   Jump	on overflow
	      JP  label		   Jump	on parity
	      JPE  label	   Jump	on parity even
	      JPO  label	   Jump	on parity odd
	      JS  label		   Jump	on sign
	      JZ  label		   Jump	on zero
	      LAHF		   Load	AH with	flags
	      LDS  r/m		   Load	operand	into DS
	      LEA  r/m		   Load	effective address of operand
	      LES  r/m		   Load	operand	into ES
	      LOCK		   Lock	bus
	      LODS  src		   Load	string
	      LODSB		   Load	byte from string into AL
	      LODSW		   Load	word from string into AX
	      LOOP  label	   Loop
	      LOOPE  label	   Loop	while equal
	      LOOPNE  label	   Loop	while not equal
	      LOOPNZ  label	   Loop	while not zero
	      LOOPZ  label	   Loop	while zero
	      MOV  accum, mem	   Move	memory to accumulator
	      MOV  mem,	accum	   Move	accumulator to memory
	      MOV  r/m,	immed	   Move	immediate to operand
	      MOV  r/m,	reg	   Move	register to operand
	      MOV  r/m,	segreg	   Move	segment	register to operand
	      MOV  reg,	immed	   Move	immediate to register
	      MOV  reg,	r/m	   Move	operand	to register
	      MOV  segreg, r/m	   Move	operand	to segment register
	      MOVS  dest, src	   Move	string
	      MOVSB		   Move	string byte by byte
	      MOVSW		   Move	string word by word
	      MUL  r/m		   Multiply accumulator	by operand
	      NEG  r/m		   Negate operand
	      NOP		   No operation
	      NOT  r/m		   Invert operand bits
	      OR  accum, immed	   Bitwise Or immediate	with accumulator
	      OR  r/m, immed	   Bitwise Or immediate	with operand
	      OR  r/m, reg	   Bitwise Or register with operand



	      A-4


















						Instruction Summary



		 OR  reg, r/m	      Bitwise Or operand with register
		 OUT  DX, accum	      Output to	port given by DX
		 OUT  immed, accum    Output to	port (8-bit immediate)
		 POP  r/m	      Pop 16-bit operand
		 POP  reg	      Pop 16-bit register from stack
		 POP  segreg	      Pop segment register
		 POPF		      Pop flags
		 PUSH  r/m	      Push 16-bit operand
		 PUSH  reg	      Push 16-bit register onto	stack
		 PUSH  segreg	      Push segment register
		 PUSHF		      Push flags
		 RCL  r/m, 1	      Rotate left through carry	by 1 bit
		 RCL  r/m, CL	      Rotate left through carry	by CL
		 RCR  r/m, 1	      Rotate right through carry by 1 bit
		 RCR  r/m, CL	      Rotate right through carry by CL
		 REPE		      Repeat if	equal
		 REPNE		      Repeat if	not equal
		 REPNZ		      Repeat if	not zero
		 REPZ		      Repeat if	zero
		 RET  [	immed ]	      Return after popping bytes from stack
		 ROL  r/m, 1	      Rotate left by 1 bit
		 ROL  r/m, CL	      Rotate left by CL
		 ROR  r/m, 1	      Rotate right by 1	bit
		 ROR  r/m, CL	      Rotate right by CL
		 SAHF		      Store AH into flags
		 SAL  r/m, 1	      Shift arithmetic left by 1 bit
		 SAL  r/m, CL	      Shift arithemetic	left by	CL
		 SAR  r/m, 1	      Shift arithmetic right by	1 bit
		 SAR  r/m, CL	      Shift arithmetic right by	CL
		 SBB  accum, immed    Subtract immediate and carry flag
		 SBB  r/m, immed      Subtract immediate and carry flag
		 SBB  r/m, reg	      Subtract register	and carry flag
		 SBB  reg, r/m	      Subtract operand and carry flag
		 SCAS  dest	      Scan string
		 SCASB		      Scan string for byte in AL
		 SCASW		      Scan string for word in AX
		 SHL  r/m, 1	      Shift left by 1 bit
		 SHL  r/m, CL	      Shift left by CL
		 SHR  r/m, 1	      Shift right by 1 bit
		 SHR  r/m, CL	      Shift right by CL



								A-5


















	      XENIX Macro Assembler Reference Manual



	      STC		   Set carry flag
	      STD		   Set direction flag
	      STI		   Set interrupt flag
	      STOS  dest	   Store string
	      STOSB		   Store byte in AL at string
	      STOSW		   Store word in AX at string
	      SUB  accum, immed	   Subtract imeediate from accumulator
	      SUB  r/m,	immed	   Subtract immediate from operand
	      SUB  r/m,	reg	   Subtract register from operand
	      SUB  reg,	r/m	   Subtract operand from register
	      TEST  accum, immed   Compare immediate bits with accumulator
	      TEST  r/m, immed	   Compare immediate bits with operand
	      TEST  r/m, reg	   Compare register bits with operand
	      TEST  reg, r/m	   Compare operand bits	with register
	      WAIT		   Wait
	      XCHG  accum, reg	   Exchange accumulator	with register
	      XCHG  r/m, reg	   Exchange operand with register
	      XCHG  reg, accum	   Exchange register with accumulator
	      XCHG  reg, r/m	   Exchange register with operand
	      XLAT  mem		   Translate
	      XOR  accum, immed	   Bitwise Xor immediate with accumulator
	      XOR  r/m,	immed	   Bitwise Xor immediate with operand
	      XOR  r/m,	reg	   Bitwise Xor register	with operand
	      XOR  reg,	r/m	   Bitwise Xor operand with register

	      The String instructions (CMPS, LODS,  MOVS,  SCAS,
	      and  STOS) use the DS, SI, ES, and DI registers to
	      compute operand locations.   Source  operands  are
	      assumed  to be at	DS:[SI]; destination operands at
	      ES:[DI].	 The operand  type  (BYTE  or  WORD)  is
	      defined by the instruction mnemonic.  For	example,
	      CMPSB specifies BYTE operands and	CMPSW  specifies
	      WORD  operands.	For  the CMPS, LODS, MOVS, SCAS,
	      and STOS instructions, the src and  dest	operands
	      are  dummy  operands  that define	the operand type
	      only.  The offsets associated with these	operands
	      are not used.  The src operand can also be used to
	      specify a	segment	override.  The ES  register  for
	      the destination operand cannot be	overridden.



	      A-6



















						Instruction Summary



		 Examples

		      cmps  word ptr string, word ptr es:0
		      lods  byte ptr string
		      mov   byte ptr es:0,  byte ptr string

		 The REP, REPE,	REPNE, REPNZ, or REPZ  instructions
		 provide  a  way  to  repeatedly  execute  a String
		 instruction for a given count	or  while  a  given
		 condition   is	 true.	 If  a	Repeat	instruction
		 immediately precedes a	 String	 instruction  (both
		 instructions  must  be	 on  the  same	line),	the
		 instructions  are  repeated  until  the  specified
		 repeat	 condition  is false, or the CX	register is
		 equal to zero.	 The Repeat instruction	 decrements
		 CX by one for each execution.

		 Example

		      mov  cx, 10      rep  scasb

		 In this example, SCASB	is repeated ten	times.


		 A.3  8087 Instruction Mnemonics

		 The following is a list of the	8087  instructions.
		 MASM assembles	all 8087 instructions by default.

		 Syntax		    Action
		 ______________________________________________________________

		 F2XM1		    Calculate 2x-1
		 FABS		    Take absolute value	of top of stack
		 FADD		    Add	real
		 FADD  mem	    Add	real from memory
		 FADD  ST, ST(i)    Add	real from stack
		 FADD  ST(i), ST    Add	real to	stack
		 FADDP ST(i), ST    Add	real and pop stack



								A-7



















	      XENIX Macro Assembler Reference Manual



	      FBLD mem		 Load 10-byte packed decimal on	stack
	      FBSTP mem		 Store 10-byte packed decimal and pop
	      FCHS		 Change	sign on	the top	stack element
	      FCLEX		 Clear exceptions after	WAIT
	      FCOM		 Compare real
	      FCOM ST		 Compare real with top of stack
	      FCOM ST(i)	 Compare real with stack
	      FCOMP		 Compare real and pop stack
	      FCOMP ST		 Compare real with top of stack	and pop
	      FCOMP ST(i)	 Compare real with stack and pop stack
	      FCOMPP		 Compare real and pop stack twice
	      FDECSTP		 Decrement stack pointer
	      FDISI		 Disable interrupts after WAIT
	      FDIV		 Divide	real
	      FDIV  mem		 Divide	real from memory
	      FDIV  ST,	ST(i)	 Divide	real from stack
	      FDIV  ST(i), ST	 Divide	real in	stack
	      FDIVP ST(i), ST	 Divide	real and pop stack
	      FDIVR		 Reversed real divide
	      FDIVR  mem	 Reverse real divide from memory
	      FDIVR  ST, ST(i)	 Reverse real divide from stack
	      FDIVR  ST(i), ST	 Reverse real divide in	stack
	      FDIVRP ST(i), ST	 Reversed real divide and pop stack twice
	      FENI		 Enable	interrupts after WAIT
	      FFREE		 Free stack element
	      FFREE ST		 Free top of stack element
	      FFREE ST(i)	 Free ith stack	element
	      FIADD mem		 Add 2 or 4-byte integer
	      FICOM mem		 2 or 4-byte integer compare
	      FICOMP mem	 2 or 4-byte integer compare and pop stack
	      FIDIV mem		 2 or 4-byte integer divide
	      FIDIVR mem	 Reversed 2 or 4-byte integer divide
	      FILD mem		 Load 2, 4, or 8-byte integer on stack
	      FIMUL mem		 2 or 4-byte integer multiply
	      FINCSTP		 Increment stack pointer
	      FINIT		 Initialize processor after WAIT
	      FIST mem		 Store 2 or 4-byte integer
	      FISTP mem		 Store 2, 4, or	8-byte integer and pop stack
	      FISUB mem		 2 or 4-byte integer subtract
	      FISUBR mem	 Reversed 2 or 4-byte integer subtract



	      A-8


















						Instruction Summary



		 FLD mem	    Load 4, 8, or 10-byte real on stack
		 FLD1		    Load +1.0 onto top of stack
		 FLDCW mem	    Load control word
		 FLDENV	mem	    Load 8087 environment (14-bytes)
		 FLDL2E		    Load log2e onto top	of stack
		 FLDL2T		    Load log210	onto top of stack
		 FLDLG2		    Load log102	onto top of stack
		 FLDLN2		    Load loge2 onto top	of stack
		 FLDPI		    Load pi onto top of	stack
		 FLDZ		    Load +0.0 onto top of stack
		 FMUL		    Multiply real
		 MUL  mem	    Multiply real from memory
		 FMUL  ST, ST(i)    Multiply real from stack
		 FMUL  ST(i), ST    Multiply real to stack
		 FMULP ST(i), ST    Multiply real and pop stack
		 FNCLEX		    Clear exceptions with no WAIT
		 FNDISI		    Disable interrupts with no WAIT
		 FNENI		    Enable interrupts with no WAIT
		 FNINIT		    Initialize processor, with no WAIT
		 FNOP		    No operation
		 FNSAVE	mem	    Save 8087 state (94	bytes) with no WAIT
		 FNSTCW	mem	    Store control word with no WAIT
		 FNSTENV mem	    Store 8087 environment with	no WAIT
		 FNSTSW	mem	    Store 8087 status word with	no WAIT
		 FPATAN		    Partial arctangent function
		 FPREM		    Partial remainder
		 FPTAN		    Partial tangent function
		 FRNDINT	    Round to integer
		 FRSTOR	mem	    Restore 8087 state (94 bytes)
		 FSAVE mem	    Save 8087 state (94	bytes) after WAIT
		 FSCALE		    Scale
		 FSQRT		    Square root
		 FST		    Store real
		 FST ST		    Store real from top	of stack
		 FST ST(i)	    Store real from stack
		 FSTCW mem	    Store control word with WAIT
		 FSTENV	mem	    Store 8087 environment after WAIT
		 FSTP mem	    Store 4, 8,	or 10-byte real	and pop	stack
		 FSTSW mem	    Store 8087 status word after WAIT
		 FSUB		    Subtract real



								A-9


















	      XENIX Macro Assembler Reference Manual



	      FSUB  mem		 Subtract real from memory
	      FSUB  ST,	ST(i)	 Subtract real from stack
	      FSUB  ST(i), ST	 Subtract real to stack
	      FSUBP ST(i), ST	 Subtract real and pop stack
	      FSUBR		 Reversed real subtract
	      FSUBR  mem	 Reversed real subtract	from memory
	      FSUBR  ST, ST(i)	 Reversed real subtract	from stack
	      FSUBR  ST(i), ST	 Reversed real subtract	in stack
	      FSUBRP ST(i), ST	 Reversed real subtract	and pop	stack
	      FTST		 Test top of stack
	      FWAIT		 Wait for last 8087 operation to complete
	      FXAM		 Examine top of	stack element
	      FXCH		 Exchange contents of stack elements
	      FFREE ST		 Exchange top of stack element
	      FFREE ST(i)	 Exchange top of stack and ith element
	      FXTRACT		 Extract exponent and significand
	      FYL2X		 Calculate Y log2x
	      FYL2PI		 Calculate Y log2(x+1)



	      A.4  186 Instruction Mnemonics

	      The 186  instruction  set	 consists  of  all  8086
	      instructions plus	the following instructions.  The
	      .186  directive  can  be	used  to  enable   these
	      instructions for assembly.

	      __________________________________________________________
	      BOUND reg, mem	      Detect value out of range
	      ENTER immed16, immed8   Enter procedure
	      INS mem, DX	      Input string from	port DX
	      INSB mem,	DX	      Input byte string	from port DX
	      INSW mem,	DX	      Input word string	from port DX
	      LEAVE		      Leave procedure
	      OUTS DX, mem	      Output byte/word/string to port DX
	      OUTSB DX,	mem	      Output byte string to port DX
	      OUTSW DX,	mem	      Output word string to port DX
	      PUSHA		      Push all registers



	      A-10



















						Instruction Summary



		 POPA			 Pop all registers



		 A.5  286 Non-Protected	Instruction Mnemonics

		 The 286 non-protected instruction set consists	 of
		 all   8086   instructions   plus   the	  following
		 instructions.	The .286c directive can	be used	 to
		 enable	these instructions for assembly.

		 __________________________________________________________
		 BOUND reg, mem		 Detect	value out of range
		 ENTER immed16,	immed8	 Enter procedure
		 INS mem, DX		 Input string from port	DX
		 INSB mem, DX		 Input byte string from	port DX
		 INSW mem, DX		 Input word string from	port DX
		 LEAVE			 Leave procedure
		 OUTS DX, mem		 Output	byte/word/string to port DX
		 OUTSB DX, mem		 Output	byte string to port DX
		 OUTSW DX, mem		 Output	word string to port DX
		 PUSHA			 Push all registers
		 POPA			 Pop all registers


		 A.6  286 Protected Instruction	Mnemonics
		 The 286 protected instruction set consists of	all
		 8086  and  286	non-protected instructions plus	the
		 following instructions.  The .286p  directive	can
		 be used to enable these instructions for assembly.

		 Syntax		   Action
		 ____________________________________________________________
		 ARPL mem, reg	   Adjust requested privilege level
		 CLTS		   Clear task switched flag
		 LAR reg, mem	   Load	access rights
		 LGDT mem	   Load	global descriptor table	(8 bytes)
		 LIDT mem	   Load	interrupt descriptor table
		 LLDT mem	   Load	local descriptor table
		 LMSW mem	   Load	machine	status word



							       A-11


















	      XENIX Macro Assembler Reference Manual



	      LSL reg, mem	Load segment limit
	      LTR mem		Load task register
	      SGDT mem		Store global descriptor	table (8 bytes)
	      SIDT mem		Store interrupt	descriptor table (8 bytes)
	      SLDT mem		Store local descriptor table
	      SMSW mem		Store machine status word
	      STR mem		Store task register
	      VERR mem		Verify read access
	      VERW mem		Verify write access



	      A.7  287 Instruction Mnemonics

	      The 287  instruction  set	 consists  of  all  8087
	      instructions   plus   the	  following   additional
	      instructions.  The .287 directive	can be	used  to
	      enable these instructions	for assembly.

	      ___________________________________________________
	      FSETPM		Set Protected Mode
	      FSTSW  AX		Store Status Word in AX	(wait)
	      FNSTSW  AX	Store Status Word in AX	(no-wait)



















	      A-12























		 Appendix A


		 Instruction Summary
		 __________________________________________________



		 A.1  Introduction  A-1

		 A.2  8086 Instructions	 A-2

		 A.3  8087 Instruction Mnemonics  A-8

		 A.4  186 Instruction Mnemonics	 A-11

		 A.5  286 Non-Protected	Instruction Mnemonics  A-11

		 A.6  286 Protected Instruction	Mnemonics  A-12

		 A.7  287 Instruction Mnemonics	 A-12



































