delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/07/13:40:36

From: Damian Yerrick <MYNAMEISd_yerrick AT hotmail DOT comNO2CANNEDHAM>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Inline asm translations?
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <s9vt9sol9hhshiefu5qpleh3tqked6mof0@4ax.com>
References: <389ED6AC DOT 76B16F3F AT yahoo DOT com>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 57
X-Trace: +4UIu5Zuj5zfIQh8J0S2jiU3uAcl3dWIvpUFo+rPFGX2bePV/+pnxIDBsvuuwEchpb3BxiqqU3Nx!uPQBS0xp4i3XXFRaT62CV6I9AoShfjBUVjwPfQgp+iw+4TGym2Fi1TU7NLesHGTwoY8UoJAEbQ==
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Mon, 07 Feb 2000 17:19:23 GMT
Distribution: world
Date: Mon, 07 Feb 2000 17:19:23 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Mon, 07 Feb 2000 14:29:00 +0100, Jan-Jaap Severs
<janjaaps AT yahoo DOT com> wrote:

>Hi people. Seems my previous msg was lost somewhere before it reached
>the newsgroup. Anyway, could someone please try and translate these two
>pieces of inline Intel asm code to AT&T inline asm code? I could really
>use those translations in trying to understand AT&T syntax. Thanx in
>advance.
>
>Here are those pieces:
>
>void FillDoubleBuffer( int color )
>{
>        asm {
>          mov cx, double_buffer_size
>          mov al, BYTE PTR color
>          mov ah, al
>          les di, double_buffer
>          rep stosw
>        }
>}

Clear screen. It's a memset() that works with real mode farpointers.

>And another one:
>
>asm {
>les di, dest_addr
>mov al, BYTE PTR color
>mov ah, al
>mov cx, xe
>sub cx, xs
>inc cx
>shr cx, 1
>rep stosw
>}

Horizontal line. Another memset().

>You might recognize them from an Andre LaMothe book...

"Black Art of 3D Game Programming"

Those are 16-bit code for memset().  Near the end of the book, it
talks about 32-bit protected mode programming and DPMI; DJGPP uses 32
bits and DPMI.  DJGPP's libc contains a 32-bit memset() that should
clear a double buffer, but I'd just use the Allegro library for the
type of thing you're trying to do.
  http://www.talula.demon.co.uk/allegro/
And Allegro has a lot of AT&T Gas-backwards assembly source for you to
peruse and reuse.

-- 
Damian Yerrick  http://yerricde.tripod.com/
Comment on story ideas: http://home1.gte.net/frodo/quickjot.html
AOL is sucks! Find out why: http://anti-aol.org/faqs/aas/
View full sig: http://www.rose-hulman.edu/~yerricde/sig.html

- Raw text -


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