c - extended asm: invalid instruction suffix for 'mov' -



c - extended asm: invalid instruction suffix for 'mov' -

using i686-elf-gcc , i686-elf-ld compile , link.

/tmp/ccyjfcee.s:25: error: invalid instruction suffix 'mov' makefile:21: recipe target 'release/boot.o' failed

when tried modify movw %0, %%dx movw $0x1, %%dx. compiled , linked successfully. wonder why there wrong line. in lite of .code16, offset address of pstr should 16bit, fits dx register well. what's wrong it?

__asm__(".code16\n"); void printstring(const char* pstr) { __asm__ __volatile__ ("movb $0x09, %%ah\n\t" "movw %0, %%dx\n\t" "int $0x21" : :"r"(pstr) :"%ah", "%dx"); } void _start() { printstring("hello, world"); }

technically can utilize .code16gcc directive generate 16 bit code , %w0 substitution forcefulness word sized register.

note above allow create programme run in 16 bit real mode under dos (after postprocessing proper format). if that's not want, need utilize appropriate os scheme calls instead of int 0x21 , not write 16 bit code.

c gcc assembly

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -