News:

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

Main Menu

MASM bug

Started by jj2007, August 09, 2019, 10:49:26 PM

Previous topic - Next topic

jj2007

Two lines from a source that assembles just fine with UAsm or AsmC:

DlgControl dcStatic,  "Files containing both strings:", SS_LEFT or WS_BORDER, 1, -7, 60.0
DlgControl dcStatic,  "maxMB=", SS_LEFT, 73.0%, -7, 31%


There are four methods to make it work with MASM (everything is fine with UAsm and AsmC):
1. add a comment to the second line
2. comment out the previous line
3. take a % sign off the second line (either 73.0% or 31%, both work)
4. brackets around SS_LEFT or WS_BORDER

To test it,
- install the latest MasmBasic package
- extract the attached files to a folder on your Masm32 drive
- open FindOnDiskMasmBug.asc in \Masm32\MasmBasic\RichMasm.exe
- hit F6 and see error A2026:constant expected DlgControl(1)
- apply any of the four methods above to fix the bug :cool:

hutch--

 :biggrin:

Is this another MASM feature you have not controlled properly ?  :skrewy:

jj2007


TimoVJL

.386
.model flat, stdcall

Test2 MACRO par1,par2,par3
LOCAL isp
ECHO Test2 <par1> <par2> <par3>
isp INSTR <par1>, <.>
if isp
ECHO isp 1
else
ECHO isp 0
endif
ENDM

.code
Test2 73, -7,10
Test2 73.0%, -7,10%
Test2 73.0%,-7,10.0%
ret
END
add ; after last Test2 line to see difference
without it:Test2 <73.0> <-7> <10.0-0>
May the source be with you

jj2007

Thanks, Timo, your example shows the problem very clearly. I've made a minor modification:
.386
.model flat, stdcall

Test2 MACRO par1,par2,par3
LOCAL isp
ECHO Test2 <par1> <par2> <par3>
isp INSTR <par1>, <.>
if isp
ECHO _isp 1
else
ECHO _isp 0
endif
ENDM

.code
Test2 71, -7,10
Test2 72.0%, -7,11%
Test2 73.0%,-7,12.3%
ret
END


*** Assemble using UAsm64  ***
Test2 <71> <-7> <10>
_isp 0
Test2 <72.0> <-7> <11>
_isp 1
Test2 <73.0> <-7> <12.3>
_isp 1


*** Assemble using ml  ***
Test2 <71> <-7> <10> ; passes, OK
_isp 0
Test2 <72.0> <-7> <11> ; passes, OK
_isp 1
tmp_file.asm(18) : error A2026:constant expected
Test2(1): Macro Called From
  tmp_file.asm(18): Main Line Code
Test2 <73.0> <-7> <12.30> ; chokes and adds a zero
_isp 1


Now, if you change the second line from 11% to 11.1%, everything works fine again. Even the added zero in the next line disappears.

We can argue now whether it's a genuine MASM bug, if MASM is simply too old to be useful, or if MASM lacks important features. The conclusion is always the same: use UAsm or AsmC :biggrin:

HSE

Sorry I missed the purpose of "%". Is there any?
Equations in Assembly: SmplMath

jj2007

Quote from: HSE on August 10, 2019, 04:11:43 AM
Sorry I missed the purpose of "%". Is there any?

It's percent, and it's useful e.g. for telling the program "use 30% of the window width". Friendly syntax - BASIC :tongue:

HSE

Quote from: jj2007 on August 10, 2019, 04:27:20 AM
It's percent, and it's useful e.g. for telling the program "use 30% of the window width". Friendly syntax - BASIC :tongue:

But removing every "%", nothing change.
Equations in Assembly: SmplMath

jj2007

Quote from: HSE on August 10, 2019, 04:40:53 AM
Quote from: jj2007 on August 10, 2019, 04:27:20 AM
It's percent, and it's useful e.g. for telling the program "use 30% of the window width". Friendly syntax - BASIC :tongue:

But removing every "%", nothing change.

Right, the macro ignores it. It's just easier to recognise as a percentage from the coder's perspective.

HSE

Equations in Assembly: SmplMath