home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / msdos / misc / 5037 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  2.7 KB

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