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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. Assembly studs

Assembly studs

Scheduled Pinned Locked Moved The Lounge
helpquestioncode-review
6 Posts 4 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.
  • S Offline
    S Offline
    Sirrius
    wrote on last edited by
    #1

    could somebody please tell me what this may mean in Intel format.

    andl $-16, %esp

    What a class this is, my teacher is teaching us in Intel format and wants us to use the djgpp compiler for our homework. But when I compile or convert a .c file into a .s file its all in at&t format. huh? And now I'm supposed to take some c code that my teacher gave me and optimize with the assembly..."yeah, right. I'll get right on that teach." What it comes down to is I may need a lot of assembly help until about mid December. Thanks.

    R J 2 Replies Last reply
    0
    • S Sirrius

      could somebody please tell me what this may mean in Intel format.

      andl $-16, %esp

      What a class this is, my teacher is teaching us in Intel format and wants us to use the djgpp compiler for our homework. But when I compile or convert a .c file into a .s file its all in at&t format. huh? And now I'm supposed to take some c code that my teacher gave me and optimize with the assembly..."yeah, right. I'll get right on that teach." What it comes down to is I may need a lot of assembly help until about mid December. Thanks.

      R Offline
      R Offline
      Roger Wright
      wrote on last edited by
      #2

      It's been a long time, but.. Having just downloaded the Intel IA-32 Instruction Reference Manual and reviewed it, there's no such instruction. I would interpet it then as an assembler- or compiler-specific mnemonic for a logical AND. This performs a bitwise AND of the two values specified as the operands, and stores the result in the destination. Where it gets weird is that the Intel spec calls for the destination to be given by the first parameter, which in this case looks suspiciously like a signed integer immediate value. Maybe the assembler/compiler reverses the Intel format, making the %esp the destination parameter. The esp would then be the stack pointer register, unless the % is meant to represent indirect addressing, in which case the destination would be the memory location specified by the stack pointer. The formatting is clearly not Intel, at least not the IA-32 spec format. Think about it, and maybe my interpretation makes sense in the context of the rest of the code. If not, maybe it will give you some clues. And it might be better to post your future questions in the C++ forum - those gurus seem to have a better grasp of assembly than most.:sigh: "Your village called -
      They're missing their idiot."

      S 1 Reply Last reply
      0
      • R Roger Wright

        It's been a long time, but.. Having just downloaded the Intel IA-32 Instruction Reference Manual and reviewed it, there's no such instruction. I would interpet it then as an assembler- or compiler-specific mnemonic for a logical AND. This performs a bitwise AND of the two values specified as the operands, and stores the result in the destination. Where it gets weird is that the Intel spec calls for the destination to be given by the first parameter, which in this case looks suspiciously like a signed integer immediate value. Maybe the assembler/compiler reverses the Intel format, making the %esp the destination parameter. The esp would then be the stack pointer register, unless the % is meant to represent indirect addressing, in which case the destination would be the memory location specified by the stack pointer. The formatting is clearly not Intel, at least not the IA-32 spec format. Think about it, and maybe my interpretation makes sense in the context of the rest of the code. If not, maybe it will give you some clues. And it might be better to post your future questions in the C++ forum - those gurus seem to have a better grasp of assembly than most.:sigh: "Your village called -
        They're missing their idiot."

        S Offline
        S Offline
        Sirrius
        wrote on last edited by
        #3

        Hey thanks for your advice... I hope I can get through this class.

        R 1 Reply Last reply
        0
        • S Sirrius

          Hey thanks for your advice... I hope I can get through this class.

          R Offline
          R Offline
          Roger Wright
          wrote on last edited by
          #4

          Happy to have been of assistance, if I really have... Good luck in the class, and give us an article or three about it if you get through it.:-D "Your village called -
          They're missing their idiot."

          S 1 Reply Last reply
          0
          • S Sirrius

            could somebody please tell me what this may mean in Intel format.

            andl $-16, %esp

            What a class this is, my teacher is teaching us in Intel format and wants us to use the djgpp compiler for our homework. But when I compile or convert a .c file into a .s file its all in at&t format. huh? And now I'm supposed to take some c code that my teacher gave me and optimize with the assembly..."yeah, right. I'll get right on that teach." What it comes down to is I may need a lot of assembly help until about mid December. Thanks.

            J Offline
            J Offline
            James Brown
            wrote on last edited by
            #5

            In "intel speak" the instruction would be: and esp, -16 which means "Bitwise-AND the ESP register with -16" basically, it's masking off the lower bits of ESP to decrease it's value, thereby aligning the stack-pointer onto a 16byte boundary. I'd use a different compiler if I were you..try mingw or lcc-win32 James
            http://www.catch22.uk.net

            1 Reply Last reply
            0
            • R Roger Wright

              Happy to have been of assistance, if I really have... Good luck in the class, and give us an article or three about it if you get through it.:-D "Your village called -
              They're missing their idiot."

              S Offline
              S Offline
              Smitha Nishant
              wrote on last edited by
              #6

              Roger Wright wrote: and give us an article or three about it if you get through it Smart idea :) Smitha Every person, all the events of your life, are there because you have drawn them there. What you choose to do with them is up to you. -- Richard Bach

              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