delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/10/10:47:29

Date: Mon, 10 Jan 2000 12:25:33 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Martin Str|mberg <ams AT ludd DOT luth DOT se>
cc: djgpp AT delorie DOT com
Subject: Re: The endless int31 hooking debugging continued
In-Reply-To: <85a7so$9kn$1@news.luth.se>
Message-ID: <Pine.SUN.3.91.1000110122457.6643J-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 9 Jan 2000, Martin Str|mberg wrote:

> : How about using _farpokeb, then?  It's inline assembly, and doesn't
> : use the stack.  You could write the characters with it one by one.
> : Clumsy, but works.
> : 
> : Actually, you could even use the assembly instructions from _farpokeb
> : inlined in your code.
> 
> The problem I have isn't with the loop or such, but to get something
> out to video memory. I have some kind of basic understanding of
> assembly, but knows very little about PC hardware.

The following snippet puts a red letter 'a' on lightgray background in
the leftmost, topmost corner of the screen (WARNING: UNTESTED CODE!):

    _farpokeb (_dos_ds, 0xb8000, 'a');
    _farpokeb (_dos_ds, 0xb8001, 0x74);

Each character on the screen takes two bytes in the video memory: the
first holds the character's code, the second its video attribute
byte.  The attribute byte (here, 0x74) holds the background color in
its high nibble and the foreground color in its lower nibble.  The
color codes begin at 0 and go up in the order the colors are listed in
the "enum COLOR" on conio.h.

To put 'a' in the rightmost lower corner, use 0xb8000 + 160*24 + 158
as the second argument to _farpokeb (assuming 80x25 text screen).

- Raw text -


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