Menu

ASM help

John Smith
2008-09-22
2012-09-26
  • John Smith

    John Smith - 2008-09-22

    Hi,

    i am having trouble using AT&T syntax..i keep getting "undefined reference to NEW".

    Here's my code:
    [code]
    void stdcall pa(void)
    {
    void p = (void)0xB49DC4;
    asm("mov (p),%ecx");

    }
    [/code]

     

    Related

    Code: code

    • John Smith

      John Smith - 2008-09-22

      Hi,

      Sorry for double post, i meant "Undefined reference to p"

       
    • cpns

      cpns - 2008-09-22

      You know that in a protected mode OS, outside of a kernel mode device driver, direct assignment of an address to a pointer us highly unlikely to work much less be correct?

      That said, for general in-line assembler this may be useful: http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html GNU in-line assembler syntax is extraordinarily arcane.

      I am still willing to bet however that whatever you are doing, it will crash.

      Clifford

       
    • John Smith

      John Smith - 2008-09-23

      Hi,

      even if i do:

      int p = 1;
      __asm("mov p,%eax");

      i still get undefined reference to "p".

       
      • cpns

        cpns - 2008-09-23

        I am not surprised. You had two problems, the one you asked about was a syntax problem. I have little experience with the in-line assembler syntax, so I posted a link. Your syntax remains incorrect.

        The problem I referred to was a technical problem. It looks like you were trying to address the DOS video memory. MinGW GCC is not a DOS compiler and will not create DOS programs. Even if you did generate a DOS program, on Windows it would be virtualised, so any benefit that may have resulted from direct VRAM access in MS-DOS is entirely lost on a modern platform. In x86 protected mode (which Windows utilises) any attempt to access that memory will fail.

        There are few reasons to ever use assembler, so you may be better off describing what you are trying to achieve. There may be a better solution.

        Clifford

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.