🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4345

Re: Editable characters in textmode?

#4345
From: Fridrik Skulason
Date: Thu, 24 Jan 1991 15:02
60 lines
2876 bytes
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  |   
Technical Details
Message-ID: <2671@krafla.rhi.hi.is>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!isgate!krafla!frisk
References: <1991Jan21.144508.2272@lth.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!isgate!krafla!frisk
From: frisk@rhi.hi.is (Fridrik Skulason)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Editable characters in textmode?
Message-ID: <2671@krafla.rhi.hi.is>
Date: 24 Jan 91 15:02:20 GMT
References: <1991Jan21.144508.2272@lth.se>
Reply-To: frisk@rhi.hi.is (Fridrik Skulason)
Organization: University of Iceland (RHI)
Lines: 60