delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/06/10:17:51

Xref: news2.mv.net comp.os.msdos.djgpp:5695
From: neligan AT odyssee DOT net (Mitran Marcel)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Setpixel in AT&T inline asm....
Date: Sat, 06 Jul 1996 16:55:14 GMT
Organization: Odyssee Internet
Lines: 42
Message-ID: <4rkrgt$g65@pegasus.odyssee.net>
References: <4rh0g5$m9r AT twain DOT mo DOT net>
Reply-To: neligan AT odyssee DOT net
NNTP-Posting-Host: pool32_6.odyssee.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019