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

From: "Ken Jenkins" <ken DOT jen AT adelphia DOT net>
Newsgroups: comp.os.msdos.djgpp
References: <RUfca.942$z_3 DOT 477599 AT news1 DOT news DOT adelphia DOT net> <b4s30b$n6o$1 AT antares DOT lu DOT erisoft DOT se>
Subject: Re: Problems adressing memory variable
Lines: 77
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: <G3wca.1706$z_3.763310@news1.news.adelphia.net>
Date: Sat, 15 Mar 2003 02:18:14 GMT
NNTP-Posting-Host: 68.64.172.34
X-Complaints-To: abuse AT adelphia DOT net
X-Trace: news1.news.adelphia.net 1047694694 68.64.172.34 (Fri, 14 Mar 2003 21:18:14 EST)
NNTP-Posting-Date: Fri, 14 Mar 2003 21:18:14 EST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

So what am I doing wrong now?

#include <dpmi.h>

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

 char * disp_str = "Hello!";

 unsigned short int length = 6;

 // *****************************************************

 unsigned short int column = (x - 1);

 unsigned short int row = (y - 1);

 __dpmi_regs output;

        output.x.ax = output.x.cs;

        output.x.ds = output.x.ax;

        output.x.es = output.x.ax;

 output.x.ax = 0x1301;

 output.h.bh = 0x00;

        output.h.bl = ((text_color << 4) + bg_color);

 output.x.cx = length;

 output.h.dl = column;

 output.h.dh = row;

        output.x.bp = ((disp_str[0]) >> 4);

        output.x.ss = (((disp_str[0]) << 4) >> 4);

        __dpmi_int (0x10, (& (output)));

};

int main (void)
{

 display_string (10, 10, 7, 1);

 return 0;

};



"Martin Stromberg" <eplmst AT lu DOT erisoft DOT se> wrote in message
news:b4s30b$n6o$1 AT antares DOT lu DOT erisoft DOT se...
> Ken Jenkins (ken DOT jen AT adelphia DOT net) wrote:
> : 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?
>
> Yes. You are issuing a real mode interrupt in protected mode. You
> aren't moving the values the real mode call need into conventional
> memory. Read __dpmi_int and related FAQs.
>
>
> Right,
>
> MartinS


- Raw text -


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