Acute Angle

This is a discussion on Acute Angle within the Tech Board forums, part of the Community Boards category; I am given a assembly code which minimizes an infinitely large radian acute angle. But I am confused with how ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    83

    Acute Angle

    I am given a assembly code which minimizes an infinitely large radian acute angle. But I am confused with how the fpu works. I fairly know about the general registers and other generic opcodes.

    I read from a book "The Art of Assembly Language" that fmulp multiplies and stores the result in second operand and then pops st(0). But the following code totally does not seem to follow this rule or else I am confused.

    Code:
    // fHalf = 0.5f
    // the previous value required to be computed is already at the fpu stack here
    fldpi //loads PI value into st(0)
    fxch st(1) // exchange st(1) and st
    loop:
    fld fHalf
    fmulp st(1), st // What does this do now?
    fprem
    fnstsw, ax // store status register into ax
    test ax, 0x400 // test if C2 flag is set (exceeds range or not)
    jnz loop
    fstp st(1) // pop the PI
    retn

    Page 395
    The fmulp( st0, sti ) instruction computes sti := sti * st0 and then pops
    ST0. This instruction uses the value for STi before popping ST0. The fmul( mem )
    instruction requires a 32- or 64-bit memory operand. It converts the specified
    memory variable to an 80-bit extended-precision value and then multiplies
    ST0 by this value.
    Last edited by Swoorup; 06-08-2012 at 11:46 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Angle between vectors
    By Eman in forum Game Programming
    Replies: 19
    Last Post: 02-22-2011, 03:02 PM
  2. right angle triangle help
    By jackalope in forum C Programming
    Replies: 7
    Last Post: 10-08-2010, 08:37 PM
  3. Angle of Trajectory?
    By napkin111 in forum Game Programming
    Replies: 3
    Last Post: 12-18-2003, 01:09 PM
  4. Angle/Trajectory
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 12-17-2003, 07:05 PM
  5. Angle of approach for C++
    By mepaco in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-13-2002, 07:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21