Re: Uniform spacing of labels in MASM32




Chris Martens wrote:
>
> [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:

Instead, use:

org $+(40h-($-ExecStart))

> ; Instruction 0x0001 code
> jmp LoopStart
>
> [END MASM32 CODE]


Cheers,
Randy Hyde

.



Relevant Pages

  • Re: Formatting in assembly
    ... really looked how the flags are set after a mul instruction). ... Checking edx for zero - by whatever means - isn't going to do ... Sometimes the purpose is "marketting ...
    (alt.lang.asm)
  • Re: Help understanding uops, etc...
    ... instruction so you can test your code to see if an ... xor edx, edx ... add ecx, 8 ... By merging the two memory reads only one memory load is ...
    (comp.lang.asm.x86)
  • Re: Int64 := Integer * Smallint; // integer overflow/incorrect results ?!?!
    ... The intel instruction set has a imul instruction to multiply two 32 bit ... integers and store the result in edx and eax. ... It seems an integer overflow is detected? ...
    (alt.comp.lang.borland-delphi)
  • Re: Matrix multiplication 3*3
    ... if we used edx for anything. ... LEA means Load Effective Address, meaning perform address calculation like in an ordinary memory reference instruction, but then just store that calculated address in a register without performing the memory reference. ... So, lea eax, effectively multiplies eax by 3. ...
    (comp.lang.asm.x86)
  • Re: Uniform spacing of labels in MASM32
    ... >> mov ebx, offset Instruction ... >> xor edx, edx ... >> jmp LoopStart ...
    (comp.lang.asm.x86)