The MASM Forum

64 bit assembler => ASMC Development => Topic started by: caballero on September 16, 2018, 07:09:07 PM

Title: Having a look to asmc
Post by: caballero on September 16, 2018, 07:09:07 PM
Hello, I have been having a look to asmc. It seems to have everything to unzip and go: compiler, linker, includes, libraries, etc. Good looking. But, when I check an example, "directx/0" for example, I don't see any batch file to click and see the results, only a makefile that I don't know how to handle... Just my thoughts, that you can send to the bin.

Good job, anyway :t
Title: Re: Having a look to asmc
Post by: Vortex on September 16, 2018, 07:31:41 PM
Hi caballero,

Extract the content of asmc-master.zip to your root partition. Now, you can execute \asmc-master\bin\dz.exe, the DosZip Commander. From DosZip's client area ( the left pane ) , run install.bat to build the libraries. dz.exe and install.bat are in the bin folder. Navigate to the folder \asmc-master\source\test\directx\0 and run the file makefile. It will build the executable test.exe
Title: Re: Having a look to asmc
Post by: caballero on September 16, 2018, 07:46:24 PM
Oh, I see, everything has to be made inside Doszip Commander. Thank you Vortex :t
Title: Re: Having a look to asmc
Post by: Vortex on September 16, 2018, 07:49:02 PM
Hi caballero,

You can also use batch files to build executables.
Title: Re: Having a look to asmc
Post by: caballero on September 16, 2018, 07:51:40 PM
I have tried it without much success
Title: Re: Having a look to asmc
Post by: Vortex on September 16, 2018, 07:58:44 PM
Here is my batch file :

Code: [Select]
set INCLUDE=\asmc-master\include
set LIB=\asmc-master\lib

\asmc-master\bin\asmc test.asm

\asmc-master\bin\linkw format windows nt runtime windows file test.obj

The linker reports some errors :

Code: [Select]
\asmc-master\bin\asmc test.asm
Asmc Macro Assembler Version 2.28.07
Copyright (C) The Asmc Contributors. All Rights Reserved.

 Assembling: test.asm

\asmc-master\bin\linkw format windows nt runtime windows file test.obj
LINKW Version 2.0
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
loading object files
searching libraries
Warning! W1008: cannot open uuid.lib : No such file or directory
Error! E2028: XMConvertVectorFloatToInt@@20 is an undefined reference
Warning! W1023: no starting address found, using 00401000
creating a PE executable
file test.obj(test.asm): undefined symbol XMConvertVectorFloatToInt@@20
Title: Re: Having a look to asmc
Post by: caballero on September 16, 2018, 08:07:23 PM
Yes, with a batch file, there are some libraries that the linker doesn't find. I didn't use the setpaths, just include the paths in the source and try to tell the linker where are the libraries with "linkw sys con_64 file test_ Library ..\..\..\..\lib\libc.lib" In my case it didn't find the library "libc.lib".
Title: Re: Having a look to asmc
Post by: Vortex on September 16, 2018, 08:30:06 PM
Hello,

I copied uuid.lib from Win7 SDK to the \asmc-master\lib folder :

Code: [Select]
LINKW Version 2.0
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
loading object files
searching libraries
Error! E2028: XMConvertVectorFloatToInt@@20 is an undefined reference
Warning! W1023: no starting address found, using 00401000
creating a PE executable
file test.obj(test.asm): undefined symbol XMConvertVectorFloatToInt@@20
Title: Re: Having a look to asmc
Post by: caballero on September 16, 2018, 09:11:42 PM
I don't have W7 SDK. I have copied it from PoASM/Lib to "asmc/lib" and doesn't work neither. Never mind. Thank you for your time, Vortex.
Title: Re: Having a look to asmc
Post by: Vortex on September 16, 2018, 09:13:04 PM
The asmc example should be built as a console application, my fault.

Code: [Select]
include stdio.inc
include directxmath.inc

includelib kernel32.lib
includelib libc.lib
includelib msvcrt.lib
includelib uuid.lib
includelib d3dx9.lib

.code

main proc

  local x:XMFLOAT4, value:UINT, result:UINT

    mov value,2
    mov x.x,5.0
    ;mov x.y,5.0
    ;mov x.z,5.0
    ;mov x.w,5.0

    XMConvertVectorFloatToInt(x, value)

    movd eax,xmm0
    printf("result: %d\n", eax)

    xor eax,eax
    ret

main endp

    end

Code: [Select]
set INCLUDE=\asmc-master\include
set LIB=\asmc-master\lib

\asmc-master\bin\asmc /c /coff test.asm

H:\masm32\bin\polink /SUBSYSTEM:CONSOLE test.obj

Code: [Select]
H:\masm32\bin\polink /SUBSYSTEM:CONSOLE test.obj
POLINK: fatal error: File not found: 'd3dx9.lib'.

Never worked on directx so could you help me to specify the correct import libs for directx?
Title: Re: Having a look to asmc
Post by: nidud on September 16, 2018, 11:33:03 PM
Hi caballero,

Normally you just run DZ.EXE and hit enter on the makefiles to build the samples. Some of the samples need uuid.lib so this may also be build in that case. There is a install.bat in the ./bin directory. This builds the import libraries and libc for 32 and 64-bit. The manual way is to browse to the directory and hit enter on the makefile in:

./lib
./lib/amd64
./source/lib32
./source/lib64
./source/uuid -- not build by install.bat!

DZ do the following:
SET PATH=C:\asmc-master\bin;%PATH%
SET INCLUDE=C:\asmc-master\include
SET ASMCDIR=C:\asmc-master


Asmc uses INCLUDE and Linkw uses ASMCDIR (see linkw.lnk (https://github.com/nidud/asmc/blob/master/bin/linkw.lnk)).

You may also use DZ in batch mode:
C:\asmc-master\bin\dz.exe <command>
This will set the environment, run <command> and exit (see install.bat (https://github.com/nidud/asmc/blob/master/bin/install.bat)).

However, there was a bug (https://github.com/nidud/asmc/commit/38a3026ab138985bbe8f3ea8705bd768ff952120) in v2.28.07 added in v2.28.01 effecting .COMDEF so a new version is uploaded.
Title: Re: Having a look to asmc
Post by: caballero on September 16, 2018, 11:45:32 PM
Hello, Vortex, I don't have much experience on DirectX programming. There are some examples by Siekmanski here on this subject.
Title: Re: Having a look to asmc
Post by: nidud on September 17, 2018, 12:11:19 AM
A batch file for the ./source/test/directx/0 sample.
Code: [Select]
SET ASMCDIR=\asmc-master

\asmc-master\bin\asmc64 -I\asmc-master\include test.asm
\asmc-master\bin\linkw sys con_64 file test

Or simply:
Code: [Select]
\asmc-master\bin\dz make.exe
Title: Re: Having a look to asmc
Post by: caballero on September 17, 2018, 02:03:00 AM
Hi, nidud, didn't work none of two options. Don't worry, surely I did something wrong, no time to check it. :t
Code: [Select]
C:\Compila\asmc\source\test\directx\0>c:\compila\asmc\bin\dz make.exe
Asmc Make Version 1.6 Copyright (c) 2017 GNU General Public License

test.exe:
        asmc64 test.asm
        linkw sys con_64 file test
        test.exe
        pause
Asmc Macro Assembler (x64) Version 2.28.08
Copyright (C) The Asmc Contributors. All Rights Reserved.

 Assembling: test.asm
Warning! W1008: cannot open directxmath.lib : No such file or directory
Warning! W1008: cannot open uuid.lib : No such file or directory
Error! E2028: XMConvertVectorFloatToInt@@24 is an undefined reference
file test.obj(test.asm): undefined symbol XMConvertVectorFloatToInt@@24
"test.exe" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
Title: Re: Having a look to asmc
Post by: nidud on September 17, 2018, 03:30:42 AM
 :biggrin:

Maybe better to delete the whole thing and try again. The sample do not need uuid.lib so there must be some external libraries or other things added there. The directx (https://github.com/nidud/asmc/tree/master/source/directx) source is now moved out of lib64 and thus separated from libc (https://github.com/nidud/asmc/blob/master/include/DirectXMath.inc#L11) as it should be. The library needs to be built in order to use it.

Title: Re: Having a look to asmc
Post by: Vortex on September 17, 2018, 04:27:06 AM
Hi nidud,

I downloaded the latest asmc release. I get the following error messages using your batch file above :

Code: [Select]
\asmc-master\bin\asmc64 -I\asmc-master\include test.asm
Asmc Macro Assembler (x64) Version 2.28.08
Copyright (C) The Asmc Contributors. All Rights Reserved.

 Assembling: test.asm

\asmc-master\bin\linkw sys con_64 file test
LINKW Version 2.0
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
Warning! W1107: undefined system name: con_64
loading object files
searching libraries
Warning! W1008: cannot open directxmath.lib : No such file or directory
Error! E2028: printf is an undefined reference
Error! E2028: XMConvertVectorFloatToInt@@24 is an undefined reference
Warning! W1023: no starting address found, using 00401000
creating a 64-bit PE executable
file test.obj(test.asm): undefined symbol XMConvertVectorFloatToInt@@24
file test.obj(test.asm): undefined symbol printf
Title: Re: Having a look to asmc
Post by: nidud on September 17, 2018, 06:32:11 AM
I downloaded and tested the batch file and it seems to work just fine. From the output the linkw.lnk (https://github.com/nidud/asmc/tree/master/bin) file appear to be missing.
Title: Re: Having a look to asmc
Post by: Vortex on September 17, 2018, 06:49:18 AM
Hi nidud,

I have the file \asmc-master\bin\linkw.lnk but still I get the error messages.

The batch file :

Code: [Select]
SET ASMCDIR=\asmc-master

\asmc-master\bin\asmc64 -I\asmc-master\include test.asm
\asmc-master\bin\linkw sys con_64 file test
Title: Re: Having a look to asmc
Post by: nidud on September 17, 2018, 07:14:01 AM
I tried using CMD instead of DZ and ended up with the same result. It appears the linkw.lnk file needs to be in the %PATH% for LINKW to find it. The following batch worked:
Code: [Select]
SET PATH=D:\asmc-master\bin
SET ASMCDIR=\asmc-master

asmc64 -I\asmc-master\include test.asm
linkw sys con_64 file test
Title: Re: Having a look to asmc
Post by: nidud on September 17, 2018, 09:25:30 AM
I upgraded LINKW to v2.01 by adding a search for linkw.lnk in the directory where LINKW is located if SearchPath() failes.
Title: Re: Having a look to asmc
Post by: Vortex on September 18, 2018, 03:23:29 AM
Hi nidud,

Thanks for the update. Here is my report. I received the similar error messages both with the batch file and the makefile executed by DosZip :

Code: [Select]
D:\asmc-master\test>path
PATH=C:\Program Files (x86)\Sent;C:\app\Administrator\product\11.2.0\client_1;C:
\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Window
sPowerShell\v1.0\

D:\asmc-master\test>Build.bat

D:\asmc-master\test>SET PATH=\asmc-master\bin

D:\asmc-master\test>SET ASMCDIR=\asmc-master

D:\asmc-master\test>asmc64 -I\asmc-master\include test.asm
Asmc Macro Assembler (x64) Version 2.28.08
Copyright (C) The Asmc Contributors. All Rights Reserved.

 Assembling: test.asm

D:\asmc-master\test>linkw sys con_64 file test
Warning! W1008: cannot open directxmath.lib : No such file or directory
Warning! W1008: cannot open uuid.lib : No such file or directory
Error! E2028: XMConvertVectorFloatToInt@@24 is an undefined reference
file test.obj(test.asm): undefined symbol XMConvertVectorFloatToInt@@24

D:\asmc-master\test>path
PATH=\asmc-master\bin

Checking the environment variable PATH, I see that it's modified to reflect only the path of asmc. I should be like the following
PATH = %PATH%;\asmc-master\bin

DosZip :

Code: [Select]
Asmc Make Version 1.6 Copyright (c) 2017 GNU General Public License

test.exe:
        asmc64 test.asm
        linkw sys con_64 file test
        test.exe
        pause
Asmc Macro Assembler (x64) Version 2.28.08
Copyright (C) The Asmc Contributors. All Rights Reserved.

 Assembling: test.asm
Warning! W1008: cannot open directxmath.lib : No such file or directory
Warning! W1008: cannot open uuid.lib : No such file or directory
Error! E2028: XMConvertVectorFloatToInt@@24 is an undefined reference
file test.obj(test.asm): undefined symbol XMConvertVectorFloatToInt@@24

OS : Windows 7 Sp1 64-bit Professional with the latest updates
Path of asmc : D:\asmc-master
Location of the test project : D:\asmc-master\test
Title: Re: Having a look to asmc
Post by: nidud on September 18, 2018, 04:17:12 AM
Well, the import + libc libraries appear to exist (no missing printf) but directxmath.lib and uuid.lib is missing. Try building the missing libraries and remove the includelib stuff from the source. The include files take care of all that.

To build the missing libraries using DZ, go to ./source/directx and hit enter on the makefile. Same with uuid. This should probably be added to the install.bat file thought.
Title: Re: Having a look to asmc
Post by: Vortex on September 18, 2018, 04:29:43 AM
Hello nidud,

Thanks, building the missing libraries solved the problem.

This should probably be added to the install.bat file thought.

Exactly.

Here is my report :
Code: [Select]
C:\asmc-master\test>path
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\obw\Mingw32\bin;
C:\Program Files\OpenVPN\bin;

C:\asmc-master\test>Build.bat

C:\asmc-master\test>SET PATH=\asmc-master\bin

C:\asmc-master\test>SET ASMCDIR=\asmc-master

C:\asmc-master\test>asmc64 -I\asmc-master\include test.asm
Asmc Macro Assembler (x64) Version 2.28.08
Copyright (C) The Asmc Contributors. All Rights Reserved.

 Assembling: test.asm

C:\asmc-master\test>linkw sys con_64 file test

C:\asmc-master\test>path
PATH=\asmc-master\bin

C:\asmc-master\test>notepad
'notepad' is not recognized as an internal or external command,
operable program or batch file.

There is only one problem, the environment variable %PATH% should preserve the original value followed by the path to asmc.

Code: [Select]
PATH = %PATH%;\asmc-master\bin
As you can see in my report, I cannot execute notepad or other tools since %PATH% points only the asmc installation.

nidud, thanks for the update. Keep up the nice work :t
Title: Re: Having a look to asmc
Post by: nidud on September 18, 2018, 07:13:06 AM
Some more updates.

I added the two directories to install.bat.

The latest version of LINKW do not need the PATH statement in the batch file so only the root directory (ASMCDIR) needs to be set (or remove it by edit the linkw.lnk file).

However, the shell (DZ) holds the environment for the current source so it's recommended to use this instead of CMD. Note also that the environment is local (mistake I did when testing) to the source tree. If you copy one instance of DZ.EXE to \masm32\bin and execute it, use Ctrl-K, Ctrl-X, and Ctrl-O to emulate CMD, and issue the following commands:

D:\masm32\bin>PATH
PATH=D:\masm32\bin;C:\Windows;...

D:\masm32\bin>echo %INCLUDE%
D:\masm32\include

D:\masm32\bin>echo %ASMCDIR%
D:\masm32


So it adapts to the directory where it is located. The default setting is as follows (dz.ini):

[Environ]
0=INCLUDE=%ASMCDIR%\include

[Path]
0=%DZ%
1=%PATH%

Title: Re: Having a look to asmc
Post by: Vortex on September 19, 2018, 06:22:33 AM
Hi nidud,

Very nice work :t Thanks.