DJGPP

Last modified: Sat Apr 4 17:13:55 EDT 2020

These are DWF's installation notes on DJGPP 2.05, using the "current" packages (supplied zip files) as they appeared on 2020-03-29.

Files

This is a lean installation for building C and C++ software.  For the complete list of prebuilt packages, browse under ftp://ftp.delorie.com/pub/djgpp/current/.  Many "standard" Unix tools and libraries are available.

From ftp://ftp.delorie.com/pub/djgpp/current/v2/:

 2509574 djdev205.zip      base package, djgpp.env, libc
  603760 djtzn205.zip      zoneinfo

From ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/:

 6230009 bnu234b.zip       binutils
56514972 em2602ab.zip      emacs (optional)
35739658 gcc920b.zip       gcc
16094222 gpp920b.zip       g++
  429208 mak43b.zip        make

From ftp://ftp.delorie.com/pub/djgpp/current/v2misc/:

   71339 csdpmi7b.zip      DPMI provider

VM

Full QEMU command line:

qemu-system-i386 -nodefaults -enable-kvm \
  -machine type=pc,accel=kvm -cpu host \
  -display gtk -vga std -soundhw pcspk -net none \
  -rtc base=localtime \
  -m 4G -mem-prealloc -mem-path /hugepages/qemu \
  -drive file=DOSGCC.img,format=raw,if=ide,media=disk,readonly=off,index=0,cache=unsafe \
  -drive file=ramdisk.img,format=raw,if=ide,media=disk,readonly=off,index=1,snapshot=on \
  -boot c

DOS environment

CONFIG.SYS:

DEVICE=C:\LOCAL\DRIVERS\XMGR.SYS
DOS=HIGH

SHELLHIGH=C:\COMMAND.COM C:\ /E:2048 /P
BUFFERSHIGH=30
FILESHIGH=40
STACKSHIGH=9,256
LASTDRIVEHIGH=D
IDLEHALT=1

AUTOEXEC.BAT:

C:\LOCAL\DOSLFN\DOSLFNMS.COM
SET DIRCMD=/LFN /A /P /O
SET PATH=C:\DJGPP\BIN;C:\LOCAL\BIN
SET DJGPP=C:\DJGPP\DJGPP.ENV
SET TZ=:America/New_York
SET TMPDIR=D:

Note 1.  On actual hardware, DOSLFNMS slows things to a crawl unless a disk cache like XHDD is used.  In QEMU, I found no benefit to the DOS cache:  things are slowed to a crawl regardless what you do.

Note 2.  The DJGPP FAQ recommends using an expanded memory manager (EMM) like Jemm386, mainly to improve the management of extended memory:

Memory managers provide an API for allocating extended memory called VCPI (the Virtual Control Program Interface).  Using that API allows CWSDPMI to allocate only as much extended memory as is needed, leaving the rest for non-DJGPP programs, in case you invoke them from DJGPP programs.  In contrast, without a memory manager, CWSDPMI will allocate all of the available extended memory to itself, leaving none of it to non-DJGPP programs.  This consideration is especially important if you use some DJGPP program, like Bash or Emacs, as your primary system interface.

The special case of a DJGPP program invoking a non-DJGPP program that uses extended memory can happen as described in the last line, but I found no benefit to using a complicated EMM instead of a simple extended memory manager (XMM) if you are only using DJGPP and friends to build and run Unix software.  There's enough low memory without UMBs.

But if you want, you can add JEMM386 (5.79, 2020-02-02) and SWITCHES in CONFIG.SYS:

; UMBs and EBDA will vary; this configuration is for QEMU.
DEVICE=C:\LOCAL\DRIVERS\XMGR.SYS /B /N24    ; Temporary "boot"
DEVICE=C:\LOCAL\JEMM\JEMM386.EXE NOEMS I=A000-B7FF X=B800-CAFF I=CB00-EAFF X=EB00-FFFF
DEVICEHIGH=C:\LOCAL\DRIVERS\XMGR.SYS
DOS=HIGH,UMB

...
SWITCHES=/E:1024

And load drivers high in AUTOEXEC.BAT:

LH C:\LOCAL\DOSLFN\DOSLFNMS.COM

To get copious amounts of low memory:

Memory Type         Total      Used       Free
----------------  --------   --------   --------
Conventional          736K        12K       724K
Upper                 128K        22K       106K
Reserved              160K       160K         0K
Extended (XMS)   3,144,576K       546K 3,144,030K
----------------  --------   --------   --------
Total memory     3,145,600K       740K 3,144,860K

Total under 1 MB      864K        34K       830K

Largest executable program size       724K (741,328 bytes)
Largest free upper memory block        69K ( 70,496 bytes)
Available space in High Memory Area     8K (  8,055 bytes)

Compiler installation

Mount the C: drive from Linux:

mount -t vfat -o uid=1000,gid=100,shortname=winnt,loop,offset=32256 DOSGCC.img /mnt

Install the EXEs from csdpmi7b.zip in /mnt/LOCAL/BIN.

Install the DJGPP zips in /mnt/DJGPP:

mkdir /mnt/DJGPP; cd /mnt/DJGPP; for f in .../*.zip; do unzip "$f"; done

Move DPMI swap file to scratch drive (optional)

The DPMI provider has a swap file path that is configured by modifying the executable with a special tool.

Test

C:\TMP>gpp -Os -s -o hello.exe hello.cc
C:\TMP>dir
HELLO    CC            120  03-29-20  8:05p hello.cc 
HELLO    EXE       685,056  03-30-20 12:16a hello.exe 
C:\TMP>hello
Good morning, thou cruel world

bash-4.3$ file hello.exe
hello.exe: MS-DOS executable, COFF for MS-DOS, DJGPP go32 DOS extender


KB
Home