Hi,
2.46.8 update is available, Windows packages today, OSX and Linux ones tonight.
Changes are:
CLMUL and SHA instruction set support added including pseudo-op forms of CLMUL.
Fixed bug in DEREF macros for OO and COM preventing correct expansion of ->Release().
Added support for typedef chain on return types so not only primitive types work.
Cheers
John
Hello
I use a older version of HJWasm v2.15r2, a new can i not find.
If i compile my project have i this error
jwasm.exe /c /coff /Cp "DlgMain.Asm"
HJWasm v2.15r2, Sep 25 2016, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
DlgMain.Asm(30) : Error A2168: General Failure
Error(s) occured.
By Uasm this
rc /v "DlgMain.Rc"
Microsoft (R) Windows (R) Resource Compiler Version 6.3.9600.17298
Copyright (C) Microsoft Corporation. All rights reserved.
Creating DlgMain.res
Using codepage 1252 as default
DlgMain.Rc.
Writing DIALOG:1000, lang:0x409, size 92.
Writing 24:1, lang:0x409, size 612
uasm32.exe /c /coff /Cp "DlgMain.Asm"
UASM v2.46, Jan 26 2018, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
DlgMain.Asm: 31 lines, 2 passes, 555 ms, 0 warnings, 0 errors
link /SUBSYSTEM:WINDOWS /RELEASE /VERSION:5.0 /MACHINE:X86 /OUT:"DlgMain.exe" "DlgMain.obj" "DlgMain.res"
Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation. All rights reserved.
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
Error(s) occured.
Here is my project can you tell me what is wrong?
Regards,
ragdog
Just throw away DlgMain.inc, it doesn't contain anything useful. This works.include \masm32\include\masm32rt.inc
IDD_DIALOG equ 1000
.data?
hInstance dd ?
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke InitCommonControls
invoke DialogBoxParam,hInstance,IDD_DIALOG,NULL,addr DlgProc,NULL
invoke ExitProcess,0
;########################################################################
DlgProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.if uMsg==WM_INITDIALOG
.elseif uMsg==WM_COMMAND
.elseif uMsg==WM_CLOSE
invoke EndDialog,hWnd,0
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgProc endp
end start
I have test your code but is same ::)
DlgMain.Asm(31) : Error A2168: General Failure
Quote from: ragdog on January 31, 2018, 08:10:54 AM
I have test your code but is same ::)
DlgMain.Asm(31) : Error A2168: General Failure
Attached code builds fine with ML 6.14, JWasm, latest UAsm64.
@John: Latest UAsm64 fails to recognise default argument size. Version 8 January was still OK. Example:
OK:
SetMouse proc idmx:DWORD
invoke SetCursor, rv(LoadCursor, 0, idmx) ; hourglass, ...
Fail:
SetMouse proc idmx
invoke SetCursor, rv(LoadCursor, 0, idmx) ; hourglass, ...
Hey,
Ok the issue with that default argument size is how the return types are now handled. With .8 we've allowed any type to be specified as the return type, not just one of the built-in types (byte/word/dword) etc.
However, what this means is that the return type can be an identifier(ID) so with the default argument size syntax it becomes grammatically ambiguous as to what that is suppose to be, an argument or a return type.
The only way I can see to really solve this is to change the return type syntax slightly. It needs some form of marker to identify the intention grammatically...
We could do something like this:
MyProc PROTO (HRESULT) :DWORD, :DWORD
MyProc PROC (HRESULT) aVar, bVar
Use brackets to enclose the return type, that way there is no confusion between the types and their meaning/intention.
If that works for all I will make this change.
::)
Was that a yes or a no ? :)
[EDIT] .. Ok I think I've maybe confused people a bit here..
So.. writing/declaring procs and protos is 100% normal as you would in Masm etc..
IF however you specifically WANT to add a return type to a PROC (which offers some benefits) then you can.
At present this is simply a type specified before the argument list (refer to the manual).
The bug now is that we've added support for identifiers to that return type, not just the built-in standard types.. which now makes that syntax ambiguous if you're using un-typed parameters.
So my suggestion was to change the return-type syntax to occur inside ( ) so that it's not ambiguous with the parameter list.
The big PRO of using the return type is that enables other macro expansions using @LastReturnType which can correctly generate based on the proc that was called..
For example:
.if( MyProc() == 1.0 )
;assuming MyProc returns a REAL4
or
.if( MyProc() == al )
; assuming MyProc returns a BYTE
and this works with normal uinvoke syntax too if you're not keen on the c style calls.
This is much smarter than everything just assuming the return is always eax/rax.
Quote
The big PRO of using the return type is that enables other macro expansions
I don't see a benefit and your example is not much convincing, I see it as a potential source of bugs. If nobody uses it you will not be aware of the bugs, of course - this is probably what happens with other great features. I have my doubts much people uses them but have not done any pool.
Quote from: aw27 on February 01, 2018, 10:20:34 AM
Quote
The big PRO of using the return type is that enables other macro expansions
I don't see a benefit and your example is not much convincing, I see it as a potential source of bugs. If nobody uses it you will not be aware of the bugs, of course - this is probably what happens with other great features. I have my doubts much people uses them but have not done any pool.
Without a return type how would you expand:
.if( DotProduct(vec) == 0.0 )
; or
vmovaps xmm0, uinvoke(myfuncX, xmm2)
You'd have to wrap things in macros yourself and deal with special cases all over the place.. much easier if you have the ability to specify the return type which is then type-checked.
As long as these additions are not mandatory and no way affect normal asm code, it's a valuable addition.
Now, I understand the idea.
However, the example:
vmovaps xmm0, uinvoke(myfuncX, xmm2) is not a good one because reals can only return in xmm0 and we will have:
vmovaps xmm0, xmm0
:t
Quote from: aw27 on February 01, 2018, 11:29:52 PM
Now, I understand the idea.
However, the example:
vmovaps xmm0, uinvoke(myfuncX, xmm2) is not a good one because reals can only return in xmm0 and we will have:
vmovaps xmm0, xmm0
:t
lol.. good spotting.. make that vmovaps xmm1, ... then ;)
Getting myself all excited to start working on the plt/got stuff now.. would like to see the back of it and know it's done and working.
PS, with regards to Ragdog's original question.. the source he posted works perfectly for me pretty much as-is (apart from changing a few paths), I've attached my archive include the then built exe.
I used uasm32 and uasm64.. both produced the same result.
Tested UAsm with my major sources, everything OK now :t
Hello
My code works fine now :t
Hi
Just downloaded UASM 2.46.9 and recompiled some major sources without problems. :t
Biterider
Hello
I have some problems with my x64 project, if i use GetOpenFilename commdlg.inc ( WinInc209.zip).
It crash in GetOpenfileName if i use your OPENFILENAME structur.
The stuctur must alignment by 8
OPENFILENAME_ struct 8 ;-- padding (8 qword size) Thanks to fearless
In x86 works fine without alignment by 8
Regards,
Hi ragdog,
With x64, your assembler commandline must specify /Zp8
Thank you Jochen for this Information :t
Hello
I have try with the switch -zp8 it works but if i close my dialog crash it on WM_CLOSE or use i Uasm64 works not
.686
.MMX
.XMM
.x64
option casemap : none
option win64 : 15
option frame : auto
;option stackbase : rsp
_WIN64 EQU 1
WINVER equ 0501h
my settings is
C:\jWasm\bin\rc /v "DlgMain.Rc"
C:\jWasm\bin\uasm64.exe /c -win64 -Zp8 /win64 /Cp /nologo "DlgMain.Asm"
C:\jWasm\bin\link /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 /MACHINE:X64 /OUT:"DlgMain.exe" /LIBPATH:C:\jWasm\Lib\x64 "DlgMain.obj" "DlgMain.res"
Regards,
entry point in x64 needs:
WinMainCRTStartup proc FRAME
invoke GetModuleHandle,NULL
mov hInstance,rax;eax
invoke InitCommonControls
invoke DialogBoxParam,hInstance,IDD_DIALOG,NULL,addr DlgProc,NULL
invoke ExitProcess,0
ret
WinMainCRTStartup ENDP
...
; code
...
end WinMainCRTStartup
which replaces the start: and end start label entry point used in x86
Thank you Fearless i try out.
Fearless beat me to it.. :)
.686
.MMX
.XMM
.x64
option casemap : none
option win64 : 7
option frame : auto
option stackbase : rbp
include DlgMain.Inc
.code
WinMainCRTStartup PROC FRAME
invoke GetModuleHandle,NULL
mov hInstance,rax
invoke InitCommonControls
invoke DialogBoxParam,hInstance,IDD_DIALOG,NULL,addr DlgProc,NULL
invoke ExitProcess,0
ret
WinMainCRTStartup ENDP
;########################################################################
DlgProc proc frame hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.if uMsg == WM_NCCREATE
.elseif uMsg == WM_INITDIALOG
; Browse for JSON file to open
Invoke RtlZeroMemory, Addr JsonBrowseFilename, SIZEOF JsonBrowseFilename
push hWnd
pop BrowseFile.hwndOwner
lea rax, JsonBrowseFilter
mov BrowseFile.lpstrFilter, rax
lea rax, JsonBrowseFilename
mov BrowseFile.lpstrFile, rax
lea rax, JsonBrowseFileTitle
mov BrowseFile.lpstrTitle, rax
mov BrowseFile.nMaxFile, SIZEOF JsonBrowseFilename
mov BrowseFile.lpstrDefExt, 0
mov BrowseFile.Flags, OFN_EXPLORER
mov BrowseFile.lStructSize, SIZEOF BrowseFile
Invoke GetOpenFileName, Addr BrowseFile
; If user selected an JSON and didnt cancel browse operation...
.IF rax !=0
mov rax, TRUE
.ELSE
mov rax, FALSE
.ENDIF
.elseif uMsg==WM_COMMAND
.elseif uMsg==WM_CLOSE
invoke EndDialog,hWnd,0
invoke PostQuitMessage,0
.else
.endif
mov rax,TRUE
ret
DlgProc endp
end WinMainCRTStartup
under x64 you should always start with a proper PROC as the entry point, that way the assembler can correctly setup the stack and alignment.
You can use whatever you want, no need to pull in the CRT. This one, for example, just creates an enter 50h, 0:
include \Masm32\MasmBasic\Res\JBasic.inc ; ## builds in 32- or 64-bit mode with ML, AsmC, JWasm, HJWasm ##
Init ; OPT_64 1 ; put 0 for 32 bit, 1 for 64 bit assembly
Inkey Chr$("This code was assembled with ", @AsmUsed$(1), " in ", jbit$, "-bit format")
EndOfCode
This code was assembled with UAsm64 in 64-bit format
The Init stands for:.code
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
start proc
enter 50h, 0 ; align stack
start endp
Yep, you can definitely do it yourself, I just call the proc WinmainCRTStartup for convention, but that isn't actually linked with the CRT.