'=========================================================================== ' Subject: SWAP COM PORTS Date: 11-15-96 (15:30) ' Author: Joseph L. Clark Code: QB, QBasic, PDS ' Origin: FidoNet QUIK_BAS Echo Packet: MODEM.ABC '=========================================================================== '> program, and also, how to re-assign the com ports so I can use com1 as '> com3 and com2 as com4. 'I've got the COM swapping bit (well the one i've got!): ' ' SWAPCOM.BAS - Swaps com ports and resets to normal ' ' Author: Joseph L. Clark ' '---------------------------------------------------------------------- DECLARE SUB SwapComPorts (port1, port2) DECLARE SUB ResetComPorts () DECLARE SUB ShowPorts () CLS ResetComPorts ShowPorts SwapComPorts 1, 3 ' Only swap 1 and 3 OR 2 and 4 ' Make sure the lower number is first! ShowPorts ResetComPorts ShowPorts END SUB ResetComPorts ' This routine resets all the base addresses of COM1-COM4 DEF SEG = 0 FOR port = 1 to 4 byte = &H400 + (port - 1) * 2 IF port MOD 2 = 0 THEN p2 = &H2 ELSE p2 = &H3 IF port < 3 THEN p1 = &HF8 ELSE p1 = &HE8 POKE byte, p1 POKE byte + 1, p2 NEXT port DEF SEG END SUB SUB ShowPorts ' This routine shows the base addresses of COM1-COM4 DEF SEG = 0 FOR port = 1 to 4 byte = &H400 + (port - 1) * 2 PRINT HEX$(PEEK(byte + 1)); PRINT HEX$(PEEK(byte)) NEXT port PRINT DEF SEG END SUB SUB SwapComPorts (port1, port2) ' Please note: this doesn't actually swap the com ports, it just ' places the base address of port2 into port1. DEF SEG = 0 port = port2 byte = &H400 + (port - 1) * 2 p1 = PEEK(byte) p2 = PEEK(byte + 1) port = port1 byte = &H400 + (port - 1) * 2 POKE byte, p1 POKE byte + 1, p2 DEF SEG END SUB