flat assembler
Message board for the users of flat assembler.

Index > Main > Floating problems

Author
Thread Post new topic Reply to topic
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica 08 Nov 2003, 12:18
When I try to compile this line:
Code:
    glCall2 glNormal3f, x, y, (z+d)    ; Normal Pointing Towards Viewer    

I get this
Error: "invalid value"
Instruction:
name=(0.0f+1.0f)

(it's in the push macro called by tge glCall2 macro, it's the first line: "name = GLfloatVar", where GLfloatVar is the argument)

Why is it invalid, is it because fasm can't make computations on float vars?

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 08 Nov 2003, 12:18
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 08 Nov 2003, 13:50
scientica wrote:
Why is it invalid, is it because fasm can't make computations on float vars?

That's right.
This is design flaw that comes form the fact, that I wanted fasm to run on 386 machines (as I myself was using it on such computers), so I couldn't use any FPU instructions. I could anyway write routines for such calculations as I wrote the routine for string to float conversion, but it's a bit much of work... Sad
Post 08 Nov 2003, 13:50
View user's profile Send private message Visit poster's website Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica 08 Nov 2003, 15:25
Privalov wrote:
This is design flaw that comes form the fact, that I wanted fasm to run on 386 machines (as I myself was using it on such computers), so I couldn't use any FPU instructions. I could anyway write routines for such calculations as I wrote the routine for string to float conversion, but it's a bit much of work... Sad

Ok, I see, the only float calculation I need now is addition (possibly subtraction - depends on wheter one can add the compliment instead).
I'd apriciate basic addition/subtraction for floats, the rest (mul,div, etc) isn't of any greater importance now (anyway that could be fixed later via macros if addition works (a teacher has told me that every mathematical operation can be broken down to only additions)).

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 08 Nov 2003, 15:25
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 09 Nov 2003, 02:50
Is it hard to make string to float routine without use of FPU?

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 09 Nov 2003, 02:50
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
inskipp



Joined: 23 Jun 2003
Posts: 25
Location: Poland
inskipp 09 Nov 2003, 12:09
It isn't very hard.
You can find an example at http://www.programmersheaven.com/zone5/cat18/1369.htm
It's old, 16-bit code, but good commended.
Post 09 Nov 2003, 12:09
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 09 Nov 2003, 12:23
In fasm I have used "very high precision" floating point format, just to make sure you'll get the best precision even when defining twords (this internal 16-byte format is later converted into appropriate IEEE format depending on data instruction with which it's used) - and this complicated the things a bit. The whole conversion procedure it's in EXPRESSI.INC file, labelled "get_fp_value" - it includes subroutines for adding such FP values, and for multiplying or dividing them by integer value.
Post 09 Nov 2003, 12:23
View user's profile Send private message Visit poster's website Reply with quote
Crunch



Joined: 09 Dec 2003
Posts: 10
Crunch 09 Dec 2003, 17:12
Privalov,

How painful would it be to add support for FPU instructions in the future? Rolling Eyes
Post 09 Dec 2003, 17:12
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 09 Dec 2003, 17:21
What do you mean? fasm has got support for FPU instructions, it is only that it doesn't use them itself.
Post 09 Dec 2003, 17:21
View user's profile Send private message Visit poster's website Reply with quote
Crunch



Joined: 09 Dec 2003
Posts: 10
Crunch 09 Dec 2003, 17:37
Doh!

Should have picked the username "Homer Simpson"!

Stupid me, I've been sitting on the sidelines with the mistaken impression that I couldn't use hardware FPU instructions with FASM.

Maybe it's time for me to download it and spend the time to actually use it Embarassed

I use so many other tools (not an assembler for a while though) and am hestitant to confuse my poor old brain with new stuff until it becomes obvious that I've waited too long to start using the right tool.
Crying or Very sad

I've been following FASM for quite a while and guess now is as good of a time as any to jump in and feel more stupid than I think I am to learn a new (yet a least good) tool. Doh! Wink

Thanks for your patience and all the hard work. Very Happy
Post 09 Dec 2003, 17:37
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.