Sie sind auf Seite 1von 144

CN 303 MICROPROCESSOR AND MICROCONTROLLER

Lecture#10 8087 Arithmetic Coprocessor

Numeric Data Processor


The instruction set of 8086 microprocessor is not optimized for; 1. Complex numerical calculations 2. CRT graphics manipulation 3. Or word processing Therefore Intel has developed 8087 numeric data processor(NDP) specially designed to perform arithmetic operations efficiently.

8087 Features
1. Can handle integer,decimal and real data types with lengths ranging from 2 to 10 bytes. 2. Its instruction set not only includes various forms of addition and substraction but also useful functions such as square root , exponential , tangent and so on. 3. It can multiply two 64 bit real numbers in about 27s and calculate square root in about 36 s.

8087 Features
4. It follows IEEE floating point standard. 5. It is multi-bus compatible.

8087 Pin outs


Fig 10.1 shows pin diagram of 8087. Address/data,status,ready,reset,clock,power and ground pins are similar to the 8086 pins. Among the 8 remaining pins 4 are not used. Other pins are as follows:

Fig 10.1 8087 Pin outs

8087 Pin functions


BUSY output
This pin is connected to TEST input of the 8086. User can tell the 8086 to wait for some computation that the 8087 is doing before executing the next instruction with a WAIT instruction(which causes the 8086 to keep looking at its TEST pin until the pin is low) A low on the 8087 BUSY output indicates that the 8087 has completed the computation.

087 Pin functions


RQ/GT0
This request/grant signal is usually connected to the (RQ/GT0 or RQ/GT1) pin of the 8086.

RQ/GT1
This request/grant signal is usually connected to the request/grant pin of the independent processor such as 8089.

INT
The interrupt pin is connected to the interrupt management logic. The 8087 interrupts the 8086 through this at the time error condition exits.

087 Pin functions


S0-S2
These are the status bits of 8087 which are encoded as follows:
S2 S1 S0 Status

0
1 1 1 1

X
0 0 1 1

X
0 1 0 1

-unused
-unused -Read memory -Write memory -passive

087 Pin functions


QS0-QS1
These signals give the queue status as follows:

QS1 O 0

QS0 1 1

Operation No operation First byte of opcode from queue

1 1

0 1

Queue empty Subsequent byte from the queue

8087 Circuit Connection


Fig 10.2 shows the circuit connection for 8087 with 8086. First note that:The MN/MX pin is grounded,so the 8086 is operating in its maximum mode. Remember in max mode control signals are on the status lines S2,S1 and S0 and the queue status lines QS1 and QS0.

Fig 10.2 8087 Circuit connection

8087 Circuit Connection


As shown the external controller 8288 decodes these status signals to produce the control signals. These status signals also go directly from the 8086 to the 8087. The upper address lines A16-A19 are also connected directly from the 8086 to the 8087.

8087 Circuit Connection


The 8087 receives the same clock and reset signals. Bus request/grant signal from 8087 is connected to RQ0 / GT0 or RQ1/GT1 signal of the 8086. BUSY signal from the 8087 is connected to the TEST input of the 8086. If the 8086 must not execute further instructions until the 8087 finishes the computation we tell the 8086 with the WAIT instruction, so that it keeps looking at its TEST pin until it finds the pin low.

8087 Circuit Connection


A low on the TEST(or BUSY) pin indicates that the 8087 has completed the computation.

Interaction between 8086 and 8087


Though the 8087 is an actual processor and has its own instruction set. Both 8086 and 8087 execute their instructions from the same program. As the 8086 fetches instructions from memory and puts them into its internal queue,the 8087 also reads these instruction and puts them in its internal queue.

Interaction between 8086 and 8087


The 8087 decodes instruction from its queue,when it finds that it is an 8086 instruction ,it simply treats it as a NOP. Likewise,when the 8086 decodes instruction from its queue and it finds that it is an 8087 instruction ,it simply treats it as a NOP.Or in some cases reads one additional word from memory for 8087.

Interaction between 8086 and 8087


Each processor decodes all instructions but only executes its own instructions. 8087 and 8086 instructions are differentiated by code 11011. 8087 instruction codes have 11011 as the most significant bits of their first code byte.

Interaction between 8086 and 8087


An instruction to be executed by 8087 is indicated when an ESC instruction appears in the program. Track of ESC instruction is gained by monitoring the 8086 S2-S0 ,QS0-QS1 and AD0-AD15. If the Q status is 00,8087 does nothing.

Interaction between 8086 and 8087


If the Q status is 01 it compares the five MSB bits with 11011,if there is a match then an ESC instruction is fetched and executed by both , and 8087 will perform the indicated operation. If no match this byte is ignored and deleted from the queue. If an error occurs during decoding an ESC instruction,8087 sends an interrupt request.

Interaction between 8086 and 8087


When 8086 reads an 8087 instruction that reads data from or writes data to memory the 8086 sends the memory address coded in the instruction on the address bus and activates appropriate memory-read or memory-write signals to transfer a word of data. The 8087 grabs the data and executes the instruction ,at the same time the 8086 ignores the data.

Fig.10.3 Interaction between CPU and COP

Interaction between 8086 and 8087


If the 8087 needs more than on word,when the 8086 outputs the address of the first data word on the address bus and appropriate memory-read or memory-write control signal;
1. The 8087 first reads the data put on the data bus by memory or writes a data word on the data bus, 2. It grabs the 20-bit physical address that was send by the 8086. 3. Then takes over the buses from the 8086.

Interaction between 8086 and 8087


How does it take over the bus?
8087 sends a low-going pulse on its RQ/GT0 pin,8086 responds by sending another low going pulse back to the RQ/GT0 pin of the 8087 and by floating its buses. 4. The 8087 then it increments the grabbed address during the first transfer and outputs the incremented address on the address bus plus memory-read or memory-write control signals to transfer data

Interaction between 8086 and 8087


5. It continues STEP 4 until it receives/sends all the data word required by the instruction. 6. When it finishes its data transfer,it sends another low-going pulse on RQ/GT0 to return bus control to 8086 . 7. During execution it asserts BUSY pin high and asserts BUSY pin low.The 8086 uses this through TEST pin with the help of WAIT instruction to see if 8087 computation is complete.

The 8087 Architecture


The internal architecture is shown in Fig. 10.4(next slide)

Instruction queue
Maintains a 6 byte instruction queue and tracks the execution sequence of the host. If the current host instruction is an ESC instruction , the 8087 decodes the external op-code to perform the specified operation and captures the operand address. Other instructions are ignored by 8087.

Data registers
It has 8 data registers each is 80-bits wide and is accessed as a stack. An operand may be pushed or popped from top of stack. A PUSH operation decrements TOP of stack by 1 a loads the a value into the new TOP of stack register. A POP operation stores the a value from the current TOP of stack register and then increments TOP of stack by 1. The top of stack register is pointed by ST bits.(bits 13,12 and 11 of the status register).

Status register
It is a 16-bit register. It reflects the overall state of the 8087. It ;
1. indicates various errors, 2. indicates condition codes for certain instructions, 3. specifies which register is at the top of stack and 4. indicates BUSY status.

Status register
Fig 10.5 shows bit definitions of the Status Register. Error Flags;
IE : Indicates invalid operation such as stack overflow , stack underflow , invalid operand , square root of ve number etc. DE : The operand is not normalized. ZE : A divide by zero error. JE : An exponent overflow error(biased exponent is too small)

Fig 10.5 bit patterns of the Status Register

Status register
PE : A precision error , the result cannot be represented in the designated format and hence is rounded off.

Interrupt Flag IR : Indicates the existence of the interrupt request. Condition code
C0-C3 indicate the condition code,its set by the compare and examine instructions(discussed later).

Status register
Stack bits
ST:S0-S1 indicate the top of stack register.

Busy status
B:Indicates current operation is not completed.

NOTE THAT:
After the 8087 is reset or initialized , all status bits except the condition code are cleared.

Control register
It is also 16 bit. Gives the opportunity to select several processing options provided by 8087 by loading a word from memory into a control register. Through this register one can mask each error type individually from causing an interrupt.

Control register
Furthermore it can be used to set precision levels , rounding type and infinity representation. Fig. 10.6 shows the bit definition of control register.

Fig. 10.6 bit pattern of control register

Control register
Lower order byte configures 8087 interrupts and exception masking. Bits 5-0 contain individual masks for each of the six exceptions recognized by 8087. Bit 7 is general mask bit for all 8087 interrupts. High order byte configures the 8087 operating mode including precision , rounding and infinity.

Control register
After reset or initialization of 8087 ,PC=11,RC=00,IC=0,IEM=0 and all error mask bits are 1.

Tag register
TAG register holds the status of the contents of data register. This includes;
00-Data Valid 01-Zero 10-A special value i.e NAN(Not A Number),infinity or denormal. 11-Empty

Data Formats and Conversions


The 8087 can operate on memory operands of seven different data types;
1. 2. 3. 4. 5. 6. 7. Word integer Short integer Long integer Packed BCD Short real Long real Temporary real

Data Formats and Conversions


Fig 10.7 shows number of bytes , format and approximate range of each of these data types. Data arrangement in the memory;
Least significant byte at the lowest address

Seven data types discussed(previous slide) are categorized as;


1. Fixed point numbers or 2. Floating point numbers

Fig 10.7:Data Formats of NDP 8087

Data Formats and Conversions


Fixed point numbers;
Are referred as Signed integer or BCD numbers bse they dont have any information about decimal point in the number. The decimal point is always assumed to be to the right of the least significant digit , so all numbers in this format are whole numbers with no fractional part.

Data Formats and Conversions


Floating point numbers;
Are all number with the integer part and the fractional part. These numbers automatically keeps track of the position of decimal number.

Data Formats and Conversions


A real format is divided into three fields:
1. Sign(0-positive and 1-negative) 2. Exponent 3. Mantissa

Formula for finding the final value of a real number;


n=sign x 2exp x mantissa Where n:final value

Data Formats and Conversions


The 8087 recognizes three real data types:
1. Short real(32-bit) 2. Long real(64-bit) 3. Temporary real(80-bits)

Do these to understand more about Real number representations by 8087


1. Convert 1259.12510 to short real , long real and temporary real format. 2. Convert -307.187510 to short real , long real and temporary real format. 3. Convert 0.062510 to short real , long real and temporary real format.

IMPORTANT NOTICE
1. An exponent with all 1s is reserved to represent infinity or not a number (NAN). 2. An exponent with all 0s plus a sign bit of 0 is reserved to represent +0. 3. An exponent with all 0s plus a sign bit of 1 is reserved to represent -0(a denormal). 4. The 8087 works internally with all numbers in the 80-bit temporary real format(1 bit for sign,15 bits for exponent and 64 bits for the mantissa). 5. Temporary real format reduce chances for overflows and underflows during series of calculations which produce final range within desired range.

Stack in 8087
The 8087 has a 3-bit stack pointer which holds the number of the register which is the current top-of-stack. During initialization the stack pointer is loaded with 000 implying that register 0 is top-of-stack. As shown in fig.10.8,the stack of 8087 is circular.

Fig. 10.8:Register stack in 8087

Stack in 8087
So , decrementing 000 changes the top-ofstack register to 111. When the 8087 reads the first number,stack is decremented to 111 and the number is stored in register number 111 making register 111 the top-of-stack. In the 8087 instructions the register that is currently top-of-stack is referred as ST(0),or simply ST.

Stack in 8087
The next to ST(0) is referred as ST(1). We can all agree that : If we pop one number from the stack the stack pointer will point to ST(1).

8087 Instruction set


The 8087 instructions are distinguished from 8086 instructions by letter F which stands for floating point number. 8087 has 68 instructions,which can be divided into six groups;
1. Data transfer instructions 2. Arithmetic instructions 3. Compare instructions

8087 Instruction set


4. Transcendental instructions 5. Load constant instructions 6. Processor control instructions

Data Transfer Instructions


Data transfer instructions are divided to; 1. Real data transfer 2. Integer data transfer 3. Packed decimal data transfer

Real data transfer


The FLD Instruction Decrements the stack pointer by one and copies a real number from a stack element or memory location to the new ST. A short-real or long real number from memory is automatically converted to temporary real format by the 8087 before it is put in ST.

Real data transfer


Format
FLD source;

Examples;
FLD ST(2) ;Copies ST(2) to ST FLD [BX] ;Number from memory pointed ;by BX copied to ST

Real data transfer


The FST Instruction Copies ST to a specified stack position or to a specified memory location. Exceptions : I,O,U,P

Real data transfer


Format
FST destination;

Examples;
FST ST(3) ;Copies ST to ST(3) FST [BX] ;Number from ST is copied to memory location pointed by BX

Real data transfer


The FSTP Instruction Copies ST to a specified stack element or memory location and increments the stack pointer by one to point to the next element on the stack. This is a stack POP operation. Exceptions : I

Real data transfer


Format
FSTP destination;

Examples;
FSTP ST(3) ;Copies ST to ST(3) FSTP [BX] ;Number from ST is copied to memory location pointed by BX

Real data transfer


The FXCH Instruction Exchanges the contents of ST with the contents of a specified stack element. If no destination is specified , then ST(1) is used. Exceptions : I

Real data transfer


Format
FXCH destination;

Examples;
FXCH ST(4) ;Swap ST and ST(4)

Integer data transfer


The FILD Instruction Integer load : Converts integer number from memory to temporary-real format and pushes converted number on 8087 stack. If no destination is specified , then ST(1) is used. Exceptions : I

Integer data transfer


Format
FILD source;

Examples;
FILD DWORD PTR [BX] ;Short integer from ;memory location ;pointed by [BX]

Integer data transfer


The FIST Instruction Integer store : Converts number from ST to integer form, and copies it to memory.
Exceptions : I,P

Integer data transfer


Format
FIST destination;

Examples;
FIST INT_NUM ;ST to memory locations ;named INT_NUM

Integer data transfer


The FISTP Instruction Integer store and pop . Converts number from ST to integer form, and copies it to memory, then the stack pointer is incremented after copy.
Exceptions : I,P

Integer data transfer


Format
FISTP destination;

Examples;
FISTP INT_NUM ;ST to memory locations ;named INT_NUM

Packed decimal transfer


The FBLD Instruction Packed decimal (BCD) load. Convert a number from memory to temporary-real format and push on top of 8087 stack.
Exceptions : I

Integer data transfer


Format
FBLD source;

Examples;
FBLD AMOUNT ;Ten byte BCD number form ;memory location ;AMOUNT to ST

Packed decimal transfer


The FBSTP Instruction Packed decimal (BCD) store in memory and pop 8087 stack. Pops temporary-real from stack , converts to 10-byte BCD, and stores result to memory.
Exceptions : I

Packed decimal transfer


Format
FBSTP destination;

Examples;
FBSTP MONEY ;Contents from top stack are ;converted to BCD and stored ;in memory

Arithmetic instructions
Can be divided to;
1. 2. 3. 4. 5. 6. Addition Subtraction Reversed subtraction Multiplication Division Other arithmetic operations

Addition arithmetic instructions


The FADD Instruction Adds real number from specified source to real number at specified destination. Source can be stack element or memory location. If no source or destination is specified,then ST is added to ST(1) and the stack pointer is incremented so that the result of the addition is at ST.

Addition arithmetic instructions


Exceptions : I,D,O,U,P Format
FADD destination , source ;

Examples;
FADD ST(2),ST ; Add ST to ST(2),result in ST(2) FADD ST,ST(5) ; Add ST(5) to ST , result in ST FADD SUM ; Real number from memory + ST FADD ;ST+ST(1),pop stack-result at ST

Addition arithmetic instructions


The FADDP Instruction Adds ST to specified stack element and increment stack pointer by one.
Exceptions : I,D,O,U,P Format
FADD destination , source ;

Examples;
FADD ST(2) ; Add ST(2) to ST ;Increment stack pointer so ST(2) ;becomes ST

Addition arithmetic instructions


The FIADD Instruction Adds integer from memory to ST,stores the result in ST.
Exceptions : I,D,O,P Format
FIADD source ;

Addition arithmetic instructions


Examples;
FIADD CARS_SOLD ; Integer number from ;memory + ST

Subtraction instructions
The FSUB Instruction Subtracts the real number from destination to real number at the source. Source can be stack element or memory location. If no source or destination is specified,then STis subtracted from ST(1) and the stack pointer is incremented so that the result is at ST.

Subtraction instructions
Exceptions : I,D,O,U,P Format
FSUB destination , source ;

Examples;
FSUB ST(3),ST ; ST(3)=ST(3)-ST FSUB DIFFERENCE ;ST=ST- Real number ;from memory FSUB ;ST=ST(1)-ST

Subtraction instructions
The FSUBP Instruction Subtracts ST from specified stack element and puts the result in the specified stack element,then it increments stack pointer by one.
Exceptions : I,D,O,U,P

Subtraction instructions
Format
FSUBP destination , source ;

Examples;
FSUB ST(2) ; ST(2)=ST(2)-ST ;Increment stack pointer so ST(1) ;becomes new ST

Subtraction instructions
The FISUB Instruction Subtracts integer stored in memory from ST and stores the result in ST.
Exceptions : I,D,O,P Format
FISUB source ;

Subtraction instructions
Examples;
FISUB DIFFERENCE ; ST=ST-Integer number ;from memory

Reversed subtraction
FSUBR destination,source FSUBRP destination,source FISUBR source These instructions operate same as the FSUB instructions described above except that these instructions subtract the contents of the destination from the contents of the source and put the result in the destination. NOTE : Normal FSUB subtracts source from destination.

Multiplication arithmetic instructions


The FMUL Instruction Multiply real number from specified source by real number from specified destination , and puts result in a specified stack element.

Multiplication arithmetic instructions


Exceptions : I,D,O,U,P Format
FMUL destination , source

Examples;
FMUL ST(2),ST ; ST(2)=ST x ST(2) FMUL ST,ST(5) ; ST= ST x ST(5)

Multiplication arithmetic instructions


The FMULP Instruction Multiply real number from specified source by real number from specified destination , puts result in a specified stack element ,and increment stack pointer by one. With no specified operands it multiplies ST(1) by ST and pops stack to leave result at ST.

Multiplication arithmetic instructions


Exceptions : I,D,O,U,P Format
FMULP destination , source

Examples;
FMULP ST(2) ; Multiplies ST(2) by ST ;Increment stack pointer so ST(1) ;becomes ST

Multiplication arithmetic instructions


The FIMUL Instruction Multiply integer from memory by ST,stores the result in ST.
Exceptions : I,D,O,P Format
FIMUL source ;

Multiplication arithmetic instructions


Examples;
FIMUL DWORD PTR [BX] ; Integer number from ;memory x ST and ;result in ST

Division arithmetic instructions


The FDIV Instruction Divides real number from specified destination by real number from specified source, and puts result in destination.

Division arithmetic instructions


Exceptions : I,D,Z,O,U,P Format
FDIV destination , source ;

Examples;
FDIV ST(2),ST ; ST(2)=ST(2)/ST

Division arithmetic instructions


The FDIVP Instruction Divides real number from specified destination by real number from specified , source puts result in destination,and increment stack pointer by one.

Division arithmetic instructions


Exceptions : I,D,O,U,P Format
FDIVP destination , source ;

Examples;
FDIVP ST(2),ST ; ST(2)=ST(2)/ ST ;Increment stack pointer so ST(1) ;becomes ST

Division arithmetic instructions


The FIDIV Instruction Divides ST by integer from memory,stores the result in ST.
Exceptions : I,D,Z,O,U,P Format
FIDIV source ;

Division arithmetic instructions


Examples;
FIDIV PERCENTAGE ; ST=ST/Integer number ;from memory result in ST

Reversed division
FDIVR destination,source FDIVRP destination,source FIDIVR source These instructions operate same as the FDIV,FDIVP and FIDIV instructions described above except that these instructions divide the source operand by the destination and put the result in the destination. NOTE : Normal division instructions divides destination to source

Other Arithmetic Operations


FSQRT instruction Contents of ST are replaced with its square root. Exceptions : I,D,P Format
FSQRT;

Example
FSQRT;ST=Square root of ST

Other Arithmetic Operations


FSCALE instruction Scales the number in ST by adding an integer value in ST(1) to the exponent of the number in ST. It provides fast way of multiplying by integral powers of two. Exceptions : I,O,U

Format
FSCALE;

Example
FSCALE ; Exponent in ST=Exponent in ;ST + Integer value in ST(1)

Other Arithmetic Operations


FPREM instruction Partial remainder.The contents of ST(1) are subtracted from the contents of ST over and over again until the contents of ST are smaller than the contents of ST(1). Exceptions : I,D,U

Other Arithmetic Operations


Format
FPREM;

Example
FPREM ; ST=ST-ST(1) until when ST<ST(1)

Other Arithmetic Operations


FRNDINT instruction Round number in ST to an integer.The round-control (RC) bits in the control word determine how the number will be rounded. Exceptions : I,P

Other Arithmetic Operations


Format
FRNDINT;

Example
FRNDINT ; Make ST an integer

Other Arithmetic Operations


FXTRACT instruction Separates the exponent and the significant parts of a temporary-real number in ST. After the instruction executes,ST contains a temporary-real representation of the significant of the number and ST(1) contains a temporary-read representation of the exponent of the number. Exceptions : I

Other Arithmetic Operations


Format
FXTRACT;

Example
FXTRACT ; ST=Significant number of ;temporary-real and ST(1)=exponent ;of temporary-real

Other Arithmetic Operations


FABS instruction Replaces ST by its absolute value. It simply makes the sign positive.
Exceptions : I

Other Arithmetic Operations


Format
FABS;

Example
FABS ; ST=absolute of ST

Other Arithmetic Operations


FCHS instruction Complements the sign of the number in ST.
Exceptions : I

Other Arithmetic Operations


Format
FCHS;

Example
FCHS ; ST sign=complement of the sign in ST

Compare instructions
Compares the contents of ST with contents of a specified or default source. The source may be another stack element or real number in memory. They set condition code bits C3,C2,C1 and C0 of the status word shown in Table 10.1. You can transfer the status word to memory with 8087 FSTSW instruction and then use 8086 instructions to determine the results of the comparison.

Compare instructions
Table 10.1 gives complete listing of each combination of condition code bits and their functions. Note that these bits have different meanings for different instructions, as indicated in table 10.1. The top of the stack is denoted as ST in this table.

Table 10.1 combination of condition code bits and their functions

Different compare instructions


FCOM source Compares ST with real number in another stack element or memory. Exceptions:I,D Examples
FCOM ST(4);Compares ST with ST(4) FCOM VALUE;Compares ST with real number ;in memory FCOM;Compares ST with ST(1)

Different compare instructions


FCOMP source Identical to FCOM except that the stack pointer is incremented by one after the compare operation. FCOMPP Compares ST with ST(1) and increments stack pointer by 2 after compare. Exceptions:I,D

Different compare instructions


FICOM source Compares ST to a short or long integer from memory. Exceptions:I,D Example
FICOM iVALUE;

Different compare instructions


FTST Compares ST with zero. FXAM Test ST to see if it is zero, infinity, unnormalized , or empty . Then it sets bits C3,C2,C1 and C0 to indicate result. Refer table 10.1 to see how bits are set. Exceptions : None.

Transcendental(Trig-nometric and Exponential) Instructions


FPTAN instruction Computes the values for ratio of Y/X for an angle in ST. The angle must be expressed in radians,and the angle must be in the range of 0<angle</4 NOTE : It does not work correctly for angles of exactly 0 and /4. Exceptions:I,P.

Transcendental(Trig-nometric and Exponential) Instructions


FPATAN instruction Computes the angle whose tangent is Y/X. X value must be in ST,and Y value must be in ST(1). X and Y must satify the inequality 0<Y<X< The resulting angle in radians replaces Y in the stack.

Transcendental(Trig-nometric and Exponential) Instructions


After the operation the stack pointer is incremented so the result is then ST. Exceptions:U,P.

Transcendental(Trig-nometric and Exponential) Instructions


F2XM1 instruction Computes the function Y=2x-1 for an x value in ST. The result ,Y , replaces x in ST. x must be in the range 0 x 0.5. Exceptions:U,P.

Transcendental(Trig-nometric and Exponential) Instructions


FYL2X instruction Calculates Y times the log to the base 2 of X or Y(log2X),X must be in the range of 0<X< and Y must be in the range - <X<+ . X must initially be in ST and Y must be in ST(1). The result replaces Y and then the stack is popped so that the result is then at ST. Exception : P.

Transcendental(Trig-nometric and Exponential) Instructions


FYL2XP1 instruction Computes the function Y times the log to the base 2 of (X+1) or Y(log2 (X+1). It almost identical to FYL2X except that it gives more accurate results when computing the log of a number very close to one.
Exception : P.

Instructions which load constants


These instructions simply push the indicated constant onto the stack. FLDZ-Push 0.0 onto stack. FLD1-Push +1.0 onto stack. FLDPI-Push the value of onto stack FLD2T-Push log of 10 to the base 2 onto the stack(log210)

Instructions which load constants


FLDL2E-Push log of e to the base 2 onto the stack(log2e) FLDLG2-Push log of 2 to the base 10 onto the stack(log102)

Processor control instructions


These are used for tasks such as;
Initializing the 8087 Enabling interrupts Writing the status word to memory

NOTE : They dont perform any computations.

Processor control instructions


FINIT/FNINT instruction No operand. Does the following;
1. 2. 3. 4. Initializes 8087. Disables interrupt output sets stack pointer register Sets default status

Processor control instructions


FDISI/FNDISI instruction No operand. Disables the 8087 interrupt output pin so that it cannot cause an interrupt when an exception(error) occurs. FENI/FNENI instruction No operand. Enables 8087 interrupt output so it can cause an interrupt when an exception occurs.

Processor control instructions


FCLEX/FNCLEX instruction Clears all of the 8087 exception flag bits in the status register. Un-asserts BUSY and INT outputs. No operand.

Processor control instructions


FINCSTP instruction Increment the 8087 stack pointer by one. No operand. FDECSTP instruction Decrement the 8087 stack pointer by one. No operand.

Processor control instructions


FLDCW source: Loads a control word from a memory location into the 8087 control register. It should be preceded by the FCLEX instruction to prevent a possible exception response if an exception bit in the status word is set. Example FLDCW [BX];Control register=Memory ;contents at BX

Processor control instructions


FSTCW/FNSTCW destination Copies the 8087 control word register to a memory location. You can determine its current value with 8086 instructions. Example FSTCW [BX]; contents at BX =Control ; register

Processor control instructions


FSTSW/FNSTSW destination Copies the 8087 status word from Status register to a memory location. You can check various status bits with 8086 instructions and take further action on the state of these bits. Example FSTSW [BX]; Memory contents at BX =ST

Processor control instructions


FSAVE/FNSAVE destination Copies the 8087 control word, status word , pointers and entire register stack to 94-byte area of memory. After copying all of this it initializes the 8087. Example FSAVE [DI+2];

Processor control instructions


ERSTOR source Copies a 94-byte area of memory into the 8087 control register , status register , pointer registers, and stack registers.

Processor control instructions


FSTENV/FNSTENV destination Copies the 8087 control register, status register , tag words, and exception pointers to a series of memory locations. It does not copy the 8087 register stack to memory as the FSAVE/FNSAVE instruction does. Example
FSTE NV [BX+DI];

Processor control instructions


FLDENV source Loads the 8087 control register, status register , tag word and exception pointers from a named area in memory. Example
FLDENV [BX];

Processor control instructions


FFREE destination Changes the tag for the specified destination register to empty. Example
FFREE ST(1);tag of ST(1)=empty

Processor control instructions


FNOP Performs no operation. Actually it copies ST to ST. FWAIT This is actually an 8086 instruction which makes the 8086 wait until it receives a not busy signal from the 8087 to its TEST pin.

Das könnte Ihnen auch gefallen