delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/05/10:02:43

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Joel Saunders" <jbs30000 AT aol DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Simple extended inline assembly question.
Date: Tue, 5 Feb 2002 14:55:29 +0000 (UTC)
Organization: Mailgate.ORG Server - http://www.Mailgate.ORG
Lines: 34
Message-ID: <a06bdd2a8cddeb9e7983067354ac4918.62691@mygate.mailgate.org>
NNTP-Posting-Host: spider-wm063.proxy.aol.com
X-Trace: news.mailgate.org 1012915958 28773 205.188.199.178 (Tue Feb 5 15:55:29 2002)
X-Complaints-To: abuse AT mailgate DOT org
NNTP-Posting-Date: Tue, 5 Feb 2002 14:55:29 +0000 (UTC)
Injector-Info: news.mailgate.org; posting-host=spider-wm063.proxy.aol.com; posting-account=62691; posting-date=1012915958
User-Agent: Mailgate Web Server
X-URL: http://mygate.mailgate.org/mynews/comp/comp.os.msdos.djgpp/a06bdd2a8cddeb9e7983067354ac4918.62691%40mygate.mailgate.org
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Ok, when learning inline assembly I did a test program which had these
variables:
char *Screen_PTR = (char *)(0xB8000 + __djgpp_conventional_base);
Which is a pointer to the text mode screen of course.
char My_Name[9] = {"J O E L "};
My name, obviously :)
Ok, now this routine works just fine.
__asm__(
        "cld\n\t"
        "movl $_My_Name, %esi\n\t"
        "movl _Screen_PTR, %edi\n\t"
        "movl $8, %ecx\n\t"
        "rep\n\t"
        "movsb"
);
But when I tried to make an extended inline assembly routine like so:
#define Mov_Byte(Src, Dest, Mov_Size)\
        __asm__ __volatile__(\
                "cld\n\t"\
                "rep\n\t"\
                "movsb"\
                : :"S" (Src), "D" (Dest), "c" (Mov_Size)\
                : "%esi", "%edi")
I can't get it to work.  The only thing I can use it, without generating
errors is to go:
Mov_Byte(My_Name[0], Screen_PTR[0], 8);
But nothing shows up on the screen.
Oh, and I don't include "%ecx" in the clobber list because then I get
the error:
Can't find a register in class `CREG' while reloading `asm'


-- 
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

- Raw text -


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