Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Fun with vDOS (Emulation)

posted by Rugxulo(R) Homepage, Usono, 07.01.2015, 21:30

> And I've encountered a weird vDOS quirk.
> One of the DOS apps I still have and use on occasion is an editor called G,
> by Jeremy Hall in the UK, dating from 1995.

Yes, I've seen it before but only tried it once or twice. Despite lacking some (irrelevant) features, I still stick to TDE.

> It uses the WordStar command set, and has an interesting design
> where it can be used as a full screen editor, or used as a filter
> in a pipe.

You mean like "uname -a | vile" or "echo hello | tde"?

> G is portable, with C source available, and Hall mentions it working on
> Solaris. The only executable I've found is a DOS version.

Back in 1995, Linux wasn't even using ELF yet! Plus presumably they were stuck with GCC 2.7.2 (or even older like 2.6.3). DJGPP 2.0 wasn't finalized yet either, nor was Quake. GCC didn't even get 586 support until 1998.

I only mention that because you mention (below) about failing to compile on Linux, which shows similar (two) errors here (Lucid Puppy circa 2010, GCC 4.4.3). The source says he tested on "Linux 1.2.8" [sic].

> I like an 80 column screen with 50 lines, so my vDOS config.txt file has
> COLS = 80 and LINS = 50. I installed the FreeDOS mode command, and it
> reports I have an 80 column, 50 line screen in mode 3.
> G invokes as though the screen was 25 lines regardless of what I do, so I
> get a 50 line screen where the top 25 lines are G and the rest is unused.
> There's no place in G to set the screen size - it relies on what the OS
> tells it. It works as desired in an NTVDM window under WinXP, and uses the
> full defined 50 lines of the screen. I doesn't work under vDOS, and I
> haven't been able to get it to work as desired in DOSBOX either.

So ... just use NTVDM? Don't use DOSBox or vDOS? Just use real FreeDOS (native or under VirtualBox or QEMU)? :-P

> This is hardly a pressing issue, and if it doesn't work, it doesn't work,
> but I'd love to know what's going on and why it's failing in vDOS.

It's failing because vDOS isn't a "real" DOS. Obviously. :-P

BTW, it seems to work fine for me under DOSEMU + FreeDOS.

> G for DOS is here
> and C source is here
> if someone else
> wants to poke at it. The G manual is online here
> I took a quick try at building the C source under Linux and failed. Have
> to take a shot under Windows and see what happens.)

There's only three files: README, G.C, and (optional) CRT0.ASM , so (famous last words) it shouldn't be that hard to recompile.

Problem #1: G471SRC.ZIP is using an old compression method ("Implode"), although Info-Zip still supports it. More crucial is the fact that he probably used PKZIP, which (at least DOS version) always capitalizes the filenames (bad!). So "G.C" [sic] is the source, which GCC thinks is C++ !! (Actually, you have to first not use "-m486" because that was removed a while ago, 4.3.0, IIRC.)

(Wed Jan 07, 02:17 PM) /tmp/doydoy/g # gcc -O2 -m486 -s G.C -o g -lncurses -w
cc1plus: error: unrecognized command line option "-m486"
(Wed Jan 07, 02:17 PM) /tmp/doydoy/g # gcc -O2 -s G.C -o g -lncurses -w 2>&1 | wc
    151    1347   10401
(Wed Jan 07, 02:17 PM) /tmp/doydoy/g # gcc -O2 -s -x c G.C -o g -lncurses -w   
G.C: In function 'Disk_to_mem':
G.C:4030: error: 'caddr_t' undeclared (first use in this function)
G.C:4030: error: (Each undeclared identifier is reported only once
G.C:4030: error: for each function it appears in.)
G.C:4030: error: expected ';' before 'f_p'
G.C:4072: error: 'f_p' undeclared (first use in this function)

So you can either "unzip -L" first or manually rename or just add "-x c" to tell it to use plain C89. I also added "-w" (no warnings) to shut up some irrelevant stuff. The problem seems to be exclusively inside the "Disk_to_mem()" function (lines 4019-93).

BTW, I'm not *nix savvy at all (in case that wasn't obvious). So I have no clue what "caddr_t" is or how to use "mmap()" correctly. I did hack at it to compile, and it seemed to work okay, but I might've done it wrong. It's a bit weird to read because of the various #ifdef stuff in there (DOS, UNIX). Honestly, I would email somebody who knows this stuff, probably Ncurses maintainer (Thomas Dickey), to see what is going on. Though keep in mind he'll probably just tell you to use VILE instead (which does helpfully hop around #ifdef with '%' key).

So I'm assuming he used mmap() for speed. I'm also assuming that the DOS version is a fallback of a simpler way of doing things. So I assume that will still work on Linux. So, inside Disk_to_mem(), I changed "#if DOS" to "#if 1" and "#if UNIX" to "#if 0". Then the only problem is that O_BINARY is undeclared, but they don't need or use that on *nix, so comment that out.

Then, it compiles okay for me. "echo $LINES" under ROXTerm here says "34" (although I don't remember how, when, why, or if I set that manually). So that's more than 25, right? So my limited testing should be acceptable here. Okay, it runs, everything is green on black, and typing "4030" jumps to that line. Down arrow brings me to the main text, and it seems to show lines 4030 through 4060. So I guess it works.

Patch follows (but beware, you need hard tabs in the makefile).

diff -waNBU0 old/G.C new/G.C
--- old/G.C     2015-01-07 14:21:32.000000000 -0600
+++ new/G.C     2015-01-07 14:23:25.000000000 -0600
@@ -4023 +4023 @@
-#if DOS
+#if 1 //DOS
@@ -4028 +4028 @@
-#if UNIX
+#if 0 //UNIX
@@ -4043,2 +4043,2 @@
-#if DOS
-    setmode( fd, O_BINARY );
+#if 1 //DOS
+    //setmode( fd, O_BINARY );
@@ -4070 +4070 @@
-#if UNIX
+#if 0 //UNIX
diff -waNBU0 old/GNUmakefile new/GNUmakefile
--- old/GNUmakefile     1969-12-31 18:00:00.000000000 -0600
+++ new/GNUmakefile     2015-01-07 14:24:33.000000000 -0600
@@ -0,0 +1,7 @@
+CC     = gcc
+CFLAGS = -O2 -s -lncurses -w -x c
+g: G.C
+       $(CC) $(CFLAGS) $< -o $@
+       ls -l $@
+       ldd $@


Complete thread:

Back to the forum
Board view  Mix view
15317 Postings in 1383 Threads, 254 registered users, 21 users online (0 registered, 21 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum