Dec 252017
This set of programs allow most applications to use 43-line EGA or 50-line VGA text modes. With source code and notes.
File SMODE.ZIP from The Programmer’s Corner in
Category Display Utilities
This set of programs allow most applications to use 43-line EGA or 50-line VGA text modes. With source code and notes.
File Name File Size Zip Size Zip Type
NANSI.DIF 2667 796 deflated
NANSI.SYS 2471 2003 deflated
NANSI286.SYS 2454 1998 deflated
NANSI_D.DIF 585 248 deflated
NANSI_F.DIF 2771 954 deflated
R.ASM 15844 3010 deflated
R.COM 1365 856 deflated
SCRN.DOC 8847 3263 deflated
SM.ASM 6933 1260 deflated
SM.COM 454 364 deflated
VGA.INC 1438 452 deflated

Download File SMODE.ZIP Here

Contents of the SCRN.DOC file


Rights and Restrictions:

The files in this archive are made available for the use of the PC
community. The only restriction is that they may not be used, except
by the authors or those with the authors' written permission, for
profit. They may be distributed freely. Groups distributing public
domain, freeware, shareware, etc at cost, may charge a reasonable
cost of duplication and distribution fee for a disk including this
archive. The rights to SM and R are reserved by the author.


The files in this archive for a set of files which aid in utilizing
43 lines (EGA) or 50 lines (VGA) per screen. They consist of three
units: NANSI, SM.COM, and R.COM. MASM source files are included for
SM.COM and R.COM. For NANSI, a difference file indicating the changes
to the source file found on IBMSW, DL 1 as NANSRC.ARC. The revised
sources were not included both to save space and on the advise of
a sysop who responded to my request to the author for permission to
upload. To the best of my knowledge NANSI is in the public domain, but
I have not been able to contact the author.

General content:

NANSI.SYS a revised version of NANSI which is, in turn, a revision
of ANSI.SYS. 8088, etc, version.

NANSI286.SYS Same as NANSI.SYS except utilitizes some of the 80286
enhanced real mode instructions for speed.

SM.COM A command line utility for changing the lines/screen.
Useful in a batch file to enquire the current status.

R.COM A utility to run a program that must run with 25 lines
per screen. It saves and restores the number of lines
currently in use before running the program.


The two programs described below require a new version of ANSI.SYS
to run properly. It is possible that no ANSI.SYS in the system would
also work. However, ANSI.SYS and many of its varients control the
scroll of stdout at the expected 25 lines per screen. Some permit
43 line modes IFF you use a special request to the driver. I have
supplied two versions of NANSI.SYS which supports all of the standard
ANSI.SYS functions and works at higher speed. They also check the
BIOS area for the number of lines/screen rather than make any assumptions.

NANSI.SYS is for any 80x86/8 processor. NANSI286.SYS requires a 80286
or 80386 (possibly works with 80186). It uses some extended instructions
to improve speed.


NANSI.SYS and both programs below assume that the BIOS data area is
setup according to the EGA and VGA specifications. There are rumors
I've heard that some TSR's and drivers, including FANSI-CONSOLE it is
reported, may cause the BIOS data area to be different and these programs
will probably fail. If there are any drivers other than NANSI supplied
with the programs or TSR programs that in some fashion augment the
screen operation, it is possible that there will be a failure. The
only way to know is to test them. So far they have run with SideKick
Plus, Periscope II debugger, Turbo and MS compilers, and Brief and
MS Editors.

Program: SM.Com (Screen Mode)

Purpose: To adjust EGA or VGA card to 43/50 rows or back to 25 rows or
to check which mode it is in. Does this without clearing the
screen. Preserves as many lines currently displayed as possible.


SM n <- set screen
or SM <- query screen

1. If n is present and is a number from 0-25, the screen will be set
to 25 lines if not already there. The return code (ERROR_LEVEL)
will be 0 if no change was needed, else 1.

2. If n is present and is a number greater than 25, the screen will be
set into whatever mode uses 8 scanlines per character. For EGA, this
is 43 lines. For VGA, 50 lines. No change is made if this is already
the case. The return code (ERROR_LEVEL) will be 0 if no change was
needed, else 1.

3. If no argument is given, this is a test for the current number of rows.
If it is 25 rows, the return code (ERROR_LEVEL) is 0 else it is the
current number of rows per screen. An ERROR_LEVEL of 1 may be checked
after running the program and will be true for all but 25 line mode.

4. A return code of 255 is returned if there is a bad argument or if
the interface is not an EGA or VGA.

Program: R.Com

Purpose: To run a program when the screen is in 43/50 line mode and the
program must run in 25 lines mode. R will switch the screen, run
the program, and restore the screen. It also works fine if the
screen is already in 25 line mode.



R will put the screen into 25 line mode if not there already. It
will then run the named program with the arguments supplied. If
the program name includes a disc designator or path or partial path
designation, then only the specified location will be checked. If
the program name includes a suffix or trailing period, then only the
specified suffix (or none) will be used.

NOTE: batch files may not be run this way.

The designated program is located according to the following rules.

1. If the program name does not contain a drive designation or
a \ character (forward slashes will not work here), skip to
the general search rules below.

2. A full path name is constructed from the portion given. If
no drive designator is specified, the current drive is inserted
at the start. If the path does not begin with a \, then the
current directory path for the drive is inserted at the start.

3. If the full path name so constructed, contains a period in the
last field, this is considered the only permitted name to use
and an attempt is made to open this file. Otherwise, the suffix
.EXE is appended and if that file does not exist, the suffix
.COM is tried.

4. If a file is found in step 3, that file is run as a program
with the arguments supplied.

General Search Rules.

1. First the file name is looked for in the current directory of
the current drive. The rules used in step 3 above for suffix
determination are used here.

2. If not found in step 1, then each directory in the PATH
environmental variable is tried in turn with the same suffix
rules as above applying.

3. If the file is found in steps 1 or 2, that file is run as a
program with the arguments supplied.


It is believed that the rules used (as documented above) correspond
to the way COMMAND.COM of MSDOS 3.xx locates a program.


If the screen interface is not an EGA or VGA, an error is reported
without trying to run the program.

If the program cannot be found by the algorithm given above, the

Program not found.

is reported.

Other errors may be reported from MSDOS's error report to the
program R:

Invalid function
internal error, should not happen.

File not found
probably will be reported as Program not found.

Not enough memory
Program requires more memory to run than is available.

Bad environment
just what it says.

Bad format
unsure what this means

Unknown Error
an error number not documented for MSDOS at this time
has been returned

Return Code (ERROR_LEVEL):

If R is not able to function (not VGA/EGA) or it cannot find
or fails to execute the program, the return code will be 1.
Otherwise, the return code from R will that which the program
it ran returns to it.

Source files:

SM.ASM the MASM source for SM, requires VGA.INC
R.ASM the MASM source for R, requires VGA.INC
VGA.INC some general VGA definitions used by some .ASM files

Difference files:


These file represent the difference between the source used for
the *.SYS files in the archives and the NANSRC.ARC found in DL1
of IBMSW. The original files are the basis for comparison with
the revised files show as the new version. A + indicates something
added in the revised version and a - indicates something deleted
from the original.

 December 25, 2017  Add comments

Leave a Reply