flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Programming Language Design > [ask] Supports I/O in FASMG

Author
Thread Post new topic Reply to topic
Kane



Joined: 08 Sep 2015
Posts: 3
[ask] Supports I/O in FASMG
Hello Tomasz Grysztar and all flatassembler community.
Thank you for your work and efforts over the best assembler.
I saw a new branch (FASMG) and was very pleased with the developments. Based on this, i would like to ask: what is your opinion on adding support for Input/Output on the macro level?
With such steep macros, this features are lacking =/

Sorry for my bad eng and thank you for the attention Smile
Post 08 Sep 2015, 07:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14588
Location: Planet Dirt
Do you mean the x86 IN and OUT instructions?
Because these would be up to the programmer to define.

Or do you mean some sort of interaction with the user by reading keystrokes and printing to the console?
But this is not usually the purpose of an assembler/compiler. Adding such a thing would make it something else.

Or are you suggesting something else?
Post 08 Sep 2015, 08:01
View user's profile Send private message Visit poster's website Reply with quote
Kane



Joined: 08 Sep 2015
Posts: 3
I meant "something" is:

Code:

char data[20];
FILE *f = fopen("file.txt""w");

fprintf(stdout"data");  // write console
fscanf(stdin"%s"data);  // read console

// --------------------------------

fprintf(f"data");  // write file
fscanf(f"%s"data);  // read file



only through macros.

Work with stream (I/O) through macros.
Post 08 Sep 2015, 08:22
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14588
Location: Planet Dirt
Using file I/O is OS dependant. I wonder if you are confusing fasmg with some sort of HLL.

But anyway, firstly you have to define which CPU you are targeting so that the binary output code can run on the CPU (X86 or ARM etc.). Then you need to define which OS you are targeting so you can interact with the I/O APIs ("int 0x80" or "invoke function" etc.), and to format the output binary accordingly (PE or ELF etc.).
Post 08 Sep 2015, 08:41
View user's profile Send private message Visit poster's website Reply with quote
Kane



Joined: 08 Sep 2015
Posts: 3
True say. I did not thought of the zoo processor Smile I thought support for I/O desktop systems based on the x86 and popular os (win, lin) =\

Thank you for your attention to the topic.
Post 08 Sep 2015, 09:09
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14588
Location: Planet Dirt
From your comment I suspect that fasmg is not going to be suitable for what you want. Instead you can look at the example code included in the download of fasm (without the 'g').
Post 08 Sep 2015, 09:14
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 868
Not sure what you guys are talking about, but both fasm and fasmg support reading files at compile time via the file directive and doing output (to the console for console versions) via the display directive. file is also able to read from the console input, but an interactive compilation session done this way is limited to blind batch input during the compilation and batch output flush done after the compilation is finished.

_________________
Faith is a superposition of knowledge and fallacy
Post 08 Sep 2015, 19:26
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14588
Location: Planet Dirt
But files are not stream I/O from stdin and stdout as the OP requested. I think the OP just misunderstood the purpose of fasmg.
Post 09 Sep 2015, 01:41
View user's profile Send private message Visit poster's website 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.