flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > btool

Author
Thread Post new topic Reply to topic
emil



Joined: 16 Dec 2003
Posts: 76
Location: egypt
emil 19 Oct 2011, 18:35
Hi all

i want to share my recent project with you.

it called btool which is 'build tool' , it is a tool that allows you to make your porject with a multi language , such as Fasm,Masm,HLA asm,Mingw and sphinx c-- , to preduce one exe file.

also it uses objconv to allow you to link with OMF object format , and dll2lib that allow you to directly link with dll files.

it reads an input file which combine a source code of each language and a link files then spilte each one in a certain file and compile it with a corresponding compiler and finally link object files with Masm linker.

here is a test program that passd to btool to make the exe file

Code:


[ MinGW ]

   extern "C" int get_int()
    {
        return 30;
    }

[ end MinGW]

[ HLAasm]

   #include("\HIDE\hlainc\w.hhf")

   procedure MyFunc;      @stdcall; @external;

   procedure MyFunc; @nodisplay;
   begin MyFunc;
    w.MessageBox(NULL,"Hello From HLAasm","From HLAasm",w.MB_OK);
   end MyFunc;

[ end HLAasm ]

[ MASM ]

  $ CmpPath = "\masm32\bin"
  $ IncPath = "\masm32\include"
  $ AddIncPath = "\masm32\macros"

 
    include windows.inc     ; always first
    include macros.asm       ; MASM support macros

  ; -----------------------------------------------------------------
  ; include files that have MASM format prototypes for function calls
  ; -----------------------------------------------------------------
    include masm32.inc
    include gdi32.inc
    include user32.inc
    include kernel32.inc
    
  get_size proc
        mov eax, 10
        ret
  get_size endp


[END MASM ]

[ Fasm ]

   public get_Eax 

   ;extrn '_printf'           as printf 

   get_Eax: 
        mov eax, 20
 ret

[ end Fasm ]

[ Link ]

    $ CONSOLE program
    $ ENTRY = start
    $ LibPath = "\C--\LIBS"
    $ AddLibPath = "Libs"

    $ COFF object File
    kernel32.lib,user32.dll,msvcrt.dll
    Myuser32.lib
    //file.obj

    $ OMF object File
    //gp.obj

[ end Link ]

// sphinx c-- code
#stack 0
#pragma option w       //enable warning.
#pragma option 3       //386 CPU.


#include <windows.h>

#pragma option ia      // allow inline asm


extern stdcall get_size();
extern stdcall get_Eax();
extern stdcall MyFunc();
extern stdcall _get_int();

extern cdecl _cprintf();   
#define printf  _cprintf

void main()
{
_start:     
    EBX = get_Eax();
    get_size(); 
    
    printf("eax = %d\nebx = %d\n",EAX, EBX);
    printf("mingw = %d", _get_int());
    MyFunc();

    ExitProcess(0);
}

    
Post 19 Oct 2011, 18:35
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1671
Location: Toronto, Canada
AsmGuru62 19 Oct 2011, 19:57
So, if I have say a 1000 files - I must bundle all these files into one HUGE ASS text file?! Isn't it better to have a small make file (!), which will refer to a separate files and a compiler on the same line, like so:

[FASM]C:\MyFASM\Module1.Asm
[FASM]C:\MyFASM\Module2.Asm
[FASM]C:\MyFASM\Module3.Asm
[MASM]C:\MyMASM32\Module1.Asm
[MASM]C:\MyMASM32\Module2.Asm
[MASM]C:\MyMASM32\Module3.Asm
[C]C:\MySphinx\Module1.c
[C]C:\MySphinx\Module2.c
[C]C:\MySphinx\Module3.c
... etc.
Post 19 Oct 2011, 19:57
View user's profile Send private message Send e-mail Reply with quote
emil



Joined: 16 Dec 2003
Posts: 76
Location: egypt
emil 20 Oct 2011, 05:03
even if you have 1000 files and have a make tool , you will put all 1000 files names in the text file that
will be proccessed by make tool or directly put them in make tool.

you still do it with my test text file , by using include statement , so you can collect all Fasm modules in one FasmInc.inc file and all Masm ,HLAasm Mingw the same way then include all those inc file in my text example and
compile them by btool.

not well , you can consider my test file as a main project file and include your modules as i explained.

you can alos edit the link proccess in link section while you make yor source code.
Post 20 Oct 2011, 05:03
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Oct 2011, 13:06
AsmGuru62
Are you jealous because the 100 year old man beat you in the Marathon, on your own soil ? Very Happy
Post 20 Oct 2011, 13:06
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1671
Location: Toronto, Canada
AsmGuru62 20 Oct 2011, 15:55
Oh, so 'include' statement is there.
Then it is valuable tool!
Post 20 Oct 2011, 15:55
View user's profile Send private message Send e-mail Reply with quote
emil



Joined: 16 Dec 2003
Posts: 76
Location: egypt
emil 20 Oct 2011, 17:38
ok ,

i have changed the 'include' statement to 'AddModule'.

so here is the test program .
Code:

[ MinGW ]

extern "C" int get_int()
{
    return 30;
}

[ end MinGW]

[ HLAasm]

#include("\HIDE\hlainc\w.hhf")

procedure MyFunc;        @stdcall; @external;

procedure MyFunc; @nodisplay;

begin MyFunc;

  w.MessageBox(NULL,"Hello From HLAasm","From HLAasm",w.MB_OK);
   
end MyFunc;

[ end HLAasm ]

[ MASM ]

$ CmpPath = "\masm32\bin"
$ IncPath = "\masm32\include"
$ AddIncPath = "\masm32\macros"

$ AddModule FileMasm1.asm,FileMasm2.asm

 
    include windows.inc     ; always first
    include macros.asm      ; MASM support macros

  ; -----------------------------------------------------------------
  ; include files that have MASM format prototypes for function calls
  ; -----------------------------------------------------------------
    include masm32.inc
    include gdi32.inc
    include user32.inc
    include kernel32.inc
    
    
;    EXTERNDEF main:PTR 
    ;get_size PROTO
 
;_start:
;   jmp main
   


get_size proc
        mov eax, 10
                ret
get_size endp


;end _start

[END MASM ]

[ Fasm ]

   public get_Eax 
;   public start as '_start'
   
;extrn '_c_stdcall_display@8' as c_stdcall_display
;extrn '_c_ccall_display'  as c_ccall_display
;extrn '_printf'        as printf
   extrn 'main'          as main

;start:
;   jmp main

get_Eax: 
    mov eax, 20
        ret

[ end Fasm ]

[ Link ]

$ CONSOLE program
$ ENTRY = start
$ LibPath = "\C--\LIBS"
$ AddLibPath = "Libs"

$ COFF object File
kernel32.lib,user32.dll,msvcrt.dll
Myuser32.lib
//file.obj

$ OMF object File
//gp.obj

[ end Link ]

#stack 0
#pragma option w       //enable warning.
#pragma option 3       //386 CPU.


#include <windows.h>
//#include <msvcrt.h-->

#pragma option ia      // allow inline asm


extern stdcall get_size();
extern stdcall get_Eax();
extern stdcall MyFunc();
extern stdcall _get_int();

extern cdecl _cprintf();   
#define printf  _cprintf

void main()
{
_start:  
    EBX = get_Eax();
    get_size(); 
    
    printf("eax = %d\nebx = %d\n",EAX, EBX);
    printf("mingw = %d", _get_int());
    MyFunc();

    ExitProcess(0);
}

    
Post 20 Oct 2011, 17:38
View user's profile Send private message Reply with quote
emil



Joined: 16 Dec 2003
Posts: 76
Location: egypt
emil 21 Oct 2011, 13:51
hi all

i have add Msvc++2003 support , when it will be solid i will post btool.exe

alse btool ueses undecor.exe to undecorate symbols in object file for simplefy linking proccess.

here is the link of undecor.exe
http://www.masm32.com/board/index.php?topic=6518.0

here is the test program

Code:


[ MSVC ]

extern "C" int get_Msvc()
{
    return 900;
}

[ end MSVC ]

[ MinGW ]

$ AddModule filemingw1.cpp

extern "C" int get_int()
{
    return 30;
}

[ end MinGW]

[ HLAasm]

$ AddModule FileHLAasm1.hla

#include("\HIDE\hlainc\w.hhf")

procedure MyFunc; @stdcall; @external;

procedure MyFunc; @nodisplay;

begin MyFunc;

  w.MessageBox(NULL,"Hello From HLAasm","From HLAasm",w.MB_OK);
   
end MyFunc;

[ end HLAasm ]

[ MASM ]

$ CmpPath = "\masm32\bin"
$ IncPath = "\masm32\include"
$ AddIncPath = "\masm32\macros"

$ AddModule FileMasm1.asm,FileMasm2.asm

 
    include windows.inc     ; always first
    include macros.asm      ; MASM support macros

  ; -----------------------------------------------------------------
  ; include files that have MASM format prototypes for function calls
  ; -----------------------------------------------------------------
    include masm32.inc
    include gdi32.inc
    include user32.inc
    include kernel32.inc
    
    
;    EXTERNDEF main:PTR 
    ;get_size PROTO
 
;_start:
;   jmp main
   


get_size proc
        mov eax, 10
                ret
get_size endp


;end _start

[END MASM ]

[ Fasm ]

$ AddModule FileFasm1.asm
   public get_Eax 
;   public start as '_start'
   
;extrn '_c_stdcall_display@8' as c_stdcall_display
;extrn '_c_ccall_display'  as c_ccall_display
;extrn '_printf'           as printf
   extrn 'main'          as main

;start:
;   jmp main

get_Eax: 
    mov eax, 20
        ret

[ end Fasm ]

[ Link ]

$ CONSOLE program
$ ENTRY = start
$ LibPath = "\C--\LIBS"
$ AddLibPath = "Libs"

$ COFF object File
kernel32.lib,user32.dll,msvcrt.dll
//file.obj

$ OMF object File
//gp.obj


[ end Link ]

#stack 0
#pragma option w       //enable warning.
#pragma option 3       //386 CPU.


#include <windows.h>
//#include <msvcrt.h-->

#pragma option ia      // allow inline asm


extern stdcall get_size();
extern stdcall get_Eax();
extern stdcall MyFunc();
extern stdcall get_int();
extern stdcall get_size1();
extern stdcall get_size2();
extern stdcall get_Eax1();
extern stdcall MyFunc1();
extern stdcall get_int1();
extern stdcall get_Msvc();

extern cdecl _cprintf();   
#define printf  _cprintf

void main()
{
_start:  
    EBX = get_Eax();
    get_size(); 
    
    printf("eax = %d\nebx = %d\n",EAX, EBX);
    printf("mingw = %d\n", get_int());
    printf("masm_module1 = %d\nmasm_module2 = %d\n",get_size1(),get_size2());
    printf("fasm_module1 = %d\n",get_Eax1());
    printf("minGw_module1 = %d\n",get_int1());
    printf("Msvc = %d\n", get_Msvc());
    
    MyFunc();
    MyFunc1();
    
 ExitProcess(0);
}

    
Post 21 Oct 2011, 13:51
View user's profile Send private message 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.