przemek@rrdstrad.nist.gov (Przemek Klosowski) (05/31/91)
Hello! I apologize if this is very easy---but how does one prevent Ctrl-P key from always trying to send something to the printer? I use C-P often under Emacs editor, and I sometimes instinctively type it in MSDOS when I want to correct a typo I did. Since some of my computers do not have a printer attached, it hangs the poor thing. I looked for a program to disable it on the usual archives, to no avail. Any ideas? I see two avenues: 1) disable something in the software 2) short some pins in the parallel connector, to fool it into believing that printer did print the stuff I can't believe that there is no simple way to prevent what is equivalent to prompt system hangup after one keystroke. przemek -- przemek klosowski (przemek@ndcvx.cc.nd.edu) Physics Department University of Notre Dame IN 46556
dlcogswe@vela.acs.oakland.edu (Dan Cogswell) (05/31/91)
przemek@rrdstrad.nist.gov (Przemek Klosowski) writes: >Hello! >I apologize if this is very easy---but how does one prevent Ctrl-P key from >always trying to send something to the printer? I use C-P often under Emacs I wanna know how to do this, too! I'm using 4DOS and remapped the keys to act as Emacs keys, but ctrl-P always prints instead to feeding an up-arrow as in Emacs. How can I disable the ctrl-P? > przemek klosowski (przemek@ndcvx.cc.nd.edu) -- Dan Cogswell dlcogswe@vela.acs.oakland.edu
dj@ctron.com (DJ Delorie) (05/31/91)
In article <6642@vela.acs.oakland.edu>, dlcogswe@vela.acs.oakland.edu (Dan Cogswell) writes: > przemek@rrdstrad.nist.gov (Przemek Klosowski) writes: > >I apologize if this is very easy---but how does one prevent Ctrl-P key from > >always trying to send something to the printer? I use C-P often under Emacs > > I wanna know how to do this, too! I'm using 4DOS and remapped the keys > to act as Emacs keys, but ctrl-P always prints instead to feeding an > up-arrow as in Emacs. How can I disable the ctrl-P? It can be done - I've done it. It's ugly, though. How it works: (don't blame me if your system gets toasted, though!) In msdos.sys, there's a spot where it watches for the ^P. It only does this if stdout is in "cooked" mode, so theoretically putting stdout in "raw" mode will disable it. However, you can't control what other applications do. SO, what you do is find the spot where msdos.sys checks for the ^P, and GET RID OF IT. Notes: 1. You have to look for the CMP AL,10 instruction that's followed by a conditional jump. I found two places that this happens in my version, and only one (trial & error) was the ^P check. 2. You have to edit MSDOS.SYS *in place*. You can't copy & rename the file, as it's special. I used Norton's Utilities to patch it, plus I have a patch program that patches it in place. 3. The safest way to patch is to replace "JZ" with "NOP NOP", or replace "JNZ" with "JMP". DJ dj@ctron.com
gintera@cpsc.ucalgary.ca (Andrew Ginter) (05/31/91)
I had the same problem and solved it by using the "mode" command to redirect printer output to one of the COM ports. I believe I have it reconnected to COM1:, which has a modem always attached and always powered up. I don't know if that makes a difference as to whether or not the trick works. When I'm using a terminal emulator, ^P is caught by the emulator and is sent down the line as usual. When I'm not using an emulator, the modem doesn't seem to mind getting the odd screenful tossed at it. Andrew Ginter, 403-220-6320, gintera@cpsc.ucalgary.ca
chris@rbdc (Chris Woodward) (06/05/91)
przemek@rrdstrad.nist.gov (Przemek Klosowski) writes: >Hello! >I apologize if this is very easy---but how does one prevent Ctrl-P key from >always trying to send something to the printer? I use C-P often under Emacs >editor, and I sometimes instinctively type it in MSDOS when I want >to correct a typo I did. Since some of my computers do not have a printer >attached, it hangs the poor thing. I looked for a program to disable it on >the usual archives, to no avail. Any ideas? I see two avenues: > 1) disable something in the software > 2) short some pins in the parallel connector, to fool it into believing > that printer did print the stuff >I can't believe that there is no simple way to prevent what is equivalent to >prompt system hangup after one keystroke. > przemek Well, it can be done using the prompt command under dos, if you are using ansi.sys... just do a prompt $e[16;0;72p at the command line, then do a prompt $p$g (or whatever) to restore your prompt and now Ctrl-P is remapped to be an up arrow! hope this helps. -chris -- Chris Woodward Internet: woodward@esv.bgsm.wfu.edu UUCP: ...!gatech!kd4nc!rbdc!chris
neil@philmtl.philips.ca (Neil Pitman) (06/11/91)
In article <PRZEMEK.91May30155306@rrdstrad.nist.gov> przemek@rrdstrad.nist.gov (Przemek Klosowski) writes: >Hello! > >I apologize if this is very easy---but how does one prevent Ctrl-P key from >always trying to send something to the printer? I use C-P often under Emacs >editor, and I sometimes instinctively type it in MSDOS when I want >to correct a typo I did. Since some of my computers do not have a printer >attached, it hangs the poor thing. I looked for a program to disable it on >the usual archives, to no avail. Any ideas? I see two avenues: > 1) disable something in the software What you can try is to delete the printer port address in the BIOS data area. This will cause all primitive print requests to return with an error immediately. Normally the ^P will still echo commands to the PRN: but, because it does not exist, it takes no time. (well very little) To delete you will need a small programme, so type the following commands: DEBUG<- N LPT-DEL.COM<- ; future name A 100<- MOV AX,40<- ; point to BIOS DATA AREA segment MOV DS,AX<- XOR AX,AX<- MOV [8],AX<- ; delete LPT1 MOV [A],AX<- ; delete LPT2 MOV [C],AX<- ; delete LPT3 MOV AH,4C<- INT 21<- ; return to DOS <- R CX<- 100<- ; set size of programme -- 100H is plenty W<- ; write programme Q<- ; back to DOS ("<-" = Carriage Return.) (comments after "<-" are for your edification (not DEBUG's)) Now run the programme LPT-DEL.COM in your AUTOEXEC.BAT to rid yourself of your printer ports. Bonne chance, Neil Pitman