And what are they really? Reserved words of masm such as mov or ret? I think I found the answer for OFFSET. I believe that's a macro. But I couldn't find ADDR anywhere in any macro listings in the \masm32\help documentation.
Just an observation from an old DOS asm'er...
There sure are a lot of ways to do console output with masm32!!!! Here are the ones I've got to work so far from stuff I've figurred out myself and from the \help *.chm files...
include \masm32\include\masm32rt.inc
.data
msg1 db "eax = %d%", 13, 10, 0
msg2 db "This Is A Test!", 13, 10, 0
CrLf db 13, 10, 0
.data?
iNumber dd ?
.code
start:
mov eax, 12345
mov iNumber, eax
invoke crt_printf, OFFSET msg1, eax
printf("eax = %d\n",iNumber);
print "This Is A Test!"
print OFFSET CrLf
print ADDR msg2
print OFFSET msg2
invoke StdOut, ADDR msg2
invoke crt_getchar
invoke ExitProcess, 0
END start
;Output...
;===================================
;C:\Code\MASM\Projects\Demo3>test1
;eax = 12345
;eax = 12345
;This Is A Test!
;This Is A Test!
;This Is A Test!
;This Is A Test!
Fred,
An OFFSET in MASM is a location (literally an OFFSET) from the front of the file where an address using the keyword ADDR can be either a stack local OR an OFFSET. ADDR is usually restricted to higher level INVOKE syntax.
When you use ADDR with a local variable ADDR (through INVOKE) create the following code : LEA AX,MYVAR ; PUSH EAX
If it is on a global variable, into the DS segment, the ADDR becomes PUSH OFFSET MYVAR
You can MOV EAX,OFFSET MYVAR but not MOV EAX,ADDR MYVAR
ADDR only works with INVOKE, like the chief said.
an offset couldn't be re-allocated by the linker.
addr could be re-allocated.
The linker add sometimes codes for the system and proceed at the re-allocation of the adress code who have changed.The lea instruction allow re-allocation
The data segment isn't affected by this change.Offset can be use here.