flat assembler
Message board for the users of flat assembler.

 flat assembler > Main > How create float structure ? Lets say df.
Author
Roman

Joined: 21 Apr 2012
Posts: 471
Fasm 1.73 have db, dw, dd ,dq, du
I want create df macro or struct. I'm so tired write after digits '.0'
Code:
df 1,2,3,34,5,26

And we get float 1.0,2.0,3.0,34.0,5.0,26.0

How do this ?

And i found interesting code:
Code:
struc dt [arg] {
if arg eqtype 1.0
dt arg
else
match sign value,arg {
match =INF,value { dq \$8000000000000000 \\}
match =NaN,value { dq \$C000000000000001 \\}
dw \$7FFF - (sign \$4000 - \$4000) \}
end if }

I think this code write only in macro but not in struct.

Last edited by Roman on 20 Jan 2019, 21:36; edited 1 time in total
20 Jan 2019, 09:52
ProMiNick

Joined: 24 Mar 2012
Posts: 321
Location: Russian Federation, Sochi
Roman, thou found my code.
Code:
struc dt [arg] {
label . tword ; add this for correcteness
if arg eqtype 1.0
dt arg
else if arg eqtype 1; may be this helps
dt arg#.0
else
match sign value,arg {
match =INF,value { dq \$8000000000000000 \\}
match =NaN,value { dq \$C000000000000001 \\} ; NaN is big range of values, and it is useless in practic (Infinity useless too)
dw \$7FFF - (sign \$4000 - \$4000) \}
end if
;if thou define table it is enought, but for single tbyte may be "dw ?" needed for alignment after it
}

alternative:
Code:
Inf equ -\$4000+\$4000+\$7FFF:\$8000000000000000
NaN equ Inf or

use case
Code:
dt Inf,+Inf,-Inf,+NaN(Index),-NaN(Index); where Index - any value from 1 to \$7FFFFFFFFFFFFFFF

Last edited by ProMiNick on 25 Jan 2019, 08:24; edited 2 times in total
20 Jan 2019, 11:15
Roman

Joined: 21 Apr 2012
Posts: 471
Yes. I found on site KalibriOS.
ProMiNick did you been on GD.ru ?
20 Jan 2019, 14:03
l4m2

Joined: 15 Jan 2015
Posts: 648
Code:
macro df [x] {
forward
dq x#.0
}
Only allow take input integer
08 Feb 2019, 04:11
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsCompiler InternalsIDE DevelopmentOS ConstructionNon-x86 architecturesHigh Level LanguagesProgramming Language DesignProjects and IdeasExamples and Tutorials 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