Ryan Stull
Ryan Stull

Reputation: 1096

Why can't I define this symbol in masm?

I'm just starting to learn intel assembly and I'm having trouble with this simple program.

main    PROC            ;program execution begins here
A   =   1               ;define A with 1
B   =   12o             ;define B with 12 octal
X   dword   A1h         ;initialize the variable X with value A1 hex
Y   dword   11001001b   ;initialize the variable Y with value 11001001 binary

SUM dword   0       ;initializes the sum variable to 0
ADD EAX, A          ;adds A to sum
ADD EAX, B          ;adds B to sum
ADD EAX, X          ;adds X to sum
ADD EAX, Y          ;adds Y to sum
MOV SUM, EAX        ;
exit                ;end of program
main    ENDP

but whenever I try to build this it says "Error A2006: undefined symbol : A1" if anyone could help me that'd be great.

Upvotes: 1

Views: 2531

Answers (2)

Thomas Havlik
Thomas Havlik

Reputation: 1388

This says to prepend hex values starting with letters with a 0 http://www.piclist.com/techref/language/masms.htm

Upvotes: 2

Raymond Chen
Raymond Chen

Reputation: 45172

You have to write 0A1h because A1h looks like a variable name.

Upvotes: 2

Related Questions