Archived

This topic is now archived and is closed to further replies.

NexusOrganicus

pcspeaker outports//inports ? How to

Recommended Posts

NexusOrganicus    122
Hi gurus need some help about making sounds with the pc speaker maybe you could tell me how ? ore you have a link for me where i can read throuh ? I remember that there are some strange ports outport and inport but i don´t know the exact hexa dezi ________ thanks nxo

Share this post


Link to post
Share on other sites
FreiDog    122
http://www.ddj.com/ftp/1996/1996.05/directio.zip/TSTIO/TSTIO.C

all i had off hand.
basically you need to get very cozy with the intel 8254 PIT (programmable interutp timer) or atleast ports 0 and 2.

you need to then output the frequency of the sound to timer port2.

the freq is set in hertz, (the basis for a divsor is, 1193180hz, 4.77/4mhz)
the output value should be 1193180 / hz. (this of course gives you the cycle rate in seconds (or tiny fraction thereof), which is important, becuase the switcing is done by a timer)

out 43h, 0xb6 (10100110b)the reason for this (or more accuratly the meaning of the bits) is explained http://www.geocities.com/SiliconValley/Sector/7256/tutor/MHEART.TXT

to turn the speaker on you need to binary or port 61h with 0x03
in al, 61h
or al, 0x03
out 61h, 0x03

to turn it off you clear those bits.
mov bl, 0x03
not bl
and al, bl


[edited by - Freidog on April 29, 2003 5:28:24 AM]

Share this post


Link to post
Share on other sites