flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > fasm as DLL

Goto page 1, 2, 3, 4, 5, 6  Next
Author
Thread Post new topic Reply to topic
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 24 Nov 2006, 22:20
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.73 core)
Download
Filename: fasmDLL.zip
Filesize: 290.89 KB
Downloaded: 6034 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



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 24 Nov 2006, 22:23
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: 489
Location: Norway
Tommy 24 Nov 2006, 23:38
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
MichaelH 25 Nov 2006, 00:59
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



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 25 Nov 2006, 13:06
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: 7105
Location: Slovakia
vid 25 Nov 2006, 13:35
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: 187
Location: Ukraine,Kharkov
dead_body 25 Nov 2006, 14:14
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
Raedwulf 25 Nov 2006, 14:47
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



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 25 Nov 2006, 14:50
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: 489
Location: Norway
Tommy 25 Nov 2006, 15:33
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: 2341
Location: Usono (aka, USA)
rugxulo 30 Nov 2006, 05:12
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: 45
Location: Canberra, Australia
WytRaven 06 Dec 2006, 02:26
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: 2709 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



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 06 Dec 2006, 10:46
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: 45
Location: Canberra, Australia
WytRaven 06 Dec 2006, 12:27
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
OzzY 08 May 2007, 01:22
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: 150
Adam Kachwalla 26 May 2007, 10:27
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
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 09 Oct 2008, 14:02
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
Molajoku 28 Apr 2009, 18:06
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: 7105
Location: Slovakia
vid 28 Apr 2009, 19:11
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
Molajoku



Joined: 28 Apr 2009
Posts: 2
Location: England
Molajoku 28 Apr 2009, 19:47
Thanks for getting back to me. I'm trying to recompile a .dll called
fasmdll_managed for use on x64 sytems.
Sad to say however all I seem able to get for my efforts so far is:
"Error 2 fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'"

Cheers though Smile
Post 28 Apr 2009, 19:47
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3, 4, 5, 6  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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.