'********** SWAPCOM.BAS 'Copyright (c) 1994 Ethan Winer 'This code shows how to swap COM1 and COM3. You can also manipulate COM2 and 'COM4 by knowing that their addresses are at &H402 and &H403 (for COM2) and '&H406 and &H407 (for COM4). Do not try to swap COM1 with COM4 or COM2 with 'COM3. You can exchange COM1 and COM3 only, and/or COM2 and COM4 only. DEFINT A-Z 'use all integers for efficiency DEF SEG = 0 'to access the port addresses in low memory Com1Lo = PEEK(&H400) 'read/save COM1's port address Com1Hi = PEEK(&H401 Com3Lo = PEEK(&H404) 'ditto for COM3 Com3Hi = PEEK(&H405) POKE &H400, Com3Lo 'swap the port addresses POKE &H401, Com3Hi POKE &H404, Com1Lo POKE &H405, Com1Hi OPEN "COM1:1200,n,8,1,rs,ds" FOR RANDOM AS #1 'this opens COM3 PRINT #1, "ATDT 1-555-1212" . . CLOSE #1 POKE &H400, Com1Lo 'restore the original port addresses POKE &H401, Com1Hi POKE &H404, Com3Lo POKE &H405, Com3Hi