Masm32 Error
Contents |
MASM Forum » Miscellaneous » 16 bit DOS Programming » Why MASM doesn't assemble this? « error a2006: undefined symbol previous next » Print Pages: [1] 2 Author Topic: Why MASM
Masm Error A2006 Undefined Symbol
doesn't assemble this? (Read 14291 times) sb1370 Guest Why MASM doesn't assemble this? « on: April 28, error a2006: undefined symbol : dgroup 2013, 05:26:43 PM » Hi;Our teacher uses a syntax like this simple example for teaching assembly:Code: [Select].MODEL SMALL
.386
.DATA
X DB 3
.CODE
.STARTUP
MOV AL,5
ADD
Error A2006: Undefined Symbol : Rax
AL,X
.EXIT
ENDI tried this for MASM:Code: [Select].MODEL SMALL
.386
.DATA
X DB 3
.CODE
main:
MOV AL,5
ADD AL,X
end main
.EXIT
ENDBut MASM doesn't assemble this. What's the problem?He usually uses emu8086 but it's a bit old and I want to do this with MASM. « Last Edit: April 28, 2013, 07:35:56 PM error a2006 undefined symbol @data by sb1370 » Logged jj2007 Member Posts: 5999 Assembler is fun ;-) Re: Why MASM doesn't compile this? « Reply #1 on: April 28, 2013, 06:04:15 PM » Quote from: sb1370 on April 28, 2013, 05:26:43 PMBut MASM doesn't compile this. Masm is not a compiler, it's an assembler. And it does assemble your snippet. Probably (can't read your thoughts, can't see your error messages) you'll see complaints from the linker. Are you using \Masm32\bin\link16.exe ? Logged Masm32 Tips, Tricks and Traps japheth Guest Re: Why MASM doesn't compile this? « Reply #2 on: April 28, 2013, 06:49:20 PM » Quote from: sb1370 on April 28, 2013, 05:26:43 PMBut MASM doesn't compile this. What's the problem?The more important question that you should ask yourself is why you want to remove .STARTUP and .EXIT. Because these directives are there for a good reason and they can't just be removed without causing your program to crash when it's launched.QuoteHe usually uses emu8086 but it's a bit old
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn
How To Run Masm Programs In Command Prompt
more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MASM32 error A2006, error A2074 and warning A4023 up vote http://masm32.com/board/index.php?topic=1853.0 1 down vote favorite 1 I am new to assmebly. I have the following piece of code from the book I am learning form. I downloaded MASM32. My computer is Win7 64bit. I tried to build the following code: .model small .stack 100h .data a dw 2 b dw 5 sum dw ? .code main proc mov ax, @data mov ds, ax mov ax, a add ax, b http://stackoverflow.com/questions/17126364/masm32-error-a2006-error-a2074-and-warning-a4023 mov sum, ax mov ax, 4c00h int 21h main endp end main Unfortunately, I get the following errors: Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved. Assembling: C:\masm32\test.asm C:\masm32\test.asm(11) : error A2006: undefined symbol : DGROUP C:\masm32\test.asm(14) : error A2074: cannot access label through segment registers C:\masm32\test.asm(15) : error A2074: cannot access label through segment registers C:\masm32\test.asm(16) : error A2074: cannot access label through segment registers C:\masm32\test.asm(22) : warning A4023: with /coff switch, leading underscore required for start address : main _ Assembly Error Press any key to continue . . . I have searched about solutions. I could solve the error A2074: by adding ASSUME DS:_DATA before .data line. I took it from this post: Cannot access label through segment registers, error in assembly but unfortunately, the solution does not provide explanations of why and what is this ? Why these errors appear and how to solve them? I am a newbie and need some details and step by step at the beginning. assembly masm32 share|improve this question asked Jun 15 '13 at 17:55 user2192774 84481734 That seems to be 16 bit DOS code, not something you'd normally use under 32 (or 64
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn http://stackoverflow.com/questions/28090067/masm32-compile-error more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MASM32 compile error up vote 2 down vote favorite I am trying to use masm32 to learn about assembly. I am running Windows 8, and can undefined symbol compile and run sample code in the masm32 directory without issue. I am using Quick Editor 4.0g. However, I have the following code, straight from Kip Irvine's "Assembly Language for x86 Processors". He states that this is a bit of code that "does not depend on include files", though I am getting the sense that this may not be entirely correct. TITLE Add and Subtract ; This program add and subtracts 32-bit Integers .386 .model flat,stdcall .stack error a2006: undefined 4096 ExitProcess PROTO, dwExitCode:DWORD DumpRegs PROTO .code main PROC mov eax,10000h add eax,40000h sub eax,20000h call DumpRegs INVOKE ExitProcess,0 main ENDP END main When I try to build it (I go to Project and choose "Console Assemble and Link") I get the following error: AddSubAlt.obj : error LNK2001: unresolved external symbol _ExitProcess@4 AddSubAlt.obj : error LNK2001: unresolved external symbol _DumpRegs@0 AddSubAlt.exe : fatal error LNK1120: 2 unresolved externals I have been trying to figure this out for days. I found an answer from 2002, but it references libraries that no longer exist. I am hoping that some assembly guru angel out there can help me fix this. Please and thank you! assembly x86 masm32 irvine32 share|improve this question edited Dec 18 '15 at 19:16 rkhb 7,56271628 asked Jan 22 '15 at 13:32 Choirbean 367315 1 You have to add the corresponding .lib files to linker command line for the libraries you take ExitProcess and DumpRegs from. BTW, why call ExitProcess when you can just zero eax and retn? –Ruslan Jan 22 '15 at 13:35 or in the assembly code, you can add includelib directirves., such as | INCLUDELIB MSVCRTD | | INCLUDELIB OLDNAMES | . –rcgldr Jan 22 '15 at 16:00 @Ruslan If you're asking me why Mr. Irvine wrote the code this way, I couldn't answer you. I also don't re