tags:

views:

65

answers:

1

Anyone know a nice way to do that?

This does not look too friendly:

__asm("command 1"
      "command 2"
      "command 3");
  1. Do I really have to put a doublequote around every line?
  2. Am I the only one who thinks this is a MAJOR partypooper?

Also... since multiline string literals does not work in GCC, i could not cheat with that either.

Thank you for your attention. Have a nice day.

+1  A: 

I always find some examples on Internet that the guy manually insert a tab and new-line instead of \t and \n, however it doesn't work for me. Not very sure if your example even compile.. but this is how I do:

VERY ugly way:

asm("xor %eax,%eax");
asm("mov $0x7c802446, %ebx");
asm("mov $500, %ax");
asm("push %eax");
asm("call *%ebx");

Or this less ugly one:

asm("xor %eax,%eax         \t\n\
    mov $0x7c802446, %ebx  \t\n\
    mov $1000, %ax         \t\n\
    push %eax              \t\n\
    call *%ebx             \t\n\
    ");
jyzuz
Thanks mate, that's more or less what I have seen in examples, however, it is still just "less ugly" for sure! Takes my motivation away from writing asm.
Mike Shinola