Uniform spacing of labels in MASM32
- From: "Chris Martens" <spamtrap@xxxxxxxxxx>
- Date: 20 Dec 2005 23:56:27 -0800
I'm a recently graduated computer engineer who's been messing around
with assembly for more than 2 years now. (Mostly TASM for basic
hardware drivers and inline asm in MS VC++6.0, the source of
manyheadaches).
I've been working on a hobby project involving an interpreter engine
that uses compiled binaries to allow me to script new functionality in
without having to recompile.
The way I thought of doing this was allocating each binary instruction
(16 bits wide) a 64 byte chunk of code to implement what it had to do.
I've done this before writing text blitters for DirectX (yes, I'm a bit
of an oddball), but I thought that using masm32 to compile the function
in assembly would give me greater control than inline assembly in MS
VC++ 6.0 like the way I used to do things.
Here's what I mean - I've got it to work before, but that has been thru
trial and error and the clever placement of NOP's to space each command
implementation apart. I'm thinking there has to be an easier way.
[MASM32 CODE]
mov ebx, offset Instruction
sub ebx, 2 ; Each instruction is two bytes wide (WORD)
LoopStart:
add ebx, 2
xor edx, edx
mov dx, WORD PTR [ebx]
sal edx, 6
add edx, offset ExecStart
jmp edx
ExecStart:
; Instruction 0x0000 code
jmp LoopStart
ExecStart + 40h:
; Instruction 0x0001 code
jmp LoopStart
[END MASM32 CODE]
....and so on. But, as you might have been able to tell, the assembler
goes nuts on the ExecStart+40h line. Here's the error message:
C:\masm32\projects\FeatureEngine\execfeature.asm(154) : error A2008:
syntax error : +
Other syntax errors and elegance issues aside, is there some other way
to space these code blocks apart easily without having to dump NOP's in
between each?
Thanks for taking a look,
Chris Martens
.
- Follow-Ups:
- Re: Uniform spacing of labels in MASM32
- From: randyhyde@xxxxxxxxxxxxx
- Re: Uniform spacing of labels in MASM32
- From: Nicolo Parenti
- Re: Uniform spacing of labels in MASM32
- Prev by Date: Re: varargs in C (AMD64 architecture)
- Next by Date: Having trouble posting?
- Previous by thread: Re: Uniform spacing of labels in MASM32
- Next by thread: Re: Uniform spacing of labels in MASM32
- Index(es):
Relevant Pages
|