News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

UASM 2.46 Release

Started by johnsa, December 05, 2017, 01:11:19 AM

Previous topic - Next topic

johnsa

 So it's that time again.. a new release, lots of new goodness coming to a store near you ;)

What have we got in this release?

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:


.if ( MyProc6( MyProc8() ) == 7 )
   xor eax,eax
.endif

mov eax,MyProc(10, 20)
lea rsi,myVar
mov eax,[rsi + MyProc12()]
mov myVar,MyProc(11,12)
mov myVar2,MyProc12()
vmovaps xmm1,MyProc5(1.0)

MyProc3()
MyProc(10,20)
MyProc(10,ADDR MyProc)
MyProc2("this is a literal")

.if( MyProc(10,20) == 30 )
   xor eax,eax
.endif

.if( MyProc5(1.0) == FP4(2.0) )
   xor eax,eax
.endif

.if ( MyProc6(7) == 7 )
   xor eax,eax
.endif

MyProc(MyProc3(), 20)
MyProc(10, MyProc4())
MyProc(MyProc3(), MyProc4())
MyProc(MyProc3(), MyProc2("stringy"))

MyProc10(MyProc11(), MyProc2("stringy"))

MyProc7( 10, 20, myVar, myVar2, 2.0, 30 )

MyProc( MyProc( MyProc3(), 10 ), 20)

.if ( MyProc6( MyProc8() ) == 7 )
   xor eax,eax
.endif

MyProc7( 10, 20, myVar, myVar2, MyProc9( 10, 20, myVar, myVar2, 2.0, 30 ), 30 )

MyProc7( 10,
20,
myVar,
myVar2,
2.0,
30 )


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:



; Declare a COM interface for IDirect3D9
COMINTERFACE IDirect3D9
CVIRTUAL RegisterSoftwareDevice, DWORD, :PTR
CVIRTUAL GetAdapterCount, DWORD
CVIRTUAL GetAdapterIdentifier, DWORD
CVIRTUAL GetAdapterModeCount, DWORD
CVIRTUAL EnumAdapterModes, DWORD
CVIRTUAL GetAdapterDisplayMode, DWORD
CVIRTUAL CheckDeviceType, DWORD
CVIRTUAL CheckDeviceFormat, DWORD
CVIRTUAL CheckDeviceMultiSampleType, DWORD
CVIRTUAL CheckDepthStencilMatch, DWORD
CVIRTUAL CheckDeviceFormatConversion, DWORD
CVIRTUAL GetDeviceCaps, DWORD, Adapter:DWORD, DeviceType:DWORD, pCaps:PTR
CVIRTUAL GetAdapterMonitor, DWORD
CVIRTUAL CreateDevice, DWORD
ENDCOMINTERFACE

LPDIRECT3D9 TYPEDEF PTR IDirect3D9

; Call it :)

mov direct3d,Direct3DCreate9( D3D_SDK_VERSION )
.if( rax != 0 )
direct3d->GetDeviceCaps( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, ADDR caps )
.endif



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.

Cheers
John

johnsa

Packages will be available this evening for all platforms.

fearless

wow amazing work. Thanks for all your hard work to all involved with the uasm developments.

six_L

Thanks your efforts. :t :t :t
we'll await the UASM 2.46 Release.
the UASM made max-win32asm compatible with its styles.
Say you, Say me, Say the codes together for ever.

GoneFishing

COMINTERFACE support is something beyond my expecrtations .

However I don't see IUnknown interface functions  in IDirect3D9 declaration?

Vortex

Hi habran and johnsa,

Many thanks for your amazing efforts :t

johnsa

Quote from: GoneFishing on December 05, 2017, 05:40:36 AM
COMINTERFACE support is something beyond my expecrtations .

However I don't see IUnknown interface functions  in IDirect3D9 declaration?

Correct, the iunknown members are automatically included as part of the COMINTERFACE definition as they're mandatory, so no point having to re-write them all the time.

GoneFishing



jj2007

MasmBasic library:
UASM v2.46, Dec  4 2017, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

*** MasmBasic version 30.11.2017 ***
Tmp_File.asm: 787 lines, 4 passes, 406 ms, 0 warnings, 0 errors

*** Link  MasmBasic.obj  using link, sub Console - no resources ***

Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.


Tmp_file.obj : error : Internal error during ReadSymbolTable

  ExceptionCode            = C0000005
  ExceptionFlags           = 00000000
  ExceptionAddress         = 00432EEB
  NumberParameters         = 00000002
  ExceptionInformation[ 0] = 00000000
  ExceptionInformation[ 1] = 1CA5E519

CONTEXT:
  Eax    = 0FCDA2C8  Esp    = 0018F654
  Ebx    = 00000000  Ebp    = 003072F9
  Ecx    = 00000002  Esi    = 00302E74
  Edx    = 8E3AB908  Edi    = 65AF2871
  Eip    = 00432EEB  EFlags = 00010246
  SegCs  = 00000023  SegDs  = 0000002B
  SegSs  = 0000002B  SegEs  = 0000002B
  SegFs  = 00000053  SegGs  = 0000002B
  Dr0    = 0018F654  Dr3    = 00000000
  Dr1    = 003072F9  Dr6    = 00000002
  Dr2    = 00000000  Dr7    = 00000000

***  build all took 3356 ms  ***


RichMasm triggers an exception in polink:
0040FFCF           ³.  C745 EC 00000000  mov dword ptr [ebp-14], 0
0040FFD6           ³>  8B45 F0           mov eax, [ebp-10]
0040FFD9           ³.  6B40 04 12        imul eax, [eax+4], 12
0040FFDD           ³.  89C6              mov esi, eax
0040FFDF           ³.  0335 C0214200     add esi, [4221C0]                         ; ASCII ".file"
0040FFE5           ³.  807E 10 02        cmp byte ptr [esi+10], 2   ; <<<<<<<<<<< esi is EA534DD7
0040FFE9           ³. 74 06             je short 0040FFF1
0040FFEB           ³.  807E 10 69        cmp byte ptr [esi+10], 69
0040FFEF           ³. 75 12             jne short 00410003
0040FFF1           ³>  89F1              mov ecx, esi
0040FFF3           ³.  E8 F80A0000       call 00410AF0
0040FFF8           ³.  89C1              mov ecx, eax
0040FFFA           ³.  E8 5172FFFF       call 00407250                             ; [polink.00407250


RichMasm with the Masm32 SDK linker:*** Link  ReTest.obj rsrc.obj  using link, sub Windows ***
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.


Tmp_file.obj : error : Internal error during ReadSymbolTable

  ExceptionCode            = C0000005
  ExceptionFlags           = 00000000
  ExceptionAddress         = 00432EEB
  NumberParameters         = 00000002
  ExceptionInformation[ 0] = 00000000
  ExceptionInformation[ 1] = EAA34DE7

CONTEXT:
  Eax    = 1B3D4C90  Esp    = 0018F654
  Ebx    = 00000000  Ebp    = 0053EBB7
  Ecx    = 00000002  Esi    = 00531440
  Edx    = F527B110  Edi    = 65AF2871
  Eip    = 00432EEB  EFlags = 00010246
  SegCs  = 00000023  SegDs  = 0000002B
  SegSs  = 0000002B  SegEs  = 0000002B
  SegFs  = 00000053  SegGs  = 0000002B
  Dr0    = 0018F654  Dr3    = 00000000
  Dr1    = 0053EBB7  Dr6    = 00000002
  Dr2    = 00000000  Dr7    = 00000000

johnsa

Well that is really odd.. I assume it works fine with 2.45? If so, can you send me both obj files (2.46 assembled and 2.45 so I can diff the obj files to see what is up).

Thanks! :) John

jj2007

Here they are for the editor :icon14:

habran

Hi jj, :biggrin:
I think your problem is related to some external vars:

extern _xzmb: byte
extern _MbExeFolder$: dword
extern _wfd: dword
extern _CrLf$: dword

?_1846: mov     edx, dword ptr [_MbExeFolder$]          ; 0000E85F _ 8B. 15, 00000000(d)
?_1846: mov     edx, dword ptr [Unnamed_80000000_0]     ; 0000E85F _ 8B. 15, 00000000(d)

        push    dword ptr [_CrLf$]                      ; 0000FEE7 _ FF. 35, 00000000(d)
        push    dword ptr [Unnamed_80000000_0]          ; 0000FEE7 _ FF. 35, 00000000(d)

As you can see they are missing for the linker
Are you sure you included a proper include files
I have compared those 2 files you've posted and only problem is those externs
Cod-Father

jj2007

Quote from: habran on December 05, 2017, 11:32:08 AMAre you sure you included a proper include files

Yes, I am sure.

habran

It is interesting that these vars are missing, have look here:

extern _DllTable: dword           extern _DllTable: dword   
extern _MbFH: dword               extern _MbFH: dword       
extern _MbExeFolder$: dword                                 
extern _Dw2BinBuffer: byte        extern _Dw2BinBuffer: byte
extern _wfd: dword                                           
extern _MbCat$: dword             extern _MbCat$: dword     
extern _hSetWin: dword            extern _hSetWin: dword     
extern _CrLf$: dword                                         
extern _Lf$: dword                extern _Lf$: dword         

Cod-Father