News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

MASM32 version 11 pre-Release 3

Started by hutch--, November 24, 2011, 07:36:25 AM

Previous topic - Next topic

hutch--

Still builds correctly. I need to be able to see what the problem is and with code that builds correctly in the default installation of version 11 I am not seeing it.



IF 0  ; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
                      Build this template with "CONSOLE ASSEMBLE AND LINK"
ENDIF ; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    __UNICODE__ equ 1

    useMasm32 = 1 ; 1 to choke, 0 to go
    ife useMasm32
      include \masm32\include\masm32rt.inc
    else
    include \masm32\include\masm32rt.inc
    endif

    .code

start:
   
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    call main
    inkey
    exit

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

main proc

    LOCAL var   :DWORD

    mov var, 1234567

    print "Numbers ",48,49,50,51,52,53,54,55,56,57,13,10
    print "Howdy "
    print ustr$(var)
    print chr$(13,10)

    print right$(left$(rev$(ustr$(uval(rev$(chr$(48,49,50,51,52,53,54,55))))),6),5),13,10

    ret

main endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

end start
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

qWord

hutch,
use jj last example.
The problem is the GOTO-construct in chr$: changing it to a IF/ELSE, solves the problem.

.nolist
useMasm32 = 0      ; 1 to choke, 0 to go
ife useMasm32
   include \masm32\include\masm32rt.inc
else
   include \masm32\include\masm32rt.inc
endif
.listall
.code
start:
  if 1   ; <<<<<<<<<<<<<< trouble starts here <<<<<<<<<<<<<<<<<
   nop           ; v v v v v no trouble without the 9 v v v v
   print "Ciao ", 9
   nop
  else   ; <<<<<<<<<<<<<<<<< works if commented out <<<<<<<<<<<<<<<<
   nop
  endif
   inkey "bye"
   exit
end start
FPU in a trice: SmplMath
It's that simple!

jj2007

Or add this to your example:
if 1
    print "Numbers ",48,49,50,51,52,53,54,55,56,57,13,10
else
    nop
endif

hutch--

qWord, your example builds perfectly here.


Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: K:\jj\elsebug2\tst2.asm

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

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

Volume in drive K is drv_k
Volume Serial Number is 4421-FFA6

Directory of K:\jj\elsebug2

11/27/2011  09:06 AM               464 tst2.asm
11/27/2011  09:06 AM             2,560 tst2.exe
11/27/2011  09:06 AM             1,045 tst2.obj
               3 File(s)          4,069 bytes
               0 Dir(s)  248,225,157,120 bytes free
Press any key to continue . . .


JJ,

Builds correctly here.


.nolist
useMasm32 = 0      ; 1 to choke, 0 to go
ife useMasm32
   include \masm32\include\masm32rt.inc
else
   include \masm32\include\masm32rt.inc
endif
.listall
.code
start:
  if 1   ; <<<<<<<<<<<<<< trouble starts here <<<<<<<<<<<<<<<<<
   nop           ; v v v v v no trouble without the 9 v v v v
   print "Ciao ", 9
   nop
  else   ; <<<<<<<<<<<<<<<<< works if commented out <<<<<<<<<<<<<<<<
   nop
  endif

if 1
    print "Numbers ",48,49,50,51,52,53,54,55,56,57,13,10
else
    nop
endif

   inkey "bye"
   exit
end start


This nests correctly as well.


    IFNDEF 1
      IFNDEF 1
        IFNDEF 1
          IFNDEF 1
            IFNDEF 1
              IFNDEF 1
                IFNDEF 1
                  IFNDEF 1
                    IFNDEF 1
                      IFNDEF 1
                        print "Howdy Folks",13,10
                      ELSE
                        nop
                      ENDIF
                    ELSE
                      nop
                    ENDIF
                  ELSE
                    nop
                  ENDIF
                ELSE
                  nop
                ENDIF
              ELSE
                nop
              ENDIF
            ELSE
              nop
            ENDIF
          ELSE
            nop
          ENDIF
        ELSE
          nop
        ENDIF
      ELSE
        nop
      ENDIF
    ELSE
      nop
    ENDIF


You guys must be doing something different, all of this stuff so far builds correctly in version 11.

I changed the ML version to 9.00 and it works exactly as before with 6.14.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

qWord

there is definitely a bug caused by the GOTO-directive in chr$:
ife 1
   include \masm32\include\masm32rt.inc
else
   include \masm32\include\masm32rt.inc
endif
.code
start:
  if 1
mov eax,chr$("1234")
else
  endif
end start


Quoteml /c /coff /Cp "main.asm"
Assembling: main.asm

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

main.asm(10) : error A2002:cannot have more than one ELSE clause per IF block
Microsoft (R) Macro Assembler Version 11.00.40825.2
Copyright (C) Microsoft Corporation.  All rights reserved.


Error(s) occured.
FPU in a trice: SmplMath
It's that simple!

hutch--

OK, that example tracks the problem down. Its a clash between "if" and "ife"

Change ife to if and it builds, alternately change if to ife and it builds. It does not occur if the "ife" block is put in the code section of this example.


ife 1
   include \masm32\include\masm32rt.inc
else
   include \masm32\include\masm32rt.inc
endif

.code
start:
  if 1
  mov eax,chr$("1234")
else
  endif
end start


Now the problem as I see it is the naive replacement of "chr$()" with a conditional block version is likely to just shift the problem elsewhere.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

qWord

Quote from: hutch-- on November 26, 2011, 11:05:37 PMNow the problem as I see it is the naive replacement of "chr$()" with a conditional block version is likely to just shift the problem elsewhere.
I've had similar problems several times (IFxx/ELSExx/ELSE/ENDIF + GOTO) - believe me, removing GOTO is the best choice.
FPU in a trice: SmplMath
It's that simple!

mineiro

If I double click masm32\datetime\demo\WorldTimes.exe says that do not have found datetime.dll.
But, if build again works fine (if I click in masm32\datetime\demo\makeit.bat works correct).

hutch--

This version of chr$() works with the example that broke the last one that used "ife"



      chr$ MACRO any_text:VARARG
        LOCAL txtname,lbl1,lbl2,flag
          .data

            IFDEF __UNICODE__
              flag = 1
            ELSE
              flag = 0
            ENDIF

            IF flag eq 0
              txtname db any_text,0
              align 4
            ENDIF

            IF flag eq 1
            WSTR txtname,any_text
            align 4
            ENDIF

          .code
         EXITM <OFFSET txtname>
      ENDM


mineiro,

Thanks, I will have a look at it.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

qWord

a bit simpler:
chr$ MACRO any_text:VARARG
LOCAL txtname
  .data
    IFNDEF __UNICODE__
      txtname db any_text,0
    ELSE
      WSTR txtname,any_text
    ENDIF
    align 4
  .code
EXITM <OFFSET txtname>
ENDM
FPU in a trice: SmplMath
It's that simple!

jj2007

Quote from: qWord on November 26, 2011, 11:39:32 PM
a bit simpler:

Resembles a little bit my version. By the way: What is the purpose of aligning after the string?

qWord

Quote from: jj2007 on November 26, 2011, 11:47:07 PM
Quote from: qWord on November 26, 2011, 11:39:32 PM
a bit simpler:

Resembles a little bit my version. By the way: What is the purpose of aligning after the string?
:bg
I think he want to leave the segment aligned? I also wouldn't do it, but on the other hand, it doesn't hurt.
...
mov eax,chr$(...)
.data
    myDW dd ?  ; align not needed
.code
...
FPU in a trice: SmplMath
It's that simple!

jj2007


qWord

FPU in a trice: SmplMath
It's that simple!

hutch--

Its easy to write it simpler with just one conditional block but I intentionally wrote it with the double step to avoid another problem of nesting. The local flag does the job and if falls out the bottom of the block, the two IF blocks are fall through and the EXITM <> is off the bottom of all of the conditional blocks without being enclosed by them. It does not need the two local labels of course, I simply forgot to remove them while testing.

I tend to align uncontrolled size data on exit so the next item is not misaligned.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php