delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/20/09:09:53

Message-ID: <367D056A.E1F31CB7@gmx.net>
Date: Sun, 20 Dec 1998 15:10:50 +0100
From: Christian Hofrichter <ChristianHofrichter AT gmx DOT net>
X-Mailer: Mozilla 4.5 [de]C-CCK-MCD QXW03201 (Win95; I)
X-Accept-Language: de,en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re:Re:Need ASM-Syntax to put code into one asm-instruction
Reply-To: djgpp AT delorie DOT com

Now I have put these instructions into one asm. I have saved the es and
ds-register temporarly but now I can't change  the ds-register without
getting and general protection fault.


asm("movw  %%ds,_ds \n\t"
    "movw  %%es,_es\n\t"
    "movw  %0,%%es  \n\t"
    "movl  %1,%%edi \n\t"
    "movl  %2,%%esi \n\t"
    "movw  %3,%%cx  \n\t"
    "movb  %%cl,%%bl\n\t"
    "shr   $2,%%cx  \n\t"
    "and   $3,%%bl  \n\t"
    "movw  %4,%%ds  \n\t" /*<= causes crash */
    "rep\n\t"
            "movsl  \n\t"
    "movb  %%bl,%%cl\n\t"
   "rep\n\t"
            "movsb\n\t"
    "movw  _ds,%ds   \n\t"
    "movw  _es,%%es":
                :"r"((unsigned short)
vesa_framebuffer),"r"(address),"r"(buffer),"r"(breite),"r"(progsel)
                :"%cx","%esi","%edi" );

Now the syntax is right, isn't it ?

- Raw text -


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