Dec 082017
Mg (aka MicroGnuEmacs) editor for DOS, w/ C src.
File MG2A-DOS.ZIP from The Programmer’s Corner in
Category C Source Code
Mg (aka MicroGnuEmacs) editor for DOS, w/ C src.
File Name File Size Zip Size Zip Type
ALLOCA.C 4937 2013 deflated
BASIC.C 9883 2921 deflated
BUFFER.C 15109 4589 deflated
CHRDEF.H 2125 823 deflated
CINFO.C 3416 1000 deflated
DEF.H 10352 3906 deflated
DIR.C 1106 554 deflated
DIRED.C 4307 1001 deflated
DISPLAY.C 24237 7899 deflated
ECHO.C 12424 3930 deflated
EXTEND.C 20512 6019 deflated
FILE.C 12239 4150 deflated
FILEIO.C 11298 3932 deflated
HELP.C 7074 2220 deflated
KBD.C 8973 2517 deflated
KBD.H 1511 680 deflated
KEY.H 346 228 deflated
KEYMAP.C 29765 7734 deflated
LINE.C 17047 5407 deflated
LINKFILE 330 152 deflated
MACRO.C 1656 676 deflated
MACRO.H 443 246 deflated
MAIN.C 3297 1493 deflated
MAKEFILE.MS4 1870 681 deflated
MAKEFILE.MS5 1873 677 deflated
MAKEFILE.TC 1650 616 deflated
MATCH.C 4601 1864 deflated
MG.EXE 90627 41217 deflated
MG.TEX 52376 15530 deflated
MG2A.CHA 5532 2538 deflated
MGIDX.TEX 4423 1015 deflated
MGPROG.DOC 11200 4798 deflated
MODES.C 3252 947 deflated
OFILEIO.C 10888 3828 deflated
OTTY.C 6978 2469 deflated
OTTYIO.C 2228 1022 deflated
OTTYKBD.C 5322 1844 deflated
PARAGRAP.C 7647 2443 deflated
QUOTER.COM 9847 7615 deflated
RANDOM.C 11242 3739 deflated
README.1ST 4491 2171 deflated
README.MG2 8202 3812 deflated
REGEX.C 44699 11823 deflated
REGEX.H 4536 1809 deflated
REGION.C 7517 2368 deflated
RE_SEARC.C 18612 5613 deflated
SEARCH.C 14622 4100 deflated
SPAWN.C 856 526 deflated
SYSDEF.H 1661 853 deflated
TTY.C 7036 2497 deflated
TTYDEF.H 1625 671 deflated
TTYIO.C 2273 1040 deflated
TTYKBD.C 5497 1909 deflated
TUTORIAL 25301 9019 deflated
VARARGS.H 955 513 deflated
VERSION.C 412 271 deflated
WINDOW.C 9901 2949 deflated
WORD.C 5651 1342 deflated

Download File MG2A-DOS.ZIP Here

Contents of the README.1ST file

ADDITIONAL NOTES: M. Slomin, 8/10/88 --

I was not successful compiling mg2 under TC 1.5. It seems to have a
memory allocation error in it. Perhaps the stack should be adjusted.
As an alternative, I minimally hacked the program for compilation
under MSC 4.0 (which generally produces faster code than TC anyway,
and, by the way, has alloca() built in). The ttyio.c, ttykbd.c, tty.c
and fileio.c files are the hacked ones; the same file names preceded
by "o" (e.g., ottyio.c, etc.) are the originals referred to below.
The makefile for compilation under MSC 4.0 is "makefile.ms4." To compile,
type "make makefile.ms4." Note that the files to be linked are in
"linkfile", and that the link command has the flag /exepack (implying
that only the MSC 4.0 linker, and not the one supplied with DOS, should
be used).

If you should have MSC 5.0 (which I don't), you should rename these
files to their original names. You may want to consider using the new
tty.c file in any event, which halves the time interval for sensing ^X
commands and the like. I found it too long in the MSC 4.0 version,
and the 5.0 code is the same.


This is the source for the MS-DOS version of mg2a. These files are
intended to reside in a directory sys/msdos underneath the main mg2a
source directory.

This code will run under both "Turbo C 1.5" and "Microsoft C 5.1"

To compile using Turbo C 1.5, copy from the sys/msdos
directory into the main mg2a source directory, then cd into the main
directory and use the Turbo C "make" program (just type "make").

To compile using Microsoft C 5.1, cd into the main directory and type
"make sys\msdos\makefile.msc"
M.S. NOTE: SIMPLY USE "make makefile.ms5"

A few random notes:

o The display routines rely on the ROM BIOS interface. This has the
advantage of being more portable, but at the expense of display
speed. Direct memory-mapped display code or using ANSI sequences with
NANSI or FANSI-Console could be much faster. To keep the program
small and maintain portability, enhancements such as these should
be supported as compile-time options (e.g. with #ifdef's)

The only display mode supported is 24 x 80. To fix this, you will
need to change NROW and NCOL ttydef.h to be the largest # of rows
and columns supported, then you will have to change either
ttresize() in "tty.c" or setttysize() in "ttyio.c" to check the
BIOS parameter memory for the current screen size.

o Note that the keyboard support also goes through the BIOS.
The "backspace" key generates DELETE (so that it does a
delete-backwards, while control-h still returns control-h (i.e.
HELP). Arrow keys, HOME, END, PgUp, PgDn, etc. are supported
(look in ttykbd.c) The ALT key works like a META key for alpha
keys, but the BIOS doesn't return keycodes for certain ALT
key combinations (I wish ALT-SHIFT-< worked!) 8 bit characters
(the line drawing set!) are supported, but to enter them, you
must use ALT-ddd (where ddd are digits on the numeric keypad).

o The dired mode SEEMS to work, but I am not real happy with "dired" in the
first place, and the MS-DOS implementation isn't very well tested.
Presumably this is one area which will be enhanced in mg 2b.

o REGEX compiles OK, but doesn't seem to work right. I haven't done any
extensive testing, and I'm not sure what is breaking down. If you
want to play with this, you must add the
string "-DREGEX" to the CDEFS macro in the makefile (don't try to
add it to sysdef.h: regex.c won't compile right (sigh)).

Anyway, I've got no use for REGEX at the moment, and compiling it
in adds 15K to the base executable size of 90K. I pass.

Good luck with this. We hope you find it useful. Please send any
improvements you make.


John P. Nelson (decvax!genrad!jpn, [email protected]) did the Turbo C
port and most of the work (based on his earlier work on
MicroGnuEmacs). Jeff Siegal ([email protected]) brought it up under
Microsoft C and fixed a few bugs.

This document was written by John P. Nelson and modified by Jeff Siegal.

 December 8, 2017  Add comments

Leave a Reply