Hi Branislav & John. You are doing great good job for all asm community. I really like hjwasm, but I found several bugs (tested on hjwasm32.exe only).
Bug#1: Incorrect "while" parsing.
Simple source:
start:
xor edx,edx
mov ecx,1
.while (edx ==0 || edx ==1) && (SDWORD ptr ecx >=0)
inc edx
dec ecx
.endw
.if edx == 2
invoke MessageBox,0,0,0,MB_OK
.else
invoke MessageBox,0,0,0,MB_ICONERROR
.endif
invoke ExitProcess,0
end start
ML.exe (6.14.8444) code:
start:
xor edx, edx
mov ecx, 1
jmp While_check
do_while:
inc edx
dec ecx
While_check:
or edx, edx
jz While_check2
cmp edx, 1
jnz jmp_from_while
While_check2:
cmp ecx, 0
jge do_while
jmp_from_while:
HJWasm v2.17, Dec 5 2016 code:
start:
xor edx, edx
mov ecx, 1
jmp While_check
do_while:
inc edx
dec ecx
While_check:
cmp edx, 0
jz jmp_from_while
cmp edx, 1
jnz jmp_from_while
cmp ecx, 0
jge do_while
jmp_from_while:
Bug#2: For Win64 in many cases missing error: "Register value overwritten by INVOKE" for registers: rcx(ecx) & rdx(edx)
Simple case:
TestProc1 proc Par1:QWORD,Par2:QWORD,Par3:QWORD,Par4:QWORD,Par5:QWORD
ret
TestProc1 endp
start:
mov rcx,555h
mov rdx,666h
invoke TestProc1,111h,rcx,rdx,0,0
end start
40001005: mov rcx, 0x555
4000100C: mov rdx, 0x666
40001013: mov rcx, 0x111
4000101A: mov rdx, rcx
4000101D: mov r8, rdx
40001020: xor r9d, r9d
40001023: mov qword [rsp+0x20], 0x0
4000102C: call 0x40001000
Bug#3 Creating stack error (HJWasm v2.17, Dec 9 2016 bug) , HJWasm v2.13 - works fine.
Simple source:
func proc
LOCAL Buff[128]:byte
xor eax,eax
ret
func endp
55 PUSH EBP
8BEC MOV EBP,ESP
81C4 7FFFFFFF ADD ESP,-81 ;???????????
33C0 XOR EAX,EAX
8BE5 MOV ESP,EBP
5D POP EBP
C3 RET
Bug#4: Completely broken source mode debugging since HJWasm v2.13, Feb 13 2016.
In some of my projects converted from masm to hjwasm, /Zd parameter not generating line number debug information. In code section "number of lines number" = 1 and LINENUMBERS information present only for the first line.
HJWasm v2.13, Feb 13 2016 - source debugging works perfectly.
HJWasm v2.15r2, Oct 1 2016 - source debugging not working.
HJWasm v2.15, Sep 6 2016 - source debugging not working.
HJWasm v2.17, Dec 9 2016 - source debugging not working.
After all of this, HJWasm v2.13 is more stable(bug#3 and Bug#4 not present).