[mod.mac.sources] modemDTR desk accessory sources

brian@ut-sally.UUCP (Brian H. Powell) (08/14/86)

     In a recent INFO-MAC, I mentioned that I had a desk accessory that
kept the new Mac+ serial driver from negating DTR the next time it was
closed.  I've had some requests for it, so here it is.
     This is useful when, for instance, you just want to quit a terminal
program for a short period of time without the modem hanging up.
     To use it, just select it inside your favorite terminal program.
It only works for the next time the driver is closed, so you'll have to
select it each time you want to quit the program and not hang up during
a modem session.
     This version is assembled to use the modem port.  To use it with
the printer port you can re-assemble it (making the obvious change to
the source).  A skilled ResEdit or FEdit user can find the -7 in the
code and change it to a -9, without needing to re-assemble it.
     I've tested it on a Mac+ and a 128K (that's RAM, not ROM) Mac.
(It faithfully beeped on the 128K Mac.)
     The .hqx file is being posted to mod.mac.binaries.  Here is a shar
file with the MDS assembly source, a link file and an rmaker file.

---
# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by sally!brian on Wed Aug 13 16:20:41 CDT 1986
# Contents:  modem.asm modem.link modem.r
 
echo x - modem.asm
sed 's/^@//' > "modem.asm" <<'@//E*O*F modem.asm//'
;------------------------
; modemDTR desk accessory
;	by Brian H. Powell	brian@sally.UTEXAS.EDU
;				cs.Powell@r20.UTEXAS.EDU
;				brian@ut-sally.UUCP
;
;	This desk accessory is used to tell the 128K ROM serial driver
;   to not negate DTR the next time it closes.  This is useful when you
;   want to quit a terminal program and not lose the connection.  (For
;   example, to change terminal programs or return to the Finder for
;   housekeeping.)  On a Macintosh with 64K ROMs, it just beeps.
;------------------------

	include	:equ_files:traps.txt
	include	:equ_files:sysequ.txt

OrnEntry
	dc.w	0		; We don't need time, need a goodbye kiss,
				;  or respond to control calls.
	dc.w	0		; We don't need time
	dc.w	0		; We don't respond to any events
	dc.w	0		; We don't have a menu

; offsets to driver routines:
	dc.w	OrnOpen-OrnEntry	; Open
	dc.w	done-OrnEntry		; Prime
	dc.w	done-OrnEntry		; Control
	dc.w	done-OrnEntry		; Status
	dc.w	done-OrnEntry		; Close

OrnTitle	dc.b	9,0
		dc.b	'modemDTR'
		.align	2

; The following are the driver reference numbers for the two output ports.
modemPort	equ	-7
printerPort	equ	-9

; We'll need 29 bytes for the parameter block.
paramblocksize	equ	29

;______________________________________________________________________

OrnOpen
	move.l	#paramblocksize,d0	; Create a pointer to a parameter
	_NewPtr				;   block.
	bne.s	error1			; If it failed, beep

	clr.l	ioCompletion(a0)	; no completion routine
	move.w	#modemPort,ioRefNum(a0)	; use the modem port
	move.w	#16,csCode(a0)		; secret code for this control call
	move.b	#$80,csParam(a0)	;  ditto
	_Control
	tst.w	d0			; Was there an error?
	bne.s	error2			; If so, release memory and beep
	_DisposPtr			; If not, release memory and return
	bra.s	done

error2	_DisposPtr
error1	move.w	#15,-(sp)		; if there was an error, beep.
	_SysBeep
done	rts

	end
@//E*O*F modem.asm//
chmod u=rw,g=r,o=r modem.asm
 
echo x - modem.link
sed 's/^@//' > "modem.link" <<'@//E*O*F modem.link//'

]

modem
/Output modem_DA
/Type 'TEMP'
$
@//E*O*F modem.link//
chmod u=rw,g=r,o=r modem.link
 
echo x - modem.r
sed 's/^@//' > "modem.r" <<'@//E*O*F modem.r//'
modem DA
DFILDMOV

TYPE DRVR = PROC
\0modemDTR ,25
modem_DA

@//E*O*F modem.r//
chmod u=rw,g=r,o=r modem.r
 
exit 0