News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

local directive-Masm x64

Started by OlivierS, September 08, 2023, 02:47:31 AM

Previous topic - Next topic

OlivierS

Hello,

there is something i cannot understand in the listing below (local directive, this is an excerpt of an lst file): why the localB variable  offset is a multiple of localB size (word: 2 bytes, offset= EBP-4), and, on the other hand, why pointer variable offset is not a multiple of pointer size (qword: 8 bytes, offset EBP-34h, that is EBP-52). Could someone explain me how the offsets get computed? I cant understand this clearly.

  vara . . . . . . . . . . . . . Byte rbp - 00000001
  localb . . . . . . . . . . . . Word rbp - 00000004
  dwv. . . . . . . . . . . . . . DWord rbp - 00000008
  QwArray. . . . . . . . . . . . QWord rbp - 00000028
  rlocal . . . . . . . . . . . . DWord rbp - 0000002C
  pointer. . . . . . . . . . . . QWord rbp - 00000034
 

I hope i posted this message in the right forum section, if that's not the case I apologize for the inconvenience.

Thanks! :azn:

Olivier

zedd

Does anyone that works with 64 bit code want to help our new friend Olivier?

I am dedicated 32 bit guy myself...
@ Olivier: Yes, this is the right place to ask questions while you are learning. :smiley:

jj2007

Hi Olivier,
It's an alignment issue. I assume you are using this:
Local vara:BYTE, localb:WORD, dwv:DWORD, QwArray:QWORD, rlocal:DWORD, pointer:QWORDWhen you start the list with a BYTE variable, the assembler leaves some empty space to ensure that the following variables are at least DWORD aligned.

You should change the order, leaving the smaller sizes at the end.

OlivierS

Hi, and thanks a lot for your answer  :smiley: