{  CHROMA     by Robert Kemmetmueller }

{$C-}
{
 This is the Turbo Pascal include-file for the speech driver.  The
 parameter S must be a character string containing valid phoneme codes:

   CODE   SOUND  (capitalized in sample word)
   ----   -----
    A     mAke   = m-A-k             AE    bAt    = b-AE-t
    AH    cAr    = k-AH-r            AW    dOg    = d-AW-g
    B     Bat    = B-ae-t            CH    CHeese = CH-ee-z
    D     Dog    = D-aw-g            EE    bE     = b-EE
    EH    bEt    = b-EH-t            F     raFt   = r-ae-F-t
    G     Go     = G-oh              H     Hive   = H-i-v
    I     tIme   = t-I-m             IH    sIt    = s-IH-t
    J     Jet    = J-eh-t            K     Kill   = K-ih-l
    L     Love   = L-uh-v            M     Map    = M-ae-p
    N     Nab    = N-ae-b            OH    gO     = g-OH
    OO    gOO    = g-OO              P     Pat    = P-ae-t
    R     Rat    = R-ae-t            S     Sat    = S-ae-t
    SH    SHe    = SH-ee             T     Tap    = T-ae-p
    TH    THin   = TH-ih-n           TZ    THis   = TZ-ih-s
    U     wOrd   = w-U-r-d           UH    bUt    = b-UH-t
    V     Vat    = V-ae-t            W     With   = W-ih-th
    WH    WHich  = WH-ih-ch          Y     Yes    = Y-eh-s
    Z     Zap    = Z-ae-p            ZH    viSion = v-ih-ZH-eh-n
    -     inter-phoneme separator    space  inter-word pause
}

Type
    SpeechString = String[255];
    Line= Array[1..80] of Integer;
    Screen= Array[1..17] of Line;
    MouthData= Array[1..7] of Integer;
    EyesData= Array[1..17] of Integer;
    String7= String[7];

Var
    Disk: File of Screen;
    Scrn: Screen Absolute $B800:$0000;
    I,J,K,L: Integer;
    Mouth: Array[0..3] of MouthData;
    Eyes: Array[0..3] of EyesData;
    Mout: MouthData Absolute $B800:2154;
    Eye: EyesData Absolute $B800:1184;

Procedure Speech(S: SpeechString);                     External 'SPEECH.BIN';

Procedure MakeMouth(I: Integer; St: String7);
    Var J: Integer;
    Begin
        For J:=1 to 7 do
            Mouth[I,J]:=116*256+Ord(St[J]);
        end;

Procedure PutMouth(I: Integer);
    Begin
        Mout:=Mouth[I];
        end;

Procedure PutEyes(I: Integer);
    Begin
        Eye:=Eyes[I];
        end;

Procedure Wait;
    Begin
        end;

BEGIN
    TextMode(C80); TextColor(15); TextBackground(0); ClrScr;
    Assign(Disk,'CHROMA.PIC'); Reset(Disk);
    Read(Disk,Scrn); Close(Disk);
    MakeMouth(0,'ÄÍÍÄÍÍÄ');
    MakeMouth(1,'ÄÜÛÜÛÜÄ');
    MakeMouth(2,'ÜÛÛÛÛÛÜ');
    MakeMouth(3,' ÄÜÛÜÄ ');
    For I:=0 to 3 do Eyes[I]:=Eye;
    For I:=0 to 3 do begin
        Eyes[1,I+2]:=Eyes[0,I+3]; Eyes[1,I+12]:=Eyes[0,I+13];
        Eyes[2,I+3]:=Eyes[0,I+2]; Eyes[2,I+13]:=Eyes[0,I+12];
        end;
    For I:=0 to 4 do begin
        If (I=0) or (I=4) then begin Eyes[3,I+2]:=7*256+220; Eyes[3,I+12]:=7*256+220; end
        Else begin Eyes[3,I+2]:=Eyes[0,I+2]+256*16*7; Eyes[3,I+12]:=Eyes[0,I+12]+256*16*7; end;
        end;
    GotoXY(32,20); Writeln('Welcome, Humanoid');
    PutEyes(0); PutMouth(3); Speech('W');
    PutEyes(3); PutMouth(1); Speech('eh-l');
    PutEyes(0); PutMouth(2); Speech('k-uh');
    PutEyes(1); PutMouth(0); Speech('m ');
    PutEyes(3); PutMouth(2); Speech('H-ee');
    PutEyes(0); PutMouth(3); Speech('oo');
    PutMouth(0); Speech('m');
    PutMouth(1); Speech('eh-n');
    PutEyes(2); PutMouth(3); Speech('oh-i-d');
    PutEyes(0); PutMouth(0); Speech('  ');
    GotoXY(20,21); Write('I am Chroma, ');
    PutMouth(2); Speech('I');
    PutMouth(0); Speech(' ');
    PutMouth(1); Speech('Eh-m');
    PutMouth(0); Speech(' ');
    PutMouth(1); Speech('K-r');
    PutMouth(3); Speech('oh');
    PutMouth(0); Speech('mm');
    PutMouth(2); Speech('ah');
    PutMouth(0); Speech('  ');
    Write('your computer'#39's worst nightmare');
    PutEyes(3); PutMouth(3); Speech('Y');
    PutEyes(0); PutMouth(1); Speech('oh-r');
    PutMouth(0); Speech(' ');
    PutMouth(2); Speech('K-ah');
    PutMouth(0); Speech('m');
    PutEyes(3); PutMouth(1); Speech('p-ee');
    PutEyes(0); PutMouth(3); Speech('oo');
    PutEyes(1); PutMouth(2); Speech('t-u-r-z');
    PutEyes(0); PutMouth(0); Speech(' ');
    PutMouth(3); Speech('W');
    PutMouth(2); Speech('u-r-s-t');
    PutMouth(0); Speech(' ');
    PutMouth(1); Speech('N-i-t');
    PutMouth(0); Speech('m');
    PutEyes(2); PutMouth(2); Speech('a-r');
    PutEyes(0); PutMouth(0); Speech('   ');
    GotoXY(36,23); Writeln('Ha-a-a-a-a!');
    PutEyes(3); PutMouth(2); Speech('H-ah-ah-ah-ah-ah');
    PutEyes(0); PutMouth(0);
    ClrScr;
    END.