Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

ENTER, LEAVE or LOCAL I am trying to replace the preceding commands

how do i rewrite the following procedure code without using assembler directives ENTER, LEAVE or LOCAL:

Proc1 PROC
LOCAL X[13]:BYTE, Y:SDWORD, Z[5]:REAL4
mov Z[0],00000000h
mov Y,-1
mov X[4],al
mov ebx,ebp
call Proc2
mov al,bl
mov ebx,Y
ret
Proc1 ENDP
using MASP IRVINE23?
futureventspr@gmail.com

Comments

  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    : how do i rewrite the following procedure code without using
    : assembler directives ENTER, LEAVE or LOCAL:
    :

    The x86 assembly language supports the assembly instructions "enter n, 0" which sets up a stack frame and allocates n bytes of local memory. "leave" will remove the local variables and stack frame. If you're not allowed to use these assembly instructions, then use:
    [code]
    ; enter n:
    push ebp
    mov ebp, esp
    sub esp, n
    [/code]
    Now the space from [ebp-n] to [ebp] is available for local variables.
    You have to decide which local variable goes where. Also important becomes the size of each local variable. Usually, the n from above is the sum of each local variable times it's size in bytes.

    The leave will become:
    [code]
    ; leave
    mov esp, ebp
    pop ebp
    [/code]

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
Sign In or Register to comment.