delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/01/19:06:36

From: "Chuck Jarenski" <3455245 AT popnet DOT ca DOT out DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Intel ASM to AT&T ASM question
Date: 1 Jan 1997 22:54:43 GMT
Organization: Netcom
Lines: 54
Message-ID: <01b9b9ca$9cccd040$aaf15ecf@platko.ix.netcom.com>
NNTP-Posting-Host: clv-oh22-10.ix.netcom.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm trying to convert the following code from More Tricks of the
Game-Programming Gurus into DJGPP.  I'm having a problem getting the code
in the book to work in the 
AT&T syntax.  (Remember ScreenWidth is a 32bit int with the value of 640
and I am using near pointers with mem protection off.)

Intel code:

	void vputpixel(int x, int y, char color, char far *vscreen)
	{
	  asm {
	    push es
	    mov ax,[y]
	    mov bx,320
	    mul bx
	    add ax,[x]
	    les di,[vscreen]
	    mov di,ax
	    mov al,color
	    stosb
	    pop es
	  }
	}

My AT&T code:

	void PutPixel(char *Buf, int X, int Y, char Color)
	{
	  /* Places a pixel on the buffer at a X,Y location */

	__asm__ __volatile__("
	  pushl %%es
	  movl %0 , %%eax\n
	  movl $_ScreenWidth, %%ebx\n
	  mull %%ebx\n
	  addl %1, %%eax\n
	  lesl %2, %%edi\n
	  movl %%eax, %%edi\n
	  movb %%al, %3\n
	  stosb\n
	  popl %%ss"
	  :
	  : "g" (Y), "g" (X), "g" (Buf), "g" (Color)
	  : "memory"
	  );
	}


The AT&T code crashes when I call the module.  Did I transfer the Intel
syntax correctly to AT&T syntax?  

I am new at assembly in general, so any help would be apreciated.

BP

- Raw text -


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