flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Hello and parser output specs?

Author
Thread Post new topic Reply to topic
Gus



Joined: 12 Jan 2008
Posts: 4
Location: Buenos Aires Argentina
Gus 12 Jan 2008, 03:29
I'm Gus and I'm new in this forum. Just wanted to share experiences with fasm, so hello to all Very Happy

To the author of fasm:
Hey, lots of dead code in 16.725 source:

From parser.inc
Code:
      parse_pure_else:
        bts     dword [esp],1
       jc      unexpected_instruction
      test    byte [esp],100b
     jz      parse_next_line
     sub     edi,4
       or      byte [esp],1
        jmp     skip_parsing         ;<-----
      skip_parsing:
    


From assemble.inc
Code:
      define_words:
       call    define_data
 lods    byte [esi]
  cmp     al,'('
        je      get_word
    cmp     al,'?'
    jne     invalid_argument
    mov     eax,edi
     mov     word [edi],0
        scas    word [edi]
  jmp     undefined_data
      ret         ;<--------
    


It is a joke (but the code is real). Great compiler you wrote. Congrats Very Happy

Any chance to get some info on parser output format?
I'm eternally writing a hll and I'll like to test fasm as code generator, but want to "in" directly to assemble.

Thanks

Regars, Gus
Post 12 Jan 2008, 03:29
View user's profile Send private message Reply with quote
Gus



Joined: 12 Jan 2008
Posts: 4
Location: Buenos Aires Argentina
Gus 16 Jan 2008, 19:53
Hi,

I did found some fasm internals info here in the forums, but it seems not enough. Internal numbers representation by example, must follow sources in detail to undestand it complety. I need that and some other info as symbol table state at assemble stage entering. I do not want to use preprocessor and parser, but enter directly to assemble.

I understand maintain fasm is hard and very time consuming task, not to talk about clean sources, so generously available for download.

So, what I must assume?

1- There is not available info yet?
2- There is not interest in fasm being used as backend for other compilers?
3- Not enough time to put the info together?
4- Not consistent internals, may change in time so better not waste time writing efimerous info.
5- Reverse enginering it, do not bother here.
6- My english/humor sense is horrible no one undestand it (probably).

Thanks for your time.
Post 16 Jan 2008, 19:53
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 16 Jan 2008, 20:01
A1: True, but you can help, if you discover something, post it.
A2: Not true, it has been discussed, but nothing happened.
A3: True, I expect, docs take time and good docs take lots of time.
A4: Very true, I found this with fasmarm.
A5: Don't see why not, there is lots to learn inside.
A6: Maybe, but it is generally considered bad manners to point out petty things. Major blunders are a different matter, feel free to poke fun at whomsoever writes clearly junk code.
Post 16 Jan 2008, 20:01
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 16 Jan 2008, 20:05
I once started such project, see http://board.flatassembler.net/topic.php?p=28103#28103
But the internals were changing faster than I was able to document them. Smile
Post 16 Jan 2008, 20:05
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Jan 2008, 21:21
There is something that I can't find explanation for, and that is the lack of many symbolic numbers, you are forced to check code that alters the memory part (or check what action is taken when the variable is read) to more or less know what the number represents. I think that binding names to numbers doesn't take too much time (surely much less than thinking an unique global label name for every label defined in source).
Post 16 Jan 2008, 21:21
View user's profile Send private message Reply with quote
Gus



Joined: 12 Jan 2008
Posts: 4
Location: Buenos Aires Argentina
Gus 17 Jan 2008, 05:01
Revolution: I understand. Sorry if I offended someone, that was not my will at all. In fact, it was all the contrary :S

Tomasz: I saw that, good work, unfortunately it explains the part I wont use, preprocessor and the very simple interface :S But tables description are very useful.

Loco: I agree, named constants would help.

My 2 cents offer: I could take the last source, name some constants, and comment a bit (at least the parts that I follow Embarassed ), when time permits, if tomasz agree in using it from there as to acumulate the documentation work (too much work to do from zero in every release). So we could end having more readable sources in some time.
I think it is easier to keep source comments updated rather than update separated text files after any change, tomasz could modify comments while coding (or simply delete the incorrect ones, mark the place ;##### and let others do that work). The inconsistent internals problem could be solved at least in part by this manner.

rgds, Gus
Post 17 Jan 2008, 05:01
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 17 Jan 2008, 07:01
LocoDelAssembly wrote:
There is something that I can't find explanation for, and that is the lack of many symbolic numbers, you are forced to check code that alters the memory part (or check what action is taken when the variable is read) to more or less know what the number represents. I think that binding names to numbers doesn't take too much time (surely much less than thinking an unique global label name for every label defined in source).

I prefer working with numbers for those structures - they allows to see things you cannot see through the textual names. Wink
As the legendary Mel would say: "You never know where [assembler] is going to put things, so you'd have to use separate constants". Wink
Post 17 Jan 2008, 07:01
View user's profile Send private message Visit poster's website Reply with quote
snrtrui



Joined: 11 Jan 2008
Posts: 14
Location: China
snrtrui 17 Jan 2008, 12:42
I think.If you can promulgate this object's flow chart, is better!
it can allure lots members to consummate this objects!
Post 17 Jan 2008, 12:42
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 17 Jan 2008, 14:38
Quote:
I prefer working with numbers for those structures - they allows to see things you cannot see through the textual names.

In this case, I prefer working with numbers, but explaining their meaning somewhere.
Post 17 Jan 2008, 14:38
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Gus



Joined: 12 Jan 2008
Posts: 4
Location: Buenos Aires Argentina
Gus 17 Jan 2008, 18:55
Tomasz Grysztar wrote:

I prefer working with numbers for those structures - they allows to see things you cannot see through the textual names. Wink
As the legendary Mel would say: "You never know where [assembler] is going to put things, so you'd have to use separate constants". Wink


It answers it all, we wont have named constants by now Very Happy
Great history! Made me remember the old days when I got my first z80. A wired breadboard was ready for it, 1mhz xtal, some leds. I had no tools, no pc, no asm, so wired an eprom burner myself, mains 50 hertz was the basetime for it, some buttons allowed to input address and value by each location, all in hex. The only way to test a program was burning the eprom (2704 I think), inserting it in its socket and firing power...a blinking led was the result of many programming hours. A single error means 30 minutes of ultraviolet light to erase the eprom (nice time to speculate about the last error), and start everything again.
Not drums but ahh, lots of adrenaline anyway Laughing
Sorry the OT.

Gus
Post 17 Jan 2008, 18:55
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 18 Jan 2008, 07:07
vid wrote:
Quote:
I prefer working with numbers for those structures - they allows to see things you cannot see through the textual names.

In this case, I prefer working with numbers, but explaining their meaning somewhere.

I have them all in my notebook, don't you remember? Wink
Post 18 Jan 2008, 07:07
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


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.