|
| Reset the Aux rs232 port.  Usage:
|	char	*rs232_iorec = Iorec(0);	|* Do this first	*|
|
|	if (rs232_reset())
|	    Cauxout(0x11);			|* sent an XOFF		*|
|
| This subroutine was written by Martin Minow, Arlington, MA
| and is in the public domain.
|
|	.shrd				| Public data
|	.globl	rs232_iorec_		| -> aux io record. see below
	.text				| Public instructions
	.globl	_rs232_reset

_rs232_reset:
	movl	d2,sp@-			| Save a scratch register
	clrl	sp@-			| Super(0L) switches to super mode
	movw	#0x20,sp@-		| Super opcode
	trap	#1			| Call TOS
	addqw	#6,sp			| Clear stack
	movl	d0,sp@-			| Save old stack for now.
|
| If you don't already have the iorec as a readily-available global,
| uncomment the following code (which is, of course, untested)
|
	clrw	sp@-			| Aux port is device zero
	movw	#14,sp@-		| Iorec
	trap	#14			| Xbios(14)
	addqw	#4,sp			| Clear stack
| End of "get iorec" code. We already have this information:
|	movl	rs232_iorec_,a0		| a0 -> I|O record
	movl	d0,a0			| a0 -> I|O record
	movw	sr,sp@-			| Save cpu status
	orw	#0x700,sr		| Disable interrupts
|	clrl	a0@(6)			| Clear input  head, tail -- crashes
	clrl	a0@(20)			| Clear output head, tail
	clrl	d2			| Clear result
	orb	a0@(30),d2		| Get old rcv xoff state
	clrw	a0@(30)			| Cancel rcv, xmt xoff states
	movw	sp@+,sr			| Enable interrupts
	movw	#0x20,sp@-		| Super -- old_stack is still at (sp)
	trap	#1			| Exit super mode
	addqw	#6,sp			| Clean junk from stack
	movl	d2,d0			| Get result
	movl	sp@+,d2			| Restore d2	
	rts				| Exit routine
