News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Code in data section assembly problem

Started by MazeGen, April 19, 2007, 03:07:27 PM

Previous topic - Next topic

MazeGen

It seems that MASM supports sort of code in data section. I can't get working direct jumps and labels however.

Standard way doesn't work at all:
.686
.MODEL FLAT, STDCALL

.DATA
mov eax, ebx
datalabel1:
jmp datalabel2
ja datalabel1
datalabel2:

.CODE
Start:
mov eax, ebx
END Start


Jumps return "cannot have implicit far jump or call to near label", Labels return "error A2108: use of register assumed to ERROR"

If I try to change label declaration to "datalabel LABEL NEAR", I get the same errors.

I've tried also "datalabel LABEL DWORD", but it doesn't work too since MASM tries to compile indirect jumps in this case (jmp [datalabel]).

Tested with ML 6.14.8444 and 8.00.50727.42

japheth


Hi,

    "assume cs:_DATA" after ".DATA" seems to help.

MazeGen


asmfan

Bad code anyway - DEP won't allow it. I experienced one problem with one media player which rejected to run - finally i turned DEP off and it ran wery well. I think they fixed it finally.
Russia is a weird place

MazeGen

I don't want to execute that code directly - that's why I put it to the data section (at run-time, that code are real data).