' TON.BAS -- PC-Speaker ueber Port 42h, 42h, 61h = Gottes Sprachrohr
DECLARE SUB Ton(Frequenz AS UINTEGER, DauerMS AS UINTEGER)

SUB Ton(Frequenz AS UINTEGER, DauerMS AS UINTEGER)
   DIM Teiler AS UINTEGER
   IF Frequenz < 20 ORELSE Frequenz > 32768 THEN 
      'Blasphemie!
      EXIT SUB
   END IF

   Teiler = 1193180 \ Frequenz       ' gott gegebene Zeit (PIT)

   OUT &H43, &HB6                    ' kanal 2, Viereck Welle
   OUT &H42, Teiler AND &HFF         ' niederes Byte
   OUT &H42, (Teiler \ 256) AND &HFF ' hohes byte
   OUT &H61, INP(&H61) OR &H03       ' gott spricht

   Sleep DauerMS

   OUT &H61, INP(&H61) AND &HFC      ' gott schweigt
END SUB
