[net.micro.pc] Changing default printer

jcw@cvl.UUCP (06/25/84)

Here is an assembly language routine for changing the standard
printer device, i.e. the printer written to through using system
call 5.  I wrote it for use with the old version of Computer Innovations'
C compiler, which only supports one printer device, "prn:", which
normally sends to "lpt1:".  The asm function below can change this
to any other device, even a file, by saying something like
"newprn("lpt3:")".  I also have a modified routine, newaux, by just
changing the output mode from 1 to 2 and the device handle from 4
to 3.   

Note that this routine was written for CI-C86 calling conventions.
         
;
;	Newprn:  change standard printer device, by jay@rochester
;
;	newprn(devname)
;	    char *devname;
;
code	segment byte public
	assume cs:code
	public newprn
newprn:
	push	bp
        mov	bp,sp
        push	dx
        mov	dx,4[bp]
        mov	al,1		; printer is only for output
        mov	ah,3dh
        int	21h		; open named device
        push	cx
        push	bx
        push	ax
        mov	bx,ax
        mov	cx,4		; handle of standard printer
        mov	ah,46h
        int	21h		; force a dup of that handle on stdprn
        mov	ah,3eh
        int	21h		; close first device handle
        pop	ax
        pop	bx
        pop	cx
        pop	dx
        pop	bp
        ret
code	ends
	end

----------
Jay Weber
..!seismo!rlgvax!cvl!jcw
..!seismo!rochester!jay
jay@rochester.arpa