Assignment #4

Clarifications, updated 28/5/00

The DTE sends whole packets to the DCE. Thus when only the RTS is reset (set to 0) the DCE waits to receive the whole packet and only then acknowledges with resetting the CTS.
If the DTR is reset as well before the whole packet has been received, this means that the DTE wants to terminate communication immediately, even in the middle of a packet.

Write a program that simulates the Modem Communication Protocol (by sending a file) between a DTE (processor) to a DCE (modem). The sender will be the DTE and the receiver the DCE. The program will be called dte2dce and receives from the user the following command line parameters:

  1. Mode (dte or dce).
  2. The COM (COM1, COM2, COM3 or COM4).
  3. Word length (5 - 8).
  4. Number of stop bits (1, 1.5, 2).
  5. Parity (even, odd, or none).
  6. Transfer rate (given the transfer rate you must compute the baud rate).
  7. Name of text file to transfer (dte only).
For example the sender must run his program like this:
C:\>dte2dce dte COM1 8 1 odd 1200 ex4.c
The receiver must run his program like this:
C:\>dte2dce dce COM1 8 1 odd 1200
The program must get the base address of the COM from the BIOS (address 0x400).



It doesn't matter which side is started first, the DCE must wait for the DTE and vice-versa. Thus when a program exits it must make sure that all the control lines are reset.