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 > Compiler Internals > fasm as DLL

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


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland
fasm as DLL
The subject says all. Wink

I've made fasm into a simple DLL which allows to assemble just inside the memory. The package contains short documentation, demonstration program (which also uses flat editor in DLL form) and the SOURCE directory, which needs to be merged with SOURCE directory of standard fasm's distributions.


Description: flat assembler DLL (assembled with 1.71.49 core)
Download
Filename: fasmDLL.zip
Filesize: 149.96 KB
Downloaded: 2953 Time(s)



Last edited by Tomasz Grysztar on 18 Nov 2015, 19:25; edited 9 times in total
Post 24 Nov 2006, 22:20
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland
PS. In demonstration program you may edit the source, however Enter key will not work, since it's inside dialog box. Use Ctrl+M instead.
Post 24 Nov 2006, 22:23
View user's profile Send private message Visit poster's website Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 492
Location: Norway
Great! Smile Looking forward to play with this one.. I'll test it more tomorrow..
Post 24 Nov 2006, 23:38
View user's profile Send private message Visit poster's website Reply with quote
MichaelH



Joined: 03 May 2005
Posts: 402
It never ceases to amaze me how much you keep giving to us all, thank you very much Tomasz.

So, fasmscript is now a reality Wink
Post 25 Nov 2006, 00:59
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland
Forgot to add a note that it is not thread-safe (and cannot be, since fasm's core uses many global variables, which cannot be made local due to extensive use of EBP register for different purposes inside core). If for some reason you wanted parallel assembly, you need to use separate instances.

Also there is a bit of moving data around which emulates the file read and write operations for the memory-to-memory assembly. At least initial copying of data could be avoided by using altered preprocessor routines, but this would require moving a piece of core functionality into a DLL interface part - in current state it should be much less affected by core version. It should not affect the speed really much, anyway. Wink
Post 25 Nov 2006, 13:06
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7111
Location: Slovakia
tomasz: did you try TLS?
Post 25 Nov 2006, 13:35
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 188
Location: Ukraine,Kharkov
will it be placed on main page "Download"?
Post 25 Nov 2006, 14:14
View user's profile Send private message Reply with quote
Raedwulf



Joined: 13 Jul 2005
Posts: 375
Location: United Kingdom
Wow nice, you did it ^^. Thank you once again Tomasz Very Happy

_________________
Raedwulf
Post 25 Nov 2006, 14:47
View user's profile Send private message MSN Messenger Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland

vid wrote:
tomasz: did you try TLS?


TLS is no help here. The variables need to be at fixed addresses.


dead_body wrote:
will it be placed on main page "Download"?


No such plans. I guess this is rather very specialized variant.
Post 25 Nov 2006, 14:50
View user's profile Send private message Visit poster's website Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 492
Location: Norway
Is this the beginning of "fasm for compiler engineers"? Smile
Post 25 Nov 2006, 15:33
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2071
Location: Usono (aka, USA)
Nifty. This makes me want a QBASIC-like IDE where you can run immediate assembly code. (To be honest, I'd never use it, but it'd be cool.)

P.S. Any reason for including FASM.DLL in the .ZIP twice? (seems silly but maybe I'm overlooking something).
Post 30 Nov 2006, 05:12
View user's profile Send private message Visit poster's website Reply with quote
WytRaven



Joined: 08 Sep 2004
Posts: 44
Location: Canberra, Australia
Tomasz has instructed that the provided zip's SOURCE folder be 'merged' into the fasm SOURCE folder. That's easy enough to do, just copy contents of SOURCE into ....fasm\SOURCE. However, if you then try to assemble the DLL it will fail. The same thing will happen if you try to compile ASMEDIT.ASM. Three include lines need to be changed to make it compatible with standard fasm distribution:

FASM.ASM
Line 9: include 'win32a.inc'
Should be: include '..\..\include\win32a.inc'

Line 428: include 'api\kernel32.inc'
Should be: include '..\..\include\api\kernel32.inc'

ASMEDIT.ASM
Line 9: include 'win32a.inc'
Should be: include '..\..\..\include\win32a.inc'

These three changes will allow succesfull build of ...fasm\SOURCE\DLL\FASM.ASM and ...fasm\SOURCE\IDE\FASMW\ASMEDIT.ASM with standard distribution. I hope this helps any people new to fasm that may be confused by this.

Have a nice day all and thanks for making this Tomasz Smile


Description: FASM DLL Zip with fixed includes
Download
Filename: fasmDLL.zip
Filesize: 115.61 KB
Downloaded: 1190 Time(s)


_________________
All your opcodes are belong to us
Post 06 Dec 2006, 02:26
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland
These changes are not needed with standard fasm distribution as long as you follow the guidelines from section 1.1.1 of FASM.PDF.
Post 06 Dec 2006, 10:46
View user's profile Send private message Visit poster's website Reply with quote
WytRaven



Joined: 08 Sep 2004
Posts: 44
Location: Canberra, Australia

Tomasz Grysztar wrote:
These changes are not needed with standard fasm distribution as long as you follow the guidelines from section 1.1.1 of FASM.PDF.



How dare I doubt you Wink I should have known the mighty Tomasz was infallible Razz

_________________
All your opcodes are belong to us
Post 06 Dec 2006, 12:27
View user's profile Send private message Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
This is very cool!
It would be nice to have it at the downloads page. Smile

The demo included in the zip file is also usefull for testing what hex numbers are generated! Good for opcode analisys!

This opens a new world of possibilites!
Someone could code a in-memory ASM code-snipet running program, that would accept blocks of code and run it showing the values insides registers! Very Happy
Post 08 May 2007, 01:22
View user's profile Send private message Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 155
Run-time assembly... So maybe we will be able to have breakpoints, just like in the high-level languages
Post 26 May 2007, 10:27
View user's profile Send private message Reply with quote
Yardman



Joined: 12 Apr 2005
Posts: 246
Location: US
[]


Last edited by Yardman on 04 Apr 2012, 03:23; edited 1 time in total
Post 05 Aug 2008, 06:07
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 829
Location: Michigan, USA
Here are some changes to get it to compile:

In the fasm.asm for the dll add 'predefinitions db 0' to the data section.
Also, add 'include "..\messages.inc" ' close to where the other includes are.

In the errors.inc for the dll add this to the end:

Code:

copy_asciiz:
        lods    byte [esi]
        stos    byte [edi]
        test    al,al
        jnz     copy_asciiz
        ret
    write_quoted_symbol_name:
        mov     al,27h
        stosb
        mov     esi,[error_info]
        movzx   ecx,byte [esi-1]
        rep     movs byte [edi],[esi]
        mov     ax,27h
        stosw
        ret
symbol_out_of_scope:
        mov     edi,message
        mov     esi,_symbol_out_of_scope_1
        call    copy_asciiz
        cmp     [error_info],0
        je      finish_symbol_out_of_scope_message
        mov     byte [edi-1],20h
        call    write_quoted_symbol_name
    finish_symbol_out_of_scope_message:
        mov     byte [edi-1],20h
        mov     esi,_symbol_out_of_scope_2
        call    copy_asciiz
        push    message
        jmp     assembler_error

invalid_definition:
        push    _invalid_definition
        jmp     assembler_error 



_________________
----> * <---- My star, won HERE
Post 09 Oct 2008, 14:02
View user's profile Send private message Reply with quote
Molajoku



Joined: 28 Apr 2009
Posts: 2
Location: England
mmm brrwains
Hi all,

I hate to be a necro but does anyone have a x64 version of this code?
Or could help me re-write it for use as a x64 .obj

Thanks.
Post 28 Apr 2009, 18:06
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7111
Location: Slovakia
Sorry, there is no 64-bit version of this code, and rewriting it would be a HUUUGE project. What do you need it for anyway? (AFAIK all systems that run 64-bit PE DLLs also support 32-bit code)
Post 28 Apr 2009, 19:11
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3  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


Powered by phpBB © 2001-2005 phpBB Group.

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