	Title 	Listing 1 - define the comm port for signal processing
;
;
SPport	equ	03fch		; for COM1
;	equ	02fch		; for COM2
SPdtr	equ	1		; Data Terminal Ready
SPrts	equ	2		; Request to Send

;---------------------------------------;
StartTimer	macro	 		; Timing Envelope Begin
	      ; push	ax		; optional, see note 1
	      ;	push	dx		; optional, see note 1
		mov	dx,SPport	; modem control port
		mov	al,SPdtr 	; DTR (outside envelope start)
	 	out	dx,al	 	; raise DTR on comm port
	      	jmp	short $+2	; optional, see note 2
	      ;	pop	dx		; optional, see note 1
	      ;	pop	ax		; optional, see note 1
		endm			; end of macro
;---------------------------------------;
StopTimer	macro	 		; Timing Envelope End
	      ; push	ax		; optional, see note 1
	      ;	push	dx		; optional, see note 1
		mov	dx,SPport	; modem control port
		mov	al,00h	 	; DTR (outside envelope start)
	 	out	dx,al	 	; drop DTR on comm port
	      	jmp	short $+2	; optional, see note 2
	      ;	pop	dx		; optional, see note 1
	      ;	pop	ax		; optional, see note 1
		endm			; end of macro
;---------------------------------------;
RoutineOn	macro	 		; Routine Timing Begin
	      ; push	ax		; optional, see note 1
	      ;	push	dx		; optional, see note 1
		mov	dx,SPport	; modem control port
		mov	al,SPdtr+SPrts 	; RTS (select signal)
	 	out	dx,al	 	; raise RTS on comm port
	      	jmp	short $+2	; optional, see note 2
	      ;	pop	dx		; optional, see note 1
	      ;	pop	ax		; optional, see note 1
		endm			; end of macro
;---------------------------------------;
RoutineOff	macro	 		; Routine Timing End
	      ; push	ax		; optional, see note 1
	      ;	push	dx		; optional, see note 1
		mov	dx,SPport	; modem control port
		mov	al,SPdtr 	; RTS (deselect signal)
	 	out	dx,al	 	; drop RTS on comm port
	      	jmp	short $+2	; optional, see note 2
	      ;	pop	dx		; optional, see note 1
	      ;	pop	ax		; optional, see note 1
		endm			; end of macro
;-----------------------------------------------------------------------;
;									;
;	Note 1	The pushing and popping will add some overhead to the	;
;		model, use only if the contents of either of the	;
;		registers must be preserved.				;
;									;
;	Note 2	This JMP just past itself is in effect a delay, not	;
;		in the cycle times it takes, but the affect it has	;
;		on the CPUs look-ahead buffer.				;
;									;
;-----------------------------------------------------------------------;

.MODEL SMALL
.STACK 100
.CODE

main	proc	near
	mov	ax,@data
	mov	ds,ax
	mov	es,ax
	;
	;	Housekeeping
	;
	call	process
	;
	;	process primed and ready to go
	;
	StartTimer
	;
	;	model outside of test routines
	;
	mov	bx,10h
loop_1:	call	process
	;
	;	routine under test
	;
	RoutineOn
	call	process
	RoutineOff
	;
	;	continue outside test routines
	;
	call	process
	dec	bx
	jnz	loop_1
	;
	;	process completed
	;
	StopTimer
	;
	;	Close and Exit
	;
	call	process

main_exit:
	mov	ax,04c00h
	int	21h

main	endp

process	proc	near
	mov	ax,10h
	xor	cx,cx
p1loop:	loop	p1loop
	dec	ax
	jnz	p1loop
	ret
process	endp

	end	main
