Article View: comp.os.msdos.programmer
Article #731Re: Graphic mouse cursor on a text screen
From: Matt Staben
Date: Wed, 15 Apr 1992 00:34
Date: Wed, 15 Apr 1992 00:34
112 lines
5219 bytes
5219 bytes
In article <10547@discus.technion.ac.il> s2861785@techunix.technion.ac.il (Alon Ziv) writes:
>I have seen of late quite a few programs (Norton Utilities, for example) which
>(seem to?) use a graphic mouse cursor on a text screen.
>Does anybody have any information as to how this is accomplished?
>
>-AZ
>
>PS Please, don't send me book references! I don't have access to most books,
> and my time is short. I would be content with highly technical, short
> answers - I _do_ have all PD reference files, inculding the INTERlist,
> VGADOC, HelpPC, etc.
>
>PPS No metoo postings! Anybody interested may mail me - I will send all I get,
>--
>Internet: s2861785@tx.technion.ac.il . __
> I'M A STUDENT: When I'm wrong, it's my teacher's fault _| /
> (when I'm right, the credit is all mine!) / | /_
> Alon Ziv
You're correct. Norton Utilities _is_ using the text screen for its graphics
by remapping certain characters. I have written a chunk of code (which is
available to you if you want) which accomplishes much the same thing. In
fact, I have released (as shareware) a linkable library which allows Clipper
developers ('87 or 5.x) to use this mouse cursor in their applications for
excellent looking interfaces. How this is done:
+-----+-----+
+ 1 | 2 |
+-----+-----+
| 3 | 4 |
+-----+-----+
The mouse cursor is actually four characters on the screen with a bit-map
mapped into them. This does require EGA/VGA style cards which allow access
to the character sets in order to modify four characters which can then be
placed anywhere on the screen.
So, if you are overwriting a "0" on the screen with part of a cursor, you
must combine the cursor as well as the "0", and then place the modified
character on the screen. This method is appropriately called "TILING", or
the act of building graphic sets by altering each character. This can grow
as complex or simple as you want.
TECHNICAL INFORMATION
---------------------
In order to be able to REMAP the vga/ega character sets, the character
generator must be turned off - which then enables access to the VGA's
character set at A000:0000, while disabling the memory areas at B000:000
through BFFF:FFFF. This can be a bitch to debug since the screen disappears
and is filled with a high frequency hum during this access time in turbo
debugger. It then is restored when you switch back. This is accomplished
by doing the following code segments:
TO TURN ON ACCESS TO CHARACTER TABLES
-------------------------------------
.model small
.code
mov dx, 3C4h
mov ax, 0402h
out dx, ax
mov ax, 0704h
out dx, ax
mov dl, 0CEh
mov ax, 0204h
out dx, ax
mov ax, 0005h
out dx, ax
mov ax, 0006h
out dx, ax
mov ah, 4Ch
int 21h
end
By simply compiling this code and running it as is (with TASM), you will
see that running it will cause all characters (after running it) which
should be appearing on the screen to be invisible. This is because the
character generator has been disabled. The hardware cursor, however, is
still visible and it will move. I use this code all the time, such as
making neat boot sequences. (blanking out my screen and putting up bart
while the computer boots is a nice idea).
TO TURN OFF ACCESS TO CHARACTER TABLE AND RESTORE VIDEO
-------------------------------------------------------
.model small
.code
mov dx, 3C4h
mov ax, 0302h
out dx, ax
mov ax, 0304h
out dx, ax
mov dl, 0CEh
mov ax, 0004h
out dx, ax
mov ax, 1005h
out dx, ax
mov ax, 0E06h
out dx, ax
mov ah, 4Ch
int 21h
end
By running this code as is, (as the first segment), you'll notice that the
video is now displayed as usual. Removing the int 21 call, on both segments
and putting them into your homebrew application, it becomes quite easy to
remap character sets as you see fit. Don't forget to do a reset after your
application terminates to restore the original character sets or you'll see
some holdovers in other applications (ah=11h, al=4h, bl=0h, int 10h).
Hope this helped you out...
mstaben@visual.spk.wa.us
Technical Details
Message-ID:
<1992Apr15.003409.5356@visual.spk.wa.us>Path:
arc1-ca.pugleaf.net!sparky!uunet!olivea!isc-br!tau-ceti!visual!mstabenReferences:
<10547@discus.technion.ac.il>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!isc-br!tau-ceti!visual!mstaben From: mstaben@visual.spk.wa.us (Matt Staben) Newsgroups: comp.os.msdos.programmer Subject: Re: Graphic mouse cursor on a text screen Message-ID: <1992Apr15.003409.5356@visual.spk.wa.us> Date: 15 Apr 92 00:34:09 GMT References: <10547@discus.technion.ac.il> Organization: The Visual Market Public Access Site - Spokane, WA Lines: 112