From: buers AT gmx DOT de (Dieter Buerssner) Newsgroups: comp.os.msdos.djgpp Subject: Re: Inline ASM Date: 24 Mar 2000 21:29:54 GMT Lines: 67 Message-ID: <8bgmoh$502uu$1@fu-berlin.de> References: <38daf59d AT news DOT integrityonline DOT com> <38DAFAA7 DOT CC352387 AT mtu-net DOT ru> <8bg4on$4kibp$2 AT fu-berlin DOT de> <38DBC4E2 DOT 405A0F6C AT mtu-net DOT ru> NNTP-Posting-Host: pec-0-114.tnt1.s2.uunet.de (149.225.0.114) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: fu-berlin.de 953933394 5245918 149.225.0.114 (16 [17104]) X-Posting-Agent: Hamster/1.3.13.0 User-Agent: Xnews/03.02.04 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Alexei A. Frounze wrote: >Yes, I tried. I have *really* working program. I believe you. You might have been lucky, your example is wrong. Adding the following lines at the top of your example to make it compilable. /* just guesses */ extern unsigned short VGA_sel; extern char *VGAAddr; /* unsigned char would be preferable */ extern long scanline_width; #define y2addr(y) ((y)*scanline_width) and compile it with gcc -O -S, I get the following output: [Comments are mine again] .file "a.c" gcc2_compiled.: ___gnu_compiled_c: .text .p2align 2 .globl _putpixel _putpixel: pushl %ebp movl %esp,%ebp pushl %ebx ; there should be a push %edi here movl 8(%ebp),%ebx ;ebx=x movl 12(%ebp),%edx ;edx=y movl 16(%ebp),%ecx ;cl=color movb %cl,%al ;al=color cmpl $0,_VGAAddr je L3 imull _scanline_width,%edx movl _VGAAddr,%eax addl %ebx,%eax movb %cl,(%edx,%eax) jmp L4 .p2align 4,,7 L3: /APP pushw %es movw _VGA_sel, %ax ;overwrite al! movw %ax, %es movl %edx, %edi shl $6, %edi movl %edi, %eax shl $2, %eax addl %eax, %edi addl %ebx, %edi movb %al, %al ;Huh, gcc thinks al is still color stosb popw %es /NO_APP L4: ;There should be a popl %edi here popl %ebx movl %ebp,%esp popl %ebp ret I suggest to read (or reread) in the gcc manual about inline assembly. -- Regards, Dieter