Microsoft Editor

(This is a guest post by Antoni Sawicki aka Tenox)

In a recent blog post I lamented the lack of a good console/cmd/PowerShell text editor for Windows. During the process I made a rather interesting discovery, that in a fact there IS a “native” Windows, 32bit, console based text editor and it was available since earliest days of NT or even before. But let’s start from…

…in the beginning there was Z editor. Developed by Steve Wood for TOPS20 operating system in 1981. Some time after that, Steve sold the source code to Microsoft, which was then ported to MS-DOS by Mark Zbikowski (aka the MZ guy) to become the M editor.

M editor

The DOS-based M editor was included and sold as part of Microsoft C 5.1 (March 1988), together with the OS/2 variant, the MEP editor (perhaps M Editor Protected-mode). The official name of M/MEP was simply Microsoft Editor. The same editor was also available earlier (mid-1987) as part of the  MS OS/2 SDK under a different name, SDKED. Note that normally SDKED insists in operating in full screen mode. Michal Necasek generously spent his time and patched it up so that it can be run in windowed mode for your viewing pleasure.

SDKED on OS/2

However my primary interest lies with Windows. The NT Design Workbook mentions that an early days self-hosting developer workstation included compiler, some command line tools and a text editor – MEP.  In fact these tools including MEP.EXE can be found on Windows NT pre-release CD-ROMs (late 1991) under MSTOOLS. It was available for both MIPS and 386 as a Win32 native console based application.

MEP on Windows NT Pre-Release

MEP.EXE was later also available for Alpha, i386, MIPS, and PowerPC processors on  various official Windows NT SDKs from 3.1 to 4.0. It survived up to July 2000 to be last included in Windows 2000 Platform SDK. From time perspective it was rather unfortunate that it was buried in the SDK and overshadowed by Visual Studio instead of being included on Windows NT release media.

MEP from NT SDK on Windows NT 4.0

The Win32 version of MEP also comes with an icon and a file description which calls it Microsoft Extensible Editor.

Z editor Icon

But that’s not the end of the story. The editor of many names survives to this day, at least unofficially. If you dig hard enough you can find it on OpenNT 4.5 build. For convenience, this and other builds including DOS M, OS/2 MEP and SDKED, NT SDK MEP can be downloaded here.

Digging in through the archive I found not one but two copies of the editor code are lurking in the source tree. One under the name MEP inside \private\utils\mep\ folder and a second copy under name Z (which was the original editor for TOPS) in \private\sdktools\z folder. Doing a few diffs I was able to get some insight on he differences. Looks like MEP was initially ported from OS/2 to NT and bears some signs of being an OS/2 app. The Z editor on the other hands is a few years newer and has many improvements and bug fixes over MEP. It also uses some specific NT features.

Sadly it looks like the Z editor for Win32 was never released anywhere outside of Redmond. All the versions outlined so far had copyrights only up to 1990, while Z clearly has copyright from 1995. Being a few years newer and more native to NT I wanted to see if a build could be made. With some effort I was able to separate it from the original source tree and compile stand alone. Being a pretty clean source code I was able to compile it for  all NT hardware platforms, including x64, which runs comfortably on Windows 10. You can download Z editor for Windows here.

Z editor on flashy Windows 7 x64

Last but not least there is a modern open source re-implementation of Z editor named K editor. It’s written from scratch in C++ and LUA and has nothing to do with the original MEP source code. K is built only for x64 using Mingw. There are no ready to run binaries so I made a fork and build.

K editor on Windows 10 x64

The author Kevin Goodwin has kindly included copies of original documentation if you actually want to learn how to use this editor.

This entry was posted in Development, DOS, Editors, Microsoft, NT, OS/2, Source code, Uncategorized. Bookmark the permalink.

21 Responses to Microsoft Editor

  1. Pingback: Wanted: Console Text Editor for Windows | OS/2 Museum

  2. zeurkous says:

    You misspeeled Michal’s name!

  3. tenox says:

    Haha good catch. It was a spell checker!

  4. zeurkous says:

    Not a .cz one then? 😛

    The reason mespotted it is that me bf happens to have the same name =)
    (He’s from the .cz republic, too.)

  5. Paul says:

    “You misspeeled Michal’s name!”…”mespotted”
    …bizarre…

    I wonder if someday we could persuade Microsoft to make another source donation to the Computer History Mueseum. A lot of early OS code and associated tools would be fascinating insight into that period, and help dramatically with digital archeologists.

  6. zeurkous says:

    Now *you* mispeeled ‘Museum’!

    Seriously, though, when it’s intentional, it ain’t a tyop.

  7. ths says:

    As a longtime subscriber to the OS/2 developer program I remember a really great editor available for Dos and OS/2 called “T”. It was only 10 KB in size (plus an external help file for keys) and could easily fit on each of my boot and emergency disks. The OS/2 version was called “T2” but I always renamed it to “T” for simplicity.
    It was a bit similar to vi in that it had a “command” and “edit” mode and a mode-switching keystroke; it had a visible command line all time and some very useful features. Obviously it was written by people who had the same requirements as I 😉
    With an external configuration program it was possible to change every key’s function and patch the executable.
    Of course I also loved “EPM” for programming cmd and Rexx but I switched to emacs for programming in C since it integrated emx+gcc and the gdb debugger quite nicely.

  8. Michal Necasek says:

    T think T/T2 was closely related to E.EXE shipped with PC DOS 6.x/7.0 and also TEDIT (OS/2 Warp and later). These editors were all related to something internally used at IBM, much like the folks at Microsoft used the Z editor and its offshoots.

    Personal Editor PE32/PE64 mentioned in the first article is yet another relative of the IBM editor.

  9. Michal Necasek says:

    With OS/2 there’s an obvious legal problem — Microsoft wasn’t the sole owner of the OS/2 source code (neither was IBM). I don’t think either company can publish the source code without the other agreeing to it as well.

    But yes, it’s not like the source code for OS/2 1.0 has any real commercial value nowadays. Publishing the source code would be great.

  10. Fernando says:

    Now Tenox will require a NT kernel mode editor like the clock that I remeber he do. ;-).
    The executable of the editor that came with Windows NT pre-release CD-ROMs would run in any modern Windows?.

  11. zeurkous says:

    Honestly, medoesn’t think tenox and me are the only people who would
    prefer to have the option of not running windoze even when running NT.

    In fact, NT having windoze plastered all over it made me finally switch
    permanently to UNIX-like stuff, many moons ago.

  12. tenox says:

    Yeah this is on my TODO. Instead of doing it in kernel mode I’m thinking of writing an ANSI/vt100 driver for the console that would allow user mode NtDisplayString() to manipulate cursor position and other states. This way you could easily port some apps to run on the blue screen.

  13. tenox says:

    Unfortunately the editor from pre-release cdrom does not run on modern Windows. However the editor from NT SDK does, you can try it. https://github.com/tenox7/ntutils/raw/master/mep/MEP-x86.EXE

  14. zeurkous says:

    Yeah, writing a terminal emulator would appear to be a good first step.

  15. Bob Nelson says:

    T/T2 definitely followed in the path of a whole series of similar editors inside (and some outside) IBM. PE/PE2 were the originals as I remember and released as part of IBM’s Personally Developed Software program where IBM sold programs written by employees. If the software was developed on personal time then the employee got royalties. I don’t know how much in common the source code was but the operation and default key bindings were very similar among all of them. There were also editors called E/E2 that were used internally, and T was referred to as Tiny Editor. VE/VE95 were windowed versions of the editor as well. My understanding was that Slickedit was descended from the same line of editors when one of the author(s) left IBM to start that company. The same key bindings are not the default but available as an option last I checked.

  16. Yuhong Bao says:

    @tenox: I wonder with the CSRSS, win32k, etc source can a Win32 console be created?

  17. So why didn’t Microsoft package their command-line editor with the released NT versions?

  18. JP Fulks says:

    It’s nice to see I’m not the only one who still keeps a copy of MEP on my PC machines as a part of my regular utilities. I still have all the helpfile dll files and .hlp files to go with it, which come in handy.

    The fact that it’s so fast to load and supports macros makes it a great utility, even today.

  19. Paul Turney says:

    Hi,

    I came across the z-x64 editor and have been using it under windows 10. However I would like to report one issue I have found with it, as downloaded from this site:

    When using alt-a, setfile(F2), filename.x to switch to a new file the editor momentarily hangs and exits. I need to put c: ahead of filename.x for it to successfully open the file in the current C drive working directory.

    Example:
    alt-a,F2,filename.c FAILS
    alt-a,F2,c:filename.c WORKS

    Leaving the file extension (.c in the above cases) out in order to access a recently opened file works just fine without the root directory prefix being needed.

    Not a fatal problem, but it will result in data loss when switching files, as the original m editor would save the current file upon doing a switch whereas when the error occurs z-x64 does not. The issue affects operation when accessed directly from Windows 10 or via a DOS command shell. The Windows 7 version z-x84 seems fine.

    Also, I have played around with tools.ini and the help files and the environment but they appear to be not being found by the app. I have tried variations on the names but to no avail. Any thoughts?

    Thank You!

  20. Todd Warren says:

    It was great to find this article! I was actually the Program Manager for “M” back in the day. The Editor was written by Mark Zbikowski–who also led the creation of the DOS 2.0 filesystem and made many important contributions to Microsoft File systems through the years (you might know that each .EXE in DOS begins with “MZ”. Z was originally written by “Zibo” when he was a student at Yale. We decided we needed with our professional compilers to include a real programmer’s editor; and since Z was floating around internally; we used it as the base–it became the editor underlying the Programmer’s Workbench in C 6.0 where we layered on a menuing and build system. I realized because of the linage; I had only one other choice than Z as the name; and that was—M!

  21. Michal Necasek says:

    Thanks for the explanation of the ‘M’ editor name, that makes perfect sense 🙂

    I believe the ‘MZ’ EXE signature goes back to Mark Zbikowski’s days of working on the Microsoft linker, probably circa 1980. I’m also pretty sure the original variant was ‘ZM’ (DOS recognizes both).

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.