[comp.os.msdos.programmer] Editable characters in textmode?

roland@dna.lth.se (Roland Mansson) (01/21/91)

We are working on a project where we need to display (>)500 
different characters on the screen. We are not sure on the 
way to go now, should we use graphics or textmode?

According to some documentation it's possible to change the 
fonts used in the textmode, and in some places it says that 
only the last 128 characters is placed in ROM (i.e. possible 
to change). Is it possible to change the .CPI files to get 
an alternative font? We can see advantages and drawbacks in 
both approaches and have a fairly good knowledge about 
graphic oriented displays, but we would like to have some 
tips and advises on a textmode solution, a topic seldom 
covered in PC-literature. On a "Hercules plus" card this is 
easily done, but how about the other cards? Its obviously 
done in some programs, for example Norton Utilities displays 
a mousecursor in textmode drawn by changing the textfont on 
the fly.

Is it possible, we probably must have 2 fonts and switch 
them in and out?

How is the .CPI files used?

Has someone done anything similar?

Thanks in advance
Joakim Bengtson & Lars Sigebo
Lund University Computing Center
-- 
Roland Mansson, Lund University Computing Center, Box 783, S220 07 Lund, Sweden
Phone: +46-46107436   Fax: +46-46138225   Bitnet: roland_m@seldc52
Internet: roland.mansson@ldc.lu.se   or   roland.mansson%ldc.lu.se@uunet.uu.net
UUCP: {uunet,mcvax}!sunic!ldc.lu.se!roland.mansson    AppleLink: SW0022

ts@uwasa.fi (Timo Salmi) (01/23/91)

In article <1991Jan21.144508.2272@lth.se> roland@dna.lth.se (Roland Mansson) writes:
>We are working on a project where we need to display (>)500 
>different characters on the screen. We are not sure on the 
>way to go now, should we use graphics or textmode?
>
>According to some documentation it's possible to change the 
>fonts used in the textmode, and in some places it says that 
>only the last 128 characters is placed in ROM (i.e. possible 
:

You might find the reference information on fonts in faqpas.txt in
/pc/ts/tsfaq16.arc of some interest.

...................................................................
Prof. Timo Salmi        (Moderating at anon. ftp site 128.214.12.3)
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun

frisk@rhi.hi.is (Fridrik Skulason) (01/24/91)

In article <1991Jan21.144508.2272@lth.se> roland@dna.lth.se (Roland Mansson) writes:
>We are working on a project where we need to display (>)500 
>different characters on the screen. We are not sure on the 
>way to go now, should we use graphics or textmode?

I assume you need 500+ different characters on the screen at the same time,
not just a simple swap of character sets.

The answer is: It depends ....

I would recommend using textmode, simply because of speed, but there are a
few problems.  The solution depends on the display cards you use.

IF you are using original CGA, MDA or Hercules cards, forget it - you cannot
do it.

If you are using the new cards from Hercules, where they use 14 bits per
character instead of 8 it is easy.

The interesting solution is when you are using the VGA card, which is
more-or-less the standard card today.  It is easy to redefine characters 
on the EGA/VGA - any single character or a block of them can be redefined with
a short piece of code - something like this:

	MOV	CX,29			; number of characters to change
	MOV	DX,139			; starting character
	MOV	AX,1110H		; change it
	MOV	BH,16			; bytes per character
	MOV	BL,0			; block to load
	INT	10H
	MOV	AX,1103H		; and select block 0
	XOR	BX,BX
	INT	10H

However - you can normally only display 256 different characters on the
screen at the same time.  There is a solution, though, provided you do not
need more than 512 different characters on the screen.

Every character on the screen is represented by 16 bits - normally 8 are used
to select the character, and 8 are attribute bits.  It is possible to change
that - using one of the attribute bits to select a block of characters.
The code is something like this...

	MOV 	AX,1103H
	MOV	BL,0CH

Then a character from block 0 will be selected when attribute bit 3=0,
otherwise a character from block 3 will be selected.  You just need to set up
the bitmap for the new 256 characters (have fun - I think I have a character
mode font editor somewhere if you want it) and load block 3.

The drawback of this method is the loss of one colour - you get only 8 colours,
instead of 16.

-frisk

----
Fridrik Skulason      University of Iceland  |       
Technical Editor of the Virus Bulletin (UK)  |  Reserved for future expansion
E-Mail: frisk@rhi.hi.is    Fax: 354-1-28801  |