News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Error: line too long while using backslash

Started by bluedevil, September 14, 2022, 07:16:32 AM

Previous topic - Next topic

HSE

Hi bluedevil!

You can try to make line shorter defining for exampleMyStyle equ WS_OVERLAPPED or WS_ ...

HSE
Equations in Assembly: SmplMath

hutch--

This is what I use for a normal CreateWindowEx() window.

    invoke CreateWindowEx,WS_EX_LEFT or WS_EX_ACCEPTFILES, \
                          ADDR classname,ADDR caption, \
                          WS_OVERLAPPED or WS_VISIBLE,\
                          lft,top,wid,hgt,0,0,hInstance,0
    mov hWnd, rax

With the examples you posted, the following line,

WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX or WS_MAXIMIZEBOX or WS_VISIBLE

can be put into a variable (or register) so that you only use the variable in the CreateWindowEx() function call which shortens the absolute line length.

zedd151

Out of curiosity I decided to give this a whirl... So I installed Windows 7 64 bit so I could test a theory I had....
Assembled your code exactly as posted; named the source file test.asm :

C:\Users\Administrator\Desktop>set appname=test
C:\Users\Administrator\Desktop>del test.obj
C:\Users\Administrator\Desktop>del test.exe
C:\Users\Administrator\Desktop>REM \masm64\bin64\rc.exe /v test.rc
C:\Users\Administrator\Desktop>REM \masm64\bin64\Cvtres.exe /machine:x64 DialogW
ithManifest.res
C:\Users\Administrator\Desktop>\masm64\bin64\ml64.exe /c test.asm
Microsoft (R) Macro Assembler (x64) Version 14.33.31629.0
Copyright (C) Microsoft Corporation.  All rights reserved.
Assembling: test.asm

C:\Users\Administrator\Desktop>\masm64\bin64\link.exe /SUBSYSTEM:WINDOWS /LARGEA
DDRESSAWARE test.obj
Microsoft (R) Incremental Linker Version 14.33.31629.0
Copyright (C) Microsoft Corporation.  All rights reserved.

C:\Users\Administrator\Desktop>dir test.exe
Volume in drive C has no label.
Volume Serial Number is 5A5F-D2AF
Directory of C:\Users\Administrator\Desktop

09/13/2022  10:21 PM             5,120 test.exe
               1 File(s)          5,120 bytes
               0 Dir(s)  11,390,537,728 bytes free
C:\Users\Administrator\Desktop>pausePress any key to continue . . .

edit = used same batch file as posted, the first time had a slightly different batch file...
Seems to assemble here with no problems. Same ml64 version and linker version as yours, so that rules out a difference with jj's ml64 version (Macro Assembler (x64) Version 14.30.30705.0)
   I thought there could be a discrepancy between ml64 versions but it appears not in this case. So therefore I don't know what to tell you...

jj2007


bluedevil

Quote from: HSE on September 14, 2022, 09:37:49 AM
You can try to make line shorter defining for exampleMyStyle equ WS_OVERLAPPED or WS_ ...

Quote from: hutch-- on September 14, 2022, 10:18:19 AM
This is what I use for a normal CreateWindowEx() window.

    invoke CreateWindowEx,WS_EX_LEFT or WS_EX_ACCEPTFILES, \
                          ADDR classname,ADDR caption, \
                          WS_OVERLAPPED or WS_VISIBLE,\
                          lft,top,wid,hgt,0,0,hInstance,0
    mov hWnd, rax

With the examples you posted, the following line,

WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX or WS_MAXIMIZEBOX or WS_VISIBLE

can be put into a variable (or register) so that you only use the variable in the CreateWindowEx() function call which shortens the absolute line length.

Guys, thank you for your replies and suggestions. I am also using that kind of clean code conventions while writing. You missed the point i have mentioned:
Quote from: bluedevil on September 14, 2022, 07:45:53 AM
I am writing iczelions win32 tutorials samples in MASM64 SDK beta 2.

I used this way because I'm trying to stay true to the original
QuoteWS_OVERLAPPED+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_VISIBLE


@jj
How are you doing this? Code on your zip file also compiles on my machine right now!!!
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

jj2007

Quote from: bluedevil on September 14, 2022, 06:54:09 PM
@jj
How are you doing this? Code on your zip file also compiles on my machine right now!!!

Zip your non-assembling source and post it here. I am curious, too.

hutch--

bluedevil,

I will let you in on a well known piece of information, Iczelion was a personal friend of mine, we developed the early part of Win32 asm together. When he retired (life, wife, kids work etc ...) he passed the maintainance of his work to me, some of which I have tweaked but it was basically too old and had errors that needed to be rewritten. The problem back when they were written was that information was very hard to get.

Register preservation conventions.

Notation like using "or" rather than "+" and with Win64, the architecture is different. Trying to use push/call notation will run into many serious problems.

What you are after can be done in 64 bit and you can produce very similar looking code but at its lowest level, the architecture is very different. The calling convention is Win64 FASTCALL, stack alignment is critical yet there are many advantages with Win64, more efficient procedure calls with lower overhead, twice as many integer registers and 64 but data rather than 32 bit.

TimoVJL

As WS_OVERLAPPED                        equ 0handWS_OVERLAPPEDWINDOW                  equ WS_OVERLAPPED OR WS_CAPTION OR WS_SYSMENU OR WS_THICKFRAME OR WS_MINIMIZEBOX OR WS_MAXIMIZEBOXwhere someone needs WS_OVERLAPPED ?
May the source be with you

jj2007

Quote from: bluedevil on September 14, 2022, 07:45:53 AMI used this way because I'm trying to stay true to the original
QuoteWS_OVERLAPPED+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_VISIBLE

When Iczelion wrote this code about 20 (?) years ago, he did a brilliant job. However, he was young and probably had not yet been bitten by the "+ vs or" problem. It is not forbidden to improve Iczelion's code.

Windows.inc:
WS_OVERLAPPEDWINDOW                  equ WS_OVERLAPPED OR WS_CAPTION OR WS_SYSMENU OR WS_THICKFRAME OR WS_MINIMIZEBOX OR WS_MAXIMIZEBOX
WS_TILEDWINDOW                       equ WS_OVERLAPPEDWINDOW
WS_POPUPWINDOW                       equ WS_POPUP OR WS_BORDER OR WS_SYSMENU
...
WS_EX_OVERLAPPEDWINDOW               equ WS_EX_WINDOWEDGE OR WS_EX_CLIENTEDGE
WS_EX_PALETTEWINDOW                  equ WS_EX_WINDOWEDGE OR WS_EX_TOOLWINDOW OR WS_EX_TOPMOST
...
LBS_STANDARD                         equ LBS_NOTIFY OR LBS_SORT OR WS_VSCROLL OR WS_BORDER


Unrelated (WinExtra.inc):
ERROR_EXPECTED_SECTION_NAME      equ APPLICATION_ERROR_MASKorERROR_SEVERITY_ERRORor0
ERROR_BAD_SECTION_NAME_LINE      equ APPLICATION_ERROR_MASKorERROR_SEVERITY_ERRORor1

zedd151

I woke up this morning with an odd but related notion. I always save my source code as ascii text since I use qeditor as my code editor. While saving as Unicode with a different editor then assembling it, would ml64 consider the line of text twice as long (in bytes) or is it counting characters? I seldom use Unicode, and use 64 bit code only rarely in comparison to the experience I have with 32 bit code.


This question is for hutch, jj or anyone else with much more experience with different situations than me regarding ml64, unicode or a combination of both.


This is posted from my iPad, will look into this when I get back to my computer. Now I wanna test this theory.
As a side note:
I played around with this code last night; indenting the argument lines further to the right, and produced the same error as bluedevil had gotten, but that was with more white space than in his posted code.

jj2007

I can answer your question as soon as you make the effort to zip your source and post it here.

zedd151

Quote from: jj2007 on September 14, 2022, 11:24:10 PM
I can answer your question as soon as you make the effort to zip your source and post it here.
My question, or are you addressing bluedevil?  If you are responding to my question, it'll have to wait. I'm not in front of my computer at the moment. I'm away from home posting from my ipad. If I were at home I would test this myself. But since I'm out and about, I posted this little theory I had.  :tongue:


Either way, I'm using the exact code as in post #4 in this thread other than changing + to ' or '. (Except for the mentioned white space experiment I had done)

zedd151

#27
Okay, my theory didn't quite work at all. Saved the file as uncode this is the response:
Could Not Find C:\Users\Administrator\Desktop\TUTE18.obj
Could Not Find C:\Users\Administrator\Desktop\TUTE18.exe
Microsoft (R) Macro Assembler (x64) Version 14.33.31629.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Assembling: TUTE18.asm
TUTE18.asm(1) : error A2044:invalid character in file
TUTE18.asm(2) : error A2008:syntax error : p
TUTE18.asm(7) : error A2109:only white space or comment can follow backslash
TUTE18.asm(9) : error A2109:only white space or comment can follow backslash
TUTE18.asm(11) : error A2109:only white space or comment can follow backslash
TUTE18.asm(14) : error A2008:syntax error : S
TUTE18.asm(19) : error A2109:only white space or comment can follow backslash
TUTE18.asm(21) : error A2109:only white space or comment can follow backslash
TUTE18.asm(23) : error A2109:only white space or comment can follow backslash
TUTE18.asm(29) : error A2109:only white space or comment can follow backslash
TUTE18.asm(31) : error A2109:only white space or comment can follow backslash
TUTE18.asm(33) : error A2109:only white space or comment can follow backslash
TUTE18.asm(39) : error A2008:syntax error : n
TUTE18.asm(44) : error A2008:syntax error : .
TUTE18.asm(45) : error A2008:syntax error : I
TUTE18.asm(46) : error A2008:syntax error : I
TUTE18.asm(47) : error A2008:syntax error : I
TUTE18.asm(49) : error A2008:syntax error : P
TUTE18.asm(50) : error A2008:syntax error : P
TUTE18.asm(51) : error A2008:syntax error : P
TUTE18.asm(52) : error A2008:syntax error : P
TUTE18.asm(53) : error A2008:syntax error : P
TUTE18.asm(58) : error A2008:syntax error : .
TUTE18.asm(59) : error A2008:syntax error : C
TUTE18.asm(60) : error A2008:syntax error : A
TUTE18.asm(61) : error A2008:syntax error : P
TUTE18.asm(62) : error A2008:syntax error : M
TUTE18.asm(63) : error A2008:syntax error : T
TUTE18.asm(68) : error A2008:syntax error : .
TUTE18.asm(69) : error A2008:syntax error : o
TUTE18.asm(70) : error A2008:syntax error : I
TUTE18.asm(71) : error A2008:syntax error : I
TUTE18.asm(72) : error A2008:syntax error : C
TUTE18.asm(73) : error A2008:syntax error : P
TUTE18.asm(74) : error A2008:syntax error : S
TUTE18.asm(75) : error A2008:syntax error : u
TUTE18.asm(77) : error A2008:syntax error : .
TUTE18.asm(79) : error A2008:syntax error : W
TUTE18.asm(81) : error A2008:syntax error : i
TUTE18.asm(82) : error A2008:syntax error : m
TUTE18.asm(84) : error A2008:syntax error : i
TUTE18.asm(85) : error A2008:syntax error : m
TUTE18.asm(87) : error A2008:syntax error : i
TUTE18.asm(88) : error A2008:syntax error : i
TUTE18.asm(90) : error A2008:syntax error : r
TUTE18.asm(92) : error A2008:syntax error : W
TUTE18.asm(94) : error A2008:syntax error : i
TUTE18.asm(96) : error A2008:syntax error : O
TUTE18.asm(97) : error A2008:syntax error : O
TUTE18.asm(98) : error A2008:syntax error : O
TUTE18.asm(100) : error A2008:syntax error : i
TUTE18.asm(101) : error A2008:syntax error : m
TUTE18.asm(102) : error A2008:syntax error : i
TUTE18.asm(103) : error A2008:syntax error : m
TUTE18.asm(105) : error A2008:syntax error : o
TUTE18.asm(106) : error A2008:syntax error : o
TUTE18.asm(107) : error A2008:syntax error : l
TUTE18.asm(108) : error A2008:syntax error : o
TUTE18.asm(109) : error A2008:syntax error : o
TUTE18.asm(110) : error A2008:syntax error : o
TUTE18.asm(111) : error A2008:syntax error : m
TUTE18.asm(112) : error A2008:syntax error : o
TUTE18.asm(113) : error A2008:syntax error : m
TUTE18.asm(114) : error A2008:syntax error : o
TUTE18.asm(115) : error A2008:syntax error : m
TUTE18.asm(116) : error A2008:syntax error : o
TUTE18.asm(117) : error A2008:syntax error : o
TUTE18.asm(118) : error A2008:syntax error : o
TUTE18.asm(119) : error A2008:syntax error : l
TUTE18.asm(120) : error A2008:syntax error : o
TUTE18.asm(121) : error A2008:syntax error : o
TUTE18.asm(122) : error A2008:syntax error : i
TUTE18.asm(124) : error A2042:statement too complex
TUTE18.asm(128) : error A2039:line too long
TUTE18.asm(136) : error A2008:syntax error : m
TUTE18.asm(138) : error A2008:syntax error : i
TUTE18.asm(139) : error A2008:syntax error : i
TUTE18.asm(141) : error A2008:syntax error : .
TUTE18.asm(142) : error A2008:syntax error : i
TUTE18.asm(143) : error A2008:syntax error : .
TUTE18.asm(144) : error A2008:syntax error : .
TUTE18.asm(145) : error A2008:syntax error : .
TUTE18.asm(146) : error A2008:syntax error : i
TUTE18.asm(147) : error A2008:syntax error : i
TUTE18.asm(148) : error A2008:syntax error : .
TUTE18.asm(150) : error A2008:syntax error : o
TUTE18.asm(152) : error A2008:syntax error : r
TUTE18.asm(154) : error A2008:syntax error : W
TUTE18.asm(156) : error A2008:syntax error : n
TUTE18.asm(158) : error A2008:syntax error : .
TUTE18.asm(159) : error A2042:statement too complex
TUTE18.asm(159) : error A2039:line too long
TUTE18.asm(170) : error A2008:syntax error : h
TUTE18.asm(172) : error A2008:syntax error : m
TUTE18.asm(174) : error A2008:syntax error : m
TUTE18.asm(175) : error A2008:syntax error : m
TUTE18.asm(176) : error A2008:syntax error : s
TUTE18.asm(178) : error A2008:syntax error : i
TUTE18.asm(179) : error A2008:syntax error : i
TUTE18.asm(181) : error A2008:syntax error : i
TUTE18.asm(182) : fatal error A1012:error count exceeds 100; stopping assembly
Microsoft (R) Incremental Linker Version 14.33.31629.0
Copyright (C) Microsoft Corporation.  All rights reserved.


LINK : fatal error LNK1181: cannot open input file 'TUTE18.obj'
Volume in drive C has no label.
Volume Serial Number is 5A5F-D2AF


Directory of C:\Users\Administrator\Desktop


File Not Found
Press any key to continue . . .

So no it wouldn't work as unicode. Even I thought my notion was 'odd' after all. This proves its oddness.  :toothy:  ml64 doesn't like unicode source file.

zedd151

#28
The same but saved as ascii text


response:
Microsoft (R) Macro Assembler (x64) Version 14.33.31629.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Assembling: TUTE18.asm
Microsoft (R) Incremental Linker Version 14.33.31629.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Volume in drive C has no label.
Volume Serial Number is 5A5F-D2AF


Directory of C:\Users\Administrator\Desktop


09/14/2022  08:59 AM             5,120 TUTE18.exe
               1 File(s)          5,120 bytes
               0 Dir(s)  11,423,076,352 bytes free
Press any key to continue . . .
Back to some semblence of normalcy.  :biggrin:

TimoVJL

ml64.exe handle only ASCII and UTF-8 without signature source files.
May the source be with you