Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DWORD PTR [modified]

DWORD PTR [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vikramlinux
    wrote on last edited by
    #1

    HI all, I have assembly generated code of an simple program C++ code:

    int main(int argc, char* argv[])
    {
    int i =10;
    int j =20;
    int k = i+j;

    return 0;
    

    }

    some assembly code generated of out it is:

    PUBLIC _main
    ; COMDAT _main
    _TEXT SEGMENT
    _i$ = -4
    _j$ = -8
    _k$ = -12
    _main PROC NEAR ; COMDAT

    ; 8 : {

    push	ebp
    mov	ebp, esp
    sub	esp, 76					; 0000004cH
    push	ebx
    push	esi
    push	edi
    lea	edi, DWORD PTR \[ebp-76\]
    mov	ecx, 19					; 00000013H
    mov	eax, -858993460				; ccccccccH
    rep stosd
    

    ; 9 : int i =10;

    mov	DWORD PTR \_i$\[ebp\], 10			; 0000000aH
    

    ; 10 : int j =20;

    mov	DWORD PTR \_j$\[ebp\], 20			; 00000014H
    

    ; 11 : int k = i+j;

    mov	eax, DWORD PTR \_i$\[ebp\]
    add	eax, DWORD PTR \_j$\[ebp\]
    mov	DWORD PTR \_k$\[ebp\], eax
    

    ; 12 :
    ; 13 : return 0;

    xor	eax, eax
    

    ; 14 : }

    My question is: What is DWORD PTR syntax is in following line

    lea edi, DWORD PTR [ebp-76]

    modified on Friday, August 8, 2008 5:46 AM

    S T M D 4 Replies Last reply
    0
    • V vikramlinux

      HI all, I have assembly generated code of an simple program C++ code:

      int main(int argc, char* argv[])
      {
      int i =10;
      int j =20;
      int k = i+j;

      return 0;
      

      }

      some assembly code generated of out it is:

      PUBLIC _main
      ; COMDAT _main
      _TEXT SEGMENT
      _i$ = -4
      _j$ = -8
      _k$ = -12
      _main PROC NEAR ; COMDAT

      ; 8 : {

      push	ebp
      mov	ebp, esp
      sub	esp, 76					; 0000004cH
      push	ebx
      push	esi
      push	edi
      lea	edi, DWORD PTR \[ebp-76\]
      mov	ecx, 19					; 00000013H
      mov	eax, -858993460				; ccccccccH
      rep stosd
      

      ; 9 : int i =10;

      mov	DWORD PTR \_i$\[ebp\], 10			; 0000000aH
      

      ; 10 : int j =20;

      mov	DWORD PTR \_j$\[ebp\], 20			; 00000014H
      

      ; 11 : int k = i+j;

      mov	eax, DWORD PTR \_i$\[ebp\]
      add	eax, DWORD PTR \_j$\[ebp\]
      mov	DWORD PTR \_k$\[ebp\], eax
      

      ; 12 :
      ; 13 : return 0;

      xor	eax, eax
      

      ; 14 : }

      My question is: What is DWORD PTR syntax is in following line

      lea edi, DWORD PTR [ebp-76]

      modified on Friday, August 8, 2008 5:46 AM

      S Offline
      S Offline
      SandipG
      wrote on last edited by
      #2

      Does this link[^] Help??

      Regards, Sandip.

      1 Reply Last reply
      0
      • V vikramlinux

        HI all, I have assembly generated code of an simple program C++ code:

        int main(int argc, char* argv[])
        {
        int i =10;
        int j =20;
        int k = i+j;

        return 0;
        

        }

        some assembly code generated of out it is:

        PUBLIC _main
        ; COMDAT _main
        _TEXT SEGMENT
        _i$ = -4
        _j$ = -8
        _k$ = -12
        _main PROC NEAR ; COMDAT

        ; 8 : {

        push	ebp
        mov	ebp, esp
        sub	esp, 76					; 0000004cH
        push	ebx
        push	esi
        push	edi
        lea	edi, DWORD PTR \[ebp-76\]
        mov	ecx, 19					; 00000013H
        mov	eax, -858993460				; ccccccccH
        rep stosd
        

        ; 9 : int i =10;

        mov	DWORD PTR \_i$\[ebp\], 10			; 0000000aH
        

        ; 10 : int j =20;

        mov	DWORD PTR \_j$\[ebp\], 20			; 00000014H
        

        ; 11 : int k = i+j;

        mov	eax, DWORD PTR \_i$\[ebp\]
        add	eax, DWORD PTR \_j$\[ebp\]
        mov	DWORD PTR \_k$\[ebp\], eax
        

        ; 12 :
        ; 13 : return 0;

        xor	eax, eax
        

        ; 14 : }

        My question is: What is DWORD PTR syntax is in following line

        lea edi, DWORD PTR [ebp-76]

        modified on Friday, August 8, 2008 5:46 AM

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        Vikrams, you've been asking here for long now. when will you format your questions and make use of the <pre></pre> tags correctly ?

        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        V 1 Reply Last reply
        0
        • T toxcct

          Vikrams, you've been asking here for long now. when will you format your questions and make use of the <pre></pre> tags correctly ?

          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

          V Offline
          V Offline
          vikramlinux
          wrote on last edited by
          #4

          Thanks for the guideline.

          T 1 Reply Last reply
          0
          • V vikramlinux

            Thanks for the guideline.

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #5

            :doh: dude, didn't I mention the <pre></pre> tags, and not the <code></code> one ? BTW, thanks for the effort, but please edit once again... thanks. it looks better now...

            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

            modified on Friday, August 8, 2008 5:54 AM

            1 Reply Last reply
            0
            • V vikramlinux

              HI all, I have assembly generated code of an simple program C++ code:

              int main(int argc, char* argv[])
              {
              int i =10;
              int j =20;
              int k = i+j;

              return 0;
              

              }

              some assembly code generated of out it is:

              PUBLIC _main
              ; COMDAT _main
              _TEXT SEGMENT
              _i$ = -4
              _j$ = -8
              _k$ = -12
              _main PROC NEAR ; COMDAT

              ; 8 : {

              push	ebp
              mov	ebp, esp
              sub	esp, 76					; 0000004cH
              push	ebx
              push	esi
              push	edi
              lea	edi, DWORD PTR \[ebp-76\]
              mov	ecx, 19					; 00000013H
              mov	eax, -858993460				; ccccccccH
              rep stosd
              

              ; 9 : int i =10;

              mov	DWORD PTR \_i$\[ebp\], 10			; 0000000aH
              

              ; 10 : int j =20;

              mov	DWORD PTR \_j$\[ebp\], 20			; 00000014H
              

              ; 11 : int k = i+j;

              mov	eax, DWORD PTR \_i$\[ebp\]
              add	eax, DWORD PTR \_j$\[ebp\]
              mov	DWORD PTR \_k$\[ebp\], eax
              

              ; 12 :
              ; 13 : return 0;

              xor	eax, eax
              

              ; 14 : }

              My question is: What is DWORD PTR syntax is in following line

              lea edi, DWORD PTR [ebp-76]

              modified on Friday, August 8, 2008 5:46 AM

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              There are different machine code instructions for accessing memory depending on what size the data pointed to is. DWORD means a double-word (4 bytes), and a DWORD PTR indicates a pointer to a double word.

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              1 Reply Last reply
              0
              • V vikramlinux

                HI all, I have assembly generated code of an simple program C++ code:

                int main(int argc, char* argv[])
                {
                int i =10;
                int j =20;
                int k = i+j;

                return 0;
                

                }

                some assembly code generated of out it is:

                PUBLIC _main
                ; COMDAT _main
                _TEXT SEGMENT
                _i$ = -4
                _j$ = -8
                _k$ = -12
                _main PROC NEAR ; COMDAT

                ; 8 : {

                push	ebp
                mov	ebp, esp
                sub	esp, 76					; 0000004cH
                push	ebx
                push	esi
                push	edi
                lea	edi, DWORD PTR \[ebp-76\]
                mov	ecx, 19					; 00000013H
                mov	eax, -858993460				; ccccccccH
                rep stosd
                

                ; 9 : int i =10;

                mov	DWORD PTR \_i$\[ebp\], 10			; 0000000aH
                

                ; 10 : int j =20;

                mov	DWORD PTR \_j$\[ebp\], 20			; 00000014H
                

                ; 11 : int k = i+j;

                mov	eax, DWORD PTR \_i$\[ebp\]
                add	eax, DWORD PTR \_j$\[ebp\]
                mov	DWORD PTR \_k$\[ebp\], eax
                

                ; 12 :
                ; 13 : return 0;

                xor	eax, eax
                

                ; 14 : }

                My question is: What is DWORD PTR syntax is in following line

                lea edi, DWORD PTR [ebp-76]

                modified on Friday, August 8, 2008 5:46 AM

                D Offline
                D Offline
                Dan 0
                wrote on last edited by
                #7

                DWOD defines the bit size of the memory being used, PTR is a modifier indicating that we are pointing to a memory location. The following are defined in x86

                 BYTE - 8 bits
                 WORD - 16 bits
                 DWORD - 32 bits ( double word )
                 QWORD - 64 bits ( quadruple word )
                 DQWORD - 128 bits ( double quadruple word )
                
                V 1 Reply Last reply
                0
                • D Dan 0

                  DWOD defines the bit size of the memory being used, PTR is a modifier indicating that we are pointing to a memory location. The following are defined in x86

                   BYTE - 8 bits
                   WORD - 16 bits
                   DWORD - 32 bits ( double word )
                   QWORD - 64 bits ( quadruple word )
                   DQWORD - 128 bits ( double quadruple word )
                  
                  V Offline
                  V Offline
                  vikramlinux
                  wrote on last edited by
                  #8

                  Thank a lot all, for your valuable postings.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups