Topic
3 replies Latest Post - ‏2012-01-31T19:55:00Z by SystemAdmin
Hell_Fire
Hell_Fire
2 Posts
ACCEPTED ANSWER

Pinned topic directory open with inline asm gcc

‏2012-01-11T04:54:57Z |
Hi.I tried to create a directory inline asm with gcc:
code
#include <stdio.h>
#include <stdlib.h>

int main()
{char My_Directory[]="C:\\Hello World";
asm("mov $39,%eah\n"
"mov $dir,%edx\n"
"int $21\n"
"mov $4c,%eah\n"
"int $21\n"
"dir:\n"
"db $0,My_Directory\n"
);
system("PAUSE");
return 0;
}
[/code]

But i take these error:
code
Assembler messages:
bad register name `%eah'
junk `c' after expression
bad register name `%eah'
`db $0,My_Directory'
[/code]

How can i this with gcc inline asm?
Updated on 2012-01-31T19:55:00Z at 2012-01-31T19:55:00Z by SystemAdmin
  • ishields
    ishields
    988 Posts
    ACCEPTED ANSWER

    Re: directory open with inline asm gcc

    ‏2012-01-11T15:56:28Z  in response to Hell_Fire
    You probably mean %ah rather than %eah for one thing. There's a GCC-Inline-Assembly-HOWTO that might help you.

    Out of curiosity, what are you trying to achieve. Most directory access can be done directly from C/C++.

    Ian Shields
  • Hell_Fire
    Hell_Fire
    2 Posts
    ACCEPTED ANSWER

    Re: directory open with inline asm gcc

    ‏2012-01-11T20:19:49Z  in response to Hell_Fire
    Yes.I know this.But must know our chances in asm.Doesn't it?
    • SystemAdmin
      SystemAdmin
      2364 Posts
      ACCEPTED ANSWER

      Re: directory open with inline asm gcc

      ‏2012-01-31T19:55:00Z  in response to Hell_Fire
      Can you give me a little more information about this code? Is this something that you wrote yourself or is it example code of some sort? How did you choose %eah as your register name?