From - Thu Mar 05 22:26:03 1998
Path: uniserve!sunqbc.risq.qc.ca!streamer1.cleveland.iagnet.net!qual.net!iagnet.net!209.98.98.14!darla.visi.com!chippy.visi.com!news-out.visi.com!pulsar.dimensional.com!dimensional.com!quasar.dimensional.com!nyx.net!nyx10!dgdavis
From: dgdavis@nyx10.nyx.net (DONALD G. DAVIS)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Mixing 80x25 Text & Graphics
Date: 5 Mar 1998 01:57:25 GMT
Organization: Nyx Public Access Internet
Lines: 144
Message-ID: <889063005.12509@iris.nyx.net>
References: <EpB8w5.9Ax@erie.ge.com>
NNTP-Posting-Host: iris.nyx.net
X-Newsreader: NN version 6.5.0 #5
X-Disclaimer: Nyx is a Free Public Access Internet Service: http://www.nyx.net
              Our AUP / Free Speech Policy are at http://www.nyx.net/policies/
              Direct complaints to abuse@nyx.net
X-Post-Path: iris.nyx.net!dgdavis@nyx10.nyx.net
Xref: uniserve comp.os.msdos.programmer:1012646

Rich Grisier <grisier@crypt.erie.ge.com> writes:

>Is there a way to mix text & graphics when in text 80x25 mode?

>I was thinking of creating new text "characters" that get called
>when an ascii code is entered, but I'm not sure how to accomplish this.

	It is possible to remap the standard character set to create
graphics-like effects in text mode.  Appended below is a little assembly
program that demonstrates a simple case of this by remapping three
characters to create a "bat" symbol.

							--Donald Davis
========================================================================

;Displays bat symbol created by remapping character set.
;Based on feature of MOZ.EXE.  Written for assembly under MASM 5.1.

;Chars. 192-223 have an extra 9th line along the right side.  This program
; makes a bat with no gaps between the elements by remapping 2 of those
; chars. and using 224 as the right block, since it is the next one that
; lacks that extra line and will therefore make the right side symmetrical
; with the left.  If other characters are used for the left wing and body,
; there will be gaps between the elements.

;This program does not reload the default character set on terminating.
; The remapped characters will remain remapped until this is done
; (as by MODE CO80).

CSEG	SEGMENT

	ASSUME CS:CSEG,DS:CSEG,ES:CSEG
	ORG	0100H

START:

	CALL	BIOWRT	;Remap bits in character generator table

	MOV	BX,12		;BL: display attribute, BH: video page 0
	MOV	CX,3		;Number of characters to display
	MOV	BP,OFFSET BAT	;Point BP to start of text buffer
	PUSH	CX		;Save number of characters to print
	MOV	AH,3		;Get cursor row & column into DH and DL
	INT	10H		;Call video BIOS interrupt
	POP	CX		;Restore number of characters to print
	MOV	AX,1301H	;BIOS print-string func., cursor-moving subfunc.
	INT	10H		;Call video BIOS interrupt
	RET			;Terminate program

BAT	DB	221,222,224	;ASCII characters to remap & display

;************************************************************************
; Replace three characters of character generator				*
; with bat components, using the BIOS function 11hex				*
;************************************************************************
BIOWRT:
	PUSH	BP
	PUSH	ES
	PUSH	SI

	;MOV AX,1202h ;set up 400 scan lines
	;MOV BL,30h
	;INT 10h

	;MOV AX,0003 ;set up normal text mode
	;INT 10

	MOV	BP,OFFSET CMAP1	;Offset of new bitmap must be in BP
	PUSH	CS		;Segment of new bitmap must be in ES
	POP	ES
	XOR	SI,SI		;Initialize pointer to table of remapped chars.
	XOR	DX,DX		;Initialize register that holds char. number
	MOV	CX,1		;Number of chars. to remap
	MOV	BL,0		;Change table 0
	MOV	BH,16		;Bytes per character
RLOOP:
	MOV	DL,BAT[SI]	;Start with first character in BAT data block
	MOV	AH,11H	;Function = LOAD CHARACTER GENERATOR
	MOV	AL,00H	;Subfunction = CUSTOM CHAR GEN
	INT	10H		;Use BIOS to replace next character
	ADD	BP,16
	INC	SI		;Point to the next character to replace
	CMP	SI,3		;Are we done with all characters?
	JB	RLOOP		;...No, go do next one

	POP	SI
	POP	ES
	POP	BP
	RET

CMAP1	DB	00010000B	;Tables representing new bitmaps for characters
	DB	00011000B
	DB	00111100B
	DB	00111110B
	DB	01111111B
	DB	01111111B
	DB	11111111B
	DB	11111111B
	DB	11111111B
	DB	11111111B
	DB	11101111B
	DB	11101110B
	DB	11000100B
	DB	10000000B
	DB	10000000B
	DB	10000000B

CMAP2	DB	01000010B
	DB	01111110B
	DB	01011010B
	DB	01111110B
	DB	01111110B
	DB	11111111B
	DB	11111111B
	DB	11111111B
	DB	11111111B
	DB	11111111B
	DB	11111111B
	DB	01111100B
	DB	00111000B
	DB	00010000B
	DB	00010000B
	DB	00010000B

CMAP3	DB	00001000B
	DB	00011000B
	DB	00111100B
	DB	01111100B
	DB	11111110B
	DB	11111110B
	DB	11111111B
	DB	11111111B
	DB	11111111B
	DB	11111111B
	DB	11110111B
	DB	01110111B
	DB	00100011B
	DB	00000001B
	DB	00000001B
	DB	00000001B

CSEG	ENDS
	END	START

