From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: Turbo C++ problem
Date: 29 Sep 92 00:06:35 GMT
Organization: negligable

Ok, I have unassemblys of three programs that apply.
EGA25.COM and EGA43.COM set the mode to 25 or 43 lines
respectively.  The second INT 10 call sets the cursor
lines, so I assume that the first call sets the text
mode.  The MOV AX,xxxx is a shorthand to load AH and AL 
at the same time.  What the rest of this program is
doing w/ the BYTE PTR [0487] I really don't remember....

EGAMODE.COM will check the current video mode and report
it if no arguments are given.  If you add a number on the
command line it will set that video mode.  Note that in 
both 25 and 43 line modes you get "Video mode is 03".

Thinking more on it I seem to recall that the 25 & 43 line
modes are a function of alternate (shorter) character sets
and pointing the character generator to the right font
bitmap table.....  I think the 43 & 25 char tables are in 
ROM, but you can actually design your own fonts of ANY
height, load them into RAM and point the character generator
at your new font.  I may be able to dig up some old PC
Magazine utility that did this for you.  The fact that
the 25 & 43 line mode charsets exist in ROM may mean that
the process for pointing at either of their fonts has a
"shorthand" method (used in these .COM programs) and that
pointing to your own font table would be a more complicated
(although not by much) process.  I think that some of the
misc. instructions in these programs are for setting the
number of lines in the current video mode properly so that
a program that asks can find out how many lines it has
to work with.

		-Richard Hartman
		hartman@ulogic.COM

Disclaimer -- I do not recall the origins of these programs, 
I *think* they were originally published in the letter columns
(or the User-to-User section) of PC Magazine a few years ago.
Similar programs have been published by many of the other 
mags out there.  I do not think that anything here is unique
enough that anyone is going to get upset about possible copyright
violations.  I consider that using these in reply to your
question would be considered "fair usage" in any event.


Unassembly of: EGA25.COM
-u 100,127

2AA4:0100 B81111        MOV	AX,1111                            
2AA4:0103 B300          MOV	BL,00                              
2AA4:0105 CD10          INT	10                                 
2AA4:0107 29C0          SUB	AX,AX                              
2AA4:0109 8ED8          MOV	DS,AX                              
2AA4:010B FF368704      PUSH	[0487]                             
2AA4:010F 800E870401    OR	BYTE PTR [0487],01                 
2AA4:0114 B90D0B        MOV	CX,0B0D                            
2AA4:0117 B401          MOV	AH,01                              
2AA4:0119 CD10          INT	10                                 
2AA4:011B 8F068704      POP	[0487]                             
2AA4:011F BAB403        MOV	DX,03B4                            
2AA4:0122 B8140D        MOV	AX,0D14                            
2AA4:0125 EF            OUT	DX,AX                              
2AA4:0126 CD20          INT	20                                 
-q



Unassembly of: EGA43.COM
-u 100,127

2AA4:0100 B81211        MOV	AX,1112                            
2AA4:0103 B300          MOV	BL,00                              
2AA4:0105 CD10          INT	10                                 
2AA4:0107 29C0          SUB	AX,AX                              
2AA4:0109 8ED8          MOV	DS,AX                              
2AA4:010B FF368704      PUSH	[0487]                             
2AA4:010F 800E870401    OR	BYTE PTR [0487],01                 
2AA4:0114 B90006        MOV	CX,0600                            
2AA4:0117 B401          MOV	AH,01                              
2AA4:0119 CD10          INT	10                                 
2AA4:011B 8F068704      POP	[0487]                             
2AA4:011F BAB403        MOV	DX,03B4                            
2AA4:0122 B81407        MOV	AX,0714                            
2AA4:0125 EF            OUT	DX,AX                              
2AA4:0126 CD20          INT	20                                 
-q

Diff of: EGA25.DMP EGA43.DMP
2c2
< 2AA4:0100 B81111        MOV	AX,1111                            

---
> 2AA4:0100 B81211        MOV	AX,1112                            

9c9
< 2AA4:0114 B90D0B        MOV	CX,0B0D                            

---
> 2AA4:0114 B90006        MOV	CX,0600                            

14c14
< 2AA4:0122 B8140D        MOV	AX,0D14                            

---
> 2AA4:0122 B81407        MOV	AX,0714                            


Unassembly of: EGAMODE.COM
-u 100,101

2AA4:0100 EB19          JMP	011B                               
-d 102,11a

2AA4:0100        43 75 72 72 65 6E-74 20 56 69 64 65 6F 20     Current Video 
2AA4:0110  4D 6F 64 65 20 69 73 20-30 30 24                  Mode is 00$
-u 11b,156

2AA4:011B BB5D00        MOV	BX,005D                            
2AA4:011E B60A          MOV	DH,0A                              
2AA4:0120 28C0          SUB	AL,AL                              
2AA4:0122 B90300        MOV	CX,0003                            
2AA4:0125 8A17          MOV	DL,[BX]                            
2AA4:0127 80EA30        SUB	DL,30                              
2AA4:012A 720C          JB	0138                               
2AA4:012C 80FA09        CMP	DL,09                              
2AA4:012F 7707          JA	0138                               
2AA4:0131 F6E6          MUL	DH                                 
2AA4:0133 00D0          ADD	AL,DL                              
2AA4:0135 43            INC	BX                                 
2AA4:0136 E2ED          LOOP	0125                               
2AA4:0138 83FB5D        CMP	BX,+5D                             
2AA4:013B 7404          JZ	0141                               
2AA4:013D 28E4          SUB	AH,AH                              
2AA4:013F CD10          INT	10                                 
2AA4:0141 B40F          MOV	AH,0F                              
2AA4:0143 CD10          INT	10                                 
2AA4:0145 257F00        AND	AX,007F                            
2AA4:0148 F6F6          DIV	DH                                 
2AA4:014A 01061801      ADD	[0118],AX                          
2AA4:014E BA0201        MOV	DX,0102                            
2AA4:0151 B409          MOV	AH,09                              
2AA4:0153 CD21          INT	21                                 
2AA4:0155 CD20          INT	20                                 
-q