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
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.