Git Product home page Git Product logo

mrpiggy's Introduction

MR Piggy

An experimental fork of MS Kermit. Cross compiles for MS-DOS on modern GNU/Linux systems using no proprietary software. The executable is 16-bit (8086) and can run on original IBM PC hardware or in an emulator such as dosbox.

Compilation

If you have jwasm and owcc installed (see below), then you can compile a DOS executable of KERMIT.EXE by simply running 'make' on your GNU/Linux box.

Prerequisites

To compile, requires the jwasm assembler and Open Watcom C compiler (owcc).

Jwasm

I used tuxxi's masm-unix which made compiling jwasm on GNU/Linux straight forward.

Cut and paste this into a command line to compile and install jwasm:
    sudo apt install build-essential cmake
    git clone http://github.com/tuxxi/masm-unix
    cd masm_unix/src/JWasm
    cmake .  &&  make  &&  sudo cp -p jwasm /usr/local/bin/

Open Watcom C Compiler

Install

The Open Watcom v2 source code is overly large to download and git times out, so I had to install a prebuilt copy.

Cut and paste these commands to install the Open Watcom v2 C compiler:
cd
mkdir ow2
cd ow2
R=https://github.com/open-watcom/open-watcom-v2/releases
wget -O ow2.zip "$R"/download/Current-build/open-watcom-2_0-c-linux-x64
unzip ow2.zip
rm -r ow2.zip binnt binp binw rdos rh 
mv binl64 bin
cd bin
chmod +x $(file * | grep ELF | cut -f1 -d:)
mv vi weevil
32-bit binaries

Binaries are in binl instead of binl64; rename it to just bin. If you don't have a binl directory, try changing x64 to x86 in the wget line.

cd
mkdir ow2
cd ow2
R=https://github.com/open-watcom/open-watcom-v2/releases
wget -O ow2.zip "$R"/download/Current-build/open-watcom-2_0-c-linux-x86
unzip ow2.zip
rm -r ow2.zip binnt binp binw rdos rh 
mv binl bin
cd bin
chmod +x $(file * | grep ELF | cut -f1 -d:)
mv vi weevil
About weevil

Note that we've renamed the Watcom editor to weevil because calling it vi on a UNIX system is silly. It is clearly the love-child of Microsoft EDIT and ed plus it's a bit buggy (try Ctrl+C), thus "weevil".

Setup

To use the Watcom C compiler, you'll need to setup the compilation environment like so:

export WATCOM=${HOME}/ow2
export PATH+=:${WATCOM}/bin
export INCLUDE=${WATCOM}/h

You can run that at the command line or add it to the Makefile.

Usage

owcc  -bdos  -mcmodel=s  -o myprog.exe  myprog.c

You can then execute the .exe file in dosbox to test it out.

Todo

  • Get it to compile under GNU/Linux

  • Test the .EXE on an IBM PC

  • Reduce file size so it is more useful on retro-PCs.

  • Simple Methods
    • Look into runtime DOS executable compressors. Do any exist that are Free Software?
      • Surprisingly, Yes!
      • UPX can be installed with apt install upx-ucl.
      • Running upx on KERMIT.EXE cuts the size in half to 152 KB.
      • Noticeably slower start up time in emulation with DOSBOX.
    • Compiler, linker flags.
    • Investigate: why is Open Watcom executable 50 KB larger than the one created by Microsoft tools in 1999. Is it Watcom's standard library?
    • Check how Open Watcom's PACKDATA works.
      • Kermit 3.14 notes state that 40KB was saved by using PACKDATA option of LINK.EXE. That option exists in Open Watcom but produces no savings in file size.
      • ** WARNING! ** I had thought PACKDATA was safe to experiment with, but I realized that since stack checking is disabled, a smaller segment size might cause pointers to wrap around!
      • What is the max size of the data structures in Kermit?
  • Complex Methods
    • Conditional compilation
      • Add "Lite" versions (no NET, no GRAPHICS, neither) to Makefile.
      • What existing subsystems does CHECK command identify?
        • IF: ???
        • Network: How does this differ from TCP?
        • TCP/IP:
        • Graphics: Tek4010 & Sixel
        • Terminal: Terminal emulation. no_terminal implies no_graphics.
        • (nls_portuguese: Missing from check but exists as ifdef.)
      • Identify other large subsystems
        • serial port? script interpreter? H19 and other terms?
        • weird networks like IPX
      • Wrap them in #ifdef, same as Lite.
    • Analyze algorithms and datastructures to trim for size.
    • How large is Kermit's TCP/IP, DHCP, and DNS implementation? Is mTCP smaller?
  • Maybe include the numerous miscellaneous supplementary files that came with the MS Kermit 3.14 distribution.

  • Bundle with FreeDOS as a bootable 360KB disk image.

mrpiggy's People

Contributors

hackerb9 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

infernalheaven

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.