/* Sounds speaker */

#include <wesson.h>

void sound(int freq, int duration)
{
	_asm \
	{
	mov   al,   0B6h
	out   43h,  al
	mov   dx,   12h
	mov   ax,   34DEh
	div   freq
	out   42h,  al
	mov   al,   ah
	out   42h,  al
	in    al,   61h
	or    al,   3
	out   61h,  al
	}

	delay((clock_t)duration);

	_asm \
	{
	in    al,   61h
	xor   al,   3
	out   61h,  al
	}
}


