5 ms·
Maybe, with a little tweaking, Ant's Editor from IOCCC 1991, the one that says "#define T isspace(*(t=Z(p)))&&". It's a passable vi clone in C using a gap buff
by kragen 7y ago
Maybe, with a little tweaking, Ant's Editor from IOCCC 1991, the one that says "#define T isspace(*(t=Z(p)))&&". It's a passable vi clone in C using a gap buffer, and it compiles to 7K of amd64 machine code, and somewhere the author has posted the non-obfuscated version. Nominally it depends on curses, but I suspect you could get it to work with implementations of move(), addch(), clrtobot(), clear(), and mvaddstr() that just emit some escape sequences, a getch() that just makes a BIOS call, and null implementations of initscr(), endwin(), raw(), noecho(), and idlok().
IOCCC '91 was before the IOCCC switched to open-source licensing, though, so you might have to somehowe find Anthony Howe and get him to relicense. Or maybe he already did.
I don't know, maybe I should just write one. Is there a reasonable emulator for the Amstrad?
Why are you using ZCPR1 instead of ZCPR2?
- david-given 7y agoI haven't seen ae. I'll take a look. Fuzix has some decent software, too, including a stub curses, which may be useful. Thanks! Re ZCPR2: licensing. It's got a no-commercial-use license encumbrance which ZCPR1 doesn't have.
- kragen 7y agoOh thanks! I didn't realize that about ZCPR2 (and, I suppose, ZCPR3). Are all of its authors still alive? Maybe they'd be willing to relicense. Have you been able to find ae? I can dig around and probably find a non-obfuscated version if the trail is going cold. Still interested in the Amstrad emulator question. If I'm going to hack together a CP/Mish text editor I'd like to be able to test it on (an emulation of) more than one target platform. (While we're talking about Z80 stuff: the embedded Z80 microcontrollers I've found on Digi-Key are absurdly power-hungry. Is there a Z80-compatible out there in the ¼-nJ-per-instruction neighborhood of the STM32L0, or at least the 10-nJ-per-instruction neighborhood of the AVR? Because AFAICT there's really no reasonable self-hosted development environment for the AVR, much less for an ARM with tens of kilobytes of RAM, while the Z80 has not ony self-hosted batch-mode toolchains but even IDEs. The first time I saw Turbo Pascal running was on a Kaypro II.)
- david-given 7y agoI found ae; later versions build but they're kinda big (45kB, yikes), and while the unobfuscated early version is amazingly simple it handles redraw by refreshing the entire screen on each keypress. If you've got curses that's easy, and quick, but if you don't have curses, hrm. CP/M terminal emulators are frequently painfully slow and you want to minimise screen refreshes. Right now I'm wondering about writing my own in another livecoding session; that original ae is a masterpiece of simplicity. The trickiest part would be handling screen updates... https://groups.google.com/forum/#!topic/comp.editors/335qpDFPuE0 https://groups.google.com/forum/#!topic/comp.editors/335qpDF... Re Amstrad emulators: I haven't played much with these, but I'd probably suggest Joyce: https://www.seasip.info/Unix/Joyce/ https://www.seasip.info/Unix/Joyce/ That said, I've been running the Kaypro cpmish port using MESS, and it's surprisingly solid. There's even a good debugger. So it might be worth giving that a try. Re microcontrollers: there are very, very few Von Neumann architecture microcontrollers, and they're mostly just boring low-end ARMs. The one exception is the MSP430, which is nice but still not a Z80. I think the eZ80 is all there is.
- kragen 7y agoThank you! Yeah, 45K is pretty huge, and redraw logic was pretty commonly the most complex part of editors of that time period. The version you linked compiles for me to 2316 bytes of amd64 machine code (in .text) with cc -Dindex=index_ptr -DBUF=4096 -DMODE=0666 -Os ae.c -o ae -lncurses, but of course then it's linked with ncurses. Ah, and it looks like Howe did dedicate it to the public domain! That's nice. I didn't remember that it refreshed the screen on each keypress. The terminals we used on actual CP/M machines were usually pretty snappy, faster than terminal emulators are, at least if you don't count the slow phosphors. But typically they were only 9600 baud, so redrawing the whole screen would take two seconds; escape sequences like the insert-line/delete-line pair supported by the H19 and the VT100 were really important. Contemporary machines like the Apple with its memory-mapped screen buffer avoided the whole terminal catastrophe. I did see your notes on the site on Kaypro emulation with MESS. Thanks!