Re: QB AND PC SPEAKER

 BBS: Inland Empire Archive
Date: 11-17-92 (06:42)             Number: 399
From: JAMES VAHN                   Refer#: 265
  To: TED NAJM                      Recvd: NO  
Subj: Re: QB AND PC SPEAKER          Conf: (2) Quik_Bas
VY>   -=> Quoting Ted Najm to Victor Yiu <=-

VY>   TN> WHAT I MEAN ABOUT ADRESS IS THAT EVERYTHING IN THE COPUTER
VY>   TN> HAS SO SORT OF ADRESS LIKE THE COMn PROMPT OR THE
VY>   TN> LPTn PROMPT. I KNOW
VY>   TN> THAT THE SPEAKER ISN'T ON THE COM OR LPT PORTS IT A SET OF BINARY
VY>   TN> STRINGS. I 'M ASKING WHAT THE STRINGS ARE IN QB LANGUAGE.

(The message is easier to read if you use lowercase.)

If I understand correctly, you want to turn the speaker on/off
with bit 1 at port 61h.  Setting bit 0 high controls the speaker
through bits 6 & 7 of port 43h. Setting bit 7 high and bit 6 low
of port 43h will permit sending the LSB,MSB of the frequency to
port 42h.  Ugh..  Here, look at this:


' Setup
        Old = INP(&H61)     ' 8255 PPI chip. Save the original.
        OUT &H43, 182       ' 8253 Timer chip. 10110110b Channel 2, mode 3
        Port = INP(&H61)    ' get the 8255 port contents and
        OUT &H61, Port OR 3 ' enable the speaker and use channel 2.

' Make the sound, square waves. Pity...
    FOR Pitch = 1 TO 100
        OUT &H42, &H0       ' LSB
        OUT &H42, Pitch     ' MSB
        FOR delay = 1 TO 500: NEXT
    NEXT

OUT &H61, Old  ' turn it off!


 * SLMR 2.1a *

--- Maximus 2.01wb
 * Origin: Inland Empire Archive (1:346/10)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET