[comp.os.msdos.programmer] Fonts for Hercules

pshuang@athena.mit.edu (Ping-Shun Huang) (06/24/91)

In article <3441@ria.ccs.uwo.ca> pruss@ria.ccs.uwo.ca (Alexander Pruss) writes:

 > Can you load a different font into a Hercules compatible display
 > adaptor?  (Without any hardware modifications.)  If so, how?

The basic Hercules monochrome graphics board (not the InColor board or
the RAM____ [sp?] boards or the Workstation Graphics Card) does not
provide hardware support for fonts, as EGA and VGA standards do.  As is
possible with any bit-addressable graphics device, the application can
implement any font it wants in software...  The table which tells the
board how to represent each ASCII character in display memory with bit
patterns is hard-coded in ROM, and there is no provision to change the
address of this table.  You can, however, read this table so that your
software can use it to display characters in graphics mode which look
very much like the characters in text mode.

--
Above text where applicable is (c) Copyleft 1991, all rights deserved by:
UNIX:/etc/ping instantiated (Ping Huang) [INTERNET: pshuang@athena.mit.edu]

kai@kaiki.toppoint.de (Kai Voelcker) (06/25/91)

pshuang@athena.mit.edu (Ping-Shun Huang) writes:

> In article <3441@ria.ccs.uwo.ca> pruss@ria.ccs.uwo.ca (Alexander Pruss) write
> 
>  > Can you load a different font into a Hercules compatible display
>  > adaptor?  (Without any hardware modifications.)  If so, how?
> 
> [..]
> You can, however, read this table so that your
> software can use it to display characters in graphics mode which look
> very much like the characters in text mode.

Yes, but this is not so easy. One way would be to read out or define the
char set as byte pattern. Then You need a routine that emulates the int 10h
calls (eg tty) for herc in graphics mode (same as EGA / VGA would do). But
this will work only if Your software does *not* change the video mode *and*
uses int 10h for video output. I used this for an own program, worked fine.
 ________________________________________________________________________
   Kai Voelcker, Kappelner Str 18, D-2300 Kiel 1, voice: +49 431 335605  
   kai@kaiki.toppoint.de    interests: 386asm, c, pascal; OR algorithms  
 >>> PLEASE NOTICE: I must PAY for incoming mail! ($ 0.25/KB) Thanks. <<<

davet@cbnewsj.cb.att.com (Dave Tutelman) (06/28/91)

In article <Nci342w164w@kaiki.toppoint.de> kai@kaiki.toppoint.de (Kai Voelcker) writes:
>pshuang@athena.mit.edu (Ping-Shun Huang) writes:
>
>> You can, however, read this table so that your
>> software can use it to display characters in graphics mode which look
>> very much like the characters in text mode.
>
>Yes, but this is not so easy. One way would be to read out or define the
>char set as byte pattern. Then You need a routine that emulates the int 10h
>calls (eg tty) for herc in graphics mode (same as EGA / VGA would do). But
>this will work only if Your software does *not* change the video mode *and*
>uses int 10h for video output. I used this for an own program, worked fine.

What Kai says is true, and most graphic-mode programs available for the PC
DO NOT use the BIOS for video output; they write directly to the screen for
efficiency.  A short story:

When I made my first near-clone in 1983, I made a Hercules-clone video board
for it.  I rapidly discovered that (1) I couldn't write much for it, since
the standard functions (BIOS) in video mode worked only for CGA, and
(2) almost none of the existing graphics programs would work with it, since
they were written for CGA.

My solution was to build a small TSR that I called HERCBIOS, which intercepted
INT 10.  If the display was in video mode, or if the call was a mode change
function, the TSR executed it.  Otherwise, it passed the call on to
the ROM BIOS.  If it was an "alpha write" function, my TSR looked into the
BIOS tables for drawing characters. However, it could have been enhanced to
look in some user-defined tables.  In fact, it DID look in user-defined
tables for codes over 127, per the BIOS specification.

This solved problem (1) above, but not problem (2); almost no existing
programs used the BIOS routines in graphics mode.

By 1986, and several computers later, I had figured out how to emulate
the CGA on my Hercules card (about the same time as others figured it
out, as in SIMCGA).  I released HERCBIOS 2, which added the following
interesting functionality.  If a mode-change command asked for a CGA
graphics mode, the TSR would go into CGA emulation until a non-CGA-graphics
mode was requested.  This increased the TSR from about 1200 bytes to
nearly 2000, still pretty small.

That improvement allowed more than half the graphics programs for CGA
to run on a Herc.  Those that didn't were usually those that didn't
even use the BIOS to change video mode; they did that directly to the
hardware.  I was able to convert a couple of these using DEBUG, but it
was hard work.  Anyway, CGA emulation does NOT address the font issue,
since it can only place the pixels that the program sends to it.   
The emulator doesn't know which pixels are part of a character.

Well most of that was sort-of on the subject.  And I can make
HERCBIOS 2 available to those who want it, if I can dig it out of my
archives.  It has both the BIOS-call support and the CGA emulation.
However, I can't guarantee to support it; I no longer have a
Hercules-compatible monitor at home, and haven't run the program in years.

Dave