In this section:
A common problem encountered while developing Windows applications is that temporary debugging output tends to interfere with the appearance of the application. Although ClearWin+ connects the standard output to a large window for debugging purposes, this can be less than satisfactory because the debug window may obscure part of the program under development. A very effective alternative is to connect the RS232 port to an old fashioned 'dumb' terminal (these can be obtained second hand very cheaply) or to a cheap PC (an AT or XT will do - anything with an RS232 port). If you use a PC you will need to execute a command on the PC to read the RS232 port to the screen (e.g. TYPE COM2). Output can be sent to the RS232 terminal even in the most sensitive parts of a Windows program, such as while the program is responding to the WM_PAINT message (e.g. while a %eb box is requesting re-colouring).
You can use any COM port, but typically COM1 is connected to the mouse and COM2 is free, so we will assume you are using COM2 in what follows. To write to the COM2 port simply open the file COM2 and write to it - these names are reserved by Windows and do not correspond to ordinary file names. It is important to ensure that the COM port has been set up with the same baud rate as the terminal. Typically you should include a suitable MODE command in the autoexec.bat file (e.g. MODE COM2:9600,n,8,1). If in doubt as to whether the link is working, try piping a command from a DOS box to the port, e.g. DIR > COM2.
Great care should be taken to remove all debugging output to RS232 ports before shipping an application. Failure to do this may cause interference with modems or other devices attached to your user's PC.
The following routines are used to send output to an auxiliary terminal:
SUBROUTINE RS232_PRINT_HEX@(MESSAGE, VALUE)
SUBROUTINE RS232_PRINT_DEC@(MESSAGE, VALUE)
The following routines do not produce a new line:
PORT is the COM port number which defaults to the value 2 (i.e. COM2). The string MESSAGE is used to identify the integer VALUE when it is displayed on the terminal.