From 37f7978b517e2f00243703d510a6a53d4ea56f1e Mon Sep 17 00:00:00 2001 From: scratko Date: Thu, 28 Mar 2024 02:58:37 +0300 Subject: added readme --- README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 README.md (limited to 'README.md') 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) + + + +## 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. -- cgit v1.2.3