News:

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

How to assemble/link with MASM32?

Started by sidezr, August 26, 2010, 07:47:14 AM

Previous topic - Next topic

sidezr

I installed MASM32 editor, but I'm having a problem. Not even the simplest assembly program will assemble; not even the samples coming with MASM32.

I used the MASM 6.1 and the same program built without errors and worked (but under DOS).

Any help on how to configure the MASM32 editor or what to do so that it will work? I need a free good integrated ASM editor/builder/debugger that works under Windows 7 x64 for my Computer Science class. I thought MASM32 was what I needed. Any help, please?


I get this list of errors when I select "Project/Assemble ASM file":

Assembling: C:\masm32\Projects\test.asm
C:\masm32\Projects\test.asm(59) : error A2006: undefined symbol : DGROUP
C:\masm32\Projects\test.asm(70) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(71) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(72) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(74) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(75) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(76) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(78) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(79) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(80) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(82) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(84) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(85) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(86) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(96) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(97) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(98) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(100) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(101) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(102) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(104) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(105) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(106) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(108) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(110) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(111) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(112) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(122) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(123) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(124) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(126) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(127) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(128) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(130) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(131) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(132) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(134) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(136) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(137) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(138) : error A2074: cannot access label through segment registers
C:\masm32\Projects\test.asm(148) : warning A4023: with /coff switch, leading underscore required for start address : main
Volume in drive C has no label.
Volume Serial Number is A8DD-5DAE

Directory of C:\masm32\Projects

08/25/2010  11:41 PM             1,902 test.asm
               1 File(s)          1,902 bytes
               0 Dir(s)  287,277,518,848 bytes free

hutch--

Hi sidezr,

Check to see if the libraries built OK when you installed MASM32. 16 bit DOS code will not build with MASM32 as it uses a 32 bit PE linker but the examples should build Ok from the editor.

Show us the code that you tried to build that created the errors and we may be able to help you.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

sidezr

Quote from: hutch-- on August 26, 2010, 07:50:24 AM
Hi sidezr,

Check to see if the libraries built OK when you installed MASM32. 16 bit DOS code will not build with MASM32 as it uses a 32 bit PE linker but the examples should build Ok from the editor.

Show us the code that you tried to build that created the errors and we may be able to help you.

Well, the installation seemed to have been successfully.

Here is the program I tried to build; it does nothing specific but just some numeric operations. It was the class example. I really appreciate any help, thanks :-)


;  Must include:
;   name
;   assignmnet #
;   section #

;   No name, asst, section -> no points!


.model medium
.586

; ----------------------------------------------
         
.data

; -----
; Byte Variables

   num1   db   15
   num2   db   7

   res1   db   ?
   res2   db   ?
   res3   dw   ?
   res4   db   ?
   rem4   db   ?

; -----
; Word Variables

   num3   dw   5000
   num4   dw   6

   res5   dw   ?
   res6   dw   ?
   res7   dw   ?
   res8   dw   ?
   rem8   dw   ?

; -----
; Double-word Variables

   num5   dd   100000
   num6   dd   1500

   res9   dd   ?
   res10   dd   ?
   res11   dd   ?
   res12   dd   ?
   rem12   dd   ?


; ----------------------------------------------

.stack   4096
.code

main proc far
   mov  ax, @data
   mov  ds, ax

; ----------
; Byte variables examples
;   res1 = num1 + num2
;   res2 = num1 - num2
;   res3 = num1 * num2
;   res4 = num1 / num2
;   rem4 = modulus(num1/num2)

   mov   al, num1
   add   al, num2
   mov   res1, al

   mov   al, num1
   sub   al, num2
   mov   res2, al

   mov   al, num1
   mul   num2
   mov   res3, ax

   mov   al, num1
   cbw
   div   num2
   mov   res4, al
   mov   rem4, ah

; ----------
; Word variables examples
;   res5 = num3 + num4
;   res6 = num3 - num4
;   res7 = num3 * num4
;   res8 = num3 / num4
;   rem8 = modulus(num3/num4)

   mov   ax, num3
   add   ax, num4
   mov   res5, ax

   mov   ax, num3
   sub   ax, num4
   mov   res6, ax

   mov   ax, num3
   mul   num4
   mov   res7, ax

   mov   ax, num3
   cwd
   div   num4
   mov   res8, ax
   mov   rem8, dx

; ----------
; Double-word variables examples
;   res9 = num5 + num6
;   res10 = num5 - num6
;   res11 = num5 * num6
;   res12 = num5 / num6
;   rem12 = modulus(num5/num6)

   mov   eax, num5
   add   eax, num6
   mov   res9, eax

   mov   eax, num5
   sub   eax, num6
   mov   res10, eax

   mov   eax, num5
   mul   num6
   mov   res11, eax

   mov   eax, num5
   cdq
   div   num6
   mov   res12, eax
   mov   rem12, edx

; ----------
;   Done, terminate program.

last:
   mov  ah, 4ch
   int  21h
main endp

end main

dedndave

it assembles and links fine
what you have is 16-bit code and it requires use of a 16-bit linker
the assembler, however will handle it
i ran the program and got no output - i didn't look at the code
i'll have a look at it tomorrow

sidezr

Yes, this code produces no output, and I know it's mainly 16 bits. It's just a sample to try the assembler. It builds well on older MASM, but I get those errors I posted in my original post when trying to build from MASM32 editor.

Quote from: dedndave on August 26, 2010, 08:14:36 AM
it assembles and links fine
what you have is 16-bit code and it requires use of a 16-bit linker
the assembler, however will handle it
i ran the program and got no output - i didn't look at the code
i'll have a look at it tomorrow

How did you do it for the MASM32 to build this? Any settings or anything I should put?

FORTRANS

Hi,

   You need to assemble your file with ML and link it with the
16-bit linker LINK16 in the \MASM32\BIN directory.  The
commands will look something like the following when used
in a *.BAT file.

Regards,

Steve N.


Try this;

\MASM32\BIN\ML  /c /Fl /Fm %1.asm
\MASM32\BIN\LINK16 %1.obj;

or try;

\masm32\bin\ml /c %1.asm
\masm32\bin\link16 %1.obj;

use the following to see what the switches mean:

ML /?

dedndave

as Hutch said, i used both hands....
.... and a batch file like Steve said, too   :bg

i wrote a batch file that should help
download and unzip it, then place a16.bat into the masm32\bin folder
that folder should be in your PATH environment variable
then, at the prompt....
>a16 MyFile    (.asm extension assumed)

http://www.masm32.com/board/index.php?topic=12621.msg97236#msg97236

oh - and i attached the EXE if you want to play with it in debug