The MASM Forum

General => The Campus => Topic started by: RAFAAJ2000 on January 14, 2013, 08:29:43 PM

Title: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 14, 2013, 08:29:43 PM
If I save the file somewhere else the code just doesn't assemble !  ......  Have I missed something during the MASM32 installation ? or is there a setting somewhere that I need to change ?

Thanks in advance.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: jj2007 on January 14, 2013, 08:53:32 PM
Rafaaj,

Please refrain from opening new threads (@moderator: could this be merged to the other "Why does this.." thread?)

We are very bad at reading your thoughts and guessing your problems. Therefore, to get help, you should:
- post complete code including the headers (members need to test it, and are too lazy to add the includes themselves)
- post error messages (type, line in source code, ...)
:icon14:
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 14, 2013, 09:03:37 PM
Quote from: jj2007 on January 14, 2013, 08:53:32 PM
Rafaaj,

Please refrain from opening new threads (@moderator: could this be merged to the other "Why does this.." thread?)

We are very bad at reading your thoughts and guessing your problems. Therefore, to get help, you should:
- post complete code including the headers (members need to test it, and are too lazy to add the includes themselves)
- post error messages (type, line in source code, ...)
:icon14:

Any code must be saved in the bin folder for it to work and I get no errors whatsoever when assembling & linking.

Code that I am experimenting with :
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib

.data
MsgBoxCaption db "An example of Cancel,Retry,Continue",0
MsgBoxText db "Hello Message Box!",0

.code
start:
invoke MessageBox,
NULL,
addr MsgBoxText,
addr MsgBoxCaption,
MB_ICONERROR OR MB_ABORTRETRYIGNORE

.IF eax==IDABORT
; Abort was pressed

.ELSEIF eax==IDRETRY
; Retry was pressed

.ELSEIF eax==IDCANCEL
; Cancel was pressed
.ENDIF

invoke ExitProcess,NULL
end start


Regards.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: frktons on January 14, 2013, 09:26:31 PM
Quote from: RAFAAJ2000 on January 14, 2013, 09:03:37 PM

Any code must be saved in the bin folder for it to work and I get no errors whatsoever when assembling & linking.


How do you assemble your programs?
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: six_L on January 14, 2013, 09:29:14 PM
if your masm32 packages were being in E disk, then add the following users environmental variation into the system settings.
QuoteE:\masm32\bin;E:\masm32\include;E:\masm32\lib;
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 14, 2013, 09:35:48 PM
Quote from: frktons on January 14, 2013, 09:26:31 PM
Quote from: RAFAAJ2000 on January 14, 2013, 09:03:37 PM

Any code must be saved in the bin folder for it to work and I get no errors whatsoever when assembling & linking.


How do you assemble your programs?

Project > Assemble & Link
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 14, 2013, 09:44:17 PM
Quote from: six_L on January 14, 2013, 09:29:14 PM
if your masm32 packages were being in E disk, then add the following users environmental variation into the system settings.
QuoteE:\masm32\bin;E:\masm32\include;E:\masm32\lib;

Yes the MASM32 package is in the E disk.... I tried your suggestion but ddn't work. - Does the name I have to give the new users environmental variation matter ?

Using Win XP SP3 - home PC
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: frktons on January 14, 2013, 10:00:04 PM
Quote from: RAFAAJ2000 on January 14, 2013, 09:35:48 PM
Project > Assemble & Link

1] Project > Console Assemble & Link
2] what the Assembler says when you compile?
3] where are your sources?
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: jj2007 on January 14, 2013, 10:12:51 PM
Quote from: RAFAAJ2000 on January 14, 2013, 09:03:37 PM
Code that I am experimenting with :

If:
- I open \Masm32\qeditor.exe
- paste your code
- save it as \Masm32\test.asm
- click Project/Build All
... then this output appears:
Microsoft (R) Macro Assembler Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000.  All rights reserved.

Assembling: C:\Masm32\Test.asm

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

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

Volume in drive C has no label.
Volume Serial Number is 4CBE-DFDC

Directory of C:\Masm32

14.01.13  12:10               671 Test.asm
14.01.13  12:10             2,560 Test.exe
14.01.13  12:10               850 Test.obj
               3 File(s)          4,081 bytes
               0 Dir(s)  90,207,358,976 bytes free
Press any key to continue . . .

Afterwards, when clicking Project/Run program, the MsgBox appears.

Question:
- What is different on your side?
- Did you fumble with any qEditor settings?
- What else could influence the build process?
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: six_L on January 14, 2013, 10:14:36 PM
QuoteDoes the name I have to give the new users environmental variation matter ?
yes.
frist,you need to ensure the "ml.exe,rc.exe,Link.exe" working on anypath. you may save your source code on ererywhere.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 14, 2013, 10:17:10 PM
Quote from: frktons on January 14, 2013, 10:00:04 PM
Quote from: RAFAAJ2000 on January 14, 2013, 09:35:48 PM
Project > Assemble & Link

1] Project > Console Assemble & Link
2] what the Assembler says when you compile?
3] where are your sources?

Tried Console Assemble & Link with no luck.
I get no output or error messages at all
The asm file is saved on my desktop and the masm32 package in the E: drive
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 14, 2013, 10:19:59 PM
Quote from: jj2007 on January 14, 2013, 10:12:51 PM
Quote from: RAFAAJ2000 on January 14, 2013, 09:03:37 PM
Code that I am experimenting with :

If:
- I open \Masm32\qeditor.exe
- paste your code
- save it as \Masm32\test.asm
- click Project/Build All
... then this output appears:
Microsoft (R) Macro Assembler Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000.  All rights reserved.

Assembling: C:\Masm32\Test.asm

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

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

Volume in drive C has no label.
Volume Serial Number is 4CBE-DFDC

Directory of C:\Masm32

14.01.13  12:10               671 Test.asm
14.01.13  12:10             2,560 Test.exe
14.01.13  12:10               850 Test.obj
               3 File(s)          4,081 bytes
               0 Dir(s)  90,207,358,976 bytes free
Press any key to continue . . .

Afterwards, when clicking Project/Run program, the MsgBox appears.

Question:
- What is different on your side?
- Did you fumble with any qEditor settings?
- What else could influence the build process?

I follow exactly the same steps but nothing happens ! However If I save the asm in the Bin folder then everything works just fine.
I didn't mess with any settings since I installed masm32.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 14, 2013, 10:22:21 PM
Quote from: six_L on January 14, 2013, 10:14:36 PM
QuoteDoes the name I have to give the new users environmental variation matter ?
yes.
frist,you need to ensure the "ml.exe,rc.exe,Link.exe" working on anypath. you may save your source code on ererywhere.
I meant what name should I give the new system user variable entry you suggested as one must enter a name for the new system variable value .
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: jj2007 on January 14, 2013, 10:34:11 PM
- click Project/Build All

What do you see when you click? Nothing??
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: six_L on January 14, 2013, 10:37:27 PM
1,"startup"->"run"->type: cmd
2, type: set path=E:\masm32\bin;E:\masm32\include;E:\masm32\lib;
3, test your source codes.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: jj2007 on January 14, 2013, 10:40:22 PM
six_L, rafaaj,

There is no need for environment variables in Masm32, and in general they do more harm than good. It's adding one layer of confusion.

We'd better find out what happens when Rafaaj clicks "Project/Build all".
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 14, 2013, 10:44:40 PM
Quote from: jj2007 on January 14, 2013, 10:34:11 PM
- click Project/Build All

What do you see when you click? Nothing??

I have already tried all the entries in the Project menu includin Build All but nothing happens .... No assembling output and no executable is created.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 14, 2013, 10:48:06 PM
Quote from: six_L on January 14, 2013, 10:37:27 PM
1,"startup"->"run"->type: cmd
2, type: set path=E:\masm32\bin;E:\masm32\include;E:\masm32\lib;
3, test your source codes.


After doing what you suggested , the command line now shows E:\mams32> but the problem still remains after testing my source code. - No executable no errors !

Late edit :

There is now a new entry in the system variables when I right click my computer, choose Properties , Advanced tab and click on the Environment variables which means that your command line suggestion did add the system variable successfully but that didn't make a difference as the program still cannot compile
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: six_L on January 14, 2013, 11:00:13 PM
QuoteThere is now a new entry in the system variables when I right click my computer, choose Properties , Advanced tab and click on the Environment variables which means that your command line suggestion did add the system variable successfully but that didn't make a difference as the program still cannot compile
reboot your computer.

what's show when you type the "path" on the command line window?
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 14, 2013, 11:05:38 PM
Quote from: six_L on January 14, 2013, 11:00:13 PM
QuoteThere is now a new entry in the system variables when I right click my computer, choose Properties , Advanced tab and click on the Environment variables which means that your command line suggestion did add the system variable successfully but that didn't make a difference as the program still cannot compile
reboot your computer.

what's show when you type the "path" on the command line window?

I'll do but i'll psot back later because I need to go now.

Thanks everybody for your help and patience.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: Magnum on January 15, 2013, 05:56:03 AM
I can help you solve your problem.

We can take it one step at a time.

Can you re-install the Masm32 package on the C: drive ?

Andy

Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: jj2007 on January 15, 2013, 06:15:41 AM
Quote from: RAFAAJ2000 on January 14, 2013, 10:48:06 PMthe command line now shows E:\mams32>

If that is true, we've found the problem. But I assume it shows E:\masm32> , right? ;-)

Besides, qEditor is a bit stingy with error messages. I just tried it with an incomplete Masm32 installation on my secondary drive, and clicking Project/Build all does indeed produce ... silence.

Check if ml.exe and link.exe are present as E:\Masm32\bin\ml.exe and E:\Masm32\bin\link.exe
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: frktons on January 15, 2013, 11:31:21 AM
It looks like an incomplete/incorrect installation of masm32 package.

Better to reinstall everything and let the installation process to get

to the end.  :biggrin:
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: Magnum on January 15, 2013, 11:51:35 AM
I gotta know, so I am going to install it to my d: drive.  :t

Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 15, 2013, 04:09:02 PM
Quote from: six_L on January 14, 2013, 11:00:13 PM
QuoteThere is now a new entry in the system variables when I right click my computer, choose Properties , Advanced tab and click on the Environment variables which means that your command line suggestion did add the system variable successfully but that didn't make a difference as the program still cannot compile
reboot your computer.

what's show when you type the "path" on the command line window?

After a reboot I get this on the commad line.
C:\Documents and Settings\Administrateur>
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 15, 2013, 04:18:10 PM
Quote from: jj2007 on January 15, 2013, 06:15:41 AM
Quote from: RAFAAJ2000 on January 14, 2013, 10:48:06 PMthe command line now shows E:\mams32>

If that is true, we've found the problem. But I assume it shows E:\masm32> , right? ;-)

Besides, qEditor is a bit stingy with error messages. I just tried it with an incomplete Masm32 installation on my secondary drive, and clicking Project/Build all does indeed produce ... silence.

Check if ml.exe and link.exe are present as E:\Masm32\bin\ml.exe and E:\Masm32\bin\link.exe

Yes that was just a spelling mistake I meant  E:\masm32>bin\link.exe


Yest the two exe files are indeed present and the respective command line outputs are :

For Link.exe :
C:\Documents and Settings\Administrateur>E:masm32\bin\link.exe
Microsoft (R) Incremental Linker Version 5.
Copyright (C) Microsoft Corp 1992-1998. All

usage: LINK [options] [files] [@commandfile

   options:

      /ALIGN:#
      /BASE:{address|@filename,key}
      /COMMENT:comment
      /DEBUG
      /DEBUGTYPE:{CV|COFF}
      /DEF:filename
      /DEFAULTLIB:library
      /DLL
      /DRIVER[:{UPONLY|WDM}]
      /ENTRY:symbol
      /EXETYPE:DYNAMIC
      /EXPORT:symbol
      /FIXED[:NO]
      /FORCE[:{MULTIPLE|UNRESOLVED}]
      /GPSIZE:#
      /HEAP:reserve[,commit]
      /IMPLIB:filename
      /INCLUDE:symbol
      /INCREMENTAL:{YES|NO}
      /LARGEADDRESSAWARE[:NO]
      /LIBPATH:dir
      /MACHINE:{ALPHA|ARM|IX86|MIPS|MIPS16|
      /MAP[:filename]
      /MAPINFO:{EXPORTS|FIXUPS|LINES}
      /MERGE:from=to
      /NODEFAULTLIB[:library]
      /NOENTRY
      /NOLOGO
      /OPT:{ICF[,iterations]|NOICF|NOREF|NO
      /ORDER:@filename
      /OUT:filename
      /PDB:{filename|NONE}
      /PDBTYPE:{CON[SOLIDATE]|SEPT[YPES]}
      /PROFILE
      /RELEASE
      /SECTION:name,[E][R][W][S][D][K][L][P
      /STACK:reserve[,commit]
      /STUB:filename
      /SUBSYSTEM:{NATIVE|WINDOWS|CONSOLE|WI
      /SWAPRUN:{CD|NET}
      /VERBOSE[:LIB]
      /VERSION:#[.#]
      /VXD
      /WARN[:warninglevel]
      /WINDOWSCE:{CONVERT|EMULATION}
      /WS:AGGRESSIVE


For ml.exe :

C:\Documents and Settings\Administrateur>E:\masm32\bin\ml.exe
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

usage: ML [ options ] filelist [ /link linkoptions]
Run "ML /help" or "ML /?" for more info
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 15, 2013, 04:41:11 PM
Quote from: Magnum on January 15, 2013, 05:56:03 AM
I can help you solve your problem.

We can take it one step at a time.

Can you re-install the Masm32 package on the C: drive ?

Andy

Thanks Andy.

I have already tried that but I can't re-install msm32 on the C drive because I first have to un-install a previous incomplete installation that I did on C .... By the way , how can one un-install masm32 ? - It doesn't show up on the control pannel Add/Remove Programs list .

I already deleted all the masm32 folders/files on the C drive but when I try to re-install it on the C drive again the masm32 install wizard tells me that masm32 is already installed on the C drive  ....  - Do I have to delete some registry keys to successfully un-install masm32 ?
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 15, 2013, 04:44:31 PM
Quote from: frktons on January 15, 2013, 11:31:21 AM
It looks like an incomplete/incorrect installation of masm32 package.

Better to reinstall everything and let the installation process to get

to the end.  :biggrin:

No - The masm32 installation process on the E: Drive was allowed to get to the end and was carried out successfully.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: hutch-- on January 15, 2013, 05:00:47 PM
Hmmmm,

The MASM32 installation creates a fully portable installation that writes NOTHING to the operating system. It is also specific to the drive you install it on so you can run multiple copies if you need to. You absolutely DO NOT NEED an environment variable to build assembler applications and it is designed specifically this way so you don't get the WRONG versions of link, rc etc ....

Now the secret to getting a proper installation is to read the installation guide on the web site, make sure your computer is set up correctly without either an AV scanner or the OS preventing disk IO.

Run the install program making sure it finishes. It will build all of the libraries and write everything it needs to the drive you select. NOTE that you must build your assembler application on the drive you select, if you try and build it from another location it will fail. This is because many programmers have other compilers and linkers on different drives.

The MASM32 SDK is primarily designed for experienced programmers who already have many different things on their development computer and the price of an installation that does not mess up anything else is that you need to read the installation guide to understand how it works.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: six_L on January 15, 2013, 06:00:09 PM
QuoteYou absolutely DO NOT NEED an environment variable to build assembler applications and it is designed specifically this way so you don't get the WRONG versions of link, rc etc
QuoteThere is no need for environment variables in Masm32, and in general they do more harm than good.
as other fourm members said, that's really true.
if you don't add your environment variable into system environment, then modify your source codes and the bldall.bat(\masm32\bin\) file.

modify as following:
1,source codes:
.386
.model flat,stdcall
option casemap:none
include e:\masm32\include\windows.inc
include e:\masm32\include\kernel32.inc
includelib e:\masm32\lib\kernel32.lib
include e:\masm32\include\user32.inc
includelib e:\masm32\lib\user32.lib

.data
MsgBoxCaption db "An example of Cancel,Retry,Continue",0
MsgBoxText db "Hello Message Box!",0

.code
start:
invoke MessageBox,
NULL,
addr MsgBoxText,
addr MsgBoxCaption,
MB_ICONERROR OR MB_ABORTRETRYIGNORE

.IF eax==IDABORT
; Abort was pressed

.ELSEIF eax==IDRETRY
; Retry was pressed

.ELSEIF eax==IDCANCEL
; Cancel was pressed
.ENDIF

invoke ExitProcess,NULL
end start

2,bldall.bat

@echo off

if not exist rsrc.rc goto over1
e:\masm32\bin\rc /v rsrc.rc
e:\masm32\bin\cvtres /machine:ix86 rsrc.res
:over1

if exist %1.obj del %1.obj
if exist %1.exe del %1.exe

e:\masm32\bin\ml /c /coff %1.asm
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

e:\masm32\bin\Link /SUBSYSTEM:WINDOWS /OPT:NOREF %1.obj rsrc.obj
if errorlevel 1 goto errlink

dir %1.*
goto TheEnd

:nores
e:\masm32\bin\Link /SUBSYSTEM:WINDOWS /OPT:NOREF %1.obj
if errorlevel 1 goto errlink
dir %1.*
goto TheEnd

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd

pause


Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: jj2007 on January 15, 2013, 06:20:21 PM
Quote from: six_L on January 15, 2013, 06:00:09 PM
include e:\masm32\include\windows.inc

PLEASE, NEVER DO THAT, neither in the sources nor in the batch files!

include \masm32\include\windows.inc is correct. The \masm32 tells the OS "take the root of the current drive (e.g. X:)and add \masm32 to arrive at X:\masm32"

Of course, e:\... works if all the rest is also set up correctly (which is apparently not the case), but
a) it doesn't add any value
b) it makes the sources incompatible to any other member's configuration (which means in the end that those who want to help will be p**sed up changing the drive letters all the time :()

Sorry to be a little bit rude here, but this "case" is already messed up enough :icon14:
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: RAFAAJ2000 on January 15, 2013, 06:43:21 PM
Never mind people - I'll will be saving my asm files in a repertory inside the Bin folder for the time being which works just fine... I really need to get down to business and start writing code.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: hutch-- on January 15, 2013, 11:04:12 PM
The idea is to learn how it works, all you need to do is create a directory on the same drive them you can create a source file in it and build it from the editor. That is what its designed to do. try and do it differently and you have to set it all up yourself which is s steep learning curve.
Title: Re: Why must the ASM file be saved in the Bin folder ? !
Post by: Magnum on January 16, 2013, 01:20:40 AM
Quote from: RAFAAJ2000 on January 15, 2013, 04:41:11 PM
Quote from: Magnum on January 15, 2013, 05:56:03 AM
I can help you solve your problem.

We can take it one step at a time.

Can you re-install the Masm32 package on the C: drive ?

Andy

To uninstall just delete the C:\masm32 directory.

That one of the things I like about it.

You don't have to worry about registry entries that didn't get deleted by the uninstall program or leftover files.

Then re-install it.

Andy
Thanks Andy.

I have already tried that but I can't re-install msm32 on the C drive because I first have to un-install a previous incomplete installation that I did on C .... By the way , how can one un-install masm32 ? - It doesn't show up on the control pannel Add/Remove Programs list .

I already deleted all the masm32 folders/files on the C drive but when I try to re-install it on the C drive again the masm32 install wizard tells me that masm32 is already installed on the C drive  ....  - Do I have to delete some registry keys to successfully un-install masm32 ?