X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-Id: <5.0.2.1.2.20020129194221.009e8990@pop.gmx.net> X-Sender: martinSteuer AT gmx DOT de@pop.gmx.net X-Mailer: QUALCOMM Windows Eudora Version 5.0.2 Date: Tue, 29 Jan 2002 20:11:29 +0100 To: djgpp AT delorie DOT com From: Martin Steuer Subject: Re: Inline assembly. Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Reply-To: djgpp AT delorie DOT com Joel Saunders wrote: >I changed the inline assembly to this: >__asm__("movl _My_Name, %esi >movl _Screen_PTR, %edi >movl $7, %ecx >movsb >"); You forgot to think on the attribute byte in textmemory, every second byte in the textmode 3h is an attribute byte. And a second problem i can see is that movsb will only be executed once, because you didn't prefix it with a rep. So i'd do it like this: __asm__("movl _My_Name, %esi\n movl _Screen_PTR, %edi\n movl $7, %ecx \n movb $7, %ah\n writeStr:\n orl %ecx,%ecx\n jz ready\n decl %ecx\n movb (%esi),%al\n movw %ax,(%edi)\n incl %esi \n add $2,%edi\n jmp writeStr\n ready:\n" : : : "ax", "cx", "si", "di" ); This example uses an "unrolled" form of movs-type instructions but it is somewhat different because it just loads 1 byte and stores 2 bytes. And it preserves registers using AT&T's extended syntax. The 'movb $7, %ah' sets the attribute byte of the text memory to the standard colors (forground grey, background black). Hope it helps, Martin