To assembly guru's,
I have just started on assembly (my first program) and I am getting compilation errors with below line of code
_DATA SEGMENT public 'DATA'
;Declaring global variables
MyVar dword 1 ;32 bits or 4 byte variable
_DATA ENDS
mov eax, seg _DATA ;I am getting error at this point
Please help!!! I am compiling this file using inshipped masm version in VC++ 2008
Have a look at the code in the masm32 project as it shows you how to put a basic assembler skeleton together.
The minimum things you need are include files for any API calls you choose to use which contain the prototypes for the API functions and you need to set up the memory model for 32 bit FLAT and usually the default calling convention to be used which is STDCALL.
It looks basically like this.
.386 ; minimum processor needed for 32 bit
.model flat, stdcall ; FLAT memory model & STDCALL calling
option casemap :none ; set code to case sensitive
The actual error you are getting is because your code is not in a code section but you are much better off checking out the existing masm32 models than trying to manually code segment directives with no practice.