UASM (HJWasm) - UASM is a free MASM-compatible assembler based on JWasm with these features:
● [*]native support for output formats Intel OMF, MS Coff (32/64-bit), Elf (32/64-bit), Binary, Windows PE (32/64-bit) and DOS MZ. [*]precompiled HJWasm binaries are available for Windows. [*]Instructions up to AVX2 and AVX512F are supported. [*]Support for MS Vectorcall on x64. [*]HJWasm is written in C. The source is portable and has successfully been tested with Open Watcom, MS VC, GCC and more. [*]As far as programming for MS Windows is concerned, HJWasm can be used with both WinInc (32/64-bit) and Masm32 (32-bit). [*]C header files can be converted to include files for HJWasm with h2incX. [*]HJWasm's source code is released under the Sybase Open Watcom Public License, which allows free commercial and non-commercial use. [*]There's a bunch of source samples available - they are supplied with the precompiled binary packages. [*]JWasm started as a fork of Open Watcom's Wasm in March 2008. Today, the part of Wasm source lines still contained in JWasm is approximately 15%. [*]HJWasm is a continued evolution of JWasm.
NOTES: Adapting constants switchs to your system,use this tool: sdkrc81\Before_use_me.exe.He will give you the correct swiths for your system. Modify translate.inc with this switchs.The defaut system is windows 10.0
With a correct alignment,all translated structures,can be used as they are. There is no need of any modifie.
Fixes: 1) Fixed usage text to show SSE as the default architecture. 2) Fixed 32bit addressing mode issue when using Array[n] (variable indexed by constant). 3) Minor RBP stack-frame fixes. 4) Fix for RSP stack setup using WIN64 < 11. 5) Fix for vmovupd addressing mode. This error was also affecting evex encoding instructions that can't use 1 byte displacement.
Improvements: 1) Updated and cleaned up the unix build. 2) Re-organized the samples folder and descriptions. 3) Adjusted local arrangement with RBP stack-frame to minimize required padding and ensure all locals are always aligned so win64:7 is obsolete. 4) Vsubpd xmm0, xmm0, zmm14 now generates an error.
New Features: 1) Add -macho64 output format support (OSX 64bit objects). 2) Added two new samples osx1.asm, osx2.asm for macho64 output. 3) Added new sample crossplatform/hello.asm demonstrating a simple console app that assembles on win64, linux and osx.
We now are finally able to run, assemble and target all platforms: Windows, Linux and OSX :)
Here is a simple hello world sample that assembles and runs on all 3 without modification:
; ####################################################################
;
; Fully cross platform 64bit Hello World Sample.
; Uses built-in @Platform to target code-blocks with UASM 2.45
;
; Windows (x64): uasm64 -c -win64 -Zp8 hello.asm
; link /machine:x64 /subsystem:console /release hello.obj msvcrt.lib
;
; Linux (x64): uasm -c -elf64 hello.asm
; gcc -o hello hello.o
;
; OSX (x64): uasm -c -macho64 hello.asm
; ld hello.o -e main -lc -o hello_app
;
; ####################################################################
include crossplatform.inc
main proto
MyFunc proto
.code
main PROC
invoke MyFunc
IF @Platform EQ WINDOWS64
invoke ExitProcess,0
ELSE
mov eax,SYS_EXIT
syscall
ENDIF
ret
main ENDP
MyFunc PROC
invoke CPRINTF, "Hello world!\n"
ret
MyFunc ENDP
end
Fixed: ----------------------------- 1) Corrected some misplaced samples in the packages. 2) Fix incorrect detection of used proc parameter vs. global struct member. 3) Promote immediate vararg arguments to qword when too large for signed dword.
Improvements: ----------------------------- 1) Add signed 1 byte displacement optimisation to all vex and evex encoded memory operands. 2) I've combined the various manual/documents into a single manual now. 3) Support return types and vectorcall in OO interfaces and updated OO samples. 4) Added return type support to OO interfaces. 5) Add .endf and .endsw aliases for .endfor and .endswitch
And the big new features: ----------------------------- 1) Added C-style function calling. The following is now possible:
All the HL/C style calls are implemented under the hood via macros, and only a light shim in the pre-processor is required which means these features do not impact or cause any other issues with existing parser or expression evaluator logic and can rely on the already powerful macro expansion system to deal with the recursions etc. Internally the macros also respect the architecture selection (AVX vs SSE) and the ordinal of the argument, so that return values are correctly loaded into the corresponding register or stack locations.
Procedure calls can be nested 1 level deep, inner calls preserver the registers of the outer call parameters where required, and all support return typing and can be used in other HLL expressions, which can be especially fun when combined with the HLL floating point comparison operators.
2) Support pointer syntax with -> and allow c-style calls via pointer and OO methods.
The above higher level calling features have been further extended with support for a c-style pointer operator ( -> ) which can then be applied to the object oriented framework:
; Method invocation using c-style calls.
albl: person1->Calc(1.0)
person2->Calc(2.0)
.if( person1->Calc(1.0) == FP4(2.0) )
xor eax,eax
.endif
; Using a register as an object pointer with c-style calls requires the type to specified after the pointer.
; The register must be doubley-indirect, in that it points to the pointer to the object, which allows for rapid iteration through lists of object pointers.
lea rsi,person1
[rsi].Person->Calc(1.0)
.if( [rsi].Person->Calc(1.0) == FP4(2.0) )
xor eax,eax
.endif
xor rax,rax
lea rsi,person2
[rsi+rax].Person->Calc(1.0)
xor rax,rax
.if( [rsi+rax].Person->Calc(1.0) == FP4(2.0) )
xor eax,eax
.endif
person1->Calc( person2->Calc(1.0) ) ; Pass the typed result of a method call to another method.
NormalProc( person1->Calc(1.0) ) ; Pass the typed result of a method call to a normal procedure.
person1->Calc( NormalProc(1.0) ) ; Pass the typed result of a normal procedure to a method call.
person2->DoAdd( 1.0, NormalProc(2.0) )
; Delete the objects.
_DELETE(person1)
_DELETE(person2)
3) Add COMINTERFACE support built-in to allow direct implementation and use of COM objects without all the boilerplate wrapper nonsense. Building on the previous two features, direct declaration of COM object interfaces and their invocation is now a doddle:
4) And possibly the most important, I've finally gotten around to updating and merging all the regression testing sets from nasm, gas, jwasm, uasm and asmc and implementing a fully automated set of testing on each build. All the results from these tests have been fixed in 2.46 so there should be a lot fewer (hopefully no) regressions or encoding issues going forward from here. The tests are included in the regress folder in the github repository and also include the OO features, macrolib, Linux64, SystemV and various other UASM only features. This brought up a few encoding issues in AVX2 and AVX512 which are now fixed.
5) Thanks to AW27's work on SEH we've ensured that both the manual and automated models that he has developed work in UASM. These are included as part of the regression tests.
Planning for 2.47 is underway, first features to be picked up are support for DWARF debugging output, some new Linux and OSX GTK+ samples and merging in the last bunch of regression tests.
P.S. Packages and git have been updated to 2.46.3 dated 8th Dec. This includes all the required fixes and a new option hlcall:{on|off} to disable the c style function calling and object/pointer invocations. It's enabled by default.
UASM 2.47 is now available:
-------------------------------------
Roadmap:
-------------------------------------
2.48
Add DWARF symbolic debugging support.
Add support for PLT/GOT relative addressing.
Extract vectorcall handling to be compatible with all modes.
-------------------------------------
Changelog:
-------------------------------------
2.47
Fixed symbol undefined with IF
Add -PIE command line switch for position indepedant executable. (not used yet)
Fixed vxorpd evex warning with missing register.
Corrected encoding for vmovsd.
Fix vgather/scatter encoding issue.
Fix vectorcall register over-write ordering.
Fix codegen integer shift encoding for SSE vs. AVX/EVEX.
Add m512 built-in types
Fix error reporting for evex compare instructions (http://masm32.com/board/index.php?topic=7320.0) => VPCMPB,VPCMPUB,VPCMPD,VPCMPUD,VPCMPQ,VPCMPUQ,VPCMPW,VPCMPUW
Clang and Gcc 8+ compiler compatibility fixes
Name mangling for vectorcall
Include improved build files for osx/linux
Fix generation of instructions when in data section (due to lbl: conversion to lbl label byte regression from 2.19)
Add error when literal string used in invoke and parameter is NOT of type PTR or VARARG.
Fixed transfer of language type info from PROC to equate (http://masm32.com/board/index.php?topic=7137.0)
Ensure that an equate used with invoke redirects to the actual PROC symbol to ensure proper relocations are generated (http://masm32.com/board/index.php?topic=7137.0)
Fix static method HLL invocation without parameters.
Fixed console colour background to match active setting under Windows.
remove duplicated string literals
add plt,got relocation types provisionally.
Fix register ordering in memory operands where base and index could be swapped when no scale present. (Legacy jwasm bug)
AVX-512 encoding fix for VPGATHERDD in 32bit.
Added MOVBE instruction support.