home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!waikato.ac.nz!canterbury.ac.nz!phys169
- Newsgroups: comp.os.msdos.misc
- Subject: Re: lptswap
- Message-ID: <1992Sep4.101658.643@csc.canterbury.ac.nz>
- From: phys169@csc.canterbury.ac.nz
- Date: 4 Sep 92 10:16:58 +1200
- References: <hippo.21.0@sonoma.edu>
- Organization: University of Canterbury, Christchurch, New Zealand
- Lines: 49
-
- In article <hippo.21.0@sonoma.edu>, hippo@sonoma.edu (Michel Davidoff) writes:
- > I just found a program called Lptswap.com at ux1.cso.uiuc.edu (128.174.5.59)
- > I think this will swap lptX to lptY
- > Where can I get some docs about this, or does anybody know how it works ?
- > I'm trying to swap LPT2 with LPT3
-
- I don't know about that particular one, but I have seen a couple of others,
- including this one, swaplpt, for which I have the assembler source...
-
- title SwapLpt ; output to lpt1 now goes to lpt2 & vica versa
- Code segment
- assume cs:code
- org 100h ; allow .COM
- prog: mov ax,40h
- mov ds,ax
- mov ax,ds:[08h] ; 40:08h contains IO port for LPT1
- xchg ax,ds:[0Ah] ; 40:0Ah contains IO port for LPT2
- xchg ax,ds:[08h]
- mov ah,4Ch
- int 21h
- code ends
- end prog
-
-
- The idea is simply to exchange elements in the 4-word array in low memory that
- says what the IO port of LPT1, LPT2 and maybe LPT3 & LPT4 is. Most software
- takes notice of this, including BIOS print routines (and so all printing that
- goes via DOS files, which is a lot but not all of the PC's printing).
-
- If you only have 2 printers, a similar program, swapping LPT2 with LPT3 would
- fail because the BIOS routines could first decide there is no 3rd printer from
- the (separate) count of printers, before it reads the port address and checks
- it for zero (the other way software can tell). Well, that *might* be what is
- happenning, but there can be other reasons. Some software has the port address
- of the printer hard-coded, which is a Bad Thing, since they change depending on
- whether you have a mono video adapter (with built-in printer port). Another
- thing is that some versions of DOS might not set up the LPT3 device driver
- properly if that device does not seem to exist at start-up.
-
- Of course, there are other ways of changing the printer, at "higher" levels
- (affecting less software, but being less hardware-specific), such as closing
- the standard printer handle and re-openning it (you wouldn't believe how little
- software uses the standard printer handle, though!).
-
- By the way, if you swap LPT4, take care that this hardly ever points to a
- physical printer port, but the word is often used for other things on PS/2
- computers, etc.
-
- Mark Aitchison, University of Canterbury, New Zealand.
-