flat assembler
Message board for the users of flat assembler.

 Index > OS Construction > ..
Author
pool

Joined: 08 Jan 2007
Posts: 97
pool 12 Mar 2008, 11:41
..

Last edited by pool on 17 Mar 2013, 11:44; edited 1 time in total
12 Mar 2008, 11:41
edfed

Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 12 Mar 2008, 11:49
first, it is not shl 2 and shr 2 but shl 1 and shr 1. due to the binary numeral system. shl and shr on base 10 numbers will divide and mul by power of 10

second, for square root, log, cos, sin, there is no easy binary way similara to shr ans shl

third, it is not the place to speak about. here, it is os construction, and this speak about a main or heap subject.
12 Mar 2008, 11:49
bitRAKE

Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 12 Mar 2008, 12:20
square root is more complicated:
Code:
```Sqrt:   xor ecx,ecx
xor eax,eax
bsr edx,[esp+4]
je .x
and edx,-2      ; even
bts ecx,edx

sub [esp+4],eax
jnc .1
sub eax,ecx
jmp .2

.2:     shr eax,1
shr ecx,2
jne .0
.x:     retn 4
; EAX = square root    ```

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
12 Mar 2008, 12:20
pool

Joined: 08 Jan 2007
Posts: 97
pool 24 Mar 2008, 03:59
..

Last edited by pool on 17 Mar 2013, 11:44; edited 1 time in total
24 Mar 2008, 03:59
edfed

Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 24 Mar 2008, 11:37
for that, don't try square root.
the square is enough to know the distance.

and in 3D, the principle is to simplify the equation, then, the algo will be little.

x2D = k (x/z)
y2D = k (y/z)
24 Mar 2008, 11:37
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum