flat assembler
Message board for the users of flat assembler.

Index > Tutorials and Examples > Command Line Arguments using FASM and GCC (win32)

Author
Thread Post new topic Reply to topic
fasmnewbie



Joined: 01 Mar 2011
Posts: 555
fasmnewbie 17 Feb 2018, 07:44
Another weekend quick code over a cup of tea. A simple code using FASM and GCC to take multiple arguments from the command line to calculate series of sine values.

output
Code:
D:\FASM>sine

 Usage: sine v1 v2 vn

D:\FASM>sine 3.4
sin(3.4000) rad = -0.255541

D:\FASM>sine 3.4 0.0 -9.2 7.6 1.5
sin(3.4000) rad = -0.255541
sin(0.0000) rad = 0.000000
sin(-9.2000) rad = -0.222890
sin(7.6000) rad = 0.967920
sin(1.5000) rad = 0.997495
    

I am sure it's not that far off from the linux version. And also easily convertible to other trigonometric functions.

EDIT: Added 64-bit version


Description:
Download
Filename: sine64.asm
Filesize: 1.55 KB
Downloaded: 945 Time(s)

Description:
Download
Filename: sine.asm
Filesize: 1.79 KB
Downloaded: 910 Time(s)



Last edited by fasmnewbie on 08 Mar 2018, 18:29; edited 1 time in total
Post 17 Feb 2018, 07:44
View user's profile Send private message Visit poster's website Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 555
fasmnewbie 17 Feb 2018, 11:34
Just added the 64-bit version.
Post 17 Feb 2018, 11:34
View user's profile Send private message Visit poster's website Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 555
fasmnewbie 21 Feb 2018, 11:24
Added the missing Linux versions (32-bit and 64-bit).

Happy coding and enjoy.


Description:
Download
Filename: sinr64.asm
Filesize: 1.15 KB
Downloaded: 871 Time(s)

Description:
Download
Filename: sinr.asm
Filesize: 1.75 KB
Downloaded: 848 Time(s)

Post 21 Feb 2018, 11:24
View user's profile Send private message Visit poster's website Reply with quote
catafest



Joined: 05 Aug 2010
Posts: 129
catafest 12 Jan 2019, 19:36
sinr64 work and result is radians:
Code:
[mythcat@desk fasm]$ ./sinr64 10
sinr(+10.000000) = -0.5440211109    

the sinr.asm come with this error for GCC compiliing process, I don't know how can be fix it:
Code:
[mythcat@desk fasm]$ gcc -s sinr.o -o sinr -lm
/usr/bin/ld: i386 architecture of input file `sinr.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status     
Post 12 Jan 2019, 19:36
View user's profile Send private message Visit poster's website Yahoo Messenger 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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.