The Smallest Communication Program in the World?

  /     /   80x86     Assembly     DOS     Programming     Retro    

I was going through a backup of my dos machine, taken in 1998, and came across some source code which I haven't seen for a long time. It was great to see that old code, and I must set-up a machine so that I can run some of it again. In particular I came across an attempt at writing the world's smallest communication program for an x86 based PC running DOS. I used to love writing these sort of little programs to test different things. I know we get more done these days, but it was fun tinkering around at such a low-level. So here follows the program.

The Assembly Code

The following code was written, for Borland Turbo Assembler, when I was 17. It maybe that, with experience, I could now write a smaller version, so my boast of 15 years ago may no longer be true!

; This is probably the smallest modem communication program in the world,
; and was written to make a smaller program than Doug Cox's comms program,
; which was claimed to be the smallest.
; Doug Cox's program : 72 bytes
; My program         : 50 bytes
; You use AT commands to control the modem.
; The following functions are also provided:
;       ALT + C    Clear the screen
;       ALT + X    Exit
;   Program name : ljatcom
;   File name	   : ljatcom.asm
;   Author	     : Lawrence Woodman
;   Date         : 11 December 1994
.model small
org 100h

  mov  ax, 3
  int  10h

  mov  dx, 2FDh              ; Line status Register
  in   al, dx
  and  al,1
  jz   check_for_key         ; If nothing from modem
  mov  dx,2F8h               ; Receive/Transmit Date Register
  in   al,dx                 ; Receive it
  mov  ah,0Eh                ; Function to write char on screen
  int  10h
  jmp  short getstatus

  mov  ah, 1                 ; Function to get keyboard status
  int  16h
  jz   getstatus             ; If no keyboard input
  dec  ah                    ; Function to get keyboard char
  int  16h
  cmp  ax,2E00h              ; ALT-C
  je   pregetstatus
  cmp  ax,2D00h              ; ALT-X
  je   exit
  mov  dx,2F8h               ; Receive/Transmit Data Register
  out  dx,al                 ; Send it
  jmp  short getstatus


end pregetstatus


I used Borland Turbo Assembler to assemble this file and produce an executable .COM file:

C:\> tasm ljatcom.asm
C:\> tlink ljatcom /x /tdc

If you don't have this assembler, the source can easily be converted to the format of your favourite assembler.

Using Debug to Create the Executable

For those not able to assemble the above code, I created a script with HEXBUG which can be run through the DOS command, debug, which will create the executable .COM file.

Copy the following script into ljatcom.bug

E100 B8 3 0 CD 10 BA FD 3 EC"$"1"t"A BA F8 3 EC B4 E CD 10 EB EE B4
E118 1 CD 16"t"E8 B4 0 CD 16"="0".t"DA"="0"-t"6 BA F8 3 EE EB D4 C3
Q HEXBUG Version 1.02 by Chad Wagner

Run this script through debug:

C:\> debug < ljatcom.bug

Using the Program

This program is very simple, as you can see, and operates on COM2. It is so small because it relies on your ability to command the modem directly.

To run it just type:

C:\> ljatcom

Commanding a Hayes Compatible Modem

To reset the modem:


To dial a number, where number is the number that you wish to dial:


Operating Once the Connection Has Been Established

Once the number has been dialed, by using the above commands, the modem will establish the connection and you will be linked to the computer on the other end of the modem. Most dial-up systems, however, use a variety of terminal emulations to control how to display things on your screen, so you will have to use a basic plain text protocol.

File Transfer

I once had an old machine on which the 5ΒΌ" drive wasn't working, so I couldn't transfer anything to or from it. I had no other drive with me to replace it, so I connected the machine to another using a null-modem cable. I then entered a slightly altered version of the above program, using debug, into both machines. This allowed me to redirect it's output to a file on one end, and send a serial transfer program to it from the other end. To make this transfer reliable enough, all I had to do was slow the COM port down with the DOS command mode. For these sorts of transfers, if nothing else, the program could still be of some use to those operating older machines.

Creative Commons License
The Smallest Communication Program in the World? by Lawrence Woodman is licensed under a Creative Commons Attribution 4.0 International License.

Related Articles

Adding a Basic Stub to a Vic-20 Assembly Language Program

To make machine language programs more friendly it is nice to add a basic stub which contains a line with a SYS statement to start the code. This is easy to do on the Vic-20 and the process gives you ...   Read More

Creating a TTY Simulator in Assembly Language on the Vic-20

The Vicmon machine language cartridge is an excellent tool for exploring the Vic-20. This article and its associated video will show you how to use it to create a simple program that will change the n...   Read More

Beginning Assembly Programming on the Commodore Vic-20

The Commodore Vic-20 is a great machine to learn an assembly language on. It was released in 1981 and was the first computer to sell one million units, which contributes to its popularity today. The ...   Read More

Writing my First Program to Toggle in to the IMSAI 8080

I have long been fascinated with entering programs into computers by methods not involving a standard keyboard and monitor. This interest was peeked by my last article: Using the latest z80pack, versi...   Read More

Benchmarking Basic on Vintage Computers

There are a few machines I'm quite interested in comparing so I decided to create a simple Basic benchmark to get an idea of their relative speed. The benchmark tests 7 aspects and is inspired by qsbb...   Read More

Sign up to get new articles straight to your inbox.

Delivered by FeedBurner


blog comments powered by Disqus