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
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: 3499
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



Joined: 16 Jun 2003
Posts: 7892
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



Joined: 16 Jun 2003
Posts: 7892
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: 1138
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
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng
Hi,Privalov:
Sorry, I found that the 1.49.4 version can't build correct wdm sys format.
The complier fill the DllCharacteristics is 0 but it should be 2000h on the wdm sys format.
I checked the source and found must added the code, the result file is 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 [110403]--WDM SYS Format
      pe_alignment_ok:
 mov     word [edx+1Ah],VERSION_MAJOR + VERSION_MINOR shl 8
  mov     dword [edx+60h],1000h   ; stack reserve
     mov     dword [edx+64h],1000h   ; stack commit
      mov     dword [edx+68h],10000h  ; heap reserve
      mov     dword [edx+6Ch],0       ; heap commit
       mov     dword [edx+74h],16      ; number of directories
     bsf     ecx,[edx+3Ch]
       imul    ebx,[number_of_sections],28h
        add     ebx,ebp
     dec     ebx
 shr     ebx,cl
      inc     ebx
 shl     ebx,cl
      sub     ebx,ebp
     mov     ecx,ebx
     mov     eax,[display_buffer]
        sub     eax,ecx
     cmp     edi,eax
     jae     out_of_memory
       shr     ecx,2
       xor     eax,eax
     rep     stos dword [edi]
    mov     eax,edi
     sub     eax,[code_start]
    add     eax,[stub_size]
     mov     [edx+54h],eax           ; size of headers
   bsf     ecx,[edx+38h]
       dec     eax
 shr     eax,cl
      inc     eax
 shl     eax,cl
      mov     [edx+28h],eax           ; entry point rva
   mov     [code_type],32
      or      [reloc_labels],-1
   mov     [number_of_sections],0
      lea     ebx,[edx+18h+0E0h]
  mov     [current_section],ebx
       mov     dword [ebx],'.fla'
        mov     dword [ebx+4],'t'
 mov     [ebx+14h],edi
       mov     [ebx+0Ch],eax
       mov     dword [ebx+24h],0E0000060h
  neg     eax
 add     eax,edi
     sub     eax,[edx+34h]
       mov     [org_origin],eax
    mov     [org_registers],0
   mov     [org_start],edi
     bt      [format_flags],8
    jnc     instruction_assembled
       or      dword [edx+16h],2000h
       cmp     word [edx+5Ch],1
    jne     instruction_assembled
       or      word [edx+5Eh],2000h
        jmp     instruction_assembled
      fp_to_version:
    

In the program flow, the 802 lines code should be executing. But I found that it doesn't work. why? I don't known the reason.
Thanks.
Post 04 Nov 2003, 02:04
View user's profile Send private message MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7892
Location: Kraków, Poland
Tomasz Grysztar
You probably forgot to specify the DLL flag with "PE native" format.
Post 04 Nov 2003, 06:51
View user's profile Send private message Visit poster's website Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng
Oh,yeah. The reason is I forgot to specify the DLL flag with "PE native" format. Now it is OK.
Thanks.
And anothers, The syntax define is invalid:
Code:
FORMAT          PE NATIVE 4.0 DLL AT 10000H ON 'STUB.EXE'    


But the define is OK:

Code:
FORMAT          PE NATIVE  DLL AT 10000H ON 'STUB.EXE'    
Post 04 Nov 2003, 08:12
View user's profile Send private message MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7892
Location: Kraków, Poland
Tomasz Grysztar
WFM
Post 04 Nov 2003, 12:16
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:  
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. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.