Mail Archives: djgpp/1996/07/06/10:17:51
vecna AT Walden DOT mo DOT net ([vecna]) wrote:
>Alright, I need help with inline ASM in DJGPP. (well, I need help with
>any sort of ASM in DJGPP) I was a big time intel asm programmer - in fact
>I programmed in 100% assembly at the time so I'm can't live with out ASM.
>And I'm really just learning C as I go along here, but right now my problem
>isn't with C, it's with AT&T ASM. I'm trying to write a simple putpixel to
>a 320x200 virtual screen, which is already allocated and defined as:
>char *virscr;
>This is my (yes, unoptimized) setpixel routine:
>setpixel(int x, int y, char c)
>{
> asm("pushl %eax \n\t"
> "pushl %ebx \n\t"
> "pushl %edi \n\t"
> "movzx $_y, %eax \n\t"
> "imul $320, %eax \n\t"
> "movzx $_x, %ebx \n\t"
> "add %ebx, %eax \n\t"
> "mov $_virscr, %ebx \n\t"
> "add %ebx, %eax \n\t"
> "mov %eax, %edi \n\t"
> "movb $_c, %al \n\t"
> "stosb \n\t"
> "popl %edi \n\t"
> "popl %ebx \n\t"
> "popl %eax \n\t");
>}
Take a look at:
http://remus.rutgers.edu/~avly/djgpp.html, it has a tutorial
on asm and grapics.
- Raw text -