flat assembler
Message board for the users of flat assembler.

Index > OS Construction > ..

Author
Thread Post new topic Reply to topic
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 11:44; edited 1 time in total
Post 12 Mar 2008, 11:41
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
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.
Post 12 Mar 2008, 11:49
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2891
Location: [RSP+8*5]
bitRAKE
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

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

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

_________________
¯\(°_o)/¯ unlicense.org
Post 12 Mar 2008, 12:20
View user's profile Send private message Visit poster's website Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 11:44; edited 1 time in total
Post 24 Mar 2008, 03:59
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
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)
Post 24 Mar 2008, 11:37
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.