🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #633

Ctrl/Prtsc Fix - TSR to disable printer timeout

#633
From: Ya-Gui Wei
Date: Thu, 09 Apr 1992 06:16
108 lines
3041 bytes
Following is a little TSR  I promised that will eliminate annoying
error messages and time-out delays for Ctrl/P and other printing keys.

By adding a small buffer and move the second half of the resident
code to inside a timer interrupt, you'd have a print spooler. (A
print spooler would probably return a busy code when the buffer is
full though, instead of always saying "all's well".)

 Ya-Gui Wei /IU

------cut here--------
;
;	NOPRTERR.COM  -  simple TSR for dealing with Ctrl/P and
;			 printer time-out problems
;
;	Author:  Ya-Gui Wei
;		 PO Box 2231, Bloomington, IN 47402
;		 (812) 857-4772
;	   I can make your PC do really neat tricks.
;
;	This program eliminates the "Abort Retry Fail?" messages
;	during printing, along with the ever-lasting time-out, when
;	the printer is not on or is out of paper. Normal printing
;	(including Ctrl-P/Prtsc printing) is still allowed if the 
;	printer is on.
;
;	CAUTION: printer output will be discarded if the printer is
;	not ready. This normally should not be a problem - you can 
;	simply turn on the printer and then send the output again.
;
;	(c) Copyrighted material. Before using this program on any
;	commercial establishments, you should either (1) obtain
;       a license from me; or (2) offer me a really nice job. :-)
;
;	A little commercial: to boot your PC from drive B: (what
;	the hell is that for?) :-), send $20 to above ddress. Ask
; 	for B:Boot (hard disk version now available).
;

CODE	SEGMENT
	assume	cs:code, ds:code
	org	100h

START:	jmp	short setup

old_int17   dd ?

resident_code:
	assume	ds:nothing

	cmp	ah, 2		;status query?
	jnz	cont
	mov	ah, 90h		;say printer is ready
	iret

cont:	push	ax
	push	cx
	or	ah, ah		;write char?
	jnz	pass_through

	sti
	mov	cx, 0FFFFh      ;loop for printer sharing devices
ploop:	mov	ah, 2		;test printer status first
	pushf
	call	old_int17
	test	ah, 28h		;no paper or i/o error?
	jnz	return_to_caller
	test    ah, 80h	        ;not busy?
	jnz	pass_through
	loop	ploop		;retry if busy
	mov	ah, 01h		;timed out

return_to_caller:
	pop	cx
	add	sp, +2
	mov	ah, 10h		;return "all's well" code
	iret

pass_through:
	pop	cx
	pop	ax
	jmp	old_int17

end_of_resident_code:

copyright_message db "(c) Copyright Ya-Gui Wei 1992. All Rights Reserved."
	        db 0ah, 0dh, 24h

setup:	
	assume	ds:code
        lea     dx, copyright_message
	mov     ah, 9
	int     21h

	mov	ax, 3517h
	int	21h
	mov	word ptr old_int17, bx
	mov	word ptr old_int17[2], es

	lea	dx, resident_code
	mov	ax, 2517h
	int	21h

	lea	dx, end_of_resident_code
	int	27h

CODE ENDS
     END START
Technical Details
Message-ID: <1992Apr9.061613.8961@bronze.ucs.indiana.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!bronze!yawei

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer,comp.sys.ibm.pc
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!bronze!yawei
From: yawei@bronze.ucs.indiana.edu (Ya-Gui Wei)
Subject: Ctrl/Prtsc Fix - TSR to disable printer timeout
Message-ID: <1992Apr9.061613.8961@bronze.ucs.indiana.edu>
Organization: Indiana University
Date: Thu, 9 Apr 92 06:16:13 GMT
Lines: 110