Hi all

My math is really getting rusty.

How do I do X^Y. The formula will do, but if you have a fpu example :alright:

KetilO
Posted on 2002-09-12 07:06:02 by KetilO
Here and here :)
Posted on 2002-09-12 07:12:42 by Eóin
Hi E?in

Thanks

KetilO
Posted on 2002-09-12 07:45:00 by KetilO
<<but if you have a fpu example >>
``````
This bit to be done just once to calculate the mask..
!fstcw   SaveCW&        ;save a copy of the initial control word so it can be put back
``````

``````
!fld y#                 ;push the 2 operands onto the FP stack
!fld x#
!fyl2x                  ;Compute y*lg(x)

!fldcw   MaskedCW&      ;Modify the control WORD TO truncate when rounding
!fld     st(0)          ;Duplicate top of stack
!frndint                ;Compute INTEGER portion.
!fsubr    st(0), st(1)  ;Compute fractional part.

!f2xm1                  ;Compute 2**FRAC(x)-1.
!fld1

!fscale                 ;Compute 2**INT(x) * 2**FRAC(x).

!fldcw   SaveCW&        ;Restore rounding mode.

!fstp XtoY#             ;pop the answer off the FP stack
!fstp  st(0)            ;clean up the stack (there's 1 value left on it)
``````
Posted on 2002-09-14 05:23:16 by pdixon

<<but if you have a fpu example >>
``````
!fld y#                 ;push the 2 operands onto the FP stack
!fld x#
!fyl2x                  ;Compute y*lg(x)

!fldcw   MaskedCW&      ;Modify the control WORD TO truncate when rounding
!fld     st(0)          ;Duplicate top of stack
!frndint                ;Compute INTEGER portion.
!fsubr    st(0), st(1)  ;Compute fractional part.

!f2xm1                  ;Compute 2**FRAC(x)-1.
!fld1

!fscale                 ;Compute 2**INT(x) * 2**FRAC(x).

!fldcw   SaveCW&        ;Restore rounding mode.

!fstp XtoY#             ;pop the answer off the FP stack
!fstp  st(0)            ;clean up the stack (there's 1 value left on it)
``````

Looks like PowerBASIC inline assembly :)
Posted on 2002-09-14 05:27:09 by bazik
PowerBASIC is all I have.
Posted on 2002-09-14 05:46:22 by pdixon
Most assemblers are free mate.
Posted on 2002-09-14 05:49:46 by Dracton
PowerBASIC is all I have.
Posted on 2002-09-14 06:05:34 by pdixon
Hey,

I think you may be on the wrong board. This board covers topics related to Assembler programming. It does not cover PowerBasic, PROLOG, C, C++, HTML, JavaScript, or any other language, other than Assembler.

I recommend trying goolge.com, and searching for PowerBasic related message boards, or/and websites. Their are quite alot of websites on the net, and if the language you require help with, is a popular language, then am sure their are tutorials and example code to help you out.

If you are interested in starting out in WinAssembler, then I recommned going to win32asm.cjb.net and downloading the MASM32 package. If you don't already know assembler, then you should attempt to learn it first, before moving onto windows development. also, I'd download the complete set of tutorials (which are packed in a .zip file) to aid you in learning the methods of developing a windows application, in the assembler langauge. These can also be found at win32asm.cjb.net
Posted on 2002-09-14 06:07:14 by Dracton
I didn't repeat that last post! I clicked "back" on my browser and IE reposted it.. .

I know a lot of the assemblers are free but I don't do a lot of x86 stuff and to learn yet another piece of software that's only going to be used once every few months isn't worth it.. yet.

I'll stick with PowerBASIC and it's built in assembler (it's ok, but not good as modern opcodes aren't implemented).
Posted on 2002-09-14 06:15:07 by pdixon
Dracton,
I didn't bring up PowerBASIC. I posted an ASM snippet in reply to the original question.
Posted on 2002-09-14 06:17:41 by pdixon
Hey,

Yes, i am sorry, I didn't realise that you'd repeated your post twie by mistake. IE can be a pain in the back side some times (or all the time !!) ....

I thought you where just a newbie (like me) who had stumbled onto the boards like a drunken man stumbling home with confusion ... :)

Indeed you did say PowerBASIC is all you have, so again, I thought you where on the wrong boards ...

If the question you have is infact, an Assembler one, then by allmeans post, but if its related to PowerBASIC, then you really need to find a PowerBASIC board :)

Sorry for the mix up :)
Posted on 2002-09-14 06:22:23 by Dracton