
Below is description how you can debug DOS executable (16 and 32-bit) from Windows.
You need some virtual serial port emulation software.
Example is for free Open Source software "com0com".

Install com0com software and configure it if necessary.
You can use default setup for COM3/COM4
In this example COM3 is used by DOSBOX and COM4 is used by OW Debugger, you can change it if necessary.

You need to configure DOSBOX to use appropriate Windows serial port and map it to selected DOS serial port (COM1).
Change DOSBOX configuration file for DOS COM1 serial port as
```
[serial]
serial1=directserial realport:COM3
```
## DOS 32-bit Application debugging

Wire schema for 32-bit DOS application.
```
+---------+ +---------+ +---+ +-----------+ +---+ +--------+ +----------+ +---------+   +---------+
| WDW.EXE | | SER.TRP | | C | |           | | C | |        | | SERSERV  | | RSI.TRP |   | APP.EXE |
|        / /          | | O | | nullmodem | | O | | DOSBOX | | .EXE    / /          |   |         |
|        \ \          | | M | |           | | M | |        | |         \ \          |   |         |
|         | |         | | 4 | |           | | 3 | | COM1   | | COM1     | |         |   |         |
+---------+ +---------+ +---+ +-----------+ +---+ +--------+ +----------+ +---------+   +---------+
|                     | |                       | |                                               |
+---- Windows host ---+ +------ com0com --------+ +--------------- DOSBOX target -----------------+
```
Before start debugging for DOS 32-bit application you need copy following files to target DOSBOX to 
existing directory or create new one. This directory will be used for debugging that any other files
required by application must be copied there.
- DOS4GW.EXE (from OW BINW subdirectory)
- SERSERV.EXE (from OW BINW subdirectory)
- RSI.TRP (from OW BINW subdirectory)
- RSIHELP.EXP (from OW BINW subdirectory)

On DOSBOX you need to run following command to start remote debug server.
```
SERSERV /trap=rsi
```
On host Windows system you must start OW Debugger by command
```
wdw -trap=ser;4 /download "application executable name"
```
It ensures automatic download of application executable from host to remote system to debugging directory.
If you don't want this automatic download then remove option **`/download`** from this command and you
must copy application executable to remote debugging directory manually.

The description above is used for application using DOS4G or DOS4GW DOS extender.
If you use different DOS extender then all is same only files and parameters is different.
See bellow table with appropriate info for various DOS Extenders supported by Open Watcom.

| Used DOS Extender | Remote trap file | Remote help file | Remote server command | Note | 
| --- | --- | --- | --- | --- |
| DOS4GW or DOS4G | RSI.TRP | RSIHELP.EXP | SERSERV /trap=rsi
| Causeway | CW.TRP | CWHELP.EXE | SERSERV /trap=cw
| Pharlap | PLS.TRP | PLSHELP.EXP | SERSERV /trap=pls


## DOS 16-bit Application debugging

Wire schema for 16-bit DOS application.
```
+---------+ +---------+ +---+ +-----------+ +---+ +--------+ +---------+ +---------+   +---------+
| WDW.EXE | | SER.TRP | | C | |           | | C | |        | | SERSERV | | STD.TRP |   | APP.EXE |
|        / /          | | O | | nullmodem | | O | | DOSBOX | | .EXE   / /          |   |         |
|        \ \          | | M | |           | | M | |        | |        \ \          |   |         |
|         | |         | | 4 | |           | | 3 | | COM1   | | COM1    | |         |   |         |
+---------+ +---------+ +---+ +-----------+ +---+ +--------+ +---------+ +---------+   +---------+
|                     | |                       | |                                              |
+---- Windows host ---+ +------ com0com --------+ +--------------- DOSBOX target ----------------+
```
Before start debugging for DOS 16-bit application you need to copy following files to target DOSBOX to 
existing directory or create new one. This directory will be used for debugging that any other files
required by application must be copied there.
- SERSERV.EXE (from OW BINW subdirectory)
- STD.TRP (from OW BINW subdirectory)

On DOSBOX in your debug directory (where you placed the files mentioned above) you need to run 
the following command to start the remote debug server.
```
SERSERV
```
On host Windows system you must start OW Debugger by command
```
wdw -trap=ser;4 /download "application executable name"
```
It ensures automatic download of application executable from host to remote system to debugging directory.
If you don't want this automatic download then remove option **`/download`** from this command and you
must copy application executable to remote debugging directory manually.
