If you need just raw output both ports are "ready to go" as is. To output a simple square you simply need to output a stream of 1's and 0's, which can be done quite easily in Linux and Win9X/Me using almost any programming language - although I would recommend C and/or ASM.
If you're attempting this from later versions of Windows, you will need to use the COM port control provided by MS or one of several other ones offered both freely and commercially on the net (just google it).
If you need to interface the square wave to a specific circuit, you'll need to supply more details. Generally speaking, you could use Maxim's MAX232 IC and optic-couplers to interface to the ports electrically and safely.
Hope this helps!
Avital