News:

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

Main Menu

UASM 2.41 Release + WinInc 2.09

Started by johnsa, September 29, 2017, 10:30:05 PM

Previous topic - Next topic

jimg

I've been reading this thread.  My bitrecord test runs now.  I still think it's defined wrong in windows.inc, but this test
.code
program:

xBITRECORD RECORD xBinary:1, xParity:1, xOutxCtsFlow:1, xOutxDsrFlow:1, xDtrControl:2,
     xDsrSensitivity:1, xTXContinueOnXoff:1, xOutX:1,xInX:1, xErrorChar:1, xNull:1,
     xRtsControl:2, xAbortOnError:1, xDummy2:17

mov dcbx.fbits, xBITRECORD < TRUE, NULL, TRUE, TRUE, DTR_CONTROL_HANDSHAKE, FALSE, \
                FALSE, FALSE, FALSE, FALSE, FALSE, RTS_CONTROL_HANDSHAKE, FALSE, NULL >
;used to give  : Error A2151: Missing operator in expression
    ret
end program

no longer gives the error comment.


However, I now get the following error in a rather large program I am currently working on.  I haven't isolated it yet, but when I do, I will post some code-
UASM v2.41, Sep 29 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.


***********
ASCII build
***********

F:\masm32\INCLUDE\winextra.inc(25183) : Error A2169: General Failure
F:\masm32\INCLUDE\winextra.inc(25183): Included by
  F:\masm32\INCLUDE\windows.inc(26889): Included by
   F:\WinAsm\Progs\Sol\Sol.asm(169): Main line code



the pertinent section of the output file looks like this-
                                markblk macro sectionname
>                                  tsiz = $ - markblockprevious
>                                  ctotmem=ctotmem+tsiz
>                                  markblockprevious = $
>                                  markblockname catstr markblockname,<," >,markblocksavename,<=>,%tsiz,<">
>                                  markblocksavename textequ <sectionname>
>                              endm

                                markblk stdlibs
= 0                         1      tsiz = $ - markblockprevious
= 0                         1      ctotmem=ctotmem+tsiz
00000000  = 0                1      markblockprevious = $
= ," =0"                    1      markblockname catstr <>,<," >,<>,<=>,<0>,<">
= stdlibs                   1      markblocksavename textequ <stdlibs>
                           Error A2169: General Failure


I'm working on getting a cleaner example of the problem.  Version 40 works without error.

jimg

Scratch that.  The error is occurring somewhere in the "include windows.inc" , which was the next line after the markblk macro.
I'll run it down and let you know what the conflict was.

jimg

I stripped the program down to this-
.686p
.model  flat, stdcall
option  casemap :none   ; case sensitive
.xmm

.data
ProgName db "Uasm Test",0
.code
.nolist
include windows.inc

.code

Program:

    invoke ExitProcess, 0
   
end Program


and get

UASM v2.41, Sep 29 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.


***********
ASCII build
***********

F:\masm32\INCLUDE\winextra.inc(25183) : Error A2169: General Failure
F:\masm32\INCLUDE\winextra.inc(25183): Included by
  F:\masm32\INCLUDE\windows.inc(26889): Included by
   R:\bugtest\Sol.asm(10): Main line code

If I take out the .nolist, I get
F:\masm32\INCLUDE\windows.inc(21253) : Error A2169: General Failure
F:\masm32\INCLUDE\windows.inc(21253): Included by
  R:\bugtest\Sol.asm(10): Main line code


So I really don't know how to pin down the error much more without stripping stuff out of windows.inc

p.s.

I just downloaded and installed the latest masm32v11r.zip to get windows.inc and winextra.inc to be sure mine weren't corrupted.  They were identical, so that's not the problem.

habran

#33
Thanks Jimg :t
I tried to build your example few days ago with masm32 windows.inc and didn't succeed
So, I tried WinInc and it was having a problem with DCB struct, so I changed it in winuser.inc to one from masm32 windows.inc and it was working fluently.
I was using this on the top:
.486
    .MODEL FLAT, stdcall
    option casemap:none

    pushcontext listing ;suppress listing of includes
    .nolist
WIN32_LEAN_AND_MEAN equ 1 ;this is to reduce assembly time
include     windows.inc
include     Winbase.inc
include     winuser.inc
include     Commctrl.inc
include     wingdi.inc
.list

includelib  kernel32.lib
includelib  user32.lib
includelib  comctl32.lib
includelib  gdi32.lib
I don't know what is going on with masm32 but lately I never succeeded to build anything neither 32 nor 64 bit, so I've gave up trying :(

So, do you agree with aw27 about the above issue, let as know which version you want please.

aw27, I have done "the magic behind the scene" but still investigating why it works only with LOCALS without FRAME, !@#$%^&&^%$# :icon_confused:
here is example:
--- awrec.asm ------------------------------------------------------------------
     1:    ; option casemap:none
     2:    ; option frame:auto    ;generate SEH-compatible prologues and epilogues
     3:     ;option win64:11       ;reserve stack space once per procedure
     4:
     5: includelib msvcrt.lib
     6:
     7: OPTION LITERALS:ON
     8:
     9: printf proto :ptr, :vararg
    10:
    11: _FP64 RECORD sign:1, exponent:11, mantissa:52
    12: _FP32 RECORD sign1:1, exponent1:7, mantissa1:24
    13: FP64_t UNION
    14: parts _FP64 <>
    15: number REAL8 ?
    16: FP64_t ENDS
    17: FP32_t UNION
    18: parts _FP32 <>
    19: number REAL8 ?
    20: FP32_t ENDS
    21: .data
    22: someDouble FP64_t <>
    23:     double32 FP32_t <>
    24: .code
    25:
    26: main proc ;FRAME USES rbx
00007FF65C8A1010 55                   push        rbp 
00007FF65C8A1011 48 8B EC             mov         rbp,rsp 
00007FF65C8A1014 48 83 EC 10          sub         rsp,10h 
    27: LOCAL someVar : dword
    28: mov someVar, 1
00007FF65C8A1018 C7 45 FC 01 00 00 00 mov         dword ptr [someVar],1 
    29: ; This assemble the record correctly when there is a frame as we have here now
    30:     mov ecx, _FP32<0,30h,99999Ah>
00007FF65C8A101F B9 9A 99 99 30       mov         ecx,3099999Ah 
    31:     mov double32.parts,_FP32<0,30h,99999Ah>
00007FF65C8A1024 C7 05 DA 3F 00 00 9A 99 99 30 mov         dword ptr [double32 (07FF65C8A5008h)],3099999Ah 
    32: mov rcx, _FP64<0, 400h, 999999999999Ah>
00007FF65C8A102E 48 B9 9A 99 99 99 99 99 09 40 mov         rcx,400999999999999Ah 
    33:     mov someDouble.parts, rcx
00007FF65C8A1038 48 89 0D C1 3F 00 00 mov         qword ptr [someDouble (07FF65C8A5000h)],rcx 
    34:     mov  someDouble.parts, _FP64<0, 400h, 999999999999Ah>               ;Here is that magic behind the scene
00007FF65C8A103F 48 B8 9A 99 99 99 99 99 09 40 mov         rax,400999999999999Ah 
    35: INVOKE printf, "Value %f", someDouble.number ; expected to print 3.2
00007FF65C8A1049 48 89 05 B0 3F 00 00 mov         qword ptr [someDouble (07FF65C8A5000h)],rax 
00007FF65C8A1050 48 83 EC 20          sub         rsp,20h 
00007FF65C8A1054 48 8B 15 A5 3F 00 00 mov         rdx,qword ptr [someDouble (07FF65C8A5000h)] 
00007FF65C8A105B 48 8D 0D C0 3F 00 00 lea         rcx,[__ls2393 (07FF65C8A5022h)] 
00007FF65C8A1062 E8 21 10 00 00       call        printf (07FF65C8A2088h) 
00007FF65C8A1067 48 83 C4 20          add         rsp,20h 
    36: ;mov rax, _FP64<0, 400h, 999999999999Ah>
    37: ;mov someDouble.parts, rax
    38:     ;mov  someDouble.parts, _FP64<0, 400h, 999999999999Ah>
    39:     ;vmovq someDouble.parts,xmm0
    40: ;and this does not work:
    41: ;mov someDouble.parts, _FP64<0, 400h, 999999999999Ah>
    42:
    43: ret
00007FF65C8A106B 48 83 C4 10          add         rsp,10h 
00007FF65C8A106F 5D                   pop         rbp 
00007FF65C8A1070 C3                   ret 
--- No source file -------------------------------------------------------------
The listing is a bit off but code is correct
we will have to look at that listing sooner or later :(
Cod-Father

habran

Actually, now everything builds fine with frame, without frame, with or without locals, the only problem is with that magic behind the scene ::)
However, that makes it easier to fix

Cod-Father

nidud

#35
deleted

aw27

Quote from: habran on October 01, 2017, 08:17:30 PM
Actually, now everything builds fine with frame, without frame, with or without locals,
:badgrin: :badgrin:
Without frame it prints ZERO, my friend.

habran

I think I have nail it now:
here is your test source with some additional lines, please test it which ever way you can think of
use the new uasm64.exe attached:

   ; option casemap:none
   ; option frame:auto    ;generate SEH-compatible prologues and epilogues
   ; option win64:11       ;reserve stack space once per procedure

includelib msvcrt.lib

OPTION LITERALS:ON

printf proto :ptr, :vararg

_FP64 RECORD sign:1, exponent:11, mantissa:52
_FP32 RECORD sign1:1, exponent1:7, mantissa1:24
FP64_t UNION
parts _FP64 <>
number REAL8 ?
FP64_t ENDS
FP32_t UNION
parts _FP32 <>
number REAL8 ?
FP32_t ENDS
.data
someDouble FP64_t <>
    double32 FP32_t <>
.code

main proc ;FRAME
;LOCAL someVar : dword
;mov someVar, 1

    mov ecx, _FP32<0,30h,99999Ah>
    mov double32.parts,_FP32<0,30h,99999Ah>
mov rcx, _FP64<0, 400h, 999999999999Ah>
    mov someDouble.parts, rcx
    mov  someDouble.parts, _FP64<0, 400h, 999999999999Ah>
INVOKE printf, "Value %f", someDouble.number ; expected to print 3.2
mov rax, _FP64<0, 400h, 999999999999Ah>
mov someDouble.parts, rax
        mov  someDouble.parts, _FP64<0, 400h, 999999999999Ah>
        vmovq someDouble.parts,xmm0
;and this now works:
mov someDouble.parts, _FP64<0, 400h, 999999999999Ah>
ret
main endp
end main
Cod-Father

aw27

Quote
here is your test source with some additional lines
Quote
This is not my test source!  It is a confusing salad.

Anyway, you fixed the issues according to this test suit:  :t


includelib \masm32\lib64\msvcrt.lib

OPTION LITERALS:ON

printf proto :ptr, :vararg

_FP64 RECORD sign:1, exponent:11, mantissa:52
_FP32 RECORD sign1:1, exponent1:8, mantissa1:23
FP64_t UNION
parts _FP64 <>
number REAL8 ?
FP64_t ENDS
FP32_t UNION
parts _FP32 <>
number REAL4 ?
FP32_t ENDS
.data
    someDouble1 FP64_t <>
    someDouble2 FP64_t <>
    float FP32_t <>
.code

test1 proc
LOCAL _real8 : REAL8
mov ecx, _FP32<0, 80h,4ccccdh>
mov float.parts,ecx
fld float.number
fstp _real8
INVOKE printf, "\nValue %f", _real8 ; expected to print 3.2
ret
test1 endp

test2 proc
mov rcx, _FP64<0, 400h, 999999999999Ah>
mov someDouble1.parts, rcx
INVOKE printf, "\nValue %f", someDouble1.number ; expected to print 3.2
ret
test2 endp

test3 proc
mov  someDouble2.parts, _FP64<0, 400h, 999999999999Ah>
INVOKE printf, "\nValue %f", someDouble2.number ; expected to print 3.2
ret
test3 endp

main proc
INVOKE printf, "Tests will pass if value is 3.2, otherwise fail\n"
INVOKE test1
INVOKE test2
INVOKE test3
ret
main endp
end main



But, 64-bit records are NOT supported by UASM in 32-bit assembling.  You did not mention that anywhere. In C they are supported in 32-bit as well

habran

That is something wrong with John's .cmd for building with DDK
here is uasm32.exe a debug version built with MSVS 2013 Community
Cod-Father

habran

After some rethinking about what you said I am not sure what did you mean, however, if you mean 32 bit assembly programming with 64 bit records, I couldn't care less :badgrin:
Cod-Father

aw27

Quote from: habran on October 02, 2017, 12:24:34 AM
After some rethinking about what you said I am not sure what did you mean, however, if you mean 32 bit assembly programming with 64 bit records, I couldn't care less :badgrin:
I would care, 32-bit will be here for next 20 years, at least.  :shock:

jimg

Quote from: habran on October 01, 2017, 07:47:05 PM
Thanks Jimg :t
I tried to build your example few days ago with masm32 windows.inc and didn't succeed
So, I tried WinInc and it was having a problem with DCB struct, so I changed it in winuser.inc to one from masm32 windows.inc and it was working fluently.
I was using this on the top:

.486
    .MODEL FLAT, stdcall
    option casemap:none

    pushcontext listing ;suppress listing of includes
    .nolist
WIN32_LEAN_AND_MEAN equ 1 ;this is to reduce assembly time
include     windows.inc
include     Winbase.inc
include     winuser.inc
include     Commctrl.inc
include     wingdi.inc
.list

includelib  kernel32.lib
includelib  user32.lib
includelib  comctl32.lib
includelib  gdi32.lib

I don't know what is going on with masm32 but lately I never succeeded to build anything neither 32 nor 64 bit, so I've gave up trying :(

So, do you agree with aw27 about the above issue, let as know which version you want please.


You guys have me confused at this point, but all my test regarding bitrecord now work properly.  It is masm that has the bug.

I'm more concerned about the above general failure problem, would you like me to start a new thread for it?

habran

Jimg, it would be great if we start a new thread :t
Cod-Father

johnsa

The issue with the record as Habran discovered seems to be coming from the use of the DDK C compiler, being 12 years old I'd really like to get away from it now.

I've made a test-build for x64 using VS 2017, if it works as well and as fast as previous DDK versions (and we know it fixes the record issue and has better C99 compliance) then I will move forward using that for Windows builds.

If you'd like to test it out:

www.terraspace.co.uk/uasm64_vs17.zip

PS, JimG I tried your sample code using both WinInc and windows.inc from masm32 package and wasn't able to re-produce the general failure.