[A83] Re: help with sound


[Prev][Next][Index][Thread]

[A83] Re: help with sound




At 21:12 2002-01-27, you wrote:
>ok, i found a sound routine in the old sos lib, but i don't understand how 
>it works with the frequency.  this code beeps until you press enter, but 
>how does it know what frequency?
>start:
>     ld  c,69 ;c is the frequency
>     ld  b,255 ;b is the duration
>beep:   di ;disable interrupts
>     ld  e,$D0
>
>beepl1: ld  a,c

these two lines:

>beepl2: dec a
>     jr  nz,beepl2

a delay betweem each toggle of the output.
so 69 isn't the real frequency it runs at, its just a delay.
the higher value, the lower frequency.

>     ld  a,e
>     xor %00000011  <-- this toggles the link pins, from high to low or 
> low to high
>     ld  e,a
>     out (0),a
>     djnz    beepl1
>     ei
>     bcall(_getk)
>     jp  z,start
>     ret
>.end
>END


///Olle





References: