diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..80add1a --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# Trigonometric functions table generator (assembler NASM) + +<img scr="trigonometric-table.png" /> + +## Introduction + +The table generator that contains values of trigonometric functions for given +angles. This program saves the result to a file. + +Trigonometric functions: + +- sine +- cosine +- tangent +- cotangent + +## Implementation (TL;DR) + +Floating point arithmetic is implemented via an arithmetic coprocessor. + +It is a kind of stack of its own registers R0, R1, ..., R7. Each of the +registers can be the top of the stack (indicated by ST0). + +The coprocessor uses its own commands for data exchange (e.g., load to the top +of the stack, also called register, fild), state flag registers (CR, SR, TW), +commands for arithmetic operations (fsin, fcos, fptan). + +Fptan calculates a value in a very interesting way: it places 1 on the top of +the stack (ST0), and places the result (the tangent value) behind the top (ST1). + +That is done to simplify the calculation of cotangent ($`1/tang`$). + +Therefore, we divide ST0 by ST1 using the fdivp command, and the result is +written to the top of the stack. + +## Building + + +``` +git clone https://git.scratko.xyz/trigonometric-table +cd trigonometric-table +make +``` + +## Usage + +After executing above commands: + +``` +./trigonometric-table <1st> <2nd> <3rd> <4th> +``` + +Where: + +- <1st> name of a file +- <2nd> initial angle +- <3rd> final angle +- <4th> distance step + +In the same directory there will be the file with the result. |