delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/07/01:33:16

Date: Wed, 07 Jun 1995 16:15:18 +1100
From: Bill Currie <BILLC AT teleng1 DOT tait DOT co DOT nz>
Subject: Re: libgrx.a corrupt?
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Organization: Tait Electronics Ltd.

> On a side note, how do I manipulate the PC speaker?  All I want is to be
> able to set frequency & duration, so I can have a good-beep and a bad-beep.

Here's the best I can do on short notice.
as code
movb $0xb6,%al # 10110110 chan 2 lsb,msb squarewave binary
outb %al,$0x43 # timer control port
movw count,%ax
outb %al,$0x42 # chanel 2 counter latch lsb
movb $ah,$al
outb %al,$0x42 # chanel 2 counter latch msb
# not certain about next lines
inb $0x61,%al
orb $3,%al # set bits 0,1
outb %al,$0x61 # turn on speeker (b 1?) and enable timer output (b 0?)
#wait a while
inb $0x61,%al
andb $0xfc,%al # clear bits 0,1
outb %al,$0x61 # turn of speeker (b 1?) and disable timer output (b 0?)

count is determined by 1193180/freq

hope this helps (not certain about port 0x61 and order of the bits 
but bits 0 and 1 are the right ones to use)

Bill

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019