This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:multiasm:papc:chapter_6_10 [2025/10/31 14:33] – [Transcendental instructions] ktokarz | en:multiasm:papc:chapter_6_10 [2025/10/31 16:28] (current) – [Table] ktokarz | ||
|---|---|---|---|
| Line 165: | Line 165: | ||
| The transcendental instructions perform calculations of advanced mathematical functions. | The transcendental instructions perform calculations of advanced mathematical functions. | ||
| The **fsin** instruction calculates the sine, while the **fcos** calculates the cosine of the argument stored in ST(0). The **fsincos** calculates both sine and cosine with the same instruction. The sine is returned in ST(1), the cosine in ST(0). The **fptan** instruction calculates the partial tangent and **fpatan** the partial arctangent. After calculating the tangent, the value of 1.0 is pushed onto the stack to make it easier to calculate cotangent afterwards by execution **fdivr** instruction. The partial means that this instruction handles only a limited range of input arguments. | The **fsin** instruction calculates the sine, while the **fcos** calculates the cosine of the argument stored in ST(0). The **fsincos** calculates both sine and cosine with the same instruction. The sine is returned in ST(1), the cosine in ST(0). The **fptan** instruction calculates the partial tangent and **fpatan** the partial arctangent. After calculating the tangent, the value of 1.0 is pushed onto the stack to make it easier to calculate cotangent afterwards by execution **fdivr** instruction. The partial means that this instruction handles only a limited range of input arguments. | ||
| - | FPTAN Partial tangent. | + | The instructions for exponential and logarithmic functions are summarised in table {{ref> |
| - | FPATAN Partial arctangent. | + | <table ftrans> |
| - | F2XM1 2x − 1. | + | < |
| - | FYL2X y∗log2x. | + | ^ Mnemonic |
| - | FYL2XP1 | + | | **f2xm1** |
| + | | **fyl2x** | ||
| + | | **fyl2xp1** | ||
| + | </ | ||
| + | |||
| + | ===== FPU control instructions ===== | ||
| + | The FPU control instructions help the programmer to save and restore the contents of chosen registers if there is a need to use them in an interrupt handler or inside a function. It is also possible to initialise the state of the FPU unit or clear errors. | ||
| + | The **fincstp** increments and **fdecstp** decrements the FPU register stack pointer. | ||
| + | The following set of instructions can perform error checking while execution (instructions without " | ||
| + | The **finit** and **fninit** initialise the FPU (after checking error conditions or without checking error conditions). | ||
| + | The **fclex** and **fnclex** clear floating-point exception flags. | ||
| + | The **fstcw** and **fnstcw** store the FPU control word. | ||
| + | The **fldcw** loads the FPU control word. | ||
| + | The **fstenv** and **fnstenr** store the FPU environment. The environment consists of the FPU control word, status | ||
| + | word, tag word, instruction pointer, data pointer, and last opcode register. | ||
| + | The **fldenv** loads the FPU environment. | ||
| + | The **fsave** and **fnsave** save the FPU state. The state is the operating environment and full register stack. | ||
| + | The **frstor** restores the FPU state. | ||
| + | The **fstsw** and **fnstsw** store the FPU status word. There is no instruction for restoring the status word. | ||
| + | The **wait** or **fwait** waits for the FPU to finish the operation. | ||
| + | The **fnop** instruction is the no operation instruction for the FPU. | ||