flat assembler
Message board for the users of flat assembler.

Index > Main > new prerelease

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
Here's the new pre-release of latest fasm sources, not only with the new ` operator implemented, but also with changed behaviour of the "defined" operator, now it checks whether the symbol is defined anywhere in source, not only prior to it. I'm sorry for the broken backward compatibility, but I've decided this is better, as it can useful in more situations, for example this nice macro for object formats is utilizing this new feature:
Code:
macro global [symbol]
{
 local isextrn
 if defined symbol & ~ defined isextrn
  public symbol
 else if used symbol
  extrn symbol
  isextrn = 1
 end if
}    

it declares symbol as public if it's defined somewhere in source, and otherwise defined it as external, but only if it's actually used somewhere (it's similar to the GLOBAL or EXTERNDEF directive of some other assemblers).

The only problem you can have with this change is when you are using some piece of code like:
Code:
if ~ defined alpha
 alpha:
        ret
end if    

It won't work with this new version (as it'll cause the infinite loop, and you'll get the "code cannot be generated" message), but you can replace it with something like:
Code:
if ~ defined alpha | defined alpha_here
 alpha:
        ret
 alpha_here = 1
end if    

or even make some macro for such definitions.

Updated version is posted below.


Last edited by Tomasz Grysztar on 03 Nov 2003, 19:46; edited 1 time in total
Post 28 Oct 2003, 13:26
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
Why not to make this as new directive ("exists" for example) and keep old one's behaviour?

Regards.
Post 28 Oct 2003, 15:36
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
I try to keep the set of operators and directives as small as possible - so you won't have to keep track with the huge language reference as it happens with some overbloated compilers (and that's also why I prefer to implement many features with macros). The same problem was taken up in this thread - with having many non-standard and special operators and directives, sources might become quite unreadable to people not knowing the whole language reference in details, especially to people used to use some other assemblers.

This time I've chosen to change behavior of one operator, because I've realized the same tasks that could be done with the old one can be also (with only a little bit more effort) done with the new one, and the second variant allows much more. Of course, I don't like breaking the backward compatibility, that's why when I have to implement some new feature I usually spend much time on searching the implementation that will be most universal to minimize the chances that I'd have to change its bahaviour in the future - but this time I failed, I didn't realize that it was not best solution on time. That's why I've decided to change it now.
Post 28 Oct 2003, 16:15
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
Cool! Nice to see FASM progress further... Maybe when you have spare time, dear Privalov, you might add DATE/TIME directives so for example aboutbox message string could include compilation date/time? Smile Shocked Very Happy

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 28 Oct 2003, 22:40
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
Would timestamp be enough (no need to modify the interface in order to get such feature, and BTW it would be useful also for some Win32 resources generation, as there are fields that theoretically should be filled with valid timestamp)?
And what name would be suitable for such value? Maybe %timestamp%?
Post 28 Oct 2003, 22:44
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
I guess so, then you propose to extract day/month/year and hour/time/seconds with macro arithmetics?

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 29 Oct 2003, 00:22
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica
Privalov wrote:
And what name would be suitable for such value? Maybe %timestamp%?

IMO one of the follow would be better:
timestamp
__TIME
__TIMESTAMP
(the two last follows the high level pseudoMacros pattern (like __FILE, __LINE, etc), IMO one of the two last is preferable)

_________________
... 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 29 Oct 2003, 07:49
View user's profile Send private message Visit poster's website Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias
Confused
Just my two cents, I prefer Privalov's notation to Scientica's, WHICH LOOKS TOO MUCH like C or C++. Going back to the old school of Nicholas Wirth, inventor of Pascal and Modula 2, I prefer avoidance of underscore character if at all possible. I believe that % symbol is much less ambiguous, and easier to recognize as a special character. I realize that two generations of programmers have become accustomed to the underscore prefix, but it ought not be employed in my opinion, for names of variables, operators, instructions, macros, or complex data types like structures, unions, etc. I understand that this view is contrary to the prevailing thinking, especially in USA, on the other hand, so is programming in Assembly! Regards, TomTobias nbri@mail.china.com
Post 29 Oct 2003, 11:05
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
Also %t might be an option (less checking for the parser and less writing for the programmer).

Another thing about which I'd like to hear your opinion: I'm planning to implement some way of specifying the section alignment for each section in ELF and MS COFF formats (classic COFF doesn't allow this, there all sections are aligned to 4 KB), and the only problem I have with it is what syntax should such option have. Would the simple:
Code:
section '.data' writeable 16    

be enough to align section on 16 bytes boundary? What's your opinion?
Post 29 Oct 2003, 11:44
View user's profile Send private message Visit poster's website Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias
First, I don't have the answer. Second, my opinion is based on ignorance, as I have never dealt with this question before. Third, I am willing to purchase the Intel C compiler for you, if that would assist in resolution of this issue. Intel has two C compilers, one for Windows (i.e. coff--common object file format), and one for Linux (elf--executable & linking format). Here's the reference to the Intel products which MIGHT address this questiion: http://www.intel.com/software/products/compilers/clin/pricelist.htm
searching the developer site at Intel redirects one to the corporate section, rather unsatisfying. Searching the PDF file on IA-32 architecture software developer's Manual http://www.intel.com/design/Pentium4/manuals/24547012.pdf
yields no results on entering "application binary interface", i.e. Intel's term for the Microsoft COFF, and the Linux ELF. One consideration for adoption of any plan, is to realize that 64 bit architecture is upon us. Classically, compiler writers sought to SAVE MEMORY, this is also the case for example, in the famous Burrus Split Radix Fast Fourier Transform, which he developed IN PLACE, because memory was so precious in former times.
I recommend to waste memory, forget about about both space and time, i.e. %t xxx or % xxx % is essentially the same, and FOCUS ON TWO aspects: (1) SIMPLICITY of design, (2) EASE of creation and maintenance, i.e. READABILITY. Memory is there for free. Assembly is already so fast there is no need to worry about saving time by concern about bus alignments to save clock cycles. Ensuring compatibility with IA-64 and SIMD extensions is ESSENTIAL. Let me know if you want me to purchase the Intel compiler for you, to see how they address the boundary question. Be my pleasure, if it would be useful to you. Regards, Tom Tobias, nbri@mail.china.com
Post 29 Oct 2003, 16:47
View user's profile Send private message Reply with quote
GuyonAsm



Joined: 27 Sep 2003
Posts: 45
GuyonAsm
Will the resources always have to be defined within the source or will there soon be a .res file implementation.

I ask this ,because I dont want to write MS COFF code just to do this. If not I'm going to end up writing a tool for the community that allows you to edit resources and then writes them to the end of the source in fasm syntax.

_________________
I shall not evade what is predestined
because every battle, is another lesson
- GuyonAsm.

A Believer of The System.
Post 29 Oct 2003, 17:24
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
tom tobias wrote:
Memory is there for free. Assembly is already so fast there is no need to worry about saving time by concern about bus alignments to save clock cycles.

No, at least not for me. I can't afford buying a new computer every year and I'm not alone with such problem. And I really like having something working smooth on my good old P60 (altough I have also a Duron 600 machine now).
Post 29 Oct 2003, 17:24
View user's profile Send private message Visit poster's website Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias
[quote="Privalov
I can't afford buying a new computer every year and I'm not alone with such problem. [/quote]

Send me an email.
Regards, tom tobias: nbri@mail.china.com
Post 29 Oct 2003, 18:29
View user's profile Send private message Reply with quote
eet_1024



Joined: 22 Jul 2003
Posts: 59
eet_1024
What does ` (back tick) do?

Care should be taken with the definition of timestamp.

I've written many parsers that act on strings that look like "%L" and "%S_Records"

I think a nice feature to have would be \ within strings.
A few I would like are: \\ \r \n \t \xHH \OOO
Post 30 Oct 2003, 02:29
View user's profile Send private message Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng
Hi,Privalov:
Please see the link:
http://board.flatassembler.net/topic.php?t=256&start=30
In the 1.49.2 version, You have fixed the bug about WDM sys format.
But in the 1.49.3 version, the bug is issue,too.
Sorry, I have to fix the format.inc, and the driver runed OK:
Code:
mov      dword [edx+14h],0E0h    ; size of optional header
   mov     dword [edx+16h],10B818Eh; flags and magic value
     mov     dword [edx+38h],1000h   ; section alignment
 mov     dword [edx+3Ch],200h    ; file alignment
    mov     word [edx+40h],1        ; OS version
        mov     eax,[image_base]
    mov     dword [edx+34h],eax
 mov     eax,[subsystem_version]
     mov     [edx+48h],eax
       mov     ax,[subsystem]
      mov     [edx+5Ch],ax
        cmp     ax,1
        jne     pe_alignment_ok
     mov     eax,20h
     mov     dword [edx+38h],eax
 mov     dword [edx+3Ch],eax
 mov     word [edx+5EH],2000H    ;Kevin Zheng[101303]--WDM SYS Format
      pe_alignment_ok:
    

Hi, Comrade and Bard:
The wdm sys must be returned 0 from DriverEntry, except the driver found error.
Thank you helpping.
Post 30 Oct 2003, 06:36
View user's profile Send private message MSN Messenger Reply with quote
BiDark



Joined: 22 Jun 2003
Posts: 109
Location: .th
BiDark
Privalov wrote:

Another thing about which I'd like to hear your opinion: I'm planning to implement some way of specifying the section alignment for each section in ELF and MS COFF formats (classic COFF doesn't allow this, there all sections are aligned to 4 KB), and the only problem I have with it is what syntax should such option have. Would the simple:
Code:
section '.data' writeable 16    

be enough to align section on 16 bytes boundary? What's your opinion?


Why not PE too?, 4k and 512 bytes.
Post 01 Nov 2003, 11:59
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
eet_1024 wrote:
What does ` (back tick) do?


Very useful operator for some macroses. It converts name of the label to string. For example:
Code:
macro DispLabel lbl {
  display 'The label name is: ', `lbl, $0d, $0a
}
    


This macro will display the name of parameter. Look at StdCallEx in Fresh package for working example.

Regards.
Post 01 Nov 2003, 14:56
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
Yes, I've removed that fix for WDM, because I've done it different way, but I forgot to include the newer fix in the 1.49.9.3
But now you have 1.49.9.4 with both this fix and the %t timestamp support. Only section alignment for object files and the "resource from" generator are left on my TODO list for 1.50.

Attachment removed - new release available in some other place.


Last edited by Tomasz Grysztar on 27 Nov 2003, 20:38; edited 1 time in total
Post 03 Nov 2003, 19:43
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
comrade wrote:
I guess so, then you propose to extract day/month/year and hour/time/seconds with macro arithmetics?

Yeah. Wink Here's the quick and dirty example:
Code:
macro months [dayscount]
 {
  forward
   if DAY <= dayscount
   else
    DAY = DAY-dayscount
    MONTH = MONTH+1
  forward
   end if
 }

TIME = %T

DAY = TIME/(24*3600)
DAY = DAY - (DAY+365)/(3*365+366)
YEAR = 1970+DAY/365
DAY = DAY mod 365 + 1
MONTH = 1
months 31,28,31,30,31,30,31,31,30,31,30,31

TIME = TIME mod (24*3600)
HOUR = TIME/3600
MINUTE = (TIME mod 3600)/60
SECOND = (TIME mod 3600) mod 60

display <YEAR,10>,'-',<MONTH,10>,'-',<DAY,10>,13,10
display <HOUR,10>,':',<MINUTE,10>,':',<SECOND,10>,13,10    

You need to use fasm 1.49.9.4+ and the display macro from here to compile it.
(note that timestamp is UTC time)
Post 03 Nov 2003, 20:31
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
Cool! Thanks! Twisted Evil Shocked Twisted Evil

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 03 Nov 2003, 20:57
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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-2020, Tomasz Grysztar.

Powered by rwasa.