Is there any way to tell MASM (inside macro) to define data at a specific address and not just at current pointer? Is it possible to segment .const section to do this or is there another way?
Posted on 2002-11-23 14:02:01 by comrade
Is there any way to tell MASM (inside macro) to define data at a specific address and not just at current pointer?
Not quite sure this is what you want...
.386

.model flat, stdcall
option casemap:none

;:::::::::::::::::::::::::::::::::::::::

UseSpecialPlace MACRO Place, a, b, c, d
local off
.const
off = $ - Place
ORG $ - off
byte a
byte b
byte c
byte d
ORG $ + off - 4
.code
ENDM

.const
SomeData1 dword 1
SpecialPlace1 byte 4 dup(0)
SomeData2 dword 2
SpecialPlace2 byte 4 dup(0)
SomeData3 dword 3

;:::::::::::::::::::::::::::::::::::::::

.code

start:
xor eax, eax
UseSpecialPlace SpecialPlace1, 1, 2, 3, 4
xor eax, eax
UseSpecialPlace SpecialPlace2, 1, 2, 3, 4
xor eax, eax
ret
end start

But this is a little bit duty. See also this thread:
Using memory twice


Is it possible to segment .const section to do this or is there another way?
have trouble to define offset
See bitRAKE's post about SpecialOne$A/SpecialOne$B
Posted on 2002-11-25 03:27:20 by Four-F
Dumau mne eto pomozhet... bolshoe spasibo, tovarisch!
Posted on 2002-11-25 07:16:21 by comrade