delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/03/14/03:06:30

From: "Ken Jenkins" <ken DOT jen AT adelphia DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Problems adressing memory variable
Lines: 61
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <RUfca.942$z_3.477599@news1.news.adelphia.net>
Date: Fri, 14 Mar 2003 07:54:25 GMT
NNTP-Posting-Host: 68.64.172.34
X-Complaints-To: abuse AT adelphia DOT net
X-Trace: news1.news.adelphia.net 1047628465 68.64.172.34 (Fri, 14 Mar 2003 02:54:25 EST)
NNTP-Posting-Date: Fri, 14 Mar 2003 02:54:25 EST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This program is supposed to print "Hello!" in gray letters on a blue
background at screen position (10, 10).  However all I'm getting is the blue
background with no text, 6 characters long.  Can anybody tell me what I'm
doing wrong?

void display_string (unsigned short int x, unsigned short int y, unsigned
short int text_color, unsigned short int bg_color)
{

        unsigned short int column = (x - 1);

        unsigned short int row = (y - 1);

        char * disp_str = "Hello!";

        unsigned short int length = 6;

        asm
 (

                "movw $0x1301, %%ax\n\t"

                "movb $0x00, %%bh\n\t"

                "shlb $0x04, %1\n\t"

                "movb %0, %%bl\n\t"

                "addb %1, %%bl\n\t"

                "movw %2, %%cx\n\t"

                "movb %3, %%dl\n\t"

                "movb %4, %%dh\n\t"

                "movl %5, %%ebp\n\t"

                "int $0x10"

  :

                : "g" (text_color), "g" (bg_color), "g" (length), "g"
(column), "g" (row), "o" (& disp_str[0])

                : "%ax", "%bx", "%cx", "%dx", "%ebp"

 );

};

int main (void)
{

        display_string (10, 10, 7, 1);

 return 0;

};


- Raw text -


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