www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/04/06:54:42

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: [Q] Inline Assembly
Date: Mon, 30 Jun 1997 17:56:03 +0100
Organization: None
Distribution: world
Message-ID: <Cb4ziZAjU+tzEw8k@talula.demon.co.uk>
References: <867681946 DOT 970324 AT red DOT parallax DOT co DOT uk>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 31
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

John Eccleston writes:
>   asm("movw %%ax, %%es\n\t"
>       "movl $0xA0000, %%edi\n\t"
>       "movl $16000, %%ecx\n\t"
>       "cld\n\t"
>       "rep\n\t"
>       "movsl\n\t"
>       : /* no output registers */
>       : "a" (selector), "S" (buffer)
>       : "%eax", "%esi", "%edi", "%ecx");

The only thing I can see wrong with that is that you are clobbering %es,
which isn't a good idea because djgpp assumes it will always contain the
same value as %ds. I don't think you can add segment registers to the
clobber list (correct me if I'm wrong, someone!) so you'll have to save
and restore it manually.

>If I comment out the inline assembly and use the movedata statement then
>everything works fine, but when I use the inline assembly version I seem to
>get an awful striping effect on the screen and although the program seems to
>work fine the display never changes.

Well, I just wrote a little test program using your routine, and it
worked flawlessly! Either the problem lies in the clobbering of %es
upsetting the rest of your code, or you are doing something wrong
somewhere else in your program...


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


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