wmdots: Move files up one directory.
[dockapps.git] / wmdots / old_dos_demo / trig.s
blob0917017b85dd9a753da623dd1b1f8d23ab1ada6b
1 ;=========================================================================
2 ;Trig functions for GFX routines Copyright (c) 1995 by Mark I Manning IV
3 ;=========================================================================
5 CosTab equ SinTab+0800 ;A Right angle foreward in table!
7 ;-------------------------------------------------------------------------
9 ;Return Sin and Cos of angle AX in variables of same name
11 SinCos:
12 and ax,0fff ;4096 degrees = 0 degrees
13 mov bx,ax ;Put into an indexing reg
14 add bx,bx
15 mov ax,SinTab[bx] ;Get Sin(N)
16 mov Sin,ax ;Bah no MOV Sin,[BX]... Crap processor!
18 ;Note.
19 ; Can NOT use mov ax,SinTab[2*ebx] because in following code BX may go
20 ; negative and 2* a negative number = DOUBLY NEGATIVE!
22 cmp bx,01800 ;Was Sin(N) in last quadrant of circle?
23 if nl sub bx,02000 ;Cos(N) must be in first quadrant then
24 mov bx,CosTab[bx] ;Get Cos(n)
25 mov Cos,bx ;Exits with Sin in AX and Cos in BX too!
26 ret
28 ;=========================================================================