From: Niklas_Pson AT nosmam DOT hotmail DOT com (Niklas Pettersson) Newsgroups: comp.os.msdos.djgpp Subject: Help!! Inline asm with DJGPP Date: 5 Jul 2001 21:33:54 GMT Organization: Lund Institute of Technology, Sweden Lines: 34 Message-ID: <90D5EC920NiklasPsonnospamhotm@130.235.20.4> NNTP-Posting-Host: npedt97.univ.vxu.se User-Agent: Xnews/03.04.11 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello! I have a tiny program that just wont compile.. What's wrong with the code? (I'm using inline asm as a help when optimizing a function) I'm quite good with assembler but a complete idiot when it comes to inline assemby syntax =) Error messages: test2.cpp: In function `int main()': test2.cpp:17: Invalid `asm' statement: test2.cpp:17: fixed or forbidden register 2 (cx) was spilled for class CREG. The Code: int main() { unsigned char *src_cur_line_pos = new unsigned char [100]; unsigned char *dest_cur_line_pos = new unsigned char [100]; unsigned char c2 = 25; asm ( " cld ; " " rep ; " " movsl ; " : /* No output */ : "S" (src_cur_line_pos), "D" (dest_cur_line_pos), "c" (c2) : "%ecx", "%esi", "%edi" ); }