
	assume cs:_text
_text	segment public byte 'code'
	public _soundon

_soundon  proc near
	push bp
	mov bp,sp
	mov cx,[bp+4]		; get frequency

	mov dx,12		; upper part of numerator
	mov ax,343eh		; lower part of numerator
	div cx			; Divide specified frequency into
				; 1,193,182 hz clock freq used by timer
	mov cx,ax		; result in ax

	mov al,cl		; lower byte out to timer
	out 42h,al
	mov al,ch		; high byte out to timer
	out 42h,al

	in al,61h		; get contents of system port b
	or al,3 		; turn speaker and timer on
	out 61h,al		; send out new values to port b

	mov sp,bp
	pop bp
	ret
_soundon  endp
_text	ends
end
